Modified log for scan and net state 54/146454/3 accepted/tizen/unified/20170901.025930 submit/tizen/20170830.065642
authortaesub kim <taesub.kim@samsung.com>
Tue, 29 Aug 2017 01:43:17 +0000 (10:43 +0900)
committertaesub kim <taesub.kim@samsung.com>
Tue, 29 Aug 2017 02:10:26 +0000 (11:10 +0900)
Change-Id: I7288fe58a3abfd1ab4f21976f24302e4ca928a4b
Signed-off-by: Taesub Kim <taesub.kim@samsung.com>
src/network_dbus.c
src/network_signal.c
src/wifi_internal.c

index f190e02..959d9f4 100755 (executable)
@@ -463,7 +463,7 @@ static void __net_bssid_scan_wifi_reply(GObject *source_object, GAsyncResult *re
        }
 
        if (Error != NET_ERR_NONE) {
-               WIFI_LOG(WIFI_ERROR, "WPS scan failed[%d]", Error);
+               WIFI_LOG(WIFI_ERROR, "bssid scan failed[%d]", Error);
 
                if (request_table[NETWORK_REQUEST_TYPE_BSSID_SCAN].flag == TRUE) {
                        memset(&request_table[NETWORK_REQUEST_TYPE_BSSID_SCAN],
@@ -482,7 +482,7 @@ static void __net_bssid_scan_wifi_reply(GObject *source_object, GAsyncResult *re
                        return;
                }
        } else
-               WIFI_LOG(WIFI_INFO, "WPS scan succeed");
+               WIFI_LOG(WIFI_INFO, "bssid scan succeed");
 
        _net_dbus_pending_call_unref();
 
index cdc943d..62339c1 100755 (executable)
@@ -82,6 +82,33 @@ static int string2error(const char *error)
        return NET_ERR_UNKNOWN;
 }
 
+static const char *_convert_net_state_to_string(net_state_type_e net_state_type)
+{
+       switch (net_state_type) {
+       case NET_STATE_TYPE_UNKNOWN:
+               return "unknown";
+       case NET_STATE_TYPE_IDLE:
+               return "idle";
+       case NET_STATE_TYPE_FAILURE:
+               return "failure";
+       case NET_STATE_TYPE_ASSOCIATION:
+               return "association";
+       case NET_STATE_TYPE_CONFIGURATION:
+               return "configuration";
+       case NET_STATE_TYPE_READY:
+               return "ready";
+       case NET_STATE_TYPE_ONLINE:
+               return "online";
+       case NET_STATE_TYPE_DISCONNECT:
+               return "disconnect";
+       default:
+               WIFI_LOG(WIFI_ERROR, "Invalid net_state_type_e parameter");
+               break;
+       }
+
+       return "Invalid parameter";
+}
+
 static int __net_handle_wifi_power_rsp(gboolean value)
 {
        __NETWORK_FUNC_ENTER__;
@@ -91,9 +118,11 @@ static int __net_handle_wifi_power_rsp(gboolean value)
        if (value == TRUE) {
                NetworkInfo.wifi_state = WIFI_ON;
                event_data.Error = NET_ERR_NONE;
+               WIFI_LOG(WIFI_INFO, "wifi state: WIFI_ON");
        } else {
                NetworkInfo.wifi_state = WIFI_OFF;
                event_data.Error = NET_ERR_NONE;
+               WIFI_LOG(WIFI_INFO, "wifi state: WIFI_OFF");
 
                if (request_table[NETWORK_REQUEST_TYPE_SCAN].flag == TRUE)
                        memset(&request_table[NETWORK_REQUEST_TYPE_SCAN],
@@ -105,14 +134,12 @@ static int __net_handle_wifi_power_rsp(gboolean value)
                                0, sizeof(network_request_table_s));
 
                event_data.Event = NET_EVENT_WIFI_POWER_RSP;
-               WIFI_LOG(WIFI_INFO, "NET_EVENT_WIFI_POWER_RSP wifi state: %d",
-                               NetworkInfo.wifi_state);
+               WIFI_LOG(WIFI_INFO, "NET_EVENT_WIFI_POWER_RSP");
 
                _net_dbus_pending_call_unref();
        } else {
                event_data.Event = NET_EVENT_WIFI_POWER_IND;
-               WIFI_LOG(WIFI_INFO, "NET_EVENT_WIFI_POWER_IND wifi state: %d",
-                               NetworkInfo.wifi_state);
+               WIFI_LOG(WIFI_INFO, "NET_EVENT_WIFI_POWER_IND");
        }
 
        event_data.Datalength = sizeof(net_wifi_state_e);
@@ -450,7 +477,7 @@ static int __net_handle_service_state_changed(const gchar *sig_path,
        if (sig_path == NULL)
                return Error;
 
-       WIFI_LOG(WIFI_INFO, "[%s] %s", state, sig_path);
+       WIFI_LOG(WIFI_INFO, "profile name: %s", sig_path);
 
        if (NetworkInfo.wifi_state == WIFI_OFF) {
                WIFI_LOG(WIFI_INFO, "Wi-Fi is off");
@@ -459,7 +486,8 @@ static int __net_handle_service_state_changed(const gchar *sig_path,
 
        old_state = service_state_table;
        new_state = string2state(state);
-       WIFI_LOG(WIFI_INFO, "old state [%d], new state [%d]", old_state, new_state);
+       WIFI_LOG(WIFI_INFO, "old state [%s], new state [%s]",
+                       _convert_net_state_to_string(old_state), _convert_net_state_to_string(new_state));
 
        if (old_state == new_state)
                return Error;
index 3a0cea0..828c890 100755 (executable)
@@ -445,7 +445,7 @@ static void __state_changed_cb(char *profile_name,
        if (profile_name == NULL)
                return;
 
-       WIFI_LOG(WIFI_INFO, "%s state changed : %d", profile_name, state);
+       WIFI_LOG(WIFI_INFO, "%s state changed : %s", profile_name, __convert_ap_state_to_string(state));
 
        if (_wifi_get_callback_count_from_handle_list(WIFI_MANAGER_CONNECTION_STATE_CB)) {
                ap_info = g_try_malloc0(sizeof(net_profile_info_s));
@@ -454,14 +454,11 @@ static void __state_changed_cb(char *profile_name,
                        return;
                }
 
-               WIFI_LOG(WIFI_INFO, "[Ap info] profile name(%s) essid(%s) bssid(%s)",
-               ap_info->ProfileName, ap_info->essid, ap_info->bssid);
-
                if (profile_info)
                        memcpy(ap_info, profile_info, sizeof(net_profile_info_s));
 
                WIFI_LOG(WIFI_INFO, "[Ap info] profile name(%s) essid(%s) bssid(%s)",
-               ap_info->ProfileName, ap_info->essid, ap_info->bssid);
+                               ap_info->ProfileName, ap_info->essid, ap_info->bssid);
 
                _wifi_add_to_ap_list(ap_info);
 
@@ -664,7 +661,11 @@ static void __scan_changed_cb(wifi_manager_scan_state_e scan_state)
                                "If multi-threaded, thread integrity be broken.");
                return;
        }
-       WIFI_LOG(WIFI_INFO, "scan state: [%d]\n", scan_state);
+
+       if (scan_state == 1)
+               WIFI_LOG(WIFI_INFO, "scan state: Scan is in progress");
+       else
+               WIFI_LOG(WIFI_INFO, "scan state: Scan is not running");
 
        if (_wifi_get_callback_count_from_handle_list(WIFI_SCAN_CHANGED_CB)) {
                for (list = wifi_manager_handle_list; list; list = list->next) {