const gchar *vsie = NULL;
int freq = 0;
int rssi = 0;
+ int sec_type = 0;
+ int enc_type = 0;
+ gboolean security_found = FALSE;
+ gboolean encryption_found = FALSE;
gboolean ssid_found = FALSE;
gboolean bssid_found = FALSE;
gboolean freq_found = FALSE;
} else if (g_strcmp0(key, "rssi") == 0) {
rssi = g_variant_get_int32(value);
rssi_found = TRUE;
+ } else if (g_strcmp0(key, "security") == 0) {
+ sec_type = g_variant_get_int32(value);
+ security_found = TRUE;
+ } else if (g_strcmp0(key, "encryption") == 0) {
+ enc_type = g_variant_get_int32(value);
+ encryption_found = TRUE;
} else if (g_strcmp0(key, "vsie") == 0) {
vsie = g_variant_get_string(value, NULL);
vsie_found = TRUE;
}
if (ssid_found == TRUE && bssid_found == TRUE &&
+ security_found == TRUE && encryption_found == TRUE &&
freq_found == TRUE && rssi_found == TRUE && vsie_found == TRUE) {
net_netlink_scan_bss_info_s *bss = NULL;
bss = g_try_new0(net_netlink_scan_bss_info_s, 1);
g_strlcpy(bss->bssid, bssid, NET_WLAN_BSSID_LEN+1);
bss->freq = freq;
bss->rssi = rssi;
+ bss->security_type = sec_type;
+ bss->encryption_type = enc_type;
+
+ WIFI_LOG(WIFI_INFO, "BSSID: %s, Freq: %d, rssi: %d, SSID: %s,"
+ "Security type : %d, Encryption type: %d", bssid, freq, rssi, ssid,
+ sec_type, enc_type);
- WIFI_LOG(WIFI_INFO, "BSSID: %s, Freq: %d, rssi: %d, SSID: %s", bssid, freq, rssi, ssid);
if (strncmp(vsie, "dd", 2) == 0) {
WIFI_LOG(WIFI_INFO, "vsie: %s", vsie);
g_strlcpy(bss->vsie, vsie, strlen(vsie)+1);
bss_info_list = g_slist_append(bss_info_list, bss);
ssid_found = bssid_found = freq_found = rssi_found = vsie_found = FALSE;
+ security_found = encryption_found = FALSE;
}
}
g_variant_iter_free(iter);
profile->frequency = (unsigned int)ap->freq;
profile->Strength = 120 + ap->rssi;
+ switch (ap->security_type) {
+ case 0:
+ profile->security_info.sec_mode = WLAN_SEC_MODE_NONE;
+ break;
+ case 1:
+ profile->security_info.sec_mode = WLAN_SEC_MODE_WEP;
+ break;
+ case 2:
+ profile->security_info.sec_mode = WLAN_SEC_MODE_WPA_PSK;
+ break;
+ case 3:
+ profile->security_info.sec_mode = WLAN_SEC_MODE_WPA2_PSK;
+ break;
+ case 4:
+ profile->security_info.sec_mode = WLAN_SEC_MODE_IEEE8021X;
+ break;
+ default:
+ profile->security_info.sec_mode = WLAN_SEC_MODE_NONE;
+ break;
+ }
+
+ switch (ap->encryption_type) {
+ case 0:
+ profile->security_info.enc_mode = WLAN_ENC_MODE_NONE;
+ break;
+ case 1:
+ profile->security_info.enc_mode = WLAN_ENC_MODE_WEP;
+ break;
+ case 2:
+ profile->security_info.enc_mode = WLAN_ENC_MODE_TKIP;
+ break;
+ case 3:
+ profile->security_info.enc_mode = WLAN_ENC_MODE_AES;
+ break;
+ case 4:
+ profile->security_info.enc_mode = WLAN_ENC_MODE_TKIP_AES_MIXED;
+ break;
+ default:
+ profile->security_info.enc_mode = WLAN_ENC_MODE_NONE;
+ break;
+ }
+
bss_profile_iterator = g_slist_append(bss_profile_iterator,
(net_profile_info_s *)profile);
}
char *essid = NULL;
int freq;
int rssi;
+ wifi_manager_security_type_e sec_type;
+ wifi_manager_encryption_type_e enc_type;
if (wifi_manager_ap_get_bssid(ap, &bssid) != WIFI_MANAGER_ERROR_NONE) {
printf("Failed to get bssid for ap\n");
return false;
}
+ if (wifi_manager_ap_get_security_type(ap, &sec_type) != WIFI_MANAGER_ERROR_NONE) {
+ printf("Failed to get security type for ap\n");
+ g_free(bssid);
+ g_free(essid);
+ return false;
+ }
+
+ if (wifi_manager_ap_get_encryption_type(ap, &enc_type) != WIFI_MANAGER_ERROR_NONE) {
+ printf("Failed to get encryption type for ap\n");
+ g_free(bssid);
+ g_free(essid);
+ return false;
+ }
+
printf("%s, %d, %d, %s\n", bssid, freq, rssi, essid);
+ printf("Security type : ");
+ switch (sec_type) {
+ case WIFI_MANAGER_SECURITY_TYPE_NONE:
+ printf("NONE, ");
+ break;
+ case WIFI_MANAGER_SECURITY_TYPE_WEP:
+ printf("WEP, ");
+ break;
+ case WIFI_MANAGER_SECURITY_TYPE_WPA_PSK:
+ printf("WPAPSK, ");
+ break;
+ case WIFI_MANAGER_SECURITY_TYPE_WPA2_PSK:
+ printf("WPA2PSK, ");
+ break;
+ case WIFI_MANAGER_SECURITY_TYPE_EAP:
+ printf("EAP, ");
+ break;
+ default:
+ break;
+ }
+ printf("Encryption type : ");
+ switch (enc_type) {
+ case WIFI_MANAGER_ENCRYPTION_TYPE_NONE:
+ printf("NONE\n");
+ break;
+ case WIFI_MANAGER_ENCRYPTION_TYPE_WEP:
+ printf("WEP\n");
+ break;
+ case WIFI_MANAGER_ENCRYPTION_TYPE_TKIP:
+ printf("TKIP\n");
+ break;
+ case WIFI_MANAGER_ENCRYPTION_TYPE_AES:
+ printf("CCMP\n");
+ break;
+ case WIFI_MANAGER_ENCRYPTION_TYPE_TKIP_AES_MIXED:
+ printf("Mixed\n");
+ break;
+ default:
+ break;
+ }
g_free(bssid);
g_free(essid);