From 67676c65bf4dd0277544fdefe98965c6fbbe6344 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Wed, 8 Jan 2014 11:40:56 -0600 Subject: [PATCH] api/wifi: add GetAllAccessPoints() method The original GetAccessPoints() method call never returned hidden SSID access points. That's useful though, and the new AccessPoints property returns all of them too, so add this new method to return all access points, including hidden SSID ones. --- introspection/nm-device-wifi.xml | 20 ++++++++++++++++++-- src/devices/nm-device-wifi.c | 21 +++++++++++++++++++-- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/introspection/nm-device-wifi.xml b/introspection/nm-device-wifi.xml index fff74337af..65c7b71dce 100644 --- a/introspection/nm-device-wifi.xml +++ b/introspection/nm-device-wifi.xml @@ -6,11 +6,27 @@ - List of access point object paths + List of access point object paths. - Get the list of access points visible to this device. + DEPRECATED. Get the list of access points visible to this device. Note + that this list does not include access points which hide their SSID. To + retrieve a list of all access points (including hidden ones) use the + GetAllAccessPoints() method. + + + + + + + + List of access point object paths. + + + + Get the list of all access points visible to this device, including + hidden ones for which the SSID is not yet known. diff --git a/src/devices/nm-device-wifi.c b/src/devices/nm-device-wifi.c index 995c2f858e..e91214e162 100644 --- a/src/devices/nm-device-wifi.c +++ b/src/devices/nm-device-wifi.c @@ -65,6 +65,10 @@ static gboolean impl_device_get_access_points (NMDeviceWifi *device, GPtrArray **aps, GError **err); +static gboolean impl_device_get_all_access_points (NMDeviceWifi *device, + GPtrArray **aps, + GError **err); + static void impl_device_request_scan (NMDeviceWifi *device, GHashTable *options, DBusGMethodInvocation *context); @@ -1376,9 +1380,8 @@ impl_device_get_access_points (NMDeviceWifi *self, GSList *elt; *aps = g_ptr_array_new (); - for (elt = priv->ap_list; elt; elt = g_slist_next (elt)) { - NMAccessPoint * ap = NM_AP (elt->data); + NMAccessPoint *ap = NM_AP (elt->data); if (nm_ap_get_ssid (ap)) g_ptr_array_add (*aps, g_strdup (nm_ap_get_dbus_path (ap))); @@ -1386,6 +1389,20 @@ impl_device_get_access_points (NMDeviceWifi *self, return TRUE; } +static gboolean +impl_device_get_all_access_points (NMDeviceWifi *self, + GPtrArray **aps, + GError **err) +{ + NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); + GSList *elt; + + *aps = g_ptr_array_new (); + for (elt = priv->ap_list; elt; elt = g_slist_next (elt)) + g_ptr_array_add (*aps, g_strdup (nm_ap_get_dbus_path (NM_AP (elt->data)))); + return TRUE; +} + static void request_scan_cb (NMDevice *device, DBusGMethodInvocation *context,