Improve:Ipc config.
This commit is contained in:
parent
a879da6532
commit
27ad9ac682
|
@ -1,5 +1,6 @@
|
||||||
|
|
||||||
include(${CMAKE_SOURCE_DIR_IPCSDK}/build/global_config.cmake)
|
include(${CMAKE_SOURCE_DIR_IPCSDK}/build/global_config.cmake)
|
||||||
|
include(./build/ipc_config.cmake)
|
||||||
set(EXECUTABLE_OUTPUT_PATH ${EXEC_OUTPUT_PATH})
|
set(EXECUTABLE_OUTPUT_PATH ${EXEC_OUTPUT_PATH})
|
||||||
set(LIBRARY_OUTPUT_PATH ${LIBS_OUTPUT_PATH})
|
set(LIBRARY_OUTPUT_PATH ${LIBS_OUTPUT_PATH})
|
||||||
|
|
||||||
|
@ -14,12 +15,6 @@ include_directories(
|
||||||
#link_directories(
|
#link_directories(
|
||||||
#)
|
#)
|
||||||
|
|
||||||
if (DEFINED IPC_CONFIG_FILE_PATH)
|
|
||||||
add_definitions(-DIPC_CONFIG_FILE_PATH=\"${IPC_CONFIG_FILE_PATH}\")
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "You set define IPC_CONFIG_FILE_PATH in toolchan .cmake file to tell code where to save config file.")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
aux_source_directory(./src SRC_FILES)
|
aux_source_directory(./src SRC_FILES)
|
||||||
|
|
||||||
set(TARGET_NAME IpcConfig)
|
set(TARGET_NAME IpcConfig)
|
||||||
|
@ -60,4 +55,9 @@ add_custom_command(
|
||||||
COMMAND make IpcConfig_code_format
|
COMMAND make IpcConfig_code_format
|
||||||
WORKING_DIRECTORY ${PLATFORM_PATH}/cmake-shell/
|
WORKING_DIRECTORY ${PLATFORM_PATH}/cmake-shell/
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
define_file_name(${TARGET_NAME})
|
||||||
|
|
||||||
|
file(GLOB_RECURSE INSTALL_HEADER_FILES include/*.h)
|
||||||
|
install(FILES ${INSTALL_HEADER_FILES} DESTINATION include)
|
6
middleware/IpcConfig/build/ipc_config.cmake
Normal file
6
middleware/IpcConfig/build/ipc_config.cmake
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
if (DEFINED IPC_CONFIG_FILE_PATH)
|
||||||
|
add_definitions(-DIPC_CONFIG_FILE_PATH=\"${IPC_CONFIG_FILE_PATH}\")
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "You set define IPC_CONFIG_FILE_PATH in toolchan .cmake file to tell code where to save config file.")
|
||||||
|
endif()
|
|
@ -18,22 +18,23 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
|
||||||
enum class IpcConfigKey
|
enum class IpcConfigKey
|
||||||
{
|
{
|
||||||
KEY_WORK_MODE = 0,
|
WIFI_SSID = 0,
|
||||||
KEY_CONTINUOUS_SHOT,
|
WIFI_PASSWORD,
|
||||||
KEY_BURST_PHOTO_INTERVAL,
|
WORK_MODE,
|
||||||
KEY_IMGAE_SIZE,
|
CONTINUOUS_SHOT,
|
||||||
KEY_VIDEO_SIZE,
|
BURST_PHOTO_INTERVAL,
|
||||||
KEY_INFRARED_LAMP_POWER,
|
IMGAE_SIZE,
|
||||||
KEY_DELAYED,
|
VIDEO_SIZE,
|
||||||
KEY_PIR_SENSITIVITY,
|
INFRARED_LAMP_POWER,
|
||||||
KEY_STORAGE_LOOP_SWITCH,
|
PIR_DELAYED,
|
||||||
KEY_FACTORY_RESET_FLAG,
|
PIR_SENSITIVITY,
|
||||||
KEY_FORMATTING_SD_CARD,
|
STORAGE_LOOP_SWITCH,
|
||||||
KEY_DARK_MODE,
|
FACTORY_RESET_FLAG,
|
||||||
KEY_WORK_INTERVAL,
|
FORMATTING_SD_CARD,
|
||||||
|
DARK_MODE,
|
||||||
|
WORK_INTERVAL,
|
||||||
TEST_SHORT,
|
TEST_SHORT,
|
||||||
TEST_LONG,
|
TEST_LONG,
|
||||||
TEST_LLONG,
|
TEST_LLONG,
|
||||||
|
@ -68,7 +69,6 @@ enum VideoSize
|
||||||
VIDEO_SIZE_15 = 15,
|
VIDEO_SIZE_15 = 15,
|
||||||
VIDEO_SIZE_END,
|
VIDEO_SIZE_END,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum InfraredIampPower
|
enum InfraredIampPower
|
||||||
{
|
{
|
||||||
INFRARED_IAMP_POWER_LOW = 0,
|
INFRARED_IAMP_POWER_LOW = 0,
|
||||||
|
|
|
@ -24,62 +24,62 @@ IpcConfigImpl::IpcConfigImpl()
|
||||||
|
|
||||||
std::map<std::string, std::reference_wrapper<int>> innerMapWorkMode;
|
std::map<std::string, std::reference_wrapper<int>> innerMapWorkMode;
|
||||||
innerMapWorkMode.insert(std::make_pair("work_mode", std::reference_wrapper<int>(mAllData.workMode)));
|
innerMapWorkMode.insert(std::make_pair("work_mode", std::reference_wrapper<int>(mAllData.workMode)));
|
||||||
mCfgMapInt.insert(std::make_pair(IpcConfigKey::KEY_WORK_MODE, innerMapWorkMode));
|
mCfgMapInt.insert(std::make_pair(IpcConfigKey::WORK_MODE, innerMapWorkMode));
|
||||||
|
|
||||||
std::map<std::string, std::reference_wrapper<int>> innerMapContinuousShot;
|
std::map<std::string, std::reference_wrapper<int>> innerMapContinuousShot;
|
||||||
innerMapContinuousShot.insert(
|
innerMapContinuousShot.insert(
|
||||||
std::make_pair("continuous_shot", std::reference_wrapper<int>(mAllData.continuousShot)));
|
std::make_pair("continuous_shot", std::reference_wrapper<int>(mAllData.continuousShot)));
|
||||||
mCfgMapInt.insert(std::make_pair(IpcConfigKey::KEY_CONTINUOUS_SHOT, innerMapContinuousShot));
|
mCfgMapInt.insert(std::make_pair(IpcConfigKey::CONTINUOUS_SHOT, innerMapContinuousShot));
|
||||||
|
|
||||||
std::map<std::string, std::reference_wrapper<int>> innerMapBurstPhotoInterval;
|
std::map<std::string, std::reference_wrapper<int>> innerMapBurstPhotoInterval;
|
||||||
innerMapBurstPhotoInterval.insert(
|
innerMapBurstPhotoInterval.insert(
|
||||||
std::make_pair("burst_photo_interval", std::reference_wrapper<int>(mAllData.burstPhotoInterval)));
|
std::make_pair("burst_photo_interval", std::reference_wrapper<int>(mAllData.burstPhotoInterval)));
|
||||||
mCfgMapInt.insert(std::make_pair(IpcConfigKey::KEY_BURST_PHOTO_INTERVAL, innerMapBurstPhotoInterval));
|
mCfgMapInt.insert(std::make_pair(IpcConfigKey::BURST_PHOTO_INTERVAL, innerMapBurstPhotoInterval));
|
||||||
|
|
||||||
std::map<std::string, std::reference_wrapper<CHAR_STRING>> innerMapImageSize;
|
std::map<std::string, std::reference_wrapper<CHAR_STRING>> innerMapImageSize;
|
||||||
innerMapImageSize.insert(std::make_pair("image_size", std::reference_wrapper<CHAR_STRING>(mAllData.imageSize)));
|
innerMapImageSize.insert(std::make_pair("image_size", std::reference_wrapper<CHAR_STRING>(mAllData.imageSize)));
|
||||||
mCfgMapString.insert(std::make_pair(IpcConfigKey::KEY_IMGAE_SIZE, innerMapImageSize));
|
mCfgMapString.insert(std::make_pair(IpcConfigKey::IMGAE_SIZE, innerMapImageSize));
|
||||||
|
|
||||||
std::map<std::string, std::reference_wrapper<int>> innerMapVideoSize;
|
std::map<std::string, std::reference_wrapper<int>> innerMapVideoSize;
|
||||||
innerMapVideoSize.insert(std::make_pair("video_size", std::reference_wrapper<int>(mAllData.videoSize)));
|
innerMapVideoSize.insert(std::make_pair("video_size", std::reference_wrapper<int>(mAllData.videoSize)));
|
||||||
mCfgMapInt.insert(std::make_pair(IpcConfigKey::KEY_VIDEO_SIZE, innerMapVideoSize));
|
mCfgMapInt.insert(std::make_pair(IpcConfigKey::VIDEO_SIZE, innerMapVideoSize));
|
||||||
|
|
||||||
std::map<std::string, std::reference_wrapper<int>> innerMapInfraredLampPower;
|
std::map<std::string, std::reference_wrapper<int>> innerMapInfraredLampPower;
|
||||||
innerMapInfraredLampPower.insert(
|
innerMapInfraredLampPower.insert(
|
||||||
std::make_pair("infrared_lamp_power", std::reference_wrapper<int>(mAllData.infraredIampPower)));
|
std::make_pair("infrared_lamp_power", std::reference_wrapper<int>(mAllData.infraredIampPower)));
|
||||||
mCfgMapInt.insert(std::make_pair(IpcConfigKey::KEY_INFRARED_LAMP_POWER, innerMapInfraredLampPower));
|
mCfgMapInt.insert(std::make_pair(IpcConfigKey::INFRARED_LAMP_POWER, innerMapInfraredLampPower));
|
||||||
|
|
||||||
std::map<std::string, std::reference_wrapper<int>> innerMapDelayed;
|
std::map<std::string, std::reference_wrapper<int>> innerMapDelayed;
|
||||||
innerMapDelayed.insert(std::make_pair("delayed", std::reference_wrapper<int>(mAllData.delayed)));
|
innerMapDelayed.insert(std::make_pair("delayed", std::reference_wrapper<int>(mAllData.delayed)));
|
||||||
mCfgMapInt.insert(std::make_pair(IpcConfigKey::KEY_DELAYED, innerMapDelayed));
|
mCfgMapInt.insert(std::make_pair(IpcConfigKey::PIR_DELAYED, innerMapDelayed));
|
||||||
|
|
||||||
std::map<std::string, std::reference_wrapper<int>> innerMapPirSensitivity;
|
std::map<std::string, std::reference_wrapper<int>> innerMapPirSensitivity;
|
||||||
innerMapPirSensitivity.insert(
|
innerMapPirSensitivity.insert(
|
||||||
std::make_pair("pir_sensitivity", std::reference_wrapper<int>(mAllData.pirSensitivity)));
|
std::make_pair("pir_sensitivity", std::reference_wrapper<int>(mAllData.pirSensitivity)));
|
||||||
mCfgMapInt.insert(std::make_pair(IpcConfigKey::KEY_PIR_SENSITIVITY, innerMapPirSensitivity));
|
mCfgMapInt.insert(std::make_pair(IpcConfigKey::PIR_SENSITIVITY, innerMapPirSensitivity));
|
||||||
|
|
||||||
std::map<std::string, std::reference_wrapper<bool>> innerMapStorageLoopSwitch;
|
std::map<std::string, std::reference_wrapper<bool>> innerMapStorageLoopSwitch;
|
||||||
innerMapStorageLoopSwitch.insert(
|
innerMapStorageLoopSwitch.insert(
|
||||||
std::make_pair("storage_loop_switch", std::reference_wrapper<bool>(mAllData.storageLoopSwitch)));
|
std::make_pair("storage_loop_switch", std::reference_wrapper<bool>(mAllData.storageLoopSwitch)));
|
||||||
mCfgMapBool.insert(std::make_pair(IpcConfigKey::KEY_STORAGE_LOOP_SWITCH, innerMapStorageLoopSwitch));
|
mCfgMapBool.insert(std::make_pair(IpcConfigKey::STORAGE_LOOP_SWITCH, innerMapStorageLoopSwitch));
|
||||||
|
|
||||||
std::map<std::string, std::reference_wrapper<bool>> innerMapFactoryReset;
|
std::map<std::string, std::reference_wrapper<bool>> innerMapFactoryReset;
|
||||||
innerMapFactoryReset.insert(std::make_pair("factory_reset", std::reference_wrapper<bool>(mAllData.factoryReset)));
|
innerMapFactoryReset.insert(std::make_pair("factory_reset", std::reference_wrapper<bool>(mAllData.factoryReset)));
|
||||||
mCfgMapBool.insert(std::make_pair(IpcConfigKey::KEY_FACTORY_RESET_FLAG, innerMapFactoryReset));
|
mCfgMapBool.insert(std::make_pair(IpcConfigKey::FACTORY_RESET_FLAG, innerMapFactoryReset));
|
||||||
|
|
||||||
std::map<std::string, std::reference_wrapper<bool>> innerMapFormattingSDCard;
|
std::map<std::string, std::reference_wrapper<bool>> innerMapFormattingSDCard;
|
||||||
innerMapFormattingSDCard.insert(
|
innerMapFormattingSDCard.insert(
|
||||||
std::make_pair("formatting_SD_card", std::reference_wrapper<bool>(mAllData.formattingSDCard)));
|
std::make_pair("formatting_SD_card", std::reference_wrapper<bool>(mAllData.formattingSDCard)));
|
||||||
mCfgMapBool.insert(std::make_pair(IpcConfigKey::KEY_FORMATTING_SD_CARD, innerMapFormattingSDCard));
|
mCfgMapBool.insert(std::make_pair(IpcConfigKey::FORMATTING_SD_CARD, innerMapFormattingSDCard));
|
||||||
|
|
||||||
std::map<std::string, std::reference_wrapper<CHAR_STRING>> innerMapDrakMode;
|
std::map<std::string, std::reference_wrapper<CHAR_STRING>> innerMapDrakMode;
|
||||||
innerMapDrakMode.insert(std::make_pair("dark_mode", std::reference_wrapper<CHAR_STRING>(mAllData.darkMode)));
|
innerMapDrakMode.insert(std::make_pair("dark_mode", std::reference_wrapper<CHAR_STRING>(mAllData.darkMode)));
|
||||||
mCfgMapString.insert(std::make_pair(IpcConfigKey::KEY_DARK_MODE, innerMapDrakMode));
|
mCfgMapString.insert(std::make_pair(IpcConfigKey::DARK_MODE, innerMapDrakMode));
|
||||||
|
|
||||||
std::map<std::string, std::reference_wrapper<CHAR_STRING>> innerMapWorkInterval;
|
std::map<std::string, std::reference_wrapper<CHAR_STRING>> innerMapWorkInterval;
|
||||||
innerMapWorkInterval.insert(
|
innerMapWorkInterval.insert(
|
||||||
std::make_pair("work_interval", std::reference_wrapper<CHAR_STRING>(mAllData.workingInterval)));
|
std::make_pair("work_interval", std::reference_wrapper<CHAR_STRING>(mAllData.workingInterval)));
|
||||||
mCfgMapString.insert(std::make_pair(IpcConfigKey::KEY_WORK_INTERVAL, innerMapWorkInterval));
|
mCfgMapString.insert(std::make_pair(IpcConfigKey::WORK_INTERVAL, innerMapWorkInterval));
|
||||||
|
|
||||||
std::map<std::string, std::reference_wrapper<short>> innerMapShort;
|
std::map<std::string, std::reference_wrapper<short>> innerMapShort;
|
||||||
innerMapShort.insert(std::make_pair("test_short", std::reference_wrapper<short>(mAllData.testShort)));
|
innerMapShort.insert(std::make_pair("test_short", std::reference_wrapper<short>(mAllData.testShort)));
|
||||||
|
|
|
@ -19,7 +19,7 @@ link_directories(
|
||||||
)
|
)
|
||||||
|
|
||||||
aux_source_directory(. SRC_FILES)
|
aux_source_directory(. SRC_FILES)
|
||||||
aux_source_directory(${TEST_SOURCE_PATH}/middleware/IpcConfig/src SRC_FILES)
|
# aux_source_directory(${TEST_SOURCE_PATH}/middleware/IpcConfig/src SRC_FILES)
|
||||||
set(TARGET_NAME AllTest)
|
set(TARGET_NAME AllTest)
|
||||||
add_executable(${TARGET_NAME} ${SRC_FILES})
|
add_executable(${TARGET_NAME} ${SRC_FILES})
|
||||||
target_link_libraries(${TARGET_NAME} IpcConfig gtest gmock pthread)
|
target_link_libraries(${TARGET_NAME} IpcConfig gtest gmock pthread)
|
||||||
|
|
|
@ -38,6 +38,7 @@ public:
|
||||||
static void TearDownTestCase()
|
static void TearDownTestCase()
|
||||||
{
|
{
|
||||||
ILogUnInit();
|
ILogUnInit();
|
||||||
|
DestroyLogModule();
|
||||||
}
|
}
|
||||||
virtual void SetUp()
|
virtual void SetUp()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
# include(${CMAKE_SOURCE_DIR}/build/independent_source.cmake)
|
|
||||||
include(${CMAKE_SOURCE_DIR_IPCSDK}/build/global_config.cmake)
|
include(${CMAKE_SOURCE_DIR_IPCSDK}/build/global_config.cmake)
|
||||||
|
include(${MIDDLEWARE_SOURCE_PATH}/IpcConfig/build/ipc_config.cmake)
|
||||||
set(EXECUTABLE_OUTPUT_PATH ${TEST_OUTPUT_PATH}/bin)
|
set(EXECUTABLE_OUTPUT_PATH ${TEST_OUTPUT_PATH}/bin)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
|
@ -8,6 +9,7 @@ include_directories(
|
||||||
./include
|
./include
|
||||||
${UTILS_SOURCE_PATH}/Log/include
|
${UTILS_SOURCE_PATH}/Log/include
|
||||||
${UTILS_SOURCE_PATH}/StatusCode/include
|
${UTILS_SOURCE_PATH}/StatusCode/include
|
||||||
|
${UTILS_SOURCE_PATH}/LinuxApi/include
|
||||||
${MIDDLEWARE_SOURCE_PATH}/IpcConfig/include
|
${MIDDLEWARE_SOURCE_PATH}/IpcConfig/include
|
||||||
${EXTERNAL_SOURCE_PATH}/gtest/googletest-release-1.11.0/googletest/include
|
${EXTERNAL_SOURCE_PATH}/gtest/googletest-release-1.11.0/googletest/include
|
||||||
${EXTERNAL_SOURCE_PATH}/gtest/googletest-release-1.11.0/googlemock/include
|
${EXTERNAL_SOURCE_PATH}/gtest/googletest-release-1.11.0/googlemock/include
|
||||||
|
@ -23,7 +25,7 @@ aux_source_directory(./src SRC_FILES)
|
||||||
|
|
||||||
set(TARGET_NAME IpcConfigTest)
|
set(TARGET_NAME IpcConfigTest)
|
||||||
add_executable(${TARGET_NAME} ${SRC_FILES_MAIN} ${SRC_FILES})
|
add_executable(${TARGET_NAME} ${SRC_FILES_MAIN} ${SRC_FILES})
|
||||||
target_link_libraries(${TARGET_NAME} IpcConfig gtest gmock pthread)
|
target_link_libraries(${TARGET_NAME} IpcConfig LinuxApi gtest gmock pthread)
|
||||||
if(${TEST_COVERAGE} MATCHES "true")
|
if(${TEST_COVERAGE} MATCHES "true")
|
||||||
target_link_libraries(${TARGET_NAME} gcov)
|
target_link_libraries(${TARGET_NAME} gcov)
|
||||||
endif()
|
endif()
|
||||||
|
@ -64,4 +66,5 @@ add_custom_command(
|
||||||
WORKING_DIRECTORY ${PLATFORM_PATH}/cmake-shell/
|
WORKING_DIRECTORY ${PLATFORM_PATH}/cmake-shell/
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
define_file_name(${TARGET_NAME})
|
define_file_name(${TARGET_NAME})
|
|
@ -1,81 +1,82 @@
|
||||||
#include "IIpcConfig.h"
|
#include "IIpcConfig.h"
|
||||||
#include "ILog.h"
|
#include "ILog.h"
|
||||||
|
#include "LinuxApi.h"
|
||||||
// #include <gmock/gmock.h>
|
// #include <gmock/gmock.h>
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
namespace IpcConfigTest
|
namespace IpcConfigTest
|
||||||
{
|
{
|
||||||
// ../output_files/test/bin/IpcConfigTest --gtest_filter=IpcConfigTest.Demo
|
// ../output_files/test/bin/IpcConfigTest --gtest_filter=IpcConfigDemo.Demo
|
||||||
TEST(IpcConfigTest, Demo)
|
TEST(IpcConfigDemo, Demo)
|
||||||
{
|
{
|
||||||
CreateLogModule();
|
CreateLogModule();
|
||||||
CreateIpcConfigModule();
|
CreateIpcConfigModule();
|
||||||
ILogInit(LOG_INSTANCE_TYPE_END);
|
ILogInit(LOG_INSTANCE_TYPE_END);
|
||||||
IIpcConfig::GetInstance()->Init();
|
IIpcConfig::GetInstance()->Init();
|
||||||
|
|
||||||
const int workMode = IIpcConfig::GetInstance()->GetInt(IpcConfigKey::KEY_WORK_MODE);
|
const int workMode = IIpcConfig::GetInstance()->GetInt(IpcConfigKey::WORK_MODE);
|
||||||
LogInfo("Get workMode = %d\n", workMode);
|
LogInfo("Get workMode = %d\n", workMode);
|
||||||
const int wworkMode = WORK_MODE_PIC_VIDEO;
|
const int wworkMode = WORK_MODE_PIC_VIDEO;
|
||||||
IIpcConfig::GetInstance()->SetInt(IpcConfigKey::KEY_WORK_MODE, wworkMode);
|
IIpcConfig::GetInstance()->SetInt(IpcConfigKey::WORK_MODE, wworkMode);
|
||||||
|
|
||||||
const int continuousShot = IIpcConfig::GetInstance()->GetInt(IpcConfigKey::KEY_CONTINUOUS_SHOT);
|
const int continuousShot = IIpcConfig::GetInstance()->GetInt(IpcConfigKey::CONTINUOUS_SHOT);
|
||||||
LogInfo("Get continuousShot = %d\n", continuousShot);
|
LogInfo("Get continuousShot = %d\n", continuousShot);
|
||||||
const int ccontinuousShot = CONTINUOUS_SHOT_TWO_PIC;
|
const int ccontinuousShot = CONTINUOUS_SHOT_TWO_PIC;
|
||||||
IIpcConfig::GetInstance()->SetInt(IpcConfigKey::KEY_CONTINUOUS_SHOT, ccontinuousShot);
|
IIpcConfig::GetInstance()->SetInt(IpcConfigKey::CONTINUOUS_SHOT, ccontinuousShot);
|
||||||
|
|
||||||
const int burstPhotoInterval = IIpcConfig::GetInstance()->GetInt(IpcConfigKey::KEY_BURST_PHOTO_INTERVAL);
|
const int burstPhotoInterval = IIpcConfig::GetInstance()->GetInt(IpcConfigKey::BURST_PHOTO_INTERVAL);
|
||||||
LogInfo("Get burstPhotoInterval = %d\n", burstPhotoInterval);
|
LogInfo("Get burstPhotoInterval = %d\n", burstPhotoInterval);
|
||||||
const int bburstPhotoInterval = BURST_PHOTO_INTERVAL_DEFAULT;
|
const int bburstPhotoInterval = BURST_PHOTO_INTERVAL_DEFAULT;
|
||||||
IIpcConfig::GetInstance()->SetInt(IpcConfigKey::KEY_BURST_PHOTO_INTERVAL, bburstPhotoInterval);
|
IIpcConfig::GetInstance()->SetInt(IpcConfigKey::BURST_PHOTO_INTERVAL, bburstPhotoInterval);
|
||||||
|
|
||||||
const std::string imageSize = IIpcConfig::GetInstance()->GetString(IpcConfigKey::KEY_IMGAE_SIZE);
|
const std::string imageSize = IIpcConfig::GetInstance()->GetString(IpcConfigKey::IMGAE_SIZE);
|
||||||
LogInfo("Get image_size = %s\n", imageSize.c_str());
|
LogInfo("Get image_size = %s\n", imageSize.c_str());
|
||||||
const std::string iimageSize = "410*410";
|
const std::string iimageSize = "410*410";
|
||||||
IIpcConfig::GetInstance()->SetString(IpcConfigKey::KEY_IMGAE_SIZE, iimageSize);
|
IIpcConfig::GetInstance()->SetString(IpcConfigKey::IMGAE_SIZE, iimageSize);
|
||||||
|
|
||||||
const int videoSize = IIpcConfig::GetInstance()->GetInt(IpcConfigKey::KEY_VIDEO_SIZE);
|
const int videoSize = IIpcConfig::GetInstance()->GetInt(IpcConfigKey::VIDEO_SIZE);
|
||||||
LogInfo("Get video_size = %d\n", videoSize);
|
LogInfo("Get video_size = %d\n", videoSize);
|
||||||
const int vvideoSize = VIDEO_SIZE_10;
|
const int vvideoSize = VIDEO_SIZE_10;
|
||||||
IIpcConfig::GetInstance()->SetInt(IpcConfigKey::KEY_VIDEO_SIZE, vvideoSize);
|
IIpcConfig::GetInstance()->SetInt(IpcConfigKey::VIDEO_SIZE, vvideoSize);
|
||||||
|
|
||||||
const int infraredIampPower = IIpcConfig::GetInstance()->GetInt(IpcConfigKey::KEY_INFRARED_LAMP_POWER);
|
const int infraredIampPower = IIpcConfig::GetInstance()->GetInt(IpcConfigKey::INFRARED_LAMP_POWER);
|
||||||
LogInfo("Get infrared_lamp_power = %d\n", infraredIampPower);
|
LogInfo("Get infrared_lamp_power = %d\n", infraredIampPower);
|
||||||
const int iinfraredIampPower = INFRARED_IAMP_POWER_LOW;
|
const int iinfraredIampPower = INFRARED_IAMP_POWER_LOW;
|
||||||
IIpcConfig::GetInstance()->SetInt(IpcConfigKey::KEY_INFRARED_LAMP_POWER, iinfraredIampPower);
|
IIpcConfig::GetInstance()->SetInt(IpcConfigKey::INFRARED_LAMP_POWER, iinfraredIampPower);
|
||||||
|
|
||||||
const int delayed = IIpcConfig::GetInstance()->GetInt(IpcConfigKey::KEY_DELAYED);
|
const int delayed = IIpcConfig::GetInstance()->GetInt(IpcConfigKey::PIR_DELAYED);
|
||||||
LogInfo("Get delayed = %d\n", delayed);
|
LogInfo("Get delayed = %d\n", delayed);
|
||||||
const int ddelayed = DELAYED_MAX;
|
const int ddelayed = DELAYED_MAX;
|
||||||
IIpcConfig::GetInstance()->SetInt(IpcConfigKey::KEY_DELAYED, ddelayed);
|
IIpcConfig::GetInstance()->SetInt(IpcConfigKey::PIR_DELAYED, ddelayed);
|
||||||
|
|
||||||
const int pirSensitivity = IIpcConfig::GetInstance()->GetInt(IpcConfigKey::KEY_PIR_SENSITIVITY);
|
const int pirSensitivity = IIpcConfig::GetInstance()->GetInt(IpcConfigKey::PIR_SENSITIVITY);
|
||||||
LogInfo("Get pir_sensitivity = %d\n", pirSensitivity);
|
LogInfo("Get pir_sensitivity = %d\n", pirSensitivity);
|
||||||
const int ppirSensitivity = PIR_SENSITIVITY_MAX;
|
const int ppirSensitivity = PIR_SENSITIVITY_MAX;
|
||||||
IIpcConfig::GetInstance()->SetInt(IpcConfigKey::KEY_PIR_SENSITIVITY, ppirSensitivity);
|
IIpcConfig::GetInstance()->SetInt(IpcConfigKey::PIR_SENSITIVITY, ppirSensitivity);
|
||||||
|
|
||||||
const bool storageLoopSwitch = IIpcConfig::GetInstance()->GetBool(IpcConfigKey::KEY_STORAGE_LOOP_SWITCH);
|
const bool storageLoopSwitch = IIpcConfig::GetInstance()->GetBool(IpcConfigKey::STORAGE_LOOP_SWITCH);
|
||||||
LogInfo("Get storage_loop_switch = %d\n", storageLoopSwitch);
|
LogInfo("Get storage_loop_switch = %d\n", storageLoopSwitch);
|
||||||
const bool sstorageLoopSwitch = false;
|
const bool sstorageLoopSwitch = false;
|
||||||
IIpcConfig::GetInstance()->SetBool(IpcConfigKey::KEY_STORAGE_LOOP_SWITCH, sstorageLoopSwitch);
|
IIpcConfig::GetInstance()->SetBool(IpcConfigKey::STORAGE_LOOP_SWITCH, sstorageLoopSwitch);
|
||||||
|
|
||||||
const bool factoryReset = IIpcConfig::GetInstance()->GetBool(IpcConfigKey::KEY_FACTORY_RESET_FLAG);
|
const bool factoryReset = IIpcConfig::GetInstance()->GetBool(IpcConfigKey::FACTORY_RESET_FLAG);
|
||||||
LogInfo("Get factory_reset = %d\n", factoryReset);
|
LogInfo("Get factory_reset = %d\n", factoryReset);
|
||||||
const bool ffactoryReset = false;
|
const bool ffactoryReset = false;
|
||||||
IIpcConfig::GetInstance()->SetBool(IpcConfigKey::KEY_FACTORY_RESET_FLAG, ffactoryReset);
|
IIpcConfig::GetInstance()->SetBool(IpcConfigKey::FACTORY_RESET_FLAG, ffactoryReset);
|
||||||
|
|
||||||
const bool formattingSDCard = IIpcConfig::GetInstance()->GetBool(IpcConfigKey::KEY_FORMATTING_SD_CARD);
|
const bool formattingSDCard = IIpcConfig::GetInstance()->GetBool(IpcConfigKey::FORMATTING_SD_CARD);
|
||||||
LogInfo("Get formatting_SD_card = %d\n", formattingSDCard);
|
LogInfo("Get formatting_SD_card = %d\n", formattingSDCard);
|
||||||
const bool fformattingSDCard = false;
|
const bool fformattingSDCard = false;
|
||||||
IIpcConfig::GetInstance()->SetBool(IpcConfigKey::KEY_FORMATTING_SD_CARD, fformattingSDCard);
|
IIpcConfig::GetInstance()->SetBool(IpcConfigKey::FORMATTING_SD_CARD, fformattingSDCard);
|
||||||
|
|
||||||
const std::string workInterval = IIpcConfig::GetInstance()->GetString(IpcConfigKey::KEY_WORK_INTERVAL);
|
const std::string workInterval = IIpcConfig::GetInstance()->GetString(IpcConfigKey::WORK_INTERVAL);
|
||||||
LogInfo("Get work_Interval = %s\n", workInterval.c_str());
|
LogInfo("Get work_Interval = %s\n", workInterval.c_str());
|
||||||
const std::string wworkInterval = "06:00:01-06:00:00";
|
const std::string wworkInterval = "06:00:01-06:00:00";
|
||||||
IIpcConfig::GetInstance()->SetString(IpcConfigKey::KEY_WORK_INTERVAL, wworkInterval);
|
IIpcConfig::GetInstance()->SetString(IpcConfigKey::WORK_INTERVAL, wworkInterval);
|
||||||
|
|
||||||
const std::string drakMode = IIpcConfig::GetInstance()->GetString(IpcConfigKey::KEY_DARK_MODE);
|
const std::string drakMode = IIpcConfig::GetInstance()->GetString(IpcConfigKey::DARK_MODE);
|
||||||
LogInfo("Get dark_mode = %s\n", drakMode.c_str());
|
LogInfo("Get dark_mode = %s\n", drakMode.c_str());
|
||||||
const std::string ddrakMode = "18:00:00-06:00:00";
|
const std::string ddrakMode = "18:00:00-06:00:00";
|
||||||
IIpcConfig::GetInstance()->SetString(IpcConfigKey::KEY_DARK_MODE, ddrakMode);
|
IIpcConfig::GetInstance()->SetString(IpcConfigKey::DARK_MODE, ddrakMode);
|
||||||
|
|
||||||
short testShort = IIpcConfig::GetInstance()->GetShort(IpcConfigKey::TEST_SHORT);
|
short testShort = IIpcConfig::GetInstance()->GetShort(IpcConfigKey::TEST_SHORT);
|
||||||
LogInfo("Get test_short = %d\n", testShort);
|
LogInfo("Get test_short = %d\n", testShort);
|
||||||
|
@ -107,4 +108,51 @@ TEST(IpcConfigTest, Demo)
|
||||||
ILogUnInit();
|
ILogUnInit();
|
||||||
DestroyLogModule();
|
DestroyLogModule();
|
||||||
}
|
}
|
||||||
|
class IpcConfigTest : public testing::Test
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
IpcConfigTest()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
virtual ~IpcConfigTest()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
static void SetUpTestCase()
|
||||||
|
{
|
||||||
|
ILogInit(LOG_INSTANCE_TYPE_END);
|
||||||
|
CreateLogModule();
|
||||||
|
}
|
||||||
|
static void TearDownTestCase()
|
||||||
|
{
|
||||||
|
ILogUnInit();
|
||||||
|
DestroyLogModule();
|
||||||
|
}
|
||||||
|
virtual void SetUp()
|
||||||
|
{
|
||||||
|
CreateIpcConfigModule();
|
||||||
|
IIpcConfig::GetInstance()->Init();
|
||||||
|
}
|
||||||
|
virtual void TearDown()
|
||||||
|
{
|
||||||
|
IIpcConfig::GetInstance()->UnInit();
|
||||||
|
DestroyIpcConfigModule();
|
||||||
|
RemoveConfigFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
void RemoveConfigFile(void)
|
||||||
|
{
|
||||||
|
constexpr int FIEL_EXIST = 0;
|
||||||
|
if (FIEL_EXIST == access(IPC_CONFIG_FILE_PATH, F_OK)) {
|
||||||
|
constexpr int BUFF_SIZE = 128;
|
||||||
|
char cmd[BUFF_SIZE] = {0};
|
||||||
|
snprintf(cmd, BUFF_SIZE, "rm -f %s", IPC_CONFIG_FILE_PATH);
|
||||||
|
fx_system(cmd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// ../output_files/test/bin/IpcConfigTest --gtest_filter=IpcConfigTest.Wifi
|
||||||
|
TEST_F(IpcConfigTest, Wifi)
|
||||||
|
{
|
||||||
|
}
|
||||||
} // namespace IpcConfigTest
|
} // namespace IpcConfigTest
|
Loading…
Reference in New Issue
Block a user