11#include <yarp/conf/version.h>
13#include <yarp/os/LogComponent.h>
14#include <yarp/os/LogStream.h>
16#include <yarp/os/idl/WireTypes.h>
22 YARP_LOG_COMPONENT(SERVICE_LOG_COMPONENT,
"RawValuesPublisherMetadata")
29public yarp::os::Portable
33 bool write(yarp::os::ConnectionWriter& connection)
const override;
34 bool read(yarp::os::ConnectionReader& connection)
override;
41 yarp::os::idl::WireWriter writer(connection);
42 if (!writer.writeListHeader(1)) {
45 if (!writer.writeString(
"getRemoteProtocolVersion")) {
51bool RawValuesPublisherMetadata_getRemoteProtocolVersion_helper ::read(yarp::os::ConnectionReader & connection)
53 yarp::os::idl::WireReader reader(connection);
54 if (!reader.readListHeader()) {
69 if(!
yarp().canWrite()) {
70 yError(
" Missing server method RawValuesPublisherMetadata::getRemoteProtocolVersion");
73 bool ok =
yarp().write(helper, helper);
77 yarp::os::ApplicationNetworkProtocolVersion failureproto;
86 if (remproto.protocol_version != locproto.protocol_version)
88 yCError(SERVICE_LOG_COMPONENT) <<
"Invalid communication protocol.";
89 yCError(SERVICE_LOG_COMPONENT) <<
"Local Protocol Version: " << locproto.toString();
90 yCError(SERVICE_LOG_COMPONENT) <<
"Remote Protocol Version: " << remproto.toString();
99 yarp::os::ApplicationNetworkProtocolVersion myproto;
103 myproto.protocol_version = 0;
104 myproto.yarp_major = YARP_VERSION_MAJOR;
105 myproto.yarp_minor = YARP_VERSION_MINOR;
106 myproto.yarp_patch = YARP_VERSION_PATCH;
112 public yarp::os::Portable
116 bool write(yarp::os::ConnectionWriter& connection)
const override;
117 bool read(yarp::os::ConnectionReader& connection)
override;
120 public yarp::os::idl::WirePortable
126 bool write(yarp::os::ConnectionWriter& connection)
const override;
127 bool read(yarp::os::ConnectionReader& connection)
override;
129 bool write(
const yarp::os::idl::WireWriter& writer)
const override;
130 bool writeTag(
const yarp::os::idl::WireWriter& writer)
const;
131 bool writeArgs(
const yarp::os::idl::WireWriter& writer)
const;
133 bool read(yarp::os::idl::WireReader& reader)
override;
134 bool readTag(yarp::os::idl::WireReader& reader);
135 bool readArgs(yarp::os::idl::WireReader& reader);
139 public yarp::os::idl::WirePortable
145 bool write(yarp::os::ConnectionWriter& connection)
const override;
146 bool read(yarp::os::ConnectionReader& connection)
override;
148 bool write(
const yarp::os::idl::WireWriter& writer)
const override;
149 bool read(yarp::os::idl::WireReader& reader)
override;
160 static constexpr const char*
s_tag{
"getMetadata"};
164 static constexpr const char*
s_prototype{
"rawValuesKeyMetadataMap RawValuesPublisherMetadata::getMetadata()"};
166 "Read the rawvalues metadata necessary to configure the RawValuesPublisherClient device."
173 return cmd.write(connection);
178 return reply.read(connection);
183 yarp::os::idl::WireWriter writer(connection);
184 if (!writer.writeListHeader(
s_cmd_len)) {
187 return write(writer);
192 yarp::os::idl::WireReader reader(connection);
193 if (!reader.readListHeader()) {
237 std::string tag = reader.readTag(
s_tag_len);
238 if (reader.isError()) {
250 if (!reader.noMore()) {
259 yarp::os::idl::WireWriter writer(connection);
260 return write(writer);
265 yarp::os::idl::WireReader reader(connection);
271 if (!writer.isNull()) {
284 if (!reader.readListReturn()) {
287 if (reader.noMore()) {
306 yarp().setOwner(*
this);
311 if (!
yarp().canWrite()) {
315 bool ok =
yarp().write(helper, helper);
322 bool showAll = (functionName ==
"--all");
323 std::vector<std::string> helpString;
325 helpString.emplace_back(
"*** Available commands:");
327 helpString.emplace_back(
"help");
333 if (functionName ==
"help") {
334 helpString.emplace_back(
"std::vector<std::string> help(const std::string& functionName = \"--all\")");
335 helpString.emplace_back(
"Return list of available commands, or help message for a specific function");
336 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");
337 helpString.emplace_back(
"@return list of strings (one string per line)");
340 if (helpString.empty()) {
341 helpString.emplace_back(
"Command not found");
349 constexpr size_t max_tag_len = 1;
352 yarp::os::idl::WireReader reader(connection);
353 reader.expectAccept();
354 if (!reader.readListHeader()) {
359 std::string tag = reader.readTag(1);
360 bool direct = (tag ==
"__direct__");
362 tag = reader.readTag(1);
364 while (tag_len <= max_tag_len && !reader.isError()) {
365 if(tag ==
"getRemoteProtocolVersion") {
366 if (!reader.noMore()) {
367 yError(
"Reader invalid protocol?! %s:%d - %s", __FILE__, __LINE__, __YFUNCTION__);
374 yarp::os::idl::WireWriter writer(reader);
375 if (!writer.writeListHeader(1)) {
376 yWarning(
"Writer invalid protocol?! %s:%d - %s", __FILE__, __LINE__, __YFUNCTION__);
378 if (!writer.write(proto)) {
379 yWarning(
"Writer invalid protocol?! %s:%d - %s", __FILE__, __LINE__, __YFUNCTION__);
393 yarp::os::idl::WireWriter writer(reader);
401 std::string functionName;
402 if (!reader.readString(functionName)) {
403 functionName =
"--all";
405 auto help_strings =
help(functionName);
406 yarp::os::idl::WireWriter writer(reader);
407 if (!writer.isNull()) {
408 if (!writer.writeListHeader(2)) {
411 if (!writer.writeTag(
"many", 1, 0)) {
414 if (!writer.writeListBegin(0, help_strings.size())) {
417 for (
const auto& help_string : help_strings) {
418 if (!writer.writeString(help_string)) {
422 if (!writer.writeListEnd()) {
429 if (reader.noMore()) {
433 std::string next_tag = reader.readTag(1);
434 if (next_tag.empty()) {
437 tag.append(
"_").append(next_tag);
438 tag_len = std::count(tag.begin(), tag.end(),
'_') + 1;
This file contains the definition of unique IDs for the body parts and the skin parts of the robot.
Copyright (C) 2008 RobotCub Consortium.