VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtCigiNetworkIO.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 2025 MaK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvCigi/vrvCigi.h>
18 
20 
21 #include <vlutil/vlInetSocket.h>
22 
23 #include <CigiTypes.h>
24 #include <CigiVersionID.h>
25 
26 class CigiHatHotRespV3_2;
27 class CigiHatHotRespV4;
28 class CigiLosRespV3_2;
29 class CigiLosRespV4;
30 class CigiLosXRespV3_2;
31 class CigiLosXRespV4;
32 class CigiPositionRespV3;
33 class CigiPositionRespV4;
34 class CigiCollDetSegRespV3;
35 class CigiCollDetSegRespV4;
36 class CigiHatHotRespV3_2;
37 class CigiHatHotRespV4;
38 class CigiHatHotXRespV3_2;
39 class CigiHatHotXRespV4;
40 class CigiSensorRespV3;
41 class CigiSensorRespV4;
42 class CigiSensorXRespV3;
43 class CigiSensorXRespV4;
44 
45 class DtInetSocket;
46 class DtInetSocketMgr;
47 class DtInetTcpSocket;
48 class CigiIGSession;
49 class CigiBasePacket;
50 class CigiBaseIGCtrl;
51 
52 namespace makCigiExt
53 {
54  class DtCigiDiGuyCtrl;
55  class DtCigiDiGuyCtrlExt;
56  class DtCigiDiGuyExecuteGesture;
57  class DtCigiDiGuyEndGesture;
58  class DtCigiDiGuyCtrlExtV4;
59  class DtCigiDiGuyExecuteGestureV4;
60  class DtCigiDiGuyEndGestureV4;
61 }
62 
63 namespace makVrv
64 {
65  class DtCigiConnectionInitializer;
66  class DtCigiSignalProcessor;
67  class DtCigiConnection;
68  class DtCigiLosBasicResponse;
69  class DtCigiLosExtendedResponse;
70 
77  {
78  public:
79  friend class DtCigiNetworkIOCreator;
80 
82  virtual ~DtCigiNetworkIO();
83 
86  virtual bool receiveCigiMessages();
87 
96  virtual bool sendCigiMessages(unsigned int frameNumber, unsigned int lastHostFrameNumber,
97  int igMode, int databaseNumber);
98 
101  virtual void setSignalProcessor(DtCigiSignalProcessor& sigProcessor);
102 
104  virtual void sendHatHotResponse( const DtHatHotResponder::DtHatHotResponseData* hatHotResponse );
105 
107  virtual void sendLosBasicResponse(DtCigiLosBasicResponse* losResponse);
108 
110  virtual void sendLosExtendedResponse(DtCigiLosExtendedResponse* losResponse);
111 
113  virtual void sendPositionResponse( DtPositionResponder::DtPositionResponseData* posResponse );
114 
116  virtual void sendCollisionSegmentResponse( DtCollisionResponder::DtCollisionSegmentResponseData* collReponse );
117 
119  virtual void sendSensorResponse( DtSensorResponder::DtSensorResponseData* sensorResponse );
120 
124  virtual void sendUserPacket( CigiBasePacket* packet );
125 
127  virtual CigiIGSession& session();
130  virtual const CigiIGSession& session() const;
132 
134  bool cigiSessionExists() const;
135 
137  virtual void packLosBasicResponseV3(const DtCigiLosBasicResponse& response, CigiLosRespV3_2& respPacket);
138 
140  virtual void packLosBasicResponseV4(const DtCigiLosBasicResponse& response, CigiLosRespV4& respPacket);
141 
143  virtual void packLosExtendedResponseV3(const DtCigiLosExtendedResponse& response, CigiLosXRespV3_2& respPacket);
144 
146  virtual void packLosExtendedResponseV4(const DtCigiLosExtendedResponse& response, CigiLosXRespV4& respPacket);
147 
149  virtual void packPositionResponseV3(const DtPositionResponder::DtPositionResponseData& response, CigiPositionRespV3& respPacket);
150  virtual void packPositionResponseV4(const DtPositionResponder::DtPositionResponseData& response, CigiPositionRespV4& respPacket);
151 
153  virtual void packCollisionSegmentResponseV3( const DtCollisionResponder::DtCollisionSegmentResponseData& response, CigiCollDetSegRespV3& respPacket );
154  virtual void packCollisionSegmentResponseV4( const DtCollisionResponder::DtCollisionSegmentResponseData& response, CigiCollDetSegRespV4& respPacket );
155 
157  virtual void packHatHotResponseV3( const DtHatHotResponder::DtHatHotResponseData& response, CigiHatHotRespV3_2& respPacket );
158  virtual void packHatHotResponseV4( const DtHatHotResponder::DtHatHotResponseData& response, CigiHatHotRespV4& respPacket );
159 
161  virtual void packHatHotExtendedResponseV3( const DtHatHotResponder::DtHatHotResponseData& response, CigiHatHotXRespV3_2& respPacket );
162  virtual void packHatHotExtendedResponseV4( const DtHatHotResponder::DtHatHotResponseData& response, CigiHatHotXRespV4& respPacket );
163 
165  virtual void packSensorResponseV3( const DtSensorResponder::DtSensorResponseData& response, CigiSensorRespV3& respPacket );
166  virtual void packSensorResponseV4( const DtSensorResponder::DtSensorResponseData& response, CigiSensorRespV4& respPacket );
167 
169  virtual void packSensorExtendedResponseV3( const DtSensorResponder::DtSensorResponseData& response, CigiSensorXRespV3& respPacket );
170  virtual void packSensorExtendedResponseV4( const DtSensorResponder::DtSensorResponseData& response, CigiSensorXRespV4& respPacket );
171 
173  virtual bool registerUserPacket(CigiBasePacket* packet,
174  unsigned int packetId, bool hostSend, bool igSend);
175 
177  static bool addSocketCb(DtInetSocket* sock, void* usr);
178 
180  static bool removeSocketCb(DtInetSocket* sock, void* usr);
181 
183  virtual void reset();
184 
187  DtCigiNetworkIO() = delete;
188  DtCigiNetworkIO( DtCigiNetworkIO& ) = delete;
189  DtCigiNetworkIO( DtCigiNetworkIO&& ) = delete;
190  DtCigiNetworkIO& operator=( DtCigiNetworkIO& ) = delete;
191  DtCigiNetworkIO& operator=( DtCigiNetworkIO&& ) = delete;
193 
194  protected:
198  DtCigiNetworkIO(const DtCigiConnectionInitializer& initializer,
199  DtCigiConnection& connection );
200 
202  virtual void initializeUdpSocket(const DtInetEndpoint& endpoint,
203  unsigned int listenPort, DtInetDevice* device);
204 
206  virtual void initializeTcpSocket(const DtInetEndpoint& endpoint,
207  DtInetDevice* device, int localPort);
208 
210  virtual void addSocket(DtInetTcpSocket* sock);
211 
213  virtual void removeSocket(DtInetTcpSocket* sock);
214 
215  virtual DtInetAddr findFirstNetworkDeviceAddress(bool& found) const;
216 
219  CigiBaseIGCtrl* igControlPacket( Cigi_uint8* Dta );
220 
223  virtual bool packAndSendCigiMessage();
224 
225  protected:
227 
229  DtInetSocket* mySocket;
230 
232  CigiIGSession* myCigiIgSession;
233 
235  DtInetBufferChain myReceiveBufferChain;
236 
238  DtInetBuffer myReceiveBuffer;
239 
241  unsigned int myReceiveBufferSize;
242 
244  DtInetEndpoint myDestinationAddress;
245 
248 
251  DtInetSocketMgr* mySocketMgr;
252 
256 
260 
264 
268  std::vector<const DtHatHotResponder::DtHatHotResponseData*> myHatHotBasicResponses;
269  std::vector<const DtHatHotResponder::DtHatHotResponseData*> myHatHotExtendedResponses;
270 
272  std::vector<DtCigiLosBasicResponse*> myLosBasicResponses;
273  std::vector<DtCigiLosExtendedResponse*> myLosExtendedResponses;
274 
276  std::vector<DtPositionResponder::DtPositionResponseData*> myPositionResponses;
277 
279  std::vector<DtCollisionResponder::DtCollisionSegmentResponseData*> myCollisionSegmentResponses;
280 
282  std::vector<DtSensorResponder::DtSensorResponseData*> mySensorResponses;
283  std::vector<DtSensorResponder::DtSensorResponseData*> mySensorExtendedResponses;
284 
285  std::vector<CigiBasePacket*> myUserPacketsToSend;
287 
289  double myTimeSlice;
290 
294 
296 
302 
307 
313 
315 
321 
326 
332 
333  };
334 
337  {
338  public:
341 
343  virtual ~DtCigiNetworkIOCreator();
344 
346  static DtCigiNetworkIOCreator& instance( DtDe& de );
347 
349  static DtCigiNetworkIOCreator& instance( DtCigiConnection& con );
350 
352  virtual DtCigiNetworkIOCreator* clone();
353 
355  static void copyInstance(DtCigiConnection& con, DtDe& de);
356 
358  virtual DtCigiNetworkIO* create( const DtCigiConnectionInitializer& initializer,
359  DtCigiConnection& connection ) const;
360  };
361 }
Contains makVrv::DtSensorResponder class.
makCigiExt::DtCigiDiGuyExecuteGesture * myDiGuyExecuteGesturePacket
This points to the sample DtCigiDiGuyExecuteGesture we create and that CIGI uses to decode these pack...
Definition: DtCigiNetworkIO.h:306
double myTimeSlice
Time alloted to check for packet buffers on the socket.
Definition: DtCigiNetworkIO.h:289
This class initializes the CIGI driver.
Definition: DtCigiConnectionInitializer.h:18
Virtual base class. Allows for RTTI and proper virtual destruction. Used by Creators, Factories, Providers, Assemblers and User Interfaces.
Definition: DtVirtualBaseClass.h:19
The end gesture packet class for CIGI V3.x.
Definition: DtCigiDiGuyEndGesture.h:35
This is the original DiGuy control packet for V3. It is maintained for backward compatibility, but is deprecated. New users should use DtCigiDiGuyCtrlExt for V3.x and DtCigiDiGuyCtrlExtV4 for V4.
Definition: DtCigiDiGuyCtrl.h:53
std::vector< DtCollisionResponder::DtCollisionSegmentResponseData * > myCollisionSegmentResponses
The Collision Response queue.
Definition: DtCigiNetworkIO.h:279
CigiIGSession * myCigiIgSession
The CIGI Session.
Definition: DtCigiNetworkIO.h:232
DtInetBuffer myReceiveBuffer
The buffer used to receive CIGI messages.
Definition: DtCigiNetworkIO.h:238
unsigned int myReceiveBufferSize
The size of the buffer used to receive CIGI messages.
Definition: DtCigiNetworkIO.h:241
bool myUseSynchronousMode
Whether we&#39;re using synchronous mode or not. Start of frame CIGI messages will only be sent in synchr...
Definition: DtCigiNetworkIO.h:263
DtCigiSignalProcessor * mySignalProcessor
Definition: DtCigiNetworkIO.h:247
makCigiExt::DtCigiDiGuyEndGesture * myDiGuyEndGesturePacket
This points to the sample DtCigiDiGuyEndGesture we create and that CIGI uses to decode these packets...
Definition: DtCigiNetworkIO.h:311
Creator class for the Network IO.
Definition: DtCigiNetworkIO.h:336
Struct for HatHotResponseData. Unused in this class, used by intersection handler and the networkIO...
Definition: DtHatHotResponder.h:73
Contains DLL export macros.
bool myUseTcpServer
Whether we&#39;re using TCP server mode. If this and myUseTcpClient are false, UDP is being used...
Definition: DtCigiNetworkIO.h:259
A DtCigiIntersectionHandler processes CIGI LOS Requests and packages the results into instances of th...
Definition: DtCigiLosExtendedResponse.h:29
Struct for all Position response data In degrees.
Definition: DtPositionResponder.h:101
bool myUseTcpClient
Whether using TCP client mode. If this and myUseTcpServer are false, UDP is being used...
Definition: DtCigiNetworkIO.h:255
std::vector< const DtHatHotResponder::DtHatHotResponseData * > myHatHotBasicResponses
Queues to send to the host.The HAT/HOT Response queue.
Definition: DtCigiNetworkIO.h:268
The end gesture packet class for CIGI V4.
Definition: DtCigiDiGuyEndGestureV4.h:37
The execute gesture packet class for CIGI V.4.
Definition: DtCigiDiGuyExecuteGestureV4.h:44
Contains makVrv::DtCollisionResponder &amp; creator class.
Contains makVrv::DtVirtualBaseClass class.
makCigiExt::DtCigiDiGuyExecuteGestureV4 * myDiGuyExecuteGesturePacketV4
This points to the sample DtCigiDiGuyExecuteGestureV4 we create and that CIGI uses to decode these pa...
Definition: DtCigiNetworkIO.h:325
DtCigiConnection & myConnection
Definition: DtCigiNetworkIO.h:226
Structure containing the data for the Sensor Response Packet.
Definition: DtSensorResponder.h:89
DtInetEndpoint myDestinationAddress
The address/port of the host.
Definition: DtCigiNetworkIO.h:244
DtInetBufferChain myReceiveBufferChain
The buffer chains used to receive CIGI messages.
Definition: DtCigiNetworkIO.h:235
Struct for Collision Response Data.
Definition: DtCollisionResponder.h:78
std::vector< DtCigiLosExtendedResponse * > myLosExtendedResponses
Queues to send to the host.The HAT/HOT Response queue.
Definition: DtCigiNetworkIO.h:273
Contains makVrv::DtHatHotResponder class.
std::vector< const DtHatHotResponder::DtHatHotResponseData * > myHatHotExtendedResponses
Queues to send to the host.The HAT/HOT Response queue.
Definition: DtCigiNetworkIO.h:269
makCigiExt::DtCigiDiGuyCtrlExt * myDiGuyCtrlExtPacket
CIGI V3 Extension Packets.
Definition: DtCigiNetworkIO.h:301
A DtCigiIntersectionHandler processes CIGI LOS Requests and packages the results into instances of th...
Definition: DtCigiLosBasicResponse.h:27
This class is responsible for the actual processing of CIGI data. This holds the entity visualizer...
Definition: DtCigiConnection.h:58
std::vector< CigiBasePacket * > myUserPacketsToSend
Queues to send to the host.The HAT/HOT Response queue.
Definition: DtCigiNetworkIO.h:285
The execute gesture packet class for CIGI V3.x.
Definition: DtCigiDiGuyExecuteGesture.h:40
Contains makVrv::DtPositionResponderclass.
makCigiExt::DtCigiDiGuyCtrlExtV4 * myDiGuyCtrlExtPacketV4
CIGI V4 Extension Packets.
Definition: DtCigiNetworkIO.h:320
std::vector< DtSensorResponder::DtSensorResponseData * > mySensorResponses
The Sensor Response queue.
Definition: DtCigiNetworkIO.h:282
std::vector< DtCigiLosBasicResponse * > myLosBasicResponses
The LOS Response queues.
Definition: DtCigiNetworkIO.h:272
DtInetSocketMgr * mySocketMgr
The socket manager holds the TCP server socket and manages connections in TCP server mode...
Definition: DtCigiNetworkIO.h:251
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:76
The DiGuy Control (extended) packet class for V4.
Definition: DtCigiDiGuyCtrlExtV4.h:59
makCigiExt::DtCigiDiGuyCtrl * myDiGuyCtrlPacket
Deprecated - This points to the sample DtCigiDiGuyCtrl we create and that CIGI uses to decode these p...
Definition: DtCigiNetworkIO.h:293
This class receives CIGI messages and sends signals that the driver can hook up to for processing...
Definition: DtCigiSignalProcessor.h:81
makCigiExt::DtCigiDiGuyEndGestureV4 * myDiGuyEndGesturePacketV4
This points to the sample DtCigiDiGuyEndGestureV4 we create and that CIGI uses to decode these packet...
Definition: DtCigiNetworkIO.h:330
#define DT_DLL_VRVCIGI
Definition: vrvCigi.h:19
The DiGuy Control (extended) packet class for V3.x.
Definition: DtCigiDiGuyCtrlExt.h:58
std::vector< DtPositionResponder::DtPositionResponseData * > myPositionResponses
The Position Response queue.
Definition: DtCigiNetworkIO.h:276
This class performs all of the network I/O for CIGI messages. This includes setting up the CIGI sessi...
Definition: DtCigiNetworkIO.h:76
DtInetSocket * mySocket
The socket. May be a UDP or TCP socket.
Definition: DtCigiNetworkIO.h:229
std::vector< DtSensorResponder::DtSensorResponseData * > mySensorExtendedResponses
Queues to send to the host.The HAT/HOT Response queue.
Definition: DtCigiNetworkIO.h:283

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)