00001
00002
00003
00004
00005
00006
00007
00008 #ifndef COMMANDMESSAGE_H
00009 #define COMMANDMESSAGE_H
00010
00011
00012
00013 #include <vector>
00014
00015 #include "AnnotatorCommApi.h"
00016 #include "CommandId.h"
00017
00018 using namespace std;
00019
00020
00021
00022 namespace annotatorcomm
00023 {
00024
00029 class ANNCOMM_API CommandMessage
00030 {
00031 public:
00035 static const int HEADER_LEN;
00036
00040 static const int FOOTER_LEN;
00041
00045 static const int MSG_LEN_IDX;
00046
00050 static const int CHECKSUM_RIDX;
00051
00052 public:
00058 CommandMessage(const CommandId & cmdId);
00059
00065 CommandMessage(const uint16_t cmdId);
00066
00072 void addParamInt8(int8_t param);
00073
00079 void addParamUInt8(uint8_t param);
00080
00086 void addParamInt16(int16_t param);
00087
00093 void addParamUInt16(uint16_t param);
00094
00100 void addParamInt32(int32_t param);
00101
00107 void addParamUInt32(uint32_t param);
00108
00114 void addParamInt64(int64_t param);
00115
00121 void addParamUInt64(uint64_t param);
00122
00128 uint16_t getId() const;
00129
00135 int getLength() const;
00136
00143 uint8_t* getBytes() const;
00144
00145 private:
00149 const uint16_t cmdId;
00150
00154 vector<uint8_t> params;
00155 };
00156
00157 }
00158
00159
00160
00161 #endif