44 if (!writer.
writeString(
"getRemoteProtocolVersion")) {
58 if (!helper_proto.read(connection)) {
68 if(!
yarp().canWrite()) {
69 yError(
" Missing server method IRobotDescriptionMsgs::getRemoteProtocolVersion");
74 return helper.helper_proto;}
85 if (remproto.protocol_version != locproto.protocol_version)
87 yCError(SERVICE_LOG_COMPONENT) <<
"Invalid communication protocol.";
88 yCError(SERVICE_LOG_COMPONENT) <<
"Local Protocol Version: " << locproto.toString();
89 yCError(SERVICE_LOG_COMPONENT) <<
"Remote Protocol Version: " << remproto.toString();
159 static constexpr const char*
s_tag{
"getAllDevicesRPC"};
163 static constexpr const char*
s_prototype{
"return_getAllDevices IRobotDescriptionMsgs::getAllDevicesRPC()"};
222 static constexpr const char*
s_tag{
"getAllDevicesByTypeRPC"};
226 static constexpr const char*
s_prototype{
"return_getAllDevicesByType IRobotDescriptionMsgs::getAllDevicesByTypeRPC(const std::string& type)"};
285 static constexpr const char*
s_tag{
"registerDeviceRPC"};
289 static constexpr const char*
s_prototype{
"yarp::dev::ReturnValue IRobotDescriptionMsgs::registerDeviceRPC(const yarp::dev::DeviceDescription& dev)"};
348 static constexpr const char*
s_tag{
"unregisterDeviceRPC"};
352 static constexpr const char*
s_prototype{
"yarp::dev::ReturnValue IRobotDescriptionMsgs::unregisterDeviceRPC(const std::string& dev)"};
406 static constexpr const char*
s_tag{
"unregisterAllRPC"};
410 static constexpr const char*
s_prototype{
"yarp::dev::ReturnValue IRobotDescriptionMsgs::unregisterAllRPC()"};
431 return write(writer);
446 if (!writeTag(writer)) {
449 if (!writeArgs(writer)) {
470 if (!readTag(reader)) {
473 if (!readArgs(reader)) {
504 return write(writer);
519 if (!writer.
write(return_helper)) {
535 if (!reader.
read(return_helper)) {
574 return write(writer);
589 if (!writeTag(writer)) {
592 if (!writeArgs(writer)) {
616 if (!readTag(reader)) {
619 if (!readArgs(reader)) {
658 return write(writer);
673 if (!writer.
write(return_helper)) {
689 if (!reader.
read(return_helper)) {
728 return write(writer);
743 if (!writeTag(writer)) {
746 if (!writeArgs(writer)) {
770 if (!readTag(reader)) {
773 if (!readArgs(reader)) {
812 return write(writer);
824 if (!writer.
write(return_helper)) {
837 if (!reader.
read(return_helper)) {
876 return write(writer);
891 if (!writeTag(writer)) {
894 if (!writeArgs(writer)) {
918 if (!readTag(reader)) {
921 if (!readArgs(reader)) {
960 return write(writer);
972 if (!writer.
write(return_helper)) {
985 if (!reader.
read(return_helper)) {
1014 return write(writer);
1024 return read(reader);
1029 if (!writeTag(writer)) {
1032 if (!writeArgs(writer)) {
1053 if (!readTag(reader)) {
1056 if (!readArgs(reader)) {
1087 return write(writer);
1093 return read(reader);
1099 if (!writer.
write(return_helper)) {
1112 if (!reader.
read(return_helper)) {
1127 yarp().setOwner(*
this);
1132 if (!
yarp().canWrite()) {
1136 bool ok =
yarp().write(helper, helper);
1140 return failed_reply;
1142 return helper.reply.return_helper;
1147 if (!
yarp().canWrite()) {
1151 bool ok =
yarp().write(helper, helper);
1155 return failed_reply;
1157 return helper.reply.return_helper;
1162 if (!
yarp().canWrite()) {
1166 bool ok =
yarp().write(helper, helper);
1172 if (!
yarp().canWrite()) {
1176 bool ok =
yarp().write(helper, helper);
1182 if (!
yarp().canWrite()) {
1186 bool ok =
yarp().write(helper, helper);
1193 bool showAll = (functionName ==
"--all");
1194 std::vector<std::string> helpString;
1196 helpString.emplace_back(
"*** Available commands:");
1202 helpString.emplace_back(
"help");
1219 if (functionName ==
"help") {
1220 helpString.emplace_back(
"std::vector<std::string> help(const std::string& functionName = \"--all\")");
1221 helpString.emplace_back(
"Return list of available commands, or help message for a specific function");
1222 helpString.emplace_back(
"@param functionName name of command for which to get a detailed description. If none or '--all' is provided, print list of available commands");
1223 helpString.emplace_back(
"@return list of strings (one string per line)");
1226 if (helpString.empty()) {
1227 helpString.emplace_back(
"Command not found");
1235 constexpr size_t max_tag_len = 1;
1245 std::string tag = reader.
readTag(1);
1246 bool direct = (tag ==
"__direct__");
1250 while (tag_len <= max_tag_len && !reader.
isError()) {
1251 if(tag ==
"getRemoteProtocolVersion") {
1258 auto proto = getLocalProtocolVersion();
1264 if (!writer.
write(proto)) {
1346 if (tag ==
"help") {
1347 std::string functionName;
1349 functionName =
"--all";
1351 auto help_strings = help(functionName);
1357 if (!writer.
writeTag(
"many", 1, 0)) {
1363 for (
const auto& help_string : help_strings) {
1379 std::string next_tag = reader.
readTag(1);
1380 if (next_tag.empty()) {
1383 tag.append(
"_").append(next_tag);
1384 tag_len = std::count(tag.begin(), tag.end(),
'_') + 1;
~Command() override=default
bool readTag(yarp::os::idl::WireReader &reader)
bool writeTag(const yarp::os::idl::WireWriter &writer) const
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool readArgs(yarp::os::idl::WireReader &reader)
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
return_getAllDevicesByType return_helper
~Reply() override=default
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
static constexpr const char * s_tag
void call(IRobotDescriptionMsgs *ptr)
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
return_getAllDevicesByType(*)(const std::string &) funcptr_t
IRobotDescriptionMsgs_getAllDevicesByTypeRPC_helper()=default
static constexpr size_t s_cmd_len
static constexpr size_t s_reply_len
static constexpr const char * s_help
static constexpr const char * s_prototype
static constexpr size_t s_tag_len
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
~Command() override=default
bool writeTag(const yarp::os::idl::WireWriter &writer) const
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
bool readTag(yarp::os::idl::WireReader &reader)
bool readArgs(yarp::os::idl::WireReader &reader)
~Reply() override=default
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
return_getAllDevices return_helper
void call(IRobotDescriptionMsgs *ptr)
static constexpr size_t s_cmd_len
static constexpr size_t s_tag_len
return_getAllDevices(*)() funcptr_t
static constexpr const char * s_help
IRobotDescriptionMsgs_getAllDevicesRPC_helper()=default
static constexpr const char * s_prototype
static constexpr size_t s_reply_len
static constexpr const char * s_tag
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
yarp::os::ApplicationNetworkProtocolVersion helper_proto
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
IRobotDescriptionMsgs_getRemoteProtocolVersion_helper()=default
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
~Command() override=default
bool readArgs(yarp::os::idl::WireReader &reader)
bool writeTag(const yarp::os::idl::WireWriter &writer) const
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
yarp::dev::DeviceDescription dev
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool readTag(yarp::os::idl::WireReader &reader)
~Reply() override=default
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
yarp::dev::ReturnValue return_helper
static constexpr size_t s_reply_len
yarp::dev::ReturnValue(*)(const yarp::dev::DeviceDescription &) funcptr_t
static constexpr const char * s_help
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
static constexpr const char * s_prototype
static constexpr size_t s_tag_len
static constexpr const char * s_tag
IRobotDescriptionMsgs_registerDeviceRPC_helper()=default
static constexpr size_t s_cmd_len
void call(IRobotDescriptionMsgs *ptr)
bool readArgs(yarp::os::idl::WireReader &reader)
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
~Command() override=default
bool writeTag(const yarp::os::idl::WireWriter &writer) const
bool readTag(yarp::os::idl::WireReader &reader)
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
~Reply() override=default
yarp::dev::ReturnValue return_helper
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
IRobotDescriptionMsgs_unregisterAllRPC_helper()=default
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
static constexpr const char * s_prototype
static constexpr size_t s_reply_len
static constexpr const char * s_help
static constexpr const char * s_tag
static constexpr size_t s_cmd_len
static constexpr size_t s_tag_len
yarp::dev::ReturnValue(*)() funcptr_t
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
void call(IRobotDescriptionMsgs *ptr)
bool readTag(yarp::os::idl::WireReader &reader)
~Command() override=default
bool writeTag(const yarp::os::idl::WireWriter &writer) const
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool readArgs(yarp::os::idl::WireReader &reader)
yarp::dev::ReturnValue return_helper
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
~Reply() override=default
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
IRobotDescriptionMsgs_unregisterDeviceRPC_helper()=default
static constexpr const char * s_help
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
static constexpr size_t s_reply_len
void call(IRobotDescriptionMsgs *ptr)
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
static constexpr const char * s_tag
static constexpr size_t s_cmd_len
yarp::dev::ReturnValue(*)(const std::string &) funcptr_t
static constexpr const char * s_prototype
static constexpr size_t s_tag_len
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
virtual yarp::os::ApplicationNetworkProtocolVersion getRemoteProtocolVersion()
virtual yarp::dev::ReturnValue unregisterAllRPC()
virtual return_getAllDevices getAllDevicesRPC()
virtual bool checkProtocolVersion()
virtual return_getAllDevicesByType getAllDevicesByTypeRPC(const std::string &type)
virtual std::vector< std::string > help(const std::string &functionName="--all")
virtual yarp::os::ApplicationNetworkProtocolVersion getLocalProtocolVersion()
virtual yarp::dev::ReturnValue registerDeviceRPC(const yarp::dev::DeviceDescription &dev)
virtual yarp::dev::ReturnValue unregisterDeviceRPC(const std::string &dev)
yarp::dev::ReturnValue ret
yarp::dev::ReturnValue ret
@ return_value_error_nws_nwc_communication_error
Method is not (yet) implemented.
short int protocol_version
An interface for reading from a network connection.
An interface for writing to a network connection.
This is a base class for objects that can be both read from and be written to the YARP network.
bool write(PortWriter &writer)
Write a message to the associated port or reader.
yarp::os::WireLink & yarp()
Get YARP state associated with this object.
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
IDL-friendly connection reader.
bool readNested(WirePortable &obj)
bool readString(std::string &str, bool *is_vocab=nullptr)
std::string readTag(size_t len=static_cast< size_t >(-1))
bool read(WirePortable &obj)
IDL-friendly connection writer.
bool write(const WirePortable &obj) const
bool writeListHeader(int len) const
bool writeTag(const char *tag, int split, int len) const
bool writeString(const std::string &str, bool skip_tag=false) const
bool writeListEnd() const
bool writeNested(const WirePortable &obj) const
bool writeListBegin(int tag, size_t len) const
#define yCError(component,...)
#define YARP_LOG_COMPONENT(name,...)
The main, catch-all namespace for YARP.
#define YARP_VERSION_PATCH
#define YARP_VERSION_MAJOR
#define YARP_VERSION_MINOR