A cheap and cheerful framework for human readable/writable forms of messages to devices. More...
#include <yarp/dev/DeviceDriver.h>
Public Member Functions | |
DeviceResponder () | |
Constructor. More... | |
void | addUsage (const char *txt, const char *explain=nullptr) |
Add information about a message that the respond() method understands. More... | |
void | addUsage (const yarp::os::Bottle &bot, const char *explain=nullptr) |
Add information about a message that the respond() method understands. More... | |
virtual bool | respond (const yarp::os::Bottle &command, yarp::os::Bottle &reply) |
Respond to a message. More... | |
bool | read (yarp::os::ConnectionReader &connection) override |
Handler for reading messages from the network, and passing them on to the respond() method. More... | |
void | onRead (yarp::os::Bottle &v) override |
Alternative handler for reading messages from the network, and passing them on to the respond() method. More... | |
void | makeUsage () |
Regenerate usage information. More... | |
void | attach (yarp::os::TypedReader< yarp::os::Bottle > &source) |
Attach this object to a source of messages. More... | |
Public Member Functions inherited from yarp::os::PortReader | |
virtual | ~PortReader () |
Destructor. More... | |
virtual Type | getReadType () const |
Public Member Functions inherited from yarp::os::TypedReaderCallback< yarp::os::Bottle > | |
virtual | ~TypedReaderCallback () |
Destructor. More... | |
virtual void | onRead (yarp::os::Bottle &datum) |
Callback method. More... | |
virtual void | onRead (yarp::os::Bottle &datum, const yarp::os::TypedReader< yarp::os::Bottle > &reader) |
Callback method. More... | |
A cheap and cheerful framework for human readable/writable forms of messages to devices.
The main concern is to makes it easier to document these messages. Override DeviceResponder::respond() to respond to new messages. You don't need to use this class – the network format of messages is defined independently of it.
Definition at line 132 of file DeviceDriver.h.
DeviceResponder::DeviceResponder | ( | ) |
Constructor.
Definition at line 21 of file DeviceDriver.cpp.
void DeviceResponder::addUsage | ( | const char * | txt, |
const char * | explain = nullptr |
||
) |
Add information about a message that the respond() method understands.
txt | the message, in text form |
explain | an (optional) what the message means |
Definition at line 25 of file DeviceDriver.cpp.
void DeviceResponder::addUsage | ( | const yarp::os::Bottle & | bot, |
const char * | explain = nullptr |
||
) |
Add information about a message that the respond() method understands.
bot | the message, in bottle form |
explain | an (optional) what the message means |
Definition at line 34 of file DeviceDriver.cpp.
|
inline |
Attach this object to a source of messages.
source | a BufferedPort or PortReaderBuffer that receives data. |
Definition at line 202 of file DeviceDriver.h.
void DeviceResponder::makeUsage | ( | ) |
Regenerate usage information.
Definition at line 99 of file DeviceDriver.cpp.
|
inlineoverride |
Alternative handler for reading messages from the network, and passing them on to the respond() method.
There can be no replies made if this handler is used.
v | the message |
Definition at line 187 of file DeviceDriver.h.
|
overridevirtual |
Handler for reading messages from the network, and passing them on to the respond() method.
connection | a network connection to a port |
Implements yarp::os::PortReader.
Definition at line 62 of file DeviceDriver.cpp.
|
virtual |
Respond to a message.
command | the message |
reply | the response |
Reimplemented in ServerGrabberResponder, ServerFrameGrabber, yarp::dev::Implement_DepthVisualParams_Parser, yarp::dev::Implement_RgbVisualParams_Parser, yarp::dev::FrameGrabberControls_Parser, DC1394Parser, RGBDImpl::RGBDSensorParser, JoypadCtrlParser, and RPCMessagesParser.
Definition at line 39 of file DeviceDriver.cpp.