X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gsupplicant%2Fsupplicant.c;h=c154a0ea38e0f59c1f4d43b2ed0a610bfc3774c4;hb=6c73f51b34fa18a1a9b4582f0e1dfcaee8f2fa5e;hp=fbfa6c7f306887a4e2ed698bfde9fa5634d95c39;hpb=dce2054780e8142aebe5a7d11c4751040437f7ec;p=platform%2Fupstream%2Fconnman.git diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c index fbfa6c7..c154a0e 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)