Fixed:Wrong word.
This commit is contained in:
parent
f0062b96c2
commit
75bd13b7a6
|
@ -1,3 +1,3 @@
|
||||||
add_subdirectory(main)
|
add_subdirectory(main)
|
||||||
add_subdirectory(HunttingCamera)
|
add_subdirectory(HuntingCamera)
|
||||||
add_subdirectory(MissionManager)
|
add_subdirectory(MissionManager)
|
|
@ -1,5 +1,5 @@
|
||||||
include(${CMAKE_SOURCE_DIR_IPCSDK}/build/global_config.cmake)
|
include(${CMAKE_SOURCE_DIR_IPCSDK}/build/global_config.cmake)
|
||||||
include(${APPLICATION_SOURCE_PATH}/HunttingCamera/build/huntting_camera.cmake)
|
include(${APPLICATION_SOURCE_PATH}/HuntingCamera/build/hunting_camera.cmake)
|
||||||
set(EXECUTABLE_OUTPUT_PATH ${EXEC_OUTPUT_PATH})
|
set(EXECUTABLE_OUTPUT_PATH ${EXEC_OUTPUT_PATH})
|
||||||
set(LIBRARY_OUTPUT_PATH ${LIBS_OUTPUT_PATH})
|
set(LIBRARY_OUTPUT_PATH ${LIBS_OUTPUT_PATH})
|
||||||
|
|
||||||
|
@ -19,9 +19,9 @@ aux_source_directory(./src MAIN_SRC_FILE_THIS)
|
||||||
# file(GLOB_RECURSE MAIN_SRC_FILE_THIS src/*.cpp src/*.c)
|
# file(GLOB_RECURSE MAIN_SRC_FILE_THIS src/*.cpp src/*.c)
|
||||||
# set(MAIN_SRC_FILE "${MAIN_SRC_FILE_THIS}" CACHE STRING INTERNAL FORCE)
|
# set(MAIN_SRC_FILE "${MAIN_SRC_FILE_THIS}" CACHE STRING INTERNAL FORCE)
|
||||||
|
|
||||||
set(TARGET_LIB HunttingMainLib)
|
set(TARGET_LIB HuntingMainLib)
|
||||||
add_library(${TARGET_LIB} STATIC ${MAIN_SRC_FILE_THIS})
|
add_library(${TARGET_LIB} STATIC ${MAIN_SRC_FILE_THIS})
|
||||||
set(TARGET_NAME HunttingCamera_x86)
|
set(TARGET_NAME HuntingCamera_x86)
|
||||||
add_executable(${TARGET_NAME} ${SRC_FILES})
|
add_executable(${TARGET_NAME} ${SRC_FILES})
|
||||||
|
|
||||||
target_link_libraries(${TARGET_LIB} ${HUNTTING_LINK_LIB})
|
target_link_libraries(${TARGET_LIB} ${HUNTTING_LINK_LIB})
|
||||||
|
@ -32,7 +32,7 @@ endif()
|
||||||
|
|
||||||
if ("${COMPILE_IMPROVE_SUPPORT}" MATCHES "true")
|
if ("${COMPILE_IMPROVE_SUPPORT}" MATCHES "true")
|
||||||
add_custom_target(
|
add_custom_target(
|
||||||
HunttingCamera_code_check
|
HuntingCamera_code_check
|
||||||
COMMAND ${CLANG_TIDY_EXE}
|
COMMAND ${CLANG_TIDY_EXE}
|
||||||
-checks='${CLANG_TIDY_CHECKS}'
|
-checks='${CLANG_TIDY_CHECKS}'
|
||||||
--header-filter=.*
|
--header-filter=.*
|
||||||
|
@ -41,27 +41,27 @@ add_custom_target(
|
||||||
${MAIN_SRC_FILE_THIS}
|
${MAIN_SRC_FILE_THIS}
|
||||||
${CLANG_TIDY_CONFIG}
|
${CLANG_TIDY_CONFIG}
|
||||||
-p ${PLATFORM_PATH}/cmake-shell
|
-p ${PLATFORM_PATH}/cmake-shell
|
||||||
WORKING_DIRECTORY ${APPLICATION_SOURCE_PATH}/HunttingCamera
|
WORKING_DIRECTORY ${APPLICATION_SOURCE_PATH}/HuntingCamera
|
||||||
)
|
)
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET ${TARGET_NAME}
|
TARGET ${TARGET_NAME}
|
||||||
PRE_BUILD
|
PRE_BUILD
|
||||||
COMMAND make HunttingCamera_code_check
|
COMMAND make HuntingCamera_code_check
|
||||||
WORKING_DIRECTORY ${PLATFORM_PATH}/cmake-shell/
|
WORKING_DIRECTORY ${PLATFORM_PATH}/cmake-shell/
|
||||||
)
|
)
|
||||||
file(GLOB_RECURSE HEADER_FILES *.h)
|
file(GLOB_RECURSE HEADER_FILES *.h)
|
||||||
add_custom_target(
|
add_custom_target(
|
||||||
HunttingCamera_code_format
|
HuntingCamera_code_format
|
||||||
COMMAND ${CLANG_FORMAT_EXE}
|
COMMAND ${CLANG_FORMAT_EXE}
|
||||||
-style=file
|
-style=file
|
||||||
-i ${SRC_FILES} ${MAIN_SRC_FILE_THIS} ${HEADER_FILES}
|
-i ${SRC_FILES} ${MAIN_SRC_FILE_THIS} ${HEADER_FILES}
|
||||||
WORKING_DIRECTORY ${APPLICATION_SOURCE_PATH}/HunttingCamera
|
WORKING_DIRECTORY ${APPLICATION_SOURCE_PATH}/HuntingCamera
|
||||||
)
|
)
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET ${TARGET_NAME}
|
TARGET ${TARGET_NAME}
|
||||||
PRE_BUILD
|
PRE_BUILD
|
||||||
COMMAND make HunttingCamera_code_check
|
COMMAND make HuntingCamera_code_check
|
||||||
COMMAND make HunttingCamera_code_format
|
COMMAND make HuntingCamera_code_format
|
||||||
WORKING_DIRECTORY ${PLATFORM_PATH}/cmake-shell/
|
WORKING_DIRECTORY ${PLATFORM_PATH}/cmake-shell/
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
|
@ -1,4 +1,4 @@
|
||||||
set(HUNTTING_MAIN_INCLUDE_PATH "${APPLICATION_SOURCE_PATH}/HunttingCamera/src")
|
set(HUNTTING_MAIN_INCLUDE_PATH "${APPLICATION_SOURCE_PATH}/HuntingCamera/src")
|
||||||
set(HUNTTING_MAIN_INCLUDE_PATH "${HUNTTING_MAIN_INCLUDE_PATH};${APPLICATION_SOURCE_PATH}/MissionManager/include")
|
set(HUNTTING_MAIN_INCLUDE_PATH "${HUNTTING_MAIN_INCLUDE_PATH};${APPLICATION_SOURCE_PATH}/MissionManager/include")
|
||||||
set(HUNTTING_MAIN_INCLUDE_PATH "${HUNTTING_MAIN_INCLUDE_PATH};${MIDDLEWARE_SOURCE_PATH}/StateMachine/include")
|
set(HUNTTING_MAIN_INCLUDE_PATH "${HUNTTING_MAIN_INCLUDE_PATH};${MIDDLEWARE_SOURCE_PATH}/StateMachine/include")
|
||||||
set(HUNTTING_MAIN_INCLUDE_PATH "${HUNTTING_MAIN_INCLUDE_PATH};${MIDDLEWARE_SOURCE_PATH}/McuManager/include")
|
set(HUNTTING_MAIN_INCLUDE_PATH "${HUNTTING_MAIN_INCLUDE_PATH};${MIDDLEWARE_SOURCE_PATH}/McuManager/include")
|
|
@ -7,3 +7,4 @@ add_subdirectory(MediaManager)
|
||||||
add_subdirectory(AppManager)
|
add_subdirectory(AppManager)
|
||||||
add_subdirectory(StorageManager)
|
add_subdirectory(StorageManager)
|
||||||
add_subdirectory(FilesManager)
|
add_subdirectory(FilesManager)
|
||||||
|
add_subdirectory(HuntingUpgrade)
|
56
middleware/HuntingUpgrade/CMakeLists.txt
Normal file
56
middleware/HuntingUpgrade/CMakeLists.txt
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
|
||||||
|
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
|
||||||
|
${UTILS_SOURCE_PATH}/UpgradeBase/include
|
||||||
|
)
|
||||||
|
#do not rely on any other library
|
||||||
|
#link_directories(
|
||||||
|
#)
|
||||||
|
|
||||||
|
aux_source_directory(./src SRC_FILES)
|
||||||
|
|
||||||
|
set(TARGET_NAME HuntingUpgrade)
|
||||||
|
add_library(${TARGET_NAME} STATIC ${SRC_FILES})
|
||||||
|
|
||||||
|
target_link_libraries(${TARGET_NAME} UpgradeBase Hal StatusCode Log)
|
||||||
|
|
||||||
|
if ("${COMPILE_IMPROVE_SUPPORT}" MATCHES "true")
|
||||||
|
add_custom_target(
|
||||||
|
HuntingUpgrade_code_check
|
||||||
|
COMMAND ${CLANG_TIDY_EXE}
|
||||||
|
-checks='${CLANG_TIDY_CHECKS}'
|
||||||
|
--header-filter=.*
|
||||||
|
--system-headers=false
|
||||||
|
${SRC_FILES}
|
||||||
|
${CLANG_TIDY_CONFIG}
|
||||||
|
-p ${PLATFORM_PATH}/cmake-shell
|
||||||
|
WORKING_DIRECTORY ${MIDDLEWARE_SOURCE_PATH}/HuntingUpgrade
|
||||||
|
)
|
||||||
|
file(GLOB_RECURSE HEADER_FILES *.h)
|
||||||
|
add_custom_target(
|
||||||
|
HuntingUpgrade_code_format
|
||||||
|
COMMAND ${CLANG_FORMAT_EXE}
|
||||||
|
-style=file
|
||||||
|
-i ${SRC_FILES} ${HEADER_FILES}
|
||||||
|
WORKING_DIRECTORY ${MIDDLEWARE_SOURCE_PATH}/HuntingUpgrade
|
||||||
|
)
|
||||||
|
add_custom_command(
|
||||||
|
TARGET ${TARGET_NAME}
|
||||||
|
PRE_BUILD
|
||||||
|
COMMAND make HuntingUpgrade_code_check
|
||||||
|
COMMAND make HuntingUpgrade_code_format
|
||||||
|
WORKING_DIRECTORY ${PLATFORM_PATH}/cmake-shell/
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
define_file_name(${TARGET_NAME})
|
||||||
|
|
||||||
|
file(GLOB_RECURSE INSTALL_HEADER_FILES include/*.h)
|
||||||
|
install(FILES ${INSTALL_HEADER_FILES} DESTINATION include)
|
26
middleware/HuntingUpgrade/include/HuntingUpgrade.h
Normal file
26
middleware/HuntingUpgrade/include/HuntingUpgrade.h
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
* 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 HUNTING_UPGRADE_H
|
||||||
|
#define HUNTING_UPGRADE_H
|
||||||
|
#include "StatusCode.h"
|
||||||
|
#include "UpgradeBase.h"
|
||||||
|
class HuntingUpgrade : public UpgradeBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
HuntingUpgrade() = default;
|
||||||
|
virtual ~HuntingUpgrade() = default;
|
||||||
|
StatusCode CheckFileHeader(const UpgradeFileHeader &head) override;
|
||||||
|
};
|
||||||
|
#endif
|
19
middleware/HuntingUpgrade/src/HuntingUpgrade.cpp
Normal file
19
middleware/HuntingUpgrade/src/HuntingUpgrade.cpp
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
/*
|
||||||
|
* 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 "HuntingUpgrade.h"
|
||||||
|
StatusCode HuntingUpgrade::CheckFileHeader(const UpgradeFileHeader &head)
|
||||||
|
{
|
||||||
|
return CreateStatusCode(STATUS_CODE_OK);
|
||||||
|
}
|
|
@ -1,3 +1,3 @@
|
||||||
|
|
||||||
add_subdirectory(HunttingCamera)
|
add_subdirectory(HuntingCamera)
|
||||||
add_subdirectory(MissionManager)
|
add_subdirectory(MissionManager)
|
|
@ -1,6 +1,6 @@
|
||||||
# include(${CMAKE_SOURCE_DIR}/build/independent_source.cmake)
|
# include(${CMAKE_SOURCE_DIR}/build/independent_source.cmake)
|
||||||
include(${CMAKE_SOURCE_DIR_IPCSDK}/build/global_config.cmake)
|
include(${CMAKE_SOURCE_DIR_IPCSDK}/build/global_config.cmake)
|
||||||
include(${APPLICATION_SOURCE_PATH}/HunttingCamera/build/huntting_camera.cmake)
|
include(${APPLICATION_SOURCE_PATH}/HuntingCamera/build/hunting_camera.cmake)
|
||||||
set(EXECUTABLE_OUTPUT_PATH ${TEST_OUTPUT_PATH}/bin)
|
set(EXECUTABLE_OUTPUT_PATH ${TEST_OUTPUT_PATH}/bin)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
|
@ -36,7 +36,7 @@ if(${TARGET_PLATFORM} MATCHES ${DEFINE_LINUX})
|
||||||
aux_source_directory(./src_mock SRC_FILES)
|
aux_source_directory(./src_mock SRC_FILES)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(TARGET_NAME HunttingCameraTest)
|
set(TARGET_NAME HuntingCameraTest)
|
||||||
add_executable(${TARGET_NAME} ${SRC_FILES_MAIN} ${SRC_FILES})
|
add_executable(${TARGET_NAME} ${SRC_FILES_MAIN} ${SRC_FILES})
|
||||||
target_link_libraries(${TARGET_NAME} HunttingMainLib MissionManagerTestTool McuManagerTestTool McuAskBaseTestTool AppManagerTestTool HalTestTool TestManager gtest gmock pthread)
|
target_link_libraries(${TARGET_NAME} HunttingMainLib MissionManagerTestTool McuManagerTestTool McuAskBaseTestTool AppManagerTestTool HalTestTool TestManager gtest gmock pthread)
|
||||||
if(${TEST_COVERAGE} MATCHES "true")
|
if(${TEST_COVERAGE} MATCHES "true")
|
||||||
|
@ -56,7 +56,7 @@ add_custom_target(
|
||||||
# --line-filter='[{\"name\":\"${EXTERNAL_SOURCE_PATH}/gtest/googletest-release-1.11.0/googletest/include/getest/gtest.h\"}]'
|
# --line-filter='[{\"name\":\"${EXTERNAL_SOURCE_PATH}/gtest/googletest-release-1.11.0/googletest/include/getest/gtest.h\"}]'
|
||||||
--line-filter='[{\"name\":\"${EXTERNAL_SOURCE_PATH}/gtest/googletest-release-1.11.0/googletest/include/getest/*.h\"}]'
|
--line-filter='[{\"name\":\"${EXTERNAL_SOURCE_PATH}/gtest/googletest-release-1.11.0/googletest/include/getest/*.h\"}]'
|
||||||
-p ${PLATFORM_PATH}/cmake-shell
|
-p ${PLATFORM_PATH}/cmake-shell
|
||||||
WORKING_DIRECTORY ${TEST_SOURCE_PATH}/application/HunttingCamera
|
WORKING_DIRECTORY ${TEST_SOURCE_PATH}/application/HuntingCamera
|
||||||
)
|
)
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET ${TARGET_NAME}
|
TARGET ${TARGET_NAME}
|
||||||
|
@ -71,7 +71,7 @@ add_custom_target(
|
||||||
COMMAND ${CLANG_FORMAT_EXE}
|
COMMAND ${CLANG_FORMAT_EXE}
|
||||||
-style=file
|
-style=file
|
||||||
-i ${SRC_FILES} ${SRC_FILES_MAIN} ${HEADER_FILES}
|
-i ${SRC_FILES} ${SRC_FILES_MAIN} ${HEADER_FILES}
|
||||||
WORKING_DIRECTORY ${TEST_SOURCE_PATH}/application/HunttingCamera
|
WORKING_DIRECTORY ${TEST_SOURCE_PATH}/application/HuntingCamera
|
||||||
)
|
)
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET ${TARGET_NAME}
|
TARGET ${TARGET_NAME}
|
|
@ -18,6 +18,6 @@
|
||||||
#include "McuManagerTestTool.h"
|
#include "McuManagerTestTool.h"
|
||||||
#include "TestManager.h"
|
#include "TestManager.h"
|
||||||
#include <thread>
|
#include <thread>
|
||||||
namespace HunttingCameraTest
|
namespace HuntingCameraTest
|
||||||
{
|
{
|
||||||
} // namespace HunttingCameraTest
|
} // namespace HuntingCameraTest
|
|
@ -15,7 +15,7 @@
|
||||||
#include "AppManagerTestTool.h"
|
#include "AppManagerTestTool.h"
|
||||||
#include "GtestUsing.h"
|
#include "GtestUsing.h"
|
||||||
#include "HalTestTool.h"
|
#include "HalTestTool.h"
|
||||||
#include "HunttingCameraTest.h"
|
#include "HuntingCameraTest.h"
|
||||||
#include "ILog.h"
|
#include "ILog.h"
|
||||||
#include "MainThread.h"
|
#include "MainThread.h"
|
||||||
#include "McuManagerTestTool.h"
|
#include "McuManagerTestTool.h"
|
||||||
|
@ -24,9 +24,9 @@
|
||||||
#include <thread>
|
#include <thread>
|
||||||
namespace AppMonitor_Mock_Test
|
namespace AppMonitor_Mock_Test
|
||||||
{
|
{
|
||||||
// ../output_files/test/bin/HunttingCameraTest
|
// ../output_files/test/bin/HuntingCameraTest
|
||||||
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetProductInfo
|
// --gtest_filter=HuntingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetProductInfo
|
||||||
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetProductInfo)
|
TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetProductInfo)
|
||||||
{
|
{
|
||||||
MainThread::GetInstance()->Init();
|
MainThread::GetInstance()->Init();
|
||||||
TestManager::ResetTimeOut(1000 * 3);
|
TestManager::ResetTimeOut(1000 * 3);
|
||||||
|
@ -34,9 +34,9 @@ TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetProductInfo)
|
||||||
MockGetProductInfo();
|
MockGetProductInfo();
|
||||||
MainThread::GetInstance()->Runing();
|
MainThread::GetInstance()->Runing();
|
||||||
}
|
}
|
||||||
// ../output_files/test/bin/HunttingCameraTest
|
// ../output_files/test/bin/HuntingCameraTest
|
||||||
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetDeviceAttr
|
// --gtest_filter=HuntingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetDeviceAttr
|
||||||
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetDeviceAttr)
|
TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetDeviceAttr)
|
||||||
{
|
{
|
||||||
MainThread::GetInstance()->Init();
|
MainThread::GetInstance()->Init();
|
||||||
TestManager::ResetTimeOut(1000 * 3);
|
TestManager::ResetTimeOut(1000 * 3);
|
||||||
|
@ -44,9 +44,9 @@ TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetDeviceAttr)
|
||||||
MockGetDeviceAttr();
|
MockGetDeviceAttr();
|
||||||
MainThread::GetInstance()->Runing();
|
MainThread::GetInstance()->Runing();
|
||||||
}
|
}
|
||||||
// ../output_files/test/bin/HunttingCameraTest
|
// ../output_files/test/bin/HuntingCameraTest
|
||||||
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetMediaInfo
|
// --gtest_filter=HuntingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetMediaInfo
|
||||||
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetMediaInfo)
|
TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetMediaInfo)
|
||||||
{
|
{
|
||||||
MainThread::GetInstance()->Init();
|
MainThread::GetInstance()->Init();
|
||||||
TestManager::ResetTimeOut(1000 * 3);
|
TestManager::ResetTimeOut(1000 * 3);
|
||||||
|
@ -54,9 +54,9 @@ TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetMediaInfo)
|
||||||
MockGetMediaInfo();
|
MockGetMediaInfo();
|
||||||
MainThread::GetInstance()->Runing();
|
MainThread::GetInstance()->Runing();
|
||||||
}
|
}
|
||||||
// ../output_files/test/bin/HunttingCameraTest
|
// ../output_files/test/bin/HuntingCameraTest
|
||||||
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetSdCardInfo
|
// --gtest_filter=HuntingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetSdCardInfo
|
||||||
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetSdCardInfo)
|
TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetSdCardInfo)
|
||||||
{
|
{
|
||||||
MainThread::GetInstance()->Init();
|
MainThread::GetInstance()->Init();
|
||||||
TestManager::ResetTimeOut(1000 * 3);
|
TestManager::ResetTimeOut(1000 * 3);
|
||||||
|
@ -64,9 +64,9 @@ TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetSdCardInfo)
|
||||||
MockGetSdCardInfo();
|
MockGetSdCardInfo();
|
||||||
MainThread::GetInstance()->Runing();
|
MainThread::GetInstance()->Runing();
|
||||||
}
|
}
|
||||||
// ../output_files/test/bin/HunttingCameraTest
|
// ../output_files/test/bin/HuntingCameraTest
|
||||||
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetBatteryInfo
|
// --gtest_filter=HuntingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetBatteryInfo
|
||||||
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetBatteryInfo)
|
TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetBatteryInfo)
|
||||||
{
|
{
|
||||||
MainThread::GetInstance()->Init();
|
MainThread::GetInstance()->Init();
|
||||||
TestManager::ResetTimeOut(1000 * 3);
|
TestManager::ResetTimeOut(1000 * 3);
|
||||||
|
@ -74,9 +74,9 @@ TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetBatteryInfo)
|
||||||
MockGetBatteryInfo();
|
MockGetBatteryInfo();
|
||||||
MainThread::GetInstance()->Runing();
|
MainThread::GetInstance()->Runing();
|
||||||
}
|
}
|
||||||
// ../output_files/test/bin/HunttingCameraTest
|
// ../output_files/test/bin/HuntingCameraTest
|
||||||
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_SetDateTime
|
// --gtest_filter=HuntingCameraTest.INTEGRATION_HunttingCamera_AUTO_SetDateTime
|
||||||
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_SetDateTime)
|
TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_AUTO_SetDateTime)
|
||||||
{
|
{
|
||||||
MainThread::GetInstance()->Init();
|
MainThread::GetInstance()->Init();
|
||||||
TestManager::ResetTimeOut(1000 * 3);
|
TestManager::ResetTimeOut(1000 * 3);
|
||||||
|
@ -84,9 +84,9 @@ TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_SetDateTime)
|
||||||
MockSetDateTime();
|
MockSetDateTime();
|
||||||
MainThread::GetInstance()->Runing();
|
MainThread::GetInstance()->Runing();
|
||||||
}
|
}
|
||||||
// ../output_files/test/bin/HunttingCameraTest
|
// ../output_files/test/bin/HuntingCameraTest
|
||||||
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_SetTimeZone
|
// --gtest_filter=HuntingCameraTest.INTEGRATION_HunttingCamera_AUTO_SetTimeZone
|
||||||
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_SetTimeZone)
|
TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_AUTO_SetTimeZone)
|
||||||
{
|
{
|
||||||
MainThread::GetInstance()->Init();
|
MainThread::GetInstance()->Init();
|
||||||
TestManager::ResetTimeOut(1000 * 3);
|
TestManager::ResetTimeOut(1000 * 3);
|
||||||
|
@ -94,9 +94,9 @@ TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_SetTimeZone)
|
||||||
MockSetTimeZone();
|
MockSetTimeZone();
|
||||||
MainThread::GetInstance()->Runing();
|
MainThread::GetInstance()->Runing();
|
||||||
}
|
}
|
||||||
// ../output_files/test/bin/HunttingCameraTest
|
// ../output_files/test/bin/HuntingCameraTest
|
||||||
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_MockUploadFiles
|
// --gtest_filter=HuntingCameraTest.INTEGRATION_HunttingCamera_AUTO_MockUploadFiles
|
||||||
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_MockUploadFiles)
|
TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_AUTO_MockUploadFiles)
|
||||||
{
|
{
|
||||||
MainThread::GetInstance()->Init();
|
MainThread::GetInstance()->Init();
|
||||||
TestManager::ResetTimeOut(1000 * 3);
|
TestManager::ResetTimeOut(1000 * 3);
|
||||||
|
@ -104,9 +104,9 @@ TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_MockUploadFiles)
|
||||||
MockUploadFiles();
|
MockUploadFiles();
|
||||||
MainThread::GetInstance()->Runing();
|
MainThread::GetInstance()->Runing();
|
||||||
}
|
}
|
||||||
// ../output_files/test/bin/HunttingCameraTest
|
// ../output_files/test/bin/HuntingCameraTest
|
||||||
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_McuOpenFailed
|
// --gtest_filter=HuntingCameraTest.INTEGRATION_HunttingCamera_AUTO_McuOpenFailed
|
||||||
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_McuOpenFailed)
|
TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_AUTO_McuOpenFailed)
|
||||||
{
|
{
|
||||||
McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
|
McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
|
||||||
MainThread::GetInstance()->Init();
|
MainThread::GetInstance()->Init();
|
||||||
|
@ -115,9 +115,9 @@ TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_McuOpenFailed)
|
||||||
// MockUploadFiles();
|
// MockUploadFiles();
|
||||||
MainThread::GetInstance()->Runing();
|
MainThread::GetInstance()->Runing();
|
||||||
}
|
}
|
||||||
// ../output_files/test/bin/HunttingCameraTest
|
// ../output_files/test/bin/HuntingCameraTest
|
||||||
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetParamValue
|
// --gtest_filter=HuntingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetParamValue
|
||||||
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetParamValue)
|
TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetParamValue)
|
||||||
{
|
{
|
||||||
McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
|
McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
|
||||||
MainThread::GetInstance()->Init();
|
MainThread::GetInstance()->Init();
|
||||||
|
@ -126,9 +126,9 @@ TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetParamValue)
|
||||||
MockGetParamValue();
|
MockGetParamValue();
|
||||||
MainThread::GetInstance()->Runing();
|
MainThread::GetInstance()->Runing();
|
||||||
}
|
}
|
||||||
// ../output_files/test/bin/HunttingCameraTest
|
// ../output_files/test/bin/HuntingCameraTest
|
||||||
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetCapability
|
// --gtest_filter=HuntingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetCapability
|
||||||
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetCapability)
|
TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetCapability)
|
||||||
{
|
{
|
||||||
McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
|
McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
|
||||||
MainThread::GetInstance()->Init();
|
MainThread::GetInstance()->Init();
|
||||||
|
@ -137,9 +137,9 @@ TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetCapability)
|
||||||
MockGetCapability();
|
MockGetCapability();
|
||||||
MainThread::GetInstance()->Runing();
|
MainThread::GetInstance()->Runing();
|
||||||
}
|
}
|
||||||
// ../output_files/test/bin/HunttingCameraTest
|
// ../output_files/test/bin/HuntingCameraTest
|
||||||
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetLockVideoStatus
|
// --gtest_filter=HuntingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetLockVideoStatus
|
||||||
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetLockVideoStatus)
|
TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetLockVideoStatus)
|
||||||
{
|
{
|
||||||
McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
|
McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
|
||||||
MainThread::GetInstance()->Init();
|
MainThread::GetInstance()->Init();
|
||||||
|
@ -148,9 +148,9 @@ TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetLockVideoStatus)
|
||||||
MockGetLockVideoStatus();
|
MockGetLockVideoStatus();
|
||||||
MainThread::GetInstance()->Runing();
|
MainThread::GetInstance()->Runing();
|
||||||
}
|
}
|
||||||
// ../output_files/test/bin/HunttingCameraTest
|
// ../output_files/test/bin/HuntingCameraTest
|
||||||
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetStorageInfo
|
// --gtest_filter=HuntingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetStorageInfo
|
||||||
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetStorageInfo)
|
TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetStorageInfo)
|
||||||
{
|
{
|
||||||
McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
|
McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
|
||||||
MainThread::GetInstance()->Init();
|
MainThread::GetInstance()->Init();
|
||||||
|
@ -159,9 +159,9 @@ TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetStorageInfo)
|
||||||
MockGetStorageInfo();
|
MockGetStorageInfo();
|
||||||
MainThread::GetInstance()->Runing();
|
MainThread::GetInstance()->Runing();
|
||||||
}
|
}
|
||||||
// ../output_files/test/bin/HunttingCameraTest
|
// ../output_files/test/bin/HuntingCameraTest
|
||||||
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetStorageFileList
|
// --gtest_filter=HuntingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetStorageFileList
|
||||||
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetStorageFileList)
|
TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetStorageFileList)
|
||||||
{
|
{
|
||||||
McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
|
McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
|
||||||
MainThread::GetInstance()->Init();
|
MainThread::GetInstance()->Init();
|
||||||
|
@ -170,9 +170,9 @@ TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetStorageFileList)
|
||||||
MockGetStorageFileList();
|
MockGetStorageFileList();
|
||||||
MainThread::GetInstance()->Runing();
|
MainThread::GetInstance()->Runing();
|
||||||
}
|
}
|
||||||
// ../output_files/test/bin/HunttingCameraTest
|
// ../output_files/test/bin/HuntingCameraTest
|
||||||
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_SetParamValue
|
// --gtest_filter=HuntingCameraTest.INTEGRATION_HunttingCamera_AUTO_SetParamValue
|
||||||
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_SetParamValue)
|
TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_AUTO_SetParamValue)
|
||||||
{
|
{
|
||||||
McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
|
McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
|
||||||
MainThread::GetInstance()->Init();
|
MainThread::GetInstance()->Init();
|
||||||
|
@ -181,9 +181,9 @@ TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_SetParamValue)
|
||||||
MockSetParamValue();
|
MockSetParamValue();
|
||||||
MainThread::GetInstance()->Runing();
|
MainThread::GetInstance()->Runing();
|
||||||
}
|
}
|
||||||
// ../output_files/test/bin/HunttingCameraTest
|
// ../output_files/test/bin/HuntingCameraTest
|
||||||
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_EnterRecorder
|
// --gtest_filter=HuntingCameraTest.INTEGRATION_HunttingCamera_AUTO_EnterRecorder
|
||||||
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_EnterRecorder)
|
TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_AUTO_EnterRecorder)
|
||||||
{
|
{
|
||||||
McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
|
McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
|
||||||
MainThread::GetInstance()->Init();
|
MainThread::GetInstance()->Init();
|
||||||
|
@ -192,9 +192,9 @@ TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_EnterRecorder)
|
||||||
MockEnterRecorder();
|
MockEnterRecorder();
|
||||||
MainThread::GetInstance()->Runing();
|
MainThread::GetInstance()->Runing();
|
||||||
}
|
}
|
||||||
// ../output_files/test/bin/HunttingCameraTest
|
// ../output_files/test/bin/HuntingCameraTest
|
||||||
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_AppPlayback
|
// --gtest_filter=HuntingCameraTest.INTEGRATION_HunttingCamera_AUTO_AppPlayback
|
||||||
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_AppPlayback)
|
TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_AUTO_AppPlayback)
|
||||||
{
|
{
|
||||||
McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
|
McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
|
||||||
MainThread::GetInstance()->Init();
|
MainThread::GetInstance()->Init();
|
|
@ -12,7 +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 "HunttingCameraTest.h"
|
#include "HuntingCameraTest.h"
|
||||||
#include "GtestUsing.h"
|
#include "GtestUsing.h"
|
||||||
#include "ILog.h"
|
#include "ILog.h"
|
||||||
#include "MainThread.h"
|
#include "MainThread.h"
|
||||||
|
@ -21,22 +21,22 @@ void MainThreadTest::CustomizationInit(void)
|
||||||
{
|
{
|
||||||
// Do nothing here to make sure test tool work.
|
// Do nothing here to make sure test tool work.
|
||||||
}
|
}
|
||||||
HunttingCameraTest::HunttingCameraTest()
|
HuntingCameraTest::HuntingCameraTest()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
HunttingCameraTest::~HunttingCameraTest()
|
HuntingCameraTest::~HuntingCameraTest()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
void HunttingCameraTest::SetUpTestCase()
|
void HuntingCameraTest::SetUpTestCase()
|
||||||
{
|
{
|
||||||
CreateLogModule();
|
CreateLogModule();
|
||||||
ILogInit(LOG_INSTANCE_TYPE_END);
|
ILogInit(LOG_INSTANCE_TYPE_END);
|
||||||
}
|
}
|
||||||
void HunttingCameraTest::TearDownTestCase()
|
void HuntingCameraTest::TearDownTestCase()
|
||||||
{
|
{
|
||||||
ILogUnInit();
|
ILogUnInit();
|
||||||
}
|
}
|
||||||
void HunttingCameraTest::SetUp()
|
void HuntingCameraTest::SetUp()
|
||||||
{
|
{
|
||||||
CreateAllCamerasMcok();
|
CreateAllCamerasMcok();
|
||||||
std::shared_ptr<MainThread> mainThread = std::make_shared<MainThreadTest>();
|
std::shared_ptr<MainThread> mainThread = std::make_shared<MainThreadTest>();
|
||||||
|
@ -52,7 +52,7 @@ void HunttingCameraTest::SetUp()
|
||||||
HalTestTool::InitSdCardHal(mLinuxTest);
|
HalTestTool::InitSdCardHal(mLinuxTest);
|
||||||
TestManager::Init();
|
TestManager::Init();
|
||||||
}
|
}
|
||||||
void HunttingCameraTest::TearDown()
|
void HuntingCameraTest::TearDown()
|
||||||
{
|
{
|
||||||
TestManager::UnInit();
|
TestManager::UnInit();
|
||||||
MissionManagerTestTool::UnInit();
|
MissionManagerTestTool::UnInit();
|
||||||
|
@ -68,12 +68,12 @@ void HunttingCameraTest::TearDown()
|
||||||
MainThread::GetInstance(&mainThread);
|
MainThread::GetInstance(&mainThread);
|
||||||
DestroyAllCamerasMock();
|
DestroyAllCamerasMock();
|
||||||
}
|
}
|
||||||
void HunttingCameraTest::CreateAllCamerasMcok(void)
|
void HuntingCameraTest::CreateAllCamerasMcok(void)
|
||||||
{
|
{
|
||||||
std::shared_ptr<VCameraHal> camera = HalTestTool::MakeCameraHalTest(CameraType::MAIN_CAMERA);
|
std::shared_ptr<VCameraHal> camera = HalTestTool::MakeCameraHalTest(CameraType::MAIN_CAMERA);
|
||||||
mAllCamerasMock[CameraType::MAIN_CAMERA] = camera;
|
mAllCamerasMock[CameraType::MAIN_CAMERA] = camera;
|
||||||
}
|
}
|
||||||
void HunttingCameraTest::DestroyAllCamerasMock(void)
|
void HuntingCameraTest::DestroyAllCamerasMock(void)
|
||||||
{
|
{
|
||||||
mAllCamerasMock.clear();
|
mAllCamerasMock.clear();
|
||||||
}
|
}
|
|
@ -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 HUNTTING_CAMERA_TEST_H
|
#ifndef HUNTING_CAMERA_TEST_H
|
||||||
#define HUNTTING_CAMERA_TEST_H
|
#define HUNTING_CAMERA_TEST_H
|
||||||
#include "AppManagerTestTool.h"
|
#include "AppManagerTestTool.h"
|
||||||
#include "GtestUsing.h"
|
#include "GtestUsing.h"
|
||||||
#include "HalTestTool.h"
|
#include "HalTestTool.h"
|
||||||
|
@ -30,7 +30,7 @@ public:
|
||||||
virtual ~MainThreadTest() = default;
|
virtual ~MainThreadTest() = default;
|
||||||
void CustomizationInit(void) override;
|
void CustomizationInit(void) override;
|
||||||
};
|
};
|
||||||
class HunttingCameraTest : public testing::Test,
|
class HuntingCameraTest : public testing::Test,
|
||||||
public TestManager,
|
public TestManager,
|
||||||
public MissionManagerTestTool,
|
public MissionManagerTestTool,
|
||||||
public McuManagerTestTool,
|
public McuManagerTestTool,
|
||||||
|
@ -38,8 +38,8 @@ class HunttingCameraTest : public testing::Test,
|
||||||
public HalTestTool
|
public HalTestTool
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HunttingCameraTest();
|
HuntingCameraTest();
|
||||||
virtual ~HunttingCameraTest();
|
virtual ~HuntingCameraTest();
|
||||||
static void SetUpTestCase();
|
static void SetUpTestCase();
|
||||||
static void TearDownTestCase();
|
static void TearDownTestCase();
|
||||||
void SetUp() override;
|
void SetUp() override;
|
|
@ -15,7 +15,7 @@
|
||||||
#include "AppManagerTestTool.h"
|
#include "AppManagerTestTool.h"
|
||||||
#include "GtestUsing.h"
|
#include "GtestUsing.h"
|
||||||
#include "HalTestTool.h"
|
#include "HalTestTool.h"
|
||||||
#include "HunttingCameraTest.h"
|
#include "HuntingCameraTest.h"
|
||||||
#include "ILog.h"
|
#include "ILog.h"
|
||||||
#include "MainThread.h"
|
#include "MainThread.h"
|
||||||
#include "McuManagerTestTool.h"
|
#include "McuManagerTestTool.h"
|
||||||
|
@ -24,9 +24,9 @@
|
||||||
#include <thread>
|
#include <thread>
|
||||||
namespace MediaManager_Mock_Test
|
namespace MediaManager_Mock_Test
|
||||||
{
|
{
|
||||||
// ../output_files/test/bin/HunttingCameraTest
|
// ../output_files/test/bin/HuntingCameraTest
|
||||||
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_EXAMPLE_MediaReprot
|
// --gtest_filter=HuntingCameraTest.INTEGRATION_HunttingCamera_EXAMPLE_MediaReprot
|
||||||
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_EXAMPLE_MediaReprot)
|
TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_EXAMPLE_MediaReprot)
|
||||||
{
|
{
|
||||||
SetAllCamerasResult(mAllCamerasMock);
|
SetAllCamerasResult(mAllCamerasMock);
|
||||||
MockReportCameraEvent("/tmp/test.MP4", CameraType::MAIN_CAMERA);
|
MockReportCameraEvent("/tmp/test.MP4", CameraType::MAIN_CAMERA);
|
|
@ -5,7 +5,7 @@ set(LIBRARY_OUTPUT_PATH ${LIBS_OUTPUT_PATH})
|
||||||
include_directories(
|
include_directories(
|
||||||
./src
|
./src
|
||||||
./include
|
./include
|
||||||
${APPLICATION_SOURCE_PATH}/HunttingCamera/src
|
${APPLICATION_SOURCE_PATH}/HuntingCamera/src
|
||||||
${UTILS_SOURCE_PATH}/Log/include
|
${UTILS_SOURCE_PATH}/Log/include
|
||||||
${UTILS_SOURCE_PATH}/StatusCode/include
|
${UTILS_SOURCE_PATH}/StatusCode/include
|
||||||
${EXTERNAL_SOURCE_PATH}/gtest/googletest-release-1.11.0/googletest/include
|
${EXTERNAL_SOURCE_PATH}/gtest/googletest-release-1.11.0/googletest/include
|
||||||
|
|
|
@ -16,3 +16,4 @@ add_subdirectory(MediaAdapter)
|
||||||
add_subdirectory(FxHttpServer)
|
add_subdirectory(FxHttpServer)
|
||||||
add_subdirectory(Servers)
|
add_subdirectory(Servers)
|
||||||
add_subdirectory(TcpModule)
|
add_subdirectory(TcpModule)
|
||||||
|
add_subdirectory(UpgradeBase)
|
54
utils/UpgradeBase/CMakeLists.txt
Normal file
54
utils/UpgradeBase/CMakeLists.txt
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
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}/LinuxApi/include
|
||||||
|
${UTILS_SOURCE_PATH}/StatusCode/include
|
||||||
|
${UTILS_SOURCE_PATH}/Log/include
|
||||||
|
)
|
||||||
|
# link_directories(
|
||||||
|
# ${EXTERNAL_SOURCE_PATH}/libconfig/libconfig-1.7.3/lib/.libs
|
||||||
|
# )
|
||||||
|
|
||||||
|
aux_source_directory(./src SRC_FILES)
|
||||||
|
|
||||||
|
set(TARGET_NAME UpgradeBase)
|
||||||
|
add_library(${TARGET_NAME} STATIC ${SRC_FILES})
|
||||||
|
target_link_libraries(${TARGET_NAME} StatusCode Log)
|
||||||
|
|
||||||
|
if ("${COMPILE_IMPROVE_SUPPORT}" MATCHES "true")
|
||||||
|
add_custom_target(
|
||||||
|
UpgradeBase_code_check
|
||||||
|
COMMAND ${CLANG_TIDY_EXE}
|
||||||
|
-checks='${CLANG_TIDY_CHECKS}'
|
||||||
|
--header-filter=.*
|
||||||
|
--system-headers=false
|
||||||
|
${SRC_FILES}
|
||||||
|
${CLANG_TIDY_CONFIG}
|
||||||
|
-p ${PLATFORM_PATH}/cmake-shell
|
||||||
|
WORKING_DIRECTORY ${UTILS_SOURCE_PATH}/UpgradeBase
|
||||||
|
)
|
||||||
|
file(GLOB_RECURSE HEADER_FILES *.h)
|
||||||
|
add_custom_target(
|
||||||
|
UpgradeBase_code_format
|
||||||
|
COMMAND ${CLANG_FORMAT_EXE}
|
||||||
|
-style=file
|
||||||
|
-i ${SRC_FILES} ${HEADER_FILES}
|
||||||
|
WORKING_DIRECTORY ${UTILS_SOURCE_PATH}/UpgradeBase
|
||||||
|
)
|
||||||
|
add_custom_command(
|
||||||
|
TARGET ${TARGET_NAME}
|
||||||
|
PRE_BUILD
|
||||||
|
COMMAND make UpgradeBase_code_check
|
||||||
|
COMMAND make UpgradeBase_code_format
|
||||||
|
WORKING_DIRECTORY ${PLATFORM_PATH}/cmake-shell/
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
define_file_name(${TARGET_NAME})
|
||||||
|
|
||||||
|
file(GLOB_RECURSE INSTALL_HEADER_FILES include/*.h)
|
||||||
|
install(FILES ${INSTALL_HEADER_FILES} DESTINATION include)
|
23
utils/UpgradeBase/README.md
Normal file
23
utils/UpgradeBase/README.md
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
# 1. 升级功能基类
|
||||||
|
|
||||||
|
## 1.1. 概述
|
||||||
|
|
||||||
|
  升级功能基类,用于升级功能模块,提供升级功能模块的通用方法。
|
||||||
|
|
||||||
|
## 1.2. 文件头定义
|
||||||
|
|
||||||
|
**32字节头定义**
|
||||||
|
|
||||||
|
| 打包时间(6) | 版本号(4) | 型号代码(2) | 项目代码(2) | 升级类型(1) | 预留(17) |
|
||||||
|
|----|----|----|----|----|----|
|
||||||
|
|----|----|----|----|----|----|
|
||||||
|
|
||||||
|
**升级类型说明**
|
||||||
|
|
||||||
|
0x00:仅仅应用程序;
|
||||||
|
0x01:烧录flash;
|
||||||
|
|
||||||
|
## 1.3. 仅升级应用程序
|
||||||
|
|
||||||
|
1. 插卡后检查sd卡是否存在升级文件;
|
||||||
|
2. 校验升级文件并拷贝到升级目录;
|
44
utils/UpgradeBase/include/UpgradeBase.h
Normal file
44
utils/UpgradeBase/include/UpgradeBase.h
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
/*
|
||||||
|
* 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 UPGRADE_BASE_H
|
||||||
|
#define UPGRADE_BASE_H
|
||||||
|
#include "StatusCode.h"
|
||||||
|
typedef struct __attribute__((packed)) upgrade_file_header
|
||||||
|
{
|
||||||
|
unsigned char packTime[6];
|
||||||
|
unsigned char version[4];
|
||||||
|
unsigned char product[2];
|
||||||
|
unsigned char project[2];
|
||||||
|
unsigned char upgradeType[1];
|
||||||
|
unsigned char reserved[17];
|
||||||
|
} UpgradeFileHeader;
|
||||||
|
class UpgradeBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
UpgradeBase() = default;
|
||||||
|
virtual ~UpgradeBase() = default;
|
||||||
|
virtual StatusCode CheckFileHeader(const UpgradeFileHeader &head) = 0;
|
||||||
|
/**
|
||||||
|
* @brief Verify if the file belongs to the upgrade file.
|
||||||
|
*
|
||||||
|
* @param fileName The file name being verified. Enter the parameter using an absolute path.
|
||||||
|
* @return StatusCode
|
||||||
|
*/
|
||||||
|
StatusCode CheckUpgradeFile(const char *fileName);
|
||||||
|
StatusCode MoveUpgradeFile(const char *sourceFile, const char *targetFile);
|
||||||
|
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
#endif
|
87
utils/UpgradeBase/src/UpgradeBase.cpp
Normal file
87
utils/UpgradeBase/src/UpgradeBase.cpp
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
/*
|
||||||
|
* 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 "UpgradeBase.h"
|
||||||
|
#include "ILog.h"
|
||||||
|
#include "LinuxApi.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
StatusCode UpgradeBase::CheckUpgradeFile(const char *fileName)
|
||||||
|
{
|
||||||
|
FILE *file = nullptr;
|
||||||
|
UpgradeFileHeader fileHead;
|
||||||
|
|
||||||
|
file = fopen(fileName, "rb");
|
||||||
|
if (file == NULL) {
|
||||||
|
perror("Error opening file");
|
||||||
|
return CreateStatusCode(STATUS_CODE_NOT_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t bytesRead = fread(&fileHead, sizeof(UpgradeFileHeader), 1, file);
|
||||||
|
if (bytesRead != 1) {
|
||||||
|
perror("Error reading file header");
|
||||||
|
fclose(file);
|
||||||
|
return CreateStatusCode(STATUS_CODE_NOT_OK);
|
||||||
|
}
|
||||||
|
return CheckFileHeader(fileHead);
|
||||||
|
}
|
||||||
|
StatusCode UpgradeBase::MoveUpgradeFile(const char *sourceFile, const char *targetFile)
|
||||||
|
{
|
||||||
|
FILE *inputFile = nullptr;
|
||||||
|
FILE *outputFile = nullptr;
|
||||||
|
constexpr int BUFF_SIZE = 1024 * 200;
|
||||||
|
UpgradeFileHeader fileHeader;
|
||||||
|
const size_t headerSize = sizeof(UpgradeFileHeader);
|
||||||
|
unsigned char buffer[BUFF_SIZE];
|
||||||
|
size_t bytesRead;
|
||||||
|
|
||||||
|
inputFile = fopen(sourceFile, "rb");
|
||||||
|
if (inputFile == NULL) {
|
||||||
|
perror("Error opening input file");
|
||||||
|
return CreateStatusCode(STATUS_CODE_NOT_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
outputFile = fopen(targetFile, "wb");
|
||||||
|
if (outputFile == NULL) {
|
||||||
|
perror("Error opening output file");
|
||||||
|
fclose(inputFile);
|
||||||
|
return CreateStatusCode(STATUS_CODE_NOT_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
bytesRead = fread(&fileHeader, 1, headerSize, inputFile);
|
||||||
|
if (bytesRead != headerSize) {
|
||||||
|
perror("Error reading file header");
|
||||||
|
fclose(inputFile);
|
||||||
|
fclose(outputFile);
|
||||||
|
return CreateStatusCode(STATUS_CODE_NOT_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
while ((bytesRead = fread(buffer, 1, sizeof(buffer), inputFile)) > 0) {
|
||||||
|
fwrite(buffer, 1, bytesRead, outputFile);
|
||||||
|
if (ferror(inputFile) || ferror(outputFile)) {
|
||||||
|
perror("Error reading or writing file");
|
||||||
|
fclose(inputFile);
|
||||||
|
fclose(outputFile);
|
||||||
|
return CreateStatusCode(STATUS_CODE_NOT_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(inputFile);
|
||||||
|
fclose(outputFile);
|
||||||
|
|
||||||
|
LogInfo("File processed successfully.\n");
|
||||||
|
|
||||||
|
return CreateStatusCode(STATUS_CODE_OK);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user