mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 13:02:44 +01:00
client: add variant appender for the on/off properties
This commit is contained in:
parent
6ba707fca8
commit
687dcc6145
@ -28,6 +28,24 @@
|
|||||||
|
|
||||||
#include "properties.h"
|
#include "properties.h"
|
||||||
|
|
||||||
|
bool properties_builder_append_on_off_variant(
|
||||||
|
struct l_dbus_message_builder *builder,
|
||||||
|
const char *value_str)
|
||||||
|
{
|
||||||
|
if (!builder || !value_str)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!strcmp(value_str, "on"))
|
||||||
|
return l_dbus_message_builder_append_basic(builder, 'b',
|
||||||
|
&properties_on_off_opts[0].value);
|
||||||
|
|
||||||
|
if (!strcmp(value_str, "off"))
|
||||||
|
return l_dbus_message_builder_append_basic(builder, 'b',
|
||||||
|
&properties_on_off_opts[1].value);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool properties_parse_args(char *args, char **name, char **value)
|
bool properties_parse_args(char *args, char **name, char **value)
|
||||||
{
|
{
|
||||||
char **arg_arr;
|
char **arg_arr;
|
||||||
|
@ -20,4 +20,19 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
struct property_value_options {
|
||||||
|
const char *value_str;
|
||||||
|
const void *value;
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct property_value_options properties_on_off_opts[] = {
|
||||||
|
{ "on", (void *) true },
|
||||||
|
{ "off", (void *) false },
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
|
||||||
|
bool properties_builder_append_on_off_variant(
|
||||||
|
struct l_dbus_message_builder *builder,
|
||||||
|
const char *value_str);
|
||||||
|
|
||||||
bool properties_parse_args(char *args, char **name, char **value);
|
bool properties_parse_args(char *args, char **name, char **value);
|
||||||
|
Loading…
Reference in New Issue
Block a user