|
xsens_imu
|
Class for storing a single message. More...
#include <cmtmessage.h>
Public Member Functions | |
| 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. More... | |
| Message (const uint8_t *source, const uint16_t size, const uint16_t maxLength=CMT_MAXMSGLEN) | |
| Create a message from the given source string. More... | |
| Message (const Message &src) | |
| ~Message () | |
| Destructor. More... | |
| void | clear (void) |
| Clear all data in the message. More... | |
| uint8_t | getBusId (void) const |
| Return the current value of the m_busId field. More... | |
| uint8_t * | getDataBuffer (const uint16_t offset=0) |
| Return a pointer to the data buffer. More... | |
| const uint8_t * | getDataBuffer (const uint16_t offset=0) const |
| uint8_t | getDataByte (const uint16_t offset=0) const |
| Return the current value of the data as an unsigned byte (8 bits). More... | |
| double | getDataDouble (const uint16_t offset=0) const |
| Return the current value of the data as a double (64 bits). More... | |
| float | getDataFloat (const uint16_t offset=0) const |
| Return the current value of the data as a float (32 bits). More... | |
| double | getDataF1220 (const uint16_t offset=0) const |
| Return the current value of the data as a double, converting it from FP 12.20. More... | |
| double | getDataFP1632 (const uint16_t offset=0) const |
| Return the current value of the data as a double, converting it from FP 16.32. More... | |
| double | getDataFPValue (const uint64_t outputSettings, const uint16_t offset=0) const |
| Return current data value as double, conversion depends on outputSettings. More... | |
| void | getDataFPValue (double *dest, const uint64_t outputSettings, uint16_t offset, const int16_t numValues) const |
| Return current data values as double, conversion depends on outputSetting. More... | |
| uint32_t | getDataLong (const uint16_t offset=0) const |
| Return the current value of the data as an uint32_t (32 bits). More... | |
| uint16_t | getDataShort (const uint16_t offset=0) const |
| Return the current value of the data as an uint16_t (16 bits). More... | |
| uint16_t | getDataSize (void) const |
| Return the length of the data part of the message. More... | |
| uint8_t | getMessageId (void) const |
| Return the current value of the m_messageId field. More... | |
| const uint8_t * | getMessageStart (void) const |
| Return the start of the message buffer. More... | |
| uint16_t | getTotalMessageSize (void) const |
| Return the length of the message buffer. More... | |
| bool | isChecksumOk (void) const |
| Compute the checksum and compare it with the stored checksum. Equal is ok. More... | |
| XsensResultValue | loadFromString (const uint8_t *source, const uint16_t size) |
| Read the entire message from the given source string. More... | |
| void | recomputeChecksum (void) |
| Compute the checksum field and fill it. More... | |
| void | resizeData (const uint16_t newSize) |
| Resize the data area to the given size. More... | |
| void | setBusId (const uint8_t busId) |
| Set the new value of the m_busId field and update the checksum. More... | |
| 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. More... | |
| void | setDataByte (const uint8_t data, const uint16_t offset=0) |
| Write an unsigned byte (8 bits) into the data buffer. More... | |
| void | setDataDouble (const double data, const uint16_t offset=0) |
| Write a double (64 bits) into the data buffer. More... | |
| void | setDataFloat (const float data, const uint16_t offset=0) |
| Write a float (32 bits) into the data buffer. More... | |
| void | setDataF1220 (const double data, const uint16_t offset=0) |
| Write a double (64 bits) into the data buffer, after converting it to F1220. More... | |
| void | setDataFP1632 (const double data, const uint16_t offset=0) |
| Write a double (64 bits) into the data buffer, after converting it to FP1632. More... | |
| 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. More... | |
| void | setDataFPValue (const uint64_t outputSettings, const double *data, uint16_t offset, const uint16_t numValues) |
| Write a floating/fixed point value into to the data buffer, conversion depends on outputSettings. More... | |
| void | setDataLong (const uint32_t data, const uint16_t offset=0) |
| Write an uint32_t (32 bits) into the data buffer. More... | |
| void | setDataShort (const uint16_t data, const uint16_t offset=0) |
| Write an uint16_t (16 bits) into the data buffer. More... | |
| void | setMessageId (const uint8_t msgId) |
| Set the new value of the m_messageId field and update the checksum. More... | |
| void | operator= (const Message &src) |
| Copy message src into this. More... | |
| void | deleteData (uint16_t size, uint16_t offset=0) |
| Remove a number of bytes from the message (this will reduce the message size) More... | |
| void | insertData (uint16_t size, uint16_t offset=0) |
| Insert a number of bytes into the message (this will increase the message size) More... | |
Public Attributes | |
| bool | m_autoUpdateChecksum |
Protected Member Functions | |
| uint8_t | calcChecksum (void) const |
| Internal checksum computation. More... | |
| uint8_t * | getDataStart (void) const |
| Internal function to get the start of the data buffer. More... | |
Protected Attributes | |
| MessageHeader * | m_buffer |
| The message header is the data buffer with interpretation. More... | |
| uint8_t * | m_checksum |
| The checksum in the m_data or m_extendedData buffer. More... | |
| uint32_t | m_maxLength |
| The maximum size of the message, including header and footer. More... | |
Class for storing a single message.
| xsens::Message::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.
The function allocates enough memory to hold an entire message with the given data length.
| msgId | The message Id that will be assigend to the m_messageId field. |
| length | The length of the data in the message. This value is stored in m_createdLength as well as m_length or m_extendedLength. |
| maxLength | The maximum data length that can be stored in the structure. |
| xsens::Message::Message | ( | const uint8_t * | source, |
| const uint16_t | size, | ||
| const uint16_t | maxLength = CMT_MAXMSGLEN |
||
| ) |
Create a message from the given source string.
This is done through a simple memory copy. The number of bytes copied is taken from the data in the message (so the message is interpreted first). Note that this does NOT recompute the checksum, nor is it checked.
| source | The source string containing message data |
| size | The size of the source string |
| maxLength | The maximum data length that can be stored in the structure. |
| xsens::Message::Message | ( | const Message & | src | ) |
| xsens::Message::~Message | ( | ) |
Destructor.
|
inlineprotected |
Internal checksum computation.
| void xsens::Message::clear | ( | void | ) |
Clear all data in the message.
| void xsens::Message::deleteData | ( | uint16_t | size, |
| uint16_t | offset = 0 |
||
| ) |
Remove a number of bytes from the message (this will reduce the message size)
|
inline |
Return the current value of the m_busId field.
|
inline |
Return a pointer to the data buffer.
| offset | An optional offset in the data buffer from where to start reading. |
|
inline |
|
inline |
Return the current value of the data as an unsigned byte (8 bits).
| offset | An optional offset in the data buffer from where to start reading. |
| double xsens::Message::getDataDouble | ( | const uint16_t | offset = 0 | ) | const |
Return the current value of the data as a double (64 bits).
| offset | An optional offset in the data buffer from where to start reading. |
| double xsens::Message::getDataF1220 | ( | const uint16_t | offset = 0 | ) | const |
Return the current value of the data as a double, converting it from FP 12.20.
| offset | An optional offset in the data buffer from where to start reading. |
| float xsens::Message::getDataFloat | ( | const uint16_t | offset = 0 | ) | const |
Return the current value of the data as a float (32 bits).
| offset | An optional offset in the data buffer from where to start reading. |
| double xsens::Message::getDataFP1632 | ( | const uint16_t | offset = 0 | ) | const |
Return the current value of the data as a double, converting it from FP 16.32.
| offset | An optional offset in the data buffer from where to start reading. |
| double xsens::Message::getDataFPValue | ( | const uint64_t | outputSettings, |
| const uint16_t | offset = 0 |
||
| ) | const |
Return current data value as double, conversion depends on outputSettings.
| outputSettings | MT output settings |
| offset | An optional offset in the data buffer from where to start reading. |
| void xsens::Message::getDataFPValue | ( | double * | dest, |
| const uint64_t | outputSettings, | ||
| uint16_t | offset, | ||
| const int16_t | numValues | ||
| ) | const |
Return current data values as double, conversion depends on outputSetting.
| dest | destination array |
| outputSettings | MT output settings |
| offset | offset in the data buffer from where to start reading. |
| numValues | number of values to be read |
| uint32_t xsens::Message::getDataLong | ( | const uint16_t | offset = 0 | ) | const |
Return the current value of the data as an uint32_t (32 bits).
| offset | An optional offset in the data buffer from where to start reading. |
| uint16_t xsens::Message::getDataShort | ( | const uint16_t | offset = 0 | ) | const |
Return the current value of the data as an uint16_t (16 bits).
| offset | An optional offset in the data buffer from where to start reading. |
| uint16_t xsens::Message::getDataSize | ( | void | ) | const |
Return the length of the data part of the message.
|
protected |
Internal function to get the start of the data buffer.
|
inline |
Return the current value of the m_messageId field.
|
inline |
Return the start of the message buffer.
The function returns the address of the m_preamble member.
| uint16_t xsens::Message::getTotalMessageSize | ( | void | ) | const |
Return the length of the message buffer.
The function returns the total size of the message, including the checksum. This is in effect the number of bytes that would be transferred if the message were to be sent over a communications channel.
| void xsens::Message::insertData | ( | uint16_t | size, |
| uint16_t | offset = 0 |
||
| ) |
Insert a number of bytes into the message (this will increase the message size)
| bool xsens::Message::isChecksumOk | ( | void | ) | const |
Compute the checksum and compare it with the stored checksum. Equal is ok.
| XsensResultValue xsens::Message::loadFromString | ( | const uint8_t * | source, |
| const uint16_t | size | ||
| ) |
Read the entire message from the given source string.
This is done through a simple memory copy. The number of bytes copied is m_createdLength.
| source | The source string containing message data |
| size | The size of the source string |
| void xsens::Message::operator= | ( | const Message & | src | ) |
Copy message src into this.
|
inline |
Compute the checksum field and fill it.
The checksum field should normally be correct at all times, but if you have somehow managed to mess it up, this function can be used to recompute it.
| void xsens::Message::resizeData | ( | const uint16_t | newSize | ) |
Resize the data area to the given size.
| void xsens::Message::setBusId | ( | const uint8_t | busId | ) |
Set the new value of the m_busId field and update the checksum.
| void xsens::Message::setDataBuffer | ( | const uint8_t * | data, |
| const uint16_t | offset = 0, |
||
| const uint16_t | count = 0 |
||
| ) |
Write a string of bytes into the data buffer.
| data | The data to write to the buffer. |
| offset | An optional offset in the data buffer from where to start writing. |
| count | An optional number of bytes to write, if set to 0 (not set), as many bytes as will fit into the buffer from the given point will be written. |
| void xsens::Message::setDataByte | ( | const uint8_t | data, |
| const uint16_t | offset = 0 |
||
| ) |
Write an unsigned byte (8 bits) into the data buffer.
| data | The data to write to the buffer. |
| offset | An optional offset in the data buffer from where to start writing. |
| void xsens::Message::setDataDouble | ( | const double | data, |
| const uint16_t | offset = 0 |
||
| ) |
Write a double (64 bits) into the data buffer.
| data | The data to write to the buffer. |
| offset | An optional offset in the data buffer from where to start writing. |
| void xsens::Message::setDataF1220 | ( | const double | data, |
| const uint16_t | offset = 0 |
||
| ) |
Write a double (64 bits) into the data buffer, after converting it to F1220.
| data | The data to write to the buffer. |
| offset | An optional offset in the data buffer from where to start writing. |
| void xsens::Message::setDataFloat | ( | const float | data, |
| const uint16_t | offset = 0 |
||
| ) |
Write a float (32 bits) into the data buffer.
| data | The data to write to the buffer. |
| offset | An optional offset in the data buffer from where to start writing. |
| void xsens::Message::setDataFP1632 | ( | const double | data, |
| const uint16_t | offset = 0 |
||
| ) |
Write a double (64 bits) into the data buffer, after converting it to FP1632.
| data | The data to write to the buffer. |
| offset | An optional offset in the data buffer from where to start writing. |
| void xsens::Message::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.
| outputSettings | MT output settings |
| data | The data to write to the buffer. |
| offset | An optional offset in the data buffer from where to start writing. |
| void xsens::Message::setDataFPValue | ( | const uint64_t | outputSettings, |
| const double * | data, | ||
| uint16_t | offset, | ||
| const uint16_t | numValues | ||
| ) |
Write a floating/fixed point value into to the data buffer, conversion depends on outputSettings.
| outputSettings | MT output settings |
| data | The data array to be written to the buffer. |
| offset | Offset in the data buffer from where to start writing. |
| numValues | number of values to be written |
| void xsens::Message::setDataLong | ( | const uint32_t | data, |
| const uint16_t | offset = 0 |
||
| ) |
Write an uint32_t (32 bits) into the data buffer.
| data | The data to write to the buffer. |
| offset | An optional offset in the data buffer from where to start writing. |
| void xsens::Message::setDataShort | ( | const uint16_t | data, |
| const uint16_t | offset = 0 |
||
| ) |
Write an uint16_t (16 bits) into the data buffer.
| data | The data to write to the buffer. |
| offset | An optional offset in the data buffer from where to start writing. |
| void xsens::Message::setMessageId | ( | const uint8_t | msgId | ) |
Set the new value of the m_messageId field and update the checksum.
| bool xsens::Message::m_autoUpdateChecksum |
|
protected |
The message header is the data buffer with interpretation.
|
protected |
The checksum in the m_data or m_extendedData buffer.
|
protected |
The maximum size of the message, including header and footer.
1.8.6