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

This class defines the message to send. More...

#include <can_sender.h>

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

Public Member Functions

 SenderMessage (const uint32_t message_id, ProtocolData< SensorType > *protocol_data)
 Constructor which takes message ID and protocol data. More...
 
 SenderMessage (const uint32_t message_id, ProtocolData< SensorType > *protocol_data, bool init_with_one)
 Constructor which takes message ID and protocol data and and indicator whether to initialize all bits of the . More...
 
virtual ~SenderMessage ()=default
 Destructor. More...
 
void UpdateCurrPeriod (const int32_t delta_period)
 Update the current period for sending messages by a difference. More...
 
void Update ()
 Update the protocol data. But the updating process depends on the real type of protocol data which inherites ProtocolData. More...
 
struct CanFrame CanFrame ()
 Get the CAN frame to send. More...
 
uint32_t message_id () const
 Get the message ID. More...
 
int32_t curr_period () const
 Get the current period to send messages. It may be different from the period from protocol data by updating. More...
 

Detailed Description

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

This class defines the message to send.

Constructor & Destructor Documentation

◆ SenderMessage() [1/2]

template<typename SensorType >
apollo::drivers::canbus::SenderMessage< SensorType >::SenderMessage ( const uint32_t  message_id,
ProtocolData< SensorType > *  protocol_data 
)

Constructor which takes message ID and protocol data.

Parameters
message_idThe message ID.
protocol_dataA pointer of ProtocolData which contains the content to send.

◆ SenderMessage() [2/2]

template<typename SensorType >
apollo::drivers::canbus::SenderMessage< SensorType >::SenderMessage ( const uint32_t  message_id,
ProtocolData< SensorType > *  protocol_data,
bool  init_with_one 
)

Constructor which takes message ID and protocol data and and indicator whether to initialize all bits of the .

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.

◆ ~SenderMessage()

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

Destructor.

Member Function Documentation

◆ CanFrame()

template<typename SensorType >
struct CanFrame apollo::drivers::canbus::SenderMessage< SensorType >::CanFrame ( )

Get the CAN frame to send.

Returns
The CAN frame to send.

◆ curr_period()

template<typename SensorType >
int32_t apollo::drivers::canbus::SenderMessage< SensorType >::curr_period ( ) const

Get the current period to send messages. It may be different from the period from protocol data by updating.

Returns
The current period.

◆ message_id()

template<typename SensorType >
uint32_t apollo::drivers::canbus::SenderMessage< SensorType >::message_id ( ) const

Get the message ID.

Returns
The message ID.

◆ Update()

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

Update the protocol data. But the updating process depends on the real type of protocol data which inherites ProtocolData.

◆ UpdateCurrPeriod()

template<typename SensorType >
void apollo::drivers::canbus::SenderMessage< SensorType >::UpdateCurrPeriod ( const int32_t  delta_period)

Update the current period for sending messages by a difference.

Parameters
delta_periodUpdate the current period by reducing delta_period.

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