revise piAction life cycle and returning undo()
authorYoungjae Shin <yj99.shin@samsung.com>
Wed, 13 Nov 2019 02:00:52 +0000 (11:00 +0900)
committerYoungjae Shin <yj99.shin@samsung.com>
Thu, 19 Mar 2020 04:30:37 +0000 (13:30 +0900)
36 files changed:
app/AppActionLaunch.cpp
app/AppActionLaunch.h
app/AppPlugin.cpp
bluetooth/BtActionPower.cpp
bluetooth/BtActionPower.h
bluetooth/BtPlugin.cpp
display/DisplayAllowPalmTouch.cpp
display/DisplayAllowPalmTouch.h
display/DisplayBrightness.cpp
display/DisplayBrightness.h
display/DisplayPlugin.cpp
display/DisplayTimeout.cpp
display/DisplayTimeout.h
media/MediaPlayer.cpp
media/MediaPlayer.h
pkg/PkgEnableSupportMode.cpp
pkg/PkgEnableSupportMode.h
pkg/PkgPlugin.cpp
unittests/mdsp_test_app.cpp
unittests/mdsp_test_display.cpp
unittests/mdsp_test_media.cpp
unittests/mdsp_test_pkg.cpp
unittests/mdsp_test_vconf.cpp
vconf/VconfAction.cpp
vconf/VconfAction.h
vconf/VconfActionBool.cpp
vconf/VconfActionBool.h
vconf/VconfActionDbl.cpp
vconf/VconfActionDbl.h
vconf/VconfActionInt.cpp
vconf/VconfActionInt.h
vconf/VconfActionStr.cpp
vconf/VconfActionStr.h
wifi/WifiActionPower.cpp
wifi/WifiActionPower.h
wifi/WifiPlugin.cpp

index a6ff7c23340f0c260fa7d9c10f2d2d8857b1540e..b9ea121717c7ef644861854c072d1d24e0f6304f 100644 (file)
@@ -103,7 +103,7 @@ int AppActionLaunch::get(std::string *val)
        return MODES_ERROR_NONE;
 }
 
-int AppActionLaunch::undo()
+void AppActionLaunch::undo()
 {
        bool running;
        app_context_h runAppContext;
@@ -111,7 +111,7 @@ int AppActionLaunch::undo()
        app_manager_is_running(appID.c_str(), &running);
        if (!running) {
                DBG("It's NOT running");
-               return MODES_ERROR_NONE;
+               return;
        }
 
        int ret = app_manager_unset_app_context_status_cb(appContextStatusCallback, appID.c_str());
@@ -123,14 +123,11 @@ int AppActionLaunch::undo()
        ret = app_manager_get_app_context(appID.c_str(), &runAppContext);
        if (APP_MANAGER_ERROR_NONE != ret) {
                ERR("app_manager_get_app_context(%s) Fail(%s)", appID.c_str(), get_error_message(ret));
-               return MODES_ERROR_SYSTEM;
+               return;
        }
        ret = app_manager_terminate_app(runAppContext);
-       if (APP_MANAGER_ERROR_NONE != ret) {
+       if (APP_MANAGER_ERROR_NONE != ret)
                ERR("app_manager_terminate_app() Fail(%s)", get_error_message(ret));
-               return MODES_ERROR_SYSTEM;
-       }
-       return MODES_ERROR_NONE;
 }
 
 std::string AppActionLaunch::serialize()
index 818457da86b640a33f0421b7e7b32f430f6295e9..2e8516ba91c5363926eb106e07ddaced89750018 100644 (file)
@@ -30,7 +30,7 @@ public:
 
        int set(const std::string &val) override;
        int get(std::string *val) override;
-       int undo() override;
+       void undo() override;
        std::string serialize() override;
        int parse(const std::string &data) override;
        static void appContextStatusCallback(app_context_h app_context, app_context_status_e status, void *user_data);
index 9204ca8699c45ff371c4ef0e1d42b61ca44f3809..3961da44f20f42b5f75b6c2d0d936cbee7c8cd33 100644 (file)
@@ -27,7 +27,7 @@ public:
        ~AppPlugin();
 
        int set(const std::string &key, const std::string &val, PluginAction **piAction) override;
