AgIsoStack++
A control-function-focused implementation of the major ISOBUS and J1939 protocols
|
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< CANHardwarePlugin > | frameHandler |
The CAN driver to use for a CAN channel. | |
LockFreeQueue< CANMessageFrame > | messagesToBeTransmittedQueue |
Transmit message queue for a CAN channel. | |
LockFreeQueue< CANMessageFrame > | receivedMessagesQueue |
Receive message queue for a CAN channel. | |
Stores the data for a single CAN channel.
Definition at line 114 of file can_hardware_interface.hpp.
|
explicit |
Constructor for the CANHardware.
[in] | queueCapacity | The capacity of the transmit and receive queues |
Definition at line 38 of file can_hardware_interface.cpp.
|
virtual |
Destructor for the CANHardware.
Definition at line 43 of file can_hardware_interface.cpp.
bool isobus::CANHardwareInterface::CANHardware::receive_can_frame | ( | ) |
Receives a frame from the hardware and adds it to the receive queue.
true
if a frame was received, otherwise false
Definition at line 90 of file can_hardware_interface.cpp.
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.
bool isobus::CANHardwareInterface::CANHardware::start | ( | ) |
Starts this hardware channel.
true
if the channel was started, otherwise false
Definition at line 50 of file can_hardware_interface.cpp.
void isobus::CANHardwareInterface::CANHardware::start_threads | ( | ) |
Starts the receiving thread for this CAN channel.
Definition at line 110 of file can_hardware_interface.cpp.
bool isobus::CANHardwareInterface::CANHardware::stop | ( | ) |
Stops this hardware channel.
true
if the channel was stopped, otherwise false
Definition at line 67 of file can_hardware_interface.cpp.
void isobus::CANHardwareInterface::CANHardware::stop_threads | ( | ) |
Stops the receiving thread for this CAN channel.
Definition at line 119 of file can_hardware_interface.cpp.
bool isobus::CANHardwareInterface::CANHardware::transmit_can_frame | ( | const CANMessageFrame & | frame | ) | const |
Try to transmit the frame to the hardware.
[in] | frame | The frame to transmit |
true
if the frame was transmitted, otherwise false
Definition at line 81 of file can_hardware_interface.cpp.
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.
LockFreeQueue<CANMessageFrame> isobus::CANHardwareInterface::CANHardware::messagesToBeTransmittedQueue |
Transmit message queue for a CAN channel.
Definition at line 157 of file can_hardware_interface.hpp.
LockFreeQueue<CANMessageFrame> isobus::CANHardwareInterface::CANHardware::receivedMessagesQueue |
Receive message queue for a CAN channel.
Definition at line 158 of file can_hardware_interface.hpp.
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.
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.