|
cisst-saw
|
CAN frame implementation. More...
#include <osaCANBusFrame.h>
Public Types | |
| typedef unsigned short | ID |
| The id of a CAN frame. More... | |
| typedef unsigned short | Mask |
| typedef unsigned char | Data |
| The data type. More... | |
| typedef Data | DataField [8] |
| The field of data. More... | |
| typedef unsigned char | DataLength |
| The data length type. More... | |
Public Member Functions | |
| osaCANBusFrame () | |
| Default constructor. More... | |
| osaCANBusFrame (ID canid, DataField data, DataLength nbytes) | |
| Overloaded constructor. More... | |
| osaCANBusFrame (ID canid, const vctDynamicVector< Data > &data) | |
| ID | GetID () const |
| Return the identifier of the frame. More... | |
| DataLength | GetLength () const |
| Return the length in bytes of the data. More... | |
| Data * | GetData () |
| Return a pointer to the data. More... | |
| const Data * | GetData () const |
| Return a const pointer to the data. More... | |
Protected Attributes | |
| ID | id |
| The ID of the node origin. More... | |
| DataField | data |
| The message (8 bytes) More... | |
| DataLength | nbytes |
| The lenght of the message in bytes. More... | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const osaCANBusFrame &frame) |
| Output the can frame. More... | |
CAN frame implementation.
This defines a basic CAN frame. It does not support the extended frame format. The frame is composed of an identifier, 8 bytes of data and a data length. A CAN frame contain an 11 bits identifier, 0-8 bytes of data and a data length code (0-8). This class does not support the extended frame format.
| typedef unsigned char osaCANBusFrame::Data |
The data type.
| typedef Data osaCANBusFrame::DataField[8] |
The field of data.
| typedef unsigned char osaCANBusFrame::DataLength |
The data length type.
| typedef unsigned short osaCANBusFrame::ID |
The id of a CAN frame.
A CAN ID has 11 bits so we use 16 bits to represent a CAN id of which only the 11 LSB are used.
| typedef unsigned short osaCANBusFrame::Mask |
| osaCANBusFrame::osaCANBusFrame | ( | ) |
Default constructor.
Set the IDs to "0" the message length to "0" and all the message bytes to "0"
| osaCANBusFrame::osaCANBusFrame | ( | ID | canid, |
| DataField | data, | ||
| DataLength | nbytes | ||
| ) |
Overloaded constructor.
Set the id of the CAN frame and the message
| osaCANBusFrame::osaCANBusFrame | ( | ID | canid, |
| const vctDynamicVector< Data > & | data | ||
| ) |
|
inline |
Return a pointer to the data.
|
inline |
Return a const pointer to the data.
|
inline |
Return the identifier of the frame.
|
inline |
Return the length in bytes of the data.
|
friend |
Output the can frame.
Prints out the frame's identifier, data length and data
| os[in] | An ouptput stream |
| cf[in] | A CAN frame |
|
protected |
The message (8 bytes)
|
protected |
The ID of the node origin.
|
protected |
The lenght of the message in bytes.
1.8.6