-       int undo(PluginAction *piAction) override;
+       void undo(PluginAction *piAction) override;
        PluginAction* getUndoAction(const std::string &key, const std::string &info) override;
 private:
        AppFactory appFactory;
@@ -68,17 +68,15 @@ int AppPlugin::set(const std::string &key, const std::string &val, PluginAction
        return ret;
 }
 
-int AppPlugin::undo(PluginAction *piAction)
+void AppPlugin::undo(PluginAction *piAction)
 {
        AppAction *action = static_cast<AppAction*>(piAction);
-       RETV_IF(nullptr == action, MODES_ERROR_INVALID_PARAMETER);
+       RET_IF(nullptr == piAction);
 
        DBG("Action(%s) undo", action->getName().c_str());
 
-       int ret = action->undo();
+       action->undo();
        appFactory.destroyAction(action);
-
-       return ret;
 }
 
 PluginAction* AppPlugin::getUndoAction(const std::string &key, const std::string &info)
index 0c8733292254110800607715d560344ad1379ae5..900b6394809908386e7868609bbb6f3065b8b139 100644 (file)
@@ -60,9 +60,9 @@ int BtActionPower::set(bool val)
        return MODES_ERROR_NONE;
 }
 
-int BtActionPower::undo()
+void BtActionPower::undo()
 {
-       return set(undoVal);
+       set(undoVal);
 }
 
 std::string BtActionPower::serialize()
index dba36ef9dcf7954360c50333cafbbd4e5c5e10af..8c2762fe34fe7ac6403c4aacd2da49f0d94e109e 100644 (file)
@@ -26,7 +26,7 @@ public:
        BtActionPower();
 
        int set(bool val) override;
-       int undo() override;
+       void undo() override;
        std::string serialize() override;
        int parse(const std::string & archive) override;
 private:
index ab5777429b77f7ab7e746a98962aab5325a3b1f0..f3fd2a7d3cf3edcda8649f7e7dffe02a694db936 100644 (file)
@@ -31,7 +31,7 @@ public:
        int set(const std::string &key, double val, PluginAction **piAction) override;
        int set(const std::string &key, bool val, PluginAction **piAction) override;
        int set(const std::string &key, const std::string &val, PluginAction **piAction) override;
-       int undo(PluginAction *piAction) override;
+       void undo(PluginAction *piAction) override;
        PluginAction* getUndoAction(const std::string &key, const std::string &info) override;
 private:
        BtFactory btFactory;
@@ -120,17 +120,15 @@ int BtPlugin::set(const std::string &key, const std::string &val, PluginAction *
        return ret;
 }
 
-int BtPlugin::undo(PluginAction *piAction)
+void BtPlugin::undo(PluginAction *piAction)
 {
        BtAction *action = static_cast<BtAction*>(piAction);
-       RETV_IF(nullptr == action, MODES_ERROR_INVALID_PARAMETER);
+       RET_IF(nullptr == piAction);
 
        DBG("Action(%s) undo", action->getName().c_str());
 
-       int ret = action->undo();
+       action->undo();
        btFactory.destroyAction(action);
-
-       return ret;
 }
 
 PluginAction* BtPlugin::getUndoAction(const std::string &key, const std::string &info)
index b527591f90a688f85c5c1f593e8f3641b88d42a1..24f0962f19a36e86cc40fd22768a25cfe4a13a8e 100644 (file)
@@ -77,9 +77,9 @@ int DisplayAllowPalmTouch::set(bool val)
        return modesRet;
 }
 
-int DisplayAllowPalmTouch::undo()
+void DisplayAllowPalmTouch::undo()
 {
-       return set(true);
+       set(true);
 }
 
 std::string DisplayAllowPalmTouch::serialize()
index a3cf5c788c459dd691994ce5a1fa8ddeb8785c8f..8c29b3ec61f0d2c0ac80835f9230f68210ac5e49 100644 (file)
@@ -27,7 +27,7 @@ public:
        ~DisplayAllowPalmTouch();
 
        int set(bool val) override;
-       int undo() override;
+       void undo() override;
        std::string serialize() override;
        int parse(const std::string &archive) override;
 
