CARMA C++
|
Class to encapsulate a CAN message. More...
#include <carma/canbus/Message.h>
Public Member Functions | |
::std::string | dump (bool abbreviate, bool ascii) const |
Dump everything we know about this message in CARMAesque. More... | |
carma::canbus::busIdType | getBusId () const |
Get CAN bus Id. More... | |
DataVector | getData () const |
Get the data as a vector of up to 8 bytes. More... | |
carma::canbus::idType | getId () const |
Get CAN message id. More... | |
double | getRxMjd () const |
Return the Rx MJD time. More... | |
bool | isSimulated () const |
Return simulated flag. More... | |
Message () | |
Default constructor. More... | |
Message (carma::canbus::idType id, carma::canbus::busIdType busId) | |
Create an extended message with specified id and busId. More... | |
Message (carma::canbus::idType id, const DataVector &data, carma::canbus::busIdType busId) | |
Create an extended message with the specified ids and data. More... | |
Message (const Message &other) | |
Copy constructor. More... | |
bool | operator!= (const Message &other) |
Returns false if the id's, busId's or data differs (including length). More... | |
carma::canbus::Message & | operator<< (unsigned char rvalue) |
Add an unsigned char to CAN message data. More... | |
carma::canbus::Message & | operator<< (unsigned short rvalue) |
Add an unsigned short to CAN message data. More... | |
carma::canbus::Message & | operator<< (short rvalue) |
Add a signed short to CAN message data. More... | |
carma::canbus::Message & | operator<< (unsigned long int rvalue) |
Add an unsigned long integer to CAN message data. More... | |
carma::canbus::Message & | operator<< (long int rvalue) |
Add a long integer to CAN message data. More... | |
carma::canbus::Message & | operator<< (float rvalue) |
Add an IEEE 754-1990 float to CAN message data. More... | |
carma::canbus::Message & | operator<< (double rvalue) |
Add an IEEE 754-1990 double float to CAN message data. More... | |
Message & | operator= (const Message &other) |
Assignment operator. More... | |
bool | operator== (const Message &other) |
Returns true if the id's, data and busId's are identical (including data length). More... | |
void | setBusId (carma::canbus::busIdType busId) |
Set bus Id. More... | |
void | setData (const carma::canbus::DataVector &data) |
Set the data. More... | |
void | setId (carma::canbus::idType id) |
Set CAN message id. More... | |
void | setRxMjd (double mjd) |
Set the rxMjd time. More... | |
void | setSimFlag (bool sim) |
Set the simulated flag. More... | |
carma::canbus::Message::Message | ( | ) |
Default constructor.
Creates a Message with an id of 0, busId 0, and no data.
carma::canbus::Message::Message | ( | carma::canbus::idType | id, |
carma::canbus::busIdType | busId | ||
) |
Create an extended message with specified id and busId.
CAN::Error | if the id is illegal (more than 29 bits). |
carma::canbus::Message::Message | ( | carma::canbus::idType | id, |
const DataVector & | data, | ||
carma::canbus::busIdType | busId | ||
) |
Create an extended message with the specified ids and data.
CAN::Error | if the id is illegal or the data contains more than 8 bytes. |
carma::canbus::Message::Message | ( | const Message & | other | ) |
Copy constructor.
::std::string carma::canbus::Message::dump | ( | bool | abbreviate, |
bool | ascii | ||
) | const |
Dump everything we know about this message in CARMAesque.
Prints the bus, api and node (or board type and serial number), message id, whether it was intended for the host or nodes and the raw data in hex.
abbreviate | Only output data if true. |
ascii | Output data as ascii text if true. |
carma::canbus::busIdType carma::canbus::Message::getBusId | ( | ) | const |
Get CAN bus Id.
DataVector carma::canbus::Message::getData | ( | ) | const |
Get the data as a vector of up to 8 bytes.
carma::canbus::idType carma::canbus::Message::getId | ( | ) | const |
Get CAN message id.
double carma::canbus::Message::getRxMjd | ( | ) | const |
Return the Rx MJD time.
bool carma::canbus::Message::isSimulated | ( | ) | const |
Return simulated flag.
This method should be used to determine if the Message was artificially constructed for simulation purposes (i.e. not retrieved from or posted to a CAN bus).
bool carma::canbus::Message::operator!= | ( | const Message & | other | ) |
Returns false if the id's, busId's or data differs (including length).
carma::canbus::Message& carma::canbus::Message::operator<< | ( | unsigned char | rvalue | ) |
Add an unsigned char to CAN message data.
carma::canbus::BadDataSizeException | if resulting data size is > 8 bytes. |
carma::canbus::Message& carma::canbus::Message::operator<< | ( | unsigned short | rvalue | ) |
Add an unsigned short to CAN message data.
carma::canbus::BadDataSizeException | if resulting data size is > 8 bytes. |
carma::canbus::Message& carma::canbus::Message::operator<< | ( | short | rvalue | ) |
Add a signed short to CAN message data.
carma::canbus::BadDataSizeException | if resulting data size is > 8 bytes. |
carma::canbus::Message& carma::canbus::Message::operator<< | ( | unsigned long int | rvalue | ) |
Add an unsigned long integer to CAN message data.
carma::canbus::BadDataSizeException | if resulting data size is > 8 bytes. |
carma::canbus::Message& carma::canbus::Message::operator<< | ( | long int | rvalue | ) |
Add a long integer to CAN message data.
carma::canbus::BadDataSizeException | if resulting data size is > 8 bytes. |
carma::canbus::Message& carma::canbus::Message::operator<< | ( | float | rvalue | ) |
Add an IEEE 754-1990 float to CAN message data.
carma::canbus::BadDataSizeException | if resulting data size is > 8 bytes. |
carma::canbus::Message& carma::canbus::Message::operator<< | ( | double | rvalue | ) |
Add an IEEE 754-1990 double float to CAN message data.
carma::canbus::BadDataSizeException | if resulting data size is > 8 bytes. |
bool carma::canbus::Message::operator== | ( | const Message & | other | ) |
Returns true if the id's, data and busId's are identical (including data length).
void carma::canbus::Message::setBusId | ( | carma::canbus::busIdType | busId | ) |
Set bus Id.
void carma::canbus::Message::setData | ( | const carma::canbus::DataVector & | data | ) |
Set the data.
carma::canbus::BadDataSizeException | if the data contains more than 8 bytes. |
void carma::canbus::Message::setId | ( | carma::canbus::idType | id | ) |
Set CAN message id.
carma::canbus::BadParameterException | if id is illegal (more than 29 bits). |
void carma::canbus::Message::setRxMjd | ( | double | mjd | ) |
Set the rxMjd time.
void carma::canbus::Message::setSimFlag | ( | bool | sim | ) |
Set the simulated flag.
This flag should be set if the message is being artificially created for simulation purposes (i.e. it isn't actually retrieved from or sent to the CAN bus). For the most part, it is set internally by the canbus::Master class.
sim | True if message is simulated, false if not. |