yarp-devices
Loading...
Searching...
No Matches
roboticslab::CanReaderWriterThread Class Reference

Base class for a thread that attends CAN reads or writes. More...

#include <CanRxTxThreads.hpp>

Inheritance diagram for roboticslab::CanReaderWriterThread:
roboticslab::CanReaderThread roboticslab::CanWriterThread

Public Member Functions

 CanReaderWriterThread (const std::string &type, const std::string &id, double delay, unsigned int bufferSize)
 Constructor.
 ~CanReaderWriterThread () override=default
 Virtual destructor.
bool threadInit () override
 Invoked by the thread right before it is started.
void threadRelease () override
 Invoked by the thread right after it is started.
void beforeStart () override
 Invoked by the caller right before the thread is started.
void afterStart (bool success) override
 Invoked by the caller right before the thread is joined.
void onStop () override
 Callback on thread stop.
void setCanHandles (yarp::dev::ICanBus *iCanBus, yarp::dev::ICanBufferFactory *iCanBufferFactory)
 Configure CAN interface handles.
void attachDumpWriter (yarp::os::BufferedPort< yarp::os::Bottle > *dumpPort, std::mutex *dumpMutex)
 Attach YARP port writer for CAN message dumping.
void attachBusLoadMonitor (ICanMessageNotifier *busLoadMonitor)
 Attach CAN bus load monitor.

Static Protected Member Functions

static void dumpMessage (const can_message &msg, yarp::os::Bottle &b)
 Dump a CAN message to a YARP bottle.

Protected Attributes

yarp::dev::ICanBus * iCanBus {nullptr}
yarp::dev::ICanBufferFactory * iCanBufferFactory {nullptr}
yarp::dev::CanBuffer canBuffer
yarp::os::BufferedPort< yarp::os::Bottle > * dumpPort {nullptr}
std::mutex * dumpMutex {nullptr}
yarp::os::Stamp lastStamp
ICanMessageNotifier * busLoadMonitor {nullptr}
unsigned int bufferSize {0}
double delay {0.0}

Private Attributes

std::string type
std::string id

Detailed Description

Child classes take advantage of CAN message buffers to perform bulk reads and writes.


The documentation for this class was generated from the following files:
  • libraries/YarpPlugins/CanBusBroker/CanRxTxThreads.hpp
  • libraries/YarpPlugins/CanBusBroker/CanRxTxThreads.cpp