19 YARP_LOG_COMPONENT(AudioRecorder_nws_yarpParamsCOMPONENT,
"yarp.device.AudioRecorder_nws_yarp")
30 std::vector<std::string> params;
31 params.push_back(
"name");
32 params.push_back(
"period");
33 params.push_back(
"debug");
34 params.push_back(
"min_samples_over_network");
35 params.push_back(
"max_samples_over_network");
36 params.push_back(
"max_samples_timeout");
37 params.push_back(
"start");
38 params.push_back(
"send_sound_on_stop");
45 if (paramName ==
"name")
50 if (paramName ==
"period")
52 paramValue = std::to_string(
m_period);
55 if (paramName ==
"debug")
57 if (
m_debug==
true) paramValue =
"true";
58 else paramValue =
"false";
61 if (paramName ==
"min_samples_over_network")
66 if (paramName ==
"max_samples_over_network")
71 if (paramName ==
"max_samples_timeout")
76 if (paramName ==
"start")
78 if (
m_start==
true) paramValue =
"true";
79 else paramValue =
"false";
82 if (paramName ==
"send_sound_on_stop")
85 else paramValue =
"false";
89 yError() <<
"parameter '" << paramName <<
"' was not found";
108 if (config.
check(
"help"))
117 if (config.
check(
"name"))
120 yCInfo(AudioRecorder_nws_yarpParamsCOMPONENT) <<
"Parameter 'name' using value:" <<
m_name;
124 yCInfo(AudioRecorder_nws_yarpParamsCOMPONENT) <<
"Parameter 'name' using DEFAULT value:" <<
m_name;
126 prop_check.
unput(
"name");
131 if (config.
check(
"period"))
134 yCInfo(AudioRecorder_nws_yarpParamsCOMPONENT) <<
"Parameter 'period' using value:" <<
m_period;
138 yCInfo(AudioRecorder_nws_yarpParamsCOMPONENT) <<
"Parameter 'period' using DEFAULT value:" <<
m_period;
140 prop_check.
unput(
"period");
145 if (config.
check(
"debug"))
148 yCInfo(AudioRecorder_nws_yarpParamsCOMPONENT) <<
"Parameter 'debug' using value:" <<
m_debug;
152 yCInfo(AudioRecorder_nws_yarpParamsCOMPONENT) <<
"Parameter 'debug' using DEFAULT value:" <<
m_debug;
154 prop_check.
unput(
"debug");
159 if (config.
check(
"min_samples_over_network"))
168 prop_check.
unput(
"min_samples_over_network");
173 if (config.
check(
"max_samples_over_network"))
182 prop_check.
unput(
"max_samples_over_network");
187 if (config.
check(
"max_samples_timeout"))
190 yCInfo(AudioRecorder_nws_yarpParamsCOMPONENT) <<
"Parameter 'max_samples_timeout' using value:" <<
m_getSound_timeout;
194 yCInfo(AudioRecorder_nws_yarpParamsCOMPONENT) <<
"Parameter 'max_samples_timeout' using DEFAULT value:" <<
m_getSound_timeout;
196 prop_check.
unput(
"max_samples_timeout");
201 if (config.
check(
"start"))
204 yCInfo(AudioRecorder_nws_yarpParamsCOMPONENT) <<
"Parameter 'start' using value:" <<
m_start;
208 yCInfo(AudioRecorder_nws_yarpParamsCOMPONENT) <<
"Parameter 'start' using DEFAULT value:" <<
m_start;
210 prop_check.
unput(
"start");
215 if (config.
check(
"send_sound_on_stop"))
222 yCInfo(AudioRecorder_nws_yarpParamsCOMPONENT) <<
"Parameter 'send_sound_on_stop' using DEFAULT value:" <<
m_send_sound_on_stop;
224 prop_check.
unput(
"send_sound_on_stop");
259 doc = doc + std::string(
"\n=============================================\n");
260 doc = doc + std::string(
"This is the help for device: AudioRecorder_nws_yarp\n");
261 doc = doc + std::string(
"\n");
262 doc = doc + std::string(
"This is the list of the parameters accepted by the device:\n");
263 doc = doc + std::string(
"'name': full name of the port opened by the device\n");
264 doc = doc + std::string(
"'period': period of the internal thread, in ms\n");
265 doc = doc + std::string(
"'debug': developers use only\n");
266 doc = doc + std::string(
"'min_samples_over_network': sends the network packet ifs n samples are collected AND the timeout is expired\n");
267 doc = doc + std::string(
"'max_samples_over_network': sends the network packet as soon as n samples have been collected\n");
268 doc = doc + std::string(
"'max_samples_timeout': timeout for sample collection\n");
269 doc = doc + std::string(
"'start': automatically activates the recording when the device is started\n");
270 doc = doc + std::string(
"'send_sound_on_stop': send the sound when the stop rpc is called, even if it does not met network size parameters\n");
271 doc = doc + std::string(
"\n");
272 doc = doc + std::string(
"Here are some examples of invocation command with yarpdev, with all params:\n");
273 doc = doc +
" yarpdev --device audioRecorder_nws_yarp --name /audioRecorder_nws --period 0.02 --debug false --min_samples_over_network 11250 --max_samples_over_network 11250 --max_samples_timeout 1.0 --start false --send_sound_on_stop true\n";
274 doc = doc + std::string(
"Using only mandatory params:\n");
275 doc = doc +
" yarpdev --device audioRecorder_nws_yarp\n";
276 doc = doc + std::string(
"=============================================\n\n");
return doc;
bool getParamValue(const std::string ¶mName, std::string ¶mValue) const override
Return the value (represented as a string) of the requested parameter.
std::string getConfiguration() const override
Return the configuration of the device.
size_t m_min_samples_over_network
std::vector< std::string > getListOfParams() const override
Return a list of all params used by the device.
AudioRecorder_nws_yarp_ParamsParser()
bool m_send_sound_on_stop
size_t m_max_samples_over_network
std::string m_provided_configuration
std::string getDocumentationOfDeviceParams() const override
Get the documentation of the DeviceDriver's parameters.
bool parseParams(const yarp::os::Searchable &config) override
Parse the DeviceDriver parameters.
A class for storing options and configuration information.
void unput(const std::string &key)
Remove the association from the given key to a value, if present.
A base class for nested structures that can be searched.
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
virtual std::string toString() const =0
Return a standard text representation of the content of the object.
virtual Value & find(const std::string &key) const =0
Gets a value corresponding to a given keyword.
#define yCInfo(component,...)
#define YARP_LOG_COMPONENT(name,...)