VR-Forces 4.3 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
makVrv::DtCigiNetworkIO Class Reference

This class performs all of the network I/O for CIGI messages. More...

Classes

struct  HatHotResponseData
 The internal structure for a HAT/HOT Response. More...
struct  LosResponseData
 The internal structure for a LOS Response. More...

Public Member Functions

 DtCigiNetworkIO (const DtCigiConnectionInitializer &initializer, DtCigiConnection &connection)
 Constructor Creates the appropriate socket based on the connection type in the initializer and sets up the CIGI Session.
virtual ~DtCigiNetworkIO ()
 Destructor.
virtual bool receiveCigiMessages ()
 Receives any CIGI messages from the network and processes them.
virtual bool sendCigiMessages (unsigned int frameNumber, unsigned int lastHostFrameNumber, int igMode, int databaseNumber)
 Sends CIGI messages to the host.
virtual bool readyToSendCigiMessages () const
 Check if there are any CIGI messages to send.
virtual void setSignalProcessor (DtCigiSignalProcessor &sigProcessor)
 Set the object that will receive CIGI signals and emit signals for CIGI message processing.
virtual void sendHatHotResponse (double height, unsigned int hotId, bool hat, unsigned int lastHostFrameNumber, bool valid)
 Queues up a HAT/HOT response for sending when sendCigiMessages is called.
virtual void sendLosResponse (int losId, int entityId, bool visible, double range, int responseCount, int hostFrame)
 Queues up a LOS response for sending when sendCigiMessges is called.
virtual void sendUserPacket (CigiBasePacket *packet)
 Specify a packet that will be included in the next CIGI message buffer.
bool cigiSessionExists () const
 Query if there is a (connected) cigi session.
virtual bool registerUserPacket (CigiBasePacket *packet, unsigned int packetId, bool hostSend, bool igSend)
 Register a user defined packet manager.
virtual CigiIGSession & session ()
 Access the cigi session.
virtual const CigiIGSession & session () const
 Access the cigi session.

Static Public Member Functions

static bool addSocketCb (DtInetSocket *sock, void *usr)
 Callback when a TCP connection is added. Used only in TCP server mode.
static bool removeSocketCb (DtInetSocket *sock, void *usr)
 Callback when a TCP connection is removed. Used only in TCP server mode.

Protected Member Functions

virtual void initializeUdpSocket (const DtInetEndpoint &endpoint, unsigned int listenPort, DtInetDevice *device)
 Initialize a UDP socket.
virtual void initializeTcpSocket (const DtInetEndpoint &endpoint, DtInetDevice *device, int localPort)
 Initialize a TCP client socket.
virtual void addSocket (DtInetTcpSocket *sock)
 Called from addSocketCb.
virtual void removeSocket (DtInetTcpSocket *sock)
 Called from removeSocketCb.
virtual DtInetAddr findFirstNetworkDeviceAddress (bool &found) const
CigiBaseIGCtrl * igControlPacket (Cigi_uint8 *Dta)
 Get a pointer to the igControl packet as the front of an incoming CIGI Message.
 DtCigiNetworkIO (const DtCigiNetworkIO &orig)
 Non-copyable.
DtCigiNetworkIOoperator= (const DtCigiNetworkIO &orig)
 Non-copyable.

Protected Attributes

DtCigiConnectionmyConnection
DtInetSocket * mySocket
 The socket. May be a UDP or TCP socket.
CigiIGSession * myCigiIgSession
 The CIGI Session.
DtInetBufferChain myReceiveBufferChain
 The buffer chains used to receive CIGI messages.
DtInetBuffer myReceiveBuffer
 The buffer used to receive CIGI messages.
unsigned int myReceiveBufferSize
 The size of the buffer used to receive CIGI messages.
DtInetEndpoint myDestinationAddress
 The address/port of the host.
DtCigiSignalProcessormySignalProcessor
DtInetSocketMgr * mySocketMgr
 The socket manager holds the TCP server socket and manages connections in TCP server mode.
bool myUseTcpClient
 Whether using TCP client mode.
bool myUseTcpServer
 Whether we're using TCP server mode.
bool myUseSynchronousMode
 Whether we're using synchronous mode or not.
std::vector< HatHotResponseDatamyHatHotResponses
 The HAT/HOT Response queue.
std::vector< LosResponseDatamyLosResponses
 The LOS Response queue.
std::vector< CigiBasePacket * > myUserPacketsToSend
double myTimeSlice
 Time alloted to check for packet buffers on the socket.
makCigiExt::DtCigiDiGuyCtrlmyDiGuyCtrlPacket
 This points to the sample DtCigiDiGuyCtrl we create and that CIGI uses to decode these packets.

Detailed Description

This class performs all of the network I/O for CIGI messages.

This includes setting up the CIGI session, managing sockets, and setting the signal processor so that messages can be processed by the IG and responses can be sent back to the host.

Constructor & Destructor Documentation

makVrv::DtCigiNetworkIO::DtCigiNetworkIO ( const DtCigiConnectionInitializer initializer,
DtCigiConnection connection 
)

Constructor Creates the appropriate socket based on the connection type in the initializer and sets up the CIGI Session.

virtual makVrv::DtCigiNetworkIO::~DtCigiNetworkIO ( )
virtual

Destructor.

makVrv::DtCigiNetworkIO::DtCigiNetworkIO ( const DtCigiNetworkIO orig)
protected

Non-copyable.

Member Function Documentation

virtual bool makVrv::DtCigiNetworkIO::receiveCigiMessages ( )
virtual

Receives any CIGI messages from the network and processes them.

Returns
True if the connection still exists, false otherwise.
virtual bool makVrv::DtCigiNetworkIO::sendCigiMessages ( unsigned int  frameNumber,
unsigned int  lastHostFrameNumber,
int  igMode,
int  databaseNumber 
)
virtual

Sends CIGI messages to the host.

Sends start-of-frame if in synchronous mode, and any HAT/HOT/LOS responses that are queued up. The parameters are only used when sending start-of-frame.

Parameters
frameNumberThe current IG frame.
lastHostFrameNumberThe host frame from the last IG Control received.
igModeThe mode of the IG (see the CIGI ICD for values)
databaseNumberThe database number currently loaded/loading.
Returns
True if the connection still exists, false otherwise.
virtual bool makVrv::DtCigiNetworkIO::readyToSendCigiMessages ( ) const
virtual

Check if there are any CIGI messages to send.

Return values
trueif SOF or HAT/HOT/LOS responses are waiting to be sent.
falseotherwise.
virtual void makVrv::DtCigiNetworkIO::setSignalProcessor ( DtCigiSignalProcessor sigProcessor)
virtual

Set the object that will receive CIGI signals and emit signals for CIGI message processing.

virtual void makVrv::DtCigiNetworkIO::sendHatHotResponse ( double  height,
unsigned int  hotId,
bool  hat,
unsigned int  lastHostFrameNumber,
bool  valid 
)
virtual

Queues up a HAT/HOT response for sending when sendCigiMessages is called.

virtual void makVrv::DtCigiNetworkIO::sendLosResponse ( int  losId,
int  entityId,
bool  visible,
double  range,
int  responseCount,
int  hostFrame 
)
virtual

Queues up a LOS response for sending when sendCigiMessges is called.

virtual void makVrv::DtCigiNetworkIO::sendUserPacket ( CigiBasePacket *  packet)
virtual

Specify a packet that will be included in the next CIGI message buffer.

This is passed to the NetworkIO by the connections call of the same name

virtual CigiIGSession& makVrv::DtCigiNetworkIO::session ( )
virtual

Access the cigi session.

These will throw DtException if the session does not exist.

virtual const CigiIGSession& makVrv::DtCigiNetworkIO::session ( ) const
virtual

Access the cigi session.

These will throw DtException if the session does not exist.

bool makVrv::DtCigiNetworkIO::cigiSessionExists ( ) const

Query if there is a (connected) cigi session.

virtual bool makVrv::DtCigiNetworkIO::registerUserPacket ( CigiBasePacket *  packet,
unsigned int  packetId,
bool  hostSend,
bool  igSend 
)
virtual

Register a user defined packet manager.

static bool makVrv::DtCigiNetworkIO::addSocketCb ( DtInetSocket *  sock,
void *  usr 
)
static

