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

wiphy: Add ConnectedNetwork property to Device

This property is optional.  If the device is connected, it holds the
object path of the connected network.
This commit is contained in:
Rahul Rahul 2016-03-09 12:44:52 -08:00 committed by Denis Kenzior
parent d86b8d2b83
commit 971d93a9e6

View File

@ -612,6 +612,10 @@ bool __iwd_device_append_properties(struct netdev *netdev,
dbus_dict_append_string(builder, "Name", netdev->name); dbus_dict_append_string(builder, "Name", netdev->name);
if (netdev->connected_network)
dbus_dict_append_object(builder, "ConnectedNetwork",
netdev->connected_network->object_path);
l_dbus_message_builder_leave_array(builder); l_dbus_message_builder_leave_array(builder);
return true; return true;
@ -821,6 +825,22 @@ static bool device_property_get_name(struct l_dbus *dbus,
return true; return true;
} }
static bool device_property_get_connected_network(struct l_dbus *dbus,
struct l_dbus_message *message,
struct l_dbus_message_builder *builder,
void *user_data)
{
struct netdev *netdev = user_data;
if (!netdev->connected_network)
return false;
l_dbus_message_builder_append_basic(builder, 'o',
netdev->connected_network->object_path);
return true;
}
static void setup_device_interface(struct l_dbus_interface *interface) static void setup_device_interface(struct l_dbus_interface *interface)
{ {
l_dbus_interface_method(interface, "Scan", 0, l_dbus_interface_method(interface, "Scan", 0,
@ -838,6 +858,9 @@ static void setup_device_interface(struct l_dbus_interface *interface)
l_dbus_interface_property(interface, "Name", 0, "s", l_dbus_interface_property(interface, "Name", 0, "s",
device_property_get_name, NULL); device_property_get_name, NULL);
l_dbus_interface_property(interface, "ConnectedNetwork", 0, "o",
device_property_get_connected_network,
NULL);
} }
static bool bss_match(const void *a, const void *b) static bool bss_match(const void *a, const void *b)