#include <Message.h>
Definition at line 75 of file Message.h.
◆ dataOffsets
| Enumerator |
|---|
| SOH_OFST | |
| LENGTH_OFST | |
| LENGTH_COMP_OFST | |
| VERSION_OFST | |
| TIMESTAMP_OFST | |
| FLAGS_OFST | |
| TYPE_OFST | |
| STX_OFST | |
| PAYLOAD_OFST | |
Definition at line 88 of file Message.h.
◆ Message() [1/4]
| clearpath::Message::Message |
( |
| ) |
|
◆ Message() [2/4]
| clearpath::Message::Message |
( |
void * |
input, |
|
|
size_t |
msg_len |
|
) |
| |
◆ Message() [3/4]
| clearpath::Message::Message |
( |
const Message & |
other | ) |
|
◆ Message() [4/4]
| clearpath::Message::Message |
( |
uint16_t |
type, |
|
|
uint8_t * |
payload, |
|
|
size_t |
payload_len, |
|
|
uint32_t |
timestamp = 0, |
|
|
uint8_t |
flags = 0, |
|
|
uint8_t |
version = 0 |
|
) |
| |
◆ ~Message()
| clearpath::Message::~Message |
( |
| ) |
|
|
virtual |
◆ crcOffset()
| size_t clearpath::Message::crcOffset |
( |
| ) |
|
|
inlineprotected |
◆ factory()
| Message * clearpath::Message::factory |
( |
void * |
input, |
|
|
size_t |
msg_len |
|
) |
| |
|
static |
Instantiates the Message subclass corresponding to the type field in raw message data.
- Parameters
-
| input | The raw message data to instantiate from |
| msg_len | The length of input. |
- Returns
- An instance of the correct Message subclass
Definition at line 385 of file Message.cpp.
◆ getChecksum()
| uint16_t clearpath::Message::getChecksum |
( |
| ) |
|
◆ getFlags()
| uint8_t clearpath::Message::getFlags |
( |
| ) |
|
◆ getLength()
| uint8_t clearpath::Message::getLength |
( |
| ) |
|
◆ getLengthComp()
| uint8_t clearpath::Message::getLengthComp |
( |
| ) |
|
◆ getPayload()
| size_t clearpath::Message::getPayload |
( |
void * |
buf, |
|
|
size_t |
buf_size |
|
) |
| |
Copies message payload into a provided buffer.
- Parameters
-
| buf | The buffer to fill |
| buf_size | Maximum length of buf |
- Returns
- number of bytes copied.
Definition at line 167 of file Message.cpp.
◆ getPayloadLength()
| size_t clearpath::Message::getPayloadLength |
( |
| ) |
|
|
inline |
◆ getPayloadPointer()
| uint8_t * clearpath::Message::getPayloadPointer |
( |
size_t |
offset = 0 | ) |
|
|
protected |
Get a pointer to the payload withing this Message's internal storage.
- Parameters
-
| offset | The offset from the beginning of the payload. |
- Returns
- a pointer to this Message's internal storage.
Definition at line 181 of file Message.cpp.
◆ getTimestamp()
| uint32_t clearpath::Message::getTimestamp |
( |
| ) |
|
◆ getTotalLength()
| size_t clearpath::Message::getTotalLength |
( |
| ) |
|
|
inline |
◆ getType()
| uint16_t clearpath::Message::getType |
( |
| ) |
|
◆ getVersion()
| uint8_t clearpath::Message::getVersion |
( |
| ) |
|
◆ isCommand()
| bool clearpath::Message::isCommand |
( |
| ) |
|
|
inline |
◆ isData()
| bool clearpath::Message::isData |
( |
| ) |
|
|
inline |
◆ isRequest()
| bool clearpath::Message::isRequest |
( |
| ) |
|
|
inline |
◆ isValid()
| bool clearpath::Message::isValid |
( |
char * |
whyNot = NULL, |
|
|
size_t |
strLen = 0 |
|
) |
| |
Checks the consistency of this message.
- Parameters
-
| whyNot | Optionally, a reason for validation failure will be written here. |
| strLen | Length of the optional whyNot string |
- Returns
- true if the message is valid, false otherwise.
Definition at line 302 of file Message.cpp.
◆ makeValid()
| void clearpath::Message::makeValid |
( |
| ) |
|
|
protected |
Sets SOH, STX, length, and checksum so that this message becomes valid.
Definition at line 340 of file Message.cpp.
◆ popNext()
| Message * clearpath::Message::popNext |
( |
| ) |
|
|
static |
◆ printMessage()
| std::ostream & clearpath::Message::printMessage |
( |
std::ostream & |
stream = std::cout | ) |
|
|
virtual |
Reimplemented in clearpath::DataVelocity, clearpath::DataSystemStatus, clearpath::DataSafetySystemStatus, clearpath::DataRawVoltage, clearpath::DataRawTemperature, clearpath::DataRawOrientation, clearpath::DataRawMagnetometer, clearpath::DataRawGyro, clearpath::DataRawCurrent, clearpath::DataRawAcceleration, clearpath::DataRangefinderTimings, clearpath::DataRangefinders, clearpath::DataProcessorStatus, clearpath::DataPowerSystem, clearpath::DataPlatformRotation, clearpath::DataPlatformOrientation, clearpath::DataPlatformMagnetometer, clearpath::DataPlatformName, clearpath::DataPlatformInfo, clearpath::DataPlatformAcceleration, clearpath::DataMaxSpeed, clearpath::DataMaxAcceleration, clearpath::DataGear, clearpath::DataFirmwareInfo, clearpath::DataEncodersRaw, clearpath::DataEncoders, clearpath::DataEcho, clearpath::DataDifferentialSpeed, clearpath::DataDifferentialOutput, clearpath::DataDifferentialControl, and clearpath::DataAckermannOutput.
Definition at line 350 of file Message.cpp.
◆ printRaw()
| void clearpath::Message::printRaw |
( |
std::ostream & |
stream = std::cout | ) |
|
◆ send()
| void clearpath::Message::send |
( |
| ) |
|
◆ setFlags()
| void clearpath::Message::setFlags |
( |
uint8_t |
flags | ) |
|
|
protected |
◆ setLength()
| void clearpath::Message::setLength |
( |
uint8_t |
len | ) |
|
|
protected |
◆ setPayload()
| void clearpath::Message::setPayload |
( |
void * |
buf, |
|
|
size_t |
buf_size |
|
) |
| |
|
protected |
Set the payload of this message. Modifies the length of the message as necessary, as per setPayloadLength.
- See also
- Message::setPayloadLength()
- Parameters
-
| buf | Buffer containing the new payload. |
| buf_size | Length of buf. |
Definition at line 270 of file Message.cpp.
◆ setPayloadLength()
| void clearpath::Message::setPayloadLength |
( |
uint8_t |
len | ) |
|
|
protected |
Changes the payload length of the packet. Does not update packet len/~len fields or the checksum. Call makeValid() to update these fields.
- Parameters
-
| len | The new payload length |
Definition at line 256 of file Message.cpp.
◆ setTimestamp()
| void clearpath::Message::setTimestamp |
( |
uint32_t |
timestamp | ) |
|
|
protected |
◆ setType()
| void clearpath::Message::setType |
( |
uint16_t |
type | ) |
|
|
protected |
◆ setVersion()
| void clearpath::Message::setVersion |
( |
uint8_t |
version | ) |
|
|
protected |
◆ toBytes()
| size_t clearpath::Message::toBytes |
( |
void * |
buf, |
|
|
size_t |
buf_size |
|
) |
| |
Copy the complete raw content of this message to a buffer.
- Parameters
-
| buf | The buffer to copy to |
| buf_size | The maximum length of buf |
- Returns
- buf on success, NULL on failure
Definition at line 284 of file Message.cpp.
◆ waitNext()
| Message * clearpath::Message::waitNext |
( |
double |
timeout = 0.0 | ) |
|
|
static |
◆ Transport
◆ CRC_INIT_VAL
| const uint16_t clearpath::Message::CRC_INIT_VAL = 0xFFFF |
|
staticprotected |
◆ CRC_LENGTH
| const size_t clearpath::Message::CRC_LENGTH = 2 |
|
staticprotected |
◆ data
◆ HEADER_LENGTH
| const size_t clearpath::Message::HEADER_LENGTH = 12 |
|
staticprotected |
◆ is_sent
| bool clearpath::Message::is_sent |
|
protected |
◆ MAX_MSG_LENGTH
| const size_t clearpath::Message::MAX_MSG_LENGTH = 256 |
|
static |
◆ MIN_MSG_LENGTH
◆ SOH
| const uint8_t clearpath::Message::SOH = 0xAA |
|
static |
◆ STX
| const uint8_t clearpath::Message::STX = 0x55 |
|
static |
◆ total_len
| size_t clearpath::Message::total_len |
|
protected |
The documentation for this class was generated from the following files: