|
| CanDataFrame () |
| Deafult constructor.
|
| CanDataFrame (CanErrorType type)=delete |
| CanDataFrame (const std::shared_ptr< IBusMessage > &message) |
| Create a message from a raw byte array.
|
void | MessageId (uint32_t msg_id) |
| DBC message ID. Note that bit 31 indicate extended ID.
|
uint32_t | MessageId () const |
| DBC message ID. Note that bit 31 indicate extended ID.
|
void | CanId (uint32_t can_id) |
| Returns the 11/27 bit CAN ID.
|
uint32_t | CanId () const |
| 29/11 bit CAN message ID. Note that bit 31 is not used.
|
void | ExtendedId (bool extended) |
| Set true if the CAN ID uses 20-bit addressing.
|
bool | ExtendedId () const |
| Returns true if the CAN ID uses 29-bit addressing,.
|
void | Dlc (uint8_t dlc) |
| Sets the CAN message data length code.
|
uint8_t | Dlc () const |
| Returns the data length code (DLC).
|
void | Crc (uint32_t crc) |
| Sets the CRC code.
|
uint32_t | Crc () const |
| Returns the CRC code.
|
void | DataLength (uint8_t data_length) |
| Sets number of data bytes.
|
uint8_t | DataLength () const |
| Returns number of data bytes.
|
void | DataBytes (const std::vector< uint8_t > &data) |
| Sets the payload data bytes.
|
const std::vector< uint8_t > & | DataBytes () const |
| Returns a reference to the payload data bytes.
|
void | Dir (bool transmit) |
| If set true, the message was transmitted.
|
bool | Dir () const |
| Returns true if the message was transmitted.
|
void | Srr (bool srr) |
| Sets the SRR bit. */.
|
bool | Srr () const |
| Returns the SRR bit.
|
void | Edl (bool edl) |
| Extended (CAN FD) data length.
|
bool | Edl () const |
| Extended (CAN FD) data length.
|
void | Brs (bool brs) |
| Bit rate switch (CAN FD).
|
bool | Brs () const |
| Bit rate switch (CAN FD).
|
void | Esi (bool esi) |
| Error state indicator (CAN FD).
|
bool | Esi () const |
| Error state indicator (CAN FD).
|
void | Rtr (bool rtr) |
| Sets the RTR bit (remote frame).
|
bool | Rtr () const |
| Returns the RTR bit.
|
void | WakeUp (bool wake_up) |
| Indicate a CAN bus wake up status.
|
bool | WakeUp () const |
| Indicate a CAN bus wake up message.
|
void | SingleWire (bool single_wire) |
| Indicate a single wire CAN bus.
|
bool | SingleWire () const |
| Indicate a single wire CAN bus.
|
void | R0 (bool flag) |
| Optional R0 flag.
|
bool | R0 () const |
| Optional R0 flag.
|
void | R1 (bool flag) |
| Optional R1 flag.
|
bool | R1 () const |
| Optional R1 flag.
|
void | FrameDuration (uint32_t duration) |
| Frame duration in nano-seconds.
|
uint32_t | FrameDuration () const |
| Frame duration in nano-seconds.
|
void | ToRaw (std::vector< uint8_t > &dest) const override |
| Serialize the message.
|
void | FromRaw (const std::vector< uint8_t > &source) override |
| Deserialize the message.
|
| IBusMessage (BusMessageType type) |
BusMessageType | Type () const |
| Returns type of message.
|
void | Version (uint16_t version) |
| Sets the vewrsion number for a message.
|
uint16_t | Version () const |
| Returns the version number of the message.
|
uint32_t | Size () const |
| Returns the total size of the message.
|
bool | Valid () const |
| Returns true if the message is valid.
|
void | Timestamp (uint64_t timestamp) |
| Sets the absolute time.
|
uint64_t | Timestamp () const |
| Retuns the timestampe.
|
void | BusChannel (uint16_t channel) |
| Sets the source channel.
|
uint16_t | BusChannel () const |
| Returns the bus channel number.
|
The class implements an interface against a CAN Data Frame message. This message is the normal CAN messages while the other messages indicates some sort of exception or error.
The serialization is according to table below and uses little endian byte order.
CAN Data Frame Message Layout
Byte (Bits) Offset | Description | Size |
0-17 | Type of Message (enumerate) | 18 bytes |
18 | Message ID (CAN Id + IDE) | uint32_t |
22 | DLC | uint8_t |
23 | Data Length | uint8_t |
24 | CRC | uint32_t |
28:0 | Direction (Rx=0, Tx=1) | 1-bit |
28:1 | SRR | 1-bit |
28:2 | EDL | 1-bit |
28:3 | BRS | 1-bit |
28:4 | ESI | 1-bit |
28:5 | RTR | 1-bit |
28:6 | R0 | 1-bit |
28:7 | R1 | 1-bit |
29:0 | Wake Up | 1-bit |
29:1 | Single Wire | 1-bit |
30 | Frame Duration (ns)/td> | uint32_t |
34 | Data Bytes | Data Length bytes |