9 #ifndef CARMA_CANBUS_UTILITIES_H
10 #define CARMA_CANBUS_UTILITIES_H
114 void uByteToData(std::vector<byteType> &data,
unsigned char value);
127 void uShortToData(std::vector<byteType> &data,
unsigned short value);
140 void uLongToData(std::vector<byteType> &data,
unsigned long value);
153 void sShortToData(std::vector<byteType> &data,
short value);
166 void sLongToData(std::vector<byteType> &data,
long value);
179 void floatToData(std::vector<byteType> &data,
float value);
192 void doubleToData(std::vector<byteType> &data,
double value);
203 unsigned char dataToUbyte(std::vector<byteType> &data);
215 unsigned short dataToUshort(std::vector<byteType> &data);
227 unsigned long dataToUlong(std::vector<byteType> &data);
348 #endif // CARMA_CANBUS_UTILITIES_H
void sShortToData(std::vector< byteType > &data, short value)
Convert a signed short integer (2 bytes) into raw CAN bytes.
double dataToDouble(std::vector< byteType > &data)
Convert data vector to IEEE double.
timespec calculateTimeToNextSlowBoundary()
Calculate the time to the next five second boundary.
int validateModulbusNo(int modulbusNo)
Validate a modulbusNo.
int validateSlotNo(int slotNo)
Validate slot number for CANbus slot.
void uShortToData(std::vector< byteType > &data, unsigned short value)
Convert an unsigned short integer (2 bytes) into raw CAN bytes.
unsigned short boardType
Carma Board Type id type.
void fromEngId(boardType &bt, serialNumberType &sn, msgType &mid, idType engId)
Convert a raw CAN id to board type, serial number and mid.
Declarations of carma::canbus types.
void floatToData(std::vector< byteType > &data, float value)
Convert a IEEE 754-1990 float (4 bytes) into raw CAN bytes.
unsigned short dataToUshort(std::vector< byteType > &data)
Convert data vector to unsigned short integer.
unsigned char dataToUbyte(std::vector< byteType > &data)
Convert data vector to unsigned byte.
const bool TO_NODES
Constant for bool host parameter of createId indicating that the message is to be addressed to the ca...
idType createId(bool host, apiType api, nodeType node, msgType mid)
Create a CAN id from api, node and mid.
void fromId(apiType &api, nodeType &node, msgType &mid, idType id)
Convert a raw CAN id to api code, node location and mid.
long dataToLong(std::vector< byteType > &data)
Convert data vector to signed long integer.
short dataToShort(std::vector< byteType > &data)
Convert data vector to signed short integer.
void sLongToData(std::vector< byteType > &data, long value)
Convert a signed long integer (4 bytes) into raw CAN bytes.
modeType getMode(idType id)
Extract the address mode from a 29 bit can id.
enum carma::canbus::modeTypeEnum modeType
Mode type.
float dataToFloat(std::vector< byteType > &data)
Convert data vector to IEEE float.
unsigned short apiType
Carma API id type.
unsigned short serialNumberType
Carma Serial Number type.
unsigned short nodeType
Carma Node Type id type.
unsigned long dataToUlong(std::vector< byteType > &data)
Convert data vector to unsigned long integer.
void uLongToData(std::vector< byteType > &data, unsigned long value)
Convert an unsigned long integer (4 bytes) into raw CAN bytes.
timespec calculateTimeToNextHalfSec()
Calculate the time to the next half second boundary.
void uByteToData(std::vector< byteType > &data, unsigned char value)
Convert a unsigned char into raw CAN bytes.
bool isToHost(idType id)
Extract the host bit from a 29 bit CAN id.
busIdType extractBusId(std::string filename)
Extract the busId from a string containing the device filename.
unsigned int idType
Type for full 29 bit CAN id.
const bool TO_HOST
Constant for bool host parameter of createId indicating that the message is to be addressed to the li...
void padWithZeros(std::vector< byteType > &data)
Pad an input vector with up to 8 bytes of zeros.
unsigned short busIdType
Carma Bus Id type.
idType createEngId(bool host, boardType board, serialNumberType serialNumber, msgType mid)
Produce a CAN message from a board type and serial number (engineering message).
unsigned short msgType
Carma Message id type.
void doubleToData(std::vector< byteType > &data, double value)
Convert a IEEE 754-1990 double float (8 bytes) into raw CAN bytes.