index d3ccf155732cd16e814238817b154996a74ac645..536c651b09da2d37672d1b9f754660fdf1223e8d 100644 (file)
@@ -59,17 +59,14 @@ int DisplayBrightness::set(int val)
        return MODES_ERROR_NONE;
 }
 
-int DisplayBrightness::undo()
+void DisplayBrightness::undo()
 {
        int i = 0;
        for (auto it = oldValList.begin(); it != oldValList.end(); ++it, ++i) {
                int ret = device_display_set_brightness(i, *it);
-               if (DEVICE_ERROR_NONE != ret) {
+               if (DEVICE_ERROR_NONE != ret)
                        ERR("device_display_set_brightness(%d, %d) Fail(%s)", i, *it, get_error_message(ret));
-                       return MODES_ERROR_SYSTEM;
-               }
        }
-       return MODES_ERROR_NONE;
 }
 
 std::string DisplayBrightness::serialize()
index ac36a192eab3449c102aba10a991f2fc1f4e2c3c..eeb841b0891cd3dab80ab719ef3c6e3756164dd5 100644 (file)
@@ -28,7 +28,7 @@ public:
        ~DisplayBrightness();
 
        int set(int val) override;
-       int undo() override;
+       void undo() override;
        std::string serialize() override;
        int parse(const std::string &archive) override;
 
index a6e53f2ecb7786ca9002a3785f42f2e9eb5b9d63..c58e9754d9fdce1b4e36e048880723a0ae484c20 100644 (file)
@@ -32,7 +32,7 @@ public:
        int set(const std::string &key, bool val, PluginAction **pluginAction) override;
        PluginAction* getUndoAction(const std::string &key, const std::string &info) override;
 
-       int undo(PluginAction *pluginAction) override;
+       void undo(PluginAction *pluginAction) override;
 
 private:
        DisplayFactory displayFactory;
@@ -104,16 +104,14 @@ PluginAction* DisplayPlugin::getUndoAction(const std::string &key, const std::st
        return action;
 }
 
-int DisplayPlugin::undo(PluginAction *pluginAction)
+void DisplayPlugin::undo(PluginAction *pluginAction)
 {
        DisplayAction *action = static_cast<DisplayAction*>(pluginAction);
-       RETV_IF(nullptr == action, MODES_ERROR_INVALID_PARAMETER);
+       RET_IF(nullptr == pluginAction);
 
        DBG("Action(%s) undo", action->getName().c_str());
 
-       int ret = action->undo();
+       action->undo();
        displayFactory.destroyAction(action);
-
-       return ret;
 }
 
index c4dbc230f31cadf3eaab996c84f99082112f5e66..f45cc6c9dae8fd4800f6978334bd663a128e268c 100644 (file)
@@ -48,16 +48,12 @@ int DisplayTimeout::set(int val)
        return MODES_ERROR_NONE;
 }
 
-int DisplayTimeout::undo()
+void DisplayTimeout::undo()
 {
-       DBG("undo Display Timeout(%s, %d)",
-                       key, oldDisplayTimeout);
+       DBG("undo Display Timeout(%s, %d)", key, oldDisplayTimeout);
        int ret = vconf_set_int(key, oldDisplayTimeout);
-       if (0 != ret) {
+       if (0 != ret)
                ERR("vconf_set_int(%s, %d) Fail(%d)", key, oldDisplayTimeout, ret);
-               return MODES_ERROR_SYSTEM;
-       }
-       return MODES_ERROR_NONE;
 }
 
 std::string DisplayTimeout::serialize()
index d29d2dcb20b8ee54f496f274962084a5556a095d..153fdb3dbe4d4f47a25f362839e406f131534c6d 100644 (file)
@@ -27,7 +27,7 @@ public:
        ~DisplayTimeout();
 
        int set(int val) override;
-       int undo() override;
+       void undo() override;
        std::string serialize() override;
        int parse(const std::string &archive) override;
 
index 7f4a4f67980d9835a78955391e466006332a60d8..99d4943fcbb0bebd0c9e03b52cdfd1d8e5d14cd5 100644 (file)
@@ -105,8 +105,7 @@ int MediaPlayer::set(std::string val)
        return MODES_ERROR_NONE;
 }
 
-int MediaPlayer::undo()
+void MediaPlayer::undo()
 {
        destroyPlayer(NULL);
-       return MODES_ERROR_NONE;
 }
