43 if (!writer.
writeString(
"getRemoteProtocolVersion")) {
57 if (!helper_proto.read(connection)) {
67 if(!
yarp().canWrite()) {
68 yError(
" Missing server method MobileBaseVelocityControlRPC::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();
166 static constexpr const char*
s_tag{
"applyVelocityCommandRPC"};
170 static constexpr const char*
s_prototype{
"yarp::dev::ReturnValue MobileBaseVelocityControlRPC::applyVelocityCommandRPC(const double x_vel, const double y_vel, const double theta_vel, const double timeout)"};
224 static constexpr const char*
s_tag{
"getLastVelocityCommandRPC"};
228 static constexpr const char*
s_prototype{
"return_getLastVelocityCommand MobileBaseVelocityControlRPC::getLastVelocityCommandRPC()"};
234 cmd{x_vel, y_vel, theta_vel, timeout}
251 theta_vel{theta_vel},
262 return write(writer);
277 if (!writeTag(writer)) {
280 if (!writeArgs(writer)) {
313 if (!readTag(reader)) {
316 if (!readArgs(reader)) {
379 return write(writer);
391 if (!writer.
write(return_helper)) {
404 if (!reader.
read(return_helper)) {
433 return write(writer);
448 if (!writeTag(writer)) {
451 if (!writeArgs(writer)) {
472 if (!readTag(reader)) {
475 if (!readArgs(reader)) {
506 return write(writer);
521 if (!writer.
write(return_helper)) {
537 if (!reader.
read(return_helper)) {
552 yarp().setOwner(*
this);
557 if (!
yarp().canWrite()) {
561 bool ok =
yarp().write(helper, helper);
567 if (!
yarp().canWrite()) {
571 bool ok =
yarp().write(helper, helper);
578 bool showAll = (functionName ==
"--all");
579 std::vector<std::string> helpString;
581 helpString.emplace_back(
"*** Available commands:");
584 helpString.emplace_back(
"help");
592 if (functionName ==
"help") {
593 helpString.emplace_back(
"std::vector<std::string> help(const std::string& functionName = \"--all\")");
594 helpString.emplace_back(
"Return list of available commands, or help message for a specific function");
595 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");
596 helpString.emplace_back(
"@return list of strings (one string per line)");
599 if (helpString.empty()) {
600 helpString.emplace_back(
"Command not found");
608 constexpr size_t max_tag_len = 1;
618 std::string tag = reader.
readTag(1);
619 bool direct = (tag ==
"__direct__");
623 while (tag_len <= max_tag_len && !reader.
isError()) {
624 if(tag ==
"getRemoteProtocolVersion") {
631 auto proto = getLocalProtocolVersion();
637 if (!writer.
write(proto)) {
675 std::string functionName;
677 functionName =
"--all";
679 auto help_strings = help(functionName);
685 if (!writer.
writeTag(
"many", 1, 0)) {
691 for (
const auto& help_string : help_strings) {
707 std::string next_tag = reader.
readTag(1);
708 if (next_tag.empty()) {
711 tag.append(
"_").append(next_tag);
712 tag_len = std::count(tag.begin(), tag.end(),
'_') + 1;
bool readArgs(yarp::os::idl::WireReader &reader)
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.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from 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.
yarp::dev::ReturnValue 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.
yarp::dev::ReturnValue(*)(const double, const double, const double, const double) funcptr_t
static constexpr const char * s_prototype
static constexpr size_t s_cmd_len
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
void call(MobileBaseVelocityControlRPC *ptr)
static constexpr size_t s_tag_len
MobileBaseVelocityControlRPC_applyVelocityCommandRPC_helper()=default
static constexpr const char * s_help
static constexpr const char * s_tag
static constexpr size_t s_reply_len
bool writeTag(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
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool readArgs(yarp::os::idl::WireReader &reader)
bool writeArgs(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 write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
~Reply() override=default
return_getLastVelocityCommand return_helper
void call(MobileBaseVelocityControlRPC *ptr)
static constexpr const char * s_help
static constexpr size_t s_reply_len
static constexpr size_t s_cmd_len
MobileBaseVelocityControlRPC_getLastVelocityCommandRPC_helper()=default
static constexpr size_t s_tag_len
static constexpr const char * s_prototype
static constexpr const char * s_tag
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
return_getLastVelocityCommand(*)() funcptr_t
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
yarp::os::ApplicationNetworkProtocolVersion helper_proto
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
MobileBaseVelocityControlRPC_getRemoteProtocolVersion_helper()=default
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
virtual std::vector< std::string > help(const std::string &functionName="--all")
MobileBaseVelocityControlRPC()
virtual yarp::dev::ReturnValue applyVelocityCommandRPC(const double x_vel, const double y_vel, const double theta_vel, const double timeout)
virtual bool checkProtocolVersion()
virtual yarp::os::ApplicationNetworkProtocolVersion getLocalProtocolVersion()
virtual yarp::os::ApplicationNetworkProtocolVersion getRemoteProtocolVersion()
virtual return_getLastVelocityCommand getLastVelocityCommandRPC()
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
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