44 if (!writer.
writeString(
"getRemoteProtocolVersion")) {
58 if (!helper_proto.read(connection)) {
68 if(!
yarp().canWrite()) {
69 yError(
" Missing server method IAudioGrabberMsgs::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{
"setHWGain_RPC"};
168 static constexpr const char*
s_prototype{
"yarp::dev::ReturnValue IAudioGrabberMsgs::setHWGain_RPC(const double gain)"};
227 static constexpr const char*
s_tag{
"setSWGain_RPC"};
231 static constexpr const char*
s_prototype{
"yarp::dev::ReturnValue IAudioGrabberMsgs::setSWGain_RPC(const double gain)"};
285 static constexpr const char*
s_tag{
"resetRecordingAudioBuffer_RPC"};
289 static constexpr const char*
s_prototype{
"yarp::dev::ReturnValue IAudioGrabberMsgs::resetRecordingAudioBuffer_RPC()"};
343 static constexpr const char*
s_tag{
"startRecording_RPC"};
347 static constexpr const char*
s_prototype{
"yarp::dev::ReturnValue IAudioGrabberMsgs::startRecording_RPC()"};
401 static constexpr const char*
s_tag{
"stopRecording_RPC"};
405 static constexpr const char*
s_prototype{
"yarp::dev::ReturnValue IAudioGrabberMsgs::stopRecording_RPC()"};
459 static constexpr const char*
s_tag{
"isRecording_RPC"};
463 static constexpr const char*
s_prototype{
"return_isRecording IAudioGrabberMsgs::isRecording_RPC()"};
524 static constexpr const char*
s_tag{
"getSound_RPC"};
528 static constexpr const char*
s_prototype{
"return_getSound IAudioGrabberMsgs::getSound_RPC(const size_t min_number_of_samples, const size_t max_number_of_samples, const double max_samples_timeout_s)"};
582 static constexpr const char*
s_tag{
"getRecordingAudioBufferMaxSize_RPC"};
586 static constexpr const char*
s_prototype{
"return_getRecordingAudioBufferMaxSize IAudioGrabberMsgs::getRecordingAudioBufferMaxSize_RPC()"};
640 static constexpr const char*
s_tag{
"getRecordingAudioBufferCurrentSize_RPC"};
644 static constexpr const char*
s_prototype{
"return_getRecordingAudioBufferCurrentSize IAudioGrabberMsgs::getRecordingAudioBufferCurrentSize_RPC()"};
675 return write(writer);
690 if (!writeTag(writer)) {
693 if (!writeArgs(writer)) {
717 if (!readTag(reader)) {
720 if (!readArgs(reader)) {
759 return write(writer);
771 if (!writer.
write(return_helper)) {
784 if (!reader.
read(return_helper)) {
823 return write(writer);
838 if (!writeTag(writer)) {
841 if (!writeArgs(writer)) {
865 if (!readTag(reader)) {
868 if (!readArgs(reader)) {
907 return write(writer);
919 if (!writer.
write(return_helper)) {
932 if (!reader.
read(return_helper)) {
961 return write(writer);
976 if (!writeTag(writer)) {
979 if (!writeArgs(writer)) {
1000 if (!readTag(reader)) {
1003 if (!readArgs(reader)) {
1034 return write(writer);
1040 return read(reader);
1046 if (!writer.
write(return_helper)) {
1059 if (!reader.
read(return_helper)) {
1088 return write(writer);
1098 return read(reader);
1103 if (!writeTag(writer)) {
1106 if (!writeArgs(writer)) {
1127 if (!readTag(reader)) {
1130 if (!readArgs(reader)) {
1161 return write(writer);
1167 return read(reader);
1173 if (!writer.
write(return_helper)) {
1186 if (!reader.
read(return_helper)) {
1215 return write(writer);
1225 return read(reader);
1230 if (!writeTag(writer)) {
1233 if (!writeArgs(writer)) {
1254 if (!readTag(reader)) {
1257 if (!readArgs(reader)) {
1288 return write(writer);
1294 return read(reader);
1300 if (!writer.
write(return_helper)) {
1313 if (!reader.
read(return_helper)) {
1342 return write(writer);
1352 return read(reader);
1357 if (!writeTag(writer)) {
1360 if (!writeArgs(writer)) {
1381 if (!readTag(reader)) {
1384 if (!readArgs(reader)) {
1415 return write(writer);
1421 return read(reader);
1430 if (!writer.
write(return_helper)) {
1446 if (!reader.
read(return_helper)) {
1460 cmd{min_number_of_samples, max_number_of_samples, max_samples_timeout_s}
1475 min_number_of_samples{min_number_of_samples},
1476 max_number_of_samples{max_number_of_samples},
1477 max_samples_timeout_s{max_samples_timeout_s}
1487 return write(writer);
1497 return read(reader);
1502 if (!writeTag(writer)) {
1505 if (!writeArgs(writer)) {
1521 if (!writer.
writeSizeT(min_number_of_samples)) {
1524 if (!writer.
writeSizeT(max_number_of_samples)) {
1535 if (!readTag(reader)) {
1538 if (!readArgs(reader)) {
1563 if (!reader.
readSizeT(min_number_of_samples)) {
1571 if (!reader.
readSizeT(max_number_of_samples)) {
1593 return write(writer);
1599 return read(reader);
1608 if (!writer.
write(return_helper)) {
1624 if (!reader.
read(return_helper)) {
1653 return write(writer);
1663 return read(reader);
1668 if (!writeTag(writer)) {
1671 if (!writeArgs(writer)) {
1692 if (!readTag(reader)) {
1695 if (!readArgs(reader)) {
1726 return write(writer);
1732 return read(reader);
1741 if (!writer.
write(return_helper)) {
1757 if (!reader.
read(return_helper)) {
1786 return write(writer);
1796 return read(reader);
1801 if (!writeTag(writer)) {
1804 if (!writeArgs(writer)) {
1825 if (!readTag(reader)) {
1828 if (!readArgs(reader)) {
1859 return write(writer);
1865 return read(reader);
1874 if (!writer.
write(return_helper)) {
1890 if (!reader.
read(return_helper)) {
1905 yarp().setOwner(*
this);
1910 if (!
yarp().canWrite()) {
1914 bool ok =
yarp().write(helper, helper);
1920 if (!
yarp().canWrite()) {
1924 bool ok =
yarp().write(helper, helper);
1930 if (!
yarp().canWrite()) {
1934 bool ok =
yarp().write(helper, helper);
1940 if (!
yarp().canWrite()) {
1944 bool ok =
yarp().write(helper, helper);
1950 if (!
yarp().canWrite()) {
1954 bool ok =
yarp().write(helper, helper);
1960 if (!
yarp().canWrite()) {
1964 bool ok =
yarp().write(helper, helper);
1968 return failed_reply;
1970 return helper.reply.return_helper;
1975 if (!
yarp().canWrite()) {
1979 bool ok =
yarp().write(helper, helper);
1983 return failed_reply;
1985 return helper.reply.return_helper;
1990 if (!
yarp().canWrite()) {
1994 bool ok =
yarp().write(helper, helper);
1998 return failed_reply;
2000 return helper.reply.return_helper;
2005 if (!
yarp().canWrite()) {
2009 bool ok =
yarp().write(helper, helper);
2013 return failed_reply;
2015 return helper.reply.return_helper;
2021 bool showAll = (functionName ==
"--all");
2022 std::vector<std::string> helpString;
2024 helpString.emplace_back(
"*** Available commands:");
2034 helpString.emplace_back(
"help");
2063 if (functionName ==
"help") {
2064 helpString.emplace_back(
"std::vector<std::string> help(const std::string& functionName = \"--all\")");
2065 helpString.emplace_back(
"Return list of available commands, or help message for a specific function");
2066 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");
2067 helpString.emplace_back(
"@return list of strings (one string per line)");
2070 if (helpString.empty()) {
2071 helpString.emplace_back(
"Command not found");
2079 constexpr size_t max_tag_len = 2;
2089 std::string tag = reader.
readTag(1);
2090 bool direct = (tag ==
"__direct__");
2094 while (tag_len <= max_tag_len && !reader.
isError()) {
2095 if(tag ==
"getRemoteProtocolVersion") {
2102 auto proto = getLocalProtocolVersion();
2108 if (!writer.
write(proto)) {
2250 if (tag ==
"help") {
2251 std::string functionName;
2253 functionName =
"--all";
2255 auto help_strings = help(functionName);
2261 if (!writer.
writeTag(
"many", 1, 0)) {
2267 for (
const auto& help_string : help_strings) {
2283 std::string next_tag = reader.
readTag(1);
2284 if (next_tag.empty()) {
2287 tag.append(
"_").append(next_tag);
2288 tag_len = std::count(tag.begin(), tag.end(),
'_') + 1;
bool readTag(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 writeTag(const yarp::os::idl::WireWriter &writer) const
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
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.
return_getRecordingAudioBufferCurrentSize return_helper
~Reply() override=default
static constexpr const char * s_prototype
static constexpr const char * s_tag
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
return_getRecordingAudioBufferCurrentSize(*)() funcptr_t
IAudioGrabberMsgs_getRecordingAudioBufferCurrentSize_RPC_helper()=default
static constexpr size_t s_tag_len
void call(IAudioGrabberMsgs *ptr)
static constexpr size_t s_cmd_len
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
static constexpr size_t s_reply_len
static constexpr const char * s_help
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool readTag(yarp::os::idl::WireReader &reader)
bool readArgs(yarp::os::idl::WireReader &reader)
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.
bool writeTag(const yarp::os::idl::WireWriter &writer) const
~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.
return_getRecordingAudioBufferMaxSize return_helper
static constexpr const char * s_tag
void call(IAudioGrabberMsgs *ptr)
static constexpr const char * s_prototype
static constexpr const char * s_help
return_getRecordingAudioBufferMaxSize(*)() funcptr_t
static constexpr size_t s_tag_len
static constexpr size_t s_reply_len
IAudioGrabberMsgs_getRecordingAudioBufferMaxSize_RPC_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.
static constexpr size_t s_cmd_len
yarp::os::ApplicationNetworkProtocolVersion helper_proto
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
IAudioGrabberMsgs_getRemoteProtocolVersion_helper()=default
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
size_t max_number_of_samples
double max_samples_timeout_s
size_t min_number_of_samples
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 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 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.
return_getSound return_helper
static constexpr const char * s_tag
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
static constexpr const char * s_prototype
return_getSound(*)(const size_t, const size_t, const double) funcptr_t
static constexpr size_t s_tag_len
void call(IAudioGrabberMsgs *ptr)
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
IAudioGrabberMsgs_getSound_RPC_helper()=default
static constexpr size_t s_cmd_len
static constexpr size_t s_reply_len
static constexpr const char * s_help
~Command() override=default
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
bool writeTag(const yarp::os::idl::WireWriter &writer) const
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 read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
return_isRecording return_helper
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
~Reply() override=default
static constexpr const char * s_help
void call(IAudioGrabberMsgs *ptr)
static constexpr const char * s_tag
static constexpr const char * s_prototype
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
static constexpr size_t s_reply_len
return_isRecording(*)() funcptr_t
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
static constexpr size_t s_tag_len
static constexpr size_t s_cmd_len
IAudioGrabberMsgs_isRecording_RPC_helper()=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 readTag(yarp::os::idl::WireReader &reader)
bool writeTag(const yarp::os::idl::WireWriter &writer) const
bool readArgs(yarp::os::idl::WireReader &reader)
~Command() override=default
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to 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.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
static constexpr const char * s_help
static constexpr size_t s_cmd_len
yarp::dev::ReturnValue(*)() funcptr_t
static constexpr const char * s_tag
static constexpr size_t s_reply_len
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
void call(IAudioGrabberMsgs *ptr)
IAudioGrabberMsgs_resetRecordingAudioBuffer_RPC_helper()=default
static constexpr const char * s_prototype
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
static constexpr size_t s_tag_len
~Command() override=default
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 readArgs(yarp::os::idl::WireReader &reader)
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.
yarp::dev::ReturnValue return_helper
~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.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
static constexpr size_t s_reply_len
static constexpr size_t s_tag_len
yarp::dev::ReturnValue(*)(const double) funcptr_t
IAudioGrabberMsgs_setHWGain_RPC_helper()=default
static constexpr const char * s_help
static constexpr const char * s_prototype
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
void call(IAudioGrabberMsgs *ptr)
static constexpr size_t s_cmd_len
static constexpr const char * s_tag
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
~Command() override=default
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
bool readArgs(yarp::os::idl::WireReader &reader)
bool writeTag(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.
yarp::dev::ReturnValue return_helper
~Reply() override=default
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
yarp::dev::ReturnValue(*)(const double) funcptr_t
static constexpr size_t s_tag_len
static constexpr const char * s_help
static constexpr const char * s_prototype
static constexpr const char * s_tag
IAudioGrabberMsgs_setSWGain_RPC_helper()=default
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
void call(IAudioGrabberMsgs *ptr)
static constexpr size_t s_reply_len
static constexpr size_t s_cmd_len
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool readArgs(yarp::os::idl::WireReader &reader)
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 writeArgs(const yarp::os::idl::WireWriter &writer) const
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
~Command() override=default
bool readTag(yarp::os::idl::WireReader &reader)
~Reply() override=default
yarp::dev::ReturnValue return_helper
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 const char * s_help
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
yarp::dev::ReturnValue(*)() funcptr_t
static constexpr const char * s_tag
static constexpr size_t s_cmd_len
static constexpr const char * s_prototype
void call(IAudioGrabberMsgs *ptr)
static constexpr size_t s_reply_len
static constexpr size_t s_tag_len
IAudioGrabberMsgs_startRecording_RPC_helper()=default
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 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 write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
~Reply() override=default
yarp::dev::ReturnValue return_helper
bool read(yarp::os::ConnectionReader &connection) override
Read this object from 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_reply_len
yarp::dev::ReturnValue(*)() funcptr_t
void call(IAudioGrabberMsgs *ptr)
static constexpr const char * s_prototype
static constexpr size_t s_cmd_len
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
static constexpr size_t s_tag_len
IAudioGrabberMsgs_stopRecording_RPC_helper()=default
virtual return_isRecording isRecording_RPC()
virtual yarp::dev::ReturnValue setHWGain_RPC(const double gain)
virtual return_getRecordingAudioBufferMaxSize getRecordingAudioBufferMaxSize_RPC()
virtual std::vector< std::string > help(const std::string &functionName="--all")
virtual return_getRecordingAudioBufferCurrentSize getRecordingAudioBufferCurrentSize_RPC()
virtual bool checkProtocolVersion()
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
virtual yarp::os::ApplicationNetworkProtocolVersion getLocalProtocolVersion()
virtual return_getSound getSound_RPC(const size_t min_number_of_samples, const size_t max_number_of_samples, const double max_samples_timeout_s)
virtual yarp::dev::ReturnValue startRecording_RPC()
virtual yarp::dev::ReturnValue setSWGain_RPC(const double gain)
virtual yarp::os::ApplicationNetworkProtocolVersion getRemoteProtocolVersion()
virtual yarp::dev::ReturnValue resetRecordingAudioBuffer_RPC()
virtual yarp::dev::ReturnValue stopRecording_RPC()
yarp::dev::ReturnValue ret
yarp::dev::ReturnValue ret
yarp::dev::ReturnValue ret
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 readSizeT(std::size_t &x)
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
bool writeSizeT(std::size_t x, bool skip_tag=false) 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