BtPlugin();
~BtPlugin();
- int set(const std::string &key, int val) override;
- int set(const std::string &key, double val) override;
- int set(const std::string &key, bool val) override;
- int set(const std::string &key, const std::string &val) override;
+ int set(const std::string &key, int val, int *oldVal) override;
+ int set(const std::string &key, double val, double *oldVal) override;
+ int set(const std::string &key, bool val, bool *oldVal) override;
+ int set(const std::string &key, const std::string &val, std::string *oldVal) override;
private:
BtFactory btFactory;
};
{
}
-int BtPlugin::set(const std::string &key, int val)
+int BtPlugin::set(const std::string &key, int val, int *oldVal)
{
BtAction *action = btFactory.createAction(key);
RETVM_IF(nullptr == action, MODES_ERROR_INVALID_PARAMETER, "action(%s) is null", key.c_str());
return btRet;
}
-int BtPlugin::set(const std::string &key, double val)
+int BtPlugin::set(const std::string &key, double val, double *oldVal)
{
BtAction *action = btFactory.createAction(key);
RETVM_IF(nullptr == action, MODES_ERROR_INVALID_PARAMETER, "action(%s) is null", key.c_str());
return btRet;
}
-int BtPlugin::set(const std::string &key, bool val)
+int BtPlugin::set(const std::string &key, bool val, bool *oldVal)
{
BtAction *action = btFactory.createAction(key);
RETVM_IF(nullptr == action, MODES_ERROR_INVALID_PARAMETER, "action(%s) is null", key.c_str());
return btRet;
}
-int BtPlugin::set(const std::string &key, const std::string &val)
+int BtPlugin::set(const std::string &key, const std::string &val, std::string *oldVal)
{
BtAction *action = btFactory.createAction(key);
RETVM_IF(nullptr == action, MODES_ERROR_INVALID_PARAMETER, "action(%s) is null", key.c_str());
public:
VconfPlugin();
- int set(const std::string &key, int val) override;
- int set(const std::string &key, double val) override;
- int set(const std::string &key, bool val) override;
- int set(const std::string &key, const std::string &val) override;
+ int set(const std::string &key, int val, int *oldVal) override;
+ int set(const std::string &key, double val, double *oldVal) override;
+ int set(const std::string &key, bool val, bool *oldVal) override;
+ int set(const std::string &key, const std::string &val, std::string *oldVal) override;
int getInt(const std::string &key) override;
double getDouble(const std::string &key) override;
setName("vconf");
}
-int VconfPlugin::set(const std::string &key, int val)
+int VconfPlugin::set(const std::string &key, int val, int *oldVal)
{
DBG("set<int>(%s, %d)", key.c_str(), val);
return MODES_ERROR_NONE;
}
-int VconfPlugin::set(const std::string &key, double val)
+int VconfPlugin::set(const std::string &key, double val, double *oldVal)
{
DBG("set<double>(%s, %lf)", key.c_str(), val);
}
return MODES_ERROR_NONE;
}
-int VconfPlugin::set(const std::string &key, bool val)
+int VconfPlugin::set(const std::string &key, bool val, bool *oldVal)
{
DBG("set<bool>(%s, %d)", key.c_str(), val);
return MODES_ERROR_NONE;
}
-int VconfPlugin::set(const std::string &key, const std::string &val)
+int VconfPlugin::set(const std::string &key, const std::string &val, std::string *oldVal)
{
DBG("set<string>(%s, %s)", key.c_str(), val.c_str());
return MODES_ERROR_NOT_SUPPORTED;
}
+int WifiAction::get(int *val)
+{
+ return MODES_ERROR_NOT_SUPPORTED;
+}
+
+int WifiAction::get(double *val)
+{
+ return MODES_ERROR_NOT_SUPPORTED;
+}
+
+int WifiAction::get(bool *val)
+{
+ return MODES_ERROR_NOT_SUPPORTED;
+}
+int WifiAction::get(std::string *val)
+{
+ return MODES_ERROR_NOT_SUPPORTED;
+}
+
+
bool WifiAction::isWifiActivate()
{
RETV_IF(!isWifiManagerEnable(), false);
virtual int set(double val);
virtual int set(bool val);
virtual int set(const std::string &val);
-
+ virtual int get(int *val);
+ virtual int get(double *val);
+ virtual int get(bool *val);
+ virtual int get(std::string *val);
protected:
bool isWifiManagerEnable();
const std::string& strErr(int err);
INFO("Wifi power [%s]", val ? "On" : "Off");
return MODES_ERROR_NONE;
}
+
+int WifiActionPower::get(bool *val)
+{
+ RETV_IF(!isWifiManagerEnable(), MODES_ERROR_NOT_SUPPORTED);
+
+ if (val)
+ *val = isWifiActivate();
+ else
+ return MODES_ERROR_INVALID_PARAMETER;
+
+ return MODES_ERROR_NONE;
+}
WifiActionPower();
int set(bool val) override;
+ int get(bool *val) override;
private:
static void activate_cb(wifi_manager_error_e result, void *user_data);
static void deactivate_cb(wifi_manager_error_e result, void *user_data);
WifiPlugin();
~WifiPlugin();
- int set(const std::string &key, int val) override;
- int set(const std::string &key, double val) override;
- int set(const std::string &key, bool val) override;
- int set(const std::string &key, const std::string &val) override;
+ int set(const std::string &key, int val, int *oldVal) override;
+ int set(const std::string &key, double val, double *oldVal) override;
+ int set(const std::string &key, bool val, bool *oldVal) override;
+ int set(const std::string &key, const std::string &val, std::string *oldVal) override;
private:
WifiFactory wifiFactory;
};
{
}
-int WifiPlugin::set(const std::string &key, int val)
+int WifiPlugin::set(const std::string &key, int val, int *oldVal)
{
WifiAction *action = wifiFactory.createAction(key);
RETVM_IF(nullptr == action, MODES_ERROR_INVALID_PARAMETER, "action(%s) is null", key.c_str());
DBG("set [%s, %d]", key.c_str(), val);
+ if (oldVal)
+ ERR("Not Supported");
+
int ret = action->set(val);
wifiFactory.destroyAction(action);
return ret;
}
-int WifiPlugin::set(const std::string &key, double val)
+int WifiPlugin::set(const std::string &key, double val, double *oldVal)
{
WifiAction *action = wifiFactory.createAction(key);
RETVM_IF(nullptr == action, MODES_ERROR_INVALID_PARAMETER, "action(%s) is null", key.c_str());
DBG("set [%s, %f]", key.c_str(), val);
+ if (oldVal)
+ ERR("Not Supported");
+
int ret = action->set(val);
wifiFactory.destroyAction(action);
return ret;
}
-int WifiPlugin::set(const std::string &key, bool val)
+int WifiPlugin::set(const std::string &key, bool val, bool *oldVal)
{
WifiAction *action = wifiFactory.createAction(key);
RETVM_IF(nullptr == action, MODES_ERROR_INVALID_PARAMETER, "action(%s) is null", key.c_str());
DBG("set [%s, %s]", key.c_str(), (val ? "on" : "off"));
+ if (oldVal)
+ action->get(oldVal);
int ret = action->set(val);
+
wifiFactory.destroyAction(action);
+
return ret;
}
-int WifiPlugin::set(const std::string &key, const std::string &val)
+int WifiPlugin::set(const std::string &key, const std::string &val, std::string *oldVal)
{
WifiAction *action = wifiFactory.createAction(key);
RETVM_IF(nullptr == action, MODES_ERROR_INVALID_PARAMETER, "action(%s) is null", key.c_str());
DBG("set [%s, %s]", key.c_str(), val.c_str());
+ if (oldVal)
+ ERR("Not Supported");
+
int ret = action->set(val);
wifiFactory.destroyAction(action);
return ret;