diff options
author | Niraj Kumar Goit <niraj.g@samsung.com> | 2017-08-17 15:26:46 +0530 |
---|---|---|
committer | Niraj Kumar Goit <niraj.g@samsung.com> | 2017-08-18 10:21:28 +0000 |
commit | 9ac9e2bcccd2c3dcea3e9111701bb09f15db85ba (patch) | |
tree | c23347a3cb9456d807f3dfb1474d9c925339a670 | |
parent | ba402241bb13ef082d057024e905e797b2f6d43b (diff) | |
download | connman-9ac9e2bcccd2c3dcea3e9111701bb09f15db85ba.tar.gz connman-9ac9e2bcccd2c3dcea3e9111701bb09f15db85ba.tar.bz2 connman-9ac9e2bcccd2c3dcea3e9111701bb09f15db85ba.zip |
[connman] Enabled specific scan for Multiple APs.submit/tizen/20170822.002714submit/tizen/20170821.070104
Change-Id: I2156778ed0bcc703e8823c7eccaf344ab21503c1
Signed-off-by: Niraj Kumar Goit <niraj.g@samsung.com>
-rwxr-xr-x | gsupplicant/supplicant.c | 6 | ||||
-rwxr-xr-x | plugins/wifi.c | 32 | ||||
-rwxr-xr-x | src/technology.c | 7 |
3 files changed, 32 insertions, 13 deletions
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c index 0d5ff3bd..67a18433 100755 --- a/gsupplicant/supplicant.c +++ b/gsupplicant/supplicant.c @@ -4316,7 +4316,11 @@ static void interface_scan_params(DBusMessageIter *iter, void *user_data) supplicant_dbus_dict_append_basic(&dict, "Type", DBUS_TYPE_STRING, &type); - supplicant_dbus_dict_append_array(&dict, "SSIDs", +#if defined TIZEN_EXT + SUPPLICANT_DBG("[specific_scan] num_ssids %d", data->scan_params->num_ssids); + if (data->scan_params->num_ssids != 0) +#endif + supplicant_dbus_dict_append_array(&dict, "SSIDs", DBUS_TYPE_STRING, append_ssids, data->scan_params); diff --git a/plugins/wifi.c b/plugins/wifi.c index 7f99ace5..ce532336 100755 --- a/plugins/wifi.c +++ b/plugins/wifi.c @@ -1862,7 +1862,7 @@ static int wifi_specific_scan(enum connman_service_type type, char *ssid = NULL; struct wifi_data *wifi = connman_device_get_data(device); GSupplicantScanParams *scan_params = NULL; - struct scan_ssid *scan_ssid; + struct scan_ssid *scan_ssid = NULL; bool scanning; int ret; int freq; @@ -1887,18 +1887,22 @@ static int wifi_specific_scan(enum connman_service_type type, DBG("scan_type: %d", scan_type); if (scan_type == 1) { /* ssid based scan */ scan_params = g_try_malloc0(sizeof(GSupplicantScanParams)); - if (!scan_params) - return -ENOMEM; - - scan_ssid = g_try_new0(struct scan_ssid, 1); - if (!scan_ssid) { - g_free(scan_params); + if (!scan_params) { + DBG("Failed to allocate memory."); return -ENOMEM; } + for (list = specific_scan_list; list; list = list->next) { ssid = (char *)list->data; int ssid_len = strlen(ssid); + scan_ssid = g_try_new0(struct scan_ssid, 1); + if (!scan_ssid) { + DBG("Failed to allocate memory."); + g_supplicant_free_scan_params(scan_params); + return -ENOMEM; + } + memcpy(scan_ssid->ssid, ssid, (ssid_len + 1)); DBG("scan ssid %s len: %d", scan_ssid->ssid, ssid_len); scan_ssid->ssid_len = ssid_len; @@ -1910,19 +1914,27 @@ static int wifi_specific_scan(enum connman_service_type type, } else if (scan_type == 2) { /* frequency based scan */ scan_params = g_try_malloc0(sizeof(GSupplicantScanParams)); - if (!scan_params) + if (!scan_params) { + DBG("Failed to allocate memory."); return -ENOMEM; + } - scan_params->freqs = g_try_new0(uint16_t, 1); + guint num_freqs = g_slist_length(specific_scan_list); + DBG("num_freqs: %d", num_freqs); + + scan_params->freqs = g_try_new0(uint16_t, num_freqs); if (!scan_params->freqs) { + DBG("Failed to allocate memory."); g_free(scan_params); return -ENOMEM; } + count = 0; for (list = specific_scan_list; list; list = list->next) { freq = (int)list->data; - DBG("freq: %d", freq); + scan_params->freqs[count] = freq; + DBG("scan_params->freqs[%d]: %d", count, scan_params->freqs[count]); count++; } scan_params->num_freqs = count; diff --git a/src/technology.c b/src/technology.c index fb39d34f..c1eb3ed2 100755 --- a/src/technology.c +++ b/src/technology.c @@ -1240,7 +1240,10 @@ static DBusMessage *specific_scan(DBusConnection *conn, DBusMessage *msg, void * if (err < 0) reply_scan_pending(technology, err); - g_slist_free_full(specific_scan_list, g_free); + if (scan_type == 1) { + g_slist_free_full(specific_scan_list, g_free); + scan_type = 0; + } return NULL; } @@ -1287,9 +1290,9 @@ static const GDBusMethodTable technology_methods[] = { GDBUS_ARGS({ "name", "s" }, { "value", "v" }), NULL, set_property) }, { GDBUS_ASYNC_METHOD("Scan", NULL, NULL, scan) }, +#if defined TIZEN_EXT { GDBUS_ASYNC_METHOD("SpecificScan", GDBUS_ARGS({ "specificscan", "a{sv}" }), NULL, specific_scan) }, -#if defined TIZEN_EXT { GDBUS_METHOD("GetScanState", NULL, GDBUS_ARGS({ "scan_state", "a{sv}" }), get_scan_state) }, #endif |