Fixed:App protocol bug.
This commit is contained in:
parent
3ad19bbbb8
commit
af6f25397f
|
@ -15,6 +15,9 @@
|
||||||
#include "AppMonitor.h"
|
#include "AppMonitor.h"
|
||||||
#include "ILog.h"
|
#include "ILog.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
AppMonitor::AppMonitor() : mMicStatus(SwitchStatus::END)
|
||||||
|
{
|
||||||
|
}
|
||||||
StatusCode AppMonitor::GetProductInfo(AppGetProductInfo ¶m)
|
StatusCode AppMonitor::GetProductInfo(AppGetProductInfo ¶m)
|
||||||
{
|
{
|
||||||
LogInfo("AppMonitor::GetProductInfo.\n");
|
LogInfo("AppMonitor::GetProductInfo.\n");
|
||||||
|
@ -65,7 +68,7 @@ StatusCode AppMonitor::GetBatteryInfo(AppGetBatteryInfo ¶m)
|
||||||
}
|
}
|
||||||
StatusCode AppMonitor::GetParamValue(AppParamValue ¶m)
|
StatusCode AppMonitor::GetParamValue(AppParamValue ¶m)
|
||||||
{
|
{
|
||||||
param.mMicStatus = SwitchStatus::ON;
|
param.mMicStatus = mMicStatus;
|
||||||
param.mRec = SwitchStatus::OFF;
|
param.mRec = SwitchStatus::OFF;
|
||||||
return CreateStatusCode(STATUS_CODE_OK);
|
return CreateStatusCode(STATUS_CODE_OK);
|
||||||
}
|
}
|
||||||
|
@ -114,16 +117,18 @@ StatusCode AppMonitor::GetStorageFileList(const AppGetFileInfo &fileInfo, std::v
|
||||||
}
|
}
|
||||||
StatusCode AppMonitor::SetDateTime(const AppSetDateTime ¶m)
|
StatusCode AppMonitor::SetDateTime(const AppSetDateTime ¶m)
|
||||||
{
|
{
|
||||||
//
|
|
||||||
return CreateStatusCode(STATUS_CODE_OK);
|
return CreateStatusCode(STATUS_CODE_OK);
|
||||||
}
|
}
|
||||||
StatusCode AppMonitor::SetTimeZone(const unsigned int &zone)
|
StatusCode AppMonitor::SetTimeZone(const unsigned int &zone)
|
||||||
{
|
{
|
||||||
//
|
|
||||||
return CreateStatusCode(STATUS_CODE_OK);
|
return CreateStatusCode(STATUS_CODE_OK);
|
||||||
}
|
}
|
||||||
StatusCode AppMonitor::SetParamValue(const AppSetParamValue ¶m)
|
StatusCode AppMonitor::SetParamValue(const AppSetParamValue ¶m)
|
||||||
{
|
{
|
||||||
|
LogInfo("SetParamValue: param = %s.\n", param.mName.c_str());
|
||||||
|
if (param.mName == "mic") {
|
||||||
|
mMicStatus = static_cast<SwitchStatus>(param.mValue);
|
||||||
|
}
|
||||||
return CreateStatusCode(STATUS_CODE_OK);
|
return CreateStatusCode(STATUS_CODE_OK);
|
||||||
}
|
}
|
||||||
StatusCode AppMonitor::EnterRecorder(void)
|
StatusCode AppMonitor::EnterRecorder(void)
|
||||||
|
@ -136,7 +141,6 @@ StatusCode AppMonitor::AppPlayback(const PlayBackEvent &event)
|
||||||
}
|
}
|
||||||
StatusCode AppMonitor::UploadFile(AppUploadFile ¶m)
|
StatusCode AppMonitor::UploadFile(AppUploadFile ¶m)
|
||||||
{
|
{
|
||||||
//
|
|
||||||
return CreateStatusCode(STATUS_CODE_OK);
|
return CreateStatusCode(STATUS_CODE_OK);
|
||||||
}
|
}
|
||||||
StatusCode AppMonitor::GetThumbnail(AppGetThumbnail ¶m)
|
StatusCode AppMonitor::GetThumbnail(AppGetThumbnail ¶m)
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
class AppMonitor : public VAppMonitor
|
class AppMonitor : public VAppMonitor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AppMonitor() = default;
|
AppMonitor();
|
||||||
virtual ~AppMonitor() = default;
|
virtual ~AppMonitor() = default;
|
||||||
StatusCode GetProductInfo(AppGetProductInfo ¶m) override;
|
StatusCode GetProductInfo(AppGetProductInfo ¶m) override;
|
||||||
StatusCode GetDeviceAttr(AppGetDeviceAttr ¶m) override;
|
StatusCode GetDeviceAttr(AppGetDeviceAttr ¶m) override;
|
||||||
|
@ -41,5 +41,8 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SdCardStatus SdCardStatusConvert(const StorageEvent &event);
|
SdCardStatus SdCardStatusConvert(const StorageEvent &event);
|
||||||
|
|
||||||
|
private:
|
||||||
|
SwitchStatus mMicStatus; // TODO: improve delete.
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
|
@ -714,16 +714,10 @@ AppSetParamValue inline SixFrameHandle::RequestSetParamValueParse(const std::str
|
||||||
auto parseFunc = [](const std::string &key, const std::string &value, std::shared_ptr<VParseUrl> &parse) {
|
auto parseFunc = [](const std::string &key, const std::string &value, std::shared_ptr<VParseUrl> &parse) {
|
||||||
std::shared_ptr<ParseUrl<AppSetParamValue>> parseImpl =
|
std::shared_ptr<ParseUrl<AppSetParamValue>> parseImpl =
|
||||||
std::dynamic_pointer_cast<ParseUrl<AppSetParamValue>>(parse);
|
std::dynamic_pointer_cast<ParseUrl<AppSetParamValue>>(parse);
|
||||||
if ("switchcam" == key) {
|
if ("param" == key) {
|
||||||
parseImpl->mData.mName = "switchcam";
|
parseImpl->mData.mName = value;
|
||||||
parseImpl->mData.mValue = std::stoi(value);
|
|
||||||
}
|
}
|
||||||
if ("rec" == key) {
|
if ("value" == key) {
|
||||||
parseImpl->mData.mName = "rec";
|
|
||||||
parseImpl->mData.mValue = std::stoi(value);
|
|
||||||
}
|
|
||||||
if ("mic" == key) {
|
|
||||||
parseImpl->mData.mName = "mic";
|
|
||||||
parseImpl->mData.mValue = std::stoi(value);
|
parseImpl->mData.mValue = std::stoi(value);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -178,7 +178,9 @@ TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_AUTO_SetParamValue)
|
||||||
MainThread::GetInstance()->Init();
|
MainThread::GetInstance()->Init();
|
||||||
TestManager::ResetTimeOut(1000 * 3);
|
TestManager::ResetTimeOut(1000 * 3);
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
MockSetParamValue();
|
MockSetParamValue("mic", "1");
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
|
MockGetParamValue("mic");
|
||||||
MainThread::GetInstance()->Runing();
|
MainThread::GetInstance()->Runing();
|
||||||
}
|
}
|
||||||
// ../output_files/test/bin/HuntingCameraTest
|
// ../output_files/test/bin/HuntingCameraTest
|
||||||
|
|
|
@ -186,6 +186,8 @@ void HalTestTool::HalMockInit(std::shared_ptr<IHalCpp> &vMock)
|
||||||
std::shared_ptr<VWifiHal> wifiHal = std::make_shared<WifiHalMock>();
|
std::shared_ptr<VWifiHal> wifiHal = std::make_shared<WifiHalMock>();
|
||||||
std::shared_ptr<WifiHalMock> wifiHalMock = std::dynamic_pointer_cast<WifiHalMock>(wifiHal);
|
std::shared_ptr<WifiHalMock> wifiHalMock = std::dynamic_pointer_cast<WifiHalMock>(wifiHal);
|
||||||
EXPECT_CALL(*wifiHalMock.get(), OpenApMode()).WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_OK))));
|
EXPECT_CALL(*wifiHalMock.get(), OpenApMode()).WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_OK))));
|
||||||
|
EXPECT_CALL(*wifiHalMock.get(), PowerOn()).WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_OK))));
|
||||||
|
EXPECT_CALL(*wifiHalMock.get(), PowerOff()).WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_OK))));
|
||||||
EXPECT_CALL(*mock.get(), GetWifiHalTrace(_))
|
EXPECT_CALL(*mock.get(), GetWifiHalTrace(_))
|
||||||
.WillRepeatedly(DoAll(SetArgReferee<0>(wifiHal), Return(CreateStatusCode(STATUS_CODE_OK))));
|
.WillRepeatedly(DoAll(SetArgReferee<0>(wifiHal), Return(CreateStatusCode(STATUS_CODE_OK))));
|
||||||
EXPECT_CALL(*mock.get(), GetCameraHalTrace(_))
|
EXPECT_CALL(*mock.get(), GetCameraHalTrace(_))
|
||||||
|
|
|
@ -28,5 +28,7 @@ public:
|
||||||
WifiHalMock() = default;
|
WifiHalMock() = default;
|
||||||
virtual ~WifiHalMock() = default;
|
virtual ~WifiHalMock() = default;
|
||||||
MOCK_METHOD0(OpenApMode, StatusCode(void));
|
MOCK_METHOD0(OpenApMode, StatusCode(void));
|
||||||
|
MOCK_METHOD0(PowerOn, StatusCode(void));
|
||||||
|
MOCK_METHOD0(PowerOff, StatusCode(void));
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
|
@ -269,7 +269,7 @@ TEST_F(AppManagerTest, INTEGRATION_AppManager_EXAMPLE_AUTO_SetParamValue)
|
||||||
IAppManager::GetInstance()->Init(mAppParam);
|
IAppManager::GetInstance()->Init(mAppParam);
|
||||||
IAppManager::GetInstance()->SetAppMonitor(monitor);
|
IAppManager::GetInstance()->SetAppMonitor(monitor);
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
MockSetParamValue();
|
MockSetParamValue("mic", "1");
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
||||||
IAppManager::GetInstance()->UnInit();
|
IAppManager::GetInstance()->UnInit();
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ protected: // About http
|
||||||
void MockGetLockVideoStatus(void);
|
void MockGetLockVideoStatus(void);
|
||||||
void MockGetStorageInfo(void);
|
void MockGetStorageInfo(void);
|
||||||
void MockGetStorageFileList(void);
|
void MockGetStorageFileList(void);
|
||||||
void MockSetParamValue(void);
|
void MockSetParamValue(const std::string &item, const std::string &value);
|
||||||
void MockEnterRecorder(void);
|
void MockEnterRecorder(void);
|
||||||
void MockAppPlayback(void);
|
void MockAppPlayback(void);
|
||||||
void MockMonitorSetFileList(std::vector<AppGetFileList> &files);
|
void MockMonitorSetFileList(std::vector<AppGetFileList> &files);
|
||||||
|
|
|
@ -182,7 +182,7 @@ void AppManagerTestTool::MockGetStorageFileList(void)
|
||||||
}
|
}
|
||||||
ServersMock::GetInstance()->MockGetStorageFileList();
|
ServersMock::GetInstance()->MockGetStorageFileList();
|
||||||
}
|
}
|
||||||
void AppManagerTestTool::MockSetParamValue(void)
|
void AppManagerTestTool::MockSetParamValue(const std::string &item, const std::string &value)
|
||||||
{
|
{
|
||||||
std::shared_ptr<AppMonitorMock> mock = std::dynamic_pointer_cast<AppMonitorMock>(mAppMonitorMock);
|
std::shared_ptr<AppMonitorMock> mock = std::dynamic_pointer_cast<AppMonitorMock>(mAppMonitorMock);
|
||||||
if (mock) {
|
if (mock) {
|
||||||
|
@ -190,7 +190,7 @@ void AppManagerTestTool::MockSetParamValue(void)
|
||||||
.Times(ONLY_BE_CALLED_ONCE)
|
.Times(ONLY_BE_CALLED_ONCE)
|
||||||
.WillOnce(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
.WillOnce(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
}
|
}
|
||||||
ServersMock::GetInstance()->MockSetParamValue();
|
ServersMock::GetInstance()->MockSetParamValue(item, value);
|
||||||
}
|
}
|
||||||
void AppManagerTestTool::MockEnterRecorder(void)
|
void AppManagerTestTool::MockEnterRecorder(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -140,10 +140,10 @@ void ServersMock::MockSetTimeZone(void)
|
||||||
std::string mockRequest = mServerUrl + APP_SET_TIME_ZONE + "?timezone=8";
|
std::string mockRequest = mServerUrl + APP_SET_TIME_ZONE + "?timezone=8";
|
||||||
MockHttpGet(mockRequest);
|
MockHttpGet(mockRequest);
|
||||||
}
|
}
|
||||||
void ServersMock::MockSetParamValue(void)
|
void ServersMock::MockSetParamValue(const std::string &item, const std::string &value)
|
||||||
{
|
{
|
||||||
LogInfo("APP_SET_PARAM_VALUE test start.\n");
|
LogInfo("APP_SET_PARAM_VALUE test start.\n");
|
||||||
std::string mockRequest = mServerUrl + APP_SET_PARAM_VALUE + "?param=switchcam&value=1";
|
std::string mockRequest = mServerUrl + APP_SET_PARAM_VALUE + "?param=" + item + "&value=" + value;
|
||||||
MockHttpGet(mockRequest);
|
MockHttpGet(mockRequest);
|
||||||
}
|
}
|
||||||
void ServersMock::MockEnterRecorder(void)
|
void ServersMock::MockEnterRecorder(void)
|
||||||
|
|
|
@ -37,7 +37,7 @@ public:
|
||||||
virtual void MockGetStorageFileList(void);
|
virtual void MockGetStorageFileList(void);
|
||||||
virtual void MockSetDateTime(void);
|
virtual void MockSetDateTime(void);
|
||||||
virtual void MockSetTimeZone(void);
|
virtual void MockSetTimeZone(void);
|
||||||
virtual void MockSetParamValue(void);
|
virtual void MockSetParamValue(const std::string &item, const std::string &value);
|
||||||
virtual void MockEnterRecorder(void);
|
virtual void MockEnterRecorder(void);
|
||||||
virtual void MockAppPlayback(void);
|
virtual void MockAppPlayback(void);
|
||||||
virtual void MockUploadFiles(void);
|
virtual void MockUploadFiles(void);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user