40 mPriv->device_id =
id;
45 return mPriv->device_id;
69 if (examples.
size()>=1) {
78 reply.
addString(
"no documentation available");
83 reply.
addString(
"command not recognized");
98 if (response.
size() >= 1) {
100 if (writer !=
nullptr) {
102 for (
size_t i = 1;
i < response.
size();
i++) {
113 response.
write(*writer);
120 if (writer !=
nullptr) {
123 response.
write(*writer);
135 addUsage(
"[help] [more]",
"list usage with some comments");
virtual void setId(const std::string &id)
Set the id for this device.
virtual std::string id() const
Return the id assigned to the PolyDriver.
DeviceResponder()
Constructor.
virtual bool respond(const yarp::os::Bottle &command, yarp::os::Bottle &reply)
Respond to a message.
void addUsage(const char *txt, const char *explain=nullptr)
Add information about a message that the respond() method understands.
void makeUsage()
Regenerate usage information.
bool read(yarp::os::ConnectionReader &connection) override
Handler for reading messages from the network, and passing them on to the respond() method.
A simple collection of objects that can be described and transmitted in a portable way.
void add(const Value &value)
Add a Value to the bottle, at the end of the list.
void addVocab32(yarp::conf::vocab32_t x)
Places a vocabulary item in the bottle, at the end of the list.
void append(const Bottle &alt)
Append the content of the given bottle to the current list.
size_type size() const
Gets the number of elements in the bottle.
bool read(ConnectionReader &reader) override
Set the bottle's value based on input from a network connection.
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
void clear()
Empties the bottle of any objects it contains.
bool write(ConnectionWriter &writer) const override
Output a representation of the bottle to a network connection.
void addString(const char *str)
Places a string in the bottle, at the end of the list.
std::string toString() const override
Gives a human-readable textual representation of the bottle.
A mini-server for performing network communication in the background.
void write(bool forceStrict=false)
Write the current object being returned by BufferedPort::prepare.
An interface for reading from a network connection.
An interface for writing to a network connection.
virtual bool isTextMode() const =0
Check if the connection is text mode.
A single value (typically within a Bottle).
static Value * makeList()
Create a list Value.
virtual yarp::conf::vocab32_t asVocab32() const
Get vocabulary identifier as an integer.
static Value * makeVocab32(yarp::conf::vocab32_t v)
Create a vocabulary identifier Value.
virtual bool isList() const
Checks if value is a list.
virtual Bottle * asList() const
Get list value.
std::string toString() const override
Return a standard text representation of the content of the object.
#define yCTrace(component,...)
#define YARP_LOG_COMPONENT(name,...)
For streams capable of holding different kinds of content, check what they actually have.
The components from which ports and connections are built.
An interface to the operating system, including Port based communication.
constexpr yarp::conf::vocab32_t createVocab32(char a, char b=0, char c=0, char d=0)
Create a vocab from chars.