Merge "Add freq/rssi info to AP list in the test app" into tizen
authorJaehyun Kim <jeik01.kim@samsung.com>
Wed, 27 Dec 2023 06:31:44 +0000 (06:31 +0000)
committerGerrit Code Review <gerrit@review>
Wed, 27 Dec 2023 06:31:44 +0000 (06:31 +0000)
src/network_dbus.c
src/wifi_config.c
tools/manager-test/wman_test_config.c

index b628ac4..fa67b17 100755 (executable)
@@ -4018,59 +4018,57 @@ int _net_dbus_config_load_configurations(network_info_s *network_info,
 
        g_variant_get(message, "(a{sv})", &iter);
        while (g_variant_iter_loop(iter, "{sv}", &field, &value)) {
-               if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
-                       if (g_strcmp0(field, WIFI_CONFIG_NAME) == 0) {
-                               *name = g_strdup(g_variant_get_string(value, NULL));
-                       } else if (g_strcmp0(field, WIFI_CONFIG_PASSPHRASE) == 0) {
-                               *passphrase = g_strdup(g_variant_get_string(value, NULL));
-                       } else if (g_strcmp0(field, WIFI_CONFIG_SECURITY_TYPE) == 0) {
-                               *security_type = __net_wifi_security_type_to_int(g_variant_get_string(value, NULL));
-                       } else if (g_strcmp0(field, WIFI_CONFIG_HIDDEN) == 0) {
-                               const gchar *r_hidden = g_variant_get_string(value, NULL);
-                               if (g_strcmp0(r_hidden, "TRUE") == 0)
-                                       *is_hidden = TRUE;
-                               else
-                                       *is_hidden = FALSE;
-                       } else if (g_strcmp0(field, WIFI_CONFIG_FREQUENCY) == 0) {
-                               *frequency = g_variant_get_uint32(value);
-                       } else if (g_strcmp0(field, WIFI_CONFIG_PROXYADDRESS) == 0) {
-                               const gchar *r_proxy_address = g_variant_get_string(value, NULL);
-                               if (g_strcmp0(r_proxy_address, "NONE") == 0)
-                                       *proxy_address = NULL;
-                               else
-                                       *proxy_address = g_strdup(r_proxy_address);
-                       } else if (g_strcmp0(field, WIFI_CONFIG_IPV4_METHOD) == 0) {
-                               const gchar *type = g_variant_get_string(value, NULL);
-                               if (g_strcmp0(type, "manual") == 0)
-                                       (*ip_info)->ip_type = NET_IP_CONFIG_TYPE_STATIC;
-                               else if (g_strcmp0(type, "dhcp") == 0)
-                                       (*ip_info)->ip_type = NET_IP_CONFIG_TYPE_DYNAMIC;
-                       } else if (g_strcmp0(field, WIFI_CONFIG_IPV4_ADDRESS) == 0) {
-                               const gchar *ip_address = g_variant_get_string(value, NULL);
-                               (*ip_info)->ip_address = g_strdup(ip_address);
-                       } else if (g_strcmp0(field, WIFI_CONFIG_IPV4_SUBNET_MASK) == 0) {
-                               const gchar *subnet_mask = g_variant_get_string(value, NULL);
-                               (*ip_info)->subnet_mask = g_strdup(subnet_mask);
-                       } else if (g_strcmp0(field, WIFI_CONFIG_IPV6_PREFIX_LEN) == 0) {
-                               int prefix_len = g_variant_get_int32(value);
-                               (*ip_info)->prefix_length = prefix_len;
-                       } else if (g_strcmp0(field, WIFI_CONFIG_IPV4_GATEWAY_ADDRESS) == 0) {
-                               const gchar *gateway_address = g_variant_get_string(value, NULL);
-                               (*ip_info)->gateway_address = g_strdup(gateway_address);
-                       } else if (g_strcmp0(field, WIFI_CONFIG_IPV4_DNS_METHOD) == 0) {
-                               const gchar *type = g_variant_get_string(value, NULL);
-                               if (g_strcmp0(type, "manual") == 0)
-                                       (*ip_info)->dns_type = NET_DNS_CONFIG_TYPE_STATIC;
-                               else if (g_strcmp0(type, "dhcp") == 0)
-                                       (*ip_info)->dns_type = NET_DNS_CONFIG_TYPE_DYNAMIC;
-                       } else if (g_strcmp0(field, WIFI_CONFIG_DNS_ADDRESS) == 0) {
-                               const gchar *dns_address = g_variant_get_string(value, NULL);
-                               (*ip_info)->dns_address[order] = g_strdup(dns_address);
-                               order += 1;
-                               (*ip_info)->dns_count = order;
-                       } else if (g_strcmp0(field, WIFI_CONFIG_FAILURE) == 0) {
-                               *wifi_last_error = __net_wifi_last_error_to_enum(g_variant_get_string(value, NULL));
-                       }
+               if (g_strcmp0(field, WIFI_CONFIG_NAME) == 0) {
+                       *name = g_strdup(g_variant_get_string(value, NULL));
+               } else if (g_strcmp0(field, WIFI_CONFIG_PASSPHRASE) == 0) {
+                       *passphrase = g_strdup(g_variant_get_string(value, NULL));
+               } else if (g_strcmp0(field, WIFI_CONFIG_SECURITY_TYPE) == 0) {
+                       *security_type = __net_wifi_security_type_to_int(g_variant_get_string(value, NULL));
+               } else if (g_strcmp0(field, WIFI_CONFIG_HIDDEN) == 0) {
+                       const gchar *r_hidden = g_variant_get_string(value, NULL);
+                       if (g_strcmp0(r_hidden, "TRUE") == 0)
+                               *is_hidden = TRUE;
+                       else
+                               *is_hidden = FALSE;
+               } else if (g_strcmp0(field, WIFI_CONFIG_FREQUENCY) == 0) {
+                       *frequency = g_variant_get_uint32(value);
+               } else if (g_strcmp0(field, WIFI_CONFIG_PROXYADDRESS) == 0) {
+                       const gchar *r_proxy_address = g_variant_get_string(value, NULL);
+                       if (g_strcmp0(r_proxy_address, "NONE") == 0)
+                               *proxy_address = NULL;
+                       else
+                               *proxy_address = g_strdup(r_proxy_address);
+               } else if (g_strcmp0(field, WIFI_CONFIG_IPV4_METHOD) == 0) {
+                       const gchar *type = g_variant_get_string(value, NULL);
+                       if (g_strcmp0(type, "manual") == 0)
+                               (*ip_info)->ip_type = NET_IP_CONFIG_TYPE_STATIC;
+                       else if (g_strcmp0(type, "dhcp") == 0)
+                               (*ip_info)->ip_type = NET_IP_CONFIG_TYPE_DYNAMIC;
+               } else if (g_strcmp0(field, WIFI_CONFIG_IPV4_ADDRESS) == 0) {
+                       const gchar *ip_address = g_variant_get_string(value, NULL);
+                       (*ip_info)->ip_address = g_strdup(ip_address);
+               } else if (g_strcmp0(field, WIFI_CONFIG_IPV4_SUBNET_MASK) == 0) {
+                       const gchar *subnet_mask = g_variant_get_string(value, NULL);
+                       (*ip_info)->subnet_mask = g_strdup(subnet_mask);
+               } else if (g_strcmp0(field, WIFI_CONFIG_IPV6_PREFIX_LEN) == 0) {
+                       int prefix_len = g_variant_get_int32(value);
+                       (*ip_info)->prefix_length = prefix_len;
+               } else if (g_strcmp0(field, WIFI_CONFIG_IPV4_GATEWAY_ADDRESS) == 0) {
+                       const gchar *gateway_address = g_variant_get_string(value, NULL);
+                       (*ip_info)->gateway_address = g_strdup(gateway_address);
+               } else if (g_strcmp0(field, WIFI_CONFIG_IPV4_DNS_METHOD) == 0) {
+                       const gchar *type = g_variant_get_string(value, NULL);
+                       if (g_strcmp0(type, "manual") == 0)
+                               (*ip_info)->dns_type = NET_DNS_CONFIG_TYPE_STATIC;
+                       else if (g_strcmp0(type, "dhcp") == 0)
+                               (*ip_info)->dns_type = NET_DNS_CONFIG_TYPE_DYNAMIC;
+               } else if (g_strcmp0(field, WIFI_CONFIG_DNS_ADDRESS) == 0) {
+                       const gchar *dns_address = g_variant_get_string(value, NULL);
+                       (*ip_info)->dns_address[order] = g_strdup(dns_address);
+                       order += 1;
+                       (*ip_info)->dns_count = order;
+               } else if (g_strcmp0(field, WIFI_CONFIG_FAILURE) == 0) {
+                       *wifi_last_error = __net_wifi_last_error_to_enum(g_variant_get_string(value, NULL));
                }
        }
 
index fe6afae..af86dc1 100644 (file)
@@ -130,6 +130,7 @@ EXPORT_API int wifi_manager_config_clone(wifi_manager_config_h origin, wifi_mana
        h->name = g_strdup(config->name);
        h->passphrase = g_strdup(config->passphrase);
        h->security_type = config->security_type;
+       h->frequency = config->frequency;
        h->is_created = FALSE;
        h->is_saved = config->is_saved;
        h->is_hidden = config->is_hidden;
@@ -894,6 +895,7 @@ EXPORT_API int wifi_manager_config_get_frequency(wifi_manager_config_h config,
        }
 
        *frequency = h->frequency;
+       WIFI_LOG(WIFI_ERROR, "Frequency: %d", *frequency); //LCOV_EXCL_LINE
 
        __NETWORK_CAPI_FUNC_EXIT__;
        return WIFI_MANAGER_ERROR_NONE;
index 78af3f1..a575739 100644 (file)
 #include <stdio.h>
 #include <stdlib.h>
 #include <wifi-manager.h>
+#include <wifi-manager-extension.h>
 #include "wman_test_common.h"
 
 static bool __test_config_list_cb(const wifi_manager_config_h config, void *user_data)
 {
        char *name = NULL;
        wifi_manager_security_type_e security_type;
+       int freq = 0;
 
        wifi_manager_config_get_name(config, &name);
        wifi_manager_config_get_security_type(config, &security_type);
+       wifi_manager_config_get_frequency(config, &freq);
 
        printf("Name[%s] ", name);
        printf("Security type[%d] ", security_type);
+       printf("Frequency[%d] ", freq);
        if (security_type == WIFI_MANAGER_SECURITY_TYPE_EAP) {
                wifi_manager_eap_type_e eap_type;
                wifi_manager_eap_auth_type_e eap_auth_type;