Public Member Functions | Private Attributes | List of all members
icl_hardware::can::HardwareCanSourcePeak::WorkerThread Class Reference
Inheritance diagram for icl_hardware::can::HardwareCanSourcePeak::WorkerThread:
Inheritance graph
[legend]

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< tCanDevicem_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::Ptrm_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 ()
 

Detailed Description

Internal worker thread which listens to a given CAN device and buffers the received messages.

Definition at line 54 of file HardwareCanSourcePeak.cpp.

Constructor & Destructor Documentation

icl_hardware::can::HardwareCanSourcePeak::WorkerThread::WorkerThread ( tCanDevice can_device,
std::size_t  max_buffer_size = 256 
)
inline

Definition at line 57 of file HardwareCanSourcePeak.cpp.

Member Function Documentation

boost::scoped_ptr<tCanDevice>& icl_hardware::can::HardwareCanSourcePeak::WorkerThread::canDevice ( )
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.

void icl_hardware::can::HardwareCanSourcePeak::WorkerThread::run ( )
virtual

Worker thread main method which receives the CAN messages.

Implements icl_core::thread::Thread.

Definition at line 133 of file HardwareCanSourcePeak.cpp.

void icl_hardware::can::HardwareCanSourcePeak::WorkerThread::setCanMask ( const CanMatrix can_mask)
inline

Sets the CAN mask used to filter out relevant CAN messages.

Definition at line 86 of file HardwareCanSourcePeak.cpp.

void icl_hardware::can::HardwareCanSourcePeak::WorkerThread::setSingleCanID ( uint16_t  can_id)
inline

Sets a single CAN ID used to filter out relevant CAN messages.

Definition at line 93 of file HardwareCanSourcePeak.cpp.

Member Data Documentation

icl_core::thread::Mutex icl_hardware::can::HardwareCanSourcePeak::WorkerThread::m_buffer_mutex
mutableprivate

Synchronizes receive buffer access.

Definition at line 108 of file HardwareCanSourcePeak.cpp.

icl_core::thread::Semaphore icl_hardware::can::HardwareCanSourcePeak::WorkerThread::m_buffer_semaphore
private

Handles producer/consumer notification.

Definition at line 110 of file HardwareCanSourcePeak.cpp.

boost::scoped_ptr<tCanDevice> icl_hardware::can::HardwareCanSourcePeak::WorkerThread::m_can_device
private

The CAN device.

Definition at line 100 of file HardwareCanSourcePeak.cpp.

CanMatrix icl_hardware::can::HardwareCanSourcePeak::WorkerThread::m_can_mask
private

Only CAN message IDs contained here are passed on to the user.

Note
If m_single_can_id is non-zero, it has priority over this.

Definition at line 117 of file HardwareCanSourcePeak.cpp.

std::size_t icl_hardware::can::HardwareCanSourcePeak::WorkerThread::m_dsin
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.

std::size_t icl_hardware::can::HardwareCanSourcePeak::WorkerThread::m_max_buffer_size
private

Buffer size limit.

Definition at line 106 of file HardwareCanSourcePeak.cpp.

std::deque<CanMessageStamped::Ptr> icl_hardware::can::HardwareCanSourcePeak::WorkerThread::m_recv_buffer
private

Buffers CAN messages in case they are not consumed quickly enough.

Definition at line 104 of file HardwareCanSourcePeak.cpp.

std::size_t icl_hardware::can::HardwareCanSourcePeak::WorkerThread::m_sequence_number
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.

uint16_t icl_hardware::can::HardwareCanSourcePeak::WorkerThread::m_single_can_id
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.

bool icl_hardware::can::HardwareCanSourcePeak::WorkerThread::m_use_can_mask
private

If true, m_can_mask is used to filter the CAN stream.

Definition at line 112 of file HardwareCanSourcePeak.cpp.


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


fzi_icl_can
Author(s):
autogenerated on Mon Jun 10 2019 13:17:02