index 78f5922e751e5114e2943dd832e9044f0439a76a..ebf3ee5353a944704401f351c59335ce572e3852 100644 (file)
@@ -29,7 +29,7 @@ public:
        ~MediaPlayer() = default;
 
        int set(std::string val) override;
-       int undo() override;
+       void undo() override;
 private:
        int createPlayer();
        static void destroyPlayer(void *data);
index 7675b5dfe5b2972e11a9837231c1991ef3ef8ed0..ba2aaacb7572fea21fe22a5338dc0636cc15d9e2 100644 (file)
@@ -110,7 +110,7 @@ int PkgStartSupportMode::get(int *val)
 }
 
 
-int PkgStartSupportMode::undo()
+void PkgStartSupportMode::undo()
 {
        //If the appList is empty, it will be ignored at subroutines.
 
@@ -130,8 +130,6 @@ int PkgStartSupportMode::undo()
 
        //The caller(Plugin undo function) includes destruction of this instance.
        //Therefore, appList will be cleared by the destructor.
-
-       return MODES_ERROR_NONE;
 }
 
 std::string PkgStartSupportMode::serialize()
index b5ccc9815556c8e4881b5b5783e314fa6cce2c16..53dd1298c0b92d4c24739567541f2140699fec09 100644 (file)
@@ -30,7 +30,7 @@ public:
 
        int set(int val) override;
        int get(int *val) override;
-       int undo() override;
+       void undo() override;
        std::string serialize() override;
        int parse(const std::string &data) override;
 private:
index 5fdcc6b04fcd95c8ef05172102ff030a5809c72b..939ec79ac027e34c5d9a4602d240fb8f58261b8f 100644 (file)
@@ -29,7 +29,7 @@ public:
        ~PkgPlugin();
 
        int set(const std::string &key, int val, PluginAction **piAction) override;
-       int undo(PluginAction *piAction) override;
+       void undo(PluginAction *piAction) override;
        PluginAction* getUndoAction(const std::string &key, const std::string &info) override;
 private:
        PkgFactory pkgFactory;
@@ -69,17 +69,15 @@ int PkgPlugin::set(const std::string &key, int val, PluginAction **piAction)
        return ret;
 }
 
-int PkgPlugin::undo(PluginAction *piAction)
+void PkgPlugin::undo(PluginAction *piAction)
 {
        PkgAction *action = static_cast<PkgAction*>(piAction);
-       RETV_IF(nullptr == action, MODES_ERROR_INVALID_PARAMETER);
+       RET_IF(nullptr == piAction);
 
        DBG("Action(%s) undo", action->getName().c_str());
 
-       int ret = action->undo();
+       action->undo();
        pkgFactory.destroyAction(action);
-
-       return ret;
 }
 
 PluginAction* PkgPlugin::getUndoAction(const std::string &key, const std::string &info)
index 0afdd3733b0cdfbd671234bf39e3110b05707f49..3ef3f71209e028a498dbc7caa7fb072ea9aa9324 100644 (file)
@@ -52,8 +52,7 @@ protected:
                app_context_h runAppContext = NULL;
                app_manager_get_app_context("org.tizen.net-popup", &runAppContext);
                app_manager_terminate_app(runAppContext);
-               result = plugin->undo(action);
-               EXPECT_EQ(MODES_ERROR_NONE, result);
+               plugin->undo(action);
                g_main_loop_quit(loop);
 
                return G_SOURCE_REMOVE;
@@ -62,8 +61,7 @@ protected:
        static gboolean appPluginSetUndoTimeout(gpointer data)
        {
                PluginAction *action = (PluginAction*)data;
-               result = plugin->undo(action);
-               EXPECT_EQ(MODES_ERROR_NONE, result);
+               plugin->undo(action);
                g_main_loop_quit(loop);
                return false;
        }
index 690c6fad2fa58bd739d4d0e6f7c97840398963bd..22d6cffba7867a7e6325907384634c3c33c10c3b 100644 (file)
@@ -46,8 +46,7 @@ protected:
                result = plugin->set("brightness", 100, &action);
                EXPECT_EQ(MODES_ERROR_NONE, result);
 
