summaryrefslogtreecommitdiff
path: root/gsupplicant
diff options
context:
space:
mode:
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>2012-07-04 14:24:40 (GMT)
committerMarcel Holtmann <marcel@holtmann.org>2012-07-05 07:08:40 (GMT)
commitaff46402fdbd86925cee5de4d36546b8b289b99b (patch)
tree3616d780ef45b1e06b2e04c6c0ac680a3cb7a5a0 /gsupplicant
parente43d3b27a7449f618913a616cb20787ac760fa8a (diff)
downloadconnman-aff46402fdbd86925cee5de4d36546b8b289b99b.zip
connman-aff46402fdbd86925cee5de4d36546b8b289b99b.tar.gz
connman-aff46402fdbd86925cee5de4d36546b8b289b99b.tar.bz2
gsupplicant: Add a function to handle autoscan method
Diffstat (limited to 'gsupplicant')
-rw-r--r--gsupplicant/gsupplicant.h5
-rw-r--r--gsupplicant/supplicant.c59
2 files changed, 64 insertions, 0 deletions
diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h
index 23ccf19..4e0118d 100644
--- a/gsupplicant/gsupplicant.h
+++ b/gsupplicant/gsupplicant.h
@@ -191,6 +191,11 @@ int g_supplicant_interface_scan(GSupplicantInterface *interface,
GSupplicantInterfaceCallback callback,
void *user_data);
+int g_supplicant_interface_autoscan(GSupplicantInterface *interface,
+ const char *autoscan_data,
+ GSupplicantInterfaceCallback callback,
+ void *user_data);
+
int g_supplicant_interface_connect(GSupplicantInterface *interface,
GSupplicantSSID *ssid,
GSupplicantInterfaceCallback callback,
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 1c03556..dffc1d8 100644
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -2432,6 +2432,13 @@ struct interface_scan_data {
void *user_data;
};
+struct interface_autoscan_data {
+ GSupplicantInterface *interface;
+ GSupplicantInterfaceCallback callback;
+ const char *autoscan_params;
+ void *user_data;
+};
+
static void interface_create_property(const char *key, DBusMessageIter *iter,
void *user_data)
{
@@ -2875,6 +2882,58 @@ int g_supplicant_interface_scan(GSupplicantInterface *interface,
return ret;
}
+static void interface_autoscan_result(const char *error,
+ DBusMessageIter *iter, void *user_data)
+{
+ struct interface_autoscan_data *data = user_data;
+ int err = 0;
+
+ if (error != NULL) {
+ SUPPLICANT_DBG("error %s", error);
+ err = -EIO;
+ }
+
+ if (data != NULL && data->callback != NULL)
+ data->callback(err, data->interface, data->user_data);
+
+ dbus_free(data);
+}
+
+static void interface_autoscan_params(DBusMessageIter *iter, void *user_data)
+{
+ struct interface_autoscan_data *data = user_data;
+
+ dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING,
+ &data->autoscan_params);
+}
+
+int g_supplicant_interface_autoscan(GSupplicantInterface *interface,
+ const char *autoscan_data,
+ GSupplicantInterfaceCallback callback,
+ void *user_data)
+{
+ struct interface_autoscan_data *data;
+ int ret;
+
+ data = dbus_malloc0(sizeof(*data));
+ if (data == NULL)
+ return -ENOMEM;
+
+ data->interface = interface;
+ data->callback = callback;
+ data->autoscan_params = autoscan_data;
+ data->user_data = user_data;
+
+ ret = supplicant_dbus_method_call(interface->path,
+ SUPPLICANT_INTERFACE ".Interface", "AutoScan",
+ interface_autoscan_params,
+ interface_autoscan_result, data);
+ if (ret < 0)
+ dbus_free(data);
+
+ return ret;
+}
+
static int parse_supplicant_error(DBusMessageIter *iter)
{
int err = -ECANCELED;