From: Youngjae Shin Date: Fri, 8 Nov 2019 01:58:34 +0000 (+0900) Subject: fix unhandled case of wifi power X-Git-Tag: submit/tizen/20200406.072014~24 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cc51cf934a2cce7dd432f7f69f665f96db427e5f;p=platform%2Fcore%2Fsystem%2Fmodes-plugins.git fix unhandled case of wifi power --- diff --git a/wifi/WifiActionPower.cpp b/wifi/WifiActionPower.cpp index 8993a4c..0af2edd 100644 --- a/wifi/WifiActionPower.cpp +++ b/wifi/WifiActionPower.cpp @@ -24,12 +24,13 @@ MODES_NAMESPACE_USE; const std::string WifiActionPower::NAME = "power"; WifiActionPower::WifiActionPower() - : WifiAction(NAME), cb(NULL), cbData(NULL), oldVal(false) + : WifiAction(NAME), cb(NULL), cbData(NULL), oldVal(false), requestVal(false) { } int WifiActionPower::set(bool val) { + requestVal = val; wifi_manager_is_activated(handle, &oldVal); if (oldVal == val) { INFO("Already wifi is [%s]", val ? "On" : "Off"); @@ -130,7 +131,7 @@ void WifiActionPower::wifiStateChangedCB(wifi_manager_device_state_e state, void RET_IF(NULL == user_data); - bool changedVal = action->oldVal; + bool changedVal = action->requestVal; if (state == WIFI_MANAGER_DEVICE_STATE_ACTIVATED) changedVal = true; else if (state == WIFI_MANAGER_DEVICE_STATE_DEACTIVATED) @@ -140,7 +141,7 @@ void WifiActionPower::wifiStateChangedCB(wifi_manager_device_state_e state, void INFO("state:%d", state); - if (changedVal == action->oldVal) { + if (changedVal != action->requestVal) { valueChangedCB cb = action->cb; void *cbData = action->cbData; //TODO: revise after revising the modes(because of piAction free) diff --git a/wifi/WifiActionPower.h b/wifi/WifiActionPower.h index 9cc77ed..7132f01 100644 --- a/wifi/WifiActionPower.h +++ b/wifi/WifiActionPower.h @@ -39,6 +39,7 @@ private: static void deactivateCB(wifi_manager_error_e result, void *user_data); static void wifiStateChangedCB(wifi_manager_device_state_e state, void * user_data); bool oldVal; + bool requestVal; }; MODES_NAMESPACE_END