static int ret;
-/*
+/**
* option '-a'
*/
static int get_all;
+/**
+ * option '-g'
+ */
+static char *get_sensor;
+
/*
* Handle to sensor service
*/
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
&shutdown_task,
NULL);
+ sensor_handle = GNUNET_SENSOR_connect(cfg);
+ GNUNET_assert(NULL != sensor_handle);
if(GNUNET_YES == get_all)
{
- sensor_handle = GNUNET_SENSOR_connect(cfg);
- GNUNET_assert(NULL != sensor_handle);
GNUNET_SENSOR_iterate_sensors(sensor_handle,
GNUNET_TIME_UNIT_FOREVER_REL,
NULL,
&print_sensor_info,
NULL);
}
+ else if(NULL != get_sensor)
+ {
+ GNUNET_SENSOR_iterate_sensors(sensor_handle,
+ GNUNET_TIME_UNIT_FOREVER_REL,
+ get_sensor,
+ strlen(get_sensor),
+ &print_sensor_info,
+ NULL);
+ }
ret = 0;
}
{
static const struct GNUNET_GETOPT_CommandLineOption options[] = {
{'a', "all", NULL,
- gettext_noop("Retrieve names of all defined sensors"),
+ gettext_noop("Retrieve information about all defined sensors"),
0, &GNUNET_GETOPT_set_one, &get_all},
+ {'g', "get-sensor", NULL,
+ gettext_noop("Retrieve information about a single sensor"),
+ 1, &GNUNET_GETOPT_set_string, &get_sensor},
GNUNET_GETOPT_OPTION_END
};
return (GNUNET_OK ==