Class Message

Inheritance Relationships

Derived Types

Class Documentation

class Message

Subclassed by clearpath::CmdMessage, clearpath::DataAckermannOutput, clearpath::DataDifferentialControl, clearpath::DataDifferentialOutput, clearpath::DataDifferentialSpeed, clearpath::DataEcho, clearpath::DataEncoders, clearpath::DataEncodersRaw, clearpath::DataFirmwareInfo, clearpath::DataGear, clearpath::DataMaxAcceleration, clearpath::DataMaxSpeed, clearpath::DataPlatformAcceleration, clearpath::DataPlatformInfo, clearpath::DataPlatformMagnetometer, clearpath::DataPlatformName, clearpath::DataPlatformOrientation, clearpath::DataPlatformRotation, clearpath::DataPowerSystem, clearpath::DataProcessorStatus, clearpath::DataRangefinderTimings, clearpath::DataRangefinders, clearpath::DataRawAcceleration, clearpath::DataRawCurrent, clearpath::DataRawGyro, clearpath::DataRawMagnetometer, clearpath::DataRawOrientation, clearpath::DataRawTemperature, clearpath::DataRawVoltage, clearpath::DataSafetySystemStatus, clearpath::DataSystemStatus, clearpath::DataVelocity, clearpath::Request

Public Functions

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 ~Message()
void send()
uint8_t getLength()
uint8_t getLengthComp()
uint8_t getVersion()
uint32_t getTimestamp()
uint8_t getFlags()
uint16_t getType()
uint16_t getChecksum()
inline size_t getPayloadLength()
size_t getPayload(void *buf, size_t max_size)
inline size_t getTotalLength()
size_t toBytes(void *buf, size_t buf_size)
bool isValid(char *whyNot = NULL, size_t strLen = 0)
inline bool isCommand()
inline bool isRequest()
inline bool isData()
virtual std::ostream &printMessage(std::ostream &stream = std::cout)
void printRaw(std::ostream &stream = std::cout)

Public Static Functions

static Message *factory(void *input, size_t msg_len)
static Message *popNext()
static Message *waitNext(double timeout = 0.0)

Public Static Attributes

static const size_t MAX_MSG_LENGTH = 256
static const size_t MIN_MSG_LENGTH = HEADER_LENGTH + CRC_LENGTH
static const uint8_t SOH = 0xAA
static const uint8_t STX = 0x55

Protected Types

enum dataOffsets

Values:

enumerator SOH_OFST
enumerator LENGTH_OFST
enumerator LENGTH_COMP_OFST
enumerator VERSION_OFST
enumerator TIMESTAMP_OFST
enumerator FLAGS_OFST
enumerator TYPE_OFST
enumerator STX_OFST
enumerator PAYLOAD_OFST

Protected Functions

inline size_t crcOffset()
void setLength(uint8_t len)
void setVersion(uint8_t version)
void setTimestamp(uint32_t timestamp)
void setFlags(uint8_t flags)
void setType(uint16_t type)
uint8_t *getPayloadPointer(size_t offset = 0)
void setPayload(void *buf, size_t buf_size)
void setPayloadLength(uint8_t len)
void makeValid()

Protected Attributes

uint8_t data[MAX_MSG_LENGTH]
size_t total_len
bool is_sent

Protected Static Attributes

static const size_t CRC_LENGTH = 2
static const uint16_t CRC_INIT_VAL = 0xFFFF
static const size_t HEADER_LENGTH = 12

Friends

friend class Transport