VR-Link API Documentation for DIS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
diGuyCustomPdu.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2020 VT MAK
3  * All rights reserved.
4  ****************************************************************************/
5 
6 #pragma once
7 
8 #if DtDIS
9 
10 #include <vl/stateMsgDIS.h>
11 #include <vlpi/entityIdentifier.h>
12 
13 class DtExerciseConn;
14 
15 
17 typedef struct DtNetDIGuyCustomPdu
18 {
26 
27 
28 class DtDIGuyCustomPdu;
29 
32 typedef void (*DtDIGuyCustomPduCb)(DtDIGuyCustomPdu* pdu, void* usr);
33 
38 {
39 public:
41  enum { PduStaticSize = 23 };
42 
43 public:
47 
50  DtBufferPtr buffer = DtUSE_INTERNAL_BUFFER, DtPduFactory* pduFactory = 0);
51 
53  virtual ~DtDIGuyCustomPdu();
54 
56  DtDIGuyCustomPdu(const DtDIGuyCustomPdu& other);
57 
60 
61  //{@
63  virtual DtNetDIGuyCustomPdu* netDIGuyCustomPdu();
64  virtual const DtNetDIGuyCustomPdu* netDIGuyCustomPdu() const;
66 
67  // MJI - I think this should always be 7, according to the SDK
68  // User's Guide. Going to set it to 7 by default for now, and
69  // this probably shouldn't be changed.
70  //{@
73  virtual void setMessageVersion(int version);
74  virtual int messageVersion() const;
76 
77  //{@
79  virtual void setMessageId(DtDIGuyCustomPduMsgId msgId);
80  virtual DtDIGuyCustomPduMsgId messageId() const;
82 
83  //{@
85  virtual void setEntityId(const DtEntityIdentifier& entId);
86  virtual DtEntityIdentifier entityId() const;
88 
89  //{@
91  virtual void setDataSize(unsigned int size);
92  virtual unsigned int dataSize() const;
94 
98  virtual void addBool(bool value);
99 
103  virtual void addShort(short value);
104 
108  virtual void addLong(long value);
109 
113  virtual void addFloat(float value);
114 
119  virtual void addString(const DtString& str);
120 
124  virtual void addUnsignedData(int size, const unsigned char* s);
125 
126  //{@
139  virtual bool pullBool( bool& value, unsigned int& byteoffset ) const;
140  virtual bool pullShort( short& value, unsigned int& byteoffset ) const;
141  virtual bool pullLong( long& value, unsigned int& byteoffset ) const;
142  virtual bool pullFloat( float& value, unsigned int& byteoffset ) const;
143  virtual bool pullString( DtString& value, unsigned int& byteoffset ) const;
144  virtual bool pullUnsignedData( const unsigned char*& value, unsigned int& byteoffset, int& bytes_read ) const;
146 
147  //{@
149  virtual void getData(unsigned char* buff) const;
150  virtual void* data();
151  void setData(unsigned char* data, int numBytes);
153 
155  virtual void printData() const;
156 
158  virtual void printDataToStream(std::ostream& stream) const;
159 
160 
161 public:
163  static DtPdu* create(const DtNetPacket* initial,
164  DtBufferPtr buffer = DtUSE_INTERNAL_BUFFER, DtPduFactory* pduFactory = 0);
165 
167  static void addCallback(DtExerciseConn* conn, DtDIGuyCustomPduCb cb,
168  void* usr);
169 
171  static void removeCallback(DtExerciseConn* conn, DtDIGuyCustomPduCb cb,
172  void* usr);
173 
176  static void addCallback(DtExerciseConn* conn, DtDIGuyCustomPduCb cb,
177  void* usr, DtDIGuyCustomPduMsgId id);
178 
181  static void removeCallback(DtExerciseConn* conn, DtDIGuyCustomPduCb cb,
182  void* usr, DtDIGuyCustomPduMsgId id);
183 
188  static void setCustomPduKind(DtPduKind pduKind);
189  static DtPduKind customPduKind();
190 
191 protected:
192  virtual DtPduKind internalGetPduKind() const;
193 
194 protected:
196 };
197 
198 
199 #endif
Contains the DtEntityIdentifier class declaration.
Instances of DtExerciseConn are used to provide an application&#39;s interface or connection to the netwo...
Definition: exerciseConnDIS.h:61
Implements the storage, sending, and receipt of DI Guy custom PDU&#39;s.
Definition: diGuyCustomPdu.h:37
#define DT_DLL_VL
Definition: vlMachineTypes.h:108
Network-order unsigned 16-bit quantity.
Definition: vlNetTypes.h:51
static DtPduKind theCustomPduKind
Definition: diGuyCustomPdu.h:195
Definition: pduHeader.h:14
class DtPduFactory:
Definition: pduFactory.h:38
virtual void printDataToStream(std::ostream &stream) const
DtStateMsg & operator=(const DtStateMsg &orig)
assignment operator
DtNetU8 DtDataSize
Definition: diGuyCustomPdu.h:23
DtNetPduHeader DtHeader
Definition: diGuyCustomPdu.h:19
DtNetU16 DtDIGuyMessageVersion
Definition: diGuyCustomPdu.h:20
struct DtNetDIGuyCustomPdu DtNetDIGuyCustomPdu
The net structure of the DI Guy Custom PDU.
virtual DtPduKind internalGetPduKind() const =0
Returns the PDU kind associated with the derived PDU class.
DtU8 DtNetU8
Unsigned 8-bit value.
Definition: vlNetTypes.h:30
DtPdu is the base class for all PDU&#39;s in VR-Link.
Definition: pdu.h:69
DtNetEntityIdentifier DtEntityId
Definition: diGuyCustomPdu.h:22
DtNetU16 DtDIGuyMessageId
Definition: diGuyCustomPdu.h:21
DtDIGuyCustomPduMsgId
Enumeration describing the message ID&#39;s of the DiGuy PDU.
Definition: disEnums.h:3191
Definition: netStructs.h:116
Instances of DtEntityIdentifier are used as a unique ID for entities in DIS.
Definition: entityIdentifier.h:31
virtual void printData() const
Print the PDU&#39;s data (not including header).
struct DtBufferPlaceHolder * DtBufferPtr
Definition: vlBaseMsg.h:17
#define DtUSE_INTERNAL_BUFFER
Definition: vlBaseMsg.h:22
The net structure of the DI Guy Custom PDU.
Definition: diGuyCustomPdu.h:17
DtPduKind
([UID 4]) - PDU Type
Definition: disEnums.h:238
Instances of DtString are used to represent strings.
Definition: vlString.h:29
Instances of DtStateMsg are used to represent state data communicated via the network in a DIS (as op...
Definition: stateMsgDIS.h:21
DtNetU8 DtData[1]
Definition: diGuyCustomPdu.h:24
void(* DtDIGuyCustomPduCb)(DtDIGuyCustomPdu *pdu, void *usr)
Callback signature used to register for callbacks to DI Guy custom PDU&#39;s.
Definition: diGuyCustomPdu.h:32

Document ID: Generated on Tue Feb 2 21:02:17 EST 2021 from SVN revision 223668
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)