commit f7171665d1f14b7770542cbb90a617630e7649db
parent d3742ba65124dbee474aecab22b4eda597f3ab7f
Author: Tim Kourt <tim.a.kourt@linux.intel.com>
Date: Wed, 25 Jul 2018 12:54:40 -0700
client: add property setter for adapter
Diffstat:
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/client/adapter.c b/client/adapter.c
@@ -29,6 +29,7 @@
#include "command.h"
#include "dbus-proxy.h"
#include "display.h"
+#include "properties.h"
struct adapter {
bool powered;
@@ -241,9 +242,37 @@ static enum cmd_status cmd_show(const char *adapter_name, char *args)
return CMD_STATUS_OK;
}
+static void property_set_callback(struct l_dbus_message *message,
+ void *user_data)
+{
+ dbus_message_has_error(message);
+}
+
static enum cmd_status cmd_set_property(const char *adapter_name, char *args)
{
- return CMD_STATUS_UNSUPPORTED;
+ char *name;
+ char *value_str;
+ const struct proxy_interface *proxy =
+ get_adapter_proxy_by_name(adapter_name);
+
+ if (!proxy)
+ return CMD_STATUS_INVALID_VALUE;
+
+ if (!properties_parse_args(args, &name, &value_str))
+ return CMD_STATUS_INVALID_ARGS;
+
+ if (!proxy_property_set(proxy, name, value_str,
+ property_set_callback)) {
+ l_free(name);
+ l_free(value_str);
+
+ return CMD_STATUS_INVALID_VALUE;
+ }
+
+ l_free(name);
+ l_free(value_str);
+
+ return CMD_STATUS_OK;
}
static char *cmd_set_property_completion(const char *text, int state)