summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>2014-11-11 12:00:48 -0500
committerLubomir Rintel <lkundrak@v3.sk>2015-10-30 10:16:58 +0100
commit0f167e8b8271d50977435eaa30292cdb02d8fac3 (patch)
tree21a7212f6d91a95ca9afd3b61efe1b1b8f87d475
parent6d295396abcc380b16fe728be2ce4b54acd0d8f7 (diff)
downloadNetworkManager-0f167e8b8271d50977435eaa30292cdb02d8fac3.tar.gz
wifi: Signal on the wifi device when its supplicant is done scanning.
This makes it possible for applications outside NetworkManager to listen for that signal, and use it along with RequestScan to get very up-to-date scan results. Signed-off-by: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
-rw-r--r--introspection/nm-device-wifi.xml6
-rw-r--r--src/devices/wifi/nm-device-wifi.c11
-rw-r--r--src/devices/wifi/nm-device-wifi.h1
-rw-r--r--src/supplicant-manager/nm-supplicant-interface.c3
4 files changed, 20 insertions, 1 deletions
diff --git a/introspection/nm-device-wifi.xml b/introspection/nm-device-wifi.xml
index b94aae8461..ec9af5f57b 100644
--- a/introspection/nm-device-wifi.xml
+++ b/introspection/nm-device-wifi.xml
@@ -121,6 +121,12 @@
</tp:docstring>
</signal>
+ <signal name="ScanDone">
+ <tp:docstring>
+ Emitted when the device has finished scanning for new APs.
+ </tp:docstring>
+ </signal>
+
<tp:flags name="NM_802_11_DEVICE_CAP" type="u">
<tp:docstring>
Flags describing the capabilities of a wireless device.
diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c
index 57d0a9d293..b3e01d3c42 100644
--- a/src/devices/wifi/nm-device-wifi.c
+++ b/src/devices/wifi/nm-device-wifi.c
@@ -104,6 +104,7 @@ enum {
ACCESS_POINT_ADDED,
ACCESS_POINT_REMOVED,
SCANNING_ALLOWED,
+ SCAN_DONE,
LAST_SIGNAL
};
@@ -1620,6 +1621,8 @@ supplicant_iface_scan_done_cb (NMSupplicantInterface *iface,
_LOGD (LOGD_WIFI_SCAN, "scan %s", success ? "successful" : "failed");
+ g_signal_emit (self, signals[SCAN_DONE], 0, NULL);
+
schedule_scan (self, success);
/* Ensure that old APs get removed, which otherwise only
@@ -3380,6 +3383,14 @@ nm_device_wifi_class_init (NMDeviceWifiClass *klass)
scanning_allowed_accumulator, NULL, NULL,
G_TYPE_BOOLEAN, 0);
+ signals[SCAN_DONE] =
+ g_signal_new ("scan-done",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (NMDeviceWifiClass, scan_done),
+ NULL, NULL, NULL,
+ G_TYPE_NONE, 0);
+
nm_dbus_manager_register_exported_type (nm_dbus_manager_get (),
G_TYPE_FROM_CLASS (klass),
&dbus_glib_nm_device_wifi_object_info);
diff --git a/src/devices/wifi/nm-device-wifi.h b/src/devices/wifi/nm-device-wifi.h
index bcba91da2f..47fb31f624 100644
--- a/src/devices/wifi/nm-device-wifi.h
+++ b/src/devices/wifi/nm-device-wifi.h
@@ -70,6 +70,7 @@ struct _NMDeviceWifiClass
void (*access_point_added) (NMDeviceWifi *device, NMAccessPoint *ap);
void (*access_point_removed) (NMDeviceWifi *device, NMAccessPoint *ap);
gboolean (*scanning_allowed) (NMDeviceWifi *device);
+ void (*scan_done) (NMDeviceWifi *device);
};
diff --git a/src/supplicant-manager/nm-supplicant-interface.c b/src/supplicant-manager/nm-supplicant-interface.c
index 30be23aec7..6cef691a52 100644
--- a/src/supplicant-manager/nm-supplicant-interface.c
+++ b/src/supplicant-manager/nm-supplicant-interface.c
@@ -1118,6 +1118,7 @@ nm_supplicant_interface_set_config (NMSupplicantInterface *self,
static void
scan_request_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data)
{
+ NMSupplicantInterface *self = NM_SUPPLICANT_INTERFACE (user_data);
gs_unref_variant GVariant *reply = NULL;
gs_free_error GError *error = NULL;
@@ -1133,7 +1134,7 @@ scan_request_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data)
nm_log_warn (LOGD_SUPPLICANT, "Could not get scan request result: %s", error->message);
}
}
- g_signal_emit (NM_SUPPLICANT_INTERFACE (user_data), signals[SCAN_DONE], 0, error ? FALSE : TRUE);
+ g_signal_emit (self, signals[SCAN_DONE], 0, FALSE);
}
gboolean