Apollo  6.0
Open source self driving car software
Public Member Functions | Protected Attributes | List of all members
apollo::drivers::canbus::CanClient Class Referenceabstract

The class which defines the CAN client to send and receive message. More...

#include <can_client.h>

Inheritance diagram for apollo::drivers::canbus::CanClient:
Inheritance graph
Collaboration diagram for apollo::drivers::canbus::CanClient:
Collaboration graph

Public Member Functions

 CanClient ()=default
 Constructor. More...
 
virtual ~CanClient ()=default
 Destructor. More...
 
virtual bool Init (const CANCardParameter &parameter)=0
 Initialize the CAN client by specified CAN card parameters. More...
 
virtual apollo::common::ErrorCode Start ()=0
 Start the CAN client. More...
 
virtual void Stop ()=0
 Stop the CAN client. More...
 
virtual apollo::common::ErrorCode Send (const std::vector< CanFrame > &frames, int32_t *const frame_num)=0
 Send messages. More...
 
virtual apollo::common::ErrorCode SendSingleFrame (const std::vector< CanFrame > &frames)
 Send a single message. More...
 
virtual apollo::common::ErrorCode Receive (std::vector< CanFrame > *const frames, int32_t *const frame_num)=0
 Receive messages. More...
 
virtual std::string GetErrorString (const int32_t status)=0
 Get the error string. More...
 

Protected Attributes

bool is_started_ = false
 The CAN client is started. More...
 

Detailed Description

The class which defines the CAN client to send and receive message.

Constructor & Destructor Documentation

◆ CanClient()

apollo::drivers::canbus::CanClient::CanClient ( )
default

Constructor.

◆ ~CanClient()

virtual apollo::drivers::canbus::CanClient::~CanClient ( )
virtualdefault

Destructor.

Member Function Documentation

◆ GetErrorString()

virtual std::string apollo::drivers::canbus::CanClient::GetErrorString ( const int32_t  status)
pure virtual

◆ Init()

virtual bool apollo::drivers::canbus::CanClient::Init ( const CANCardParameter &  parameter)
pure virtual

Initialize the CAN client by specified CAN card parameters.

Parameters
parameterCAN card parameters to initialize the CAN client.
Returns
If the initialization is successful.

Implemented in apollo::drivers::canbus::can::SocketCanClientRaw, apollo::drivers::canbus::can::HermesCanClient, apollo::drivers::canbus::can::EsdCanClient, and apollo::drivers::canbus::can::FakeCanClient.

◆ Receive()

virtual apollo::common::ErrorCode apollo::drivers::canbus::CanClient::Receive ( std::vector< CanFrame > *const  frames,
int32_t *const  frame_num 
)
pure virtual

Receive messages.

Parameters
framesThe messages to receive.
frame_numThe amount of messages to receive.
Returns
The status of the receiving action which is defined by apollo::common::ErrorCode.

Implemented in apollo::drivers::canbus::can::SocketCanClientRaw, apollo::drivers::canbus::can::HermesCanClient, apollo::drivers::canbus::can::EsdCanClient, and apollo::drivers::canbus::can::FakeCanClient.

◆ Send()

virtual apollo::common::ErrorCode apollo::drivers::canbus::CanClient::Send ( const std::vector< CanFrame > &  frames,
int32_t *const  frame_num 
)
pure virtual

Send messages.

Parameters
framesThe messages to send.
frame_numThe amount of messages to send.
Returns
The status of the sending action which is defined by apollo::common::ErrorCode.

Implemented in apollo::drivers::canbus::can::SocketCanClientRaw, apollo::drivers::canbus::can::HermesCanClient, apollo::drivers::canbus::can::EsdCanClient, and apollo::drivers::canbus::can::FakeCanClient.

◆ SendSingleFrame()

virtual apollo::common::ErrorCode apollo::drivers::canbus::CanClient::SendSingleFrame ( const std::vector< CanFrame > &  frames)
inlinevirtual

Send a single message.

Parameters
framesA single-element vector containing only one message.
Returns
The status of the sending single message action which is defined by apollo::common::ErrorCode.

◆ Start()

virtual apollo::common::ErrorCode apollo::drivers::canbus::CanClient::Start ( )
pure virtual

Start the CAN client.

Returns
The status of the start action which is defined by apollo::common::ErrorCode.

Implemented in apollo::drivers::canbus::can::SocketCanClientRaw, apollo::drivers::canbus::can::HermesCanClient, apollo::drivers::canbus::can::EsdCanClient, and apollo::drivers::canbus::can::FakeCanClient.

◆ Stop()

virtual void apollo::drivers::canbus::CanClient::Stop ( )
pure virtual

Member Data Documentation

◆ is_started_

bool apollo::drivers::canbus::CanClient::is_started_ = false
protected

The CAN client is started.


The documentation for this class was generated from the following file: