mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 06:29:23 +01:00
client: Add 'Yes', 'No' property type support
This property type will be used for the argument completion among the properties that require Yes or No value.
This commit is contained in:
parent
f5674a2356
commit
bb33c5db8c
@ -29,6 +29,7 @@
|
||||
#include "properties.h"
|
||||
|
||||
const char *properties_on_off_opts[3] = { "on", "off", NULL };
|
||||
const char *properties_yes_no_opts[3] = { "yes", "no", NULL };
|
||||
|
||||
bool properties_builder_append_on_off_variant(
|
||||
struct l_dbus_message_builder *builder,
|
||||
@ -48,3 +49,22 @@ bool properties_builder_append_on_off_variant(
|
||||
|
||||
return l_dbus_message_builder_append_basic(builder, 'b', &value);
|
||||
}
|
||||
|
||||
bool properties_builder_append_yes_no_variant(
|
||||
struct l_dbus_message_builder *builder,
|
||||
const char *value_str)
|
||||
{
|
||||
bool value;
|
||||
|
||||
if (!builder || !value_str)
|
||||
return false;
|
||||
|
||||
if (!strcmp(value_str, "yes"))
|
||||
value = true;
|
||||
else if (!strcmp(value_str, "no"))
|
||||
value = false;
|
||||
else
|
||||
return false;
|
||||
|
||||
return l_dbus_message_builder_append_basic(builder, 'b', &value);
|
||||
}
|
||||
|
@ -21,7 +21,12 @@
|
||||
*/
|
||||
|
||||
const char *properties_on_off_opts[3];
|
||||
const char *properties_yes_no_opts[3];
|
||||
|
||||
bool properties_builder_append_on_off_variant(
|
||||
struct l_dbus_message_builder *builder,
|
||||
const char *value_str);
|
||||
|
||||
bool properties_builder_append_yes_no_variant(
|
||||
struct l_dbus_message_builder *builder,
|
||||
const char *value_str);
|
||||
|
Loading…
Reference in New Issue
Block a user