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