3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 23:09:34 +01:00

network: Move network_emit_added to network.c

This commit is contained in:
Denis Kenzior 2016-05-12 09:51:02 -05:00
parent 3ca8dfb5ad
commit 5dc3a892db
3 changed files with 31 additions and 29 deletions

View File

@ -225,6 +225,35 @@ bool __iwd_network_append_properties(const struct network *network,
return true;
}
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);
}
void network_init()
{
networks = l_queue_new();

View File

@ -49,5 +49,7 @@ struct netdev *network_get_netdev(struct network *network);
const char *network_get_path(struct network *network);
enum security network_get_security(struct network *network);
void network_emit_added(struct network *network);
void network_init();
void network_exit();

View File

@ -509,35 +509,6 @@ static void setup_network_interface(struct l_dbus_interface *interface)
NULL);
}
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();