Return error code when failed to turn Wi-Fi on 76/196876/2 submit/tizen_4.0/20190109.002415
authorSeonah Moon <seonah1.moon@samsung.com>
Mon, 7 Jan 2019 07:53:48 +0000 (16:53 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Tue, 8 Jan 2019 09:23:01 +0000 (18:23 +0900)
Change-Id: I2157832dd83fa7c9aa0867a854204baaef8c7c10

src/wifi_internal.c

index c12855f9dd1134c5b2447bf910818c7bc2f9375c..0a3ed9a9eaba9517a6cf627f9cce25c47faef972 100755 (executable)
@@ -581,8 +581,12 @@ static void __power_on_off_cb(net_event_info_s *event_cb, bool is_requested)
        if (_wifi_get_callback_count_from_handle_list(WIFI_ACTIVATED_CB)) {
                for (list = wifi_manager_handle_list; list; list = list->next) {
                        wifi_manager_handle_s *local_handle = (wifi_manager_handle_s *)list->data;
-                       if (local_handle->activated_cb)
+                       if (local_handle->activated_cb) {
+                               if (*wifi_state == WIFI_OFF
+                                               && error_code == WIFI_MANAGER_ERROR_NONE)
+                                       error_code = WIFI_MANAGER_ERROR_OPERATION_FAILED;
                                local_handle->activated_cb(error_code, local_handle->activated_user_data);
+                       }
 
                        local_handle->activated_cb = NULL;
                        local_handle->activated_user_data = NULL;
@@ -592,8 +596,12 @@ static void __power_on_off_cb(net_event_info_s *event_cb, bool is_requested)
        if (_wifi_get_callback_count_from_handle_list(WIFI_DEACTIVATED_CB)) {
                for (list = wifi_manager_handle_list; list; list = list->next) {
                        wifi_manager_handle_s *local_handle = (wifi_manager_handle_s *)list->data;
-                       if (local_handle->deactivated_cb != NULL)
+                       if (local_handle->deactivated_cb != NULL) {
+                               if (*wifi_state == WIFI_ON
+                                               && error_code == WIFI_MANAGER_ERROR_NONE)
+                                       error_code = WIFI_MANAGER_ERROR_OPERATION_FAILED;
                                local_handle->deactivated_cb(error_code, local_handle->deactivated_user_data);
+                       }
 
                        local_handle->deactivated_cb = NULL;
                        local_handle->deactivated_user_data = NULL;