summaryrefslogtreecommitdiff
path: root/gsupplicant/dbus.c
diff options
context:
space:
mode:
authorLeena Gunda <leena.gunda@wipro.com>2010-10-22 11:53:39 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2010-10-22 11:59:01 +0200
commitace7fdcba81dc1fe26eda148acc149094260e451 (patch)
tree0fa8fc286164e0e195c1d4f0fd9d0dabb10ddb13 /gsupplicant/dbus.c
parent9e07415df71b95191bf7a64a0a69369402a614a2 (diff)
downloadconnman-ace7fdcba81dc1fe26eda148acc149094260e451.tar.gz
connman-ace7fdcba81dc1fe26eda148acc149094260e451.tar.bz2
connman-ace7fdcba81dc1fe26eda148acc149094260e451.zip
gsupplicant: Get all BSSs when scan is done
After a scan, all BSSs need to be refreshed and passed back to the device layer or else the WiFi device networks list is emptied. Fixes BMC#8324 Fixes BMC#8363
Diffstat (limited to 'gsupplicant/dbus.c')
-rw-r--r--gsupplicant/dbus.c84
1 files changed, 84 insertions, 0 deletions
diff --git a/gsupplicant/dbus.c b/gsupplicant/dbus.c
index 23593f48..53c56ae4 100644
--- a/gsupplicant/dbus.c
+++ b/gsupplicant/dbus.c
@@ -182,6 +182,90 @@ int supplicant_dbus_property_get_all(const char *path, const char *interface,
return 0;
}
+static void property_get_reply(DBusPendingCall *call, void *user_data)
+{
+ struct property_get_data *data = user_data;
+ DBusMessage *reply;
+ DBusMessageIter iter;
+
+ reply = dbus_pending_call_steal_reply(call);
+
+ if (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR)
+ goto done;
+
+ if (dbus_message_iter_init(reply, &iter) == FALSE)
+ goto done;
+
+ if (dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_VARIANT) {
+ DBusMessageIter variant;
+
+ dbus_message_iter_recurse(&iter, &variant);
+
+ if (data->function != NULL)
+ data->function(NULL, &variant, data->user_data);
+ }
+done:
+ dbus_message_unref(reply);
+
+ dbus_pending_call_unref(call);
+}
+
+int supplicant_dbus_property_get(const char *path, const char *interface,
+ const char *method,
+ supplicant_dbus_property_function function,
+ void *user_data)
+{
+ struct property_get_data *data;
+ DBusMessage *message;
+ DBusPendingCall *call;
+
+ if (connection == NULL)
+ return -EINVAL;
+
+ if (path == NULL || interface == NULL || method == NULL)
+ return -EINVAL;
+
+ data = dbus_malloc0(sizeof(*data));
+ if (data == NULL)
+ return -ENOMEM;
+
+ message = dbus_message_new_method_call(SUPPLICANT_SERVICE, path,
+ DBUS_INTERFACE_PROPERTIES, "Get");
+
+ if (message == NULL) {
+ dbus_free(data);
+ return -ENOMEM;
+ }
+
+ dbus_message_set_auto_start(message, FALSE);
+
+ dbus_message_append_args(message, DBUS_TYPE_STRING, &interface,
+ DBUS_TYPE_STRING, &method, NULL);
+
+ if (dbus_connection_send_with_reply(connection, message,
+ &call, TIMEOUT) == FALSE) {
+ dbus_message_unref(message);
+ dbus_free(data);
+ return -EIO;
+ }
+
+ if (call == NULL) {
+ dbus_message_unref(message);
+ dbus_free(data);
+ return -EIO;
+ }
+
+ data->function = function;
+ data->user_data = user_data;
+
+ dbus_pending_call_set_notify(call, property_get_reply,
+ data, dbus_free);
+
+ dbus_message_unref(message);
+
+ return 0;
+}
+
struct property_set_data {
supplicant_dbus_result_function function;
void *user_data;