43 if (!writer.
writeString(
"getRemoteProtocolVersion")) {
57 if (!helper_proto.read(connection)) {
67 if(!
yarp().canWrite()) {
68 yError(
" Missing server method IRangefinder2DMsgs::getRemoteProtocolVersion");
73 return helper.helper_proto;}
84 if (remproto.protocol_version != locproto.protocol_version)
86 yCError(SERVICE_LOG_COMPONENT) <<
"Invalid communication protocol.";
87 yCError(SERVICE_LOG_COMPONENT) <<
"Local Protocol Version: " << locproto.toString();
88 yCError(SERVICE_LOG_COMPONENT) <<
"Remote Protocol Version: " << remproto.toString();
158 static constexpr const char*
s_tag{
"getDeviceStatus_RPC"};
162 static constexpr const char*
s_prototype{
"return_getDeviceStatus IRangefinder2DMsgs::getDeviceStatus_RPC()"};
216 static constexpr const char*
s_tag{
"getDistanceRange_RPC"};
220 static constexpr const char*
s_prototype{
"return_getDistanceRange IRangefinder2DMsgs::getDistanceRange_RPC()"};
274 static constexpr const char*
s_tag{
"getScanLimits_RPC"};
278 static constexpr const char*
s_prototype{
"return_getScanLimits IRangefinder2DMsgs::getScanLimits_RPC()"};
332 static constexpr const char*
s_tag{
"getHorizontalResolution_RPC"};
336 static constexpr const char*
s_prototype{
"return_getHorizontalResolution IRangefinder2DMsgs::getHorizontalResolution_RPC()"};
390 static constexpr const char*
s_tag{
"getScanRate_RPC"};
394 static constexpr const char*
s_prototype{
"return_getScanRate IRangefinder2DMsgs::getScanRate_RPC()"};
448 static constexpr const char*
s_tag{
"getDeviceInfo_RPC"};
452 static constexpr const char*
s_prototype{
"return_getDeviceInfo IRangefinder2DMsgs::getDeviceInfo_RPC()"};
512 static constexpr const char*
s_tag{
"setDistanceRange_RPC"};
516 static constexpr const char*
s_prototype{
"yarp::dev::ReturnValue IRangefinder2DMsgs::setDistanceRange_RPC(const double min, const double max)"};
576 static constexpr const char*
s_tag{
"setScanLimits_RPC"};
580 static constexpr const char*
s_prototype{
"yarp::dev::ReturnValue IRangefinder2DMsgs::setScanLimits_RPC(const double min, const double max)"};
639 static constexpr const char*
s_tag{
"setHorizontalResolution_RPC"};
643 static constexpr const char*
s_prototype{
"yarp::dev::ReturnValue IRangefinder2DMsgs::setHorizontalResolution_RPC(const double step)"};
702 static constexpr const char*
s_tag{
"setScanRate_RPC"};
706 static constexpr const char*
s_prototype{
"yarp::dev::ReturnValue IRangefinder2DMsgs::setScanRate_RPC(const double rate)"};
727 return write(writer);
742 if (!writeTag(writer)) {
745 if (!writeArgs(writer)) {
766 if (!readTag(reader)) {
769 if (!readArgs(reader)) {
800 return write(writer);
815 if (!writer.
write(return_helper)) {
831 if (!reader.
read(return_helper)) {
860 return write(writer);
875 if (!writeTag(writer)) {
878 if (!writeArgs(writer)) {
899 if (!readTag(reader)) {
902 if (!readArgs(reader)) {
933 return write(writer);
948 if (!writer.
write(return_helper)) {
964 if (!reader.
read(return_helper)) {
993 return write(writer);
1003 return read(reader);
1008 if (!writeTag(writer)) {
1011 if (!writeArgs(writer)) {
1032 if (!readTag(reader)) {
1035 if (!readArgs(reader)) {
1066 return write(writer);
1072 return read(reader);
1081 if (!writer.
write(return_helper)) {
1097 if (!reader.
read(return_helper)) {
1126 return write(writer);
1136 return read(reader);
1141 if (!writeTag(writer)) {
1144 if (!writeArgs(writer)) {
1165 if (!readTag(reader)) {
1168 if (!readArgs(reader)) {
1199 return write(writer);
1205 return read(reader);
1214 if (!writer.
write(return_helper)) {
1230 if (!reader.
read(return_helper)) {
1259 return write(writer);
1269 return read(reader);
1274 if (!writeTag(writer)) {
1277 if (!writeArgs(writer)) {
1298 if (!readTag(reader)) {
1301 if (!readArgs(reader)) {
1332 return write(writer);
1338 return read(reader);
1347 if (!writer.
write(return_helper)) {
1363 if (!reader.
read(return_helper)) {
1392 return write(writer);
1402 return read(reader);
1407 if (!writeTag(writer)) {
1410 if (!writeArgs(writer)) {
1431 if (!readTag(reader)) {
1434 if (!readArgs(reader)) {
1465 return write(writer);
1471 return read(reader);
1480 if (!writer.
write(return_helper)) {
1496 if (!reader.
read(return_helper)) {
1536 return write(writer);
1546 return read(reader);
1551 if (!writeTag(writer)) {
1554 if (!writeArgs(writer)) {
1581 if (!readTag(reader)) {
1584 if (!readArgs(reader)) {
1631 return write(writer);
1637 return read(reader);
1643 if (!writer.
write(return_helper)) {
1656 if (!reader.
read(return_helper)) {
1696 return write(writer);
1706 return read(reader);
1711 if (!writeTag(writer)) {
1714 if (!writeArgs(writer)) {
1741 if (!readTag(reader)) {
1744 if (!readArgs(reader)) {
1791 return write(writer);
1797 return read(reader);
1803 if (!writer.
write(return_helper)) {
1816 if (!reader.
read(return_helper)) {
1855 return write(writer);
1865 return read(reader);
1870 if (!writeTag(writer)) {
1873 if (!writeArgs(writer)) {
1897 if (!readTag(reader)) {
1900 if (!readArgs(reader)) {
1939 return write(writer);
1945 return read(reader);
1951 if (!writer.
write(return_helper)) {
1964 if (!reader.
read(return_helper)) {
2003 return write(writer);
2013 return read(reader);
2018 if (!writeTag(writer)) {
2021 if (!writeArgs(writer)) {
2045 if (!readTag(reader)) {
2048 if (!readArgs(reader)) {
2087 return write(writer);
2093 return read(reader);
2099 if (!writer.
write(return_helper)) {
2112 if (!reader.
read(return_helper)) {
2127 yarp().setOwner(*
this);
2132 if (!
yarp().canWrite()) {
2136 bool ok =
yarp().write(helper, helper);
2142 if (!
yarp().canWrite()) {
2146 bool ok =
yarp().write(helper, helper);
2152 if (!
yarp().canWrite()) {
2156 bool ok =
yarp().write(helper, helper);
2162 if (!
yarp().canWrite()) {
2166 bool ok =
yarp().write(helper, helper);
2172 if (!
yarp().canWrite()) {
2176 bool ok =
yarp().write(helper, helper);
2182 if (!
yarp().canWrite()) {
2186 bool ok =
yarp().write(helper, helper);
2192 if (!
yarp().canWrite()) {
2196 bool ok =
yarp().write(helper, helper);
2202 if (!
yarp().canWrite()) {
2206 bool ok =
yarp().write(helper, helper);
2212 if (!
yarp().canWrite()) {
2216 bool ok =
yarp().write(helper, helper);
2222 if (!
yarp().canWrite()) {
2226 bool ok =
yarp().write(helper, helper);
2233 bool showAll = (functionName ==
"--all");
2234 std::vector<std::string> helpString;
2236 helpString.emplace_back(
"*** Available commands:");
2247 helpString.emplace_back(
"help");
2279 if (functionName ==
"help") {
2280 helpString.emplace_back(
"std::vector<std::string> help(const std::string& functionName = \"--all\")");
2281 helpString.emplace_back(
"Return list of available commands, or help message for a specific function");
2282 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");
2283 helpString.emplace_back(
"@return list of strings (one string per line)");
2286 if (helpString.empty()) {
2287 helpString.emplace_back(
"Command not found");
2295 constexpr size_t max_tag_len = 2;
2305 std::string tag = reader.
readTag(1);
2306 bool direct = (tag ==
"__direct__");
2310 while (tag_len <= max_tag_len && !reader.
isError()) {
2311 if(tag ==
"getRemoteProtocolVersion") {
2318 auto proto = getLocalProtocolVersion();
2324 if (!writer.
write(proto)) {
2481 if (tag ==
"help") {
2482 std::string functionName;
2484 functionName =
"--all";
2486 auto help_strings = help(functionName);
2492 if (!writer.
writeTag(
"many", 1, 0)) {
2498 for (
const auto& help_string : help_strings) {
2514 std::string next_tag = reader.
readTag(1);
2515 if (next_tag.empty()) {
2518 tag.append(
"_").append(next_tag);
2519 tag_len = std::count(tag.begin(), tag.end(),
'_') + 1;
bool readArgs(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 writeArgs(const yarp::os::idl::WireWriter &writer) const
~Command() override=default
bool readTag(yarp::os::idl::WireReader &reader)
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.
return_getDeviceInfo return_helper
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
return_getDeviceInfo(*)() funcptr_t
static constexpr size_t s_cmd_len
IRangefinder2DMsgs_getDeviceInfo_RPC_helper()=default
static constexpr const char * s_prototype
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 size_t s_tag_len
static constexpr const char * s_tag
static constexpr const char * s_help
void call(IRangefinder2DMsgs *ptr)
static constexpr size_t s_reply_len
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
~Command() override=default
bool readArgs(yarp::os::idl::WireReader &reader)
bool readTag(yarp::os::idl::WireReader &reader)
bool writeTag(const yarp::os::idl::WireWriter &writer) const
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
return_getDeviceStatus return_helper
~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.
static constexpr size_t s_cmd_len
return_getDeviceStatus(*)() funcptr_t
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
IRangefinder2DMsgs_getDeviceStatus_RPC_helper()=default
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
void call(IRangefinder2DMsgs *ptr)
static constexpr size_t s_tag_len
static constexpr const char * s_help
static constexpr const char * s_tag
static constexpr size_t s_reply_len
static constexpr const char * s_prototype
bool readArgs(yarp::os::idl::WireReader &reader)
bool writeTag(const yarp::os::idl::WireWriter &writer) const
bool readTag(yarp::os::idl::WireReader &reader)
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
~Command() override=default
return_getDistanceRange return_helper
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.
~Reply() override=default
return_getDistanceRange(*)() funcptr_t
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_help
static constexpr size_t s_tag_len
static constexpr const char * s_prototype
IRangefinder2DMsgs_getDistanceRange_RPC_helper()=default
void call(IRangefinder2DMsgs *ptr)
static constexpr const char * s_tag
static constexpr size_t s_reply_len
static constexpr size_t s_cmd_len
~Command() override=default
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 readTag(yarp::os::idl::WireReader &reader)
bool readArgs(yarp::os::idl::WireReader &reader)
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
bool writeTag(const yarp::os::idl::WireWriter &writer) const
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.
return_getHorizontalResolution return_helper
return_getHorizontalResolution(*)() funcptr_t
static constexpr const char * s_help
static constexpr size_t s_tag_len
void call(IRangefinder2DMsgs *ptr)
static constexpr const char * s_prototype
static constexpr const char * s_tag
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
static constexpr size_t s_cmd_len
static constexpr size_t s_reply_len
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
IRangefinder2DMsgs_getHorizontalResolution_RPC_helper()=default
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
IRangefinder2DMsgs_getRemoteProtocolVersion_helper()=default
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
yarp::os::ApplicationNetworkProtocolVersion helper_proto
~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)
bool readTag(yarp::os::idl::WireReader &reader)
~Reply() override=default
return_getScanLimits return_helper
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.
IRangefinder2DMsgs_getScanLimits_RPC_helper()=default
return_getScanLimits(*)() funcptr_t
static constexpr size_t s_tag_len
void call(IRangefinder2DMsgs *ptr)
static constexpr size_t s_cmd_len
static constexpr size_t s_reply_len
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
static constexpr const char * s_help
static constexpr const char * s_prototype
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
static constexpr const char * s_tag
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool writeTag(const yarp::os::idl::WireWriter &writer) const
bool readArgs(yarp::os::idl::WireReader &reader)
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool readTag(yarp::os::idl::WireReader &reader)
~Command() override=default
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
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.
return_getScanRate return_helper
static constexpr const char * s_prototype
static constexpr size_t s_reply_len
static constexpr const char * s_help
static constexpr size_t s_cmd_len
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
return_getScanRate(*)() funcptr_t
void call(IRangefinder2DMsgs *ptr)
static constexpr const char * s_tag
static constexpr size_t s_tag_len
IRangefinder2DMsgs_getScanRate_RPC_helper()=default
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
bool writeTag(const yarp::os::idl::WireWriter &writer) const
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool readTag(yarp::os::idl::WireReader &reader)
bool readArgs(yarp::os::idl::WireReader &reader)
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
~Command() override=default
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
yarp::dev::ReturnValue return_helper
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
~Reply() override=default
yarp::dev::ReturnValue(*)(const double, const double) funcptr_t
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
void call(IRangefinder2DMsgs *ptr)
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
static constexpr size_t s_cmd_len
static constexpr const char * s_help
IRangefinder2DMsgs_setDistanceRange_RPC_helper()=default
static constexpr const char * s_tag
static constexpr size_t s_tag_len
static constexpr size_t s_reply_len
static constexpr const char * s_prototype
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.
~Command() override=default
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
bool readArgs(yarp::os::idl::WireReader &reader)
bool readTag(yarp::os::idl::WireReader &reader)
~Reply() override=default
yarp::dev::ReturnValue return_helper
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.
void call(IRangefinder2DMsgs *ptr)
static constexpr const char * s_prototype
IRangefinder2DMsgs_setHorizontalResolution_RPC_helper()=default
static constexpr const char * s_tag
yarp::dev::ReturnValue(*)(const double) funcptr_t
static constexpr const char * s_help
static constexpr size_t s_reply_len
static constexpr size_t s_cmd_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.
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.
bool readArgs(yarp::os::idl::WireReader &reader)
bool readTag(yarp::os::idl::WireReader &reader)
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
bool writeTag(const yarp::os::idl::WireWriter &writer) const
~Command() override=default
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
~Reply() override=default
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_tag_len
IRangefinder2DMsgs_setScanLimits_RPC_helper()=default
static constexpr const char * s_prototype
void call(IRangefinder2DMsgs *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.
static constexpr size_t s_cmd_len
static constexpr const char * s_tag
yarp::dev::ReturnValue(*)(const double, const double) funcptr_t
static constexpr size_t s_reply_len
static constexpr const char * s_help
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool readArgs(yarp::os::idl::WireReader &reader)
bool readTag(yarp::os::idl::WireReader &reader)
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
~Command() override=default
bool writeTag(const yarp::os::idl::WireWriter &writer) const
~Reply() override=default
yarp::dev::ReturnValue return_helper
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.
static constexpr const char * s_help
static constexpr const char * s_tag
yarp::dev::ReturnValue(*)(const double) funcptr_t
IRangefinder2DMsgs_setScanRate_RPC_helper()=default
static constexpr size_t s_cmd_len
static constexpr size_t s_reply_len
static constexpr size_t s_tag_len
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
void call(IRangefinder2DMsgs *ptr)
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
static constexpr const char * s_prototype
virtual yarp::dev::ReturnValue setHorizontalResolution_RPC(const double step)
virtual std::vector< std::string > help(const std::string &functionName="--all")
virtual return_getScanRate getScanRate_RPC()
virtual yarp::os::ApplicationNetworkProtocolVersion getLocalProtocolVersion()
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
virtual return_getHorizontalResolution getHorizontalResolution_RPC()
virtual bool checkProtocolVersion()
virtual return_getDeviceStatus getDeviceStatus_RPC()
virtual yarp::dev::ReturnValue setScanRate_RPC(const double rate)
virtual return_getScanLimits getScanLimits_RPC()
virtual yarp::os::ApplicationNetworkProtocolVersion getRemoteProtocolVersion()
virtual return_getDeviceInfo getDeviceInfo_RPC()
virtual yarp::dev::ReturnValue setScanLimits_RPC(const double min, const double max)
virtual return_getDistanceRange getDistanceRange_RPC()
virtual yarp::dev::ReturnValue setDistanceRange_RPC(const double min, const double max)
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 readString(std::string &str, bool *is_vocab=nullptr)
std::string readTag(size_t len=static_cast< size_t >(-1))
bool read(WirePortable &obj)
bool readFloat64(yarp::conf::float64_t &x)
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 writeFloat64(yarp::conf::float64_t x, bool skip_tag=false) const
bool writeString(const std::string &str, bool skip_tag=false) const
bool writeListEnd() 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