44 if (!writer.
writeString(
"getRemoteProtocolVersion")) {
58 if (!helper_proto.read(connection)) {
68 if(!
yarp().canWrite()) {
69 yError(
" Missing server method IRangefinder2DMsgs::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{
"getDeviceStatus_RPC"};
163 static constexpr const char*
s_prototype{
"return_getDeviceStatus IRangefinder2DMsgs::getDeviceStatus_RPC()"};
217 static constexpr const char*
s_tag{
"getDistanceRange_RPC"};
221 static constexpr const char*
s_prototype{
"return_getDistanceRange IRangefinder2DMsgs::getDistanceRange_RPC()"};
275 static constexpr const char*
s_tag{
"getScanLimits_RPC"};
279 static constexpr const char*
s_prototype{
"return_getScanLimits IRangefinder2DMsgs::getScanLimits_RPC()"};
333 static constexpr const char*
s_tag{
"getHorizontalResolution_RPC"};
337 static constexpr const char*
s_prototype{
"return_getHorizontalResolution IRangefinder2DMsgs::getHorizontalResolution_RPC()"};
391 static constexpr const char*
s_tag{
"getScanRate_RPC"};
395 static constexpr const char*
s_prototype{
"return_getScanRate IRangefinder2DMsgs::getScanRate_RPC()"};
449 static constexpr const char*
s_tag{
"getDeviceInfo_RPC"};
453 static constexpr const char*
s_prototype{
"return_getDeviceInfo IRangefinder2DMsgs::getDeviceInfo_RPC()"};
513 static constexpr const char*
s_tag{
"setDistanceRange_RPC"};
517 static constexpr const char*
s_prototype{
"yarp::dev::ReturnValue IRangefinder2DMsgs::setDistanceRange_RPC(const double min, const double max)"};
577 static constexpr const char*
s_tag{
"setScanLimits_RPC"};
581 static constexpr const char*
s_prototype{
"yarp::dev::ReturnValue IRangefinder2DMsgs::setScanLimits_RPC(const double min, const double max)"};
640 static constexpr const char*
s_tag{
"setHorizontalResolution_RPC"};
644 static constexpr const char*
s_prototype{
"yarp::dev::ReturnValue IRangefinder2DMsgs::setHorizontalResolution_RPC(const double step)"};
703 static constexpr const char*
s_tag{
"setScanRate_RPC"};
707 static constexpr const char*
s_prototype{
"yarp::dev::ReturnValue IRangefinder2DMsgs::setScanRate_RPC(const double rate)"};
728 return write(writer);
743 if (!writeTag(writer)) {
746 if (!writeArgs(writer)) {
767 if (!readTag(reader)) {
770 if (!readArgs(reader)) {
801 return write(writer);
816 if (!writer.
write(return_helper)) {
832 if (!reader.
read(return_helper)) {
861 return write(writer);
876 if (!writeTag(writer)) {
879 if (!writeArgs(writer)) {
900 if (!readTag(reader)) {
903 if (!readArgs(reader)) {
934 return write(writer);
949 if (!writer.
write(return_helper)) {
965 if (!reader.
read(return_helper)) {
994 return write(writer);
1004 return read(reader);
1009 if (!writeTag(writer)) {
1012 if (!writeArgs(writer)) {
1033 if (!readTag(reader)) {
1036 if (!readArgs(reader)) {
1067 return write(writer);
1073 return read(reader);
1082 if (!writer.
write(return_helper)) {
1098 if (!reader.
read(return_helper)) {
1127 return write(writer);
1137 return read(reader);
1142 if (!writeTag(writer)) {
1145 if (!writeArgs(writer)) {
1166 if (!readTag(reader)) {
1169 if (!readArgs(reader)) {
1200 return write(writer);
1206 return read(reader);
1215 if (!writer.
write(return_helper)) {
1231 if (!reader.
read(return_helper)) {
1260 return write(writer);
1270 return read(reader);
1275 if (!writeTag(writer)) {
1278 if (!writeArgs(writer)) {
1299 if (!readTag(reader)) {
1302 if (!readArgs(reader)) {
1333 return write(writer);
1339 return read(reader);
1348 if (!writer.
write(return_helper)) {
1364 if (!reader.
read(return_helper)) {
1393 return write(writer);
1403 return read(reader);
1408 if (!writeTag(writer)) {
1411 if (!writeArgs(writer)) {
1432 if (!readTag(reader)) {
1435 if (!readArgs(reader)) {
1466 return write(writer);
1472 return read(reader);
1481 if (!writer.
write(return_helper)) {
1497 if (!reader.
read(return_helper)) {
1537 return write(writer);
1547 return read(reader);
1552 if (!writeTag(writer)) {
1555 if (!writeArgs(writer)) {
1582 if (!readTag(reader)) {
1585 if (!readArgs(reader)) {
1632 return write(writer);
1638 return read(reader);
1644 if (!writer.
write(return_helper)) {
1657 if (!reader.
read(return_helper)) {
1697 return write(writer);
1707 return read(reader);
1712 if (!writeTag(writer)) {
1715 if (!writeArgs(writer)) {
1742 if (!readTag(reader)) {
1745 if (!readArgs(reader)) {
1792 return write(writer);
1798 return read(reader);
1804 if (!writer.
write(return_helper)) {
1817 if (!reader.
read(return_helper)) {
1856 return write(writer);
1866 return read(reader);
1871 if (!writeTag(writer)) {
1874 if (!writeArgs(writer)) {
1898 if (!readTag(reader)) {
1901 if (!readArgs(reader)) {
1940 return write(writer);
1946 return read(reader);
1952 if (!writer.
write(return_helper)) {
1965 if (!reader.
read(return_helper)) {
2004 return write(writer);
2014 return read(reader);
2019 if (!writeTag(writer)) {
2022 if (!writeArgs(writer)) {
2046 if (!readTag(reader)) {
2049 if (!readArgs(reader)) {
2088 return write(writer);
2094 return read(reader);
2100 if (!writer.
write(return_helper)) {
2113 if (!reader.
read(return_helper)) {
2128 yarp().setOwner(*
this);
2133 if (!
yarp().canWrite()) {
2137 bool ok =
yarp().write(helper, helper);
2141 return failed_reply;
2143 return helper.reply.return_helper;
2148 if (!
yarp().canWrite()) {
2152 bool ok =
yarp().write(helper, helper);
2156 return failed_reply;
2158 return helper.reply.return_helper;
2163 if (!
yarp().canWrite()) {
2167 bool ok =
yarp().write(helper, helper);
2171 return failed_reply;
2173 return helper.reply.return_helper;
2178 if (!
yarp().canWrite()) {
2182 bool ok =
yarp().write(helper, helper);
2186 return failed_reply;
2188 return helper.reply.return_helper;
2193 if (!
yarp().canWrite()) {
2197 bool ok =
yarp().write(helper, helper);
2201 return failed_reply;
2203 return helper.reply.return_helper;
2208 if (!
yarp().canWrite()) {
2212 bool ok =
yarp().write(helper, helper);
2216 return failed_reply;
2218 return helper.reply.return_helper;
2223 if (!
yarp().canWrite()) {
2227 bool ok =
yarp().write(helper, helper);
2233 if (!
yarp().canWrite()) {
2237 bool ok =
yarp().write(helper, helper);
2243 if (!
yarp().canWrite()) {
2247 bool ok =
yarp().write(helper, helper);
2253 if (!
yarp().canWrite()) {
2257 bool ok =
yarp().write(helper, helper);
2264 bool showAll = (functionName ==
"--all");
2265 std::vector<std::string> helpString;
2267 helpString.emplace_back(
"*** Available commands:");
2278 helpString.emplace_back(
"help");
2310 if (functionName ==
"help") {
2311 helpString.emplace_back(
"std::vector<std::string> help(const std::string& functionName = \"--all\")");
2312 helpString.emplace_back(
"Return list of available commands, or help message for a specific function");
2313 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");
2314 helpString.emplace_back(
"@return list of strings (one string per line)");
2317 if (helpString.empty()) {
2318 helpString.emplace_back(
"Command not found");
2326 constexpr size_t max_tag_len = 2;
2336 std::string tag = reader.
readTag(1);
2337 bool direct = (tag ==
"__direct__");
2341 while (tag_len <= max_tag_len && !reader.
isError()) {
2342 if(tag ==
"getRemoteProtocolVersion") {
2349 auto proto = getLocalProtocolVersion();
2355 if (!writer.
write(proto)) {
2512 if (tag ==
"help") {
2513 std::string functionName;
2515 functionName =
"--all";
2517 auto help_strings = help(functionName);
2523 if (!writer.
writeTag(
"many", 1, 0)) {
2529 for (
const auto& help_string : help_strings) {
2545 std::string next_tag = reader.
readTag(1);
2546 if (next_tag.empty()) {
2549 tag.append(
"_").append(next_tag);
2550 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)
yarp::dev::ReturnValue retval
yarp::dev::ReturnValue retval
yarp::dev::ReturnValue retval
yarp::dev::ReturnValue retval
yarp::dev::ReturnValue retval
yarp::dev::ReturnValue retval
@ 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 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