AgIsoStack++
A control-function-focused implementation of the major ISOBUS and J1939 protocols
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
isobus::CANHardwareInterface::CANHardware Class Reference

Stores the data for a single CAN channel. More...

Public Member Functions

 CANHardware (std::size_t queueCapacity)
 Constructor for the CANHardware.
 
virtual ~CANHardware ()
 Destructor for the CANHardware.
 
bool start ()
 Starts this hardware channel.
 
bool stop ()
 Stops this hardware channel.
 
bool transmit_can_frame (const CANMessageFrame &frame) const
 Try to transmit the frame to the hardware.
 
bool receive_can_frame ()
 Receives a frame from the hardware and adds it to the receive queue.
 
void start_threads ()
 Starts the receiving thread for this CAN channel.
 
void stop_threads ()
 Stops the receiving thread for this CAN channel.
 
void receive_thread_function ()
 The receiving thread loop for this CAN channel.
 

Public Attributes

std::unique_ptr< std::thread > receiveMessageThread
 Thread to manage getting messages from a CAN channel.
 
bool receiveThreadRunning = false
 Flag to indicate if the receive thread is running.
 
std::shared_ptr< CANHardwarePluginframeHandler
 The CAN driver to use for a CAN channel.
 
LockFreeQueue< CANMessageFramemessagesToBeTransmittedQueue
 Transmit message queue for a CAN channel.
 
LockFreeQueue< CANMessageFramereceivedMessagesQueue
 Receive message queue for a CAN channel.
 

Detailed Description

Stores the data for a single CAN channel.

Definition at line 114 of file can_hardware_interface.hpp.

Constructor & Destructor Documentation

◆ CANHardware()

isobus::CANHardwareInterface::CANHardware::CANHardware ( std::size_t queueCapacity)
explicit

Constructor for the CANHardware.

Parameters
[in]queueCapacityThe capacity of the transmit and receive queues

Definition at line 38 of file can_hardware_interface.cpp.

◆ ~CANHardware()

isobus::CANHardwareInterface::CANHardware::~CANHardware ( )
virtual

Destructor for the CANHardware.

Definition at line 43 of file can_hardware_interface.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ receive_can_frame()

bool isobus::CANHardwareInterface::CANHardware::receive_can_frame ( )

Receives a frame from the hardware and adds it to the receive queue.

Returns
true if a frame was received, otherwise false

Definition at line 90 of file can_hardware_interface.cpp.

◆ receive_thread_function()

void isobus::CANHardwareInterface::CANHardware::receive_thread_function ( )

The receiving thread loop for this CAN channel.

Definition at line 132 of file can_hardware_interface.cpp.

◆ start()

bool isobus::CANHardwareInterface::CANHardware::start ( )

Starts this hardware channel.

Returns
true if the channel was started, otherwise false

Definition at line 50 of file can_hardware_interface.cpp.

Here is the call graph for this function:

◆ start_threads()

void isobus::CANHardwareInterface::CANHardware::start_threads ( )

Starts the receiving thread for this CAN channel.

Definition at line 110 of file can_hardware_interface.cpp.

◆ stop()

bool isobus::CANHardwareInterface::CANHardware::stop ( )

Stops this hardware channel.

Returns
true if the channel was stopped, otherwise false

Definition at line 67 of file can_hardware_interface.cpp.

Here is the call graph for this function:

◆ stop_threads()

void isobus::CANHardwareInterface::CANHardware::stop_threads ( )

Stops the receiving thread for this CAN channel.

Definition at line 119 of file can_hardware_interface.cpp.

◆ transmit_can_frame()

bool isobus::CANHardwareInterface::CANHardware::transmit_can_frame ( const CANMessageFrame & frame) const

Try to transmit the frame to the hardware.

Parameters
[in]frameThe frame to transmit
Returns
true if the frame was transmitted, otherwise false

Definition at line 81 of file can_hardware_interface.cpp.

Member Data Documentation

◆ frameHandler

std::shared_ptr<CANHardwarePlugin> isobus::CANHardwareInterface::CANHardware::frameHandler

The CAN driver to use for a CAN channel.

Definition at line 155 of file can_hardware_interface.hpp.

◆ messagesToBeTransmittedQueue

LockFreeQueue<CANMessageFrame> isobus::CANHardwareInterface::CANHardware::messagesToBeTransmittedQueue

Transmit message queue for a CAN channel.

Definition at line 157 of file can_hardware_interface.hpp.

◆ receivedMessagesQueue

LockFreeQueue<CANMessageFrame> isobus::CANHardwareInterface::CANHardware::receivedMessagesQueue

Receive message queue for a CAN channel.

Definition at line 158 of file can_hardware_interface.hpp.

◆ receiveMessageThread

std::unique_ptr<std::thread> isobus::CANHardwareInterface::CANHardware::receiveMessageThread

Thread to manage getting messages from a CAN channel.

Definition at line 151 of file can_hardware_interface.hpp.

◆ receiveThreadRunning

bool isobus::CANHardwareInterface::CANHardware::receiveThreadRunning = false

Flag to indicate if the receive thread is running.

Definition at line 152 of file can_hardware_interface.hpp.


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