forked from atsommer/Simplicio
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimplicioServer.cpp
More file actions
115 lines (102 loc) · 3.04 KB
/
Copy pathSimplicioServer.cpp
File metadata and controls
115 lines (102 loc) · 3.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#include "stdafx.h"
//#using <DataStructures.dll>
#include "SimplicioServer.h"
#include "Form1.h"
namespace forms2{
//using namespace DataStructures;
//using namespace System::Collections::Generic;
using namespace System::Runtime::Remoting;
using namespace System::Runtime::Remoting::Channels;
using namespace System::Runtime::Remoting::Channels::Tcp;
SimplicioServer::SimplicioServer(Form1^ f){
mainForm=f;
setNextTimeMainForm = gcnew DelegateTime(f,&Form1::setNextTime);
seqStartedMainForm = gcnew DelegateVars(f,&Form1::sequenceStarted);
connect();
}
void SimplicioServer::connect(){
//RemotingConfiguration::Configure("forms2.exe.config",false);
try{
TcpChannel^ tcpChannel = gcnew TcpChannel(5678);
ChannelServices::RegisterChannel(tcpChannel, false);
ObjRef^ objRef = RemotingServices::Marshal(this, "serverCommunicator");
}catch(Exception^){}
}
bool SimplicioServer::armTasks()
{
return true;
}
ServerCommunicator::BufferGenerationStatus SimplicioServer::generateBuffers(int listIterationNumber)
{
return ServerCommunicator::BufferGenerationStatus::Success;
}
bool SimplicioServer::generateTrigger()
{
return true;
}
List<HardwareChannel>^ SimplicioServer::getHardwareChannels()
{
return gcnew List<HardwareChannel>();
}
String^ SimplicioServer::getServerName()
{
return "Simplicio Server";
}
ServerSettingsInterface^ SimplicioServer::getServerSettings()
{
return gcnew ServerSettingsInterface();
}
void SimplicioServer::nextRunTimeStamp(DateTime timeStamp)
{
array<Object^>^ parameters = gcnew array<Object^>(1);
parameters[0] = timeStamp;
mainForm->BeginInvoke(setNextTimeMainForm, parameters);
}
bool SimplicioServer::outputGPIBGroup(GPIBGroup^ gpibGroup, SettingsData^ settings)
{
return true;
}
bool SimplicioServer::outputRS232Group(RS232Group^ rs232Group, SettingsData^ settings)
{
return true;
}
bool SimplicioServer::outputSingleTimestep(SettingsData^ settings, SingleOutputFrame^ output)
{
return true;
}
bool SimplicioServer::ping()
{
//messageLog(this, new MessageEvent("Received PING from client."));
return true;
}
bool SimplicioServer::runSuccess()
{
return true;
}
bool SimplicioServer::setSequence(SequenceData^ sequence)
{
List<Variable^>^ vars = sequence->Variables;
LinkedList<Variable^>^ listVars = gcnew LinkedList<Variable^>();
int count(0);
for each(Variable^ var in vars){
if (var->ListDriven){
Variable^ newVar = gcnew Variable();
newVar->VariableValue = var->VariableValue;
newVar->VariableName = var->VariableName;
listVars->AddLast(newVar);
count++;
}
}
array<Object^>^ parameters = gcnew array<Object^>(1);
parameters[0] = listVars;
mainForm->BeginInvoke(seqStartedMainForm, parameters);
return true;
}
bool SimplicioServer::setSettings(SettingsData^ settings)
{
return true;
}
void SimplicioServer::stop()
{
}
}