Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
driver_svh::SVHReceiveThread Class Reference

Thread for receiving messages from the serial device. More...

#include <SVHReceiveThread.h>

Inheritance diagram for driver_svh::SVHReceiveThread:
Inheritance graph
[legend]

Public Member Functions

unsigned int receivedPacketCount ()
 return the count of received packets More...
 
void resetReceivedPackageCount ()
 resetReceivedPackageCount Resets the received package count to zero. This can be usefull to set all communication variables to the initial state More...
 
virtual void run ()
 run method of the thread, executes the main program More...
 
 SVHReceiveThread (const TimeSpan &period, boost::shared_ptr< Serial > device, ReceivedPacketCallback const &received_callback)
 SVHReceiveThread Constructs a new Receivethread. More...
 
virtual ~SVHReceiveThread ()
 Default DTOR. More...
 
- Public Member Functions inherited from icl_core::thread::PeriodicThread
icl_core::TimeSpan period () const
 
 PeriodicThread (const icl_core::String &description, const icl_core::TimeSpan &period, ThreadPriority priority=0)
 
bool setPeriod (const icl_core::TimeSpan &period)
 
virtual ~PeriodicThread ()
 
- 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 Types

enum  tState {
  eRS_HEADER1, eRS_HEADER2, eRS_INDEX, eRS_ADDRESS,
  eRS_LENGTH1, eRS_LENGTH2, eRS_DATA, eRS_CHECKSUM1,
  eRS_CHECKSUM2
}
 enum for receive packet state machine states More...
 

Private Member Functions

bool receiveData ()
 state machine processing received data More...
 

Private Attributes

icl_comm::ArrayBuilder m_ab
 pointer to array builder object for packet receive More...
 
uint8_t m_checksum1
 Checksum of packet. More...
 
uint8_t m_checksum2
 
std::vector< uint8_tm_data
 length of received serial data More...
 
uint16_t m_length
 length of received serial data More...
 
unsigned int m_packets_received
 packets counter More...
 
ReceivedPacketCallback m_received_callback
 function callback for received packages More...
 
tState m_received_state
 current state of the state machine More...
 
boost::shared_ptr< Serial > m_serial_device
 pointer to serial device object More...
 
unsigned int m_skipped_bytes
 counter for skipped bytes in case no packet is detected 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::thread::PeriodicThread
void waitPeriod ()
 
- Protected Member Functions inherited from icl_core::Noncopyable
 Noncopyable ()
 
virtual ~Noncopyable ()
 

Detailed Description

Thread for receiving messages from the serial device.

Definition at line 56 of file SVHReceiveThread.h.

Member Enumeration Documentation

enum for receive packet state machine states

Enumerator
eRS_HEADER1 
eRS_HEADER2 
eRS_INDEX 
eRS_ADDRESS 
eRS_LENGTH1 
eRS_LENGTH2 
eRS_DATA 
eRS_CHECKSUM1 
eRS_CHECKSUM2 

Definition at line 89 of file SVHReceiveThread.h.

Constructor & Destructor Documentation

driver_svh::SVHReceiveThread::SVHReceiveThread ( const TimeSpan period,
boost::shared_ptr< Serial >  device,
ReceivedPacketCallback const &  received_callback 
)

SVHReceiveThread Constructs a new Receivethread.

Parameters
periodThe relative period after which the thread is cyclically woken up.
devicehandle of the serial device
received_callbackfunction to call uppon finished packet

Definition at line 38 of file SVHReceiveThread.cpp.

virtual driver_svh::SVHReceiveThread::~SVHReceiveThread ( )
inlinevirtual

Default DTOR.

Definition at line 70 of file SVHReceiveThread.h.

Member Function Documentation

bool driver_svh::SVHReceiveThread::receiveData ( )
private

state machine processing received data

Definition at line 80 of file SVHReceiveThread.cpp.

unsigned int driver_svh::SVHReceiveThread::receivedPacketCount ( )
inline

return the count of received packets

Definition at line 76 of file SVHReceiveThread.h.

void driver_svh::SVHReceiveThread::resetReceivedPackageCount ( )
inline

resetReceivedPackageCount Resets the received package count to zero. This can be usefull to set all communication variables to the initial state

Definition at line 81 of file SVHReceiveThread.h.

void driver_svh::SVHReceiveThread::run ( )
virtual

run method of the thread, executes the main program

Implements icl_core::thread::Thread.

Definition at line 51 of file SVHReceiveThread.cpp.

Member Data Documentation

icl_comm::ArrayBuilder driver_svh::SVHReceiveThread::m_ab
private

pointer to array builder object for packet receive

Definition at line 115 of file SVHReceiveThread.h.

uint8_t driver_svh::SVHReceiveThread::m_checksum1
private

Checksum of packet.

Definition at line 108 of file SVHReceiveThread.h.

uint8_t driver_svh::SVHReceiveThread::m_checksum2
private

Definition at line 109 of file SVHReceiveThread.h.

std::vector<uint8_t> driver_svh::SVHReceiveThread::m_data
private

length of received serial data

Definition at line 112 of file SVHReceiveThread.h.

uint16_t driver_svh::SVHReceiveThread::m_length
private

length of received serial data

Definition at line 106 of file SVHReceiveThread.h.

unsigned int driver_svh::SVHReceiveThread::m_packets_received
private

packets counter

Definition at line 118 of file SVHReceiveThread.h.

ReceivedPacketCallback driver_svh::SVHReceiveThread::m_received_callback
private

function callback for received packages

Definition at line 126 of file SVHReceiveThread.h.

tState driver_svh::SVHReceiveThread::m_received_state
private

current state of the state machine

Definition at line 103 of file SVHReceiveThread.h.

boost::shared_ptr<Serial> driver_svh::SVHReceiveThread::m_serial_device
private

pointer to serial device object

Definition at line 86 of file SVHReceiveThread.h.

unsigned int driver_svh::SVHReceiveThread::m_skipped_bytes
private

counter for skipped bytes in case no packet is detected

Definition at line 120 of file SVHReceiveThread.h.


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


schunk_svh_driver
Author(s): Georg Heppner
autogenerated on Mon Jun 10 2019 15:04:59