3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 21:22:37 +01:00

client: Change signature of the prop. setters

This commit is contained in:
Tim Kourt 2017-04-25 14:32:16 -07:00 committed by Denis Kenzior
parent 8f632633c1
commit 59a3c848ff
3 changed files with 62 additions and 31 deletions

View File

@ -49,7 +49,6 @@ static void proxy_interface_property_set(struct proxy_interface *proxy,
struct l_dbus_message_iter *variant)
{
size_t i;
const void *value;
const struct proxy_interface_property *property_table =
proxy->type->properties;
@ -60,14 +59,7 @@ static void proxy_interface_property_set(struct proxy_interface *proxy,
if (!property_table[i].set)
return;
if (variant)
l_dbus_message_iter_get_variant(variant,
property_table[i].type,
&value);
else
value = NULL;
property_table[i].set(proxy->data, value);
property_table[i].set(proxy->data, variant);
return;
}

View File

@ -35,7 +35,7 @@ typedef bool (*proxy_property_match_func_t) (const void *a, const void *b);
struct proxy_interface_property {
const char *name;
const char *type;
void (*set)(void *data, const void *value);
void (*set)(void *data, struct l_dbus_message_iter *variant);
const void *(*get)(const void *data);
const bool is_read_write;
};

View File

@ -54,13 +54,19 @@ static const void *get_name(const void *data)
return device->name;
}
static void set_name(void *data, const void *value)
static void set_name(void *data, struct l_dbus_message_iter *variant)
{
struct device *device = data;
const char *value;
l_free(device->name);
if (value)
if (!l_dbus_message_iter_get_variant(variant, "s", &value)) {
device->name = NULL;
return;
}
device->name = l_strdup(value);
}
@ -71,13 +77,19 @@ static const void *get_address(const void *data)
return device->address;
}
static void set_address(void *data, const void *value)
static void set_address(void *data, struct l_dbus_message_iter *variant)
{
struct device *device = data;
const char *value;
l_free(device->address);
if (value)
if (!l_dbus_message_iter_get_variant(variant, "s", &value)) {
device->address = NULL;
return;
}
device->address = l_strdup(value);
}
@ -88,20 +100,33 @@ static const void *get_state(const void *data)
return device->state;
}
static void set_state(void *data, const void *value)
static void set_state(void *data, struct l_dbus_message_iter *variant)
{
struct device *device = data;
const char *value;
l_free(device->state);
if (value)
if (!l_dbus_message_iter_get_variant(variant, "s", &value)) {
device->state = NULL;
return;
}
device->state = l_strdup(value);
}
static void set_connected_network(void *data, const void *value)
static void set_connected_network(void *data,
struct l_dbus_message_iter *variant)
{
struct device *device = data;
const char *path = value;
const char *path;
if (!l_dbus_message_iter_get_variant(variant, "o", &path)) {
device->connected_network = NULL;
return;
}
device->connected_network = proxy_interface_find(IWD_NETWORK_INTERFACE,
path);
@ -117,14 +142,18 @@ static const void *get_powered(const void *data)
return ptr;
}
static void set_powered(void *data, const void *value)
static void set_powered(void *data, struct l_dbus_message_iter *variant)
{
struct device *device = data;
bool value;
if (value)
device->powered = l_get_u8(&value);
else
if (!l_dbus_message_iter_get_variant(variant, "b", &value)) {
device->powered = false;
return;
}
device->powered = value;
}
static const void *get_scanning(const void *data)
@ -137,20 +166,30 @@ static const void *get_scanning(const void *data)
return ptr;
}
static void set_scanning(void *data, const void *value)
static void set_scanning(void *data, struct l_dbus_message_iter *variant)
{
struct device *device = data;
bool value;
if (value)
device->scanning = l_get_u8(&value);
else
if (!l_dbus_message_iter_get_variant(variant, "b", &value)) {
device->scanning = false;
return;
}
static void set_adapter(void *data, const void *value)
device->scanning = value;
}
static void set_adapter(void *data, struct l_dbus_message_iter *variant)
{
struct device *device = data;
const char *path = value;
const char *path;
if (!l_dbus_message_iter_get_variant(variant, "o", &path)) {
device->adapter = NULL;
return;
}
device->adapter = proxy_interface_find(IWD_ADAPTER_INTERFACE, path);
}