Public Member Functions | |
boost::scoped_ptr< tCanDevice > & | canDevice () |
Access the CAN device. More... | |
CanMessageStamped::Ptr | get () |
bool | hasData () const |
Returns true if the buffer is nonempty. More... | |
virtual void | run () |
Worker thread main method which receives the CAN messages. More... | |
void | setCanMask (const CanMatrix &can_mask) |
Sets the CAN mask used to filter out relevant CAN messages. More... | |
void | setSingleCanID (uint16_t can_id) |
Sets a single CAN ID used to filter out relevant CAN messages. More... | |
WorkerThread (tCanDevice *can_device, std::size_t max_buffer_size=256) | |
Public Member Functions inherited from icl_core::thread::Thread | |
void | cancel () |
bool | checkHardRealtime () |
bool | execute () const |
bool | executesHardRealtime () const |
icl_core::String | getDescription () const |
bool | isHardRealtime () const |
void | join () |
virtual void | onStop () |
icl_core::ThreadPriority | priority () const |
bool | running () const |
void | setDescription (const icl_core::String &description) |
bool | setHardRealtime (bool hard_realtime=true) |
bool | setPriority (icl_core::ThreadPriority priority) |
bool | start () |
void | stop () |
Thread (const icl_core::String &description, icl_core::ThreadPriority priority=0) | |
icl_core::ThreadId | threadId () const |
const char * | threadInfo () const |
bool | threadSelf () const |
bool | wait (const icl_core::TimeSpan &timeout) |
bool | wait () |
bool | wait (const icl_core::TimeStamp &timeout) |
virtual | ~Thread () |
Private Attributes | |
icl_core::thread::Mutex | m_buffer_mutex |
Synchronizes receive buffer access. More... | |
icl_core::thread::Semaphore | m_buffer_semaphore |
Handles producer/consumer notification. More... | |
boost::scoped_ptr< tCanDevice > | m_can_device |
The CAN device. More... | |
CanMatrix | m_can_mask |
std::size_t | m_dsin |
std::size_t | m_max_buffer_size |
Buffer size limit. More... | |
std::deque< CanMessageStamped::Ptr > | m_recv_buffer |
std::size_t | m_sequence_number |
uint16_t | m_single_can_id |
bool | m_use_can_mask |
If true , m_can_mask is used to filter the CAN stream. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from icl_core::thread::Thread | |
static icl_core::ThreadId | selfId () |
Protected Member Functions inherited from icl_core::Noncopyable | |
Noncopyable () | |
virtual | ~Noncopyable () |
Internal worker thread which listens to a given CAN device and buffers the received messages.
Definition at line 54 of file HardwareCanSourcePeak.cpp.
|
inline |
Definition at line 57 of file HardwareCanSourcePeak.cpp.
|
inline |
Access the CAN device.
Definition at line 83 of file HardwareCanSourcePeak.cpp.
CanMessageStamped::Ptr icl_hardware::can::HardwareCanSourcePeak::WorkerThread::get | ( | ) |
Gets the next CAN message, blocking in case no data is in the buffer.
Definition at line 178 of file HardwareCanSourcePeak.cpp.
bool icl_hardware::can::HardwareCanSourcePeak::WorkerThread::hasData | ( | ) | const |
Returns true
if the buffer is nonempty.
Definition at line 187 of file HardwareCanSourcePeak.cpp.
|
virtual |
Worker thread main method which receives the CAN messages.
Implements icl_core::thread::Thread.
Definition at line 133 of file HardwareCanSourcePeak.cpp.
|
inline |
Sets the CAN mask used to filter out relevant CAN messages.
Definition at line 86 of file HardwareCanSourcePeak.cpp.
|
inline |
Sets a single CAN ID used to filter out relevant CAN messages.
Definition at line 93 of file HardwareCanSourcePeak.cpp.
|
mutableprivate |
Synchronizes receive buffer access.
Definition at line 108 of file HardwareCanSourcePeak.cpp.
|
private |
Handles producer/consumer notification.
Definition at line 110 of file HardwareCanSourcePeak.cpp.
|
private |
The CAN device.
Definition at line 100 of file HardwareCanSourcePeak.cpp.
|
private |
Only CAN message IDs contained here are passed on to the user.
Definition at line 117 of file HardwareCanSourcePeak.cpp.
|
private |
Current item number. This increments for every CAN message received, even messages that are filtered out.
Definition at line 125 of file HardwareCanSourcePeak.cpp.
|
private |
Buffer size limit.
Definition at line 106 of file HardwareCanSourcePeak.cpp.
|
private |
Buffers CAN messages in case they are not consumed quickly enough.
Definition at line 104 of file HardwareCanSourcePeak.cpp.
|
private |
Current sequence number. This increments for every CAN message that is received and passed on to the user, i.e. not filtered out.
Definition at line 130 of file HardwareCanSourcePeak.cpp.
|
private |
If non-zero, only this message ID is passed on to the user. This has priority over m_can_mask.
Definition at line 121 of file HardwareCanSourcePeak.cpp.
|
private |
If true
, m_can_mask is used to filter the CAN stream.
Definition at line 112 of file HardwareCanSourcePeak.cpp.