static void wpas_iface_properties_changed (DBusGProxy *proxy, GHashTable *props, gpointer user_data) { NMSupplicantInterface *self = NM_SUPPLICANT_INTERFACE (user_data); GValue *value; value = g_hash_table_lookup (props, "Scanning"); if (value && G_VALUE_HOLDS_BOOLEAN (value)) set_scanning (self, g_value_get_boolean (value)); value = g_hash_table_lookup (props, "State"); if (value && G_VALUE_HOLDS_STRING (value)) set_state_from_string (self, g_value_get_string (value)); value = g_hash_table_lookup (props, "BSSs"); if (value && G_VALUE_HOLDS (value, DBUS_TYPE_G_ARRAY_OF_OBJECT_PATH)) request_bss_properties (self, g_value_get_boxed (value)); }
static void props_changed_cb (GDBusProxy *proxy, GVariant *changed_properties, GStrv invalidated_properties, gpointer user_data) { NMSupplicantInterface *self = NM_SUPPLICANT_INTERFACE (user_data); NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); const char *s, **array, **iter; gboolean b = FALSE; gint32 i32; GVariant *v; g_object_freeze_notify (G_OBJECT (self)); if (g_variant_lookup (changed_properties, "Scanning", "b", &b)) set_scanning (self, b); if ( g_variant_lookup (changed_properties, "State", "&s", &s) && priv->state >= NM_SUPPLICANT_INTERFACE_STATE_READY) { /* Only transition to actual wpa_supplicant interface states (ie, * anything > READY) after the NMSupplicantInterface has had a * chance to initialize, which is signalled by entering the READY * state. */ set_state_from_string (self, s); } if (g_variant_lookup (changed_properties, "BSSs", "^a&s", &array)) { iter = array; while (*iter) handle_new_bss (self, *iter++); g_free (array); } if (g_variant_lookup (changed_properties, "CurrentBSS", "&o", &s)) { if (strcmp (s, "/") == 0) s = NULL; if (g_strcmp0 (s, priv->current_bss) != 0) { g_free (priv->current_bss); priv->current_bss = g_strdup (s); g_object_notify (G_OBJECT (self), NM_SUPPLICANT_INTERFACE_CURRENT_BSS); } } v = g_variant_lookup_value (changed_properties, "Capabilities", G_VARIANT_TYPE_VARDICT); if (v) { parse_capabilities (self, v); g_variant_unref (v); } if (g_variant_lookup (changed_properties, "DisconnectReason", "i", &i32)) { /* Disconnect reason is currently only given for deauthentication events, * not disassociation; currently they are IEEE 802.11 "reason codes", * defined by (IEEE 802.11-2007, 7.3.1.7, Table 7-22). Any locally caused * deauthentication will be negative, while authentications caused by the * AP will be positive. */ priv->disconnect_reason = i32; if (priv->disconnect_reason != 0) { nm_log_warn (LOGD_SUPPLICANT, "Connection disconnected (reason %d)", priv->disconnect_reason); } } g_object_thaw_notify (G_OBJECT (self)); }