From a879da6532497bbfacecfa16b4e1c4171547d812 Mon Sep 17 00:00:00 2001 From: Fancy code <258828110.@qq.com> Date: Thu, 16 May 2024 20:00:34 +0800 Subject: [PATCH] Add:Ipc config module. --- .../HuntingCamera/build/hunting_camera.cmake | 3 +- application/HuntingCamera/src/MainThread.cpp | 5 ++ application/MissionManager/src/McuMonitor.cpp | 39 ++++++++++++++ application/MissionManager/src/McuMonitor.h | 2 + application/MissionManager/src/TopState.cpp | 9 ++-- application/MissionManager/src/TopState.h | 2 + middleware/IpcConfig/CMakeLists.txt | 1 - middleware/IpcConfig/include/IIpcConfig.h | 4 +- .../src/{IpcConfig.cpp => IpcConfigImpl.cpp} | 52 +++++++++---------- .../src/{IpcConfig.h => IpcConfigImpl.h} | 10 ++-- middleware/IpcConfig/src/IpcConfigMakePtr.cpp | 22 ++++++-- .../IpcConfig/src/IpcConfig_Test.cpp | 2 +- .../src_mock/McuManager_Mock_Test.cpp | 18 ++++--- 13 files changed, 119 insertions(+), 50 deletions(-) rename middleware/IpcConfig/src/{IpcConfig.cpp => IpcConfigImpl.cpp} (91%) rename middleware/IpcConfig/src/{IpcConfig.h => IpcConfigImpl.h} (93%) diff --git a/application/HuntingCamera/build/hunting_camera.cmake b/application/HuntingCamera/build/hunting_camera.cmake index 850d24b0..fceaeaec 100644 --- a/application/HuntingCamera/build/hunting_camera.cmake +++ b/application/HuntingCamera/build/hunting_camera.cmake @@ -7,8 +7,9 @@ set(HUNTTING_MAIN_INCLUDE_PATH "${HUNTTING_MAIN_INCLUDE_PATH};${MIDDLEWARE_S set(HUNTTING_MAIN_INCLUDE_PATH "${HUNTTING_MAIN_INCLUDE_PATH};${MIDDLEWARE_SOURCE_PATH}/FilesManager/include") set(HUNTTING_MAIN_INCLUDE_PATH "${HUNTTING_MAIN_INCLUDE_PATH};${MIDDLEWARE_SOURCE_PATH}/StorageManager/include") set(HUNTTING_MAIN_INCLUDE_PATH "${HUNTTING_MAIN_INCLUDE_PATH};${MIDDLEWARE_SOURCE_PATH}/HuntingUpgrade/include") +set(HUNTTING_MAIN_INCLUDE_PATH "${HUNTTING_MAIN_INCLUDE_PATH};${MIDDLEWARE_SOURCE_PATH}/IpcConfig/include") set(HUNTTING_MAIN_INCLUDE_PATH "${HUNTTING_MAIN_INCLUDE_PATH};${UTILS_SOURCE_PATH}/StatusCode/include") set(HUNTTING_MAIN_INCLUDE_PATH "${HUNTTING_MAIN_INCLUDE_PATH};${UTILS_SOURCE_PATH}/Log/include") set(HUNTTING_MAIN_INCLUDE_PATH "${HUNTTING_MAIN_INCLUDE_PATH};${HAL_SOURCE_PATH}/include") -set(HUNTTING_LINK_LIB McuManager MissionManager StateMachine AppManager FilesManager StorageManager HuntingUpgrade StatusCode Log Hal pthread dl) \ No newline at end of file +set(HUNTTING_LINK_LIB McuManager MissionManager StateMachine AppManager FilesManager StorageManager HuntingUpgrade IpcConfig StatusCode Log Hal pthread dl) \ No newline at end of file diff --git a/application/HuntingCamera/src/MainThread.cpp b/application/HuntingCamera/src/MainThread.cpp index 4cd40010..41fd0c96 100644 --- a/application/HuntingCamera/src/MainThread.cpp +++ b/application/HuntingCamera/src/MainThread.cpp @@ -17,6 +17,7 @@ #include "IFilesManager.h" #include "IHalCpp.h" #include "IHuntingUpgrade.h" +#include "IIpcConfig.h" #include "ILog.h" #include "IMcuManager.h" #include "IMediaManager.h" @@ -66,6 +67,7 @@ StatusCode MainThread::Init(void) IHalCpp::GetInstance()->Init(); IMcuManager::GetInstance()->Init(); IStorageManager::GetInstance()->Init(); + IIpcConfig::GetInstance()->Init(); IMediaManager::GetInstance()->Init(); IMissionManager::GetInstance()->Init(); return CreateStatusCode(STATUS_CODE_OK); @@ -74,6 +76,7 @@ StatusCode MainThread::UnInit(void) { IMissionManager::GetInstance()->UnInit(); IMediaManager::GetInstance()->UnInit(); + IIpcConfig::GetInstance()->UnInit(); IStorageManager::GetInstance()->UnInit(); IMcuManager::GetInstance()->UnInit(); IHalCpp::GetInstance()->UnInit(); @@ -92,6 +95,7 @@ StatusCode MainThread::CreateAllModules(void) CreateAppManagerModule(); CreateMediaManagerModule(); CreateHuntingUpgradeModule(); + CreateIpcConfigModule(); return CreateStatusCode(STATUS_CODE_OK); } void MainThread::DestoryAllModules(void) @@ -105,6 +109,7 @@ void MainThread::DestoryAllModules(void) DestroyStorageManagerModule(); DestroyMcuManager(); DestroyHalCppModule(); + DestroyIpcConfigModule(); } void MainThread::ResetAllPtrMaker(void) { diff --git a/application/MissionManager/src/McuMonitor.cpp b/application/MissionManager/src/McuMonitor.cpp index 1edce0ab..49d7ec10 100644 --- a/application/MissionManager/src/McuMonitor.cpp +++ b/application/MissionManager/src/McuMonitor.cpp @@ -13,6 +13,15 @@ * limitations under the License. */ #include "McuMonitor.h" +#include "ILog.h" +#include "IMcuManager.h" +void McuMonitor::Init(std::shared_ptr &monitor) +{ + IMcuManager::GetInstance()->SetMcuMonitor(monitor); +} +void McuMonitor::UnInit(void) +{ +} void McuMonitor::RecvIpcMissionEvent(std::shared_ptr &recv, const IpcMission &mission) { } @@ -21,10 +30,40 @@ void McuMonitor::RecvMcuHeartBeatEvent(std::shared_ptr &recv) } void McuMonitor::RecvGetIntervalStartEvent(std::shared_ptr &recv) { + LogInfo("RecvGetIntervalStartEvent\n"); + std::shared_ptr> recvData = + std::dynamic_pointer_cast>(recv); + if (recvData) { + recvData->mDataRecvReply.mHour = 10; + recvData->mDataRecvReply.mMin = 10; + recvData->mDataRecvReply.mSecond = 10; + recv->ReplyFinished(true); + } + recv->ReplyFinished(false); } void McuMonitor::RecvGetDateTime(std::shared_ptr &recv) { + LogInfo("RecvGetDateTime\n"); + std::shared_ptr> recvData = std::dynamic_pointer_cast>(recv); + if (recvData) { + recvData->mDataRecvReply.mYear = 2024; + recvData->mDataRecvReply.mMon = 10; + recvData->mDataRecvReply.mDay = 10; + recvData->mDataRecvReply.mHour = 10; + recvData->mDataRecvReply.mMin = 10; + recvData->mDataRecvReply.mSecond = 10; + recv->ReplyFinished(true); + } + recv->ReplyFinished(false); } void McuMonitor::RecvGetPirSensitivity(std::shared_ptr &recv) { + LogInfo("RecvGetPirSensitivity\n"); + std::shared_ptr> recvData = + std::dynamic_pointer_cast>(recv); + if (recvData) { + recvData->mDataRecvReply.mSensitivity = 9; + recv->ReplyFinished(true); + } + recv->ReplyFinished(false); } \ No newline at end of file diff --git a/application/MissionManager/src/McuMonitor.h b/application/MissionManager/src/McuMonitor.h index 9a9f1e59..d7abad62 100644 --- a/application/MissionManager/src/McuMonitor.h +++ b/application/MissionManager/src/McuMonitor.h @@ -20,6 +20,8 @@ class McuMonitor : public VMcuMonitor public: McuMonitor() = default; virtual ~McuMonitor() = default; + void Init(std::shared_ptr &monitor); + void UnInit(void); void RecvIpcMissionEvent(std::shared_ptr &recv, const IpcMission &mission) override; void RecvMcuHeartBeatEvent(std::shared_ptr &recv) override; void RecvGetIntervalStartEvent(std::shared_ptr &recv) override; diff --git a/application/MissionManager/src/TopState.cpp b/application/MissionManager/src/TopState.cpp index abfe75a9..1ab1063d 100644 --- a/application/MissionManager/src/TopState.cpp +++ b/application/MissionManager/src/TopState.cpp @@ -18,13 +18,16 @@ #include "MissionStateMachine.h" TopState::TopState() : State("TopState") { - mEventHandle[InternalStateEvent::STORAGE_HANDLE_STATE_INIT] = std::bind(&TopState::StorageStartInitHandle, this, _1); + mEventHandle[InternalStateEvent::STORAGE_HANDLE_STATE_INIT] = + std::bind(&TopState::StorageStartInitHandle, this, _1); } void TopState::GoInState() { LogInfo(" ========== TopState::GoInState.\n"); - std::shared_ptr monitor = std::dynamic_pointer_cast(shared_from_this()); - IMediaManager::GetInstance()->SetMediaMonitor(monitor); + std::shared_ptr mcuMonitor = std::dynamic_pointer_cast(shared_from_this()); + McuMonitor::Init(mcuMonitor); + std::shared_ptr mediaMonitor = std::dynamic_pointer_cast(shared_from_this()); + IMediaManager::GetInstance()->SetMediaMonitor(mediaMonitor); MissionStateMachine::GetInstance()->SwitchState(SystemState::MISSION_STATE); } void TopState::GoOutState() diff --git a/application/MissionManager/src/TopState.h b/application/MissionManager/src/TopState.h index f8b6a17d..e09b9b31 100644 --- a/application/MissionManager/src/TopState.h +++ b/application/MissionManager/src/TopState.h @@ -17,9 +17,11 @@ #include "DataProcessing.h" #include "IMediaManager.h" #include "IStateMachine.h" +#include "McuMonitor.h" class TopState : public State, public DataProcessing, public VMediaMonitor, + public McuMonitor, public std::enable_shared_from_this { public: diff --git a/middleware/IpcConfig/CMakeLists.txt b/middleware/IpcConfig/CMakeLists.txt index 9a987b5f..81c1be50 100644 --- a/middleware/IpcConfig/CMakeLists.txt +++ b/middleware/IpcConfig/CMakeLists.txt @@ -14,7 +14,6 @@ include_directories( #link_directories( #) - if (DEFINED IPC_CONFIG_FILE_PATH) add_definitions(-DIPC_CONFIG_FILE_PATH=\"${IPC_CONFIG_FILE_PATH}\") else() diff --git a/middleware/IpcConfig/include/IIpcConfig.h b/middleware/IpcConfig/include/IIpcConfig.h index 5a84893e..11317a00 100644 --- a/middleware/IpcConfig/include/IIpcConfig.h +++ b/middleware/IpcConfig/include/IIpcConfig.h @@ -90,7 +90,8 @@ enum PirSensitivity PIR_SENSITIVITY_MAX = 9, PIR_SENSITIVITY_END, }; - +bool CreateIpcConfigModule(void); +bool DestroyIpcConfigModule(void); class IIpcConfig { public: @@ -121,5 +122,4 @@ public: virtual const std::string GetString(const IpcConfigKey &key); virtual void SetString(const IpcConfigKey &key, const std::string string); }; -bool CreateIpcConfig(void); #endif \ No newline at end of file diff --git a/middleware/IpcConfig/src/IpcConfig.cpp b/middleware/IpcConfig/src/IpcConfigImpl.cpp similarity index 91% rename from middleware/IpcConfig/src/IpcConfig.cpp rename to middleware/IpcConfig/src/IpcConfigImpl.cpp index b673908e..4e687f85 100644 --- a/middleware/IpcConfig/src/IpcConfig.cpp +++ b/middleware/IpcConfig/src/IpcConfigImpl.cpp @@ -12,13 +12,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "IpcConfig.h" +#include "IpcConfigImpl.h" #include "ILog.h" #include #define CHECK_MAP(map) (map.size() == 1 ? true : false) -IpcConfig::IpcConfig() +IpcConfigImpl::IpcConfigImpl() { mCfgChanged = CONFIG_HAS_NOT_CHANGED; @@ -101,7 +101,7 @@ IpcConfig::IpcConfig() innerMapFloat.insert(std::make_pair("test_float", std::reference_wrapper(mAllData.testFloat))); mCfgMapFloat.insert(std::make_pair(IpcConfigKey::TEST_FLOAT, innerMapFloat)); } -const StatusCode IpcConfig::Init(void) +const StatusCode IpcConfigImpl::Init(void) { memset(&mAllData, 0, sizeof(Config_s)); mCfg = OpenConfigFile(IPC_CONFIG_FILE_PATH); @@ -112,7 +112,7 @@ const StatusCode IpcConfig::Init(void) ReadAllConfigParameters(); return CreateStatusCode(STATUS_CODE_OK); } -const StatusCode IpcConfig::UnInit(void) +const StatusCode IpcConfigImpl::UnInit(void) { if (CONFIG_HAS_CHANGED == mCfgChanged) { LogInfo("Save config files.\n"); @@ -121,12 +121,12 @@ const StatusCode IpcConfig::UnInit(void) CloseConfigFile(mCfg); return CreateStatusCode(STATUS_CODE_OK); } -const StatusCode IpcConfig::ConfigFileSave(void) +const StatusCode IpcConfigImpl::ConfigFileSave(void) { return ConfigSaveFile(mCfg); } -const int IpcConfig::GetInt(const IpcConfigKey &key) +const int IpcConfigImpl::GetInt(const IpcConfigKey &key) { std::map>>::iterator iter; iter = mCfgMapInt.find(key); @@ -137,7 +137,7 @@ const int IpcConfig::GetInt(const IpcConfigKey &key) constexpr int UNKNOWN_CONFIG = -1; return UNKNOWN_CONFIG; } -void IpcConfig::SetInt(const IpcConfigKey &key, const int &value) +void IpcConfigImpl::SetInt(const IpcConfigKey &key, const int &value) { std::map>>::iterator iter; iter = mCfgMapInt.find(key); @@ -151,7 +151,7 @@ void IpcConfig::SetInt(const IpcConfigKey &key, const int &value) LogError("Can't find the key.\n"); } } -const short IpcConfig::GetShort(const IpcConfigKey &key) +const short IpcConfigImpl::GetShort(const IpcConfigKey &key) { std::map>>::iterator iter; iter = mCfgMapShort.find(key); @@ -162,7 +162,7 @@ const short IpcConfig::GetShort(const IpcConfigKey &key) constexpr short UNKNOWN_CONFIG = -1; return UNKNOWN_CONFIG; } -void IpcConfig::SetShort(const IpcConfigKey &key, const short &value) +void IpcConfigImpl::SetShort(const IpcConfigKey &key, const short &value) { std::map>>::iterator iter; iter = mCfgMapShort.find(key); @@ -176,7 +176,7 @@ void IpcConfig::SetShort(const IpcConfigKey &key, const short &value) LogError("Can't find the key.\n"); } } -const long IpcConfig::GetLong(const IpcConfigKey &key) +const long IpcConfigImpl::GetLong(const IpcConfigKey &key) { std::map>>::iterator iter; iter = mCfgMapLong.find(key); @@ -187,7 +187,7 @@ const long IpcConfig::GetLong(const IpcConfigKey &key) constexpr long UNKNOWN_CONFIG = -1; return UNKNOWN_CONFIG; } -void IpcConfig::SetLong(const IpcConfigKey &key, const long &value) +void IpcConfigImpl::SetLong(const IpcConfigKey &key, const long &value) { std::map>>::iterator iter; iter = mCfgMapLong.find(key); @@ -201,7 +201,7 @@ void IpcConfig::SetLong(const IpcConfigKey &key, const long &value) LogError("Can't find the key.\n"); } } -const long long IpcConfig::GetLLong(const IpcConfigKey &key) +const long long IpcConfigImpl::GetLLong(const IpcConfigKey &key) { std::map>>::iterator iter; iter = mCfgMapLLong.find(key); @@ -212,7 +212,7 @@ const long long IpcConfig::GetLLong(const IpcConfigKey &key) constexpr long long UNKNOWN_CONFIG = -1; return UNKNOWN_CONFIG; } -void IpcConfig::SetLLong(const IpcConfigKey &key, const long long &value) +void IpcConfigImpl::SetLLong(const IpcConfigKey &key, const long long &value) { std::map>>::iterator iter; iter = mCfgMapLLong.find(key); @@ -226,7 +226,7 @@ void IpcConfig::SetLLong(const IpcConfigKey &key, const long long &value) LogError("Can't find the key.\n"); } } -const char IpcConfig::GetChar(const IpcConfigKey &key) +const char IpcConfigImpl::GetChar(const IpcConfigKey &key) { std::map>>::iterator iter; iter = mCfgMapChar.find(key); @@ -237,7 +237,7 @@ const char IpcConfig::GetChar(const IpcConfigKey &key) constexpr char UNKNOWN_CONFIG = '\0'; return UNKNOWN_CONFIG; } -void IpcConfig::SetChar(const IpcConfigKey &key, const char &character) +void IpcConfigImpl::SetChar(const IpcConfigKey &key, const char &character) { std::map>>::iterator iter; iter = mCfgMapChar.find(key); @@ -251,7 +251,7 @@ void IpcConfig::SetChar(const IpcConfigKey &key, const char &character) LogError("Can't find the key.\n"); } } -const float IpcConfig::GetFloat(const IpcConfigKey &key) +const float IpcConfigImpl::GetFloat(const IpcConfigKey &key) { std::map>>::iterator iter; iter = mCfgMapFloat.find(key); @@ -262,7 +262,7 @@ const float IpcConfig::GetFloat(const IpcConfigKey &key) constexpr float UNKNOWN_CONFIG = -1.00; return UNKNOWN_CONFIG; } -void IpcConfig::SetFloat(const IpcConfigKey &key, const float &value) +void IpcConfigImpl::SetFloat(const IpcConfigKey &key, const float &value) { std::map>>::iterator iter; iter = mCfgMapFloat.find(key); @@ -276,7 +276,7 @@ void IpcConfig::SetFloat(const IpcConfigKey &key, const float &value) LogError("Can't find the key.\n"); } } -const double IpcConfig::GetDouble(const IpcConfigKey &key) +const double IpcConfigImpl::GetDouble(const IpcConfigKey &key) { std::map>>::iterator iter; iter = mCfgMapDouble.find(key); @@ -287,7 +287,7 @@ const double IpcConfig::GetDouble(const IpcConfigKey &key) constexpr double UNKNOWN_CONFIG = -1.00; return UNKNOWN_CONFIG; } -void IpcConfig::SetDouble(const IpcConfigKey &key, const double &value) +void IpcConfigImpl::SetDouble(const IpcConfigKey &key, const double &value) { std::map>>::iterator iter; iter = mCfgMapDouble.find(key); @@ -301,7 +301,7 @@ void IpcConfig::SetDouble(const IpcConfigKey &key, const double &value) LogError("Can't find the key.\n"); } } -const long double IpcConfig::GetLongDouble(const IpcConfigKey &key) +const long double IpcConfigImpl::GetLongDouble(const IpcConfigKey &key) { std::map>::iterator iter; iter = mCfgMapLongDouble.find(key); @@ -312,7 +312,7 @@ const long double IpcConfig::GetLongDouble(const IpcConfigKey &key) constexpr long double UNKNOWN_CONFIG = -1.0; return UNKNOWN_CONFIG; } -void IpcConfig::SetLongDouble(const IpcConfigKey &key, const long double &value) +void IpcConfigImpl::SetLongDouble(const IpcConfigKey &key, const long double &value) { std::map>::iterator iter; iter = mCfgMapLongDouble.find(key); @@ -324,7 +324,7 @@ void IpcConfig::SetLongDouble(const IpcConfigKey &key, const long double &value) LogError("Can't find the key.\n"); } } -const bool IpcConfig::GetBool(const IpcConfigKey &key) +const bool IpcConfigImpl::GetBool(const IpcConfigKey &key) { std::map>>::iterator iter; iter = mCfgMapBool.find(key); @@ -335,7 +335,7 @@ const bool IpcConfig::GetBool(const IpcConfigKey &key) constexpr bool UNKNOWN_CONFIG = false; return UNKNOWN_CONFIG; } -void IpcConfig::SetBool(const IpcConfigKey &key, const bool &value) +void IpcConfigImpl::SetBool(const IpcConfigKey &key, const bool &value) { std::map>>::iterator iter; iter = mCfgMapBool.find(key); @@ -349,7 +349,7 @@ void IpcConfig::SetBool(const IpcConfigKey &key, const bool &value) LogError("Can't find the key.\n"); } } -const std::string IpcConfig::GetString(const IpcConfigKey &key) +const std::string IpcConfigImpl::GetString(const IpcConfigKey &key) { std::map>>::iterator iter; iter = mCfgMapString.find(key); @@ -361,7 +361,7 @@ const std::string IpcConfig::GetString(const IpcConfigKey &key) const std::string UNKNOWN_CONFIG = "undefine"; return UNKNOWN_CONFIG; } -void IpcConfig::SetString(const IpcConfigKey &key, const std::string string) +void IpcConfigImpl::SetString(const IpcConfigKey &key, const std::string string) { std::map>>::iterator iter; iter = mCfgMapString.find(key); @@ -376,7 +376,7 @@ void IpcConfig::SetString(const IpcConfigKey &key, const std::string string) } } -void IpcConfig::ReadAllConfigParameters(void) +void IpcConfigImpl::ReadAllConfigParameters(void) { StatusCode workModeCode = ConfigGetInt(mCfg, "work_mode", &(mAllData.workMode)); if (StatusCodeEqual(workModeCode, "CONFIG_CODE_PARAM_NOT_EXIST")) { diff --git a/middleware/IpcConfig/src/IpcConfig.h b/middleware/IpcConfig/src/IpcConfigImpl.h similarity index 93% rename from middleware/IpcConfig/src/IpcConfig.h rename to middleware/IpcConfig/src/IpcConfigImpl.h index 9de09a46..dc5865a5 100644 --- a/middleware/IpcConfig/src/IpcConfig.h +++ b/middleware/IpcConfig/src/IpcConfigImpl.h @@ -12,8 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef IPCCONFIG_H -#define IPCCONFIG_H +#ifndef IPC_CONFIG_IMPL_H +#define IPC_CONFIG_IMPL_H #include "ConfigBase.h" #include "IIpcConfig.h" #include "StatusCode.h" @@ -50,11 +50,11 @@ public: MapInt() = default; ~MapInt() = default; }; -class IpcConfig : public IIpcConfig +class IpcConfigImpl : public IIpcConfig { public: - IpcConfig(); - virtual ~IpcConfig() = default; + IpcConfigImpl(); + virtual ~IpcConfigImpl() = default; const StatusCode Init(void) override; const StatusCode UnInit(void) override; const StatusCode ConfigFileSave(void) override; diff --git a/middleware/IpcConfig/src/IpcConfigMakePtr.cpp b/middleware/IpcConfig/src/IpcConfigMakePtr.cpp index a924eac3..33bb6fcd 100644 --- a/middleware/IpcConfig/src/IpcConfigMakePtr.cpp +++ b/middleware/IpcConfig/src/IpcConfigMakePtr.cpp @@ -14,29 +14,41 @@ */ #include "IpcConfigMakePtr.h" #include "ILog.h" -#include "IpcConfig.h" -bool CreateIpcConfig(void) +#include "IpcConfigImpl.h" +bool CreateIpcConfigModule(void) { auto instance = std::make_shared(); StatusCode code = IpcConfigMakePtr::GetInstance()->CreateIpcConfig(instance); if (IsCodeOK(code)) { - LogInfo("CreateIpcConfig is ok.\n"); + LogInfo("CreateIpcConfigModule is ok.\n"); IIpcConfig::GetInstance(&instance); return true; } return false; } +bool DestroyIpcConfigModule(void) +{ + auto instance = std::make_shared(); + IIpcConfig::GetInstance(&instance); + return true; +} std::shared_ptr &IpcConfigMakePtr::GetInstance(std::shared_ptr *impl) { static auto instance = std::make_shared(); if (impl) { - instance = *impl; + if (instance.use_count() == 1) { + LogInfo("Instance changed succeed.\n"); + instance = *impl; + } + else { + LogError("Can't changing the instance becase of using by some one.\n"); + } } return instance; } const StatusCode IpcConfigMakePtr::CreateIpcConfig(std::shared_ptr &impl) { - auto tmp = std::make_shared(); + auto tmp = std::make_shared(); impl = tmp; return CreateStatusCode(STATUS_CODE_OK); } \ No newline at end of file diff --git a/test/middleware/IpcConfig/src/IpcConfig_Test.cpp b/test/middleware/IpcConfig/src/IpcConfig_Test.cpp index 3206afb5..f3c4415a 100644 --- a/test/middleware/IpcConfig/src/IpcConfig_Test.cpp +++ b/test/middleware/IpcConfig/src/IpcConfig_Test.cpp @@ -8,7 +8,7 @@ namespace IpcConfigTest TEST(IpcConfigTest, Demo) { CreateLogModule(); - CreateIpcConfig(); + CreateIpcConfigModule(); ILogInit(LOG_INSTANCE_TYPE_END); IIpcConfig::GetInstance()->Init(); diff --git a/test/middleware/McuManager/src_mock/McuManager_Mock_Test.cpp b/test/middleware/McuManager/src_mock/McuManager_Mock_Test.cpp index eec85e66..8461bd3c 100644 --- a/test/middleware/McuManager/src_mock/McuManager_Mock_Test.cpp +++ b/test/middleware/McuManager/src_mock/McuManager_Mock_Test.cpp @@ -945,8 +945,9 @@ TEST_F(McuManagerMockTest, HS_INTEGRATION_McuManager_AUTO_OtherSideGetIntervalSt recvData->mDataRecvReply.mHour = 10; recvData->mDataRecvReply.mMin = 10; recvData->mDataRecvReply.mSecond = 10; + recv->ReplyFinished(true); } - recv->ReplyFinished(true); + recv->ReplyFinished(false); } }; IMcuManager::GetInstance()->Init(); @@ -982,8 +983,9 @@ TEST_F(McuManagerMockTest, HS_INTEGRATION_McuManager_AUTO_OtherSideGetIntervalSt recvData->mDataRecvReply.mHour = 10; recvData->mDataRecvReply.mMin = 10; recvData->mDataRecvReply.mSecond = 10; + recv->ReplyFinished(true); } - recv->ReplyFinished(true); + recv->ReplyFinished(false); } }; IMcuManager::GetInstance()->Init(); @@ -1017,8 +1019,9 @@ TEST_F(McuManagerMockTest, HS_INTEGRATION_McuManager_AUTO_OtherSideGetDateTime) recvData->mDataRecvReply.mHour = 10; recvData->mDataRecvReply.mMin = 10; recvData->mDataRecvReply.mSecond = 10; + recv->ReplyFinished(true); } - recv->ReplyFinished(true); + recv->ReplyFinished(false); } }; IMcuManager::GetInstance()->Init(); @@ -1057,8 +1060,9 @@ TEST_F(McuManagerMockTest, HS_INTEGRATION_McuManager_AUTO_OtherSideGetDateTime2) recvData->mDataRecvReply.mHour = 10; recvData->mDataRecvReply.mMin = 10; recvData->mDataRecvReply.mSecond = 10; + recv->ReplyFinished(true); } - recv->ReplyFinished(true); + recv->ReplyFinished(false); } }; IMcuManager::GetInstance()->Init(); @@ -1087,8 +1091,9 @@ TEST_F(McuManagerMockTest, HS_INTEGRATION_McuManager_AUTO_OtherSideGetPirSensiti EXPECT_NE(recvData, nullptr) << "recvData is not McuGetPirSensitivity."; if (recvData) { recvData->mDataRecvReply.mSensitivity = 9; + recv->ReplyFinished(true); } - recv->ReplyFinished(true); + recv->ReplyFinished(false); } }; IMcuManager::GetInstance()->Init(); @@ -1122,8 +1127,9 @@ TEST_F(McuManagerMockTest, HS_INTEGRATION_McuManager_AUTO_OtherSideGetPirSensiti EXPECT_NE(recvData, nullptr) << "recvData is not McuGetPirSensitivity."; if (recvData) { recvData->mDataRecvReply.mSensitivity = 9; + recv->ReplyFinished(true); } - recv->ReplyFinished(true); + recv->ReplyFinished(false); } }; IMcuManager::GetInstance()->Init();