-               result = plugin->undo(action);
-               EXPECT_EQ(MODES_ERROR_NONE, result);
+               plugin->undo(action);
 
                g_main_loop_quit(loop);
 
@@ -60,8 +59,7 @@ protected:
                result = plugin->set("allowPalmTouch", true, &action);
                EXPECT_EQ(MODES_ERROR_NONE, result);
 
-               result = plugin->undo(action);
-               EXPECT_EQ(MODES_ERROR_NONE, result);
+               plugin->undo(action);
 
                g_main_loop_quit(loop);
 
@@ -74,8 +72,7 @@ protected:
                result = plugin->set("Timeout", 0, &action);
                EXPECT_EQ(MODES_ERROR_NONE, result);
 
-               result = plugin->undo(action);
-               EXPECT_EQ(MODES_ERROR_NONE, result);
+               plugin->undo(action);
 
                g_main_loop_quit(loop);
 
index 119986f5fb736cfe6f00e47ea0b34e3314ad5711..f5982747baa70b914cb29939227a2e158676bff0 100644 (file)
@@ -44,8 +44,7 @@ protected:
        static gboolean mediaPluginSetUndoTimeout(gpointer data)
        {
                PluginAction *action = (PluginAction*)data;
-               result = plugin->undo(action);
-               EXPECT_EQ(MODES_ERROR_NONE, result);
+               plugin->undo(action);
                g_main_loop_quit(loop);
                return false;
        }
index 054ddb4000df767f696e553c6e416f655ec83300..a2729747c3c5047963b87b4e714ce80ce00633d6 100644 (file)
@@ -63,8 +63,7 @@ TEST_F(PkgPluginTest, setUndoTest)
        g_idle_add(pkgPluginIdler, plugin);
        g_main_loop_run(loop);
 
-       ret = plugin->undo(action);
-       EXPECT_EQ(MODES_ERROR_NONE, ret);
+       plugin->undo(action);
 
        g_idle_add(pkgPluginIdler, plugin);
        g_main_loop_run(loop);
index 9f80af0f55f9aa22843d7dcb960ff55081de18b0..a94d54450c23d67f59116799e4976f252d345eab 100644 (file)
@@ -103,8 +103,7 @@ TEST_F(VconfPluginTest, VconfInt)
        ret = plugin->set(key, 1, &action);
        EXPECT_EQ(ret, MODES_ERROR_NONE);
 
-       ret = plugin->undo(action);
-       EXPECT_EQ(ret, MODES_ERROR_NONE);
+       plugin->undo(action);
 
        val = plugin->getInt(key);
        EXPECT_EQ(val, 0);
@@ -125,8 +124,7 @@ TEST_F(VconfPluginTest, VconfDouble)
        ret = plugin->set(key, 1.0, &action);
        EXPECT_EQ(ret, MODES_ERROR_NONE);
 
-       ret = plugin->undo(action);
-       EXPECT_EQ(ret, MODES_ERROR_NONE);
+       plugin->undo(action);
 
        val = plugin->getDouble(key);
        EXPECT_EQ(val, 0.0);
@@ -147,8 +145,7 @@ TEST_F(VconfPluginTest, VconfBool)
        ret = plugin->set(key, false, &action);
        EXPECT_EQ(ret, MODES_ERROR_NONE);
 
-       ret = plugin->undo(action);
-       EXPECT_EQ(ret, MODES_ERROR_NONE);
+       plugin->undo(action);
 
        val = plugin->getBool(key);
        EXPECT_EQ(val, true);
@@ -171,8 +168,7 @@ TEST_F(VconfPluginTest, VconfStr)
        ret = plugin->set(key, tmpName, &action);
        EXPECT_EQ(ret, MODES_ERROR_NONE);
 
-       ret = plugin->undo(action);
-       EXPECT_EQ(ret, MODES_ERROR_NONE);
+       plugin->undo(action);
 
        val = plugin->getString(key);
        EXPECT_STREQ(val.c_str(), devName.c_str());
@@ -195,13 +191,11 @@ TEST_F(VconfPluginTest, callbackPluginVconf)
        g_main_loop_run(loop);
 
        // It should be removed by the changed callback procedure.
