mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-23 06:02:37 +01:00
client: Change signature of the prop. setters
This commit is contained in:
parent
8f632633c1
commit
59a3c848ff
@ -49,7 +49,6 @@ static void proxy_interface_property_set(struct proxy_interface *proxy,
|
|||||||
struct l_dbus_message_iter *variant)
|
struct l_dbus_message_iter *variant)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
const void *value;
|
|
||||||
const struct proxy_interface_property *property_table =
|
const struct proxy_interface_property *property_table =
|
||||||
proxy->type->properties;
|
proxy->type->properties;
|
||||||
|
|
||||||
@ -60,14 +59,7 @@ static void proxy_interface_property_set(struct proxy_interface *proxy,
|
|||||||
if (!property_table[i].set)
|
if (!property_table[i].set)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (variant)
|
property_table[i].set(proxy->data, variant);
|
||||||
l_dbus_message_iter_get_variant(variant,
|
|
||||||
property_table[i].type,
|
|
||||||
&value);
|
|
||||||
else
|
|
||||||
value = NULL;
|
|
||||||
|
|
||||||
property_table[i].set(proxy->data, value);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ typedef bool (*proxy_property_match_func_t) (const void *a, const void *b);
|
|||||||
struct proxy_interface_property {
|
struct proxy_interface_property {
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *type;
|
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 void *(*get)(const void *data);
|
||||||
const bool is_read_write;
|
const bool is_read_write;
|
||||||
};
|
};
|
||||||
|
@ -54,13 +54,19 @@ static const void *get_name(const void *data)
|
|||||||
return device->name;
|
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;
|
struct device *device = data;
|
||||||
|
const char *value;
|
||||||
|
|
||||||
l_free(device->name);
|
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);
|
device->name = l_strdup(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,13 +77,19 @@ static const void *get_address(const void *data)
|
|||||||
return device->address;
|
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;
|
struct device *device = data;
|
||||||
|
const char *value;
|
||||||
|
|
||||||
l_free(device->address);
|
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);
|
device->address = l_strdup(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,20 +100,33 @@ static const void *get_state(const void *data)
|
|||||||
return device->state;
|
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;
|
struct device *device = data;
|
||||||
|
const char *value;
|
||||||
|
|
||||||
l_free(device->state);
|
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);
|
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;
|
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,
|
device->connected_network = proxy_interface_find(IWD_NETWORK_INTERFACE,
|
||||||
path);
|
path);
|
||||||
@ -117,14 +142,18 @@ static const void *get_powered(const void *data)
|
|||||||
return ptr;
|
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;
|
struct device *device = data;
|
||||||
|
bool value;
|
||||||
|
|
||||||
if (value)
|
if (!l_dbus_message_iter_get_variant(variant, "b", &value)) {
|
||||||
device->powered = l_get_u8(&value);
|
|
||||||
else
|
|
||||||
device->powered = false;
|
device->powered = false;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
device->powered = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const void *get_scanning(const void *data)
|
static const void *get_scanning(const void *data)
|
||||||
@ -137,20 +166,30 @@ static const void *get_scanning(const void *data)
|
|||||||
return ptr;
|
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;
|
struct device *device = data;
|
||||||
|
bool value;
|
||||||
|
|
||||||
if (value)
|
if (!l_dbus_message_iter_get_variant(variant, "b", &value)) {
|
||||||
device->scanning = l_get_u8(&value);
|
|
||||||
else
|
|
||||||
device->scanning = false;
|
device->scanning = false;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
device->scanning = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_adapter(void *data, const void *value)
|
static void set_adapter(void *data, struct l_dbus_message_iter *variant)
|
||||||
{
|
{
|
||||||
struct device *device = data;
|
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);
|
device->adapter = proxy_interface_find(IWD_ADAPTER_INTERFACE, path);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user