Class SVHReceiveThread

Class Documentation

class SVHReceiveThread

Class for receiving messages from the serial device.

Instantiate this class in client code and call its run() method in a separate thread. Data is passed to the caller via the provided callback.

Public Functions

SVHReceiveThread(const std::chrono::microseconds &idle_sleep, std::shared_ptr<Serial> device, ReceivedPacketCallback const &received_callback)

SVHReceiveThread Constructs a new Receivethread.

Parameters:
  • idle_sleep – sleep time during run() if no data is available

  • device – handle of the serial device

  • received_callback – function to call uppon finished packet

inline ~SVHReceiveThread()

Default DTOR.

void run()

run method of the thread, executes the main program in an infinite loop

inline void stop()

stop the run() method

inline unsigned int receivedPacketCount()

return the count of received packets

inline void resetReceivedPackageCount()

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