Callback when a TCP connection is added. Used only in TCP server mode.

static bool makVrv::DtCigiNetworkIO::removeSocketCb ( DtInetSocket *  sock,
void *  usr 
)
static

Callback when a TCP connection is removed. Used only in TCP server mode.

virtual void makVrv::DtCigiNetworkIO::initializeUdpSocket ( const DtInetEndpoint &  endpoint,
unsigned int  listenPort,
DtInetDevice *  device 
)
protectedvirtual

Initialize a UDP socket.

virtual void makVrv::DtCigiNetworkIO::initializeTcpSocket ( const DtInetEndpoint &  endpoint,
DtInetDevice *  device,
int  localPort 
)
protectedvirtual

Initialize a TCP client socket.

virtual void makVrv::DtCigiNetworkIO::addSocket ( DtInetTcpSocket *  sock)
protectedvirtual

Called from addSocketCb.

virtual void makVrv::DtCigiNetworkIO::removeSocket ( DtInetTcpSocket *  sock)
protectedvirtual

Called from removeSocketCb.

virtual DtInetAddr makVrv::DtCigiNetworkIO::findFirstNetworkDeviceAddress ( bool found) const
protectedvirtual
CigiBaseIGCtrl* makVrv::DtCigiNetworkIO::igControlPacket ( Cigi_uint8 *  Dta)
protected

Get a pointer to the igControl packet as the front of an incoming CIGI Message.

This is a peek, and does not modify the buffer

DtCigiNetworkIO& makVrv::DtCigiNetworkIO::operator= ( const DtCigiNetworkIO orig)
protected

Non-copyable.

Member Data Documentation

DtCigiConnection& makVrv::DtCigiNetworkIO::myConnection
protected
DtInetSocket* makVrv::DtCigiNetworkIO::mySocket
protected

The socket. May be a UDP or TCP socket.

CigiIGSession* makVrv::DtCigiNetworkIO::myCigiIgSession
protected

The CIGI Session.

DtInetBufferChain makVrv::DtCigiNetworkIO::myReceiveBufferChain
protected

The buffer chains used to receive CIGI messages.

DtInetBuffer makVrv::DtCigiNetworkIO::myReceiveBuffer
protected

The buffer used to receive CIGI messages.

unsigned int makVrv::DtCigiNetworkIO::myReceiveBufferSize
protected

The size of the buffer used to receive CIGI messages.

DtInetEndpoint makVrv::DtCigiNetworkIO::myDestinationAddress
protected

The address/port of the host.

DtCigiSignalProcessor* makVrv::DtCigiNetworkIO::mySignalProcessor
protected
DtInetSocketMgr* makVrv::DtCigiNetworkIO::mySocketMgr
protected

The socket manager holds the TCP server socket and manages connections in TCP server mode.

bool makVrv::DtCigiNetworkIO::myUseTcpClient
protected

Whether using TCP client mode.

If this and myUseTcpServer are false, UDP is being used.

bool makVrv::DtCigiNetworkIO::myUseTcpServer
protected

Whether we're using TCP server mode.

If this and myUseTcpClient are false, UDP is being used.

bool makVrv::DtCigiNetworkIO::myUseSynchronousMode
protected

Whether we're using synchronous mode or not.

Start of frame CIGI messages will only be sent in synchronous mode.

std::vector<HatHotResponseData> makVrv::DtCigiNetworkIO::myHatHotResponses
protected

The HAT/HOT Response queue.

std::vector<LosResponseData> makVrv::DtCigiNetworkIO::myLosResponses
protected

The LOS Response queue.

std::vector<CigiBasePacket*> makVrv::DtCigiNetworkIO::myUserPacketsToSend
protected
double makVrv::DtCigiNetworkIO::myTimeSlice
protected

Time alloted to check for packet buffers on the socket.

makCigiExt::DtCigiDiGuyCtrl* makVrv::DtCigiNetworkIO::myDiGuyCtrlPacket
protected

This points to the sample DtCigiDiGuyCtrl we create and that CIGI uses to decode these packets.


The documentation for this class was generated from the following file:

Document ID: Generated on Wed Mar 11 21:20:57 EDT 2015 from SVN revision 150940
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)