[UTC][wifi-manager][Non-ACR][Update WiFi activation callback to reduce the impact... 32/216032/1
authorJaehyun Kim <jeik01.kim@samsung.com>
Fri, 18 Oct 2019 10:38:38 +0000 (19:38 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Fri, 18 Oct 2019 10:38:38 +0000 (19:38 +0900)
Change-Id: I47530de79637aebe9f3e5e0664af004d46752767
Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
src/utc/wifi-manager/utc-wifi-manager-common.c
src/utc/wifi-manager/utc-wifi-manager.c

index 377119ed021a6c9727896baabb5bf5249831a6a0..a85c6d51a8e8acc439016d72c50b4f6d95cd4fc8 100755 (executable)
@@ -157,24 +157,8 @@ void wifi_manager_deactivated_callback(wifi_manager_error_e result, void* user_d
 {
        PRINT_RETURN("wifi_manager_deactivate_callback", result);
 
-       int ret = WIFI_MANAGER_ERROR_NONE;
-       int data = (int)user_data;
        g_nCallbackRet = result;
-
-       switch (data) {
-       case 1:
-               ret = wifi_manager_activate(g_hWifi, wifi_manager_activated_callback, NULL);
-               PRINT_RETURN("wifi_manager_activate", ret);
-               break;
-       case 2:
-               ret = wifi_manager_activate_with_wifi_picker_tested(g_hWifi, wifi_manager_activated_with_picker_callback, NULL);
-               PRINT_RETURN("wifi_manager_activate_with_wifi_picker_tested", ret);
-               break;
-       default :
-               /* FPRINTF("[%s:%d] user_data is Unknown\\n", __FILE__, __LINE__); */
-               QUIT_GMAIN_LOOP;
-               break;
-       }
+       QUIT_GMAIN_LOOP;
 }
 
 void wifi_manager_activated_with_picker_callback(wifi_manager_error_e result, void* user_data)
index baee4dbc64dfdf8b47403949acae3a50976ca2bd..a65030925730af6a13316b445be1dedd659770e0 100755 (executable)
@@ -142,25 +142,25 @@ int utc_wifi_manager_activate_p(void)
        CHECK_RETURN("wifi_manager_is_activated", ret, WIFI_MANAGER_ERROR_NONE);
 
        if (activated) {
-               ret = wifi_manager_deactivate(g_hWifi, wifi_manager_deactivated_callback, (void *)1);
+               ret = wifi_manager_deactivate(g_hWifi, wifi_manager_deactivated_callback, NULL);
                PRINT_RETURN("wifi_manager_deactivate", ret);
 
                RUN_GMAIN_LOOP;
-       } else {
+       }
+
+       ret = wifi_manager_activate(g_hWifi, wifi_manager_activated_callback, NULL);
+       PRINT_RETURN("wifi_manager_activate", ret);
+
+       RUN_GMAIN_LOOP;
+
+       while (retry_count < WIFI_ACTIVATION_RETRY &&
+                       g_nCallbackRet != WIFI_MANAGER_ERROR_NONE) {
+               sleep(5);
                ret = wifi_manager_activate(g_hWifi, wifi_manager_activated_callback, NULL);
                PRINT_RETURN("wifi_manager_activate", ret);
+               retry_count++;
 
                RUN_GMAIN_LOOP;
-
-               while (retry_count < WIFI_ACTIVATION_RETRY &&
-                               g_nCallbackRet != WIFI_MANAGER_ERROR_NONE) {
-                       sleep(5);
-                       ret = wifi_manager_activate(g_hWifi, wifi_manager_activated_callback, NULL);
-                       PRINT_RETURN("wifi_manager_activate", ret);
-                       retry_count++;
-
-                       RUN_GMAIN_LOOP;
-               }
        }
 
        CHECK_RETURN(CALLBACK_RETURN, g_nCallbackRet, WIFI_MANAGER_ERROR_NONE);
@@ -214,23 +214,23 @@ int utc_wifi_manager_activate_with_wifi_picker_tested_p(void)
        CHECK_RETURN("wifi_manager_is_activated", ret, WIFI_MANAGER_ERROR_NONE);
 
        if (activated) {
-               ret = wifi_manager_deactivate(g_hWifi, wifi_manager_deactivated_callback, (void *)2);
+               ret = wifi_manager_deactivate(g_hWifi, wifi_manager_deactivated_callback, NULL);
                PRINT_RETURN("wifi_manager_deactivate", ret);
 
                RUN_GMAIN_LOOP;
-       } else {
+       }
+
+       ret = wifi_manager_activate_with_wifi_picker_tested(g_hWifi, wifi_manager_activated_with_picker_callback, NULL);
+       PRINT_RETURN("wifi_manager_activate_with_wifi_picker_tested", ret);
+
+       while (retry_count < WIFI_ACTIVATION_RETRY &&
+                       g_nCallbackRet != WIFI_MANAGER_ERROR_NONE) {
+               sleep(5);
                ret = wifi_manager_activate_with_wifi_picker_tested(g_hWifi, wifi_manager_activated_with_picker_callback, NULL);
                PRINT_RETURN("wifi_manager_activate_with_wifi_picker_tested", ret);
+               retry_count++;
 
-               while (retry_count < WIFI_ACTIVATION_RETRY &&
-                               g_nCallbackRet != WIFI_MANAGER_ERROR_NONE) {
-                       sleep(5);
-                       ret = wifi_manager_activate_with_wifi_picker_tested(g_hWifi, wifi_manager_activated_with_picker_callback, NULL);
-                       PRINT_RETURN("wifi_manager_activate_with_wifi_picker_tested", ret);
-                       retry_count++;
-
-                       RUN_GMAIN_LOOP;
-               }
+               RUN_GMAIN_LOOP;
        }
 
        CHECK_RETURN(CALLBACK_RETURN, g_nCallbackRet, WIFI_MANAGER_ERROR_NONE);