-       ret = action->unSetChangedCallback(valChangedCb, (void*)key);
-       EXPECT_EQ(ret, MODES_ERROR_NO_DATA);
+       action->unSetChangedCallback(valChangedCb, (void*)key);
 
        ret = action->setChangedCallback(shoudNotBeCalled, (void*)key);
        EXPECT_EQ(ret, MODES_ERROR_NONE);
-       ret = action->unSetChangedCallback(shoudNotBeCalled, (void*)key);
-       EXPECT_EQ(ret, MODES_ERROR_NONE);
+       action->unSetChangedCallback(shoudNotBeCalled, (void*)key);
        vconf_set_int("db/setting/psmode", oldVal);
 }
 
@@ -226,8 +220,7 @@ TEST_F(VconfPluginTest, callbackPluginVconfReset)
        g_main_loop_run(loop);
        EXPECT_TRUE(cb2Called);
 
-       ret = action2->unSetChangedCallback(callback2, nullptr);
-       EXPECT_EQ(ret, MODES_ERROR_NO_DATA);
+       action2->unSetChangedCallback(callback2, nullptr);
        vconf_set_int("db/setting/psmode", 0);
 }
 
index 66a080ae0ac87a0231cf7128f2cf0dda7bcab9cb..b93b2a267cce13819948f03c8c460f1ca5c50d46 100644 (file)
@@ -44,23 +44,22 @@ int VconfAction::setChangedCallback(valueChangedCB callback, void *userData)
        return MODES_ERROR_NONE;
 }
 
-int VconfAction::unSetChangedCallback(valueChangedCB callback, void * userData)
+void VconfAction::unSetChangedCallback(valueChangedCB callback, void *userData)
 {
        auto found = callbackMap.find(key);
        if (found == callbackMap.end()) {
                ERR("No Changed Callback(%s)", key.c_str());
-               return MODES_ERROR_NO_DATA;
+               return;
        }
 
        callbackMap.erase(found);
        int ret = vconf_ignore_key_changed(key.c_str(), vconfChangedCallback);
        if (0 != ret) {
                ERR("vconf_ignore_key_changed(%s) Fail(%d)", key.c_str(), ret);
-               return MODES_ERROR_SYSTEM;
+               return;
        }
 
        DBG("unSetChangedCallback(%s) Success", key.c_str());
-       return MODES_ERROR_NONE;
 }
 
 int VconfAction::handleChange()
@@ -92,13 +91,6 @@ void VconfAction::vconfChangedCallback(keynode_t *node, void *userData)
                return;
        }
 
-       std::string newKey(node->keyname);
-       std::replace(newKey.begin(), newKey.end(), '/', '.');
        cbData->callback(cbData->userData);
        DBG("Action(%s) is Changed", node->keyname);
-
-       callbackMap.erase(found);
-       int ret = vconf_ignore_key_changed(node->keyname, vconfChangedCallback);
-       if (0 != ret)
-               ERR("vconf_ignore_key_changed(%s) Fail(%d)", node->keyname, ret);
 }
index fe374c269dab5eb3d9b56233fba2f7efc405603a..19198cc0a2a5481523233622fe4cac8336a0b811 100644 (file)
@@ -29,7 +29,7 @@ public:
        virtual ~VconfAction() = default;
 
        int setChangedCallback(valueChangedCB callback, void *userData) override;
-       int unSetChangedCallback(valueChangedCB callback, void *userData) override;
+       void unSetChangedCallback(valueChangedCB callback, void *userData) override;
 protected:
        int handleChange();
        std::string key;
index 6062db20365ad720541f7bb2e7dfb5820e5604af..16297c2cda2dc3fc43acbc57f92ec203c7880a53 100644 (file)
@@ -65,18 +65,14 @@ bool VconfActionBool::get()
        return value ? true : false;
 }
 
-int VconfActionBool::undo()
+void VconfActionBool::undo()
 {
        int ret;
        DBG("undoBool(%s, %d)", key.c_str(), oldVal);
 
        ret = vconf_set_bool(key.c_str(), oldVal ? 1 : 0);
-       if (0 != ret) {
+       if (0 != ret)
                ERR("vconf_set_bool(%s, %d) Fail(%d)", key.c_str(), oldVal, ret);
-               return MODES_ERROR_SYSTEM;
-       }
-
-       return MODES_ERROR_NONE;
 }
 
 std::string VconfActionBool::serialize()
