VR-Forces 4.5 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtCigiNetworkIO.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 2016 MaK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvCigi/vrvCigi.h>
14 
16 
17 #include <vlutil/vlInetSocket.h>
18 
19 #include "CigiTypes.h"
20 
21 class CigiHatHotRespV3_2;
22 
23 class DtInetSocket;
24 class DtInetSocketMgr;
25 class DtInetTcpSocket;
26 class CigiIGSession;
27 class CigiBasePacket;
28 class CigiBaseIGCtrl;
29 
30 namespace makCigiExt
31 {
32  class DtCigiDiGuyCtrl;
33 }
34 
35 namespace makVrv
36 {
37  class DtCigiConnectionInitializer;
38  class DtCigiSignalProcessor;
39  class DtCigiConnection;
40 
47  {
48  public:
49  friend class DtCigiNetworkIOCreator;
50 
52  virtual ~DtCigiNetworkIO();
53 
56  virtual bool receiveCigiMessages();
57 
66  virtual bool sendCigiMessages(unsigned int frameNumber, unsigned int lastHostFrameNumber,
67  int igMode, int databaseNumber);
68 
72  virtual bool readyToSendCigiMessages() const;
73 
76  virtual void setSignalProcessor(DtCigiSignalProcessor& sigProcessor);
77 
79  virtual void sendHatHotResponse(double height, unsigned int hotId, bool hat,
80  unsigned int lastHostFrameNumber, bool valid);
81 
83  virtual void sendLosResponse(int losId, int entityId, bool visible, double range,
84  int responseCount, int hostFrame);
85 
89  virtual void sendUserPacket( CigiBasePacket* packet );
90 
92 
93 
94  virtual CigiIGSession& session();
95  virtual const CigiIGSession& session() const;
97 
99  bool cigiSessionExists() const;
100 
102  virtual bool registerUserPacket(CigiBasePacket *packet,
103  unsigned int packetId, bool hostSend, bool igSend);
104 
106  static bool addSocketCb(DtInetSocket* sock, void* usr);
107 
109  static bool removeSocketCb(DtInetSocket* sock, void* usr);
110 
111  protected:
115  DtCigiNetworkIO(const DtCigiConnectionInitializer& initializer,
116  DtCigiConnection& connection );
117 
119  virtual void initializeUdpSocket(const DtInetEndpoint& endpoint,
120  unsigned int listenPort, DtInetDevice* device);
121 
123  virtual void initializeTcpSocket(const DtInetEndpoint& endpoint,
124  DtInetDevice* device, int localPort);
125 
127  virtual void addSocket(DtInetTcpSocket* sock);
128 
130  virtual void removeSocket(DtInetTcpSocket* sock);
131 
132  virtual DtInetAddr findFirstNetworkDeviceAddress(bool& found) const;
133 
136  CigiBaseIGCtrl* igControlPacket( Cigi_uint8* Dta );
137 
139  DtCigiNetworkIO(const DtCigiNetworkIO& orig);
140 
142  DtCigiNetworkIO& operator=(const DtCigiNetworkIO& orig);
143 
144  protected:
147  {
148  double hatHotValue;
149  int hatHotId;
151  unsigned int lastHostFrameNumber;
152  bool valid;
153  };
154 
157  {
158  int losId;
159  int entityId;
160  bool visible;
161  double range;
162  unsigned int lastHostFrameNumber;
164  };
165 
167 
169  DtInetSocket* mySocket;
170 
172  CigiIGSession* myCigiIgSession;
173 
175  DtInetBufferChain myReceiveBufferChain;
176 
178  DtInetBuffer myReceiveBuffer;
179 
181  unsigned int myReceiveBufferSize;
182 
184  DtInetEndpoint myDestinationAddress;
185 
188 
191  DtInetSocketMgr* mySocketMgr;
192 
196 
200 
204 
206  std::vector<HatHotResponseData> myHatHotResponses;
207 
209  std::vector<LosResponseData> myLosResponses;
210 
211  std::vector<CigiBasePacket*> myUserPacketsToSend;
212 
214  double myTimeSlice;
215 
219  };
220 
223  {
224  public:
227 
229  virtual ~DtCigiNetworkIOCreator();
230 
232  static DtCigiNetworkIOCreator& instance( DtDe& de );
233 
235  static DtCigiNetworkIOCreator& instance( DtCigiConnection& con );
236 
238  static void copyInstance(DtCigiConnection& con, DtDe& de);
239 
241  virtual DtCigiNetworkIO* create( const DtCigiConnectionInitializer& initializer,
242  DtCigiConnection& connection ) const;
243  };
244 }

Document ID: Generated on Thu Mar 23 18:54:12 EDT 2017 from SVN revision 174804
Copyright © 2005-2017 VT MÄK. All Rights Reserved (www.mak.com)