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;
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;