|
|
|
@ -15,7 +15,7 @@
|
|
|
|
|
#include "IpcConfigImpl.h"
|
|
|
|
|
#include "ILog.h"
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#define CHECK_MAP(map) (map.size() == 1 ? true : false)
|
|
|
|
|
const char *CONFIG_WIFI_SSID = "wifi_ssid";
|
|
|
|
|
const char *CONFIG_WIFI_SSID_DEFAULT = "Hunting 2024";
|
|
|
|
@ -30,69 +30,9 @@ const char *CONFIG_PIR_DELAYED = "pir_delayed";
|
|
|
|
|
const char *CONFIG_STORAGE_LOOP = "storage_loop";
|
|
|
|
|
const char *CONFIG_INFRARED_POWER = "infrared_power";
|
|
|
|
|
const char *CONFIG_PIR_SENSITIVITY = "pir_sensitivity";
|
|
|
|
|
IpcConfigImpl::IpcConfigImpl()
|
|
|
|
|
IpcConfigImpl::IpcConfigImpl() : mThreadRuning(false), mCfgChanged(CONFIG_HAS_NOT_CHANGED), mCfg(nullptr)
|
|
|
|
|
{
|
|
|
|
|
mCfgChanged = CONFIG_HAS_NOT_CHANGED;
|
|
|
|
|
|
|
|
|
|
memset(&mAllData, 0, sizeof(Config_s));
|
|
|
|
|
{
|
|
|
|
|
std::map<std::string, StringConfigPack> config;
|
|
|
|
|
StringConfigPack pack = {WIFI_SSID_BUFF_SIZE, mAllData.mWifiSsid};
|
|
|
|
|
config.insert(std::make_pair(CONFIG_WIFI_SSID, pack));
|
|
|
|
|
mCfgMapStringV2.insert(std::make_pair(IpcConfigKey::WIFI_SSID, config));
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
std::map<std::string, StringConfigPack> config;
|
|
|
|
|
StringConfigPack pack = {WIFI_PASSWORD_BUFF_SIZE, mAllData.mWifiPassword};
|
|
|
|
|
config.insert(std::make_pair(CONFIG_WIFI_PASSWORD, pack));
|
|
|
|
|
mCfgMapStringV2.insert(std::make_pair(IpcConfigKey::WIFI_PASSWORD, config));
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
std::map<std::string, char *> config;
|
|
|
|
|
config.insert(std::make_pair(CONFIG_WORK_MODE, &mAllData.mWorkMode));
|
|
|
|
|
mCfgMapCharV2.insert(std::make_pair(IpcConfigKey::WORK_MODE, config));
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
std::map<std::string, char *> config;
|
|
|
|
|
config.insert(std::make_pair(CONFIG_INFRARED_POWER, &mAllData.mInfraredPower));
|
|
|
|
|
mCfgMapCharV2.insert(std::make_pair(IpcConfigKey::INFRARED_POWER, config));
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
std::map<std::string, int *> config;
|
|
|
|
|
config.insert(std::make_pair(CONFIG_CONTINUE_SHOT, &mAllData.mContinuousShot));
|
|
|
|
|
mCfgMapIntV2.insert(std::make_pair(IpcConfigKey::CONTINUOUS_SHOT, config));
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
std::map<std::string, int *> config;
|
|
|
|
|
config.insert(std::make_pair(CONFIG_BURST_PHOTO_INTERVAL, &mAllData.mBurstPhotoInterval));
|
|
|
|
|
mCfgMapIntV2.insert(std::make_pair(IpcConfigKey::BURST_PHOTO_INTERVAL, config));
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
std::map<std::string, int *> config;
|
|
|
|
|
config.insert(std::make_pair(CONFIG_IMAGE_SIZE, &mAllData.mImageSize));
|
|
|
|
|
mCfgMapIntV2.insert(std::make_pair(IpcConfigKey::IMGAE_SIZE, config));
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
std::map<std::string, int *> config;
|
|
|
|
|
config.insert(std::make_pair(CONFIG_VIDEO_SIZE, &mAllData.mVideoLength));
|
|
|
|
|
mCfgMapIntV2.insert(std::make_pair(IpcConfigKey::VIDEO_LENGTH, config));
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
std::map<std::string, int *> config;
|
|
|
|
|
config.insert(std::make_pair(CONFIG_PIR_DELAYED, &mAllData.mPirDelayed));
|
|
|
|
|
mCfgMapIntV2.insert(std::make_pair(IpcConfigKey::PIR_DELAYED, config));
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
std::map<std::string, int *> config;
|
|
|
|
|
config.insert(std::make_pair(CONFIG_PIR_SENSITIVITY, &mAllData.mPirSensitivity));
|
|
|
|
|
mCfgMapIntV2.insert(std::make_pair(IpcConfigKey::PIR_SENSITIVITY, config));
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
std::map<std::string, bool *> config;
|
|
|
|
|
config.insert(std::make_pair(CONFIG_STORAGE_LOOP, &mAllData.mStorageLoopSwitch));
|
|
|
|
|
mCfgMapBoolV2.insert(std::make_pair(IpcConfigKey::STORAGE_LOOP_SWITCH, config));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// std::map<std::string, std::reference_wrapper<int>> innerMapWorkMode;
|
|
|
|
|
// innerMapWorkMode.insert(std::make_pair("work_mode", std::reference_wrapper<int>(mAllData.mWorkMode)));
|
|
|
|
|
// mCfgMapInt.insert(std::make_pair(IpcConfigKey::WORK_MODE, innerMapWorkMode));
|
|
|
|
@ -175,17 +115,28 @@ IpcConfigImpl::IpcConfigImpl()
|
|
|
|
|
}
|
|
|
|
|
const StatusCode IpcConfigImpl::Init(void)
|
|
|
|
|
{
|
|
|
|
|
memset(&mAllData, 0, sizeof(Config_s));
|
|
|
|
|
mCfg = OpenConfigFile(IPC_CONFIG_FILE_PATH);
|
|
|
|
|
if (nullptr == mCfg) {
|
|
|
|
|
LogError("Open config file failed.\n");
|
|
|
|
|
return CreateStatusCode(STATUS_CODE_NOT_OK);
|
|
|
|
|
}
|
|
|
|
|
ReadAllConfigParameters();
|
|
|
|
|
// memset(&mAllData, 0, sizeof(Config_s));
|
|
|
|
|
// InitConfigMap();
|
|
|
|
|
// mCfg = OpenConfigFile(IPC_CONFIG_FILE_PATH);
|
|
|
|
|
// if (nullptr == mCfg) {
|
|
|
|
|
// LogError("Open config file failed.\n");
|
|
|
|
|
// return CreateStatusCode(STATUS_CODE_NOT_OK);
|
|
|
|
|
// }
|
|
|
|
|
// ReadAllConfigParameters();
|
|
|
|
|
auto readingConfig = [](std::shared_ptr<IpcConfigImpl> impl) {
|
|
|
|
|
impl->ReadingConfigThread();
|
|
|
|
|
};
|
|
|
|
|
std::shared_ptr<IpcConfigImpl> impl = shared_from_this();
|
|
|
|
|
mInitThread = std::thread(readingConfig, impl);
|
|
|
|
|
return CreateStatusCode(STATUS_CODE_OK);
|
|
|
|
|
}
|
|
|
|
|
const StatusCode IpcConfigImpl::UnInit(void)
|
|
|
|
|
{
|
|
|
|
|
mThreadRuning = false;
|
|
|
|
|
if (mInitThread.joinable()) {
|
|
|
|
|
mInitThread.join();
|
|
|
|
|
}
|
|
|
|
|
std::lock_guard<std::mutex> locker(mMutex);
|
|
|
|
|
if (CONFIG_HAS_CHANGED == mCfgChanged) {
|
|
|
|
|
LogInfo("Save config files.\n");
|
|
|
|
|
ConfigSaveFile(mCfg);
|
|
|
|
@ -195,11 +146,13 @@ const StatusCode IpcConfigImpl::UnInit(void)
|
|
|
|
|
}
|
|
|
|
|
const StatusCode IpcConfigImpl::ConfigFileSave(void)
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> locker(mMutex);
|
|
|
|
|
return ConfigSaveFile(mCfg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const int IpcConfigImpl::GetInt(const IpcConfigKey &key)
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> locker(mMutex);
|
|
|
|
|
std::map<IpcConfigKey, std::map<std::string, int *>>::iterator iter;
|
|
|
|
|
iter = mCfgMapIntV2.find(key);
|
|
|
|
|
if (iter != mCfgMapIntV2.end() && CHECK_MAP(iter->second)) {
|
|
|
|
@ -211,6 +164,7 @@ const int IpcConfigImpl::GetInt(const IpcConfigKey &key)
|
|
|
|
|
}
|
|
|
|
|
void IpcConfigImpl::SetInt(const IpcConfigKey &key, const int &value)
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> locker(mMutex);
|
|
|
|
|
std::map<IpcConfigKey, std::map<std::string, int *>>::iterator iter;
|
|
|
|
|
iter = mCfgMapIntV2.find(key);
|
|
|
|
|
if (iter != mCfgMapIntV2.end() && CHECK_MAP(iter->second)) {
|
|
|
|
@ -224,6 +178,7 @@ void IpcConfigImpl::SetInt(const IpcConfigKey &key, const int &value)
|
|
|
|
|
}
|
|
|
|
|
const short IpcConfigImpl::GetShort(const IpcConfigKey &key)
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> locker(mMutex);
|
|
|
|
|
std::map<IpcConfigKey, std::map<std::string, std::reference_wrapper<short>>>::iterator iter;
|
|
|
|
|
iter = mCfgMapShort.find(key);
|
|
|
|
|
if (iter != mCfgMapShort.end() && CHECK_MAP(iter->second)) {
|
|
|
|
@ -235,6 +190,7 @@ const short IpcConfigImpl::GetShort(const IpcConfigKey &key)
|
|
|
|
|
}
|
|
|
|
|
void IpcConfigImpl::SetShort(const IpcConfigKey &key, const short &value)
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> locker(mMutex);
|
|
|
|
|
std::map<IpcConfigKey, std::map<std::string, std::reference_wrapper<short>>>::iterator iter;
|
|
|
|
|
iter = mCfgMapShort.find(key);
|
|
|
|
|
if (iter != mCfgMapShort.end() && CHECK_MAP(iter->second)) {
|
|
|
|
@ -249,6 +205,7 @@ void IpcConfigImpl::SetShort(const IpcConfigKey &key, const short &value)
|
|
|
|
|
}
|
|
|
|
|
const long IpcConfigImpl::GetLong(const IpcConfigKey &key)
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> locker(mMutex);
|
|
|
|
|
std::map<IpcConfigKey, std::map<std::string, std::reference_wrapper<long>>>::iterator iter;
|
|
|
|
|
iter = mCfgMapLong.find(key);
|
|
|
|
|
if (iter != mCfgMapLong.end() && CHECK_MAP(iter->second)) {
|
|
|
|
@ -260,6 +217,7 @@ const long IpcConfigImpl::GetLong(const IpcConfigKey &key)
|
|
|
|
|
}
|
|
|
|
|
void IpcConfigImpl::SetLong(const IpcConfigKey &key, const long &value)
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> locker(mMutex);
|
|
|
|
|
std::map<IpcConfigKey, std::map<std::string, std::reference_wrapper<long>>>::iterator iter;
|
|
|
|
|
iter = mCfgMapLong.find(key);
|
|
|
|
|
if (iter != mCfgMapLong.end() && CHECK_MAP(iter->second)) {
|
|
|
|
@ -274,6 +232,7 @@ void IpcConfigImpl::SetLong(const IpcConfigKey &key, const long &value)
|
|
|
|
|
}
|
|
|
|
|
const long long IpcConfigImpl::GetLLong(const IpcConfigKey &key)
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> locker(mMutex);
|
|
|
|
|
std::map<IpcConfigKey, std::map<std::string, std::reference_wrapper<long long>>>::iterator iter;
|
|
|
|
|
iter = mCfgMapLLong.find(key);
|
|
|
|
|
if (iter != mCfgMapLLong.end() && CHECK_MAP(iter->second)) {
|
|
|
|
@ -285,6 +244,7 @@ const long long IpcConfigImpl::GetLLong(const IpcConfigKey &key)
|
|
|
|
|
}
|
|
|
|
|
void IpcConfigImpl::SetLLong(const IpcConfigKey &key, const long long &value)
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> locker(mMutex);
|
|
|
|
|
std::map<IpcConfigKey, std::map<std::string, std::reference_wrapper<long long>>>::iterator iter;
|
|
|
|
|
iter = mCfgMapLLong.find(key);
|
|
|
|
|
if (iter != mCfgMapLLong.end() && CHECK_MAP(iter->second)) {
|
|
|
|
@ -299,6 +259,7 @@ void IpcConfigImpl::SetLLong(const IpcConfigKey &key, const long long &value)
|
|
|
|
|
}
|
|
|
|
|
const char IpcConfigImpl::GetChar(const IpcConfigKey &key)
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> locker(mMutex);
|
|
|
|
|
std::map<IpcConfigKey, std::map<std::string, char *>>::iterator iter;
|
|
|
|
|
iter = mCfgMapCharV2.find(key);
|
|
|
|
|
if (iter != mCfgMapCharV2.end() && CHECK_MAP(iter->second)) {
|
|
|
|
@ -310,6 +271,7 @@ const char IpcConfigImpl::GetChar(const IpcConfigKey &key)
|
|
|
|
|
}
|
|
|
|
|
void IpcConfigImpl::SetChar(const IpcConfigKey &key, const char &character)
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> locker(mMutex);
|
|
|
|
|
std::map<IpcConfigKey, std::map<std::string, char *>>::iterator iter;
|
|
|
|
|
iter = mCfgMapCharV2.find(key);
|
|
|
|
|
if (iter != mCfgMapCharV2.end() && CHECK_MAP(iter->second)) {
|
|
|
|
@ -324,6 +286,7 @@ void IpcConfigImpl::SetChar(const IpcConfigKey &key, const char &character)
|
|
|
|
|
}
|
|
|
|
|
const float IpcConfigImpl::GetFloat(const IpcConfigKey &key)
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> locker(mMutex);
|
|
|
|
|
std::map<IpcConfigKey, std::map<std::string, std::reference_wrapper<float>>>::iterator iter;
|
|
|
|
|
iter = mCfgMapFloat.find(key);
|
|
|
|
|
if (iter != mCfgMapFloat.end() && CHECK_MAP(iter->second)) {
|
|
|
|
@ -335,6 +298,7 @@ const float IpcConfigImpl::GetFloat(const IpcConfigKey &key)
|
|
|
|
|
}
|
|
|
|
|
void IpcConfigImpl::SetFloat(const IpcConfigKey &key, const float &value)
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> locker(mMutex);
|
|
|
|
|
std::map<IpcConfigKey, std::map<std::string, std::reference_wrapper<float>>>::iterator iter;
|
|
|
|
|
iter = mCfgMapFloat.find(key);
|
|
|
|
|
if (iter != mCfgMapFloat.end() && CHECK_MAP(iter->second)) {
|
|
|
|
@ -349,6 +313,7 @@ void IpcConfigImpl::SetFloat(const IpcConfigKey &key, const float &value)
|
|
|
|
|
}
|
|
|
|
|
const double IpcConfigImpl::GetDouble(const IpcConfigKey &key)
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> locker(mMutex);
|
|
|
|
|
std::map<IpcConfigKey, std::map<std::string, std::reference_wrapper<double>>>::iterator iter;
|
|
|
|
|
iter = mCfgMapDouble.find(key);
|
|
|
|
|
if (iter != mCfgMapDouble.end() && CHECK_MAP(iter->second)) {
|
|
|
|
@ -360,6 +325,7 @@ const double IpcConfigImpl::GetDouble(const IpcConfigKey &key)
|
|
|
|
|
}
|
|
|
|
|
void IpcConfigImpl::SetDouble(const IpcConfigKey &key, const double &value)
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> locker(mMutex);
|
|
|
|
|
std::map<IpcConfigKey, std::map<std::string, std::reference_wrapper<double>>>::iterator iter;
|
|
|
|
|
iter = mCfgMapDouble.find(key);
|
|
|
|
|
if (iter != mCfgMapDouble.end() && CHECK_MAP(iter->second)) {
|
|
|
|
@ -374,6 +340,7 @@ void IpcConfigImpl::SetDouble(const IpcConfigKey &key, const double &value)
|
|
|
|
|
}
|
|
|
|
|
const long double IpcConfigImpl::GetLongDouble(const IpcConfigKey &key)
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> locker(mMutex);
|
|
|
|
|
std::map<IpcConfigKey, std::reference_wrapper<long double>>::iterator iter;
|
|
|
|
|
iter = mCfgMapLongDouble.find(key);
|
|
|
|
|
if (iter != mCfgMapLongDouble.end()) {
|
|
|
|
@ -385,6 +352,7 @@ const long double IpcConfigImpl::GetLongDouble(const IpcConfigKey &key)
|
|
|
|
|
}
|
|
|
|
|
void IpcConfigImpl::SetLongDouble(const IpcConfigKey &key, const long double &value)
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> locker(mMutex);
|
|
|
|
|
std::map<IpcConfigKey, std::reference_wrapper<long double>>::iterator iter;
|
|
|
|
|
iter = mCfgMapLongDouble.find(key);
|
|
|
|
|
if (iter != mCfgMapLongDouble.end()) {
|
|
|
|
@ -397,6 +365,7 @@ void IpcConfigImpl::SetLongDouble(const IpcConfigKey &key, const long double &va
|
|
|
|
|
}
|
|
|
|
|
const bool IpcConfigImpl::GetBool(const IpcConfigKey &key)
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> locker(mMutex);
|
|
|
|
|
std::map<IpcConfigKey, std::map<std::string, bool *>>::iterator iter;
|
|
|
|
|
iter = mCfgMapBoolV2.find(key);
|
|
|
|
|
if (iter != mCfgMapBoolV2.end() && CHECK_MAP(iter->second)) {
|
|
|
|
@ -408,6 +377,7 @@ const bool IpcConfigImpl::GetBool(const IpcConfigKey &key)
|
|
|
|
|
}
|
|
|
|
|
void IpcConfigImpl::SetBool(const IpcConfigKey &key, const bool &value)
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> locker(mMutex);
|
|
|
|
|
std::map<IpcConfigKey, std::map<std::string, bool *>>::iterator iter;
|
|
|
|
|
iter = mCfgMapBoolV2.find(key);
|
|
|
|
|
if (iter != mCfgMapBoolV2.end() && CHECK_MAP(iter->second)) {
|
|
|
|
@ -421,6 +391,7 @@ void IpcConfigImpl::SetBool(const IpcConfigKey &key, const bool &value)
|
|
|
|
|
}
|
|
|
|
|
const std::string IpcConfigImpl::GetString(const IpcConfigKey &key)
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> locker(mMutex);
|
|
|
|
|
std::map<IpcConfigKey, std::map<std::string, StringConfigPack>>::iterator iter;
|
|
|
|
|
iter = mCfgMapStringV2.find(key);
|
|
|
|
|
if (iter != mCfgMapStringV2.end() && CHECK_MAP(iter->second)) {
|
|
|
|
@ -433,6 +404,7 @@ const std::string IpcConfigImpl::GetString(const IpcConfigKey &key)
|
|
|
|
|
}
|
|
|
|
|
void IpcConfigImpl::SetString(const IpcConfigKey &key, const std::string &string)
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> locker(mMutex);
|
|
|
|
|
std::map<IpcConfigKey, std::map<std::string, StringConfigPack>>::iterator iter;
|
|
|
|
|
iter = mCfgMapStringV2.find(key);
|
|
|
|
|
if (iter != mCfgMapStringV2.end() && CHECK_MAP(iter->second)) {
|
|
|
|
@ -478,6 +450,99 @@ void IpcConfigImpl::SetLevel(const IpcConfigKey &key, const ConfigLevel &value)
|
|
|
|
|
char config = static_cast<char>(value);
|
|
|
|
|
SetChar(key, config);
|
|
|
|
|
}
|
|
|
|
|
void IpcConfigImpl::ReadingConfigThread(void)
|
|
|
|
|
{
|
|
|
|
|
constexpr int DIR_PATH_LENGTH = 32;
|
|
|
|
|
char dirPath[DIR_PATH_LENGTH] = {0};
|
|
|
|
|
strncpy(dirPath, IPC_CONFIG_FILE_PATH, DIR_PATH_LENGTH - 1);
|
|
|
|
|
char *lastSlash = strrchr(dirPath, '/');
|
|
|
|
|
if (lastSlash == NULL) {
|
|
|
|
|
strcpy(dirPath, ".");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
*lastSlash = '\0';
|
|
|
|
|
}
|
|
|
|
|
mThreadRuning = true;
|
|
|
|
|
LogInfo("Reading config thread is running.dirPath = %s\n", dirPath);
|
|
|
|
|
while (mThreadRuning) {
|
|
|
|
|
constexpr int FIEL_EXIST = 0;
|
|
|
|
|
if (FIEL_EXIST == access(dirPath, F_OK)) {
|
|
|
|
|
memset(&mAllData, 0, sizeof(Config_s));
|
|
|
|
|
mCfg = OpenConfigFile(IPC_CONFIG_FILE_PATH);
|
|
|
|
|
if (nullptr == mCfg) {
|
|
|
|
|
LogError("Open config file failed.\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
std::lock_guard<std::mutex> locker(mMutex);
|
|
|
|
|
InitConfigMap();
|
|
|
|
|
ReadAllConfigParameters();
|
|
|
|
|
LogInfo("Read config file success.\n");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
|
|
|
|
}
|
|
|
|
|
mThreadRuning = false;
|
|
|
|
|
}
|
|
|
|
|
void IpcConfigImpl::InitConfigMap(void)
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
std::map<std::string, StringConfigPack> config;
|
|
|
|
|
StringConfigPack pack = {WIFI_SSID_BUFF_SIZE, mAllData.mWifiSsid};
|
|
|
|
|
config.insert(std::make_pair(CONFIG_WIFI_SSID, pack));
|
|
|
|
|
mCfgMapStringV2.insert(std::make_pair(IpcConfigKey::WIFI_SSID, config));
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
std::map<std::string, StringConfigPack> config;
|
|
|
|
|
StringConfigPack pack = {WIFI_PASSWORD_BUFF_SIZE, mAllData.mWifiPassword};
|
|
|
|
|
config.insert(std::make_pair(CONFIG_WIFI_PASSWORD, pack));
|
|
|
|
|
mCfgMapStringV2.insert(std::make_pair(IpcConfigKey::WIFI_PASSWORD, config));
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
std::map<std::string, char *> config;
|
|
|
|
|
config.insert(std::make_pair(CONFIG_WORK_MODE, &mAllData.mWorkMode));
|
|
|
|
|
mCfgMapCharV2.insert(std::make_pair(IpcConfigKey::WORK_MODE, config));
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
std::map<std::string, char *> config;
|
|
|
|
|
config.insert(std::make_pair(CONFIG_INFRARED_POWER, &mAllData.mInfraredPower));
|
|
|
|
|
mCfgMapCharV2.insert(std::make_pair(IpcConfigKey::INFRARED_POWER, config));
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
std::map<std::string, int *> config;
|
|
|
|
|
config.insert(std::make_pair(CONFIG_CONTINUE_SHOT, &mAllData.mContinuousShot));
|
|
|
|
|
mCfgMapIntV2.insert(std::make_pair(IpcConfigKey::CONTINUOUS_SHOT, config));
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
std::map<std::string, int *> config;
|
|
|
|
|
config.insert(std::make_pair(CONFIG_BURST_PHOTO_INTERVAL, &mAllData.mBurstPhotoInterval));
|
|
|
|
|
mCfgMapIntV2.insert(std::make_pair(IpcConfigKey::BURST_PHOTO_INTERVAL, config));
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
std::map<std::string, int *> config;
|
|
|
|
|
config.insert(std::make_pair(CONFIG_IMAGE_SIZE, &mAllData.mImageSize));
|
|
|
|
|
mCfgMapIntV2.insert(std::make_pair(IpcConfigKey::IMGAE_SIZE, config));
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
std::map<std::string, int *> config;
|
|
|
|
|
config.insert(std::make_pair(CONFIG_VIDEO_SIZE, &mAllData.mVideoLength));
|
|
|
|
|
mCfgMapIntV2.insert(std::make_pair(IpcConfigKey::VIDEO_LENGTH, config));
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
std::map<std::string, int *> config;
|
|
|
|
|
config.insert(std::make_pair(CONFIG_PIR_DELAYED, &mAllData.mPirDelayed));
|
|
|
|
|
mCfgMapIntV2.insert(std::make_pair(IpcConfigKey::PIR_DELAYED, config));
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
std::map<std::string, int *> config;
|
|
|
|
|
config.insert(std::make_pair(CONFIG_PIR_SENSITIVITY, &mAllData.mPirSensitivity));
|
|
|
|
|
mCfgMapIntV2.insert(std::make_pair(IpcConfigKey::PIR_SENSITIVITY, config));
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
std::map<std::string, bool *> config;
|
|
|
|
|
config.insert(std::make_pair(CONFIG_STORAGE_LOOP, &mAllData.mStorageLoopSwitch));
|
|
|
|
|
mCfgMapBoolV2.insert(std::make_pair(IpcConfigKey::STORAGE_LOOP_SWITCH, config));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void IpcConfigImpl::ReadAllConfigParameters(void)
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|