wifi: convert scanning to new supplicant interface

This commit is contained in:
Dan Williams 2010-11-22 08:40:21 -06:00
parent 848f9f4261
commit 6ecb45ddf0

View file

@ -950,23 +950,49 @@ scan_request_cb (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
g_clear_error (&err);
}
static void
destroy_gvalue (gpointer data)
{
GValue *value = (GValue *) data;
g_value_unset (value);
g_slice_free (GValue, value);
}
static GValue *
string_to_gvalue (const char *str)
{
GValue *val = g_slice_new0 (GValue);
g_value_init (val, G_TYPE_STRING);
g_value_set_string (val, str);
return val;
}
gboolean
nm_supplicant_interface_request_scan (NMSupplicantInterface * self)
{
NMSupplicantInterfacePrivate *priv;
NMSupplicantInfo *info;
DBusGProxyCall *call;
GHashTable *hash;
g_return_val_if_fail (NM_IS_SUPPLICANT_INTERFACE (self), FALSE);
priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self);
/* Scan parameters */
hash = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, destroy_gvalue);
g_hash_table_insert (hash, "Type", string_to_gvalue ("active"));
info = nm_supplicant_info_new (self, priv->iface_proxy, priv->other_pcalls);
call = dbus_g_proxy_begin_call (priv->iface_proxy, "scan",
call = dbus_g_proxy_begin_call (priv->iface_proxy, "Scan",
scan_request_cb,
info,
nm_supplicant_info_destroy,
DBUS_TYPE_G_MAP_OF_VARIANT, hash,
G_TYPE_INVALID);
g_hash_table_destroy (hash);
nm_supplicant_info_set_call (info, call);
return call != NULL;