return WLAN_SEC_EAP_AUTH_NONE;
}
-static int __net_update_connected_wifi_info(net_profile_info_t* ProfInfo)
-{
- static char ifname[NET_MAX_DEVICE_NAME_LEN+1] = { '\0', };
- static char interface_path[DBUS_OBJECT_PATH_MAX] = { '\0', };
- char current_bss_path[DBUS_OBJECT_PATH_MAX] = { '\0', };
- net_err_t Error = NET_ERR_NONE;
- GVariant *params = NULL;
- GVariant *reply = NULL;
- GVariant *value = NULL;
- GVariantIter *iter = NULL;
- gchar *key = NULL;
- const char *path = NULL;
-
- /* Get proper interface */
- if (g_strcmp0(ProfInfo->ProfileInfo.Wlan.net_info.DevName, ifname) != 0) {
- g_strlcpy(ifname, ProfInfo->ProfileInfo.Wlan.net_info.DevName,
- NET_MAX_DEVICE_NAME_LEN+1);
-
- params = g_variant_new("(s)", ifname);
- reply = _net_invoke_dbus_method(SUPPLICANT_SERVICE, SUPPLICANT_PATH,
- SUPPLICANT_INTERFACE, "GetInterface", params, &Error);
- if (reply == NULL) {
- ifname[0] = '\0';
- NETWORK_LOG(NETWORK_ERROR, "Failed to get Wi-Fi interface");
- return Error;
- }
- g_variant_get(reply, "(o)", &path);
- g_strlcpy(interface_path, path, DBUS_OBJECT_PATH_MAX);
-
- g_variant_unref(reply);
- }
-
- /* Get CurrentBSS object path */
- params = g_variant_new("(ss)", SUPPLICANT_IFACE_INTERFACE, "CurrentBSS");
- reply = _net_invoke_dbus_method(SUPPLICANT_SERVICE, interface_path,
- DBUS_PROPERTIES_INTERFACE, "Get", params, &Error);
- if (reply == NULL) {
- NETWORK_LOG(NETWORK_ERROR, "Failed to get CurrentBSS");
- return Error;
- }
- g_variant_get(reply, "(v)", &value);
- path = g_variant_get_string(value, NULL);
- g_strlcpy(current_bss_path, path, DBUS_OBJECT_PATH_MAX);
-
- g_variant_unref(value);
- g_variant_unref(reply);
-
- /* Get Wi-Fi information */
- params = g_variant_new("(s)", SUPPLICANT_IFACE_BSS);
- reply = _net_invoke_dbus_method(SUPPLICANT_SERVICE, current_bss_path,
- DBUS_PROPERTIES_INTERFACE, "GetAll", params, &Error);
- if (reply == NULL) {
- NETWORK_LOG(NETWORK_ERROR, "Failed to get Wi-Fi information");
- return Error;
- }
- g_variant_get(reply, "(a{sv})", &iter);
- while (g_variant_iter_loop(iter, "{sv}", &key, &value)) {
- if (g_strcmp0(key, "BSSID") == 0) {
- gsize bssid_len = 0;
- const gchar *bssid = NULL;
-
- bssid =
- g_variant_get_fixed_array(value, &bssid_len, sizeof(guchar));
- if (bssid && bssid_len == 6)
- snprintf(ProfInfo->ProfileInfo.Wlan.bssid, 18,
- "%02x:%02x:%02x:%02x:%02x:%02x",
- bssid[0], bssid[1], bssid[2],
- bssid[3], bssid[4], bssid[5]);
-
- } else if (g_strcmp0(key, "Signal") == 0) {
- ProfInfo->ProfileInfo.Wlan.Strength =
- (unsigned char)(120 + g_variant_get_int16(value));
-
- if (ProfInfo->ProfileInfo.Wlan.Strength > 100)
- ProfInfo->ProfileInfo.Wlan.Strength = 100;
-
- } else if (g_strcmp0(key, "Frequency") == 0) {
- ProfInfo->ProfileInfo.Wlan.frequency =
- (unsigned int)g_variant_get_uint16(value);
-
- } else if (g_strcmp0(key, "Rates") == 0) {
- GVariantIter *iter_sub = NULL;
- guint32 value_sub;
-
- g_variant_get(value, "au", &iter_sub);
- while (g_variant_iter_loop(iter_sub, "u", &value_sub)) {
- ProfInfo->ProfileInfo.Wlan.max_rate = (unsigned int)value_sub;
- break;
- }
-
- g_variant_iter_free(iter_sub);
- }
- }
-
- g_variant_iter_free(iter);
- g_variant_unref(reply);
-
- return Error;
-}
-
static int __net_extract_wifi_info(GVariantIter *array, net_profile_info_t* ProfInfo)
{
net_err_t Error = NET_ERR_NONE;
Error = __net_extract_common_info(key, var, ProfInfo);
}
- /* If there are multiple Wi-Fi networks which have the same SSID,
- * and one of them is connected, we need to get the connected one
- * rather than ConnMan grouped properties.
- */
- if (ProfInfo->ProfileState == NET_STATE_TYPE_READY ||
- ProfInfo->ProfileState == NET_STATE_TYPE_ONLINE)
- Error = __net_update_connected_wifi_info(ProfInfo);
-
__NETWORK_FUNC_EXIT__;
return Error;
}