Merge branch 'master-develop' of gitee.com:shenzhen-jiuyilian/ipc into master-develop
This commit is contained in:
commit
78967a59df
|
@ -80,3 +80,9 @@ void MainThread::Runing(void)
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
extern bool CreateProtocolHandleImpl(void);
|
||||||
|
void MainThread::CustomizationInit(void)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
CreateProtocolHandleImpl();
|
||||||
|
}
|
|
@ -26,7 +26,7 @@ public:
|
||||||
virtual StatusCode UnInit(void);
|
virtual StatusCode UnInit(void);
|
||||||
void Runing(void);
|
void Runing(void);
|
||||||
void Exit(void) { mMainThreadRuning = false; }
|
void Exit(void) { mMainThreadRuning = false; }
|
||||||
virtual void CustomizationInit(void) {}
|
virtual void CustomizationInit(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
StatusCode CreateAllModules(void);
|
StatusCode CreateAllModules(void);
|
||||||
|
|
|
@ -1,6 +1,22 @@
|
||||||
|
/*
|
||||||
|
* 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 "AppMonitor.h"
|
#include "AppMonitor.h"
|
||||||
|
#include "ILog.h"
|
||||||
StatusCode AppMonitor::GetProductInfo(AppGetProductInfo ¶m)
|
StatusCode AppMonitor::GetProductInfo(AppGetProductInfo ¶m)
|
||||||
{
|
{
|
||||||
|
LogInfo("AppMonitor::GetProductInfo.\n");
|
||||||
param.mModel = "test";
|
param.mModel = "test";
|
||||||
param.mCompany = "test";
|
param.mCompany = "test";
|
||||||
param.mSoc = "test";
|
param.mSoc = "test";
|
||||||
|
@ -9,6 +25,7 @@ StatusCode AppMonitor::GetProductInfo(AppGetProductInfo ¶m)
|
||||||
}
|
}
|
||||||
StatusCode AppMonitor::GetDeviceAttr(AppGetDeviceAttr ¶m)
|
StatusCode AppMonitor::GetDeviceAttr(AppGetDeviceAttr ¶m)
|
||||||
{
|
{
|
||||||
|
LogInfo("AppMonitor::GetDeviceAttr.\n");
|
||||||
param.mUUID = "test";
|
param.mUUID = "test";
|
||||||
param.mSoftVersion = "test";
|
param.mSoftVersion = "test";
|
||||||
param.mOtaVersion = "test";
|
param.mOtaVersion = "test";
|
||||||
|
@ -22,6 +39,7 @@ StatusCode AppMonitor::GetDeviceAttr(AppGetDeviceAttr ¶m)
|
||||||
}
|
}
|
||||||
StatusCode AppMonitor::GetMediaInfo(AppGetMeidaInfo ¶m)
|
StatusCode AppMonitor::GetMediaInfo(AppGetMeidaInfo ¶m)
|
||||||
{
|
{
|
||||||
|
LogInfo("AppMonitor::GetMediaInfo.\n");
|
||||||
param.mRtspUrl = "test";
|
param.mRtspUrl = "test";
|
||||||
param.mTransport = "test";
|
param.mTransport = "test";
|
||||||
param.mPort = 123;
|
param.mPort = 123;
|
||||||
|
@ -29,6 +47,7 @@ StatusCode AppMonitor::GetMediaInfo(AppGetMeidaInfo ¶m)
|
||||||
}
|
}
|
||||||
StatusCode AppMonitor::GetSdCardInfo(AppGetSdCardInfo ¶m)
|
StatusCode AppMonitor::GetSdCardInfo(AppGetSdCardInfo ¶m)
|
||||||
{
|
{
|
||||||
|
LogInfo("AppMonitor::GetSdCardInfo.\n");
|
||||||
param.mStatus = SdCardStatus::CARD_DAMAGED;
|
param.mStatus = SdCardStatus::CARD_DAMAGED;
|
||||||
param.mFree = 0;
|
param.mFree = 0;
|
||||||
param.mTotal = 0;
|
param.mTotal = 0;
|
||||||
|
@ -36,6 +55,7 @@ StatusCode AppMonitor::GetSdCardInfo(AppGetSdCardInfo ¶m)
|
||||||
}
|
}
|
||||||
StatusCode AppMonitor::GetBatteryInfo(AppGetBatteryInfo ¶m)
|
StatusCode AppMonitor::GetBatteryInfo(AppGetBatteryInfo ¶m)
|
||||||
{
|
{
|
||||||
|
LogInfo("AppMonitor::GetBatteryInfo.\n");
|
||||||
param.mCapacity = 0;
|
param.mCapacity = 0;
|
||||||
param.mChargeStatus = ChargeStatus::CHARGING;
|
param.mChargeStatus = ChargeStatus::CHARGING;
|
||||||
return CreateStatusCode(STATUS_CODE_OK);
|
return CreateStatusCode(STATUS_CODE_OK);
|
||||||
|
|
|
@ -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 DATAPROCESSING_H
|
#ifndef DATA_PROCESSING_H
|
||||||
#define DATAPROCESSING_H
|
#define DATA_PROCESSING_H
|
||||||
#include "IMissionManager.h"
|
#include "IMissionManager.h"
|
||||||
#include "IStateMachine.h"
|
#include "IStateMachine.h"
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
|
@ -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 MISSIONMANAGER_H
|
#ifndef MISSION_MANAGER_H
|
||||||
#define MISSIONMANAGER_H
|
#define MISSION_MANAGER_H
|
||||||
#include "IMissionManager.h"
|
#include "IMissionManager.h"
|
||||||
class MissionManager : public IMissionManager
|
class MissionManager : public IMissionManager
|
||||||
{
|
{
|
||||||
|
|
|
@ -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 MISSIONMANAGERMAKEIMPL_H
|
#ifndef MISSION_MANAGER_MAKE_PTR_H
|
||||||
#define MISSIONMANAGERMAKEIMPL_H
|
#define MISSION_MANAGER_MAKE_PTR_H
|
||||||
#include "IMcuManager.h"
|
#include "IMcuManager.h"
|
||||||
#include "IMissionManager.h"
|
#include "IMissionManager.h"
|
||||||
#include "IStateMachine.h"
|
#include "IStateMachine.h"
|
||||||
|
|
29
application/MissionManager/src/MissionState.cpp
Normal file
29
application/MissionManager/src/MissionState.cpp
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* 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 "MissionState.h"
|
||||||
|
#include "IAppManager.h"
|
||||||
|
#include "ILog.h"
|
||||||
|
MissionState::MissionState(const std::string &name) : State(name) {}
|
||||||
|
void MissionState::GoInState()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
LogInfo(" ========== MissionState::GoInState.\n");
|
||||||
|
}
|
||||||
|
void MissionState::GoOutState()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
LogInfo(" ========== MissionState::GoOutState.\n");
|
||||||
|
}
|
||||||
|
bool MissionState::ExecuteStateMsg(VStateMachineData *msg) { return DataProcessing::EventHandle(msg); }
|
28
application/MissionManager/src/MissionState.h
Normal file
28
application/MissionManager/src/MissionState.h
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
* 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 MISSION_STATE_H
|
||||||
|
#define MISSION_STATE_H
|
||||||
|
#include "DataProcessing.h"
|
||||||
|
#include "IStateMachine.h"
|
||||||
|
class MissionState : public State, public DataProcessing, public std::enable_shared_from_this<MissionState>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MissionState(const std::string &name);
|
||||||
|
virtual ~MissionState() = default;
|
||||||
|
void GoInState() override;
|
||||||
|
void GoOutState() override;
|
||||||
|
bool ExecuteStateMsg(VStateMachineData *msg) override;
|
||||||
|
};
|
||||||
|
#endif
|
|
@ -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 MISSIONSTATEMACHINE_H
|
#ifndef MISSION_STATE_MACHINE_H
|
||||||
#define MISSIONSTATEMACHINE_H
|
#define MISSION_STATE_MACHINE_H
|
||||||
// #include "IDeviceManager.h"
|
// #include "IDeviceManager.h"
|
||||||
#include "IMcuManager.h"
|
#include "IMcuManager.h"
|
||||||
#include "IMissionManager.h"
|
#include "IMissionManager.h"
|
||||||
|
|
|
@ -15,17 +15,20 @@
|
||||||
#include "TestMissionState.h"
|
#include "TestMissionState.h"
|
||||||
#include "IAppManager.h"
|
#include "IAppManager.h"
|
||||||
#include "ILog.h"
|
#include "ILog.h"
|
||||||
TestMissionState::TestMissionState() : State("TestMissionState") {}
|
TestMissionState::TestMissionState() : MissionState("TestMissionState") {}
|
||||||
void TestMissionState::GoInState()
|
void TestMissionState::GoInState()
|
||||||
{
|
{
|
||||||
//
|
MissionState::GoInState();
|
||||||
LogInfo(" ========== TestMissionState::GoInState.\n");
|
LogInfo(" ========== TestMissionState::GoInState.\n");
|
||||||
AppParam mAppParam("192.168.1.29", APP_MANAGER_HTTP_SERVER_PORT); // TODO:
|
AppParam mAppParam(APP_MANAGER_HTTP_SERVER_IP, APP_MANAGER_HTTP_SERVER_PORT); // TODO:
|
||||||
IAppManager::GetInstance()->Init(mAppParam);
|
IAppManager::GetInstance()->Init(mAppParam);
|
||||||
|
std::shared_ptr<VAppMonitor> monitor =
|
||||||
|
std::dynamic_pointer_cast<TestMissionState>(MissionState::shared_from_this());
|
||||||
|
IAppManager::GetInstance()->SetAppMonitor(monitor);
|
||||||
}
|
}
|
||||||
void TestMissionState::GoOutState()
|
void TestMissionState::GoOutState()
|
||||||
{
|
{
|
||||||
//
|
MissionState::GoOutState();
|
||||||
LogInfo(" ========== TestMissionState::GoOutState.\n");
|
LogInfo(" ========== TestMissionState::GoOutState.\n");
|
||||||
}
|
}
|
||||||
bool TestMissionState::ExecuteStateMsg(VStateMachineData *msg) { return DataProcessing::EventHandle(msg); }
|
bool TestMissionState::ExecuteStateMsg(VStateMachineData *msg) { return MissionState::EventHandle(msg); }
|
|
@ -15,9 +15,9 @@
|
||||||
#ifndef TEST_MISSION_STATE_H
|
#ifndef TEST_MISSION_STATE_H
|
||||||
#define TEST_MISSION_STATE_H
|
#define TEST_MISSION_STATE_H
|
||||||
#include "AppMonitor.h"
|
#include "AppMonitor.h"
|
||||||
#include "DataProcessing.h"
|
|
||||||
#include "IStateMachine.h"
|
#include "IStateMachine.h"
|
||||||
class TestMissionState : public State, public DataProcessing, public AppMonitor
|
#include "MissionState.h"
|
||||||
|
class TestMissionState : public MissionState, public AppMonitor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TestMissionState();
|
TestMissionState();
|
||||||
|
|
|
@ -49,7 +49,7 @@ set(LOG_SUPPORT "true")
|
||||||
set(GOAHEAD_DOCUMENTS_PATH "web")
|
set(GOAHEAD_DOCUMENTS_PATH "web")
|
||||||
set(GOAHEAD_UPLOAD_TMP_PATH "./goahead")
|
set(GOAHEAD_UPLOAD_TMP_PATH "./goahead")
|
||||||
set(GOAHEAD_UPLOAD_PATH "${GOAHEAD_UPLOAD_TMP_PATH}")
|
set(GOAHEAD_UPLOAD_PATH "${GOAHEAD_UPLOAD_TMP_PATH}")
|
||||||
set(GOAHEAD_LIMIT_POST "33554432") # If not defined means using default setting. See goahead-linux-static-fancy.mk
|
set(GOAHEAD_LIMIT_POST "335544320") # If not defined means using default setting. See goahead-linux-static-fancy.mk
|
||||||
# GOAHEAD_CONFIG_FILE_PATH should be set when cross compile
|
# GOAHEAD_CONFIG_FILE_PATH should be set when cross compile
|
||||||
# set(GOAHEAD_CONFIG_FILE_PATH "./")
|
# set(GOAHEAD_CONFIG_FILE_PATH "./")
|
||||||
# ------------ build GoAhead end ------------ #
|
# ------------ build GoAhead end ------------ #
|
||||||
|
|
|
@ -39,3 +39,7 @@ StatusCode IHalCpp::GetAllKeys(std::map<std::string, std::shared_ptr<VKeyHal>> &
|
||||||
{
|
{
|
||||||
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
}
|
}
|
||||||
|
StatusCode IHalCpp::GetWifiHal(std::shared_ptr<VWifiHal> &wifi)
|
||||||
|
{
|
||||||
|
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
|
}
|
|
@ -50,6 +50,13 @@ public:
|
||||||
VLedHal() = default;
|
VLedHal() = default;
|
||||||
virtual ~VLedHal() = default;
|
virtual ~VLedHal() = default;
|
||||||
};
|
};
|
||||||
|
class VWifiHal
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
VWifiHal() = default;
|
||||||
|
virtual ~VWifiHal() = default;
|
||||||
|
virtual StatusCode OpenApMode(void) { return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION); }
|
||||||
|
};
|
||||||
class IHalCpp
|
class IHalCpp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -60,5 +67,6 @@ public:
|
||||||
virtual StatusCode UnInit(void);
|
virtual StatusCode UnInit(void);
|
||||||
virtual StatusCode GetAllLeds(std::map<std::string, std::shared_ptr<VLedHal>> &allLeds);
|
virtual StatusCode GetAllLeds(std::map<std::string, std::shared_ptr<VLedHal>> &allLeds);
|
||||||
virtual StatusCode GetAllKeys(std::map<std::string, std::shared_ptr<VKeyHal>> &allKeys);
|
virtual StatusCode GetAllKeys(std::map<std::string, std::shared_ptr<VKeyHal>> &allKeys);
|
||||||
|
virtual StatusCode GetWifiHal(std::shared_ptr<VWifiHal> &wifi);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
14
hal/src/WifiHal.cpp
Normal file
14
hal/src/WifiHal.cpp
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
24
hal/src/WifiHal.h
Normal file
24
hal/src/WifiHal.h
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* 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 WIFI_HAL_H
|
||||||
|
#define WIFI_HAL_H
|
||||||
|
#include "IHalCpp.h"
|
||||||
|
class WifiHal : public VWifiHal
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
WifiHal() = default;
|
||||||
|
virtual ~WifiHal() = default;
|
||||||
|
};
|
||||||
|
#endif
|
|
@ -15,15 +15,23 @@
|
||||||
#include "AppManager.h"
|
#include "AppManager.h"
|
||||||
#include "AppManagerMakePtr.h"
|
#include "AppManagerMakePtr.h"
|
||||||
// #include "FxHttpServer.h"
|
// #include "FxHttpServer.h"
|
||||||
|
#include "IHalCpp.h"
|
||||||
#include "ILog.h"
|
#include "ILog.h"
|
||||||
#include "WebServer.h"
|
#include "WebServer.h"
|
||||||
AppManager::AppManager()
|
AppManager::AppManager()
|
||||||
{
|
{
|
||||||
//
|
|
||||||
// mHttpServerRuning = false;
|
// mHttpServerRuning = false;
|
||||||
|
mProtocolHandle = std::make_shared<IAppProtocolHandle>();
|
||||||
}
|
}
|
||||||
const StatusCode AppManager::Init(const AppParam ¶m)
|
const StatusCode AppManager::Init(const AppParam ¶m)
|
||||||
{
|
{
|
||||||
|
std::shared_ptr<VWifiHal> wifi;
|
||||||
|
IHalCpp::GetInstance()->GetWifiHal(wifi);
|
||||||
|
if (!wifi) {
|
||||||
|
LogError("Get wifi hal failed.\n");
|
||||||
|
return CreateStatusCode(STATUS_CODE_NOT_OK);
|
||||||
|
}
|
||||||
|
wifi->OpenApMode();
|
||||||
AppManagerMakePtr::GetInstance()->CreateProtocolHandle(mProtocolHandle);
|
AppManagerMakePtr::GetInstance()->CreateProtocolHandle(mProtocolHandle);
|
||||||
HttpServerStart(param);
|
HttpServerStart(param);
|
||||||
return CreateStatusCode(STATUS_CODE_OK);
|
return CreateStatusCode(STATUS_CODE_OK);
|
||||||
|
|
|
@ -102,14 +102,24 @@ void SixFrameHandle::RequestGetProductInfo(const std::string &url, ResponseHandl
|
||||||
{
|
{
|
||||||
LogInfo("RequestGetProductInfo.\n");
|
LogInfo("RequestGetProductInfo.\n");
|
||||||
char *resultStr = nullptr;
|
char *resultStr = nullptr;
|
||||||
cJSON *result = MakeResponseResult(ResposeResult::SUCCESSFUL);
|
|
||||||
resultStr = cJSON_Print(result);
|
|
||||||
AppGetProductInfo param;
|
AppGetProductInfo param;
|
||||||
mAppMonitor->GetProductInfo(param);
|
mAppMonitor->GetProductInfo(param);
|
||||||
|
cJSON *result = MakeResponseResult(ResposeResult::SUCCESSFUL);
|
||||||
|
ResponseGetProductInfo(result, param);
|
||||||
|
resultStr = cJSON_Print(result);
|
||||||
responseHandle(resultStr, context);
|
responseHandle(resultStr, context);
|
||||||
free(resultStr);
|
free(resultStr);
|
||||||
cJSON_Delete(result);
|
cJSON_Delete(result);
|
||||||
}
|
}
|
||||||
|
void inline SixFrameHandle::ResponseGetProductInfo(cJSON *result, const AppGetProductInfo ¶m)
|
||||||
|
{
|
||||||
|
cJSON *info = nullptr;
|
||||||
|
cJSON_AddItemToObject(result, CJSON_INFO_STRING, info = cJSON_CreateObject());
|
||||||
|
cJSON_AddStringToObject(info, "model", param.mModel.c_str());
|
||||||
|
cJSON_AddStringToObject(info, "company", param.mCompany.c_str());
|
||||||
|
cJSON_AddStringToObject(info, "soc", param.mSoc.c_str());
|
||||||
|
cJSON_AddStringToObject(info, "sp", param.mSp.c_str());
|
||||||
|
}
|
||||||
void SixFrameHandle::RequestGetDeviceAttr(const std::string &url, ResponseHandle responseHandle, void *context)
|
void SixFrameHandle::RequestGetDeviceAttr(const std::string &url, ResponseHandle responseHandle, void *context)
|
||||||
{
|
{
|
||||||
LogInfo("RequestGetDeviceAttr.\n");
|
LogInfo("RequestGetDeviceAttr.\n");
|
||||||
|
|
|
@ -59,6 +59,7 @@ private:
|
||||||
void *context);
|
void *context);
|
||||||
void DoNothing(const std::string &url, ResponseHandle responseHandle, void *context);
|
void DoNothing(const std::string &url, ResponseHandle responseHandle, void *context);
|
||||||
void RequestGetProductInfo(const std::string &url, ResponseHandle responseHandle, void *context);
|
void RequestGetProductInfo(const std::string &url, ResponseHandle responseHandle, void *context);
|
||||||
|
void ResponseGetProductInfo(cJSON *result, const AppGetProductInfo ¶m);
|
||||||
void RequestGetDeviceAttr(const std::string &url, ResponseHandle responseHandle, void *context);
|
void RequestGetDeviceAttr(const std::string &url, ResponseHandle responseHandle, void *context);
|
||||||
void ResponseGetDeviceAttr(cJSON *result, const AppGetDeviceAttr ¶m);
|
void ResponseGetDeviceAttr(cJSON *result, const AppGetDeviceAttr ¶m);
|
||||||
void RequestGetMediaInfo(const std::string &url, ResponseHandle responseHandle, void *context);
|
void RequestGetMediaInfo(const std::string &url, ResponseHandle responseHandle, void *context);
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
|
|
||||||
add_subdirectory(HunttingCamera)
|
add_subdirectory(HunttingCamera)
|
||||||
|
add_subdirectory(MissionManager)
|
|
@ -13,6 +13,7 @@ include_directories(
|
||||||
${UTILS_SOURCE_PATH}/UartDevice/include
|
${UTILS_SOURCE_PATH}/UartDevice/include
|
||||||
${TEST_SOURCE_PATH}
|
${TEST_SOURCE_PATH}
|
||||||
${TEST_SOURCE_PATH}/middleware/McuManager/tool/include
|
${TEST_SOURCE_PATH}/middleware/McuManager/tool/include
|
||||||
|
${TEST_SOURCE_PATH}/middleware/AppManager/tool/include
|
||||||
${TEST_SOURCE_PATH}/utils/LinuxApiMock/include
|
${TEST_SOURCE_PATH}/utils/LinuxApiMock/include
|
||||||
${TEST_SOURCE_PATH}/utils/TestManager/include
|
${TEST_SOURCE_PATH}/utils/TestManager/include
|
||||||
${TEST_SOURCE_PATH}/utils/McuProtocol/tool/include
|
${TEST_SOURCE_PATH}/utils/McuProtocol/tool/include
|
||||||
|
@ -34,7 +35,7 @@ endif()
|
||||||
|
|
||||||
set(TARGET_NAME HunttingCameraTest)
|
set(TARGET_NAME HunttingCameraTest)
|
||||||
add_executable(${TARGET_NAME} ${SRC_FILES_MAIN} ${SRC_FILES})
|
add_executable(${TARGET_NAME} ${SRC_FILES_MAIN} ${SRC_FILES})
|
||||||
target_link_libraries(${TARGET_NAME} HunttingMainLib McuManagerTestTool McuAskBaseTestTool TestManager gtest gmock pthread)
|
target_link_libraries(${TARGET_NAME} HunttingMainLib McuManagerTestTool McuAskBaseTestTool AppManagerTestTool TestManager 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()
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
* 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.
|
||||||
*/
|
*/
|
||||||
|
#include "AppManagerTestTool.h"
|
||||||
#include "GtestUsing.h"
|
#include "GtestUsing.h"
|
||||||
#include "ILog.h"
|
#include "ILog.h"
|
||||||
#include "MainThread.h"
|
#include "MainThread.h"
|
||||||
|
@ -20,7 +21,10 @@
|
||||||
#include <thread>
|
#include <thread>
|
||||||
namespace HunttingCameraTest
|
namespace HunttingCameraTest
|
||||||
{
|
{
|
||||||
class HunttingCameraTest : public testing::Test, public TestManager, public McuManagerTestTool
|
class HunttingCameraTest : public testing::Test,
|
||||||
|
public TestManager,
|
||||||
|
public McuManagerTestTool,
|
||||||
|
public AppManagerTestTool
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HunttingCameraTest() {}
|
HunttingCameraTest() {}
|
||||||
|
@ -68,6 +72,8 @@ TEST_F(HunttingCameraTest, INTEGRATION_DeviceManager_EXAMPLE_Demo)
|
||||||
{
|
{
|
||||||
MainThread::GetInstance()->Init();
|
MainThread::GetInstance()->Init();
|
||||||
TestManager::ResetTimeOut(1000 * 3);
|
TestManager::ResetTimeOut(1000 * 3);
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
|
MockGetProductInfo();
|
||||||
MainThread::GetInstance()->Runing();
|
MainThread::GetInstance()->Runing();
|
||||||
}
|
}
|
||||||
} // namespace HunttingCameraTest
|
} // namespace HunttingCameraTest
|
2
test/application/MissionManager/CMakeLists.txt
Normal file
2
test/application/MissionManager/CMakeLists.txt
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
|
||||||
|
add_subdirectory(tool)
|
58
test/application/MissionManager/tool/CMakeLists.txt
Normal file
58
test/application/MissionManager/tool/CMakeLists.txt
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
include(${CMAKE_SOURCE_DIR_IPCSDK}/build/global_config.cmake)
|
||||||
|
set(EXECUTABLE_OUTPUT_PATH ${EXEC_OUTPUT_PATH})
|
||||||
|
set(LIBRARY_OUTPUT_PATH ${LIBS_OUTPUT_PATH})
|
||||||
|
|
||||||
|
include_directories(
|
||||||
|
./src
|
||||||
|
./include
|
||||||
|
${UTILS_SOURCE_PATH}/StatusCode/include
|
||||||
|
${UTILS_SOURCE_PATH}/Log/include
|
||||||
|
${APPLICATION_SOURCE_PATH}/MissionManager/include
|
||||||
|
${APPLICATION_SOURCE_PATH}/MissionManager/src
|
||||||
|
${MIDDLEWARE_SOURCE_PATH}/AppManager/include
|
||||||
|
${MIDDLEWARE_SOURCE_PATH}/StateMachine/include
|
||||||
|
${TEST_SOURCE_PATH}
|
||||||
|
${TEST_SOURCE_PATH}/middleware/AppManager/tool/include
|
||||||
|
${TEST_SOURCE_PATH}/middleware/AppManager/tool/src
|
||||||
|
${EXTERNAL_SOURCE_PATH}/gtest/googletest-release-1.11.0/googletest/include
|
||||||
|
${EXTERNAL_SOURCE_PATH}/gtest/googletest-release-1.11.0/googlemock/include
|
||||||
|
)
|
||||||
|
# link_directories(
|
||||||
|
# ${EXTERNAL_SOURCE_PATH}/libconfig/libconfig-1.7.3/lib/.libs
|
||||||
|
# )
|
||||||
|
|
||||||
|
aux_source_directory(./src TEST_TOOL_SRC_FILES)
|
||||||
|
set(TEST_TOOL_TARGET MissionManagerTestTool)
|
||||||
|
add_library(${TEST_TOOL_TARGET} STATIC ${TEST_TOOL_SRC_FILES})
|
||||||
|
target_link_libraries(${TEST_TOOL_TARGET} MissionManager AppManagerTestTool Log)
|
||||||
|
|
||||||
|
if ("${CLANG_TIDY_SUPPORT}" MATCHES "true")
|
||||||
|
add_custom_target(
|
||||||
|
MissionManagerTestTool_code_check
|
||||||
|
COMMAND ${CLANG_TIDY_EXE}
|
||||||
|
-checks='${CLANG_TIDY_CHECKS}'
|
||||||
|
--header-filter=.*
|
||||||
|
--system-headers=false
|
||||||
|
${TEST_TOOL_SRC_FILES}
|
||||||
|
${CLANG_TIDY_CONFIG}
|
||||||
|
-p ${PLATFORM_PATH}/cmake-shell
|
||||||
|
WORKING_DIRECTORY ${TEST_SOURCE_PATH}/application/MissionManager/tool
|
||||||
|
)
|
||||||
|
file(GLOB_RECURSE HEADER_FILES *.h)
|
||||||
|
add_custom_target(
|
||||||
|
MissionManagerTestTool_code_format
|
||||||
|
COMMAND ${CLANG_FORMAT_EXE}
|
||||||
|
-style=file
|
||||||
|
-i ${TEST_TOOL_SRC_FILES} ${HEADER_FILES}
|
||||||
|
WORKING_DIRECTORY ${TEST_SOURCE_PATH}/application/MissionManager/tool
|
||||||
|
)
|
||||||
|
add_custom_command(
|
||||||
|
TARGET ${TEST_TOOL_TARGET}
|
||||||
|
PRE_BUILD
|
||||||
|
COMMAND make MissionManagerTestTool_code_check
|
||||||
|
COMMAND make MissionManagerTestTool_code_format
|
||||||
|
WORKING_DIRECTORY ${PLATFORM_PATH}/cmake-shell/
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
define_file_name(${TEST_TOOL_TARGET})
|
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* 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 MISSION_MANAGER_TEST_TOOL_H
|
||||||
|
#define MISSION_MANAGER_TEST_TOOL_H
|
||||||
|
#include "GtestUsing.h"
|
||||||
|
#include "IMissionManager.h"
|
||||||
|
#include <memory>
|
||||||
|
class MissionManagerTestTool
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MissionManagerTestTool() = default;
|
||||||
|
virtual ~MissionManagerTestTool() = default;
|
||||||
|
void Init(void);
|
||||||
|
void UnInit(void);
|
||||||
|
|
||||||
|
private:
|
||||||
|
// void MissionManagerMockInit(std::shared_ptr<IMissionManager> &vMock);
|
||||||
|
|
||||||
|
// private:
|
||||||
|
// std::shared_ptr<IMissionManager> mMissionManagerMock;
|
||||||
|
// std::shared_ptr<VAppMonitor> mAppMonitorMock;
|
||||||
|
|
||||||
|
// public:
|
||||||
|
// static std::shared_ptr<VAppMonitor> MakeMonitorMock(void);
|
||||||
|
// void AppMonitorInit(std::shared_ptr<VAppMonitor> &vMock);
|
||||||
|
};
|
||||||
|
#endif
|
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
* 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 "MissionManagerTestTool.h"
|
||||||
|
void MissionManagerTestTool::Init(void)
|
||||||
|
{
|
||||||
|
// ServersMock::GetInstance()->Init();
|
||||||
|
// mMissionManagerMock = std::make_shared<MissionManagerMock>();
|
||||||
|
// MissionManagerMockInit(mMissionManagerMock);
|
||||||
|
// std::shared_ptr<MissionManagerMock> mock = std::dynamic_pointer_cast<MissionManagerMock>(mMissionManagerMock);
|
||||||
|
// OverrideMissionManagerMakePtrObject(mock);
|
||||||
|
}
|
||||||
|
void MissionManagerTestTool::UnInit(void)
|
||||||
|
{
|
||||||
|
// ServersMock::GetInstance()->UnInit();
|
||||||
|
// mMissionManagerMock.reset();
|
||||||
|
// mAppMonitorMock.reset();
|
||||||
|
// CancelOverrideMissionManagerMakePtrObject();
|
||||||
|
}
|
|
@ -0,0 +1,95 @@
|
||||||
|
/*
|
||||||
|
* 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 "TestMissionStateMock.h"
|
||||||
|
#include "AppMonitorMock.h"
|
||||||
|
#include "ILog.h"
|
||||||
|
StatusCode TestMissionStateTest::GetProductInfo(AppGetProductInfo ¶m)
|
||||||
|
{
|
||||||
|
LogInfo("TestMissionStateTest::GetProductInfo\n");
|
||||||
|
StatusCode code = GetProductInfoTrace(param);
|
||||||
|
if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
|
||||||
|
return AppMonitor::GetProductInfo(param);
|
||||||
|
}
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
StatusCode TestMissionStateTest::GetDeviceAttr(AppGetDeviceAttr ¶m)
|
||||||
|
{
|
||||||
|
LogInfo("TestMissionStateTest::GetDeviceAttr\n");
|
||||||
|
StatusCode code = GetDeviceAttrTrace(param);
|
||||||
|
if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
|
||||||
|
return AppMonitor::GetDeviceAttr(param);
|
||||||
|
}
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
StatusCode TestMissionStateTest::GetMediaInfo(AppGetMeidaInfo ¶m)
|
||||||
|
{
|
||||||
|
LogInfo("TestMissionStateTest::GetMediaInfo\n");
|
||||||
|
StatusCode code = GetMediaInfoTrace(param);
|
||||||
|
if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
|
||||||
|
return AppMonitor::GetMediaInfo(param);
|
||||||
|
}
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
StatusCode TestMissionStateTest::GetSdCardInfo(AppGetSdCardInfo ¶m)
|
||||||
|
{
|
||||||
|
LogInfo("TestMissionStateTest::GetSdCardInfo\n");
|
||||||
|
StatusCode code = GetSdCardInfoTrace(param);
|
||||||
|
if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
|
||||||
|
return AppMonitor::GetSdCardInfo(param);
|
||||||
|
}
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
StatusCode TestMissionStateTest::GetBatteryInfo(AppGetBatteryInfo ¶m)
|
||||||
|
{
|
||||||
|
LogInfo("TestMissionStateTest::GetBatteryInfo\n");
|
||||||
|
StatusCode code = GetBatteryInfoTrace(param);
|
||||||
|
if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
|
||||||
|
return AppMonitor::GetBatteryInfo(param);
|
||||||
|
}
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
StatusCode TestMissionStateTest::SetDateTime(AppSetDateTime ¶m)
|
||||||
|
{
|
||||||
|
LogInfo("TestMissionStateTest::SetDateTime\n");
|
||||||
|
LogInfo("mYear = %u\n", param.mYear);
|
||||||
|
LogInfo("mMonth = %02u\n", param.mMonth);
|
||||||
|
LogInfo("mDay = %02u\n", param.mDay);
|
||||||
|
LogInfo("mHour = %02u\n", param.mHour);
|
||||||
|
LogInfo("mMinute = %02u\n", param.mMinute);
|
||||||
|
LogInfo("mSecond = %02u\n", param.mSecond);
|
||||||
|
StatusCode code = SetDateTimeTrace(param);
|
||||||
|
if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
|
||||||
|
return AppMonitor::SetDateTime(param);
|
||||||
|
}
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
StatusCode TestMissionStateTest::SetTimeZone(const unsigned int &zone)
|
||||||
|
{
|
||||||
|
LogInfo("TestMissionStateTest::SetTimeZone = %u\n", zone);
|
||||||
|
StatusCode code = SetTimeZoneTrace(zone);
|
||||||
|
if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
|
||||||
|
return AppMonitor::SetTimeZone(zone);
|
||||||
|
}
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
StatusCode TestMissionStateTest::UploadFile(AppUploadFile ¶m)
|
||||||
|
{
|
||||||
|
LogInfo("TestMissionStateTest::UploadFile\n");
|
||||||
|
StatusCode code = UploadFileTrace(param);
|
||||||
|
if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
|
||||||
|
return AppMonitor::UploadFile(param);
|
||||||
|
}
|
||||||
|
return code;
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
/*
|
||||||
|
* 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 TEST_MISSION_STATE_MOCK_H
|
||||||
|
#define TEST_MISSION_STATE_MOCK_H
|
||||||
|
#include "AppMonitorMock.h"
|
||||||
|
#include "MissionManagerTestTool.h"
|
||||||
|
#include "TestMissionState.h"
|
||||||
|
class TestMissionStateTest : public TestMissionState, virtual public AppMonitorTrace
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TestMissionStateTest() = default;
|
||||||
|
virtual ~TestMissionStateTest() = 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 SetDateTime(AppSetDateTime ¶m) override;
|
||||||
|
StatusCode SetTimeZone(const unsigned int &zone) override;
|
||||||
|
StatusCode UploadFile(AppUploadFile ¶m) 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
|
|
@ -36,84 +36,82 @@ void AppManagerTestTool::UnInit(void)
|
||||||
}
|
}
|
||||||
void AppManagerTestTool::MockGetProductInfo(void)
|
void AppManagerTestTool::MockGetProductInfo(void)
|
||||||
{
|
{
|
||||||
//
|
std::shared_ptr<AppMonitorMock> mock = std::dynamic_pointer_cast<AppMonitorMock>(mAppMonitorMock);
|
||||||
|
if (mock) {
|
||||||
|
EXPECT_CALL(*mock.get(), GetProductInfoTrace(_))
|
||||||
|
.Times(ONLY_BE_CALLED_ONCE)
|
||||||
|
.WillOnce(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
|
}
|
||||||
ServersMock::GetInstance()->MockGetProductInfo();
|
ServersMock::GetInstance()->MockGetProductInfo();
|
||||||
}
|
}
|
||||||
void AppManagerTestTool::MockGetDeviceAttr(void)
|
void AppManagerTestTool::MockGetDeviceAttr(void)
|
||||||
{
|
{
|
||||||
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) {
|
||||||
LogError("vMock error.\n");
|
EXPECT_CALL(*mock.get(), GetDeviceAttrTrace(_))
|
||||||
return;
|
.Times(ONLY_BE_CALLED_ONCE)
|
||||||
|
.WillOnce(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
}
|
}
|
||||||
EXPECT_CALL(*mock.get(), GetDeviceAttrTrace(_))
|
|
||||||
.Times(ONLY_BE_CALLED_ONCE)
|
|
||||||
.WillOnce(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
|
||||||
ServersMock::GetInstance()->MockGetDeviceAttr();
|
ServersMock::GetInstance()->MockGetDeviceAttr();
|
||||||
}
|
}
|
||||||
void AppManagerTestTool::MockGetMediaInfo(void)
|
void AppManagerTestTool::MockGetMediaInfo(void)
|
||||||
{
|
{
|
||||||
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) {
|
||||||
LogError("vMock error.\n");
|
EXPECT_CALL(*mock.get(), GetMediaInfoTrace(_))
|
||||||
return;
|
.Times(ONLY_BE_CALLED_ONCE)
|
||||||
|
.WillOnce(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
}
|
}
|
||||||
EXPECT_CALL(*mock.get(), GetMediaInfoTrace(_))
|
|
||||||
.Times(ONLY_BE_CALLED_ONCE)
|
|
||||||
.WillOnce(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
|
||||||
ServersMock::GetInstance()->MockGetMediaInfo();
|
ServersMock::GetInstance()->MockGetMediaInfo();
|
||||||
}
|
}
|
||||||
void AppManagerTestTool::MockGetSdCardInfo(void)
|
void AppManagerTestTool::MockGetSdCardInfo(void)
|
||||||
{
|
{
|
||||||
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) {
|
||||||
LogError("vMock error.\n");
|
EXPECT_CALL(*mock.get(), GetSdCardInfoTrace(_))
|
||||||
return;
|
.Times(ONLY_BE_CALLED_ONCE)
|
||||||
|
.WillOnce(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
}
|
}
|
||||||
EXPECT_CALL(*mock.get(), GetSdCardInfoTrace(_))
|
|
||||||
.Times(ONLY_BE_CALLED_ONCE)
|
|
||||||
.WillOnce(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
|
||||||
ServersMock::GetInstance()->MockGetSdCardInfo();
|
ServersMock::GetInstance()->MockGetSdCardInfo();
|
||||||
}
|
}
|
||||||
void AppManagerTestTool::MockGetBatteryInfo(void)
|
void AppManagerTestTool::MockGetBatteryInfo(void)
|
||||||
{
|
{
|
||||||
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) {
|
||||||
LogError("vMock error.\n");
|
EXPECT_CALL(*mock.get(), GetBatteryInfoTrace(_))
|
||||||
return;
|
.Times(ONLY_BE_CALLED_ONCE)
|
||||||
|
.WillOnce(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
}
|
}
|
||||||
EXPECT_CALL(*mock.get(), GetBatteryInfoTrace(_))
|
|
||||||
.Times(ONLY_BE_CALLED_ONCE)
|
|
||||||
.WillOnce(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
|
||||||
ServersMock::GetInstance()->MockGetBatteryInfo();
|
ServersMock::GetInstance()->MockGetBatteryInfo();
|
||||||
}
|
}
|
||||||
void AppManagerTestTool::MockSetDateTime(void)
|
void AppManagerTestTool::MockSetDateTime(void)
|
||||||
{
|
{
|
||||||
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) {
|
||||||
LogError("vMock error.\n");
|
EXPECT_CALL(*mock.get(), SetDateTimeTrace(_))
|
||||||
return;
|
.Times(ONLY_BE_CALLED_ONCE)
|
||||||
|
.WillOnce(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
}
|
}
|
||||||
EXPECT_CALL(*mock.get(), SetDateTimeTrace(_))
|
|
||||||
.Times(ONLY_BE_CALLED_ONCE)
|
|
||||||
.WillOnce(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
|
||||||
ServersMock::GetInstance()->MockSetDateTime();
|
ServersMock::GetInstance()->MockSetDateTime();
|
||||||
}
|
}
|
||||||
void AppManagerTestTool::MockSetTimeZone(void)
|
void AppManagerTestTool::MockSetTimeZone(void)
|
||||||
{
|
{
|
||||||
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) {
|
||||||
LogError("vMock error.\n");
|
EXPECT_CALL(*mock.get(), SetTimeZoneTrace(_))
|
||||||
return;
|
.Times(ONLY_BE_CALLED_ONCE)
|
||||||
|
.WillOnce(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
}
|
}
|
||||||
EXPECT_CALL(*mock.get(), SetDateTimeTrace(_))
|
|
||||||
.Times(ONLY_BE_CALLED_ONCE)
|
|
||||||
.WillOnce(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
|
||||||
ServersMock::GetInstance()->MockSetTimeZone();
|
ServersMock::GetInstance()->MockSetTimeZone();
|
||||||
}
|
}
|
||||||
void AppManagerTestTool::MockUploadFiles(void)
|
void AppManagerTestTool::MockUploadFiles(void)
|
||||||
{
|
{
|
||||||
//
|
std::shared_ptr<AppMonitorMock> mock = std::dynamic_pointer_cast<AppMonitorMock>(mAppMonitorMock);
|
||||||
|
if (mock) {
|
||||||
|
EXPECT_CALL(*mock.get(), UploadFileTrace(_))
|
||||||
|
.Times(ONLY_BE_CALLED_ONCE)
|
||||||
|
.WillOnce(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
|
}
|
||||||
ServersMock::GetInstance()->MockUploadFiles();
|
ServersMock::GetInstance()->MockUploadFiles();
|
||||||
}
|
}
|
||||||
void AppManagerTestTool::AppManagerMockInit(std::shared_ptr<IAppManager> &vMock)
|
void AppManagerTestTool::AppManagerMockInit(std::shared_ptr<IAppManager> &vMock)
|
||||||
|
@ -125,7 +123,8 @@ void AppManagerTestTool::AppManagerMockInit(std::shared_ptr<IAppManager> &vMock)
|
||||||
}
|
}
|
||||||
auto getAppMonitor = [=](std::shared_ptr<VAppMonitor> &monitor) {
|
auto getAppMonitor = [=](std::shared_ptr<VAppMonitor> &monitor) {
|
||||||
LogInfo("mAppMonitorMock get.\n");
|
LogInfo("mAppMonitorMock get.\n");
|
||||||
mAppMonitorMock = std::dynamic_pointer_cast<AppMonitorMock>(monitor);
|
// mAppMonitorMock = std::dynamic_pointer_cast<AppMonitorMock>(monitor);
|
||||||
|
mAppMonitorMock = monitor;
|
||||||
AppManagerTestTool::AppMonitorInit(mAppMonitorMock);
|
AppManagerTestTool::AppMonitorInit(mAppMonitorMock);
|
||||||
};
|
};
|
||||||
EXPECT_CALL(*mock.get(), SetAppMonitorTrace(_))
|
EXPECT_CALL(*mock.get(), SetAppMonitorTrace(_))
|
||||||
|
@ -134,27 +133,32 @@ void AppManagerTestTool::AppManagerMockInit(std::shared_ptr<IAppManager> &vMock)
|
||||||
}
|
}
|
||||||
std::shared_ptr<VAppMonitor> AppManagerTestTool::MakeMonitorMock(void)
|
std::shared_ptr<VAppMonitor> AppManagerTestTool::MakeMonitorMock(void)
|
||||||
{
|
{
|
||||||
auto monitor = std::make_shared<AppMonitorMock>();
|
class Monitor : public AppMonitorMock, public AppMonitorTest
|
||||||
EXPECT_CALL(*monitor.get(), GetProductInfoTrace(_))
|
{
|
||||||
.WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
public:
|
||||||
EXPECT_CALL(*monitor.get(), GetDeviceAttrTrace(_))
|
Monitor() = default;
|
||||||
.WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
virtual ~Monitor() = default;
|
||||||
EXPECT_CALL(*monitor.get(), GetMediaInfoTrace(_))
|
};
|
||||||
.WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
std::shared_ptr<VAppMonitor> monitor = std::make_shared<Monitor>();
|
||||||
EXPECT_CALL(*monitor.get(), GetSdCardInfoTrace(_))
|
// auto result = std::dynamic_pointer_cast<VAppMonitor>(monitor);
|
||||||
.WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
|
||||||
EXPECT_CALL(*monitor.get(), GetBatteryInfoTrace(_))
|
|
||||||
.WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
|
||||||
EXPECT_CALL(*monitor.get(), SetDateTimeTrace(_))
|
|
||||||
.WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
|
||||||
EXPECT_CALL(*monitor.get(), UploadFileTrace(_))
|
|
||||||
.WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
|
||||||
return monitor;
|
return monitor;
|
||||||
}
|
}
|
||||||
void AppManagerTestTool::AppMonitorInit(std::shared_ptr<VAppMonitor> &vMock)
|
void AppManagerTestTool::AppMonitorInit(std::shared_ptr<VAppMonitor> &vMock)
|
||||||
{
|
{
|
||||||
std::shared_ptr<AppMonitorMock> mock = std::dynamic_pointer_cast<AppMonitorMock>(vMock);
|
std::shared_ptr<AppMonitorMock> mock = std::dynamic_pointer_cast<AppMonitorMock>(vMock);
|
||||||
if (mock) {
|
if (mock) {
|
||||||
|
EXPECT_CALL(*mock.get(), GetProductInfoTrace(_))
|
||||||
|
.WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
|
EXPECT_CALL(*mock.get(), GetDeviceAttrTrace(_))
|
||||||
|
.WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
|
EXPECT_CALL(*mock.get(), GetMediaInfoTrace(_))
|
||||||
|
.WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
|
EXPECT_CALL(*mock.get(), GetSdCardInfoTrace(_))
|
||||||
|
.WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
|
EXPECT_CALL(*mock.get(), GetBatteryInfoTrace(_))
|
||||||
|
.WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
|
EXPECT_CALL(*mock.get(), SetDateTimeTrace(_))
|
||||||
|
.WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
EXPECT_CALL(*mock.get(), UploadFileTrace(_))
|
EXPECT_CALL(*mock.get(), UploadFileTrace(_))
|
||||||
.WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
.WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,9 +23,9 @@ StatusCode AppMonitorTest::GetProductInfo(AppGetProductInfo ¶m)
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
StatusCode AppMonitorTest::GetProductInfoTrace(AppGetProductInfo ¶m)
|
StatusCode AppMonitorTrace::GetProductInfoTrace(AppGetProductInfo ¶m)
|
||||||
{
|
{
|
||||||
LogInfo("AppMonitorTest::GetProductInfoTrace\n");
|
LogInfo("AppMonitorTrace::GetProductInfoTrace\n");
|
||||||
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
}
|
}
|
||||||
StatusCode AppMonitorTest::GetDeviceAttr(AppGetDeviceAttr ¶m)
|
StatusCode AppMonitorTest::GetDeviceAttr(AppGetDeviceAttr ¶m)
|
||||||
|
@ -37,9 +37,9 @@ StatusCode AppMonitorTest::GetDeviceAttr(AppGetDeviceAttr ¶m)
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
StatusCode AppMonitorTest::GetDeviceAttrTrace(AppGetDeviceAttr ¶m)
|
StatusCode AppMonitorTrace::GetDeviceAttrTrace(AppGetDeviceAttr ¶m)
|
||||||
{
|
{
|
||||||
LogInfo("AppMonitorTest::GetDeviceAttrTrace\n");
|
LogInfo("AppMonitorTrace::GetDeviceAttrTrace\n");
|
||||||
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
}
|
}
|
||||||
StatusCode AppMonitorTest::GetMediaInfo(AppGetMeidaInfo ¶m)
|
StatusCode AppMonitorTest::GetMediaInfo(AppGetMeidaInfo ¶m)
|
||||||
|
@ -51,9 +51,9 @@ StatusCode AppMonitorTest::GetMediaInfo(AppGetMeidaInfo ¶m)
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
StatusCode AppMonitorTest::GetMediaInfoTrace(AppGetMeidaInfo ¶m)
|
StatusCode AppMonitorTrace::GetMediaInfoTrace(AppGetMeidaInfo ¶m)
|
||||||
{
|
{
|
||||||
LogInfo("AppMonitorTest::GetMediaInfoTrace\n");
|
LogInfo("AppMonitorTrace::GetMediaInfoTrace\n");
|
||||||
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
}
|
}
|
||||||
StatusCode AppMonitorTest::GetSdCardInfo(AppGetSdCardInfo ¶m)
|
StatusCode AppMonitorTest::GetSdCardInfo(AppGetSdCardInfo ¶m)
|
||||||
|
@ -65,9 +65,9 @@ StatusCode AppMonitorTest::GetSdCardInfo(AppGetSdCardInfo ¶m)
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
StatusCode AppMonitorTest::GetSdCardInfoTrace(AppGetSdCardInfo ¶m)
|
StatusCode AppMonitorTrace::GetSdCardInfoTrace(AppGetSdCardInfo ¶m)
|
||||||
{
|
{
|
||||||
LogInfo("AppMonitorTest::GetSdCardInfoTrace\n");
|
LogInfo("AppMonitorTrace::GetSdCardInfoTrace\n");
|
||||||
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
}
|
}
|
||||||
StatusCode AppMonitorTest::GetBatteryInfo(AppGetBatteryInfo ¶m)
|
StatusCode AppMonitorTest::GetBatteryInfo(AppGetBatteryInfo ¶m)
|
||||||
|
@ -79,9 +79,9 @@ StatusCode AppMonitorTest::GetBatteryInfo(AppGetBatteryInfo ¶m)
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
StatusCode AppMonitorTest::GetBatteryInfoTrace(AppGetBatteryInfo ¶m)
|
StatusCode AppMonitorTrace::GetBatteryInfoTrace(AppGetBatteryInfo ¶m)
|
||||||
{
|
{
|
||||||
LogInfo("AppMonitorTest::GetBatteryInfoTrace\n");
|
LogInfo("AppMonitorTrace::GetBatteryInfoTrace\n");
|
||||||
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
}
|
}
|
||||||
StatusCode AppMonitorTest::SetDateTime(AppSetDateTime ¶m)
|
StatusCode AppMonitorTest::SetDateTime(AppSetDateTime ¶m)
|
||||||
|
@ -99,9 +99,9 @@ StatusCode AppMonitorTest::SetDateTime(AppSetDateTime ¶m)
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
StatusCode AppMonitorTest::SetDateTimeTrace(AppSetDateTime ¶m)
|
StatusCode AppMonitorTrace::SetDateTimeTrace(AppSetDateTime ¶m)
|
||||||
{
|
{
|
||||||
LogInfo("AppMonitorTest::SetDateTimeTrace\n");
|
LogInfo("AppMonitorTrace::SetDateTimeTrace\n");
|
||||||
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
}
|
}
|
||||||
StatusCode AppMonitorTest::SetTimeZone(const unsigned int &zone)
|
StatusCode AppMonitorTest::SetTimeZone(const unsigned int &zone)
|
||||||
|
@ -113,9 +113,9 @@ StatusCode AppMonitorTest::SetTimeZone(const unsigned int &zone)
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
StatusCode AppMonitorTest::SetTimeZoneTrace(const unsigned int &zone)
|
StatusCode AppMonitorTrace::SetTimeZoneTrace(const unsigned int &zone)
|
||||||
{
|
{
|
||||||
LogInfo("AppMonitorTest::SetTimeZoneTrace\n");
|
LogInfo("AppMonitorTrace::SetTimeZoneTrace\n");
|
||||||
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
}
|
}
|
||||||
StatusCode AppMonitorTest::UploadFile(AppUploadFile ¶m)
|
StatusCode AppMonitorTest::UploadFile(AppUploadFile ¶m)
|
||||||
|
@ -127,8 +127,8 @@ StatusCode AppMonitorTest::UploadFile(AppUploadFile ¶m)
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
StatusCode AppMonitorTest::UploadFileTrace(AppUploadFile ¶m)
|
StatusCode AppMonitorTrace::UploadFileTrace(AppUploadFile ¶m)
|
||||||
{
|
{
|
||||||
LogInfo("AppMonitorTest::UploadFileTrace\n");
|
LogInfo("AppMonitorTrace::UploadFileTrace\n");
|
||||||
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
}
|
}
|
|
@ -16,7 +16,23 @@
|
||||||
#define APP_MONITOR_MOCK_H
|
#define APP_MONITOR_MOCK_H
|
||||||
#include "GtestUsing.h"
|
#include "GtestUsing.h"
|
||||||
#include "IAppManager.h"
|
#include "IAppManager.h"
|
||||||
class AppMonitorTest : public VAppMonitor
|
class AppMonitorTrace
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AppMonitorTrace() = default;
|
||||||
|
virtual ~AppMonitorTrace() = default;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual StatusCode GetProductInfoTrace(AppGetProductInfo ¶m);
|
||||||
|
virtual StatusCode GetDeviceAttrTrace(AppGetDeviceAttr ¶m);
|
||||||
|
virtual StatusCode GetMediaInfoTrace(AppGetMeidaInfo ¶m);
|
||||||
|
virtual StatusCode GetSdCardInfoTrace(AppGetSdCardInfo ¶m);
|
||||||
|
virtual StatusCode GetBatteryInfoTrace(AppGetBatteryInfo ¶m);
|
||||||
|
virtual StatusCode SetDateTimeTrace(AppSetDateTime ¶m);
|
||||||
|
virtual StatusCode SetTimeZoneTrace(const unsigned int &zone);
|
||||||
|
virtual StatusCode UploadFileTrace(AppUploadFile ¶m);
|
||||||
|
};
|
||||||
|
class AppMonitorTest : public VAppMonitor, virtual public AppMonitorTrace
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AppMonitorTest() = default;
|
AppMonitorTest() = default;
|
||||||
|
@ -29,18 +45,8 @@ public:
|
||||||
StatusCode SetDateTime(AppSetDateTime ¶m) override;
|
StatusCode SetDateTime(AppSetDateTime ¶m) override;
|
||||||
StatusCode SetTimeZone(const unsigned int &zone) override;
|
StatusCode SetTimeZone(const unsigned int &zone) override;
|
||||||
StatusCode UploadFile(AppUploadFile ¶m) override;
|
StatusCode UploadFile(AppUploadFile ¶m) override;
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual StatusCode GetProductInfoTrace(AppGetProductInfo ¶m);
|
|
||||||
virtual StatusCode GetDeviceAttrTrace(AppGetDeviceAttr ¶m);
|
|
||||||
virtual StatusCode GetMediaInfoTrace(AppGetMeidaInfo ¶m);
|
|
||||||
virtual StatusCode GetSdCardInfoTrace(AppGetSdCardInfo ¶m);
|
|
||||||
virtual StatusCode GetBatteryInfoTrace(AppGetBatteryInfo ¶m);
|
|
||||||
virtual StatusCode SetDateTimeTrace(AppSetDateTime ¶m);
|
|
||||||
virtual StatusCode SetTimeZoneTrace(const unsigned int &zone);
|
|
||||||
virtual StatusCode UploadFileTrace(AppUploadFile ¶m);
|
|
||||||
};
|
};
|
||||||
class AppMonitorMock : public AppMonitorTest
|
class AppMonitorMock : virtual public AppMonitorTrace
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AppMonitorMock() = default;
|
AppMonitorMock() = default;
|
||||||
|
@ -51,6 +57,7 @@ public:
|
||||||
MOCK_METHOD1(GetSdCardInfoTrace, StatusCode(AppGetSdCardInfo &));
|
MOCK_METHOD1(GetSdCardInfoTrace, StatusCode(AppGetSdCardInfo &));
|
||||||
MOCK_METHOD1(GetBatteryInfoTrace, StatusCode(AppGetBatteryInfo &));
|
MOCK_METHOD1(GetBatteryInfoTrace, StatusCode(AppGetBatteryInfo &));
|
||||||
MOCK_METHOD1(SetDateTimeTrace, StatusCode(AppSetDateTime &));
|
MOCK_METHOD1(SetDateTimeTrace, StatusCode(AppSetDateTime &));
|
||||||
|
MOCK_METHOD1(SetTimeZoneTrace, StatusCode(const unsigned int &));
|
||||||
MOCK_METHOD1(UploadFileTrace, StatusCode(AppUploadFile &));
|
MOCK_METHOD1(UploadFileTrace, StatusCode(AppUploadFile &));
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
Loading…
Reference in New Issue
Block a user