client: add property setter for device

This commit is contained in:
Tim Kourt 2018-07-25 12:54:41 -07:00 committed by Denis Kenzior
parent f7171665d1
commit 1e78ed5a7d
1 changed files with 24 additions and 1 deletions

View File

@ -31,6 +31,7 @@
#include "device.h"
#include "display.h"
#include "network.h"
#include "properties.h"
struct device {
bool powered;
@ -672,7 +673,29 @@ static enum cmd_status cmd_list(const char *device_name, char *args)
static enum cmd_status cmd_set_property(const char *device_name, char *args)
{
return CMD_STATUS_UNSUPPORTED;
char *name;
char *value_str;
const struct proxy_interface *proxy =
get_device_proxy_by_name(device_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,
check_errors_method_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 enum cmd_status cmd_connect(const char *device_name, char *args)