10 #ifndef _CMTMESSAGE_H_2006_05_24 11 #define _CMTMESSAGE_H_2006_05_24 13 #ifndef _CMT_MONOLITHIC 63 #if defined(_DEBUG) && defined(_CMT_CHECK_MSG_DATA_INTEGRITY) 64 #define CMT_CHECKVAR uint32_t m_checkvar; 65 #define CMT_CHECKVAL 10101010 66 #define CMT_CHECKASSIGN m_checkvar = CMT_CHECKVAL; 67 #define CMT_CHECKASSERT \ 68 if (m_checkvar != CMT_CHECKVAL) throw "Message assertion failed!"; 72 #define CMT_CHECKASSIGN 73 #define CMT_CHECKASSERT 76 #define swapEndian16(src) (((src) >> 8) | ((src) << 8)) 77 #define swapEndian32(src) \ 78 (((src) >> 24) | ((src) >> 8 & 0xFF00) | ((src) << 8 & 0xFF0000) | \ 220 const int16_t numValues)
const;
378 #endif // _CMTMESSAGE_H_2006_05_24 uint32_t getDataLong(const uint16_t offset=0) const
Return the current value of the data as an uint32_t (32 bits).
double getDataFPValue(const uint64_t outputSettings, const uint16_t offset=0) const
Return current data value as double, conversion depends on outputSettings.
GLuint GLuint GLsizei count
void setDataFPValue(const uint64_t outputSettings, const double data, const uint16_t offset=0)
Write a floating/fixed point value into to the data buffer, conversion depends on outputSettings...
const uint8_t * getDataBuffer(const uint16_t offset=0) const
unsigned __int16 uint16_t
uint8_t * getDataStart(void) const
Internal function to get the start of the data buffer.
void resizeData(const uint16_t newSize)
Resize the data area to the given size.
void operator=(const Message &src)
Copy message src into this.
double getDataFP1632(const uint16_t offset=0) const
Return the current value of the data as a double, converting it from FP 16.32.
void deleteData(uint16_t size, uint16_t offset=0)
Remove a number of bytes from the message (this will reduce the message size)
double getDataF1220(const uint16_t offset=0) const
Return the current value of the data as a double, converting it from FP 12.20.
uint8_t getBusId(void) const
Return the current value of the m_busId field.
void clear(void)
Clear all data in the message.
uint16_t getDataSize(void) const
Return the length of the data part of the message.
void insertData(uint16_t size, uint16_t offset=0)
Insert a number of bytes into the message (this will increase the message size)
uint16_t getDataShort(const uint16_t offset=0) const
Return the current value of the data as an uint16_t (16 bits).
void recomputeChecksum(void)
Compute the checksum field and fill it.
Message(const uint8_t msgId=0, const uint16_t length=0, const uint16_t maxLength=CMT_MAXMSGLEN)
Create a Message object with the given data length and message Id.
CMT_CHECKVAR MessageHeader * m_buffer
The message header is the data buffer with interpretation.
uint8_t computeChecksum(const uint8_t *buffer, uint32_t length)
Compute the checksum of the given byte string.
float getDataFloat(const uint16_t offset=0) const
Return the current value of the data as a float (32 bits).
XsensResultValue
Xsens return values.
void setDataFloat(const float data, const uint16_t offset=0)
Write a float (32 bits) into the data buffer.
XsensResultValue loadFromString(const uint8_t *source, const uint16_t size)
Read the entire message from the given source string.
void setDataLong(const uint32_t data, const uint16_t offset=0)
Write an uint32_t (32 bits) into the data buffer.
void setDataDouble(const double data, const uint16_t offset=0)
Write a double (64 bits) into the data buffer.
uint8_t * getDataBuffer(const uint16_t offset=0)
Return a pointer to the data buffer.
unsigned __int64 uint64_t
uint8_t getMessageId(void) const
Return the current value of the m_messageId field.
void setDataFP1632(const double data, const uint16_t offset=0)
Write a double (64 bits) into the data buffer, after converting it to FP1632.
const uint8_t * getMessageStart(void) const
Return the start of the message buffer.
uint8_t calcChecksum(void) const
Internal checksum computation.
GLuint GLsizei GLsizei * length
GLsizei GLsizei GLchar * source
uint8_t getDataByte(const uint16_t offset=0) const
Return the current value of the data as an unsigned byte (8 bits).
The namespace of all Xsens software since 2006.
void setDataBuffer(const uint8_t *data, const uint16_t offset=0, const uint16_t count=0)
Write a string of bytes into the data buffer.
void setMessageId(const uint8_t msgId)
Set the new value of the m_messageId field and update the checksum.
void setBusId(const uint8_t busId)
Set the new value of the m_busId field and update the checksum.
bool m_autoUpdateChecksum
uint16_t getTotalMessageSize(void) const
Return the length of the message buffer.
unsigned __int32 uint32_t
bool isChecksumOk(void) const
Compute the checksum and compare it with the stored checksum.
uint8_t * m_checksum
The checksum in the m_data or m_extendedData buffer.
GLsizei GLsizei GLenum GLenum const GLvoid * data
double getDataDouble(const uint16_t offset=0) const
Return the current value of the data as a double (64 bits).
void setDataF1220(const double data, const uint16_t offset=0)
Write a double (64 bits) into the data buffer, after converting it to F1220.
void setDataByte(const uint8_t data, const uint16_t offset=0)
Write an unsigned byte (8 bits) into the data buffer.
uint32_t m_maxLength
The maximum size of the message, including header and footer.
Class for storing a single message.
void setDataShort(const uint16_t data, const uint16_t offset=0)
Write an uint16_t (16 bits) into the data buffer.