NMSupplicantInterface PROP_CONNECTION_STATE not installed
Hi, The PROP_CONNECTION_STATE property on NMSupplicantInterface (src/supplicant-manager/nm-supplicant-interface.c) seems not to be installed through g_object_class_install_property(), hence is not really usable. I'm interested in it being a usable property so that I can attach a notify handler to the object and receive notification on when it changes (also have to add some g_object_notify() calls in that file appropriately when con_state changes). Or should I subscribe to the connection-state signal instead, which seems to do that? The background is that I'm trying to act on this feedback: http://thread.gmane.org/gmane.linux.network.networkmanager.devel/10398/focus=10422 As things have changed around a bit, I'm now trying to expose a scanning property from NMDeviceWifi which other code (i.e. mesh device implementation) can then monitor for notify events in order to know when scanning has started or finished. This means that I effectively need to reimplement the nm_supplicant_interface_get_scanning() logic as a property in NMDeviceWifi: generate a property change notification when NMSupplicantInterface's scanning property changes, *or* when NMSupplicantInterface's half-existant connection-state property changes. Daniel ___ NetworkManager-list mailing list NetworkManager-list@gnome.org http://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: NMSupplicantInterface PROP_CONNECTION_STATE not installed
On Fri, 2009-06-05 at 11:26 +0100, Daniel Drake wrote: Hi, The PROP_CONNECTION_STATE property on NMSupplicantInterface (src/supplicant-manager/nm-supplicant-interface.c) seems not to be installed through g_object_class_install_property(), hence is not really usable. possible patch, compile tested only Daniel From 41b84dffe018e764dd7571ad10be42c1c4a7f511 Mon Sep 17 00:00:00 2001 From: Daniel Drake d...@laptop.org Date: Fri, 5 Jun 2009 12:05:13 +0100 Subject: [PATCH] NMSupplicantInterface: make PROP_CONNECTION_STATE a real property It now generates notify events when the property changes. --- src/supplicant-manager/nm-supplicant-interface.c | 17 +++-- 1 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/supplicant-manager/nm-supplicant-interface.c b/src/supplicant-manager/nm-supplicant-interface.c index 32bbdfa..eff9ea2 100644 --- a/src/supplicant-manager/nm-supplicant-interface.c +++ b/src/supplicant-manager/nm-supplicant-interface.c @@ -395,6 +395,16 @@ nm_supplicant_interface_class_init (NMSupplicantInterfaceClass *klass) G_PARAM_READABLE)); g_object_class_install_property (object_class, +PROP_CONNECTION_STATE, +g_param_spec_uint (connection-state, + Connection state, + Connection state, + NM_SUPPLICANT_INTERFACE_CON_STATE_DISCONNECTED, + NM_SUPPLICANT_INTERFACE_CON_STATE_LAST - 1, + NM_SUPPLICANT_INTERFACE_CON_STATE_DISCONNECTED, + G_PARAM_READABLE)); + + g_object_class_install_property (object_class, PROP_SCANNING, g_param_spec_boolean (scanning, Scanning, @@ -640,6 +650,7 @@ wpas_iface_handle_state_change (DBusGProxy *proxy, enum_new_state = wpas_state_string_to_enum (str_new_state); old_state = priv-con_state; priv-con_state = enum_new_state; + g_object_notify (G_OBJECT (user_data), connection-state); if (priv-con_state != old_state) { g_signal_emit (user_data, nm_supplicant_interface_signals[CONNECTION_STATE], @@ -663,11 +674,13 @@ iface_state_cb (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data) g_error_free (err); } else { NMSupplicantInfo *info = (NMSupplicantInfo *) user_data; - NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (info-interface); + NMSupplicantInterface *iface = info-interface; + NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (iface); priv-con_state = wpas_state_string_to_enum (state_str); + g_object_notify (G_OBJECT (iface), connection-state); g_free (state_str); - nm_supplicant_interface_set_state (info-interface, NM_SUPPLICANT_INTERFACE_STATE_READY); + nm_supplicant_interface_set_state (iface, NM_SUPPLICANT_INTERFACE_STATE_READY); } } -- 1.6.2.2 ___ NetworkManager-list mailing list NetworkManager-list@gnome.org http://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: NMSupplicantInterface PROP_CONNECTION_STATE not installed
On Fri, 2009-06-05 at 12:07 +0100, Daniel Drake wrote: On Fri, 2009-06-05 at 11:26 +0100, Daniel Drake wrote: Hi, The PROP_CONNECTION_STATE property on NMSupplicantInterface (src/supplicant-manager/nm-supplicant-interface.c) seems not to be installed through g_object_class_install_property(), hence is not really usable. possible patch, compile tested only How about using the 'scanning' property instead? That's exactly what the 'scanning' property is for, and connection-state doesn't always reflect when the supplicant is actually scanning (ie, it won't back down from CONNECTED - SCANNING when it's associated but can't find the AP in an unsolicited scan list, but will direct-scan again anyway), which is why I added the 'scanning' property and associated patch to wpa_supplicant. Will that do what you need? Dan ___ NetworkManager-list mailing list NetworkManager-list@gnome.org http://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: NMSupplicantInterface PROP_CONNECTION_STATE not installed
On Fri, 2009-06-05 at 09:16 -0400, Dan Williams wrote: How about using the 'scanning' property instead? That's exactly what the 'scanning' property is for, and connection-state doesn't always reflect when the supplicant is actually scanning (ie, it won't back down from CONNECTED - SCANNING when it's associated but can't find the AP in an unsolicited scan list, but will direct-scan again anyway), which is why I added the 'scanning' property and associated patch to wpa_supplicant. Will that do what you need? I don't know. I need a subscribable way of monitoring is this interface currently scanning for networks. I found the function nm_supplicant_interface_get_scanning() which reflects both the scanning property (which is subscribable, great), and the connection-state property (which only half exists). If I'm to believe the logic in that function, I need to subscribe to both scanning and connection-state. The function seems to suggest that sometimes, priv-scanning will be FALSE even though the connection state is NM_SUPPLICANT_INTERFACE_CON_STATE_SCANNING. Thanks, Daniel ___ NetworkManager-list mailing list NetworkManager-list@gnome.org http://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: NMSupplicantInterface PROP_CONNECTION_STATE not installed
On Fri, 2009-06-05 at 19:12 +0100, Daniel Drake wrote: On Fri, 2009-06-05 at 09:16 -0400, Dan Williams wrote: How about using the 'scanning' property instead? That's exactly what the 'scanning' property is for, and connection-state doesn't always reflect when the supplicant is actually scanning (ie, it won't back down from CONNECTED - SCANNING when it's associated but can't find the AP in an unsolicited scan list, but will direct-scan again anyway), which is why I added the 'scanning' property and associated patch to wpa_supplicant. Will that do what you need? I don't know. I need a subscribable way of monitoring is this interface currently scanning for networks. I found the function nm_supplicant_interface_get_scanning() which reflects both the scanning property (which is subscribable, great), and the connection-state property (which only half exists). If I'm to believe the logic in that function, I need to subscribe to both scanning and connection-state. The function seems to suggest that sometimes, priv-scanning will be FALSE even though the connection state is NM_SUPPLICANT_INTERFACE_CON_STATE_SCANNING. It really shouldn't; I was being conservative there. The 'scanning' property (assuming you have that supplicant patch which is now upstream and also available at [1]) should reflect the scanning state internally in the supplicant. If you want, I'll take a patch that makes the supplicant interface's 'scanning' property derived from both wpa_supplicant and the connection state, and then you could still just use g_signal_connect (sup_iface, notify::scanning, G_CALLBACK (my_callback), my_data); Dan [1] http://cvs.fedoraproject.org/viewvc/rpms/wpa_supplicant/F-11/wpa_supplicant-0.6.8-scanning-property.patch?view=log ___ NetworkManager-list mailing list NetworkManager-list@gnome.org http://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: NMSupplicantInterface PROP_CONNECTION_STATE not installed
On Fri, 2009-06-05 at 14:35 -0400, Dan Williams wrote: It really shouldn't; I was being conservative there. The 'scanning' property (assuming you have that supplicant patch which is now upstream and also available at [1]) should reflect the scanning state internally in the supplicant. OK, makes sense, and if it doesn't then we should fix the supplicant. So I don't think there is a need for any patches here. Daniel ___ NetworkManager-list mailing list NetworkManager-list@gnome.org http://mail.gnome.org/mailman/listinfo/networkmanager-list