+static GSList *
+get_scan_results(struct if_msg *ifm)
+{
+ GType otype;
+ GError *error;
+ GPtrArray *array;
+ GHashTable *config;
+ GSList *list = NULL;
+ struct if_ap *ifa;
+ guint i;
+ GValue *val;
+
+ otype = dbus_g_type_get_map("GHashTable", G_TYPE_STRING, G_TYPE_VALUE);
+ otype = dbus_g_type_get_collection("GPtrArray", otype);
+
+ if (!dbus_g_proxy_call(dbus, "ScanResults", &error,
+ G_TYPE_STRING, ifm->ifname, G_TYPE_INVALID,
+ otype, &array, G_TYPE_INVALID))
+ error_exit(_("ScanResults"), error);
+
+ for (i = 0; i < array->len; i++) {
+ config = g_ptr_array_index(array, i);
+ val = g_hash_table_lookup(config, "BSSID");
+ if (val == NULL)
+ continue;
+ ifa = g_malloc0(sizeof(*ifa));
+ ifa->ifname = g_strdup(ifm->ifname);
+ ifa->bssid = g_strdup(g_value_get_string(val));
+ val = g_hash_table_lookup(config, "Frequency");
+ if (val)
+ ifa->frequency = g_value_get_int(val);
+ val = g_hash_table_lookup(config, "Quality");
+ if (val)
+ ifa->quality = g_value_get_int(val);
+ val = g_hash_table_lookup(config, "Noise");
+ if (val)
+ ifa->noise = g_value_get_int(val);
+ val = g_hash_table_lookup(config, "Level");
+ if (val)
+ ifa->level = g_value_get_int(val);
+ val = g_hash_table_lookup(config, "Flags");
+ if (val)
+ ifa->flags = g_strdup(g_value_get_string(val));
+ val = g_hash_table_lookup(config, "SSID");
+ if (val)
+ ifa->ssid = g_strdup(g_value_get_string(val));
+ list = g_slist_append(list, ifa);
+ }
+ return list;
+}
+