44 if (!writer.
writeString(
"getRemoteProtocolVersion")) {
58 if (!helper_proto.read(connection)) {
68 if(!
yarp().canWrite()) {
69 yError(
" Missing server method IOdometry2DMsgs::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{
"reset_odometry_RPC"};
163 static constexpr const char*
s_prototype{
"yarp::dev::ReturnValue IOdometry2DMsgs::reset_odometry_RPC()"};
184 return write(writer);
199 if (!writeTag(writer)) {
202 if (!writeArgs(writer)) {
223 if (!readTag(reader)) {
226 if (!readArgs(reader)) {
257 return write(writer);
269 if (!writer.
write(return_helper)) {
282 if (!reader.
read(return_helper)) {
297 yarp().setOwner(*
this);
302 if (!
yarp().canWrite()) {
306 bool ok =
yarp().write(helper, helper);
313 bool showAll = (functionName ==
"--all");
314 std::vector<std::string> helpString;
316 helpString.emplace_back(
"*** Available commands:");
318 helpString.emplace_back(
"help");
323 if (functionName ==
"help") {
324 helpString.emplace_back(
"std::vector<std::string> help(const std::string& functionName = \"--all\")");
325 helpString.emplace_back(
"Return list of available commands, or help message for a specific function");
326 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");
327 helpString.emplace_back(
"@return list of strings (one string per line)");
330 if (helpString.empty()) {
331 helpString.emplace_back(
"Command not found");
339 constexpr size_t max_tag_len = 3;
349 std::string tag = reader.
readTag(1);
350 bool direct = (tag ==
"__direct__");
354 while (tag_len <= max_tag_len && !reader.
isError()) {
355 if(tag ==
"getRemoteProtocolVersion") {
362 auto proto = getLocalProtocolVersion();
368 if (!writer.
write(proto)) {
391 std::string functionName;
393 functionName =
"--all";
395 auto help_strings = help(functionName);
401 if (!writer.
writeTag(
"many", 1, 0)) {
407 for (
const auto& help_string : help_strings) {
423 std::string next_tag = reader.
readTag(1);
424 if (next_tag.empty()) {
427 tag.append(
"_").append(next_tag);
428 tag_len = std::count(tag.begin(), tag.end(),
'_') + 1;
yarp::os::ApplicationNetworkProtocolVersion helper_proto
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
IOdometry2DMsgs_getRemoteProtocolVersion_helper()=default
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
~Command() override=default
bool readArgs(yarp::os::idl::WireReader &reader)
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
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.
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.
~Reply() override=default
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
yarp::dev::ReturnValue return_helper
static constexpr const char * s_prototype
IOdometry2DMsgs_reset_odometry_RPC_helper()=default
static constexpr const char * s_help
static constexpr const char * s_tag
static constexpr size_t s_reply_len
yarp::dev::ReturnValue(*)() funcptr_t
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
void call(IOdometry2DMsgs *ptr)
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
static constexpr size_t s_cmd_len
static constexpr size_t s_tag_len
virtual bool checkProtocolVersion()
virtual yarp::os::ApplicationNetworkProtocolVersion getRemoteProtocolVersion()
virtual yarp::os::ApplicationNetworkProtocolVersion getLocalProtocolVersion()
virtual yarp::dev::ReturnValue reset_odometry_RPC()
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
virtual std::vector< std::string > help(const std::string &functionName="--all")
@ 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)
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 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