index 4d74dc2c8d5a18a8b603e5dc7f236e570f90960f..57eae7a933e58b1048b11b558fbe5b0227b2cf4b 100644 (file)
@@ -28,7 +28,7 @@ public:
 
        int set(bool val);
        bool get();
-       int undo() override;
+       void undo() override;
        std::string serialize() override;
        int parse(const std::string &archive) override;
 private:
index 1d7cc3c162aaea6ffe4f19377a74755e813ef56c..7135d492943f4602962eb972fcb085a7f4a5d743 100644 (file)
@@ -63,18 +63,14 @@ double VconfActionDbl::get()
        return value;
 }
 
-int VconfActionDbl::undo()
+void VconfActionDbl::undo()
 {
        int ret;
        DBG("undoDbl(%s, %f)", key.c_str(), oldVal);
 
        ret = vconf_set_dbl(key.c_str(), oldVal);
-       if (0 != ret) {
+       if (0 != ret)
                ERR("vconf_set_dbl(%s, %f) Fail(%d)", key.c_str(), oldVal, ret);
-               return MODES_ERROR_SYSTEM;
-       }
-
-       return MODES_ERROR_NONE;
 }
 
 std::string VconfActionDbl::serialize()
index f83cf511a26df147b9f58384b6edf1eda2d102f0..9841386b3a2d5ca88b497d2f7377fa457e09d28f 100644 (file)
@@ -28,7 +28,7 @@ public:
 
        int set(double val);
        double get();
-       int undo() override;
+       void undo() override;
        std::string serialize() override;
        int parse(const std::string &archive) override;
 private:
index 05f6d24f43ed01525d7f71133205b8369de21344..d717a7ffdbdad02fecd8debbacc8179eac967843 100644 (file)
@@ -63,18 +63,14 @@ int VconfActionInt::get()
        return value;
 }
 
-int VconfActionInt::undo()
+void VconfActionInt::undo()
 {
        int ret;
        DBG("undoInt(%s, %d)", key.c_str(), oldVal);
 
        ret = vconf_set_int(key.c_str(), oldVal);
-       if (0 != ret) {
+       if (0 != ret)
                ERR("vconf_set_int(%s, %d) Fail(%d)", key.c_str(), oldVal, ret);
-               return MODES_ERROR_SYSTEM;
-       }
-
-       return MODES_ERROR_NONE;
 }
 
 std::string VconfActionInt::serialize()
index 66b0b8a775d393025350627f6a24d83fdf483b75..1a747e9bf23eb7889db743ea50ae6a16de524b5c 100644 (file)
@@ -28,7 +28,7 @@ public:
 
        int set(int val);
        int get();
-       int undo() override;
+       void undo() override;
        std::string serialize() override;
        int parse(const std::string &archive) override;
 private:
index cfa27152dc19b98ea0bdb8d0a7f8a3bdbaf34e0c..ace2fe984f8c47d4328b1321ac09e975cf583bbe 100644 (file)
@@ -66,18 +66,14 @@ std::string VconfActionStr::get()
        return retStr;
 }
 
-int VconfActionStr::undo()
+void VconfActionStr::undo()
 {
        int ret;
        DBG("undoStr(%s, %s)", key.c_str(), oldVal.c_str());
 
        ret = vconf_set_str(key.c_str(), oldVal.c_str());
-       if (0 != ret) {
+       if (0 != ret)
                ERR("vconf_set_str(%s, %s) Fail(%d)", key.c_str(), oldVal.c_str(), ret);
-               return MODES_ERROR_SYSTEM;
-       }
-
-       return MODES_ERROR_NONE;
 }
 
 std::string VconfActionStr::serialize()
index e6a5ec055f5b05dd43e0bbe2b39dc68380f0e009..0273ad516ca0e2691900f432c2391c453d3ea456 100644 (file)
@@ -28,7 +28,7 @@ public:
 
        int set(const std::string &val);
        std::string get();
-       int undo() override;
+       void undo() override;
        std::string serialize() override;
        int parse(const std::string &archive) override;
 private:
