Improve:MissionManager module.

This commit is contained in:
Fancy code 2024-03-25 11:24:54 +08:00
parent 053d2dbda3
commit 9a10d9e16a
8 changed files with 241 additions and 8 deletions

View File

@ -60,6 +60,43 @@ StatusCode AppMonitor::GetBatteryInfo(AppGetBatteryInfo &param)
param.mChargeStatus = ChargeStatus::CHARGING;
return CreateStatusCode(STATUS_CODE_OK);
}
StatusCode AppMonitor::GetParamValue(AppGetParamValue &param)
{
param.mMicStatus = MicStatus::ON;
return CreateStatusCode(STATUS_CODE_OK);
}
StatusCode AppMonitor::GetCapability(AppGetCapability &param)
{
//
return CreateStatusCode(STATUS_CODE_OK);
}
StatusCode AppMonitor::GetLockVideoStatus(LockVideoStatus &param)
{
param = LockVideoStatus::LOCK;
return CreateStatusCode(STATUS_CODE_OK);
}
StatusCode AppMonitor::GetStorageInfo(std::vector<AppGetStorageInfo> &param)
{
AppGetStorageInfo info;
info.mIndex = 0;
info.mName = "TF card";
info.mType = StorageType::SD_CARD_1;
info.mFree = 1024 * 32;
info.mTotal = 1024 * 32;
param.push_back(info);
return CreateStatusCode(STATUS_CODE_OK);
}
StatusCode AppMonitor::GetStorageFileList(const AppGetFileInfo &fileInfo, std::vector<AppGetFileList> &param)
{
AppGetFileList file;
file.mCreateTime_s = 123456789;
file.mDuration = 15;
file.mName = "/video/test.mp4";
file.mSize = 1024;
file.mType = StorageFileType::VIDEO;
param.push_back(file);
return CreateStatusCode(STATUS_CODE_OK);
}
StatusCode AppMonitor::SetDateTime(const AppSetDateTime &param)
{
//
@ -70,6 +107,9 @@ StatusCode AppMonitor::SetTimeZone(const unsigned int &zone)
//
return CreateStatusCode(STATUS_CODE_OK);
}
StatusCode AppMonitor::SetParamValue(const AppSetParamValue &param) { return CreateStatusCode(STATUS_CODE_OK); }
StatusCode AppMonitor::EnterRecorder(void) { return CreateStatusCode(STATUS_CODE_OK); }
StatusCode AppMonitor::AppPlayback(const PlayBackEvent &event) { return CreateStatusCode(STATUS_CODE_OK); }
StatusCode AppMonitor::UploadFile(AppUploadFile &param)
{
//

View File

@ -25,8 +25,16 @@ public:
StatusCode GetMediaInfo(AppGetMeidaInfo &param) override;
StatusCode GetSdCardInfo(AppGetSdCardInfo &param) override;
StatusCode GetBatteryInfo(AppGetBatteryInfo &param) override;
StatusCode GetParamValue(AppGetParamValue &param) override;
StatusCode GetCapability(AppGetCapability &param) override;
StatusCode GetLockVideoStatus(LockVideoStatus &param) override;
StatusCode GetStorageInfo(std::vector<AppGetStorageInfo> &param) override;
StatusCode GetStorageFileList(const AppGetFileInfo &fileInfo, std::vector<AppGetFileList> &param) override;
StatusCode SetDateTime(const AppSetDateTime &param) override;
StatusCode SetTimeZone(const unsigned int &zone) override;
StatusCode SetParamValue(const AppSetParamValue &param) override;
StatusCode EnterRecorder(void) override;
StatusCode AppPlayback(const PlayBackEvent &event) override;
StatusCode UploadFile(AppUploadFile &param) override;
};
#endif

View File

@ -0,0 +1,20 @@
# 1. 项目进度汇总
## 1.1. 软件开发进度
```mermaid
gantt
dateFormat YYYY-MM-DD
title 软件进度-3月
section 3月
6帧探RTSP推流 : done, rtsp_media, 2024-03-18,3d
SC230AI快启验证(快启报错) : crit, active, 2024-03-21,3d
6帧探视频回放 : active, 2024-03-25,3d
```
### 1.1.1. 总结
* 截至2024-3-25
1. 6侦探协议框架含http和tcphttp协议框架开发完成rtsp推流到手机APP完成
2. 存在问题rtsp推流存在卡顿问题待优化
3. 更换SC230AI调试快启快启报错需要提问题单找原厂协助

View File

@ -583,7 +583,7 @@ void SixFrameHandle::RequestEnterRecorder(const std::string &url, ResponseHandle
{
LogInfo("RequestEnterRecorder.\n");
mAppMonitor->EnterRecorder();
cJSON *result = MakeResponseResult(ResposeResult::SUCCESSFUL);
cJSON *result = MakeResponseResult(ResposeResult::SUCCESSFUL, SET_REQUEST_RESPONSE);
if (nullptr == result) {
LogError("MakeResponseResult failed.\n");
responseHandle("Device run out of memory.", context);

View File

@ -181,4 +181,92 @@ TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_McuOpenFailed)
// MockUploadFiles();
MainThread::GetInstance()->Runing();
}
// ../output_files/test/bin/HunttingCameraTest
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetParamValue
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetParamValue)
{
McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
MainThread::GetInstance()->Init();
TestManager::ResetTimeOut(1000 * 3);
std::this_thread::sleep_for(std::chrono::milliseconds(100));
MockGetParamValue();
MainThread::GetInstance()->Runing();
}
// ../output_files/test/bin/HunttingCameraTest
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetCapability
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetCapability)
{
McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
MainThread::GetInstance()->Init();
TestManager::ResetTimeOut(1000 * 3);
std::this_thread::sleep_for(std::chrono::milliseconds(100));
MockGetCapability();
MainThread::GetInstance()->Runing();
}
// ../output_files/test/bin/HunttingCameraTest
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetLockVideoStatus
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetLockVideoStatus)
{
McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
MainThread::GetInstance()->Init();
TestManager::ResetTimeOut(1000 * 3);
std::this_thread::sleep_for(std::chrono::milliseconds(100));
MockGetLockVideoStatus();
MainThread::GetInstance()->Runing();
}
// ../output_files/test/bin/HunttingCameraTest
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetStorageInfo
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetStorageInfo)
{
McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
MainThread::GetInstance()->Init();
TestManager::ResetTimeOut(1000 * 3);
std::this_thread::sleep_for(std::chrono::milliseconds(100));
MockGetStorageInfo();
MainThread::GetInstance()->Runing();
}
// ../output_files/test/bin/HunttingCameraTest
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetStorageFileList
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetStorageFileList)
{
McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
MainThread::GetInstance()->Init();
TestManager::ResetTimeOut(1000 * 3);
std::this_thread::sleep_for(std::chrono::milliseconds(100));
MockGetStorageFileList();
MainThread::GetInstance()->Runing();
}
// ../output_files/test/bin/HunttingCameraTest
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_SetParamValue
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_SetParamValue)
{
McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
MainThread::GetInstance()->Init();
TestManager::ResetTimeOut(1000 * 3);
std::this_thread::sleep_for(std::chrono::milliseconds(100));
MockSetParamValue();
MainThread::GetInstance()->Runing();
}
// ../output_files/test/bin/HunttingCameraTest
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_EnterRecorder
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_EnterRecorder)
{
McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
MainThread::GetInstance()->Init();
TestManager::ResetTimeOut(1000 * 3);
std::this_thread::sleep_for(std::chrono::milliseconds(100));
MockEnterRecorder();
MainThread::GetInstance()->Runing();
}
// ../output_files/test/bin/HunttingCameraTest
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_AppPlayback
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_AppPlayback)
{
McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
MainThread::GetInstance()->Init();
TestManager::ResetTimeOut(1000 * 3);
std::this_thread::sleep_for(std::chrono::milliseconds(100));
MockAppPlayback();
MainThread::GetInstance()->Runing();
}
} // namespace HunttingCameraTest

View File

@ -60,6 +60,51 @@ StatusCode TestMissionStateTest::GetBatteryInfo(AppGetBatteryInfo &param)
}
return code;
}
StatusCode TestMissionStateTest::GetParamValue(AppGetParamValue &param)
{
LogInfo("TestMissionStateTest::GetParamValue\n");
StatusCode code = GetParamValueTrace(param);
if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
return AppMonitor::GetParamValue(param);
}
return code;
}
StatusCode TestMissionStateTest::GetCapability(AppGetCapability &param)
{
LogInfo("TestMissionStateTest::GetCapability\n");
StatusCode code = GetCapabilityTrace(param);
if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
return AppMonitor::GetCapability(param);
}
return code;
}
StatusCode TestMissionStateTest::GetLockVideoStatus(LockVideoStatus &param)
{
LogInfo("TestMissionStateTest::GetLockVideoStatus\n");
StatusCode code = GetLockVideoStatusTrace(param);
if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
return AppMonitor::GetLockVideoStatus(param);
}
return code;
}
StatusCode TestMissionStateTest::GetStorageInfo(std::vector<AppGetStorageInfo> &param)
{
LogInfo("TestMissionStateTest::GetStorageInfo\n");
StatusCode code = GetStorageInfoTrace(param);
if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
return AppMonitor::GetStorageInfo(param);
}
return code;
}
StatusCode TestMissionStateTest::GetStorageFileList(const AppGetFileInfo &fileInfo, std::vector<AppGetFileList> &param)
{
LogInfo("TestMissionStateTest::GetStorageFileList\n");
StatusCode code = GetStorageFileListTrace(fileInfo, param);
if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
return AppMonitor::GetStorageFileList(fileInfo, param);
}
return code;
}
StatusCode TestMissionStateTest::SetDateTime(const AppSetDateTime &param)
{
LogInfo("TestMissionStateTest::SetDateTime\n");
@ -84,6 +129,33 @@ StatusCode TestMissionStateTest::SetTimeZone(const unsigned int &zone)
}
return code;
}
StatusCode TestMissionStateTest::SetParamValue(const AppSetParamValue &param)
{
LogInfo("TestMissionStateTest::SetParamValue.\n");
StatusCode code = SetParamValueTrace(param);
if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
return AppMonitor::SetParamValue(param);
}
return code;
}
StatusCode TestMissionStateTest::EnterRecorder(void)
{
LogInfo("TestMissionStateTest::EnterRecorder.\n");
StatusCode code = EnterRecorderTrace();
if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
return AppMonitor::EnterRecorder();
}
return code;
}
StatusCode TestMissionStateTest::AppPlayback(const PlayBackEvent &event)
{
LogInfo("TestMissionStateTest::AppPlayback.\n");
StatusCode code = AppPlaybackTrace(event);
if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
return AppMonitor::AppPlayback(event);
}
return code;
}
StatusCode TestMissionStateTest::UploadFile(AppUploadFile &param)
{
LogInfo("TestMissionStateTest::UploadFile\n");

View File

@ -27,19 +27,24 @@ public:
StatusCode GetMediaInfo(AppGetMeidaInfo &param) override;
StatusCode GetSdCardInfo(AppGetSdCardInfo &param) override;
StatusCode GetBatteryInfo(AppGetBatteryInfo &param) override;
StatusCode GetParamValue(AppGetParamValue &param) override;
StatusCode GetCapability(AppGetCapability &param) override;
StatusCode GetLockVideoStatus(LockVideoStatus &param) override;
StatusCode GetStorageInfo(std::vector<AppGetStorageInfo> &param) override;
StatusCode GetStorageFileList(const AppGetFileInfo &fileInfo, std::vector<AppGetFileList> &param) override;
StatusCode SetDateTime(const AppSetDateTime &param) override;
StatusCode SetTimeZone(const unsigned int &zone) override;
StatusCode SetParamValue(const AppSetParamValue &param) override;
StatusCode EnterRecorder(void) override;
StatusCode AppPlayback(const PlayBackEvent &event) override;
StatusCode UploadFile(AppUploadFile &param) override;
// const StatusCode SetAppMonitor(std::shared_ptr<VAppMonitor> &monitor) override;
protected:
// virtual const StatusCode SetAppMonitorTrace(std::shared_ptr<VAppMonitor> &monitor);
};
class TestMissionStateMock : public AppMonitorMock, public TestMissionStateTest
{
public:
TestMissionStateMock() = default;
virtual ~TestMissionStateMock() = default;
// MOCK_METHOD1(SetAppMonitorTrace, const StatusCode(std::shared_ptr<VAppMonitor> &));
};
#endif

View File

@ -219,7 +219,7 @@ void ServersMock::MockGetStorageInfo(void)
void ServersMock::MockGetStorageFileList(void)
{
LogInfo("APP_GET_FILE_LIST test start.\n");
std::string mockRequest = mServerUrl + APP_GET_FILE_LIST;
std::string mockRequest = mServerUrl + APP_GET_FILE_LIST + "?folder=loop&start=0&end=99";
ServerHttp *http = NewServersHttp(mockRequest.c_str());
if (http) {
HttpGet(http);
@ -270,7 +270,7 @@ void ServersMock::MockSetTimeZone(void)
void ServersMock::MockSetParamValue(void)
{
LogInfo("APP_SET_PARAM_VALUE test start.\n");
std::string mockRequest = mServerUrl + APP_SET_PARAM_VALUE + "?timezone=8";
std::string mockRequest = mServerUrl + APP_SET_PARAM_VALUE + "?param=switchcam&value=1";
ServerHttp *http = NewServersHttp(mockRequest.c_str());
if (http) {
HttpGet(http);
@ -287,7 +287,7 @@ void ServersMock::MockSetParamValue(void)
void ServersMock::MockEnterRecorder(void)
{
LogInfo("APP_ENTER_RECORDER test start.\n");
std::string mockRequest = mServerUrl + APP_ENTER_RECORDER + "?timezone=8";
std::string mockRequest = mServerUrl + APP_ENTER_RECORDER + "?timezone=8"; // TODO:
ServerHttp *http = NewServersHttp(mockRequest.c_str());
if (http) {
HttpGet(http);
@ -304,7 +304,7 @@ void ServersMock::MockEnterRecorder(void)
void ServersMock::MockAppPlayback(void)
{
LogInfo("APP_PLAYBACK test start.\n");
std::string mockRequest = mServerUrl + APP_PLAYBACK + "?timezone=8";
std::string mockRequest = mServerUrl + APP_PLAYBACK + "?param=enter";
ServerHttp *http = NewServersHttp(mockRequest.c_str());
if (http) {
HttpGet(http);