30 std::vector<std::string> params;
31 params.push_back(
"period");
32 params.push_back(
"charge");
33 params.push_back(
"voltage");
34 params.push_back(
"current");
35 params.push_back(
"temperature");
36 params.push_back(
"info");
37 params.push_back(
"rpc_port_name");
44 if (paramName ==
"period")
46 paramValue = std::to_string(
m_period);
49 if (paramName ==
"charge")
51 paramValue = std::to_string(
m_charge);
54 if (paramName ==
"voltage")
59 if (paramName ==
"current")
64 if (paramName ==
"temperature")
69 if (paramName ==
"info")
74 if (paramName ==
"rpc_port_name")
80 yError() <<
"parameter '" << paramName <<
"' was not found";
99 if (config.
check(
"help"))
108 if (config.
check(
"period"))
111 yCInfo(FakeBatteryParamsCOMPONENT) <<
"Parameter 'period' using value:" <<
m_period;
115 yCInfo(FakeBatteryParamsCOMPONENT) <<
"Parameter 'period' using DEFAULT value:" <<
m_period;
117 prop_check.
unput(
"period");
122 if (config.
check(
"charge"))
125 yCInfo(FakeBatteryParamsCOMPONENT) <<
"Parameter 'charge' using value:" <<
m_charge;
129 yCInfo(FakeBatteryParamsCOMPONENT) <<
"Parameter 'charge' using DEFAULT value:" <<
m_charge;
131 prop_check.
unput(
"charge");
136 if (config.
check(
"voltage"))
139 yCInfo(FakeBatteryParamsCOMPONENT) <<
"Parameter 'voltage' using value:" <<
m_voltage;
143 yCInfo(FakeBatteryParamsCOMPONENT) <<
"Parameter 'voltage' using DEFAULT value:" <<
m_voltage;
145 prop_check.
unput(
"voltage");
150 if (config.
check(
"current"))
153 yCInfo(FakeBatteryParamsCOMPONENT) <<
"Parameter 'current' using value:" <<
m_current;
157 yCInfo(FakeBatteryParamsCOMPONENT) <<
"Parameter 'current' using DEFAULT value:" <<
m_current;
159 prop_check.
unput(
"current");
164 if (config.
check(
"temperature"))
167 yCInfo(FakeBatteryParamsCOMPONENT) <<
"Parameter 'temperature' using value:" <<
m_temperature;
171 yCInfo(FakeBatteryParamsCOMPONENT) <<
"Parameter 'temperature' using DEFAULT value:" <<
m_temperature;
173 prop_check.
unput(
"temperature");
178 if (config.
check(
"info"))
181 yCInfo(FakeBatteryParamsCOMPONENT) <<
"Parameter 'info' using value:" <<
m_info;
185 yCInfo(FakeBatteryParamsCOMPONENT) <<
"Parameter 'info' using DEFAULT value:" <<
m_info;
187 prop_check.
unput(
"info");
192 if (config.
check(
"rpc_port_name"))
199 yCInfo(FakeBatteryParamsCOMPONENT) <<
"Parameter 'rpc_port_name' using DEFAULT value:" <<
m_rpc_port_name;
201 prop_check.
unput(
"rpc_port_name");
236 doc = doc + std::string(
"\n=============================================\n");
237 doc = doc + std::string(
"This is the help for device: FakeBattery\n");
238 doc = doc + std::string(
"\n");
239 doc = doc + std::string(
"This is the list of the parameters accepted by the device:\n");
240 doc = doc + std::string(
"'period': thread period\n");
241 doc = doc + std::string(
"'charge': Initial charge\n");
242 doc = doc + std::string(
"'voltage': Initial voltage\n");
243 doc = doc + std::string(
"'current': Initial current\n");
244 doc = doc + std::string(
"'temperature': Initial temperature\n");
245 doc = doc + std::string(
"'info': Initial battery information\n");
246 doc = doc + std::string(
"'rpc_port_name': Full rpc port name\n");
247 doc = doc + std::string(
"\n");
248 doc = doc + std::string(
"Here are some examples of invocation command with yarpdev, with all params:\n");
249 doc = doc +
" yarpdev --device fakeBattery --period 0.02 --charge 50.0 --voltage 30.0 --current 3.0 --temperature 20.0 --info Fake battery system v2.0 --rpc_port_name /fakeBattery/rpc\n";
250 doc = doc + std::string(
"Using only mandatory params:\n");
251 doc = doc +
" yarpdev --device fakeBattery\n";
252 doc = doc + std::string(
"=============================================\n\n");
return doc;
std::vector< std::string > getListOfParams() const override
Return a list of all params used by the device.
FakeBattery_ParamsParser()
std::string getConfiguration() const override
Return the configuration of the device.
bool parseParams(const yarp::os::Searchable &config) override
Parse the DeviceDriver parameters.
bool getParamValue(const std::string ¶mName, std::string ¶mValue) const override
Return the value (represented as a string) of the requested parameter.
std::string m_provided_configuration
std::string m_rpc_port_name
std::string getDocumentationOfDeviceParams() const override
Get the documentation of the DeviceDriver's 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,...)