44 if (!writer.
writeString(
"getRemoteProtocolVersion")) {
58 if (!helper_proto.read(connection)) {
68 if(!
yarp().canWrite()) {
69 yError(
" Missing server method IChatBotMsgs::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();
164 static constexpr const char*
s_tag{
"interactRPC"};
168 static constexpr const char*
s_prototype{
"return_interact IChatBotMsgs::interactRPC(const std::string& messageIn)"};
227 static constexpr const char*
s_tag{
"setLanguageRPC"};
231 static constexpr const char*
s_prototype{
"yarp::dev::ReturnValue IChatBotMsgs::setLanguageRPC(const std::string& language)"};
285 static constexpr const char*
s_tag{
"getLanguageRPC"};
289 static constexpr const char*
s_prototype{
"return_getLanguage IChatBotMsgs::getLanguageRPC()"};
343 static constexpr const char*
s_tag{
"getStatusRPC"};
347 static constexpr const char*
s_prototype{
"return_getStatus IChatBotMsgs::getStatusRPC()"};
401 static constexpr const char*
s_tag{
"resetBotRPC"};
405 static constexpr const char*
s_prototype{
"yarp::dev::ReturnValue IChatBotMsgs::resetBotRPC()"};
436 return write(writer);
451 if (!writeTag(writer)) {
454 if (!writeArgs(writer)) {
478 if (!readTag(reader)) {
481 if (!readArgs(reader)) {
520 return write(writer);
535 if (!writer.
write(return_helper)) {
551 if (!reader.
read(return_helper)) {
590 return write(writer);
605 if (!writeTag(writer)) {
608 if (!writeArgs(writer)) {
632 if (!readTag(reader)) {
635 if (!readArgs(reader)) {
674 return write(writer);
686 if (!writer.
write(return_helper)) {
699 if (!reader.
read(return_helper)) {
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);
1079 if (!writer.
write(return_helper)) {
1092 if (!reader.
read(return_helper)) {
1107 yarp().setOwner(*
this);
1112 if (!
yarp().canWrite()) {
1116 bool ok =
yarp().write(helper, helper);
1120 return failed_reply;
1122 return helper.reply.return_helper;
1127 if (!
yarp().canWrite()) {
1131 bool ok =
yarp().write(helper, helper);
1137 if (!
yarp().canWrite()) {
1141 bool ok =
yarp().write(helper, helper);
1145 return failed_reply;
1147 return helper.reply.return_helper;
1152 if (!
yarp().canWrite()) {
1156 bool ok =
yarp().write(helper, helper);
1160 return failed_reply;
1162 return helper.reply.return_helper;
1167 if (!
yarp().canWrite()) {
1171 bool ok =
yarp().write(helper, helper);
1178 bool showAll = (functionName ==
"--all");
1179 std::vector<std::string> helpString;
1181 helpString.emplace_back(
"*** Available commands:");
1187 helpString.emplace_back(
"help");
1204 if (functionName ==
"help") {
1205 helpString.emplace_back(
"std::vector<std::string> help(const std::string& functionName = \"--all\")");
1206 helpString.emplace_back(
"Return list of available commands, or help message for a specific function");
1207 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");
1208 helpString.emplace_back(
"@return list of strings (one string per line)");
1211 if (helpString.empty()) {
1212 helpString.emplace_back(
"Command not found");
1220 constexpr size_t max_tag_len = 1;
1230 std::string tag = reader.
readTag(1);
1231 bool direct = (tag ==
"__direct__");
1235 while (tag_len <= max_tag_len && !reader.
isError()) {
1236 if(tag ==
"getRemoteProtocolVersion") {
1243 auto proto = getLocalProtocolVersion();
1249 if (!writer.
write(proto)) {
1331 if (tag ==
"help") {
1332 std::string functionName;
1334 functionName =
"--all";
1336 auto help_strings = help(functionName);
1342 if (!writer.
writeTag(
"many", 1, 0)) {
1348 for (
const auto& help_string : help_strings) {
1364 std::string next_tag = reader.
readTag(1);
1365 if (next_tag.empty()) {
1368 tag.append(
"_").append(next_tag);
1369 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
~Command() override=default
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool readTag(yarp::os::idl::WireReader &reader)
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
return_getLanguage return_helper
~Reply() override=default
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
void call(IChatBotMsgs *ptr)
static constexpr const char * s_prototype
static constexpr size_t s_reply_len
static constexpr size_t s_cmd_len
IChatBotMsgs_getLanguageRPC_helper()=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.
return_getLanguage(*)() funcptr_t
static constexpr size_t s_tag_len
yarp::os::ApplicationNetworkProtocolVersion helper_proto
IChatBotMsgs_getRemoteProtocolVersion_helper()=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.
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 write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
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 write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
return_getStatus return_helper
~Reply() override=default
static constexpr const char * s_help
return_getStatus(*)() funcptr_t
static constexpr const char * s_tag
static constexpr size_t s_reply_len
static constexpr size_t s_cmd_len
IChatBotMsgs_getStatusRPC_helper()=default
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
void call(IChatBotMsgs *ptr)
static constexpr const char * s_prototype
static constexpr size_t s_tag_len
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
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.
~Command() override=default
bool readArgs(yarp::os::idl::WireReader &reader)
bool readTag(yarp::os::idl::WireReader &reader)
return_interact return_helper
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.
static constexpr size_t s_reply_len
IChatBotMsgs_interactRPC_helper()=default
static constexpr const char * s_prototype
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
static constexpr const char * s_tag
static constexpr const char * s_help
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_tag_len
return_interact(*)(const std::string &) funcptr_t
void call(IChatBotMsgs *ptr)
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 readArgs(yarp::os::idl::WireReader &reader)
bool writeTag(const yarp::os::idl::WireWriter &writer) const
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
~Command() override=default
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
yarp::dev::ReturnValue return_helper
~Reply() override=default
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
IChatBotMsgs_resetBotRPC_helper()=default
static constexpr const char * s_tag
static constexpr const char * s_help
static constexpr const char * s_prototype
void call(IChatBotMsgs *ptr)
static constexpr size_t s_tag_len
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_reply_len
static constexpr size_t s_cmd_len
yarp::dev::ReturnValue(*)() funcptr_t
bool readArgs(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.
~Command() override=default
bool readTag(yarp::os::idl::WireReader &reader)
bool writeTag(const yarp::os::idl::WireWriter &writer) const
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
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
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
static constexpr const char * s_prototype
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_tag
static constexpr size_t s_cmd_len
IChatBotMsgs_setLanguageRPC_helper()=default
void call(IChatBotMsgs *ptr)
static constexpr const char * s_help
yarp::dev::ReturnValue(*)(const std::string &) funcptr_t
static constexpr size_t s_tag_len
virtual yarp::os::ApplicationNetworkProtocolVersion getLocalProtocolVersion()
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
virtual bool checkProtocolVersion()
virtual yarp::dev::ReturnValue resetBotRPC()
virtual yarp::dev::ReturnValue setLanguageRPC(const std::string &language)
virtual yarp::os::ApplicationNetworkProtocolVersion getRemoteProtocolVersion()
virtual std::vector< std::string > help(const std::string &functionName="--all")
virtual return_getStatus getStatusRPC()
virtual return_interact interactRPC(const std::string &messageIn)
virtual return_getLanguage getLanguageRPC()
yarp::dev::ReturnValue result
yarp::dev::ReturnValue result
yarp::dev::ReturnValue result
@ 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