Woman, Life, Freedom


OBD-II Emulator
Linux ODB-II Emulator public and protected interfaces documentation
ObdEmulator::CanDriver Class Reference

CAN bus controller driver helper. More...

#include <can_driver.h>

Public Member Functions

 CanDriver (CanBusSpeed speed, bool supportExtended)
 Constructor. More...
 
std::vector< uint8_t > GetConfiguration () const
 Get CAN bus communication configuration packet. More...
 
std::vector< uint8_t > Serialize (const CanFrame &frame) const
 Serialize a CAN frame to a variable length byte array. More...
 
CanFrame Deserialize (const std::vector< uint8_t > &packet) const
 Deserialize a packet to a CAN frame. More...
 

Static Public Attributes

static constexpr size_t cFixedFrameSize {20}
 Fixed CAN frame data packet size.
 

Detailed Description

CAN bus controller driver helper.

Constructor & Destructor Documentation

◆ CanDriver()

ObdEmulator::CanDriver::CanDriver ( CanBusSpeed  speed,
bool  supportExtended 
)

Constructor.

Parameters
speedCAN bus communication speed
supportExtendedIndicates whether extended frame is supported or not

Member Function Documentation

◆ Deserialize()

CanFrame ObdEmulator::CanDriver::Deserialize ( const std::vector< uint8_t > &  packet) const

Deserialize a packet to a CAN frame.

Parameters
packetPacket data array to be deserialized
Returns
Derserialized CAN frame
Exceptions
std::invalid_argumentThrows if the input packet is invalid

◆ GetConfiguration()

std::vector< uint8_t > ObdEmulator::CanDriver::GetConfiguration ( ) const

Get CAN bus communication configuration packet.

Returns
Configuration packet byte vector

◆ Serialize()

std::vector< uint8_t > ObdEmulator::CanDriver::Serialize ( const CanFrame frame) const

Serialize a CAN frame to a variable length byte array.

Parameters
frameFrame to be serialized
Returns
Serialized frame byte array
Exceptions
std::invalid_argumentThrows if the input frame is invalid