Apollo 10.0
自动驾驶开放平台
apollo::drivers::canbus::CanClient类 参考abstract

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

#include <can_client.h>

类 apollo::drivers::canbus::CanClient 继承关系图:
apollo::drivers::canbus::CanClient 的协作图:

Public 成员函数

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

Protected 属性

bool is_started_ = false
 The CAN client is started.
 

详细描述

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

在文件 can_client.h92 行定义.

构造及析构函数说明

◆ CanClient()

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

Constructor

◆ ~CanClient()

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

Destructor

成员函数说明

◆ 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.

参数
parameterCAN card parameters to initialize the CAN client.
返回
If the initialization is successful.

apollo::drivers::canbus::can::FakeCanClient, apollo::drivers::canbus::can::EsdCanClient, apollo::drivers::canbus::can::HermesCanClient , 以及 apollo::drivers::canbus::can::SocketCanClientRaw 内被实现.

◆ Receive()

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

Receive messages

参数
framesThe messages to receive.
frame_numThe amount of messages to receive.
返回
The status of the receiving action which is defined by apollo::common::ErrorCode.

apollo::drivers::canbus::can::HermesCanClient, apollo::drivers::canbus::can::EsdCanClient, apollo::drivers::canbus::can::SocketCanClientRaw , 以及 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

参数
framesThe messages to send.
frame_numThe amount of messages to send.
返回
The status of the sending action which is defined by apollo::common::ErrorCode.

apollo::drivers::canbus::can::HermesCanClient, apollo::drivers::canbus::can::EsdCanClient, apollo::drivers::canbus::can::FakeCanClient , 以及 apollo::drivers::canbus::can::SocketCanClientRaw 内被实现.

◆ SendSingleFrame()

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

Send a single message.

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

在文件 can_client.h139 行定义.

140 {
141 CHECK_EQ(frames.size(), 1U)
142 << "frames size not equal to 1, actual frame size :" << frames.size();
143 int32_t n = 1;
144 return Send(frames, &n);
145 }
virtual apollo::common::ErrorCode Send(const std::vector< CanFrame > &frames, int32_t *const frame_num)=0
Send messages

◆ Start()

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

◆ Stop()

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

类成员变量说明

◆ is_started_

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

The CAN client is started.

在文件 can_client.h165 行定义.


该类的文档由以下文件生成: