Backup:MediaManager function.
This commit is contained in:
parent
9351b0611e
commit
a1d76b0339
|
@ -1,9 +1,9 @@
|
||||||
|
|
||||||
set(HUNTTING_MAIN_INCLUDE_PATH "${APPLICATION_SOURCE_PATH}/HunttingCamera/src")
|
set(HUNTTING_MAIN_INCLUDE_PATH "${APPLICATION_SOURCE_PATH}/HunttingCamera/src")
|
||||||
set(HUNTTING_MAIN_INCLUDE_PATH "${HUNTTING_MAIN_INCLUDE_PATH};${APPLICATION_SOURCE_PATH}/MissionManager/include")
|
set(HUNTTING_MAIN_INCLUDE_PATH "${HUNTTING_MAIN_INCLUDE_PATH};${APPLICATION_SOURCE_PATH}/MissionManager/include")
|
||||||
set(HUNTTING_MAIN_INCLUDE_PATH "${HUNTTING_MAIN_INCLUDE_PATH};${MIDDLEWARE_SOURCE_PATH}/StateMachine/include")
|
set(HUNTTING_MAIN_INCLUDE_PATH "${HUNTTING_MAIN_INCLUDE_PATH};${MIDDLEWARE_SOURCE_PATH}/StateMachine/include")
|
||||||
set(HUNTTING_MAIN_INCLUDE_PATH "${HUNTTING_MAIN_INCLUDE_PATH};${MIDDLEWARE_SOURCE_PATH}/McuManager/include")
|
set(HUNTTING_MAIN_INCLUDE_PATH "${HUNTTING_MAIN_INCLUDE_PATH};${MIDDLEWARE_SOURCE_PATH}/McuManager/include")
|
||||||
set(HUNTTING_MAIN_INCLUDE_PATH "${HUNTTING_MAIN_INCLUDE_PATH};${MIDDLEWARE_SOURCE_PATH}/AppManager/include")
|
set(HUNTTING_MAIN_INCLUDE_PATH "${HUNTTING_MAIN_INCLUDE_PATH};${MIDDLEWARE_SOURCE_PATH}/AppManager/include")
|
||||||
|
set(HUNTTING_MAIN_INCLUDE_PATH "${HUNTTING_MAIN_INCLUDE_PATH};${MIDDLEWARE_SOURCE_PATH}/MediaManager/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}/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};${UTILS_SOURCE_PATH}/Log/include")
|
||||||
set(HUNTTING_MAIN_INCLUDE_PATH "${HUNTTING_MAIN_INCLUDE_PATH};${HAL_SOURCE_PATH}/include")
|
set(HUNTTING_MAIN_INCLUDE_PATH "${HUNTTING_MAIN_INCLUDE_PATH};${HAL_SOURCE_PATH}/include")
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "IHalCpp.h"
|
#include "IHalCpp.h"
|
||||||
#include "ILog.h"
|
#include "ILog.h"
|
||||||
#include "IMcuManager.h"
|
#include "IMcuManager.h"
|
||||||
|
#include "IMediaManager.h"
|
||||||
#include "IMissionManager.h"
|
#include "IMissionManager.h"
|
||||||
#include "IStateMachine.h"
|
#include "IStateMachine.h"
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
@ -61,12 +62,14 @@ StatusCode MainThread::Init(void)
|
||||||
CreateAllModules();
|
CreateAllModules();
|
||||||
IHalCpp::GetInstance()->Init();
|
IHalCpp::GetInstance()->Init();
|
||||||
IMcuManager::GetInstance()->Init();
|
IMcuManager::GetInstance()->Init();
|
||||||
|
IMediaManager::GetInstance()->Init();
|
||||||
IMissionManager::GetInstance()->Init();
|
IMissionManager::GetInstance()->Init();
|
||||||
return CreateStatusCode(STATUS_CODE_OK);
|
return CreateStatusCode(STATUS_CODE_OK);
|
||||||
}
|
}
|
||||||
StatusCode MainThread::UnInit(void)
|
StatusCode MainThread::UnInit(void)
|
||||||
{
|
{
|
||||||
IMissionManager::GetInstance()->UnInit();
|
IMissionManager::GetInstance()->UnInit();
|
||||||
|
IMediaManager::GetInstance()->UnInit();
|
||||||
IMcuManager::GetInstance()->UnInit();
|
IMcuManager::GetInstance()->UnInit();
|
||||||
IHalCpp::GetInstance()->UnInit();
|
IHalCpp::GetInstance()->UnInit();
|
||||||
DestoryAllModules();
|
DestoryAllModules();
|
||||||
|
@ -80,10 +83,12 @@ StatusCode MainThread::CreateAllModules(void)
|
||||||
CreateMissionManagerModule();
|
CreateMissionManagerModule();
|
||||||
CreateStateMachine();
|
CreateStateMachine();
|
||||||
CreateAppManagerModule();
|
CreateAppManagerModule();
|
||||||
|
CreateMediaManagerModule();
|
||||||
return CreateStatusCode(STATUS_CODE_OK);
|
return CreateStatusCode(STATUS_CODE_OK);
|
||||||
}
|
}
|
||||||
void MainThread::DestoryAllModules(void)
|
void MainThread::DestoryAllModules(void)
|
||||||
{
|
{
|
||||||
|
DestroyMediaManagerModule();
|
||||||
DestroyAppManagerModule();
|
DestroyAppManagerModule();
|
||||||
DestroyStateMachine();
|
DestroyStateMachine();
|
||||||
DestroyMissionManagerModule();
|
DestroyMissionManagerModule();
|
||||||
|
|
|
@ -11,7 +11,7 @@ include_directories(
|
||||||
${UTILS_SOURCE_PATH}/Log/include
|
${UTILS_SOURCE_PATH}/Log/include
|
||||||
${MIDDLEWARE_SOURCE_PATH}/StateMachine/include
|
${MIDDLEWARE_SOURCE_PATH}/StateMachine/include
|
||||||
${MIDDLEWARE_SOURCE_PATH}/AppManager/include
|
${MIDDLEWARE_SOURCE_PATH}/AppManager/include
|
||||||
# ${MIDDLEWARE_SOURCE_PATH}/DeviceManager/include
|
${MIDDLEWARE_SOURCE_PATH}/MediaManager/include
|
||||||
${MIDDLEWARE_SOURCE_PATH}/McuManager/include
|
${MIDDLEWARE_SOURCE_PATH}/McuManager/include
|
||||||
${MIDDLEWARE_SOURCE_PATH}/McuAskBase/include
|
${MIDDLEWARE_SOURCE_PATH}/McuAskBase/include
|
||||||
)
|
)
|
||||||
|
@ -24,7 +24,7 @@ aux_source_directory(./src SRC_FILES)
|
||||||
set(TARGET_NAME MissionManager)
|
set(TARGET_NAME MissionManager)
|
||||||
add_library(${TARGET_NAME} STATIC ${SRC_FILES})
|
add_library(${TARGET_NAME} STATIC ${SRC_FILES})
|
||||||
|
|
||||||
target_link_libraries(${TARGET_NAME} McuAskBase StateMachine StatusCode Log)
|
target_link_libraries(${TARGET_NAME} McuAskBase StateMachine MediaManager StatusCode Log)
|
||||||
|
|
||||||
if ("${COMPILE_IMPROVE_SUPPORT}" MATCHES "true")
|
if ("${COMPILE_IMPROVE_SUPPORT}" MATCHES "true")
|
||||||
add_custom_target(
|
add_custom_target(
|
||||||
|
|
|
@ -14,22 +14,28 @@
|
||||||
*/
|
*/
|
||||||
#include "TopState.h"
|
#include "TopState.h"
|
||||||
#include "ILog.h"
|
#include "ILog.h"
|
||||||
|
#include "IMediaManager.h"
|
||||||
#include "MissionStateMachine.h"
|
#include "MissionStateMachine.h"
|
||||||
TopState::TopState() : State("TopState")
|
TopState::TopState() : State("TopState")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
void TopState::GoInState()
|
void TopState::GoInState()
|
||||||
{
|
{
|
||||||
//
|
|
||||||
LogInfo(" ========== opState::GoInState.\n");
|
LogInfo(" ========== opState::GoInState.\n");
|
||||||
|
std::shared_ptr<VMediaMonitor> monitor = std::dynamic_pointer_cast<TopState>(shared_from_this());
|
||||||
|
IMediaManager::GetInstance()->SetMediaMonitor(monitor);
|
||||||
MissionStateMachine::GetInstance()->SwitchState(MissionState::MISSION_STATE);
|
MissionStateMachine::GetInstance()->SwitchState(MissionState::MISSION_STATE);
|
||||||
}
|
}
|
||||||
void TopState::GoOutState()
|
void TopState::GoOutState()
|
||||||
{
|
{
|
||||||
//
|
|
||||||
LogInfo(" ========== opState::GoOutState.\n");
|
LogInfo(" ========== opState::GoOutState.\n");
|
||||||
}
|
}
|
||||||
bool TopState::ExecuteStateMsg(VStateMachineData *msg)
|
bool TopState::ExecuteStateMsg(VStateMachineData *msg)
|
||||||
{
|
{
|
||||||
return DataProcessing::EventHandle(msg);
|
return DataProcessing::EventHandle(msg);
|
||||||
}
|
}
|
||||||
|
StatusCode TopState::ReportEvent(const MediaReportEvent &event)
|
||||||
|
{
|
||||||
|
LogInfo("sssssssssssssssssssssssssssssssssssssssssssssssssssssssss\n");
|
||||||
|
return CreateStatusCode(STATUS_CODE_OK);
|
||||||
|
}
|
|
@ -15,8 +15,12 @@
|
||||||
#ifndef TOP_STATE_H
|
#ifndef TOP_STATE_H
|
||||||
#define TOP_STATE_H
|
#define TOP_STATE_H
|
||||||
#include "DataProcessing.h"
|
#include "DataProcessing.h"
|
||||||
|
#include "IMediaManager.h"
|
||||||
#include "IStateMachine.h"
|
#include "IStateMachine.h"
|
||||||
class TopState : public State, public DataProcessing
|
class TopState : public State,
|
||||||
|
public DataProcessing,
|
||||||
|
public VMediaMonitor,
|
||||||
|
public std::enable_shared_from_this<TopState>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TopState();
|
TopState();
|
||||||
|
@ -24,5 +28,8 @@ public:
|
||||||
void GoInState() override;
|
void GoInState() override;
|
||||||
void GoOutState() override;
|
void GoOutState() override;
|
||||||
bool ExecuteStateMsg(VStateMachineData *msg) override;
|
bool ExecuteStateMsg(VStateMachineData *msg) override;
|
||||||
|
|
||||||
|
private: // About VMediaMonitor
|
||||||
|
StatusCode ReportEvent(const MediaReportEvent &event) override;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
|
@ -33,6 +33,15 @@ enum class MediaTaskType
|
||||||
MONITOR,
|
MONITOR,
|
||||||
END
|
END
|
||||||
};
|
};
|
||||||
|
typedef struct media_report_event
|
||||||
|
{
|
||||||
|
media_report_event(const std::string &fileName, const std::string &filePath, const MediaTaskType &eventType,
|
||||||
|
const MediaChannel &mediaChannedl);
|
||||||
|
const std::string mFileName;
|
||||||
|
const std::string mFilePath;
|
||||||
|
const MediaTaskType mEventType;
|
||||||
|
const MediaChannel mMediaChannedl;
|
||||||
|
} MediaReportEvent;
|
||||||
class MediaTaskResponse
|
class MediaTaskResponse
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -55,6 +64,7 @@ class VMediaMonitor
|
||||||
public:
|
public:
|
||||||
VMediaMonitor() = default;
|
VMediaMonitor() = default;
|
||||||
virtual ~VMediaMonitor() = default;
|
virtual ~VMediaMonitor() = default;
|
||||||
|
virtual StatusCode ReportEvent(const MediaReportEvent &event);
|
||||||
};
|
};
|
||||||
class VMediaHandle
|
class VMediaHandle
|
||||||
{
|
{
|
||||||
|
@ -68,8 +78,8 @@ public:
|
||||||
IMediaManager() = default;
|
IMediaManager() = default;
|
||||||
virtual ~IMediaManager() = default;
|
virtual ~IMediaManager() = default;
|
||||||
static std::shared_ptr<IMediaManager> &GetInstance(std::shared_ptr<IMediaManager> *impl = nullptr);
|
static std::shared_ptr<IMediaManager> &GetInstance(std::shared_ptr<IMediaManager> *impl = nullptr);
|
||||||
virtual const StatusCode Init(void);
|
virtual StatusCode Init(void);
|
||||||
virtual const StatusCode UnInit(void);
|
virtual StatusCode UnInit(void);
|
||||||
virtual StatusCode SetMediaMonitor(std::shared_ptr<VMediaMonitor> &monitor);
|
virtual StatusCode SetMediaMonitor(std::shared_ptr<VMediaMonitor> &monitor);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
|
@ -14,6 +14,11 @@
|
||||||
*/
|
*/
|
||||||
#include "IMediaManager.h"
|
#include "IMediaManager.h"
|
||||||
#include "ILog.h"
|
#include "ILog.h"
|
||||||
|
media_report_event::media_report_event(const std::string &fileName, const std::string &filePath,
|
||||||
|
const MediaTaskType &eventType, const MediaChannel &mediaChannedl)
|
||||||
|
: mFileName(fileName), mFilePath(filePath), mEventType(eventType), mMediaChannedl(mediaChannedl)
|
||||||
|
{
|
||||||
|
}
|
||||||
const MediaTaskType VMediaTask::GetTaskType(void)
|
const MediaTaskType VMediaTask::GetTaskType(void)
|
||||||
{
|
{
|
||||||
return MediaTaskType::END;
|
return MediaTaskType::END;
|
||||||
|
@ -33,6 +38,10 @@ const unsigned int VMediaTask::GetIsMultShot(void)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
StatusCode VMediaMonitor::ReportEvent(const MediaReportEvent &event)
|
||||||
|
{
|
||||||
|
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
|
}
|
||||||
std::shared_ptr<IMediaManager> &IMediaManager::GetInstance(std::shared_ptr<IMediaManager> *impl)
|
std::shared_ptr<IMediaManager> &IMediaManager::GetInstance(std::shared_ptr<IMediaManager> *impl)
|
||||||
{
|
{
|
||||||
static auto instance = std::make_shared<IMediaManager>();
|
static auto instance = std::make_shared<IMediaManager>();
|
||||||
|
@ -47,11 +56,11 @@ std::shared_ptr<IMediaManager> &IMediaManager::GetInstance(std::shared_ptr<IMedi
|
||||||
}
|
}
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
const StatusCode IMediaManager::Init(void)
|
StatusCode IMediaManager::Init(void)
|
||||||
{
|
{
|
||||||
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
}
|
}
|
||||||
const StatusCode IMediaManager::UnInit(void)
|
StatusCode IMediaManager::UnInit(void)
|
||||||
{
|
{
|
||||||
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,13 +14,13 @@
|
||||||
*/
|
*/
|
||||||
#include "MediaManagerImpl.h"
|
#include "MediaManagerImpl.h"
|
||||||
#include "ILog.h"
|
#include "ILog.h"
|
||||||
const StatusCode MediaManagerImpl::Init(void)
|
StatusCode MediaManagerImpl::Init(void)
|
||||||
{
|
{
|
||||||
IHalCpp::GetInstance()->GetCameraHal(mAllCameras);
|
IHalCpp::GetInstance()->GetCameraHal(mAllCameras);
|
||||||
SetCamerasMonitor();
|
SetCamerasMonitor();
|
||||||
return CreateStatusCode(STATUS_CODE_OK);
|
return CreateStatusCode(STATUS_CODE_OK);
|
||||||
}
|
}
|
||||||
const StatusCode MediaManagerImpl::UnInit(void)
|
StatusCode MediaManagerImpl::UnInit(void)
|
||||||
{
|
{
|
||||||
return CreateStatusCode(STATUS_CODE_OK);
|
return CreateStatusCode(STATUS_CODE_OK);
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,21 @@ StatusCode MediaManagerImpl::SetMediaMonitor(std::shared_ptr<VMediaMonitor> &mon
|
||||||
mMediaMonitor = monitor;
|
mMediaMonitor = monitor;
|
||||||
return CreateStatusCode(STATUS_CODE_OK);
|
return CreateStatusCode(STATUS_CODE_OK);
|
||||||
}
|
}
|
||||||
|
void MediaManagerImpl::ReportEvent(const CameraReportEvent &event)
|
||||||
|
{
|
||||||
|
LogInfo("ReportEvent.\n");
|
||||||
|
LogInfo("ReportEvent. file: %s, path: %s.\n", event.mFileName.c_str(), event.mFilePath.c_str());
|
||||||
|
MediaReportEvent reprot(event.mFileName,
|
||||||
|
event.mFilePath,
|
||||||
|
static_cast<MediaTaskType>(event.mEventType),
|
||||||
|
static_cast<MediaChannel>(event.mCameraType));
|
||||||
|
auto monitor = mMediaMonitor.lock();
|
||||||
|
if (mMediaMonitor.expired())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
monitor->ReportEvent(reprot);
|
||||||
|
}
|
||||||
void MediaManagerImpl::SetCamerasMonitor(void)
|
void MediaManagerImpl::SetCamerasMonitor(void)
|
||||||
{
|
{
|
||||||
std::shared_ptr<VCameraHalMonitor> moniter = shared_from_this();
|
std::shared_ptr<VCameraHalMonitor> moniter = shared_from_this();
|
||||||
|
|
|
@ -24,15 +24,16 @@ class MediaManagerImpl : public IMediaManager,
|
||||||
public:
|
public:
|
||||||
MediaManagerImpl() = default;
|
MediaManagerImpl() = default;
|
||||||
virtual ~MediaManagerImpl() = default;
|
virtual ~MediaManagerImpl() = default;
|
||||||
const StatusCode Init(void) override;
|
StatusCode Init(void) override;
|
||||||
const StatusCode UnInit(void) override;
|
StatusCode UnInit(void) override;
|
||||||
StatusCode SetMediaMonitor(std::shared_ptr<VMediaMonitor> &monitor) override;
|
StatusCode SetMediaMonitor(std::shared_ptr<VMediaMonitor> &monitor) override;
|
||||||
|
void ReportEvent(const CameraReportEvent &event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetCamerasMonitor(void);
|
void SetCamerasMonitor(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::map<CameraType, std::shared_ptr<VCameraHal>> mAllCameras;
|
std::map<CameraType, std::shared_ptr<VCameraHal>> mAllCameras;
|
||||||
std::shared_ptr<VMediaMonitor> mMediaMonitor;
|
std::weak_ptr<VMediaMonitor> mMediaMonitor;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
|
@ -15,88 +15,15 @@
|
||||||
#include "AppManagerTestTool.h"
|
#include "AppManagerTestTool.h"
|
||||||
#include "GtestUsing.h"
|
#include "GtestUsing.h"
|
||||||
#include "HalTestTool.h"
|
#include "HalTestTool.h"
|
||||||
|
#include "HunttingCameraTest.h"
|
||||||
#include "ILog.h"
|
#include "ILog.h"
|
||||||
#include "MainThread.h"
|
#include "MainThread.h"
|
||||||
#include "McuManagerTestTool.h"
|
#include "McuManagerTestTool.h"
|
||||||
#include "MissionManagerTestTool.h"
|
#include "MissionManagerTestTool.h"
|
||||||
#include "TestManager.h"
|
#include "TestManager.h"
|
||||||
#include <thread>
|
#include <thread>
|
||||||
namespace HunttingCameraTest
|
namespace AppMonitor_Mock_Test
|
||||||
{
|
{
|
||||||
class MainThreadTest : public MainThread
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
MainThreadTest() = default;
|
|
||||||
virtual ~MainThreadTest() = default;
|
|
||||||
void CustomizationInit(void) override
|
|
||||||
{
|
|
||||||
// Do nothing here to make sure test tool work.
|
|
||||||
}
|
|
||||||
};
|
|
||||||
class HunttingCameraTest : public testing::Test,
|
|
||||||
public TestManager,
|
|
||||||
public MissionManagerTestTool,
|
|
||||||
public McuManagerTestTool,
|
|
||||||
public AppManagerTestTool,
|
|
||||||
public HalTestTool
|
|
||||||
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
HunttingCameraTest()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
virtual ~HunttingCameraTest()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
static void SetUpTestCase()
|
|
||||||
{
|
|
||||||
CreateLogModule();
|
|
||||||
ILogInit(LOG_INSTANCE_TYPE_END);
|
|
||||||
}
|
|
||||||
static void TearDownTestCase()
|
|
||||||
{
|
|
||||||
ILogUnInit();
|
|
||||||
}
|
|
||||||
virtual void SetUp()
|
|
||||||
{
|
|
||||||
std::shared_ptr<MainThread> mainThread = std::make_shared<MainThreadTest>();
|
|
||||||
MainThread::GetInstance(&mainThread);
|
|
||||||
// CreateAllKeysMcok();
|
|
||||||
HalTestTool::Init();
|
|
||||||
AppManagerTestTool::Init();
|
|
||||||
MissionManagerTestTool::Init();
|
|
||||||
// HunttingCameraTestTool::Init();
|
|
||||||
// CreateHalCppModule();
|
|
||||||
// CreateDeviceManagerModule();
|
|
||||||
mLinuxTest = LinuxTest::CreateLinuxTest();
|
|
||||||
std::shared_ptr<LinuxApiMock> test = mLinuxTest;
|
|
||||||
LinuxApiMock::GetInstance(&test);
|
|
||||||
LinuxApiMock::GetInstance()->Init();
|
|
||||||
McuManagerTestTool::Init(mLinuxTest);
|
|
||||||
TestManager::Init();
|
|
||||||
}
|
|
||||||
virtual void TearDown()
|
|
||||||
{
|
|
||||||
// HunttingCameraTestTool::UnInit();
|
|
||||||
// DestroyDeviceManagerModule();
|
|
||||||
// DestroyAllKeysMock();
|
|
||||||
TestManager::UnInit();
|
|
||||||
MissionManagerTestTool::UnInit();
|
|
||||||
AppManagerTestTool::UnInit();
|
|
||||||
HalTestTool::UnInit();
|
|
||||||
LinuxApiMock::GetInstance()->UnInit();
|
|
||||||
mLinuxTest = std::make_shared<LinuxTest>();
|
|
||||||
std::shared_ptr<LinuxApiMock> test = std::make_shared<LinuxApiMock>();
|
|
||||||
LinuxApiMock::GetInstance(&test);
|
|
||||||
McuManagerTestTool::UnInit();
|
|
||||||
MainThread::GetInstance()->UnInit();
|
|
||||||
std::shared_ptr<MainThread> mainThread = std::make_shared<MainThread>();
|
|
||||||
MainThread::GetInstance(&mainThread);
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
std::shared_ptr<LinuxTest> mLinuxTest;
|
|
||||||
};
|
|
||||||
// ../output_files/test/bin/HunttingCameraTest
|
// ../output_files/test/bin/HunttingCameraTest
|
||||||
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetProductInfo
|
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetProductInfo
|
||||||
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetProductInfo)
|
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetProductInfo)
|
||||||
|
@ -276,4 +203,4 @@ TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_AppPlayback)
|
||||||
MockAppPlayback();
|
MockAppPlayback();
|
||||||
MainThread::GetInstance()->Runing();
|
MainThread::GetInstance()->Runing();
|
||||||
}
|
}
|
||||||
} // namespace HunttingCameraTest
|
} // namespace AppMonitor_Mock_Test
|
|
@ -0,0 +1,78 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2023 Fancy Code.
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
#include "HunttingCameraTest.h"
|
||||||
|
#include "GtestUsing.h"
|
||||||
|
#include "ILog.h"
|
||||||
|
#include "MainThread.h"
|
||||||
|
#include <thread>
|
||||||
|
void MainThreadTest::CustomizationInit(void)
|
||||||
|
{
|
||||||
|
// Do nothing here to make sure test tool work.
|
||||||
|
}
|
||||||
|
HunttingCameraTest::HunttingCameraTest()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
HunttingCameraTest::~HunttingCameraTest()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void HunttingCameraTest::SetUpTestCase()
|
||||||
|
{
|
||||||
|
CreateLogModule();
|
||||||
|
ILogInit(LOG_INSTANCE_TYPE_END);
|
||||||
|
}
|
||||||
|
void HunttingCameraTest::TearDownTestCase()
|
||||||
|
{
|
||||||
|
ILogUnInit();
|
||||||
|
}
|
||||||
|
void HunttingCameraTest::SetUp()
|
||||||
|
{
|
||||||
|
CreateAllCamerasMcok();
|
||||||
|
std::shared_ptr<MainThread> mainThread = std::make_shared<MainThreadTest>();
|
||||||
|
MainThread::GetInstance(&mainThread);
|
||||||
|
HalTestTool::Init();
|
||||||
|
AppManagerTestTool::Init();
|
||||||
|
MissionManagerTestTool::Init();
|
||||||
|
mLinuxTest = LinuxTest::CreateLinuxTest();
|
||||||
|
std::shared_ptr<LinuxApiMock> test = mLinuxTest;
|
||||||
|
LinuxApiMock::GetInstance(&test);
|
||||||
|
LinuxApiMock::GetInstance()->Init();
|
||||||
|
McuManagerTestTool::Init(mLinuxTest);
|
||||||
|
TestManager::Init();
|
||||||
|
}
|
||||||
|
void HunttingCameraTest::TearDown()
|
||||||
|
{
|
||||||
|
TestManager::UnInit();
|
||||||
|
MissionManagerTestTool::UnInit();
|
||||||
|
AppManagerTestTool::UnInit();
|
||||||
|
HalTestTool::UnInit();
|
||||||
|
LinuxApiMock::GetInstance()->UnInit();
|
||||||
|
mLinuxTest = std::make_shared<LinuxTest>();
|
||||||
|
std::shared_ptr<LinuxApiMock> test = std::make_shared<LinuxApiMock>();
|
||||||
|
LinuxApiMock::GetInstance(&test);
|
||||||
|
McuManagerTestTool::UnInit();
|
||||||
|
MainThread::GetInstance()->UnInit();
|
||||||
|
std::shared_ptr<MainThread> mainThread = std::make_shared<MainThread>();
|
||||||
|
MainThread::GetInstance(&mainThread);
|
||||||
|
DestroyAllCamerasMock();
|
||||||
|
}
|
||||||
|
void HunttingCameraTest::CreateAllCamerasMcok(void)
|
||||||
|
{
|
||||||
|
std::shared_ptr<VCameraHal> camera = HalTestTool::MakeCameraHalTest(CameraType::MAIN_CAMERA);
|
||||||
|
mAllCamerasMock[CameraType::MAIN_CAMERA] = camera;
|
||||||
|
}
|
||||||
|
void HunttingCameraTest::DestroyAllCamerasMock(void)
|
||||||
|
{
|
||||||
|
mAllCamerasMock.clear();
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2023 Fancy Code.
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
#ifndef HUNTTING_CAMERA_TEST_H
|
||||||
|
#define HUNTTING_CAMERA_TEST_H
|
||||||
|
#include "AppManagerTestTool.h"
|
||||||
|
#include "GtestUsing.h"
|
||||||
|
#include "HalTestTool.h"
|
||||||
|
#include "LinuxApiMock.h"
|
||||||
|
#include "MainThread.h"
|
||||||
|
#include "McuManagerTestTool.h"
|
||||||
|
#include "MissionManagerTestTool.h"
|
||||||
|
#include "TestManager.h"
|
||||||
|
#include <memory>
|
||||||
|
class MainThreadTest : public MainThread
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MainThreadTest() = default;
|
||||||
|
virtual ~MainThreadTest() = default;
|
||||||
|
void CustomizationInit(void) override;
|
||||||
|
};
|
||||||
|
class HunttingCameraTest : public testing::Test,
|
||||||
|
public TestManager,
|
||||||
|
public MissionManagerTestTool,
|
||||||
|
public McuManagerTestTool,
|
||||||
|
public AppManagerTestTool,
|
||||||
|
public HalTestTool
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
HunttingCameraTest();
|
||||||
|
virtual ~HunttingCameraTest();
|
||||||
|
static void SetUpTestCase();
|
||||||
|
static void TearDownTestCase();
|
||||||
|
void SetUp() override;
|
||||||
|
void TearDown() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void CreateAllCamerasMcok(void);
|
||||||
|
void DestroyAllCamerasMock(void);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
std::shared_ptr<LinuxTest> mLinuxTest;
|
||||||
|
std::map<CameraType, std::shared_ptr<VCameraHal>> mAllCamerasMock;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,41 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2023 Fancy Code.
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
#include "AppManagerTestTool.h"
|
||||||
|
#include "GtestUsing.h"
|
||||||
|
#include "HalTestTool.h"
|
||||||
|
#include "HunttingCameraTest.h"
|
||||||
|
#include "ILog.h"
|
||||||
|
#include "MainThread.h"
|
||||||
|
#include "McuManagerTestTool.h"
|
||||||
|
#include "MissionManagerTestTool.h"
|
||||||
|
#include "TestManager.h"
|
||||||
|
#include <thread>
|
||||||
|
namespace MediaManager_Mock_Test
|
||||||
|
{
|
||||||
|
// ../output_files/test/bin/HunttingCameraTest
|
||||||
|
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_EXAMPLE_MediaReprot
|
||||||
|
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_EXAMPLE_MediaReprot)
|
||||||
|
{
|
||||||
|
SetAllCamerasResult(mAllCamerasMock);
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
|
// McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
|
||||||
|
MainThread::GetInstance()->Init();
|
||||||
|
TestManager::ResetTimeOut(1000 * 3);
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
|
MockReportCameraEvent("test name", "test path", CameraEvent::PICTIRUE, CameraType::MAIN_CAMERA);
|
||||||
|
// MockAppPlayback();
|
||||||
|
MainThread::GetInstance()->Runing();
|
||||||
|
}
|
||||||
|
} // namespace MediaManager_Mock_Test
|
|
@ -10,11 +10,14 @@ include_directories(
|
||||||
${APPLICATION_SOURCE_PATH}/MissionManager/include
|
${APPLICATION_SOURCE_PATH}/MissionManager/include
|
||||||
${APPLICATION_SOURCE_PATH}/MissionManager/src
|
${APPLICATION_SOURCE_PATH}/MissionManager/src
|
||||||
${MIDDLEWARE_SOURCE_PATH}/AppManager/include
|
${MIDDLEWARE_SOURCE_PATH}/AppManager/include
|
||||||
|
${MIDDLEWARE_SOURCE_PATH}/MediaManager/include
|
||||||
${MIDDLEWARE_SOURCE_PATH}/StateMachine/include
|
${MIDDLEWARE_SOURCE_PATH}/StateMachine/include
|
||||||
${MIDDLEWARE_SOURCE_PATH}/McuManager/include
|
${MIDDLEWARE_SOURCE_PATH}/McuManager/include
|
||||||
${TEST_SOURCE_PATH}
|
${TEST_SOURCE_PATH}
|
||||||
${TEST_SOURCE_PATH}/middleware/AppManager/tool/include
|
${TEST_SOURCE_PATH}/middleware/AppManager/tool/include
|
||||||
${TEST_SOURCE_PATH}/middleware/AppManager/tool/src
|
${TEST_SOURCE_PATH}/middleware/AppManager/tool/src
|
||||||
|
${TEST_SOURCE_PATH}/middleware/MediaManager/tool/include
|
||||||
|
${TEST_SOURCE_PATH}/middleware/MediaManager/tool/src
|
||||||
${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
|
||||||
)
|
)
|
||||||
|
@ -25,7 +28,7 @@ include_directories(
|
||||||
aux_source_directory(./src TEST_TOOL_SRC_FILES)
|
aux_source_directory(./src TEST_TOOL_SRC_FILES)
|
||||||
set(TEST_TOOL_TARGET MissionManagerTestTool)
|
set(TEST_TOOL_TARGET MissionManagerTestTool)
|
||||||
add_library(${TEST_TOOL_TARGET} STATIC ${TEST_TOOL_SRC_FILES})
|
add_library(${TEST_TOOL_TARGET} STATIC ${TEST_TOOL_SRC_FILES})
|
||||||
target_link_libraries(${TEST_TOOL_TARGET} MissionManager AppManagerTestTool Log)
|
target_link_libraries(${TEST_TOOL_TARGET} MissionManager AppManagerTestTool MediaManagerTestTool Log)
|
||||||
|
|
||||||
if ("${COMPILE_IMPROVE_SUPPORT}" MATCHES "true")
|
if ("${COMPILE_IMPROVE_SUPPORT}" MATCHES "true")
|
||||||
add_custom_target(
|
add_custom_target(
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "MissionManagerMakePtrTest.h"
|
#include "MissionManagerMakePtrTest.h"
|
||||||
#include "ILog.h"
|
#include "ILog.h"
|
||||||
#include "TestMissionStateMock.h"
|
#include "TestMissionStateMock.h"
|
||||||
|
#include "TopStateMock.h"
|
||||||
void OverrideMissionManagerMakePtrObject(std::shared_ptr<MissionManagerMock> &appManagerMock)
|
void OverrideMissionManagerMakePtrObject(std::shared_ptr<MissionManagerMock> &appManagerMock)
|
||||||
{
|
{
|
||||||
std::shared_ptr<MissionManagerMakePtr> impl = std::make_shared<MissionManagerMakePtrTest>();
|
std::shared_ptr<MissionManagerMakePtr> impl = std::make_shared<MissionManagerMakePtrTest>();
|
||||||
|
@ -38,24 +39,16 @@ void CancelOverrideMissionManagerMakePtrObject(void)
|
||||||
}
|
}
|
||||||
MissionManagerMakePtrTest::MissionManagerMakePtrTest()
|
MissionManagerMakePtrTest::MissionManagerMakePtrTest()
|
||||||
{
|
{
|
||||||
//
|
|
||||||
}
|
}
|
||||||
MissionManagerMakePtrTest::~MissionManagerMakePtrTest()
|
MissionManagerMakePtrTest::~MissionManagerMakePtrTest()
|
||||||
{
|
{
|
||||||
//
|
|
||||||
mMissionManagerMock.reset();
|
mMissionManagerMock.reset();
|
||||||
}
|
}
|
||||||
// const StatusCode MissionManagerMakePtrTest::CreateMissionManager(std::shared_ptr<IMissionManager> &impl)
|
std::shared_ptr<State> MissionManagerMakePtrTest::CreateTopState(void)
|
||||||
// {
|
{
|
||||||
// if (mMissionManagerMock) {
|
std::shared_ptr<State> state = std::make_shared<TopStateMock>();
|
||||||
// LogInfo("CreateMissionManager mMissionManagerMock\n");
|
return state;
|
||||||
// impl = mMissionManagerMock;
|
}
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// LogWarning("CreateMcuManager failed:mMissionManagerMock is nullptr.\n");
|
|
||||||
// }
|
|
||||||
// return CreateStatusCode(STATUS_CODE_OK);
|
|
||||||
// }
|
|
||||||
std::shared_ptr<State> MissionManagerMakePtrTest::CreateMissionState(const IpcMission &mission)
|
std::shared_ptr<State> MissionManagerMakePtrTest::CreateMissionState(const IpcMission &mission)
|
||||||
{
|
{
|
||||||
std::shared_ptr<State> state = std::make_shared<TestMissionStateMock>();
|
std::shared_ptr<State> state = std::make_shared<TestMissionStateMock>();
|
||||||
|
|
|
@ -24,6 +24,7 @@ class MissionManagerMakePtrTest : public MissionManagerMakePtr
|
||||||
public:
|
public:
|
||||||
MissionManagerMakePtrTest();
|
MissionManagerMakePtrTest();
|
||||||
virtual ~MissionManagerMakePtrTest();
|
virtual ~MissionManagerMakePtrTest();
|
||||||
|
std::shared_ptr<State> CreateTopState(void) override;
|
||||||
std::shared_ptr<State> CreateMissionState(const IpcMission &mission) override;
|
std::shared_ptr<State> CreateMissionState(const IpcMission &mission) override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
15
test/application/MissionManager/tool/src/TopStateMock.cpp
Normal file
15
test/application/MissionManager/tool/src/TopStateMock.cpp
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2023 Fancy Code.
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
#include "TopStateMock.h"
|
50
test/application/MissionManager/tool/src/TopStateMock.h
Normal file
50
test/application/MissionManager/tool/src/TopStateMock.h
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2023 Fancy Code.
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
#ifndef TOP_STATE_MOCK_H
|
||||||
|
#define TOP_STATE_MOCK_H
|
||||||
|
#include "MediaMonitorMock.h"
|
||||||
|
#include "MissionManagerTestTool.h"
|
||||||
|
#include "TopState.h"
|
||||||
|
class TopStateTest : public TopState, virtual public MediaMonitorTrace
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TopStateTest() = default;
|
||||||
|
virtual ~TopStateTest() = default;
|
||||||
|
// StatusCode GetProductInfo(AppGetProductInfo ¶m) override;
|
||||||
|
// StatusCode GetDeviceAttr(AppGetDeviceAttr ¶m) override;
|
||||||
|
// StatusCode GetMediaInfo(AppGetMeidaInfo ¶m) override;
|
||||||
|
// StatusCode GetSdCardInfo(AppGetSdCardInfo ¶m) override;
|
||||||
|
// StatusCode GetBatteryInfo(AppGetBatteryInfo ¶m) override;
|
||||||
|
// StatusCode GetParamValue(AppParamValue ¶m) override;
|
||||||
|
// StatusCode GetCapability(AppGetCapability ¶m) override;
|
||||||
|
// StatusCode GetLockVideoStatus(LockVideoStatus ¶m) override;
|
||||||
|
// StatusCode GetStorageInfo(std::vector<AppGetStorageInfo> ¶m) override;
|
||||||
|
// StatusCode GetStorageFileList(const AppGetFileInfo &fileInfo, std::vector<AppGetFileList> ¶m) override;
|
||||||
|
// StatusCode SetDateTime(const AppSetDateTime ¶m) override;
|
||||||
|
// StatusCode SetTimeZone(const unsigned int &zone) override;
|
||||||
|
// StatusCode SetParamValue(const AppSetParamValue ¶m) override;
|
||||||
|
// StatusCode EnterRecorder(void) override;
|
||||||
|
// StatusCode AppPlayback(const PlayBackEvent &event) override;
|
||||||
|
// StatusCode UploadFile(AppUploadFile ¶m) override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
};
|
||||||
|
class TopStateMock : public MediaMonitorMock, public TopStateTest
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TopStateMock() = default;
|
||||||
|
virtual ~TopStateMock() = default;
|
||||||
|
};
|
||||||
|
#endif
|
|
@ -93,7 +93,7 @@ void HalTestTool::MockReportCameraEvent(const std::string &fileName, const std::
|
||||||
{
|
{
|
||||||
std::shared_ptr<VCameraHal> camera = SearchCamera(cameraType);
|
std::shared_ptr<VCameraHal> camera = SearchCamera(cameraType);
|
||||||
if (!camera) {
|
if (!camera) {
|
||||||
LogError("Can't mock camera event, key not found.\n");
|
LogError("Can't mock camera event, camera not found.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::shared_ptr<CameraHalMock> cameraMock = std::dynamic_pointer_cast<CameraHalMock>(camera);
|
std::shared_ptr<CameraHalMock> cameraMock = std::dynamic_pointer_cast<CameraHalMock>(camera);
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
class AppManagerTestTool
|
class AppManagerTestTool
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AppManagerTestTool() = default;
|
AppManagerTestTool();
|
||||||
virtual ~AppManagerTestTool() = default;
|
virtual ~AppManagerTestTool() = default;
|
||||||
void Init(void);
|
void Init(void);
|
||||||
void UnInit(void);
|
void UnInit(void);
|
||||||
|
|
|
@ -20,6 +20,10 @@
|
||||||
#include "ServersMock.h"
|
#include "ServersMock.h"
|
||||||
#include "TcpModule.h"
|
#include "TcpModule.h"
|
||||||
constexpr int ONLY_BE_CALLED_ONCE = 1;
|
constexpr int ONLY_BE_CALLED_ONCE = 1;
|
||||||
|
AppManagerTestTool::AppManagerTestTool()
|
||||||
|
{
|
||||||
|
mAppClientTool = nullptr;
|
||||||
|
}
|
||||||
void AppManagerTestTool::Init(void)
|
void AppManagerTestTool::Init(void)
|
||||||
{
|
{
|
||||||
ServersMock::GetInstance()->Init();
|
ServersMock::GetInstance()->Init();
|
||||||
|
|
|
@ -48,7 +48,6 @@ std::shared_ptr<ServersMock> &ServersMock::GetInstance(std::shared_ptr<ServersMo
|
||||||
}
|
}
|
||||||
ServersMock::ServersMock()
|
ServersMock::ServersMock()
|
||||||
{
|
{
|
||||||
//
|
|
||||||
mServerUrl = APP_MANAGER_DEVICE_IP ":" + std::to_string(APP_MANAGER_HTTP_SERVER_PORT);
|
mServerUrl = APP_MANAGER_DEVICE_IP ":" + std::to_string(APP_MANAGER_HTTP_SERVER_PORT);
|
||||||
}
|
}
|
||||||
void ServersMock::Init(void)
|
void ServersMock::Init(void)
|
||||||
|
@ -61,7 +60,6 @@ void ServersMock::Init(void)
|
||||||
}
|
}
|
||||||
void ServersMock::UnInit(void)
|
void ServersMock::UnInit(void)
|
||||||
{
|
{
|
||||||
//
|
|
||||||
}
|
}
|
||||||
void ServersMock::MockGetProductInfo(void)
|
void ServersMock::MockGetProductInfo(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#ifndef APP_MONITOR_MOCK_H
|
#ifndef MEDIA_MONITOR_MOCK_H
|
||||||
#define APP_MONITOR_MOCK_H
|
#define MEDIA_MONITOR_MOCK_H
|
||||||
#include "GtestUsing.h"
|
#include "GtestUsing.h"
|
||||||
#include "IMediaManager.h"
|
#include "IMediaManager.h"
|
||||||
class MediaMonitorTrace
|
class MediaMonitorTrace
|
||||||
|
|
|
@ -84,7 +84,7 @@ void FreeTcpClient(void *object)
|
||||||
if (TcpClientObjectCheck(object) == true) {
|
if (TcpClientObjectCheck(object) == true) {
|
||||||
(*(std::shared_ptr<ITcpClient> *)object)->UnInit();
|
(*(std::shared_ptr<ITcpClient> *)object)->UnInit();
|
||||||
(*(std::shared_ptr<ITcpClient> *)object).reset();
|
(*(std::shared_ptr<ITcpClient> *)object).reset();
|
||||||
free(((char *)object) - sizeof(ITcpClientHeader)); // TODO: bug?
|
free(((char *)object) - sizeof(ITcpClientHeader));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ssize_t TcpClientWrite(void *object, const void *buf, const size_t bufLenght)
|
ssize_t TcpClientWrite(void *object, const void *buf, const size_t bufLenght)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user