#include <Message.h>
|
uint16_t | getChecksum () |
|
uint8_t | getFlags () |
|
uint8_t | getLength () |
|
uint8_t | getLengthComp () |
|
size_t | getPayload (void *buf, size_t max_size) |
|
size_t | getPayloadLength () |
|
size_t | getTotalLength () |
|
uint16_t | getType () |
|
size_t | getType (void *buf, size_t max_size) |
|
size_t | getTypeLength () |
|
uint8_t | getVersion () |
|
bool | isCommand () |
|
bool | isData () |
|
bool | isRequest () |
|
bool | isValid (char *whyNot=NULL, size_t strLen=0) |
|
| Message () |
|
| Message (void *input, size_t msg_len) |
|
| Message (const Message &other) |
|
| Message (uint16_t type, uint8_t *payload, size_t payload_len, uint32_t timestamp=0, uint8_t flags=0, uint8_t version=0) |
|
virtual std::ostream & | printMessage (std::ostream &stream=std::cout) |
|
void | printRaw (std::ostream &stream=std::cout) |
|
void | send () |
|
Message * | sendRequest () |
|
size_t | toBytes (void *buf, size_t buf_size) |
|
virtual | ~Message () |
|
Definition at line 67 of file Message.h.
Enumerator |
---|
SOH_OFST |
|
LENGTH_OFST |
|
LENGTH_COMP_OFST |
|
VERSION_OFST |
|
FLAGS_OFST |
|
STX_OFST |
|
TYPE_OFST |
|
PAYLOAD_OFST |
|
Definition at line 83 of file Message.h.
sawyer::Message::Message |
( |
| ) |
|
sawyer::Message::Message |
( |
void * |
input, |
|
|
size_t |
msg_len |
|
) |
| |
sawyer::Message::Message |
( |
const Message & |
other | ) |
|
sawyer::Message::Message |
( |
uint16_t |
type, |
|
|
uint8_t * |
payload, |
|
|
size_t |
payload_len, |
|
|
uint32_t |
timestamp = 0 , |
|
|
uint8_t |
flags = 0 , |
|
|
uint8_t |
version = 0 |
|
) |
| |
sawyer::Message::~Message |
( |
| ) |
|
|
virtual |
size_t sawyer::Message::crcOffset |
( |
| ) |
|
|
inlineprotected |
Message * sawyer::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 423 of file Message.cpp.
uint16_t sawyer::Message::getChecksum |
( |
| ) |
|
uint8_t sawyer::Message::getFlags |
( |
| ) |
|
uint8_t sawyer::Message::getLength |
( |
| ) |
|
uint8_t sawyer::Message::getLengthComp |
( |
| ) |
|
size_t sawyer::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 204 of file Message.cpp.
size_t sawyer::Message::getPayloadLength |
( |
| ) |
|
|
inline |
uint8_t * sawyer::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 218 of file Message.cpp.
size_t sawyer::Message::getTotalLength |
( |
| ) |
|
|
inline |
uint16_t sawyer::Message::getType |
( |
| ) |
|
size_t sawyer::Message::getType |
( |
void * |
buf, |
|
|
size_t |
max_size |
|
) |
| |
size_t sawyer::Message::getTypeLength |
( |
| ) |
|
|
inline |
uint8_t sawyer::Message::getVersion |
( |
| ) |
|
bool sawyer::Message::isCommand |
( |
| ) |
|
|
inline |
bool sawyer::Message::isData |
( |
| ) |
|
|
inline |
bool sawyer::Message::isRequest |
( |
| ) |
|
|
inline |
bool sawyer::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 329 of file Message.cpp.
void sawyer::Message::makeValid |
( |
| ) |
|
|
protected |
Sets SOH, STX, length, and checksum so that this message becomes valid.
Definition at line 372 of file Message.cpp.
Message * sawyer::Message::popNext |
( |
| ) |
|
|
static |
std::ostream & sawyer::Message::printMessage |
( |
std::ostream & |
stream = std::cout | ) |
|
|
virtual |
Reimplemented in sawyer::DataVelocity, sawyer::DataSystemStatus, sawyer::DataSafetySystemStatus, sawyer::DataRawVoltage, sawyer::DataRawTemperature, sawyer::DataRawOrientation, sawyer::DataXYZData, sawyer::DataRawMagnetometer, sawyer::DataRawGyro, sawyer::DataRawCurrent, sawyer::Data6AxisYaw, sawyer::DataRawAcceleration, sawyer::DataRangefinderTimings, sawyer::DataRangefinders, sawyer::DataProcessorStatus, sawyer::DataPowerSystem, sawyer::DataPlatformRotation, sawyer::DataPlatformOrientation, sawyer::DataPlatformMagnetometer, sawyer::DataPlatformName, sawyer::DataPlatformInfo, sawyer::DataPlatformAcceleration, sawyer::DataMaxSpeed, sawyer::DataMaxAcceleration, sawyer::DataGear, sawyer::DataFirmwareInfo, sawyer::DataEncodersRaw, sawyer::DataEncoders, sawyer::DataEcho, sawyer::DataWheelInfo, sawyer::DataDifferentialSpeed, sawyer::DataDifferentialOutput, sawyer::DataDifferentialControl, and sawyer::DataAckermannOutput.
Definition at line 389 of file Message.cpp.
void sawyer::Message::printRaw |
( |
std::ostream & |
stream = std::cout | ) |
|
void sawyer::Message::send |
( |
| ) |
|
Message * sawyer::Message::sendRequest |
( |
| ) |
|
void sawyer::Message::setFlags |
( |
uint8_t |
flags | ) |
|
|
protected |
void sawyer::Message::setLength |
( |
uint8_t |
len | ) |
|
|
protected |
void sawyer::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 296 of file Message.cpp.
void sawyer::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 282 of file Message.cpp.
void sawyer::Message::setType |
( |
uint16_t |
type | ) |
|
|
protected |
void sawyer::Message::setVersion |
( |
uint8_t |
version | ) |
|
|
protected |
size_t sawyer::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 311 of file Message.cpp.
Message * sawyer::Message::waitNext |
( |
double |
timeout = 0.0 | ) |
|
|
static |
const uint16_t sawyer::Message::CRC_INIT_VAL = 0xFFFF |
|
staticprotected |
const size_t sawyer::Message::CRC_LENGTH = 2 |
|
staticprotected |
const size_t sawyer::Message::HEADER_LENGTH = 8 |
|
staticprotected |
bool sawyer::Message::is_sent |
|
protected |
const size_t sawyer::Message::MAX_MSG_LENGTH = 256 |
|
static |
const uint8_t sawyer::Message::SOH = 0xAA |
|
static |
const uint8_t sawyer::Message::STX = 0x55 |
|
static |
size_t sawyer::Message::total_len |
The documentation for this class was generated from the following files: