diff options
author | Mayank Haarit <mayank.h@samsung.com> | 2018-04-20 20:57:32 +0530 |
---|---|---|
committer | Mayank Haarit <mayank.h@samsung.com> | 2018-04-20 15:39:29 +0000 |
commit | 6c73f51b34fa18a1a9b4582f0e1dfcaee8f2fa5e (patch) | |
tree | c1df62ff68b833ec3a00f05617bb77cbdf85c588 /gsupplicant/supplicant.c | |
parent | dce2054780e8142aebe5a7d11c4751040437f7ec (diff) | |
download | connman-6c73f51b34fa18a1a9b4582f0e1dfcaee8f2fa5e.tar.gz connman-6c73f51b34fa18a1a9b4582f0e1dfcaee8f2fa5e.tar.bz2 connman-6c73f51b34fa18a1a9b4582f0e1dfcaee8f2fa5e.zip |
Add BSSID , signal strength and frequency list of the APssubmit/tizen/20180424.084858accepted/tizen/unified/20180425.062309
This patch sends the list of BSSID, signal strength and
frequency of an APs having same SSID and Security type.
Change-Id: I368d37de310687ca173418dfad91fae7082b2357
Signed-off-by: Mayank Haarit <mayank.h@samsung.com>
Diffstat (limited to 'gsupplicant/supplicant.c')
-rw-r--r-- | gsupplicant/supplicant.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c index fbfa6c7f..c154a0ea 100644 --- a/gsupplicant/supplicant.c +++ b/gsupplicant/supplicant.c @@ -321,6 +321,14 @@ struct interface_scan_data { void *user_data; }; +#if defined TIZEN_EXT +struct g_connman_bssids { + char bssid[18]; + uint16_t strength; + uint16_t frequency; +}; +#endif + static int network_remove(struct interface_data *data); static inline void debug(const char *format, ...) @@ -1595,6 +1603,46 @@ void *g_supplicant_network_get_wifi_vsie(GSupplicantNetwork *network) return vsie_list; } + +static void update_bssid_list(gpointer key, gpointer value, gpointer user_data) +{ + struct g_supplicant_bss *bss = value; + struct g_connman_bssids *bssids = NULL; + char buff[18]; + GSList **list = (GSList **)user_data; + + bssids = (struct g_connman_bssids *)g_try_malloc0(sizeof(struct g_connman_bssids)); + + if (bssids) { + g_snprintf(buff, 18, "%02x:%02x:%02x:%02x:%02x:%02x", + bss->bssid[0], bss->bssid[1], bss->bssid[2], bss->bssid[3], + bss->bssid[4], bss->bssid[5]); + + memcpy(bssids->bssid, buff, 18); + bssids->bssid[17] = '\0'; + bssids->strength = bss->signal; + bssids->strength += 120; + + if (bssids->strength > 100) + bssids->strength = 100; + + bssids->frequency = bss->frequency; + *list = g_slist_append(*list, bssids); + } else + SUPPLICANT_DBG("Failed to allocate memory"); +} + +void *g_supplicant_network_get_bssid_list(GSupplicantNetwork *network) +{ + GSList *bssid_list = NULL; + + if (g_hash_table_size(network->bss_table) < 1) + return NULL; + + g_hash_table_foreach(network->bss_table, update_bssid_list, &bssid_list); + + return bssid_list; +} #endif static void merge_network(GSupplicantNetwork *network) |