44 if (!writer.
writeString(
"getRemoteProtocolVersion")) {
58 if (!helper_proto.read(connection)) {
68 if(!
yarp().canWrite()) {
69 yError(
" Missing server method INavigation2DVelocityActionsMsgs::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();
167 static constexpr const char*
s_tag{
"applyVelocityCommandRPC"};
171 static constexpr const char*
s_prototype{
"yarp::dev::ReturnValue INavigation2DVelocityActionsMsgs::applyVelocityCommandRPC(const double x_vel, const double y_vel, const double theta_vel, const double timeout)"};
225 static constexpr const char*
s_tag{
"getLastVelocityCommandRPC"};
229 static constexpr const char*
s_prototype{
"return_getLastVelocityCommand INavigation2DVelocityActionsMsgs::getLastVelocityCommandRPC()"};
235 cmd{x_vel, y_vel, theta_vel, timeout}
252 theta_vel{theta_vel},
263 return write(writer);
278 if (!writeTag(writer)) {
281 if (!writeArgs(writer)) {
314 if (!readTag(reader)) {
317 if (!readArgs(reader)) {
380 return write(writer);
392 if (!writer.
write(return_helper)) {
405 if (!reader.
read(return_helper)) {
434 return write(writer);
449 if (!writeTag(writer)) {
452 if (!writeArgs(writer)) {
473 if (!readTag(reader)) {
476 if (!readArgs(reader)) {
507 return write(writer);
522 if (!writer.
write(return_helper)) {
538 if (!reader.
read(return_helper)) {
553 yarp().setOwner(*
this);
558 if (!
yarp().canWrite()) {
562 bool ok =
yarp().write(helper, helper);
568 if (!
yarp().canWrite()) {
572 bool ok =
yarp().write(helper, helper);
578 return helper.reply.return_helper;
584 bool showAll = (functionName ==
"--all");
585 std::vector<std::string> helpString;
587 helpString.emplace_back(
"*** Available commands:");
590 helpString.emplace_back(
"help");
598 if (functionName ==
"help") {
599 helpString.emplace_back(
"std::vector<std::string> help(const std::string& functionName = \"--all\")");
600 helpString.emplace_back(
"Return list of available commands, or help message for a specific function");
601 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");
602 helpString.emplace_back(
"@return list of strings (one string per line)");
605 if (helpString.empty()) {
606 helpString.emplace_back(
"Command not found");
614 constexpr size_t max_tag_len = 1;
624 std::string tag = reader.
readTag(1);
625 bool direct = (tag ==
"__direct__");
629 while (tag_len <= max_tag_len && !reader.
isError()) {
630 if(tag ==
"getRemoteProtocolVersion") {
637 auto proto = getLocalProtocolVersion();
643 if (!writer.
write(proto)) {
681 std::string functionName;
683 functionName =
"--all";
685 auto help_strings = help(functionName);
691 if (!writer.
writeTag(
"many", 1, 0)) {
697 for (
const auto& help_string : help_strings) {
713 std::string next_tag = reader.
readTag(1);
714 if (next_tag.empty()) {
717 tag.append(
"_").append(next_tag);
718 tag_len = std::count(tag.begin(), tag.end(),
'_') + 1;
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool readArgs(yarp::os::idl::WireReader &reader)
~Command() override=default
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
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
~Reply() 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.
yarp::dev::ReturnValue return_helper
INavigation2DVelocityActionsMsgs_applyVelocityCommandRPC_helper()=default
static constexpr size_t s_reply_len
static constexpr size_t s_tag_len
void call(INavigation2DVelocityActionsMsgs *ptr)
static constexpr const char * s_tag
static constexpr const char * s_prototype
static constexpr size_t s_cmd_len
static constexpr const char * s_help
yarp::dev::ReturnValue(*)(const double, const double, const double, const double) 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.
bool readTag(yarp::os::idl::WireReader &reader)
bool readArgs(yarp::os::idl::WireReader &reader)
~Command() override=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 write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
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.
return_getLastVelocityCommand return_helper
~Reply() override=default
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
void call(INavigation2DVelocityActionsMsgs *ptr)
static constexpr const char * s_prototype
static constexpr const char * s_tag
return_getLastVelocityCommand(*)() funcptr_t
INavigation2DVelocityActionsMsgs_getLastVelocityCommandRPC_helper()=default
static constexpr size_t s_reply_len
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.
yarp::os::ApplicationNetworkProtocolVersion helper_proto
INavigation2DVelocityActionsMsgs_getRemoteProtocolVersion_helper()=default
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
INavigation2DVelocityActionsMsgs()
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")
virtual yarp::os::ApplicationNetworkProtocolVersion getRemoteProtocolVersion()
virtual yarp::os::ApplicationNetworkProtocolVersion getLocalProtocolVersion()
virtual bool checkProtocolVersion()
virtual yarp::dev::ReturnValue applyVelocityCommandRPC(const double x_vel, const double y_vel, const double theta_vel, const double timeout)
virtual return_getLastVelocityCommand getLastVelocityCommandRPC()
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 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