index 0af2edd9028a7be05911e1a82ae46ca865604ee7..68cfdafc35532a755b199d0c7e3a2d8744e3861c 100644 (file)
@@ -55,9 +55,9 @@ int WifiActionPower::set(bool val)
        return MODES_ERROR_NONE;
 }
 
-int WifiActionPower::undo()
+void WifiActionPower::undo()
 {
-       return set(oldVal);
+       set(oldVal);
 }
 
 std::string WifiActionPower::serialize()
@@ -92,21 +92,20 @@ int WifiActionPower::setChangedCallback(valueChangedCB callback, void *userData)
        DBG("WifiActionPower setChangedCallback() Success");
        return MODES_ERROR_NONE;
 }
-int WifiActionPower::unSetChangedCallback(valueChangedCB callback, void *userData)
+void WifiActionPower::unSetChangedCallback(valueChangedCB callback, void *userData)
 {
-       RETV_IF(NULL == callback, MODES_ERROR_INVALID_PARAMETER);
+       RET_IF(NULL == callback);
 
        int ret = wifi_manager_unset_device_state_changed_cb(handle);
        if (WIFI_MANAGER_ERROR_NONE != ret) {
-               ERR("wifi_manager_unset_device_state_changed_cb() Fail(%s)", get_error_message(ret));
-               return MODES_ERROR_SYSTEM;
+               ERR("wifi_manager_unset_device_state_changed_cb() Fail(%s)",
+                       get_error_message(ret));
        }
 
        cb = NULL;
        cbData = NULL;
 
        DBG("WifiActionPower unSetChangedCallback() Success");
-       return MODES_ERROR_NONE;
 }
 
 void WifiActionPower::activateCB(wifi_manager_error_e result, void *user_data)
@@ -141,11 +140,6 @@ void WifiActionPower::wifiStateChangedCB(wifi_manager_device_state_e state, void
 
        INFO("state:%d", state);
 
-       if (changedVal != action->requestVal) {
-               valueChangedCB cb = action->cb;
-               void *cbData = action->cbData;
-               //TODO: revise after revising the modes(because of piAction free)
-               action->unSetChangedCallback(action->cb, action->cbData);
-               cb(cbData);
-       }
+       if (changedVal != action->requestVal)
+               action->cb(action->cbData);
 }
index 7132f0117283de9fea5001f4edf82691ca79b5aa..4fa8e57a1ef250107a52b68d84861223f011769e 100644 (file)
@@ -26,11 +26,11 @@ public:
        WifiActionPower();
 
        int set(bool val) override;
-       int undo() override;
+       void undo() override;
        std::string serialize() override;
        int parse(const std::string &archive) override;
-       int setChangedCallback(valueChangedCB callback, void *userData);
-       int unSetChangedCallback(valueChangedCB callback, void *userData);
+       int setChangedCallback(valueChangedCB callback, void *userData) override;
+       void unSetChangedCallback(valueChangedCB callback, void *userData) override;
 
        valueChangedCB cb;
        void *cbData;
index cdb0245c76e53fce2c9f9d62b3184ad3501112f9..e8b88b18a42c58b61ea368c24df5ccd74a8aa216 100644 (file)
@@ -27,7 +27,7 @@ public:
        WifiPlugin();
 
        int set(const std::string &key, bool val, PluginAction **piAction) override;
-       int undo(PluginAction *piAction) override;
+       void undo(PluginAction *piAction) override;
        PluginAction* getUndoAction(const std::string &key, const std::string &info) override;
 private:
        WifiFactory wifiFactory;
@@ -64,17 +64,15 @@ int WifiPlugin::set(const std::string &key, bool val, PluginAction **piAction)
        return ret;
 }
 
-int WifiPlugin::undo(PluginAction *piAction)
+void WifiPlugin::undo(PluginAction *piAction)
 {
        WifiAction *action = static_cast<WifiAction*>(piAction);
-       RETV_IF(nullptr == action, MODES_ERROR_INVALID_PARAMETER);
+       RET_IF(nullptr == piAction);
 
        DBG("Action(%s) undo", action->getName().c_str());
 
-       int ret = action->undo();
+       action->undo();
        wifiFactory.destroyAction(action);
-
-       return ret;
 }
 
 PluginAction* WifiPlugin::getUndoAction(const std::string &key, const std::string &info)