43 if (!writer.
writeString(
"getRemoteProtocolVersion")) {
57 if (!helper_proto.read(connection)) {
67 if(!
yarp().canWrite()) {
68 yError(
" Missing server method IAudioGrabberMsgs::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();
163 static constexpr const char*
s_tag{
"setHWGain_RPC"};
167 static constexpr const char*
s_prototype{
"yarp::dev::ReturnValue IAudioGrabberMsgs::setHWGain_RPC(const double gain)"};
226 static constexpr const char*
s_tag{
"setSWGain_RPC"};
230 static constexpr const char*
s_prototype{
"yarp::dev::ReturnValue IAudioGrabberMsgs::setSWGain_RPC(const double gain)"};
284 static constexpr const char*
s_tag{
"resetRecordingAudioBuffer_RPC"};
288 static constexpr const char*
s_prototype{
"yarp::dev::ReturnValue IAudioGrabberMsgs::resetRecordingAudioBuffer_RPC()"};
342 static constexpr const char*
s_tag{
"startRecording_RPC"};
346 static constexpr const char*
s_prototype{
"yarp::dev::ReturnValue IAudioGrabberMsgs::startRecording_RPC()"};
400 static constexpr const char*
s_tag{
"stopRecording_RPC"};
404 static constexpr const char*
s_prototype{
"yarp::dev::ReturnValue IAudioGrabberMsgs::stopRecording_RPC()"};
458 static constexpr const char*
s_tag{
"isRecording_RPC"};
462 static constexpr const char*
s_prototype{
"return_isRecording IAudioGrabberMsgs::isRecording_RPC()"};
523 static constexpr const char*
s_tag{
"getSound_RPC"};
527 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)"};
581 static constexpr const char*
s_tag{
"getRecordingAudioBufferMaxSize_RPC"};
585 static constexpr const char*
s_prototype{
"return_getRecordingAudioBufferMaxSize IAudioGrabberMsgs::getRecordingAudioBufferMaxSize_RPC()"};
639 static constexpr const char*
s_tag{
"getRecordingAudioBufferCurrentSize_RPC"};
643 static constexpr const char*
s_prototype{
"return_getRecordingAudioBufferCurrentSize IAudioGrabberMsgs::getRecordingAudioBufferCurrentSize_RPC()"};
674 return write(writer);
689 if (!writeTag(writer)) {
692 if (!writeArgs(writer)) {
716 if (!readTag(reader)) {
719 if (!readArgs(reader)) {
758 return write(writer);
770 if (!writer.
write(return_helper)) {
783 if (!reader.
read(return_helper)) {
822 return write(writer);
837 if (!writeTag(writer)) {
840 if (!writeArgs(writer)) {
864 if (!readTag(reader)) {
867 if (!readArgs(reader)) {
906 return write(writer);
918 if (!writer.
write(return_helper)) {
931 if (!reader.
read(return_helper)) {
960 return write(writer);
975 if (!writeTag(writer)) {
978 if (!writeArgs(writer)) {
999 if (!readTag(reader)) {
1002 if (!readArgs(reader)) {
1033 return write(writer);
1039 return read(reader);
1045 if (!writer.
write(return_helper)) {
1058 if (!reader.
read(return_helper)) {
1087 return write(writer);
1097 return read(reader);
1102 if (!writeTag(writer)) {
1105 if (!writeArgs(writer)) {
1126 if (!readTag(reader)) {
1129 if (!readArgs(reader)) {
1160 return write(writer);
1166 return read(reader);
1172 if (!writer.
write(return_helper)) {
1185 if (!reader.
read(return_helper)) {
1214 return write(writer);
1224 return read(reader);
1229 if (!writeTag(writer)) {
1232 if (!writeArgs(writer)) {
1253 if (!readTag(reader)) {
1256 if (!readArgs(reader)) {
1287 return write(writer);
1293 return read(reader);
1299 if (!writer.
write(return_helper)) {
1312 if (!reader.
read(return_helper)) {
1341 return write(writer);
1351 return read(reader);
1356 if (!writeTag(writer)) {
1359 if (!writeArgs(writer)) {
1380 if (!readTag(reader)) {
1383 if (!readArgs(reader)) {
1414 return write(writer);
1420 return read(reader);
1429 if (!writer.
write(return_helper)) {
1445 if (!reader.
read(return_helper)) {
1459 cmd{min_number_of_samples, max_number_of_samples, max_samples_timeout_s}
1474 min_number_of_samples{min_number_of_samples},
1475 max_number_of_samples{max_number_of_samples},
1476 max_samples_timeout_s{max_samples_timeout_s}
1486 return write(writer);
1496 return read(reader);
1501 if (!writeTag(writer)) {
1504 if (!writeArgs(writer)) {
1520 if (!writer.
writeSizeT(min_number_of_samples)) {
1523 if (!writer.
writeSizeT(max_number_of_samples)) {
1534 if (!readTag(reader)) {
1537 if (!readArgs(reader)) {
1562 if (!reader.
readSizeT(min_number_of_samples)) {
1570 if (!reader.
readSizeT(max_number_of_samples)) {
1592 return write(writer);
1598 return read(reader);
1607 if (!writer.
write(return_helper)) {
1623 if (!reader.
read(return_helper)) {
1652 return write(writer);
1662 return read(reader);
1667 if (!writeTag(writer)) {
1670 if (!writeArgs(writer)) {
1691 if (!readTag(reader)) {
1694 if (!readArgs(reader)) {
1725 return write(writer);
1731 return read(reader);
1740 if (!writer.
write(return_helper)) {
1756 if (!reader.
read(return_helper)) {
1785 return write(writer);
1795 return read(reader);
1800 if (!writeTag(writer)) {
1803 if (!writeArgs(writer)) {
1824 if (!readTag(reader)) {
1827 if (!readArgs(reader)) {
1858 return write(writer);
1864 return read(reader);
1873 if (!writer.
write(return_helper)) {
1889 if (!reader.
read(return_helper)) {
1904 yarp().setOwner(*
this);
1909 if (!
yarp().canWrite()) {
1913 bool ok =
yarp().write(helper, helper);
1919 if (!
yarp().canWrite()) {
1923 bool ok =
yarp().write(helper, helper);
1929 if (!
yarp().canWrite()) {
1933 bool ok =
yarp().write(helper, helper);
1939 if (!
yarp().canWrite()) {
1943 bool ok =
yarp().write(helper, helper);
1949 if (!
yarp().canWrite()) {
1953 bool ok =
yarp().write(helper, helper);
1959 if (!
yarp().canWrite()) {
1963 bool ok =
yarp().write(helper, helper);
1969 if (!
yarp().canWrite()) {
1973 bool ok =
yarp().write(helper, helper);
1979 if (!
yarp().canWrite()) {
1983 bool ok =
yarp().write(helper, helper);
1989 if (!
yarp().canWrite()) {
1993 bool ok =
yarp().write(helper, helper);
2000 bool showAll = (functionName ==
"--all");
2001 std::vector<std::string> helpString;
2003 helpString.emplace_back(
"*** Available commands:");
2013 helpString.emplace_back(
"help");
2042 if (functionName ==
"help") {
2043 helpString.emplace_back(
"std::vector<std::string> help(const std::string& functionName = \"--all\")");
2044 helpString.emplace_back(
"Return list of available commands, or help message for a specific function");
2045 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");
2046 helpString.emplace_back(
"@return list of strings (one string per line)");
2049 if (helpString.empty()) {
2050 helpString.emplace_back(
"Command not found");
2058 constexpr size_t max_tag_len = 2;
2068 std::string tag = reader.
readTag(1);
2069 bool direct = (tag ==
"__direct__");
2073 while (tag_len <= max_tag_len && !reader.
isError()) {
2074 if(tag ==
"getRemoteProtocolVersion") {
2081 auto proto = getLocalProtocolVersion();
2087 if (!writer.
write(proto)) {
2229 if (tag ==
"help") {
2230 std::string functionName;
2232 functionName =
"--all";
2234 auto help_strings = help(functionName);
2240 if (!writer.
writeTag(
"many", 1, 0)) {
2246 for (
const auto& help_string : help_strings) {
2262 std::string next_tag = reader.
readTag(1);
2263 if (next_tag.empty()) {
2266 tag.append(
"_").append(next_tag);
2267 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()
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