mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-21 20:12:37 +01:00
wiphy: Drop Device.GetNetworks and related signals
Drop the Device interface methods and properties made redundant by the ObjectManager.
This commit is contained in:
parent
15bab067fc
commit
ab1319a9d5
@ -602,67 +602,6 @@ static void setup_network_interface(struct l_dbus_interface *interface)
|
||||
NULL);
|
||||
}
|
||||
|
||||
bool __iwd_network_append_properties(const struct network *network,
|
||||
struct l_dbus_message_builder *builder)
|
||||
{
|
||||
bool connected;
|
||||
|
||||
l_dbus_message_builder_enter_array(builder, "{sv}");
|
||||
dbus_dict_append_string(builder, "Name", network->ssid);
|
||||
|
||||
connected = device_get_connected_network(network->netdev) == network;
|
||||
dbus_dict_append_bool(builder, "Connected", connected);
|
||||
l_dbus_message_builder_leave_array(builder);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void network_emit_added(struct network *network)
|
||||
{
|
||||
struct l_dbus *dbus = dbus_get_bus();
|
||||
struct l_dbus_message *signal;
|
||||
struct l_dbus_message_builder *builder;
|
||||
|
||||
signal = l_dbus_message_new_signal(dbus,
|
||||
device_get_path(network->netdev),
|
||||
IWD_DEVICE_INTERFACE,
|
||||
"NetworkAdded");
|
||||
|
||||
if (!signal)
|
||||
return;
|
||||
|
||||
builder = l_dbus_message_builder_new(signal);
|
||||
if (!builder) {
|
||||
l_dbus_message_unref(signal);
|
||||
return;
|
||||
}
|
||||
|
||||
l_dbus_message_builder_append_basic(builder, 'o',
|
||||
network->object_path);
|
||||
__iwd_network_append_properties(network, builder);
|
||||
|
||||
l_dbus_message_builder_finalize(builder);
|
||||
l_dbus_message_builder_destroy(builder);
|
||||
l_dbus_send(dbus, signal);
|
||||
}
|
||||
|
||||
static void network_emit_removed(struct network *network)
|
||||
{
|
||||
struct l_dbus *dbus = dbus_get_bus();
|
||||
struct l_dbus_message *signal;
|
||||
|
||||
signal = l_dbus_message_new_signal(dbus,
|
||||
device_get_path(network->netdev),
|
||||
IWD_DEVICE_INTERFACE,
|
||||
"NetworkRemoved");
|
||||
|
||||
if (!signal)
|
||||
return;
|
||||
|
||||
l_dbus_message_set_arguments(signal, "o", network->object_path);
|
||||
l_dbus_send(dbus, signal);
|
||||
}
|
||||
|
||||
bool network_register(struct network *network, const char *path)
|
||||
{
|
||||
if (!l_dbus_object_add_interface(dbus_get_bus(), path,
|
||||
@ -673,7 +612,6 @@ bool network_register(struct network *network, const char *path)
|
||||
}
|
||||
|
||||
network->object_path = strdup(path);
|
||||
network_emit_added(network);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -686,7 +624,6 @@ static void network_unregister(struct network *network)
|
||||
network_settings_close(network);
|
||||
|
||||
l_dbus_unregister_object(dbus, network->object_path);
|
||||
network_emit_removed(network);
|
||||
|
||||
l_free(network->object_path);
|
||||
network->object_path = NULL;
|
||||
|
@ -32,9 +32,6 @@ struct network *network_create(struct netdev *device,
|
||||
uint8_t *ssid, uint8_t ssid_len,
|
||||
enum security security);
|
||||
|
||||
bool __iwd_network_append_properties(const struct network *network,
|
||||
struct l_dbus_message_builder *builder);
|
||||
|
||||
const char *network_get_ssid(struct network *network);
|
||||
struct netdev *network_get_netdev(struct network *network);
|
||||
const char *network_get_path(struct network *network);
|
||||
|
42
src/wiphy.c
42
src/wiphy.c
@ -390,40 +390,6 @@ static struct l_dbus_message *device_scan(struct l_dbus *dbus,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void append_network_properties(const void *key, void *value,
|
||||
void *user_data)
|
||||
{
|
||||
struct network *network = value;
|
||||
struct l_dbus_message_builder *builder = user_data;
|
||||
|
||||
l_dbus_message_builder_enter_dict(builder, "oa{sv}");
|
||||
l_dbus_message_builder_append_basic(builder, 'o',
|
||||
network_get_path(network));
|
||||
__iwd_network_append_properties(network, builder);
|
||||
l_dbus_message_builder_leave_dict(builder);
|
||||
}
|
||||
|
||||
static struct l_dbus_message *device_get_networks(struct l_dbus *dbus,
|
||||
struct l_dbus_message *message,
|
||||
void *user_data)
|
||||
{
|
||||
struct netdev *netdev = user_data;
|
||||
struct l_dbus_message *reply;
|
||||
struct l_dbus_message_builder *builder;
|
||||
|
||||
reply = l_dbus_message_new_method_return(message);
|
||||
builder = l_dbus_message_builder_new(reply);
|
||||
|
||||
l_dbus_message_builder_enter_array(builder, "{oa{sv}}");
|
||||
l_hashmap_foreach(netdev->networks, append_network_properties, builder);
|
||||
l_dbus_message_builder_leave_array(builder);
|
||||
|
||||
l_dbus_message_builder_finalize(builder);
|
||||
l_dbus_message_builder_destroy(builder);
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
static void device_disconnect_cb(struct l_genl_msg *msg, void *user_data)
|
||||
{
|
||||
struct netdev *netdev = user_data;
|
||||
@ -509,17 +475,9 @@ static void setup_device_interface(struct l_dbus_interface *interface)
|
||||
{
|
||||
l_dbus_interface_method(interface, "Scan", 0,
|
||||
device_scan, "", "");
|
||||
l_dbus_interface_method(interface, "GetNetworks", 0,
|
||||
device_get_networks,
|
||||
"a{oa{sv}}", "", "networks");
|
||||
l_dbus_interface_method(interface, "Disconnect", 0,
|
||||
device_disconnect, "", "");
|
||||
|
||||
l_dbus_interface_signal(interface, "NetworkAdded", 0,
|
||||
"oa{sv}", "path", "properties");
|
||||
l_dbus_interface_signal(interface, "NetworkRemoved", 0,
|
||||
"o", "path");
|
||||
|
||||
l_dbus_interface_property(interface, "Name", 0, "s",
|
||||
device_property_get_name, NULL);
|
||||
l_dbus_interface_property(interface, "ConnectedNetwork", 0, "o",
|
||||
|
Loading…
Reference in New Issue
Block a user