Thread for receiving messages from the serial device. More...
#include <SVHReceiveThread.h>
Public Member Functions | |
unsigned int | receivedPacketCount () |
return the count of received packets | |
void | resetReceivedPackageCount () |
resetReceivedPackageCount Resets the received package count to zero. This can be usefull to set all communication variables to the initial state | |
virtual void | run () |
run method of the thread, executes the main program | |
SVHReceiveThread (const TimeSpan &period, boost::shared_ptr< Serial > device, ReceivedPacketCallback const &received_callback) | |
SVHReceiveThread Constructs a new Receivethread. | |
virtual | ~SVHReceiveThread () |
Default DTOR. | |
Private Types | |
enum | tState { eRS_HEADER1, eRS_HEADER2, eRS_INDEX, eRS_ADDRESS, eRS_LENGTH, eRS_DATA, eRS_CHECKSUM, eRS_COMPLETE } |
enum for receive packet state machine states More... | |
Private Member Functions | |
bool | receiveData () |
state machine processing received data | |
Private Attributes | |
icl_comm::ArrayBuilder | m_ab |
pointer to array builder object for packet receive | |
std::vector< uint8_t > | m_data |
length of received serial data | |
uint16_t | m_length |
length of received serial data | |
unsigned int | m_packets_received |
packets counter | |
ReceivedPacketCallback | m_received_callback |
function callback for received packages | |
tState | m_received_state |
current state of the state machine | |
boost::shared_ptr< Serial > | m_serial_device |
pointer to serial device object |
Thread for receiving messages from the serial device.
Definition at line 56 of file SVHReceiveThread.h.
enum driver_svh::SVHReceiveThread::tState [private] |
enum for receive packet state machine states
eRS_HEADER1 | |
eRS_HEADER2 | |
eRS_INDEX | |
eRS_ADDRESS | |
eRS_LENGTH | |
eRS_DATA | |
eRS_CHECKSUM | |
eRS_COMPLETE |
Definition at line 89 of file SVHReceiveThread.h.
driver_svh::SVHReceiveThread::SVHReceiveThread | ( | const TimeSpan & | period, |
boost::shared_ptr< Serial > | device, | ||
ReceivedPacketCallback const & | received_callback | ||
) |
SVHReceiveThread Constructs a new Receivethread.
period | The relative period after which the thread is cyclically woken up. |
device | handle of the serial device |
received_callback | function to call uppon finished packet |
Definition at line 38 of file SVHReceiveThread.cpp.
virtual driver_svh::SVHReceiveThread::~SVHReceiveThread | ( | ) | [inline, virtual] |
Default DTOR.
Definition at line 70 of file SVHReceiveThread.h.
bool driver_svh::SVHReceiveThread::receiveData | ( | ) | [private] |
state machine processing received data
Definition at line 72 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 50 of file SVHReceiveThread.cpp.
pointer to array builder object for packet receive
Definition at line 111 of file SVHReceiveThread.h.
std::vector<uint8_t> driver_svh::SVHReceiveThread::m_data [private] |
length of received serial data
Definition at line 108 of file SVHReceiveThread.h.
length of received serial data
Definition at line 105 of file SVHReceiveThread.h.
unsigned int driver_svh::SVHReceiveThread::m_packets_received [private] |
packets counter
Definition at line 114 of file SVHReceiveThread.h.
function callback for received packages
Definition at line 120 of file SVHReceiveThread.h.
current state of the state machine
Definition at line 102 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.