#include <Message.h>
Definition at line 75 of file Message.h.
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.
clearpath::Message::Message |
( |
| ) |
|
clearpath::Message::Message |
( |
void * |
input, |
|
|
size_t |
msg_len |
|
) |
| |
clearpath::Message::Message |
( |
const Message & |
other | ) |
|
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 |
|
) |
| |
clearpath::Message::~Message |
( |
| ) |
|
|
virtual |
size_t clearpath::Message::crcOffset |
( |
| ) |
|
|
inlineprotected |
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.
uint16_t clearpath::Message::getChecksum |
( |
| ) |
|
uint8_t clearpath::Message::getFlags |
( |
| ) |
|
uint8_t clearpath::Message::getLength |
( |
| ) |
|
uint8_t clearpath::Message::getLengthComp |
( |
| ) |
|
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.
size_t clearpath::Message::getPayloadLength |
( |
| ) |
|
|
inline |
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.
uint32_t clearpath::Message::getTimestamp |
( |
| ) |
|
size_t clearpath::Message::getTotalLength |
( |
| ) |
|
|
inline |
uint16_t clearpath::Message::getType |
( |
| ) |
|
uint8_t clearpath::Message::getVersion |
( |
| ) |
|
bool clearpath::Message::isCommand |
( |
| ) |
|
|
inline |
bool clearpath::Message::isData |
( |
| ) |
|
|
inline |
bool clearpath::Message::isRequest |
( |
| ) |
|
|
inline |
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.
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.
Message * clearpath::Message::popNext |
( |
| ) |
|
|
static |
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.
void clearpath::Message::printRaw |
( |
std::ostream & |
stream = std::cout | ) |
|
void clearpath::Message::send |
( |
| ) |
|
void clearpath::Message::setFlags |
( |
uint8_t |
flags | ) |
|
|
protected |
void clearpath::Message::setLength |
( |
uint8_t |
len | ) |
|
|
protected |
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.
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.
void clearpath::Message::setTimestamp |
( |
uint32_t |
timestamp | ) |
|
|
protected |
void clearpath::Message::setType |
( |
uint16_t |
type | ) |
|
|
protected |
void clearpath::Message::setVersion |
( |
uint8_t |
version | ) |
|
|
protected |
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.
Message * clearpath::Message::waitNext |
( |
double |
timeout = 0.0 | ) |
|
|
static |
const uint16_t clearpath::Message::CRC_INIT_VAL = 0xFFFF |
|
staticprotected |
const size_t clearpath::Message::CRC_LENGTH = 2 |
|
staticprotected |
const size_t clearpath::Message::HEADER_LENGTH = 12 |
|
staticprotected |
bool clearpath::Message::is_sent |
|
protected |
const size_t clearpath::Message::MAX_MSG_LENGTH = 256 |
|
static |
const uint8_t clearpath::Message::SOH = 0xAA |
|
static |
const uint8_t clearpath::Message::STX = 0x55 |
|
static |
size_t clearpath::Message::total_len |
|
protected |
The documentation for this class was generated from the following files: