Go to the documentation of this file.00001
00002
00003
00004
00005 #ifndef lcPdu_h_
00006 #define lcPdu_h_
00007
00010
00011 #pragma once
00012
00013 #include "loggerControlDefines.h"
00014 #include "packets/lgrControlP.h"
00015 #include <vlutil/vlMachineTypes.h>
00016 #include <vlutil/vlPrintUtil.h>
00017 #include <matrix/LibMatrix.h>
00018 #include <matrix/vlMath.h>
00019 #include <vlpi/parseEnum.h>
00020 #include <vl/interaction.h>
00021 #include <vl/exerciseConn.h>
00022 #include <vl/hostStructs.h>
00023 #include <vl/pdu.h>
00024
00025
00027
00028 enum DtLgrCommandExt
00029 {
00030 DtLgrBeginExtension = 22,
00031 DtLgrEmpty = 22,
00032 DtLgrConnect = 23,
00033 DtLgrConnectionEstablished = 24,
00034 DtLgrDisconnect = 25,
00035 DtLgrAcknowledge = 26,
00036 DtLgrCommandKind = 27,
00037 DtLgrResponse = 28,
00038 DtLgrLgrHeartbeat = 29
00039 };
00040
00042 enum DtLgrMode
00043 {
00044 DtLGR_PLAY = 0,
00045 DtLGR_PAUSE = 1,
00046 DtLGR_RECORD = 2,
00047 DtLGR_STOP = 3,
00048 DtLGR_EMPTY = 4,
00049 DtLGR_LOOP = 5
00050 };
00051
00052
00054 enum DtLgrDirection
00055 {
00056 DtLGR_STOPPED = 0,
00057 DtLGR_NOPKT = 0,
00058 DtLGR_FORWARDS = 1,
00059 DtLGR_BACKWARDS = -1
00060 };
00061
00062
00064 enum DtLgrFilePosition
00065 {
00066 DtLGR_NOFILE = 0,
00067 DtLGR_START = 1,
00068 DtLGR_MIDDLE = 2,
00069 DtLGR_END = 3
00070 };
00071
00072
00073 enum DtLgrStyle
00074 {
00075 DtLGR_PRISTINE = 0,
00076 DtLGR_RVA = 1
00077 };
00078
00079
00081 enum DtLgrProcess
00082 {
00083 DtLGR_NONE = 0,
00084 DtLGR_MINE = 1,
00085 DtLGR_ALL = 2
00086 };
00087
00088
00090 enum DtLgrCtrlFlagStates
00091 {
00092 DtLGR_EMPTY_FLAG = 0,
00093 DtLGR_STATE_REQUEST = 1,
00094 DtLGR_TIME_CONSTR_ON = 2,
00095 DtLGR_TIME_CONSTR_OFF = 3,
00096 DtLGR_TIME_REGLTD_ON = 4,
00097 DtLGR_TIME_REGLTD_OFF = 5,
00098 DtLGR_OWN_FED_AMB_ON = 6,
00099 DtLGR_OWN_FED_AMB_OFF = 7
00100 };
00101
00102 #if DtDIS
00103
00104 class DT_DLL_LOGGERCONTROL DtExerciseConn;
00105 class DT_DLL_LOGGERCONTROL DtLgrControlPdu;
00106
00107 typedef DtLgrControlPdu DtLgrControlInteraction;
00108 typedef void (*DtLgrControlInteractionCb)
00109 ( DtLgrControlInteraction* inter, void* usr );
00110
00111 #endif
00112
00116 #if DtHLA
00117 class DT_DLL_LOGGERCONTROL DtLgrControlPdu : public DtPdu
00118 #else
00119 class DT_DLL_LOGGERCONTROL DtLgrControlPdu : public DtInteraction
00120 #endif
00121 {
00122 public:
00123
00125 DtLgrControlPdu( DtBufferPtr buffer = DtUSE_INTERNAL_BUFFER, int pduSize=sizeof(DtNetLgrControlPdu) );
00126
00128 DtLgrControlPdu( const DtNetLgrControlPdu* initial,
00129 DtBufferPtr buffer = DtUSE_INTERNAL_BUFFER );
00130
00132 virtual ~DtLgrControlPdu();
00133
00135 DtLgrControlPdu( const DtLgrControlPdu& src );
00136
00138 DtLgrControlPdu& operator=( const DtLgrControlPdu& src );
00139
00141 virtual const DtEntityIdentifier& receiverId() const;
00142 virtual void setReceiverId( const DtEntityIdentifier& id );
00143
00145 virtual const DtEntityIdentifier& senderId() const;
00146 virtual void setSenderId( const DtEntityIdentifier& id );
00147
00149 virtual DtLgrCommand lgrCommand() const;
00150
00152 virtual DtU32 sequence() const;
00153 virtual void setSequence(DtU32 sequenceNumber);
00154
00156 virtual void printDataToStream(std::ostream& stream) const;
00157
00158 public:
00160 static DtPdu* create( const DtNetPacket* initial,
00161 DtBufferPtr buffer = DtUSE_INTERNAL_BUFFER );
00162
00164 static DtLgrControlPdu* create( DtLgrCommand command );
00165
00167 static DtLgrControlPdu* create( DtLgrCommandExt command );
00168
00169 #if DtDIS
00170
00171 static void addCallback( DtExerciseConn* conn,
00172 DtLgrControlInteractionCb cb, void* usr );
00173 static void removeCallback( DtExerciseConn* conn,
00174 DtLgrControlInteractionCb cb, void* usr );
00175 #endif
00176
00178 static DtU16 addressWildcard();
00179
00181 static const DtEntityIdentifier& wildcardAddress();
00182
00184 static const char* lgrModeEnum2string( DtLgrMode md );
00185
00187 static const char* lgrFilePosEnum2string( DtLgrFilePosition pos );
00188
00190 static const char* lgrStateFlag2string( DtLgrCtrlFlagStates flg );
00191
00192 protected:
00194 virtual void setLgrCommand( DtLgrCommand com );
00196 virtual void setLgrCommand( DtLgrCommandExt com );
00197
00199 virtual DtNetLgrControlPdu* controlHeader();
00200
00202 virtual DtNetLgrControlPdu* controlHeader() const;
00203
00205 DtPduKind internalGetPduKind() const { return DtLgrControlPduKind; }
00206
00207 protected:
00209 DtEntityIdentifier mySenderId;
00210 DtEntityIdentifier myReceiverId;
00211
00212 protected:
00213 static const DtU16 theAddressWildcard = ((1<<16)-1);
00214 static const DtEntityIdentifier theWildcardAddress;
00215 };
00216
00218 DT_DLL_LOGGERCONTROL const char *DtLgrCommandEnumString(DtLgrCommand param);
00219
00220 #endif // lcPdu_h_