Apollo  6.0
Open source self driving car software
Public Member Functions | List of all members
apollo::drivers::canbus::CanSender< SensorType > Class Template Reference

CAN sender. More...

#include <can_sender.h>

Collaboration diagram for apollo::drivers::canbus::CanSender< SensorType >:
Collaboration graph

Public Member Functions

 CanSender ()=default
 Constructor. More...
 
virtual ~CanSender ()=default
 Destructor. More...
 
common::ErrorCode Init (CanClient *can_client, bool enable_log)
 Initialize by a CAN client based on its brand. More...
 
void AddMessage (uint32_t message_id, ProtocolData< SensorType > *protocol_data, bool init_with_one=false)
 Add a message with its ID, protocol data. More...
 
apollo::common::ErrorCode Start ()
 Start the CAN sender. More...
 
void Update ()
 
void Stop ()
 Stop the CAN sender. More...
 
bool IsRunning () const
 Get the working status of this CAN sender. To check if it is running. More...
 
bool enable_log () const
 
 FRIEND_TEST (CanSenderTest, OneRunCase)
 

Detailed Description

template<typename SensorType>
class apollo::drivers::canbus::CanSender< SensorType >

CAN sender.

Constructor & Destructor Documentation

◆ CanSender()

template<typename SensorType >
apollo::drivers::canbus::CanSender< SensorType >::CanSender ( )
default

Constructor.

◆ ~CanSender()

template<typename SensorType >
virtual apollo::drivers::canbus::CanSender< SensorType >::~CanSender ( )
virtualdefault

Destructor.

Member Function Documentation

◆ AddMessage()

template<typename SensorType >
void apollo::drivers::canbus::CanSender< SensorType >::AddMessage ( uint32_t  message_id,
ProtocolData< SensorType > *  protocol_data,
bool  init_with_one = false 
)

Add a message with its ID, protocol data.

Parameters
message_idThe message ID.
protocol_dataA pointer of ProtocolData which contains the content to send.
init_with_oneIf it is true, then initialize all bits in the protocol data as one. By default, it is false.

◆ enable_log()

template<typename SensorType >
bool apollo::drivers::canbus::CanSender< SensorType >::enable_log ( ) const

◆ FRIEND_TEST()

template<typename SensorType >
apollo::drivers::canbus::CanSender< SensorType >::FRIEND_TEST ( CanSenderTest  ,
OneRunCase   
)

◆ Init()

template<typename SensorType >
common::ErrorCode apollo::drivers::canbus::CanSender< SensorType >::Init ( CanClient can_client,
bool  enable_log 
)

Initialize by a CAN client based on its brand.

Parameters
can_clientThe CAN client to use for sending messages.
enable_logwhether enable record the send can frame log
Returns
An error code indicating the status of this initialization.

◆ IsRunning()

template<typename SensorType >
bool apollo::drivers::canbus::CanSender< SensorType >::IsRunning ( ) const

Get the working status of this CAN sender. To check if it is running.

Returns
If this CAN sender is running.

◆ Start()

template<typename SensorType >
common::ErrorCode apollo::drivers::canbus::CanSender< SensorType >::Start ( )

Start the CAN sender.

Returns
The error code indicating the status of this action.

◆ Stop()

template<typename SensorType >
void apollo::drivers::canbus::CanSender< SensorType >::Stop ( void  )

Stop the CAN sender.

◆ Update()

template<typename SensorType >
void apollo::drivers::canbus::CanSender< SensorType >::Update ( )

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