56 [[nodiscard]] uint32_t
CanId()
const;
68 void Dlc(uint8_t dlc);
69 [[nodiscard]] uint8_t
Dlc()
const;
90 [[nodiscard]]
const std::vector<uint8_t>&
DataBytes()
const;
98 void Dir(
bool transmit );
100 [[nodiscard]]
bool Dir()
const;
103 [[nodiscard]]
bool Srr()
const;
106 [[nodiscard]]
bool Edl()
const;
109 [[nodiscard]]
bool Brs()
const;
112 [[nodiscard]]
bool Esi()
const;
115 [[nodiscard]]
bool Rtr()
const;
138 size_t max_data_length,
bool save_index )
const;
140 uint32_t message_id_ = 0;
143 uint64_t data_index_ = 0;
144 std::vector<uint8_t> data_bytes_;
145 uint8_t bit_position_ = 0;
146 uint8_t error_type_ = 0;
Helper class when logging CAN and CAN FD messages.
Definition canmessage.h:47
void Esi(bool esi)
Error state indicator (CAN FD).
uint8_t BitPosition() const
Error bit position.
bool Rtr() const
Returns the RTR bit.
static size_t DlcToLength(uint8_t dlc)
Return the data length by DLC.
void WakeUp(bool wake_up)
Indicate a CAN bus wake up status.
bool Brs() const
Bit rate switch (CAN FD).
bool Dir() const
Returns true if the message was transmitted.
bool Esi() const
Error state indicator (CAN FD).
bool Srr() const
Returns the SRR bit.
void Edl(bool edl)
Extended (CAN FD) data length.
bool ExtendedId() const
Returns the extended CAN ID.
uint8_t BusChannel() const
Bus channel.
void Srr(bool srr)
Sets the SRR bit. */.
void SingleWire(bool single_wire)
Indicate a single wire CAN bus.
uint8_t Dlc() const
Returns the CAN message length code.
const std::vector< uint8_t > & DataBytes() const
Returns a reference to the payload data bytes.
uint64_t DataIndex() const
Internal function for the VLSD data offset.
uint32_t CanId() const
29/11 bit CAN message ID. Note that bit 31 is not used.
void DataLength(size_t data_length)
Sets number of data bytes.
bool Edl() const
Extended (CAN FD) data length.
void Rtr(bool rtr)
Sets the RTR bit (remote frame).
void Dlc(uint8_t dlc)
Sets the CAM message data length code.
size_t DataLength() const
Returns number of data bytes.
void DataBytes(const std::vector< uint8_t > &data)
Sets the payload data bytes.
void MessageId(uint32_t msg_id)
CAN message ID. Note that bit 31 indicate extended ID.
CanErrorType ErrorType() const
Type of error.
void Brs(bool brs)
Bit rate switch (CAN FD).
void BusChannel(uint8_t channel)
Bus channel.
void DataIndex(uint64_t index)
Internal function for storing VLSD data offset.
void ErrorType(CanErrorType error_type)
Type of error.
void BitPosition(uint8_t position)
Error bit position (error frame).
bool SingleWire() const
Indicate a single wire CAN bus.
void ExtendedId(bool extended)
Sets the extended CAN ID bit.
void Reset()
Reset all flags an payload data buffers.
void ToRaw(MessageType msg_type, SampleRecord &sample, size_t max_data_length, bool save_index) const
Creates an MDF sample record. Used primarily internally.
bool WakeUp() const
Indicate a CAN bus wake up message.
uint32_t MessageId() const
CAN message ID. Note that bit 31 indicate extended ID.
void Dir(bool transmit)
If set true, the message was transmitted.
Main namespace for the MDF library.
Definition canmessage.h:17
CanErrorType
Enumerate yhat defines type of CAN bus error.
Definition canmessage.h:19
@ BIT_STUFFING_ERROR
Bit stuffing error.
@ FORM_ERROR
CAN format error.
@ UNKNOWN_ERROR
Unspecified error.
@ BIT_ERROR
CAN bit error.
@ ACK_ERROR
Acknowledgement error.
@ CRC_ERROR
Checksum error.
MessageType
Enumerate that defines type of CAN messages.
Definition canmessage.h:29
@ CAN_RemoteFrame
Remote frame message.
@ CAN_OverloadFrame
Overload frame message.
@ CAN_ErrorFrame
Error message.
@ CAN_DataFrame
Normal CAN message.
Simple record buffer structure.
Definition samplerecord.h:20