30 std::vector<std::string> params;
31 params.push_back(
"name");
32 params.push_back(
"period");
33 params.push_back(
"enable_shutdown");
34 params.push_back(
"enable_log");
35 params.push_back(
"quitPortName");
43 if (config.
check(
"help"))
48 std::string config_string = config.
toString();
52 if (config.
check(
"name"))
55 yCInfo(Battery_nws_yarpParamsCOMPONENT) <<
"Parameter 'name' using value:" <<
m_name;
59 yCError(Battery_nws_yarpParamsCOMPONENT) <<
"Mandatory parameter 'name' not found!";
60 yCError(Battery_nws_yarpParamsCOMPONENT) <<
"Description of the parameter: prefix of the ports opened by the device";
63 prop_check.
unput(
"name");
68 if (config.
check(
"period"))
71 yCInfo(Battery_nws_yarpParamsCOMPONENT) <<
"Parameter 'period' using value:" <<
m_period;
75 yCInfo(Battery_nws_yarpParamsCOMPONENT) <<
"Parameter 'period' using DEFAULT value:" <<
m_period;
77 prop_check.
unput(
"period");
82 if (config.
check(
"enable_shutdown"))
89 yCInfo(Battery_nws_yarpParamsCOMPONENT) <<
"Parameter 'enable_shutdown' using DEFAULT value:" <<
m_enable_shutdown;
91 prop_check.
unput(
"enable_shutdown");
96 if (config.
check(
"enable_log"))
99 yCInfo(Battery_nws_yarpParamsCOMPONENT) <<
"Parameter 'enable_log' using value:" <<
m_enable_log;
103 yCInfo(Battery_nws_yarpParamsCOMPONENT) <<
"Parameter 'enable_log' using DEFAULT value:" <<
m_enable_log;
105 prop_check.
unput(
"enable_log");
110 if (config.
check(
"quitPortName"))
113 yCInfo(Battery_nws_yarpParamsCOMPONENT) <<
"Parameter 'quitPortName' using value:" <<
m_quitPortName;
117 yCInfo(Battery_nws_yarpParamsCOMPONENT) <<
"Parameter 'quitPortName' using DEFAULT value:" <<
m_quitPortName;
119 prop_check.
unput(
"quitPortName");
154 doc = doc + std::string(
"\n=============================================\n");
155 doc = doc + std::string(
"This is the help for device: Battery_nws_yarp\n");
156 doc = doc + std::string(
"\n");
157 doc = doc + std::string(
"This is the list of the parameters accepted by the device:\n");
158 doc = doc + std::string(
"'name': prefix of the ports opened by the device\n");
159 doc = doc + std::string(
"'period': refresh period of the broadcasted values in seconds\n");
160 doc = doc + std::string(
"'enable_shutdown': if enabled, batteryWrapper will start a system shutdown when charge is below 5%\n");
161 doc = doc + std::string(
"'enable_log': if enabled, stores a log of battery usage on disk\n");
162 doc = doc + std::string(
"'quitPortName': if present, this yarp port will be opened and used to send a sthutdown command to other processes\n");
163 doc = doc + std::string(
"\n");
164 doc = doc + std::string(
"Here are some examples of invocation command with yarpdev, with all params:\n");
165 doc = doc +
" yarpdev --device battery_nws_yarp --name /robotName/battery1 --period 1.0 --enable_shutdown false --enable_log false --quitPortName <optional_value>\n";
166 doc = doc + std::string(
"Using only mandatory params:\n");
167 doc = doc +
" yarpdev --device battery_nws_yarp --name /robotName/battery1\n";
168 doc = doc + std::string(
"=============================================\n\n");
return doc;
Battery_nws_yarp_ParamsParser()
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.
std::string m_quitPortName
std::vector< std::string > getListOfParams() const override
Return a list of all params used by the device.
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 yCError(component,...)
#define YARP_LOG_COMPONENT(name,...)