Backup key manager code.
This commit is contained in:
parent
353aa7d63e
commit
be566f10db
|
@ -7,9 +7,10 @@ set(HUNTTING_MAIN_INCLUDE_PATH "${HUNTTING_MAIN_INCLUDE_PATH};${MIDDLEWARE_S
|
|||
set(HUNTTING_MAIN_INCLUDE_PATH "${HUNTTING_MAIN_INCLUDE_PATH};${MIDDLEWARE_SOURCE_PATH}/FilesManager/include")
|
||||
set(HUNTTING_MAIN_INCLUDE_PATH "${HUNTTING_MAIN_INCLUDE_PATH};${MIDDLEWARE_SOURCE_PATH}/StorageManager/include")
|
||||
set(HUNTTING_MAIN_INCLUDE_PATH "${HUNTTING_MAIN_INCLUDE_PATH};${MIDDLEWARE_SOURCE_PATH}/HuntingUpgrade/include")
|
||||
set(HUNTTING_MAIN_INCLUDE_PATH "${HUNTTING_MAIN_INCLUDE_PATH};${MIDDLEWARE_SOURCE_PATH}/DeviceManager/include")
|
||||
set(HUNTTING_MAIN_INCLUDE_PATH "${HUNTTING_MAIN_INCLUDE_PATH};${MIDDLEWARE_SOURCE_PATH}/IpcConfig/include")
|
||||
set(HUNTTING_MAIN_INCLUDE_PATH "${HUNTTING_MAIN_INCLUDE_PATH};${UTILS_SOURCE_PATH}/StatusCode/include")
|
||||
set(HUNTTING_MAIN_INCLUDE_PATH "${HUNTTING_MAIN_INCLUDE_PATH};${UTILS_SOURCE_PATH}/Log/include")
|
||||
set(HUNTTING_MAIN_INCLUDE_PATH "${HUNTTING_MAIN_INCLUDE_PATH};${HAL_SOURCE_PATH}/include")
|
||||
|
||||
set(HUNTTING_LINK_LIB McuManager MissionManager StateMachine AppManager FilesManager StorageManager HuntingUpgrade IpcConfig StatusCode Log Hal pthread dl)
|
||||
set(HUNTTING_LINK_LIB McuManager MissionManager StateMachine AppManager FilesManager StorageManager HuntingUpgrade IpcConfig DeviceManager StatusCode Log Hal pthread dl)
|
|
@ -14,6 +14,7 @@
|
|||
*/
|
||||
#include "MainThread.h"
|
||||
#include "IAppManager.h"
|
||||
#include "IDeviceManager.h"
|
||||
#include "IFilesManager.h"
|
||||
#include "IHalCpp.h"
|
||||
#include "IHuntingUpgrade.h"
|
||||
|
@ -65,6 +66,7 @@ StatusCode MainThread::Init(void)
|
|||
mMainThreadRuning = true;
|
||||
CreateAllModules();
|
||||
IHalCpp::GetInstance()->Init();
|
||||
IDeviceManager::GetInstance()->Init();
|
||||
IMcuManager::GetInstance()->Init();
|
||||
IStorageManager::GetInstance()->Init();
|
||||
IIpcConfig::GetInstance()->Init();
|
||||
|
@ -79,6 +81,7 @@ StatusCode MainThread::UnInit(void)
|
|||
IIpcConfig::GetInstance()->UnInit();
|
||||
IStorageManager::GetInstance()->UnInit();
|
||||
IMcuManager::GetInstance()->UnInit();
|
||||
IDeviceManager::GetInstance()->UnInit();
|
||||
IHalCpp::GetInstance()->UnInit();
|
||||
DestoryAllModules();
|
||||
ILogUnInit();
|
||||
|
@ -96,6 +99,7 @@ StatusCode MainThread::CreateAllModules(void)
|
|||
CreateMediaManagerModule();
|
||||
CreateHuntingUpgradeModule();
|
||||
CreateIpcConfigModule();
|
||||
CreateDeviceManagerModule();
|
||||
return CreateStatusCode(STATUS_CODE_OK);
|
||||
}
|
||||
void MainThread::DestoryAllModules(void)
|
||||
|
@ -110,6 +114,7 @@ void MainThread::DestoryAllModules(void)
|
|||
DestroyMcuManager();
|
||||
DestroyHalCppModule();
|
||||
DestroyIpcConfigModule();
|
||||
DestroyDeviceManagerModule();
|
||||
}
|
||||
void MainThread::ResetAllPtrMaker(void)
|
||||
{
|
||||
|
|
|
@ -21,26 +21,37 @@ camera_report_event::camera_report_event(const std::string &fileName, const Came
|
|||
}
|
||||
void VKeyHalMonitor::KeyEventHappened(const std::string &keyName, const VirtualKeyEvent &event)
|
||||
{
|
||||
LogWarning("STATUS_CODE_VIRTUAL_FUNCTION.\n");
|
||||
}
|
||||
void VKeyHal::CheckKeyStatus(void)
|
||||
{
|
||||
LogWarning("STATUS_CODE_VIRTUAL_FUNCTION.\n");
|
||||
}
|
||||
void VKeyHal::GetHoldPressingTimeMs(long int &holdTimeMs, VirtualKeyEvent &event)
|
||||
{
|
||||
LogWarning("STATUS_CODE_VIRTUAL_FUNCTION.\n");
|
||||
}
|
||||
void VKeyHal::SetKeyMonitor(std::shared_ptr<VKeyHalMonitor> &monitor)
|
||||
{
|
||||
LogWarning("STATUS_CODE_VIRTUAL_FUNCTION.\n");
|
||||
}
|
||||
// std::string VKeyHal::GetKeyHalName(void)
|
||||
// {
|
||||
// return "undefined";
|
||||
// }
|
||||
StatusCode VWifiHal::OpenApMode(void)
|
||||
{
|
||||
LogWarning("STATUS_CODE_VIRTUAL_FUNCTION.\n");
|
||||
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||
}
|
||||
StatusCode VWifiHal::CloseApMode(void)
|
||||
{
|
||||
LogWarning("STATUS_CODE_VIRTUAL_FUNCTION.\n");
|
||||
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||
}
|
||||
void VCameraHalMonitor::ReportEvent(const CameraReportEvent &event)
|
||||
{
|
||||
LogWarning("STATUS_CODE_VIRTUAL_FUNCTION.\n");
|
||||
}
|
||||
void VCameraHal::SetCameraMonitor(std::shared_ptr<VCameraHalMonitor> &monitor)
|
||||
{
|
||||
|
@ -48,6 +59,7 @@ void VCameraHal::SetCameraMonitor(std::shared_ptr<VCameraHalMonitor> &monitor)
|
|||
}
|
||||
void VSdCardHalMonitor::ReportEvent(const SdCardHalStatus &status)
|
||||
{
|
||||
LogWarning("STATUS_CODE_VIRTUAL_FUNCTION.\n");
|
||||
}
|
||||
std::shared_ptr<IHalCpp> &IHalCpp::GetInstance(std::shared_ptr<IHalCpp> *impl)
|
||||
{
|
||||
|
@ -75,6 +87,7 @@ SdCardHalStatus VSdCardHal::GetSdCardStatus(void)
|
|||
StatusCode VSdCardHal::GetCapacity(unsigned long long &totalSizeMB, unsigned long long &freeSizeMB,
|
||||
unsigned long long &usedSizeMB)
|
||||
{
|
||||
LogWarning("STATUS_CODE_VIRTUAL_FUNCTION.\n");
|
||||
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||
}
|
||||
StatusCode IHalCpp::Init(void)
|
||||
|
|
|
@ -63,6 +63,7 @@ public:
|
|||
virtual void CheckKeyStatus(void);
|
||||
virtual void GetHoldPressingTimeMs(long int &holdTimeMs, VirtualKeyEvent &event);
|
||||
virtual void SetKeyMonitor(std::shared_ptr<VKeyHalMonitor> &monitor);
|
||||
// virtual std::string GetKeyHalName(void);
|
||||
};
|
||||
class VLedHal
|
||||
{
|
||||
|
|
|
@ -58,6 +58,19 @@ StatusCode HalCpp::GetSdCardHal(std::shared_ptr<VSdCardHal> &sdCard)
|
|||
sdCard = mSdCardHal;
|
||||
return CreateStatusCode(STATUS_CODE_OK);
|
||||
}
|
||||
StatusCode HalCpp::GetAllKeys(std::map<std::string, std::shared_ptr<VKeyHal>> &allKeys)
|
||||
{
|
||||
LogInfo("GetAllKeys\n");
|
||||
for (auto &key : mKeys) {
|
||||
std::shared_ptr<VKeyHal> keyControl = std::dynamic_pointer_cast<VKeyHal>(key);
|
||||
if (nullptr == keyControl) {
|
||||
LogError("keyControl is nullptr\n");
|
||||
continue;
|
||||
}
|
||||
allKeys.insert(std::make_pair(key->GetKeyName(), keyControl));
|
||||
}
|
||||
return CreateStatusCode(STATUS_CODE_OK);
|
||||
}
|
||||
void HalCpp::CheckAllPinVauleThread(void)
|
||||
{
|
||||
// mThreadRuning = true;
|
||||
|
|
|
@ -27,6 +27,7 @@ public:
|
|||
StatusCode UnInit(void) override;
|
||||
StatusCode GetWifiHal(std::shared_ptr<VWifiHal> &wifi) override;
|
||||
StatusCode GetSdCardHal(std::shared_ptr<VSdCardHal> &sdCard) override;
|
||||
StatusCode GetAllKeys(std::map<std::string, std::shared_ptr<VKeyHal>> &allKeys) override;
|
||||
|
||||
private:
|
||||
void CheckAllPinVauleThread(void);
|
||||
|
|
|
@ -62,6 +62,7 @@ void KeyManager::StopTimer(void)
|
|||
}
|
||||
void KeyManager::Timer(void)
|
||||
{
|
||||
LogInfo("Key timer started.\n");
|
||||
mTimerRuning = true;
|
||||
std::map<std::string, std::shared_ptr<VKeyHal>>::iterator iter;
|
||||
while (mTimerRuning) {
|
||||
|
|
|
@ -9,6 +9,8 @@ include_directories(
|
|||
${HUNTTING_MAIN_INCLUDE_PATH}
|
||||
${MIDDLEWARE_SOURCE_PATH}/McuManager/include
|
||||
${MIDDLEWARE_SOURCE_PATH}/McuManager/src
|
||||
${MIDDLEWARE_SOURCE_PATH}/DeviceManager/include
|
||||
${MIDDLEWARE_SOURCE_PATH}/DeviceManager/src
|
||||
${UTILS_SOURCE_PATH}/McuProtocol/include
|
||||
${UTILS_SOURCE_PATH}/UartDevice/include
|
||||
${UTILS_SOURCE_PATH}/LedControl/include
|
||||
|
@ -16,6 +18,7 @@ include_directories(
|
|||
${TEST_SOURCE_PATH}/application/MissionManager/tool/include
|
||||
${TEST_SOURCE_PATH}/middleware/McuManager/tool/include
|
||||
${TEST_SOURCE_PATH}/middleware/AppManager/tool/include
|
||||
${TEST_SOURCE_PATH}/middleware/DeviceManager/tool/include
|
||||
${TEST_SOURCE_PATH}/utils/LinuxApiMock/include
|
||||
${TEST_SOURCE_PATH}/utils/TestManager/include
|
||||
${TEST_SOURCE_PATH}/utils/McuProtocol/tool/include
|
||||
|
@ -38,7 +41,8 @@ endif()
|
|||
|
||||
set(TARGET_NAME HuntingCameraTest)
|
||||
add_executable(${TARGET_NAME} ${SRC_FILES_MAIN} ${SRC_FILES})
|
||||
target_link_libraries(${TARGET_NAME} HuntingMainLib MissionManagerTestTool McuManagerTestTool McuAskBaseTestTool AppManagerTestTool HalTestTool TestManager gtest gmock pthread)
|
||||
target_link_libraries(${TARGET_NAME} HuntingMainLib MissionManagerTestTool McuManagerTestTool McuAskBaseTestTool
|
||||
AppManagerTestTool HalTestTool DeviceManagerTestTool TestManager gtest gmock pthread)
|
||||
if(${TEST_COVERAGE} MATCHES "true")
|
||||
target_link_libraries(${TARGET_NAME} gcov)
|
||||
endif()
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* 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 "HuntingCameraTest.h"
|
||||
#include "ILog.h"
|
||||
#include "MainThread.h"
|
||||
#include "McuManagerTestTool.h"
|
||||
#include "MissionManagerTestTool.h"
|
||||
#include "TestManager.h"
|
||||
#include <thread>
|
||||
namespace DeviceManager_Mock_Test
|
||||
{
|
||||
/**
|
||||
* @brief Construct a new test f object
|
||||
* ../output_files/test/bin/HuntingCameraTest
|
||||
* --gtest_filter=HuntingCameraTest.HS_INTEGRATION_HunttingCamera_EXAMPLE_KeyControl
|
||||
*/
|
||||
TEST_F(HuntingCameraTest, HS_INTEGRATION_HunttingCamera_EXAMPLE_KeyControl)
|
||||
{
|
||||
MainThread::GetInstance()->Init();
|
||||
TestManager::ResetTimeOut(1000 * 3);
|
||||
HalTestTool::MockKeyClick("reset", 1000); // Simulate pressing a button.
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
MainThread::GetInstance()->Runing();
|
||||
}
|
||||
} // namespace DeviceManager_Mock_Test
|
|
@ -17,6 +17,7 @@
|
|||
#include "ILog.h"
|
||||
#include "MainThread.h"
|
||||
#include <thread>
|
||||
const char *KEY_RESET = "reset";
|
||||
void MainThreadTest::CustomizationInit(void)
|
||||
{
|
||||
// Do nothing here to make sure test tool work.
|
||||
|
@ -42,6 +43,7 @@ void HuntingCameraTest::SetUp()
|
|||
std::shared_ptr<MainThread> mainThread = std::make_shared<MainThreadTest>();
|
||||
MainThread::GetInstance(&mainThread);
|
||||
HalTestTool::Init();
|
||||
CreateAllKeysMcok();
|
||||
AppManagerTestTool::Init();
|
||||
MissionManagerTestTool::Init();
|
||||
mLinuxTest = LinuxTest::CreateLinuxTest();
|
||||
|
@ -50,6 +52,7 @@ void HuntingCameraTest::SetUp()
|
|||
LinuxApiMock::GetInstance()->Init();
|
||||
McuManagerTestTool::Init(mLinuxTest);
|
||||
HalTestTool::InitSdCardHal(mLinuxTest);
|
||||
DeviceManagerTestTool::Init();
|
||||
TestManager::Init();
|
||||
}
|
||||
void HuntingCameraTest::TearDown()
|
||||
|
@ -66,7 +69,9 @@ void HuntingCameraTest::TearDown()
|
|||
MainThread::GetInstance()->UnInit();
|
||||
std::shared_ptr<MainThread> mainThread = std::make_shared<MainThread>();
|
||||
MainThread::GetInstance(&mainThread);
|
||||
DeviceManagerTestTool::UnInit();
|
||||
DestroyAllCamerasMock();
|
||||
DestroyAllKeysMock();
|
||||
}
|
||||
void HuntingCameraTest::CreateAllCamerasMcok(void)
|
||||
{
|
||||
|
@ -77,3 +82,17 @@ void HuntingCameraTest::DestroyAllCamerasMock(void)
|
|||
{
|
||||
mAllCamerasMock.clear();
|
||||
}
|
||||
void HuntingCameraTest::CreateAllKeysMcok(void)
|
||||
{
|
||||
std::shared_ptr<VKeyHal> key = HalTestTool::MakeKeyHalTest(KEY_RESET);
|
||||
mAllKeysMock[KEY_RESET] = key;
|
||||
// std::shared_ptr<VLedHal> led = HalTestTool::MakeLedHalTest(LED_TEST);
|
||||
// mAllLedsMock[LED_TEST] = led;
|
||||
HalTestTool::SetAllKeysResult(mAllKeysMock);
|
||||
}
|
||||
void HuntingCameraTest::DestroyAllKeysMock(void)
|
||||
{
|
||||
|
||||
mAllKeysMock.clear();
|
||||
// mAllLedsMock.clear();
|
||||
}
|
|
@ -15,6 +15,7 @@
|
|||
#ifndef HUNTING_CAMERA_TEST_H
|
||||
#define HUNTING_CAMERA_TEST_H
|
||||
#include "AppManagerTestTool.h"
|
||||
#include "DeviceManagerTestTool.h"
|
||||
#include "GtestUsing.h"
|
||||
#include "HalTestTool.h"
|
||||
#include "LinuxApiMock.h"
|
||||
|
@ -35,7 +36,8 @@ class HuntingCameraTest : public testing::Test,
|
|||
public MissionManagerTestTool,
|
||||
public McuManagerTestTool,
|
||||
public AppManagerTestTool,
|
||||
public HalTestTool
|
||||
public DeviceManagerTestTool,
|
||||
virtual public HalTestTool
|
||||
{
|
||||
public:
|
||||
HuntingCameraTest();
|
||||
|
@ -48,10 +50,13 @@ public:
|
|||
private:
|
||||
void CreateAllCamerasMcok(void);
|
||||
void DestroyAllCamerasMock(void);
|
||||
void CreateAllKeysMcok(void);
|
||||
void DestroyAllKeysMock(void);
|
||||
|
||||
protected:
|
||||
std::shared_ptr<LinuxTest> mLinuxTest;
|
||||
std::map<CameraType, std::shared_ptr<VCameraHal>> mAllCamerasMock;
|
||||
std::map<std::string, std::shared_ptr<VKeyHal>> mAllKeysMock;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -59,3 +59,14 @@ StatusCode HalMakePtrTest::CreateSdCardHal(std::shared_ptr<VSdCardHal> &impl)
|
|||
impl = mSdCardHalMock;
|
||||
return CreateStatusCode(STATUS_CODE_OK);
|
||||
}
|
||||
StatusCode HalMakePtrTest::CreateAllKeyHal(std::vector<std::shared_ptr<VKeyControl>> &keys)
|
||||
{
|
||||
if (mKeysMock.size() > 0) {
|
||||
LogInfo("Create mock keys.size = %d\n", mKeysMock.size());
|
||||
keys = mKeysMock;
|
||||
}
|
||||
else {
|
||||
HalMakePtr::CreateAllKeyHal(keys);
|
||||
}
|
||||
return CreateStatusCode(STATUS_CODE_OK);
|
||||
}
|
|
@ -28,9 +28,11 @@ public:
|
|||
virtual ~HalMakePtrTest();
|
||||
StatusCode CreateHalSharePtr(std::shared_ptr<IHalCpp> &impl) override;
|
||||
StatusCode CreateSdCardHal(std::shared_ptr<VSdCardHal> &impl) override;
|
||||
StatusCode CreateAllKeyHal(std::vector<std::shared_ptr<VKeyControl>> &keys) override;
|
||||
|
||||
public:
|
||||
std::shared_ptr<HalCppMock> mHalCppMock;
|
||||
std::shared_ptr<SdCardHalMock> mSdCardHalMock;
|
||||
std::vector<std::shared_ptr<VKeyControl>> mKeysMock;
|
||||
};
|
||||
#endif
|
|
@ -199,9 +199,26 @@ void HalTestTool::SetAllKeysResult(std::shared_ptr<IHalCpp> &vMock,
|
|||
LogError("vMock error.\n");
|
||||
return;
|
||||
}
|
||||
EXPECT_CALL(*mock.get(), GetAllKeysTrace(_))
|
||||
.WillRepeatedly(DoAll(SetArgReferee<0>(allKeys), Return(CreateStatusCode(STATUS_CODE_OK))));
|
||||
InitAllKeysMock(allKeys);
|
||||
// EXPECT_CALL(*mock.get(), GetAllKeysTrace(_))
|
||||
// .WillRepeatedly(DoAll(SetArgReferee<0>(allKeys), Return(CreateStatusCode(STATUS_CODE_OK))));
|
||||
// InitAllKeysMock(allKeys);
|
||||
std::vector<std::shared_ptr<VKeyControl>> keysMock;
|
||||
std::shared_ptr<HalMakePtr> impl = HalMakePtr::GetInstance();
|
||||
std::shared_ptr<HalMakePtrTest> test = std::dynamic_pointer_cast<HalMakePtrTest>(impl);
|
||||
if (test) {
|
||||
for (auto &key : allKeys) {
|
||||
std::shared_ptr<KeyControlMock> keyMock = std::dynamic_pointer_cast<KeyControlMock>(key.second);
|
||||
if (keyMock) {
|
||||
keysMock.push_back(keyMock);
|
||||
LogInfo("Create key mock. name = %s\n", keyMock->GetKeyName().c_str());
|
||||
}
|
||||
else {
|
||||
LogWarning("Can't create key mock.\n");
|
||||
}
|
||||
}
|
||||
test->mKeysMock = keysMock;
|
||||
LogInfo("Create all keys mock. size = %d\n", keysMock.size());
|
||||
}
|
||||
}
|
||||
void HalTestTool::SetAllLedsResult(std::shared_ptr<IHalCpp> &vMock,
|
||||
std::map<std::string, std::shared_ptr<VLedHal>> &allLeds)
|
||||
|
|
|
@ -151,14 +151,14 @@ void LinuxTestImpl::ApiUnlock(void)
|
|||
}
|
||||
void LinuxTestImpl::ApiUnlockThread(void)
|
||||
{
|
||||
LogInfo("ApiUnlockThread\n");
|
||||
if (mApiThread.joinable()) {
|
||||
mApiThread.join();
|
||||
}
|
||||
auto api_unlock = [](std::shared_ptr<LinuxTestImpl> test) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(API_LOCK_TIME_MS));
|
||||
test->ApiUnlock();
|
||||
};
|
||||
std::shared_ptr<LinuxTestImpl> test = std::dynamic_pointer_cast<LinuxTestImpl>(LinuxTest::shared_from_this());
|
||||
mApiThread = std::thread(api_unlock, test);
|
||||
// LogInfo("ApiUnlockThread\n");
|
||||
// if (mApiThread.joinable()) {
|
||||
// mApiThread.join();
|
||||
// }
|
||||
// auto api_unlock = [](std::shared_ptr<LinuxTestImpl> test) {
|
||||
// std::this_thread::sleep_for(std::chrono::milliseconds(API_LOCK_TIME_MS));
|
||||
// test->ApiUnlock();
|
||||
// };
|
||||
// std::shared_ptr<LinuxTestImpl> test = std::dynamic_pointer_cast<LinuxTestImpl>(LinuxTest::shared_from_this());
|
||||
// mApiThread = std::thread(api_unlock, test);
|
||||
}
|
|
@ -15,52 +15,60 @@
|
|||
#include "WrapApi.h"
|
||||
#include "LinuxApiMock.h"
|
||||
#include <mutex>
|
||||
static std::mutex gMutex;
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
int __wrap_fx_open(const char *pathname, int flags)
|
||||
{
|
||||
static std::mutex gMutex;
|
||||
std::lock_guard<std::mutex> locker(gMutex);
|
||||
return LinuxApiMock::GetInstance()->fx_open(pathname, flags);
|
||||
}
|
||||
int __wrap_fx_tcgetattr(int fd, struct termios *termios_p)
|
||||
{
|
||||
static std::mutex gMutex;
|
||||
std::lock_guard<std::mutex> locker(gMutex);
|
||||
return LinuxApiMock::GetInstance()->fx_tcgetattr(fd, termios_p);
|
||||
}
|
||||
int __wrap_fx_tcsetattr(int fd, int optional_actions, const struct termios *termios_p)
|
||||
{
|
||||
static std::mutex gMutex;
|
||||
std::lock_guard<std::mutex> locker(gMutex);
|
||||
return LinuxApiMock::GetInstance()->fx_tcsetattr(fd, optional_actions, termios_p);
|
||||
}
|
||||
ssize_t __wrap_fx_write(int fd, const void *buf, size_t count)
|
||||
{
|
||||
static std::mutex gMutex;
|
||||
std::lock_guard<std::mutex> locker(gMutex);
|
||||
return LinuxApiMock::GetInstance()->fx_write(fd, buf, count);
|
||||
}
|
||||
ssize_t __wrap_fx_read(int fd, void *buf, size_t count)
|
||||
{
|
||||
static std::mutex gMutex;
|
||||
std::lock_guard<std::mutex> locker(gMutex);
|
||||
return LinuxApiMock::GetInstance()->fx_read(fd, buf, count);
|
||||
}
|
||||
int __wrap_fx_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
|
||||
{
|
||||
std::lock_guard<std::mutex> locker(gMutex);
|
||||
static std::mutex gMutex;
|
||||
std::lock_guard<std::mutex> locker(gMutex); // TODO: The select function can cause severe blocking here.
|
||||
return LinuxApiMock::GetInstance()->fx_select(nfds, readfds, writefds, exceptfds, timeout);
|
||||
}
|
||||
int __wrap_fx_fstat(int fd, struct stat *statbuf)
|
||||
{
|
||||
static std::mutex gMutex;
|
||||
std::lock_guard<std::mutex> locker(gMutex);
|
||||
return LinuxApiMock::GetInstance()->fx_fstat(fd, statbuf);
|
||||
}
|
||||
int __wrap_fx_access(const char *pathname, int mode)
|
||||
{
|
||||
static std::mutex gMutex;
|
||||
std::lock_guard<std::mutex> locker(gMutex);
|
||||
return LinuxApiMock::GetInstance()->fx_access(pathname, mode);
|
||||
}
|
||||
FILE *__wrap_fx_fopen(const char *pathname, const char *mode)
|
||||
{
|
||||
static std::mutex gMutex;
|
||||
std::lock_guard<std::mutex> locker(gMutex);
|
||||
return LinuxApiMock::GetInstance()->fx_fopen(pathname, mode);
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -86,6 +86,7 @@ void KeyControl::KeyPressingTrigger(const std::string &key)
|
|||
* long press events at the application level.
|
||||
*/
|
||||
}
|
||||
// LogInfo("KeyPressingTrigger: %s, %d", key.c_str(), mPressingTime);
|
||||
if (mPressingTime != KEY_NOT_PRESSING && mPressingTime % KEY_ACTION_HOLD_DWON == 0) {
|
||||
KeyEventTrigger(key, KeyEvent::HOLD_DOWN, mPressingTime);
|
||||
}
|
||||
|
|
|
@ -52,6 +52,8 @@ void NewILog(ILog **object)
|
|||
}
|
||||
void ResetLogImpl(ILog *impl)
|
||||
{
|
||||
// log_instance->free(log_instance);
|
||||
if (log_instance) {
|
||||
log_instance->free(log_instance);
|
||||
}
|
||||
log_instance = impl;
|
||||
}
|
Loading…
Reference in New Issue
Block a user