MAK Data Logger API Documentation for HLA
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
remoteControlInterface.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 1992-2010 VT MAK
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 
11 #pragma once
12 
14 
16 
17 #include <vlutil/vlString.h>
18 #include <vlpi/entityIdentifier.h>
19 #include <vlutil/vlInetSocket.h>
20 
21 #include <list>
22 #include <map>
23 #include <set>
24 
25 class DtExerciseConn;
26 class DtInteraction;
27 class DtLgrControlPdu;
28 class DtEntityIdentifier;
30 class DtLgrConnectPdu;
31 class DtLgrDisconnectPdu;
33 class DtLgrResponsePdu;
34 class DtLgrTotalStatePdu;
35 class DtInetSocket;
36 
37 namespace MAKLogger
38 {
39  class DtAbsoluteTime;
40  class DtRelativeTime;
41  class DtCommand;
42  class DtRemoteControlDomainInterface;
43  class DtRemoteControlSystemInterface;
44  class DtRemoteControlPlaybackInterface;
45  class DtRemoteControlRecordInterface;
46  class DtRemoteControlEditorInterface;
47  class DtRemoteControlSimulationInterface;
49 
50  typedef DtU32 DtSequenceNumber;
51  typedef std::set<DtSequenceNumber> DtSequenceNumberSet;
52  typedef std::set<DtEntityIdentifier> DtEntityIdSet;
53 
54  typedef void (*DtLgrConnectCb)( DtLgrConnectPdu* connect, void* usr );
55  typedef void (*DtLgrDisconnectCb)( DtLgrDisconnectPdu* connect, void* usr );
56  typedef void (*DtLgrLgrHeartbeatCb)( DtLgrLgrHeartbeatPdu* connect, void* usr );
57  typedef void (*DtLgrAcknowledgeCb)( DtLgrAcknowledgePdu* connect, void* usr );
58  typedef void (*DtLgrResponseCb)( DtLgrResponsePdu* connect, void* usr );
59  typedef void (*DtLgrTotalStateCb)( DtLgrTotalStatePdu* connect, void* usr );
60  typedef void (*DtLgrConnectionAddedCb)( const DtRemoteLoggerConnection& loggerConnection, void* usr );
61  typedef void (*DtLgrConnectionRemovedCb)( const DtRemoteLoggerConnection& loggerConnection, void* usr );
62  typedef void (*DtLgrConnectionTimedOutCb)( const DtRemoteLoggerConnection& loggerConnection, void* usr );
63 
64  typedef void (*DtLgrCommandAcceptedCb)( DtSequenceNumber sequenceNumber, void* usr );
65  typedef void (*DtLgrCommandRejectedCb)(const DtEntityIdentifier& source, DtSequenceNumber sequenceNumber, void* usr );
66  typedef void (*DtLgrCommandTimedOutCb)( DtSequenceNumber sequenceNumber, void* usr );
67 
68 
74  {
75  public:
79  DtRemoteControlInterface(int numberOfLoggersToManage=0);
80 
82  virtual ~DtRemoteControlInterface();
83 
84  private:
89 
90  public:
91 
93  virtual void setConnection(DtExerciseConn* exconn, const DtEntityIdentifier& entityId);
94 
96  virtual void setConnection(const DtEntityIdentifier& id, DtInetSocket* socket);
97 
100  virtual void clearConnection();
101 
103  virtual void disconnect(const DtEntityIdentifier& entityId);
104 
106  virtual void tick();
107 
109  virtual void setId( const DtEntityIdentifier& id );
111  virtual const DtEntityIdentifier& id() const;
113 
115  virtual void setAcceptAnyId( bool acceptAny);
117  virtual bool acceptAnyId() const;
119 
121  virtual DtTime connectionTimeout() const;
123  virtual void setConnectionTimeout(DtTime val);
125 
127  virtual DtTime acknowledgeTimeout() const;
129  virtual void setAcknowledgeTimeout(DtTime val);
131 
133  virtual void setNumberOfLoggers(int numberOfLoggersToManage);
135  virtual int numberOfLoggers() const;
137 
139  virtual void setPassivelyAccepting(bool enablePassivelyAccept);
141  virtual bool isPassivelyAccepting() const;
143 
145  virtual void getConnectionIds(DtEntityIdSet& connectedLoggers) const;
146 
148  virtual void getConnectionIds(DtEntityIdSet& connectedLoggers,
149  const DtEntityIdentifier& idFilter) const;
150 
152  virtual int numberConnections() const;
153 
155  virtual DtRemoteLoggerConnection* getConnection(const DtEntityIdentifier& id);
156 
158  virtual DtTime lowestTime() const;
159 
161  virtual DtTime highestTime() const;
162 
164 
165  virtual DtRemoteControlSystemInterface* systemInterface();
166  virtual DtRemoteControlPlaybackInterface* playbackInterface();
167  virtual DtRemoteControlRecordInterface* recordInterface();
168  virtual DtRemoteControlEditorInterface* editorInterface();
169  virtual DtRemoteControlSimulationInterface* simulationInterface();
170  virtual DtRemoteControlSharedInterface* sharedInterface();
172 
177  virtual DtSequenceNumber sendCommandMessage(const DtCommand& command,
178  const DtEntityIdentifier& target=theWildcardAddress);
179 
185  virtual DtSequenceNumber sendCommandMessage(const DtCommand& command,
186  DtRemoteControlDomainInterface* domainInterface,
187  const DtEntityIdentifier& target=theWildcardAddress);
188 
193  virtual DtSequenceNumber sendLoggerControlMessage(DtLgrControlPdu& lgrControl,
194  const DtEntityIdentifier& target=theWildcardAddress);
195 
201  virtual DtSequenceNumber sendLoggerControlMessage(DtLgrControlPdu& lgrControl,
202  DtRemoteControlDomainInterface* domainInterface,
203  const DtEntityIdentifier& target=theWildcardAddress);
204 
206 
207  virtual void addCallback( DtLgrConnectCb cb, void* user );
208  virtual void removeCallback( DtLgrConnectCb );
209 
210  virtual void addCallback( DtLgrDisconnectCb cb, void* user );
211  virtual void removeCallback( DtLgrDisconnectCb );
212 
213  virtual void addCallback( DtLgrLgrHeartbeatCb cb, void* user );
214  virtual void removeCallback( DtLgrLgrHeartbeatCb );
215 
216  virtual void addCallback( DtLgrAcknowledgeCb cb, void* user );
217  virtual void removeCallback( DtLgrAcknowledgeCb );
218 
219  virtual void addCallback( DtLgrResponseCb cb, void* user );
220  virtual void removeCallback( DtLgrResponseCb );
221 
222  virtual void addCallback( DtLgrTotalStateCb cb, void* user );
223  virtual void removeCallback( DtLgrTotalStateCb );
224 
225  virtual void addCallbackConnectionAdded( DtLgrConnectionAddedCb cb, void* user );
226  virtual void removeCallbackConnectionAdded( DtLgrConnectionAddedCb );
227 
228  virtual void addCallbackConnectionRemoved( DtLgrConnectionRemovedCb cb, void* user );
229  virtual void removeCallbackConnectionRemoved( DtLgrConnectionRemovedCb );
230 
231  virtual void addCallbackConnectionTimedOut( DtLgrConnectionTimedOutCb cb, void* user );
232  virtual void removeCallbackConnectionTimedOut( DtLgrConnectionTimedOutCb );
233 
234  virtual void addCallbackCommandAccepted( DtLgrCommandAcceptedCb cb, void* user );
235  virtual void removeCallbackCommandAccepted( DtLgrCommandAcceptedCb );
236 
237  virtual void addCallbackCommandRejected( DtLgrCommandRejectedCb cb, void* user );
238  virtual void removeCallbackCommandRejected( DtLgrCommandRejectedCb );
239 
240  virtual void addCallbackCommandTimedOut( DtLgrCommandTimedOutCb cb, void* user );
241  virtual void removeCallbackCommandTimedOut( DtLgrCommandTimedOutCb );
242 
244 
245  public:
246 
248  static const DtEntityIdentifier& wildcardAddress();
249 
251  static const char* commandToString(int domain, int command);
252 
253  const DtRemoteLoggerMap& getMyRemoteLoggerMap() const;
254 
255  protected:
256 
258  virtual void lgrCtrlCallback( DtInteraction* );
259 
261  virtual void processControlPdus();
262 
264  virtual void processBackChannel();
265 
267  virtual void checkConnections();
268 
270  virtual bool isIdMatching(const DtEntityIdentifier& targetId, bool allowWildCard=true);
271 
273  virtual DtSequenceNumber nextSequenceNumber();
274 
276 
277  virtual void processTotalState(DtLgrTotalStatePdu* totalStatePdu);
278  virtual void processConnect(DtLgrConnectPdu* connectPdu);
279  virtual void processDisconnect(DtLgrDisconnectPdu* disconnectPdu);
280  virtual void processLgrHeartbeat(DtLgrLgrHeartbeatPdu* lgrHeartbeatPdu);
281  virtual void processAcknowledge(DtLgrAcknowledgePdu* acknowledgePdu);
282  virtual void processResponse(DtLgrResponsePdu* responsePdu);
284 
286  virtual void commandAccepted(DtSequenceNumber sequenceNumber);
287 
289  virtual void commandRejected(const DtEntityIdentifier& source, DtSequenceNumber sequenceNumber);
290 
292  virtual void commandTimedOut(DtSequenceNumber sequenceNumber);
293 
295  virtual void sendMessage(const DtLgrControlPdu& message);
296 
297  protected:
298 
300  static void lgrCtrlCb( DtInteraction*, void* );
301 
302  protected:
303 
305  typedef struct DtPendingAcknowledge
306  {
307  DtTime timeout;
310 
311  typedef std::map<DtSequenceNumber, DtPendingAcknowledge> DtPendingAcknowledgeList;
312  typedef std::map<DtSequenceNumber, DtTime> DtRejectCommandList;
313  typedef std::map<DtSequenceNumber, DtRemoteControlDomainInterface*> DtAcknowledgeDomainMap;
314 
315  typedef std::list<DtLgrControlPdu*> DtPduList;
316 
317  protected:
318 
319 
321  DtInetSocket* myBackChannelConnection;
322  DtInetBuffer myBackChannelBuffer;
323  DtEntityIdentifier myId;
337  DtClock myClock;
339 
340  std::map<DtLgrConnectCb, void*> myConnectCallbacks;
341  std::map<DtLgrDisconnectCb, void*> myDisconnectCallbacks;
342  std::map<DtLgrAcknowledgeCb, void*> myAcknowledgeCallbacks;
343  std::map<DtLgrResponseCb, void*> myResponseCallbacks;
344  std::map<DtLgrTotalStateCb, void*> myTotalStateCallbacks;
345  std::map<DtLgrLgrHeartbeatCb, void*> myHeartbeatCallbacks;
346  std::map<DtLgrConnectionAddedCb, void*> myConnectionAddedCallbacks;
347  std::map<DtLgrConnectionRemovedCb, void*> myConnectionRemovedCallbacks;
348  std::map<DtLgrConnectionTimedOutCb, void*> myConnectionTimedOutCallbacks;
349  std::map<DtLgrCommandAcceptedCb, void*> myCommandAcceptedCallbacks;
350  std::map<DtLgrCommandRejectedCb, void*> myCommandRejectedCallbacks;
351  std::map<DtLgrCommandTimedOutCb, void*> myCommandTimedOutCallbacks;
352 
359 
360  protected:
361  static const DtU16 theAddressWildcard = ((1<<16)-1); // 65535 or 0xFFFF
362  static const DtEntityIdentifier theWildcardAddress;
363 
364  };
365 }
The logger command which contains the command type and its parameters.
Definition: lgrCommand.h:109
std::map< DtLgrLgrHeartbeatCb, void * > myHeartbeatCallbacks
Definition: remoteControlInterface.h:345
DtSequenceNumber mySequenceNumber
Definition: remoteControlInterface.h:324
int myNumberOfLoggers
Definition: remoteControlInterface.h:335
DtInetBuffer myBackChannelBuffer
Definition: remoteControlInterface.h:322
void(* DtLgrConnectionRemovedCb)(const DtRemoteLoggerConnection &loggerConnection, void *usr)
Definition: remoteControlInterface.h:61
DtRemoteControlSimulationInterface * mySimulationInterface
Definition: remoteControlInterface.h:357
std::map< DtSequenceNumber, DtPendingAcknowledge > DtPendingAcknowledgeList
Definition: remoteControlInterface.h:311
std::list< DtLgrControlPdu * > DtPduList
Definition: remoteControlInterface.h:315
std::map< DtSequenceNumber, DtTime > DtRejectCommandList
Definition: remoteControlInterface.h:312
std::set< DtEntityIdentifier > DtEntityIdSet
Definition: remoteControlInterface.h:52
Instances of DtLgrTotalStatePdu are used to convey to a remote logger- controller the total current s...
Definition: lcTotalState.h:43
DtEntityIdSet myRejectedLoggerIds
Definition: remoteControlInterface.h:328
Instances of DtRemoteLoggerConnection are a family of messages used to control a remote instance of t...
Definition: lcRemoteLoggerConnection.h:27
DtRemoteLoggerMap myRemoteLoggers
Definition: remoteControlInterface.h:326
DtClock myClock
Definition: remoteControlInterface.h:337
Instances of DtLgrDisconnectPdu are used to convey to a remote logger- controller the total current s...
Definition: lcDisconnect.h:25
DtRemoteControlSystemInterface * mySystemInterface
Definition: remoteControlInterface.h:353
#define DT_DLL_LGR_RCI
Definition: lgrRemoteControlInterface.h:18
static const DtEntityIdentifier theWildcardAddress
Definition: remoteControlInterface.h:362
std::map< DtLgrConnectionRemovedCb, void * > myConnectionRemovedCallbacks
Definition: remoteControlInterface.h:347
Contains DtRemoteLoggerConnection.
bool myAcceptAnyId
Definition: remoteControlInterface.h:329
DtTime myConnectionTimeout
Definition: remoteControlInterface.h:330
void(* DtLgrResponseCb)(DtLgrResponsePdu *connect, void *usr)
Definition: remoteControlInterface.h:58
DtRemoteControlPlaybackInterface * myPlaybackInterface
Definition: remoteControlInterface.h:354
std::map< DtLgrCommandTimedOutCb, void * > myCommandTimedOutCallbacks
Definition: remoteControlInterface.h:351
std::map< DtLgrCommandRejectedCb, void * > myCommandRejectedCallbacks
Definition: remoteControlInterface.h:350
Primary interface to remote loggers.
Definition: remoteControlInterface.h:73
DtTime timeout
Definition: remoteControlInterface.h:307
DtRejectCommandList myRejectedCommands
Definition: remoteControlInterface.h:333
DtEntityIdSet myRemoteLoggerIds
Definition: remoteControlInterface.h:327
void(* DtLgrLgrHeartbeatCb)(DtLgrLgrHeartbeatPdu *connect, void *usr)
Definition: remoteControlInterface.h:56
DtAcknowledgeDomainMap myAcknowledgeInterface
Definition: remoteControlInterface.h:336
void(* DtLgrConnectCb)(DtLgrConnectPdu *connect, void *usr)
Definition: remoteControlInterface.h:54
void(* DtLgrConnectionAddedCb)(const DtRemoteLoggerConnection &loggerConnection, void *usr)
Definition: remoteControlInterface.h:60
Responsible for invoking simulation commands and processing simulation responses. ...
Definition: remoteControlSimulationInterface.h:21
DtRemoteControlRecordInterface * myRecordInterface
Definition: remoteControlInterface.h:355
DtU32 DtSequenceNumber
Definition: remoteControlInterface.h:48
std::map< DtLgrConnectCb, void * > myConnectCallbacks
Definition: remoteControlInterface.h:340
Base class for handling commands and responses.
Definition: remoteControlDomainInterface.h:27
DtExerciseConn * myExerciseCon
Definition: remoteControlInterface.h:320
std::map< DtLgrAcknowledgeCb, void * > myAcknowledgeCallbacks
Definition: remoteControlInterface.h:342
void(* DtLgrConnectionTimedOutCb)(const DtRemoteLoggerConnection &loggerConnection, void *usr)
Definition: remoteControlInterface.h:62
Entry for pending acknowledgment.
Definition: remoteControlInterface.h:305
Instances of DtLgrControlPdu are a family of messages used to control a remote instance of the MAK-Lo...
Definition: lcPdu.h:137
DtPendingAcknowledgeList myPendingAcknowledgements
Definition: remoteControlInterface.h:332
DtEntityIdSet pending
Definition: remoteControlInterface.h:308
DtTime myNextTimeoutCheck
Definition: remoteControlInterface.h:331
Instances of DtLgrLgrHeartbeatPdu are used for fault tolerance indicating that the logger is still ac...
Definition: lcLgrHeartbeat.h:18
std::map< DtLgrConnectionAddedCb, void * > myConnectionAddedCallbacks
Definition: remoteControlInterface.h:346
std::set< DtSequenceNumber > DtSequenceNumberSet
Definition: remoteControlInterface.h:51
void(* DtLgrCommandAcceptedCb)(DtSequenceNumber sequenceNumber, void *usr)
Definition: remoteControlInterface.h:64
class DT_DLL_MATREX_TSPI_FOM_MAP DtInteraction
Definition: matrexTspiTagModifier.h:20
void(* DtLgrTotalStateCb)(DtLgrTotalStatePdu *connect, void *usr)
Definition: remoteControlInterface.h:59
DtPduList myPduList
Definition: remoteControlInterface.h:325
bool myPassivelyAccepting
Definition: remoteControlInterface.h:338
DtInetSocket * myBackChannelConnection
Definition: remoteControlInterface.h:321
DtRemoteControlSharedInterface * mySharedInterface
Definition: remoteControlInterface.h:358
DtTime MyAcknowledgeTimeout
Definition: remoteControlInterface.h:334
class DT_DLL_LGRUTIL DtAbsoluteTime
Definition: absoluteTime.h:22
std::map< DtSequenceNumber, DtRemoteControlDomainInterface * > DtAcknowledgeDomainMap
Definition: remoteControlInterface.h:313
std::map< DtLgrTotalStateCb, void * > myTotalStateCallbacks
Definition: remoteControlInterface.h:344
Instances of DtLgrResponsePdu are to respond to a remote controller with the result of a logger comma...
Definition: lcResponse.h:19
std::map< DtLgrResponseCb, void * > myResponseCallbacks
Definition: remoteControlInterface.h:343
std::map< DtEntityIdentifier, DtRemoteLoggerConnection > DtRemoteLoggerMap
Collection of remote logger connections.
Definition: lcRemoteLoggerConnection.h:210
Responsible for invoking editor commands and processing editor responses.
Definition: remoteControlEditorInterface.h:27
Responsible for invoking shared commands and processing shared responses.
Definition: remoteControlSharedInterface.h:22
void(* DtLgrAcknowledgeCb)(DtLgrAcknowledgePdu *connect, void *usr)
Definition: remoteControlInterface.h:57
Instances of DtLgrAcknowledgePdu are to respond to a remote controller with the result of a logger co...
Definition: lcAcknowledge.h:24
Contains lgrRemoteControlInterface library definitions.
std::map< DtLgrDisconnectCb, void * > myDisconnectCallbacks
Definition: remoteControlInterface.h:341
std::map< DtLgrConnectionTimedOutCb, void * > myConnectionTimedOutCallbacks
Definition: remoteControlInterface.h:348
Responsible for invoking system commands and processing system responses.
Definition: remoteControlSystemInterface.h:21
Responsible for invoking playback commands and processing playback responses.
Definition: remoteControlPlaybackInterface.h:29
DtEntityIdentifier myId
Definition: remoteControlInterface.h:323
void(* DtLgrDisconnectCb)(DtLgrDisconnectPdu *connect, void *usr)
Definition: remoteControlInterface.h:55
void(* DtLgrCommandRejectedCb)(const DtEntityIdentifier &source, DtSequenceNumber sequenceNumber, void *usr)
Definition: remoteControlInterface.h:65
DtRemoteControlEditorInterface * myEditorInterface
Definition: remoteControlInterface.h:356
void(* DtLgrCommandTimedOutCb)(DtSequenceNumber sequenceNumber, void *usr)
Definition: remoteControlInterface.h:66
std::map< DtLgrCommandAcceptedCb, void * > myCommandAcceptedCallbacks
Definition: remoteControlInterface.h:349
Instances of DtLgrConnectPdu are used to convey to a remote logger- controller the total current stat...
Definition: lcConnect.h:26
Responsible for invoking record commands and processing record responses.
Definition: remoteControlRecordInterface.h:26

Document ID: Generated on Thu Jul 14 15:45:33 EDT 2022 from SVN revision 244827
Copyright © 2021 MAK Technologies. All Rights Reserved (www.mak.com)