Compare commits
2 Commits
cb0948f81f
...
b7674539dd
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b7674539dd | ||
![]() |
39ab107f7d |
2
Makefile
2
Makefile
|
@ -37,4 +37,4 @@ clean:
|
|||
external/goahead-5.2.0/GoAhead \
|
||||
output_files \
|
||||
cmake-shell
|
||||
@git checkout output_files
|
||||
@git checkout output_files
|
|
@ -10,6 +10,7 @@ include_directories(
|
|||
link_directories(
|
||||
${LIBS_OUTPUT_PATH}
|
||||
${EXTERNAL_LIBS_OUTPUT_PATH}
|
||||
${EXTERNAL_LIBS_OUTPUT_PATH}/libconfig/lib
|
||||
)
|
||||
|
||||
aux_source_directory(. SRC_FILES)
|
||||
|
|
|
@ -13,7 +13,10 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "AppMonitor.h"
|
||||
#include "IAppManager.h"
|
||||
#include "ILog.h"
|
||||
#include "IStorageManager.h"
|
||||
#include "StatusCode.h"
|
||||
#include <vector>
|
||||
AppMonitor::AppMonitor() : mMicStatus(SwitchStatus::END)
|
||||
{
|
||||
|
|
|
@ -14,6 +14,13 @@
|
|||
*/
|
||||
#include "DataProcessing.h"
|
||||
#include "ILog.h"
|
||||
#include "IMissionManager.h"
|
||||
#include "IStateMachine.h"
|
||||
#include "KeyControl.h"
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
const bool NOT_EXECUTED = false;
|
||||
const bool EXECUTED = true;
|
||||
key_event_data::key_event_data(const std::string &keyName, const KeyEvent &keyEvent, const unsigned int &holdTime)
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
*/
|
||||
#include "IMissionManager.h"
|
||||
#include "ILog.h"
|
||||
#include "StatusCode.h"
|
||||
#include <memory>
|
||||
std::shared_ptr<IMissionManager> &IMissionManager::GetInstance(std::shared_ptr<IMissionManager> *impl)
|
||||
{
|
||||
static auto instance = std::make_shared<IMissionManager>();
|
||||
|
|
|
@ -13,10 +13,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "IdleState.h"
|
||||
#include "IFilesManager.h"
|
||||
#include "DataProcessing.h"
|
||||
#include "ILog.h"
|
||||
#include "IMediaManager.h"
|
||||
#include "MissionStateMachine.h"
|
||||
#include "IStateMachine.h"
|
||||
IdleState::IdleState() : State("IdleState")
|
||||
{
|
||||
// mEventHandle[InternalStateEvent::MEDIA_REPORT_EVENT] = std::bind(&IdleState::MediaReportHandle, this, _1);
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
*/
|
||||
#include "LedsHandle.h"
|
||||
#include "ILog.h"
|
||||
#include "LedControl.h"
|
||||
#include "SetLedState.h"
|
||||
void LedsHandle::ControlDeviceStatusLed(const DeviceStatus &status, const long int &keepAliveTime,
|
||||
const unsigned int &blinkPeriod)
|
||||
{
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "McuMonitor.h"
|
||||
#include "ILog.h"
|
||||
#include "IMcuManager.h"
|
||||
#include <memory>
|
||||
void McuMonitor::Init(std::shared_ptr<VMcuMonitor> &monitor)
|
||||
{
|
||||
IMcuManager::GetInstance()->SetMcuMonitor(monitor);
|
||||
|
|
|
@ -13,10 +13,15 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "MediaHandleState.h"
|
||||
#include "IFilesManager.h"
|
||||
#include "DataProcessing.h"
|
||||
#include "ILog.h"
|
||||
#include "IMediaManager.h"
|
||||
#include "IStateMachine.h"
|
||||
#include "MediaTaskHandle.h"
|
||||
#include "MissionStateMachine.h"
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
MediaHandleState::MediaHandleState() : State("MediaHandleState")
|
||||
{
|
||||
mEventHandle[InternalStateEvent::RESET_KEY_MEDIA_TASK] =
|
||||
|
|
|
@ -13,6 +13,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "MediaTask.h"
|
||||
#include "DataProcessing.h"
|
||||
#include "IMediaManager.h"
|
||||
#include <memory>
|
||||
MediaTask::MediaTask(const MediaTaskType &type, const InternalStateEvent &bindEvent,
|
||||
const std::weak_ptr<VMediaTaskIniator> &iniator)
|
||||
: mType(type), mBindEvent(bindEvent), mIniator(iniator)
|
||||
|
|
|
@ -13,8 +13,14 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "MediaTaskHandle.h"
|
||||
#include "DataProcessing.h"
|
||||
#include "ILog.h"
|
||||
#include "IMediaManager.h"
|
||||
#include "IMissionManager.h"
|
||||
#include "MediaTask.h"
|
||||
#include "MissionStateMachine.h"
|
||||
#include "StatusCode.h"
|
||||
#include <memory>
|
||||
MediaTaskHandle::MediaTaskHandle()
|
||||
{
|
||||
mMediaHandle.reset();
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "MissionManager.h"
|
||||
#include "IAppManager.h"
|
||||
#include "MissionStateMachine.h"
|
||||
#include "StatusCode.h"
|
||||
const StatusCode MissionManager::Init(void)
|
||||
{
|
||||
MissionStateMachine::GetInstance()->Init();
|
||||
|
|
|
@ -14,16 +14,21 @@
|
|||
*/
|
||||
#include "MissionManagerMakePtr.h"
|
||||
#include "ILog.h"
|
||||
#include "IMcuManager.h"
|
||||
#include "IMissionManager.h"
|
||||
#include "IStateMachine.h"
|
||||
#include "IdleState.h"
|
||||
#include "MediaHandleState.h"
|
||||
#include "MissionManager.h"
|
||||
#include "OnMissionState.h"
|
||||
#include "PirTriggeredMissionState.h"
|
||||
#include "SdCardHandleState.h"
|
||||
#include "StatusCode.h"
|
||||
#include "StorageHandleState.h"
|
||||
#include "TestMissionState.h"
|
||||
#include "TopState.h"
|
||||
#include "UpgradeState.h"
|
||||
#include <memory>
|
||||
bool CreateMissionManagerModule(void)
|
||||
{
|
||||
auto instance = std::make_shared<IMissionManager>();
|
||||
|
|
|
@ -13,9 +13,13 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "MissionState.h"
|
||||
#include "IAppManager.h"
|
||||
#include "DataProcessing.h"
|
||||
#include "ILog.h"
|
||||
#include "IStateMachine.h"
|
||||
#include "LedsHandle.h"
|
||||
#include "MissionStateMachine.h"
|
||||
#include <functional>
|
||||
#include <string>
|
||||
MissionState::MissionState(const std::string &name) : State(name)
|
||||
{
|
||||
mEventHandle[InternalStateEvent::MEDIA_REPORT_EVENT] = std::bind(&MissionState::MediaReportHandle, this, _1);
|
||||
|
|
|
@ -15,8 +15,13 @@
|
|||
#include "MissionStateMachine.h"
|
||||
#include "DataProcessing.h"
|
||||
#include "ILog.h"
|
||||
#include "IMcuManager.h"
|
||||
#include "IMissionManager.h"
|
||||
#include "IStateMachine.h"
|
||||
#include "McuAskBase.h"
|
||||
#include "MissionManagerMakePtr.h"
|
||||
#include "StatusCode.h"
|
||||
#include <memory>
|
||||
// #include "TopState.h"
|
||||
std::shared_ptr<MissionStateMachine> &MissionStateMachine::GetInstance(std::shared_ptr<MissionStateMachine> *impl)
|
||||
{
|
||||
|
|
|
@ -14,7 +14,8 @@
|
|||
*/
|
||||
#include "OnMissionState.h"
|
||||
#include "ILog.h"
|
||||
#include "IStorageManager.h"
|
||||
#include "IStateMachine.h"
|
||||
#include "MissionState.h"
|
||||
#include "MissionStateMachine.h"
|
||||
OnMissionState::OnMissionState() : MissionState("OnMissionState")
|
||||
{
|
||||
|
|
|
@ -12,10 +12,11 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "PirTriggeredMissionState.h"
|
||||
#include "ILog.h"
|
||||
#include "IStorageManager.h"
|
||||
#include "IStateMachine.h"
|
||||
#include "MissionState.h"
|
||||
#include "MissionStateMachine.h"
|
||||
#include "PirTriggeredMissionState.h"
|
||||
PirTriggeredMissionState::PirTriggeredMissionState() : MissionState("PirTriggeredMissionState")
|
||||
{
|
||||
// mEventHandle[InternalStateEvent::ANY_STATE_SD_STATUS_PERORIED] =
|
||||
|
|
|
@ -13,10 +13,18 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "SdCardHandleState.h"
|
||||
#include "DataProcessing.h"
|
||||
#include "IFilesManager.h"
|
||||
#include "ILog.h"
|
||||
#include "IMediaManager.h"
|
||||
#include "IMissionManager.h"
|
||||
#include "IStateMachine.h"
|
||||
#include "IStorageManager.h"
|
||||
#include "MissionStateMachine.h"
|
||||
#include "StatusCode.h"
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
using std::placeholders::_1;
|
||||
SdCardHandleState::SdCardHandleState() : State("SdCardHandleState"), mSdCardStatus(StorageEvent::END)
|
||||
{
|
||||
mEventHandle[InternalStateEvent::MEDIA_REPORT_EVENT] = std::bind(&SdCardHandleState::MediaReportHandle, this, _1);
|
||||
|
|
|
@ -13,6 +13,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "SetLedState.h"
|
||||
#include "IDeviceManager.h"
|
||||
#include "LedControl.h"
|
||||
#include "StatusCode.h"
|
||||
#include <memory>
|
||||
#include <string>
|
||||
SetLedState::SetLedState(const LedState &state, const unsigned int &keepAliveTime, const unsigned int &blinkPeriod)
|
||||
: mState(state), mKeepAliveTime(keepAliveTime), mBlinkPeriod(blinkPeriod)
|
||||
{
|
||||
|
|
|
@ -13,9 +13,14 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "StorageHandleState.h"
|
||||
#include "DataProcessing.h"
|
||||
#include "ILog.h"
|
||||
#include "IMediaManager.h"
|
||||
#include "IMissionManager.h"
|
||||
#include "IStateMachine.h"
|
||||
#include "IStorageManager.h"
|
||||
#include "MissionStateMachine.h"
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
StorageHandleState::StorageHandleState() : State("StorageHandleState")
|
||||
{
|
||||
mEventHandle[InternalStateEvent::STORAGE_HANDLE_STATE_INIT] =
|
||||
|
|
|
@ -13,10 +13,17 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "TestMissionState.h"
|
||||
#include "DataProcessing.h"
|
||||
#include "IAppManager.h"
|
||||
#include "ILog.h"
|
||||
#include "IMissionManager.h"
|
||||
#include "IStateMachine.h"
|
||||
#include "IStorageManager.h"
|
||||
#include "LedsHandle.h"
|
||||
#include "MissionState.h"
|
||||
#include "MissionStateMachine.h"
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
TestMissionState::TestMissionState() : MissionState("TestMissionState")
|
||||
{
|
||||
mEventHandle[InternalStateEvent::ANY_STATE_SD_STATUS_PERORIED] =
|
||||
|
|
|
@ -13,10 +13,19 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "TopState.h"
|
||||
#include "DataProcessing.h"
|
||||
#include "IDeviceManager.h"
|
||||
#include "ILog.h"
|
||||
#include "IMcuManager.h"
|
||||
#include "IMediaManager.h"
|
||||
#include "IMissionManager.h"
|
||||
#include "IStateMachine.h"
|
||||
#include "KeyControl.h"
|
||||
#include "McuMonitor.h"
|
||||
#include "MissionStateMachine.h"
|
||||
#include "StatusCode.h"
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
TopState::TopState() : State("TopState")
|
||||
{
|
||||
mEventHandle[InternalStateEvent::STORAGE_HANDLE_STATE_INIT] =
|
||||
|
|
|
@ -13,10 +13,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "UpgradeState.h"
|
||||
#include "DataProcessing.h"
|
||||
#include "IHuntingUpgrade.h"
|
||||
#include "ILog.h"
|
||||
#include "IMediaManager.h"
|
||||
#include "IStateMachine.h"
|
||||
#include "MissionStateMachine.h"
|
||||
#include <functional>
|
||||
UpgradeState::UpgradeState() : State("UpgradeState")
|
||||
{
|
||||
mEventHandle[InternalStateEvent::CHECK_UPGRADE_FILE] = std::bind(&UpgradeState::CheckUpgradeFileHandle, this, _1);
|
||||
|
|
|
@ -27,7 +27,7 @@ llvm-twine-local,\
|
|||
misc-confusable-identifiers,\
|
||||
misc-definitions-in-headers,\
|
||||
misc-header-include-cycle,\
|
||||
-misc-include-cleaner,\
|
||||
misc-include-cleaner,\
|
||||
misc-misleading-bidirectional,\
|
||||
misc-misleading-identifier,\
|
||||
misc-misplaced-const,\
|
||||
|
|
42
doc/clang-tidy_user_guide.md
Normal file
42
doc/clang-tidy_user_guide.md
Normal file
|
@ -0,0 +1,42 @@
|
|||
# 1. clang-tidy使用指南
|
||||
|
||||
   使用clang-tidy工具进行代码规范管理。
|
||||
1. 编译时实时报错;
|
||||
2. 指定自研源码检测;
|
||||
|
||||
## 1.1. 环境搭建
|
||||
|
||||
1. llvm使用cmake编译,cmake版本要求 3.20以上,此处使用cmake-3.27.4
|
||||
```
|
||||
// cmake源码目录://tools/cmake/cmake-3.27.4.tar.gz
|
||||
// cmake源码安装:
|
||||
tar zxvf cmake-3.27.4.tar.gz
|
||||
cd cmake-3.27.4/
|
||||
sudo apt-get install openssl // 如果执行./bootstrap提示缺少ssl相关资源,执行此安装命令
|
||||
./bootstrap
|
||||
make
|
||||
sudo make install
|
||||
```
|
||||
2. 安装llvm
|
||||
```
|
||||
// 下载源码
|
||||
git clone https://github.com/llvm/llvm-project.git
|
||||
cd llvm-project/
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86" -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra" ../llvm
|
||||
make -j8
|
||||
find ./ -name clang-tidy // 确认编译完成
|
||||
```
|
||||
|
||||
## 1.2. clang-tidy使用
|
||||
修改配置:< IPC-SDK >/build/global_config.cmake
|
||||
```
|
||||
# ------------ build clang-tools ------------ #
|
||||
if(${LINUX_TEST} MATCHES "true")
|
||||
set(CLANG_TIDY_SUPPORT "true") // 使能工具
|
||||
set(CLANG_FORMAT_SUPPORT "true")
|
||||
set(LLVM_PATH "/home/xiaojiazhu/project/tmp/llvm-project") // llvm安装目录
|
||||
endif()
|
||||
# ------------ build clang-tools end ------------ #
|
||||
```
|
54
doc/cmake_exploitReport.md
Normal file
54
doc/cmake_exploitReport.md
Normal file
|
@ -0,0 +1,54 @@
|
|||
# 1.cmake开发报告
|
||||
|
||||
## 1.1 前言
|
||||
该篇md用于ipc项目下log功能的cmakelist的开发报告,以阐述其功能和组成。
|
||||
|
||||
## 1.2 功能介绍
|
||||
* 设置库文件输出路径:`set(LIBRARY_OUTPUT_PATH ${LIBS_OUTPUT_PATH})`.
|
||||
该语句用于设置该功能的静态库的生成路径,其中`${LIBS_OUTPUT_PATH}`在/build/cmake/global_config.cmake被定义在项目根目录的/output_files/libs/。
|
||||
|
||||
* 添加实现功能的文件目录:`include_directories(./)`.
|
||||
该语句旨在向编译器告知该功能的实现文件和头文件的所在位置。
|
||||
|
||||
* 添加功能目录到搜索路径:`set(CMAKE_AUTOMOC ON);set(CMAKE_INCLUDE_CURRENT_DIR ON)`
|
||||
这些 CMake 命令支持自动处理 Qt moc(元对象编译器),并将当前目录设置为包含在包含文件的搜索路径中;在构建过程中自动运行Qt moc编译器,用于包含Q_OBJECT宏的任何源文件。这对于为信号和插槽生成必要的C++代码是必需的;该选项将当前源目录添加到包含文件的搜索路径中。这允许构建系统查找与正在编译的源文件位于同一目录中的头文件。
|
||||
|
||||
* 收集、生成头文件列表:`file(GLOB_RECURSE HEADER_FILES "*.h")`
|
||||
该语句的功能是搜索当前目录及其子目录中扩展名为 .h 的所有文件。生成的文件列表存储在 HEADER_FILES 变量中。
|
||||
|
||||
* 收集源文件列表:`aux_source_directory(. SRC_FILES)`
|
||||
在本语句中,aux_source_directory(.SRC_FILES) 从当前目录(由 .) 及其子目录中收集所有源文件(例如,.cpp 个文件),生成的文件列表存储在 SRC_FILES 变量中。
|
||||
|
||||
* 添加编译器标志和定义到当前目录及其子目录:`add_definitions("-fexceptions")`
|
||||
添加编译器标志`-fexceptions`以在代码中启用异常处理。此标志告诉编译器生成支持捕获和引发异常的代码。通过使用 add_definitions(),可以将特定的编译器标志或定义全局应用于项目或特定源文件。
|
||||
|
||||
* 创建静态库目标:`add_library(xlog STATIC ${SRC_FILES} ${HEADER_FILES})`
|
||||
在这种情况下,本语句使用提供的源文件和头文件列表创建一个名为“xlog”的静态库目标;`STATIC`关键字指定库将构建为静态库,这意味着库代码将在编译时直接链接到最终可执行文件中;`${SRC_FILES}`变量包含应编译并链接到库中的源文件(通常.cpp文件)的列表。${HEADER_FILES} 变量包含头文件(通常为 .h 文件)的列表,这些文件定义库使用的接口和声明。
|
||||
|
||||
## 1.3 总结
|
||||
该篇cmakelists.txt的主要用途是对ipc项目下xlog功能的显现文件的编译和汇总。
|
||||
|
||||
## 2.1 返回码管理库概述
|
||||
提供整个应用程序的返回码管理功能,例如:打印返回码的字符串含义。提供C语言接口,内部实现不限于C或者C++,形成项目内部唯一返回码标准。
|
||||
|
||||
## 2.2 功能介绍
|
||||
* 设置可执行文件的输出路径:`set(EXECUTABLE_OUTPUT_PATH ${EXEC_OUTPUT_PATH})`;`set(LIBRARY_OUTPUT_PATH ${LIBS_OUTPUT_PATH})`
|
||||
|
||||
* 引入头文件目录:`include_directories`。`include_directories`表示引入头文件搜索路径,当工程要用到某个头文件的时候,就会去该路径下搜索。
|
||||
|
||||
* 开启自动编译:`set(CMAKE_AUTOMOC ON)` `set(CMAKE_INCLUDE_CURRENT_DIR ON)`. 这段代码开启了 CMake 的元对象编译器、界面编译器和资源编译器自动编译,这样当项目使用了包含元对象的文件、界面文件和资源文件时 CMake 可以自动检测并编译。
|
||||
|
||||
* 查找在./src路径下的所有源文件:`aux_source_directory(./src SRC_FILES)` 。
|
||||
|
||||
* 设置ReturnCode地址:`set(TARGET_NAME ReturnCode)`。根据提供的源文件创建一个叫ReturnCode的静态库。然后将目标文件与库文件进行链接:`target_link_libraries(${TARGET_NAME} Log)`。
|
||||
|
||||
## 2.3 返回码test
|
||||
* 添加test文件到目录,本目录为测试代码目录,目录结构保持与源码目录结构一致。
|
||||
|
||||
* 在test各个文件夹里添加相对应的CMakeLists.txt文件,通过`add_subdirectory(utils)`添加与源码目录结构相对应的子文件夹。
|
||||
|
||||
* 在src文件夹下创建ReturnCodeTest.cpp,调用返回码管理接口。在根目录添加第三方库文件,存放需要用到的第三方库。
|
||||
|
||||
## 2.4 总结
|
||||
Cmake的语句都在CMakeLists.txt的文件中,Cmake运行之后就会产生想要的makefile文件,然后再直接make就可以编译出可执行程序。
|
||||
|
299
doc/cmake_guide.md
Normal file
299
doc/cmake_guide.md
Normal file
|
@ -0,0 +1,299 @@
|
|||
# 1. CMake构建工具使用
|
||||
|
||||
  SDK使用CMake工具构建。
|
||||
|
||||
## 1.1. 安装
|
||||
|
||||
```code
|
||||
详见://tools/cmake/Makefile
|
||||
$ cd tools/cmake
|
||||
$ make
|
||||
$ cmake --version
|
||||
cmake version 3.27.4
|
||||
```
|
||||
|
||||
## 1.2. SDK构建配置脚本
|
||||
|
||||
* build目录下是基本的配置脚本。
|
||||
|
||||
```code
|
||||
build/
|
||||
├── cmake
|
||||
│ ├── Makefile // 调用cmake命令生成Makefile文件;
|
||||
│ └── toolchain
|
||||
│ └── linux.toolchain.cmake // 工具链配置文件已经一些全局变量;
|
||||
├── global_config.cmake // 配置文件
|
||||
└── sdk_config.cmake // 配置文件
|
||||
```
|
||||
|
||||
### 1.2.1. //build/cmake/Makefile
|
||||
|
||||
  调用cmake命令生成Makefile文件。
|
||||
|
||||
```code
|
||||
all:
|
||||
@mkdir -p ../../cmake-shell;\ // 创建cmake输出目录,这一步很关键,所有cmake的中间文件都将会存放在此目录。
|
||||
cd ../../cmake-shell;\
|
||||
pwd;\
|
||||
# 调用cmake命令,并指定工具链配置文件,生成Makefile文件。
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE="./build/cmake/toolchain/linux.toolchain.cmake" ..;\
|
||||
cd ..
|
||||
clean:
|
||||
rm -rf ../../cmake-shell
|
||||
```
|
||||
|
||||
在根目录执行:make cmake 的时候,即是调用上述Makefile生成Makefile文件。
|
||||
|
||||
### 1.2.2. //build/cmake/toolchain/linux.toolchain.cmake
|
||||
|
||||
  工具链配置文件或者一些跨平台差异化的配置文件。该文件在//build/cmake/Makefile中被指定,当需要交叉编译时,此文件的变量需要被重新配置。
|
||||
|
||||
```code
|
||||
|
||||
INCLUDE(CMakeForceCompiler)
|
||||
|
||||
set(LINUX_TEST "true")
|
||||
set(CROSS_COMPILE_PREFIX "") // 工具链前缀
|
||||
set(CMAKE_C_COMPILER "${CROSS_COMPILE_PREFIX}gcc") // 配置工具链
|
||||
set(CMAKE_CXX_COMPILER "${CROSS_COMPILE_PREFIX}g++") // 配置工具链
|
||||
|
||||
# path to compiler and utilities
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
|
||||
# Name of the target platform
|
||||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
set(CMAKE_SYSTEM_PROCESSOR arm)
|
||||
|
||||
# Version of the system
|
||||
set(CMAKE_SYSTEM_VERSION 1)
|
||||
cmake_policy(SET CMP0011 NEW)
|
||||
cmake_policy(SET CMP0005 NEW)
|
||||
|
||||
add_definitions(-Wall -O2 -Os)
|
||||
add_definitions(-Wno-unused-local-typedefs)
|
||||
add_definitions(-Wstrict-aliasing -Wwrite-strings)
|
||||
|
||||
set(TOOLCHAIN_NAME arm-linux-gnueabihf)
|
||||
|
||||
set(TARGET_PLATFORM "linux") // 编译系统平台,Linux表示在PC的ubuntu系统上编译
|
||||
set(SUBMODULE_PATH_OF_IPC_SDK "") // 子仓库路面,此处为空,交叉编译时设置
|
||||
set(PLATFORM_PATH "${CMAKE_CURRENT_SOURCE_DIR}") // 平台路径
|
||||
set(TEST_COVERAGE "true") // 覆盖率报告开关
|
||||
add_definitions(-DPLATFORM_PATH=\"${PLATFORM_PATH}\") // 定义一个宏
|
||||
set(PROJECT_OUTPUT_FOLDER "output_files") // 编译的目标文件输出目录
|
||||
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_OUTPUT_FOLDER}")
|
||||
|
||||
... // 此处省略不同模块的配置参数,一般是一些宏定义;
|
||||
```
|
||||
|
||||
### 1.2.3. //CMakeLists.txt
|
||||
|
||||
  SDK跟目录下的第一个CMakeLists.txt文件,cmake命令执行的时候会指定根目录,到此目录下寻找CMakeLists.txt文件作为整个项目的构建起点。
|
||||
|
||||
## 1.3. 重要的配置
|
||||
|
||||
### 1.3.1. 目录设置
|
||||
|
||||
  目录结构都是通过.cmake脚本来配置的。
|
||||
|
||||
#### 1.3.1.1. 源码目录结构配置
|
||||
|
||||
详见://build/global_config.cmake
|
||||
|
||||
```code
|
||||
set(EXEC_OUTPUT_PATH "${PLATFORM_PATH}/${PROJECT_OUTPUT_FOLDER}/bin")
|
||||
set(LIBS_OUTPUT_PATH "${PLATFORM_PATH}/${PROJECT_OUTPUT_FOLDER}/libs")
|
||||
set(TEST_TOOLS_OUTPUT_PATH "${PLATFORM_PATH}/${PROJECT_OUTPUT_FOLDER}/libs/test_tools")
|
||||
set(EXTERNAL_LIBS_OUTPUT_PATH "${PLATFORM_PATH}/${PROJECT_OUTPUT_FOLDER}/libs/external")
|
||||
set(TEST_OUTPUT_PATH "${PLATFORM_PATH}/${PROJECT_OUTPUT_FOLDER}/test")
|
||||
|
||||
set(PROJECT_ROOT_PATH "${PLATFORM_PATH}")
|
||||
set(APPLICATION_SOURCE_PATH "${CMAKE_SOURCE_DIR_IPCSDK}/application") # 应用层目录
|
||||
set(MIDDLEWARE_SOURCE_PATH "${CMAKE_SOURCE_DIR_IPCSDK}/middleware") # 中间件层目录
|
||||
set(UTILS_SOURCE_PATH "${CMAKE_SOURCE_DIR_IPCSDK}/utils") # 工具层目录
|
||||
set(HAL_SOURCE_PATH "${CMAKE_SOURCE_DIR_IPCSDK}/hal") # 硬件抽象层目录
|
||||
set(TEST_SOURCE_PATH "${CMAKE_SOURCE_DIR_IPCSDK}/test") # 自动化测试代码/example目录
|
||||
set(EXTERNAL_SOURCE_PATH "${CMAKE_SOURCE_DIR_IPCSDK}/external") # 外部依赖库目录
|
||||
```
|
||||
|
||||
## 1.4. CMakeLists.txt基本语法
|
||||
|
||||
### 1.4.1. 概述
|
||||
|
||||
  概括性描述就是,只需要告诉CMakeLists.txt文件,构建时包含哪些配置文件,依赖的头文件目录,需要编译的源码文件,依赖的目标目录(如有),输出的目标,依赖的目标(一般是库),CMakeLists.txt即可生成一个Makefile代码来构建这个目标。
|
||||
|
||||
  整个SDK由很多的CMakeLists.txt文件组成,绝大多数的CMakeLists.txt文件负责把该目录的源码编译成一个库,SDK通过链接不同功能的库来构建不同的应用程序。
|
||||
|
||||
```code
|
||||
./application/CMakeLists.txt
|
||||
./application/HuntingCamera/CMakeLists.txt
|
||||
./CMakeLists.txt
|
||||
./hal/CMakeLists.txt
|
||||
./middleware/AppManager/CMakeLists.txt
|
||||
./middleware/CMakeLists.txt
|
||||
./test/all/CMakeLists.txt
|
||||
./test/application/CMakeLists.txt
|
||||
./test/application/HuntingCamera/CMakeLists.txt
|
||||
./test/application/MissionManager/CMakeLists.txt
|
||||
./test/application/MissionManager/tool/CMakeLists.txt
|
||||
./test/application/VersionReleaseTool/CMakeLists.txt
|
||||
./test/CMakeLists.txt
|
||||
./test/hal/CMakeLists.txt
|
||||
./test/hal/tool/CMakeLists.txt
|
||||
./test/middleware/AppManager/CMakeLists.txt
|
||||
./tools/clang-tidy/CMakeLists.txt
|
||||
./utils/CMakeLists.txt
|
||||
./utils/Config/CMakeLists.txt
|
||||
./utils/ConfigBase/CMakeLists.txt
|
||||
```
|
||||
|
||||
### 1.4.2. 一个CMakeLists.txt示例
|
||||
|
||||
  CMakeLists.txt可以通过调用一些shell脚本来完成除编译之外的其它工具,例如:格式化代码。
|
||||
|
||||
```code
|
||||
|
||||
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
|
||||
)
|
||||
|
||||
#do not rely on any other library
|
||||
#link_directories( // 该目标需要链接依赖的库的目录,因为是目标是库,无需链接,此设置无
|
||||
#)
|
||||
|
||||
aux_source_directory(./src SRC_FILES) // 需要编译的源码文件,此处是src目录下的所有文件
|
||||
|
||||
set(TARGET_NAME StatusCode) // 设置输出目标名称
|
||||
add_library(${TARGET_NAME} STATIC ${SRC_FILES})
|
||||
target_link_libraries(${TARGET_NAME} Log) // 该目标需要依赖的库,这一步很关键,cmake将会根据依赖关系自动去编译需要的依赖库;
|
||||
|
||||
if ("${COMPILE_IMPROVE_SUPPORT}" MATCHES "true")
|
||||
add_custom_target( // 静态检测代码
|
||||
StatusCode_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}/StatusCode
|
||||
)
|
||||
file(GLOB_RECURSE HEADER_FILES *.h)
|
||||
add_custom_target( // 格式化代码
|
||||
StatusCode_code_format
|
||||
COMMAND ${CLANG_FORMAT_EXE}
|
||||
-style=file
|
||||
-i ${SRC_FILES} ${HEADER_FILES}
|
||||
WORKING_DIRECTORY ${UTILS_SOURCE_PATH}/StatusCode
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET ${TARGET_NAME}
|
||||
PRE_BUILD
|
||||
COMMAND make StatusCode_code_check
|
||||
COMMAND make StatusCode_code_format
|
||||
WORKING_DIRECTORY ${PLATFORM_PATH}/cmake-shell/
|
||||
)
|
||||
endif()
|
||||
|
||||
define_file_name(${TARGET_NAME}) // 该函数实现log库打印时,可打印文件名
|
||||
|
||||
file(GLOB_RECURSE INSTALL_HEADER_FILES include/*.h)
|
||||
install(FILES ${INSTALL_HEADER_FILES} DESTINATION include) // 拷贝头文件到安装目录
|
||||
```
|
||||
|
||||
### 1.4.3. 通过CMakeLists.txt构建开源库
|
||||
|
||||
  通过CMakeLists.txt构建开源库,可以自动关联第三方的依赖库,编译的时候自动按需编译对应的开源库。
|
||||
|
||||
```code
|
||||
|
||||
include(${CMAKE_SOURCE_DIR_IPCSDK}/build/global_config.cmake)
|
||||
include(build/config_base.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
|
||||
${EXTERNAL_SOURCE_PATH}/libconfig/libconfig-1.7.3/lib
|
||||
)
|
||||
# link_directories(
|
||||
# ${EXTERNAL_SOURCE_PATH}/libconfig/libconfig-1.7.3/lib/.libs
|
||||
# )
|
||||
|
||||
aux_source_directory(./src SRC_FILES)
|
||||
|
||||
set(TARGET_NAME ConfigBase)
|
||||
add_library(${TARGET_NAME} STATIC ${SRC_FILES})
|
||||
target_link_libraries(${TARGET_NAME} StatusCode Log libconfig.a)
|
||||
|
||||
if ("${COMPILE_IMPROVE_SUPPORT}" MATCHES "true")
|
||||
add_custom_target(
|
||||
ConfigBase_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}/ConfigBase
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET ${TARGET_NAME}
|
||||
PRE_BUILD
|
||||
COMMAND make ConfigBase_code_check
|
||||
WORKING_DIRECTORY ${PLATFORM_PATH}/cmake-shell/
|
||||
)
|
||||
file(GLOB_RECURSE HEADER_FILES *.h)
|
||||
add_custom_target(
|
||||
ConfigBase_code_format
|
||||
COMMAND ${CLANG_FORMAT_EXE}
|
||||
-style=file
|
||||
-i ${SRC_FILES} ${HEADER_FILES}
|
||||
WORKING_DIRECTORY ${UTILS_SOURCE_PATH}/ConfigBase
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET ${TARGET_NAME}
|
||||
PRE_BUILD
|
||||
COMMAND make ConfigBase_code_check
|
||||
COMMAND make ConfigBase_code_format
|
||||
WORKING_DIRECTORY ${PLATFORM_PATH}/cmake-shell/
|
||||
)
|
||||
endif()
|
||||
|
||||
# build libconfig before make libConfigBase.a
|
||||
add_custom_command(
|
||||
# OUTPUT ${EXTERNAL_SOURCE_PATH}/libconfig/libconfig-1.7.3/lib/.libs/libconfig.a
|
||||
OUTPUT ${EXTERNAL_LIBS_OUTPUT_PATH}/libconfig.a // 创建这个开源库输出文件的生成方法
|
||||
COMMAND echo "Build libconfig-1.7.3. COMPILE_HOST = ${COMPILE_HOST}"
|
||||
# COMMAND tar zxvf libconfig-1.7.3.tar.gz
|
||||
COMMAND sh build_libconfig.sh ${TARGET_PLATFORM} ${COMPILE_HOST}
|
||||
# 把生成的开源库拷贝到输出目录
|
||||
COMMAND mv ${EXTERNAL_SOURCE_PATH}/libconfig/libconfig-1.7.3/lib/.libs/libconfig.a ${EXTERNAL_LIBS_OUTPUT_PATH}/libconfig.a
|
||||
WORKING_DIRECTORY ${EXTERNAL_SOURCE_PATH}/libconfig/
|
||||
)
|
||||
add_custom_target(
|
||||
libconfig.a // 创建一个库目标
|
||||
# DEPENDS ${EXTERNAL_SOURCE_PATH}/libconfig/libconfig-1.7.3/lib/.libs/libconfig.a
|
||||
DEPENDS ${EXTERNAL_LIBS_OUTPUT_PATH}/libconfig.a // 这个目标依赖开源库的编译输出文件
|
||||
)
|
||||
|
||||
define_file_name(${TARGET_NAME})
|
||||
config_owner(${TARGET_NAME})
|
||||
|
||||
file(GLOB_RECURSE INSTALL_HEADER_FILES include/*.h)
|
||||
install(FILES ${INSTALL_HEADER_FILES} DESTINATION include)
|
||||
```
|
1103
doc/design.md
Normal file
1103
doc/design.md
Normal file
File diff suppressed because it is too large
Load Diff
111
doc/develop_standard.md
Normal file
111
doc/develop_standard.md
Normal file
|
@ -0,0 +1,111 @@
|
|||
# 1. SDK开发规范
|
||||
|
||||
## 1.1. 编码规范
|
||||
|
||||
### 1.1.1. 指针/智能指针
|
||||
|
||||
* C++编码只能使用智能指针;
|
||||
* 指针遵循谁使用谁进行“非空”判断,且无比使用前进行“非空”判断;
|
||||
* 智能指针经过转换后务必进行“非空”判断;
|
||||
|
||||
理论上,**明显不可能为空的指针,可以不进行“非空”判断**,可以不进行“非空”判断的场景:
|
||||
|
||||
```
|
||||
void McuManagerImpl::OtherSideSendIpcMission(const unsigned int &serialNumber, const unsigned char &mission)
|
||||
{
|
||||
class McuRecvIpcMission : public McuRecvImpl, public McuRecv<unsigned char>
|
||||
{
|
||||
public:
|
||||
McuRecvIpcMission(std::shared_ptr<McuManagerImpl> &mcuManager, const unsigned int &serialNumber,
|
||||
const OtherSideSendType &sendType, const unsigned char &mission)
|
||||
: McuRecvImpl(serialNumber, sendType)
|
||||
{
|
||||
McuRecv::mDataRecvReply = mission;
|
||||
McuRecvImpl::mMcuManager = mcuManager;
|
||||
}
|
||||
~McuRecvIpcMission() = default;
|
||||
void ReplyFinished(const bool result) override
|
||||
{
|
||||
// 此处可以不进行“非空”判断,该值在有限范围内(OtherSideSendIpcMission函数内部)就能看出是否为空
|
||||
McuRecvImpl::mMcuManager->ReplyOtherSideSendIpcMission(ASK_RESULT::SUCCEED, McuRecvImpl::mSerialNumber);
|
||||
}
|
||||
};
|
||||
std::shared_ptr<VMcuMonitor> monitor = GetMcuMonitor();
|
||||
std::shared_ptr<McuManagerImpl> manager = std::dynamic_pointer_cast<McuManagerImpl>(SharedFromThis());
|
||||
std::shared_ptr<VMcuRecv> recv =
|
||||
std::make_shared<McuRecvIpcMission>(manager, serialNumber, OtherSideSendType::SEND_IPC_MISSION, mission);
|
||||
if (monitor) {
|
||||
monitor->RecvIpcMissionEvent(recv, static_cast<IpcMission>(mission));
|
||||
}
|
||||
else {
|
||||
LogWarning("mMonitor is nullptr, AddMcuRecv.\n");
|
||||
AddMcuRecv(recv);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**没有进行“非空”判断的代码,应该开发测试用例,保证“空指针”的报错。**
|
||||
|
||||
### 1.1.2. 注释
|
||||
|
||||
* 注释必须使用英文,且使用翻译器翻译;
|
||||
  避免编码问题导致的乱码,且需要保证阅读困难时可使用翻译器翻译成可读的中文;
|
||||
|
||||
**注:** 注释翻译工具使用[百度翻译](https://fanyi.baidu.com/);翻译的注释在使用doxygen工具生成接口文档时,在网页上方便翻译成中文。
|
||||
|
||||
### 1.1.3. C++继承
|
||||
|
||||
* 子类使用父类的函数时,函数前必须加父类名,降低阅读难度,没有父类名的一律为本类函数(有可能是虚函数);
|
||||
|
||||
### 1.1.4. 变量命名
|
||||
|
||||
#### 1.1.4.1. 结构体/类成员
|
||||
|
||||
* 结构体和类成员必须要使用驼峰命名法,且首字母必须为m表示成员变量;
|
||||
|
||||
```
|
||||
typedef struct app_get_product_info
|
||||
{
|
||||
app_get_product_info();
|
||||
std::string mModel;
|
||||
std::string mCompany;
|
||||
std::string mSoc;
|
||||
std::string mSp;
|
||||
} AppGetProductInfo;
|
||||
```
|
||||
|
||||
### 1.1.5. 文件命名
|
||||
|
||||
* 文件名必须使用驼峰命名法,且首字母大写;
|
||||
|
||||
### 1.1.6. 代码排版
|
||||
|
||||
* 使用统一标准的代码排版风格,保持多人开发时代码的整洁,避免因为排版(特别是编辑工具的自动排版功能)导致每次提交时都产生大量的排版修改,影响后续代码异常排查;
|
||||
|
||||
  请使用仓库跟目录下.clang-format配置文件进行排版,如果使用vscode编辑器开发代码,可直接使用快捷键ctrl+alt+f进行排版;也可以使用构建脚本对代码进行排版。
|
||||
|
||||
**对发生修改的代码进行格式化:**
|
||||
|
||||
```code
|
||||
$ make cmake // 在仓库根目录执行,对发生修改的文件创建格式化命令
|
||||
$ cd cmake-shell/
|
||||
$ make improve_modified_code // 文件格式化命令,统一排版,此命名只对发生修改的文件进行格式化
|
||||
```
|
||||
|
||||
**对全部文件进行格式化:**
|
||||
|
||||
```code
|
||||
详见配置文件://build/global_config.cmake
|
||||
把 COMPILE_IMPROVE_SUPPORT 设置为 true 时,将会在每次编译代码时进行格式化。
|
||||
if(${LINUX_TEST} MATCHES "true")
|
||||
set(CLANG_TIDY_SUPPORT "true")
|
||||
set(CLANG_FORMAT_SUPPORT "true")
|
||||
set(COMPILE_IMPROVE_SUPPORT "false") # 开启后每次编译可能会很慢
|
||||
set(LLVM_PATH "$ENV{HOME}/llvm-project")
|
||||
endif()
|
||||
```
|
||||
|
||||
### 1.1.7. 函数
|
||||
|
||||
* 单个函数代码行控制在50行内,阅读时无需上下滚动去理解代码逻辑;极少数初始化数据的无逻辑推理的代码除外;
|
||||
* 函数参数不能超过10个;
|
21
doc/doxygen_user_guide.md
Normal file
21
doc/doxygen_user_guide.md
Normal file
|
@ -0,0 +1,21 @@
|
|||
# 1. Linux嵌入式项目使用Doxygen生成API文档
|
||||
|
||||
## 1.1. Doxygen简介
|
||||
|
||||
  Doxygen是一个开源的文档生成工具,可以用来生成项目源代码的API文档。
|
||||
|
||||
## 1.2. Doxygen安装
|
||||
|
||||
  Doxygen安装非常简单,直接在官网下载最新版本即可。
|
||||
|
||||
```
|
||||
$ sudo apt-get install doxygen
|
||||
```
|
||||
|
||||
## 1.3. 安装Graphviz
|
||||
|
||||
  Doxygen本身不直接支持画图功能,但它可以生成DOT格式的图形描述文件,然后使用Graphviz工具进行渲染。
|
||||
|
||||
```
|
||||
$ sudo apt-get install graphviz
|
||||
```
|
209
doc/gdb_coredump_guide.md
Normal file
209
doc/gdb_coredump_guide.md
Normal file
|
@ -0,0 +1,209 @@
|
|||
# 1. gdb coredump分析
|
||||
|
||||
  本文介绍ubuntu系统环境下coredump文件的分析方法。
|
||||
|
||||
**一个coredump示例:**
|
||||
|
||||
```
|
||||
$ ../output_files/test/bin/McuManagerTest --gtest_filter=McuManagerTest.RH_INTEGRATION_McuManager_AUTO_OtherSideSendIpcMission
|
||||
Note: Google Test filter = McuManagerTest.RH_INTEGRATION_McuManager_AUTO_OtherSideSendIpcMission
|
||||
[==========] Running 1 test from 1 test suite.
|
||||
[----------] Global test environment set-up.
|
||||
[----------] 1 test from McuManagerTest
|
||||
NewLog succeed.
|
||||
LogImplInit
|
||||
[ RUN ] McuManagerTest.RH_INTEGRATION_McuManager_AUTO_OtherSideSendIpcMission
|
||||
2024-05-15 17:43:04,782 INFO [default] [McuManagerMakePtr.cpp:23]:CreateMcuManager is ok.
|
||||
|
||||
2024-05-15 17:43:04,783 INFO [default] [IMcuManager.cpp:72]:Instance changed succeed.
|
||||
|
||||
2024-05-15 17:43:04,783 INFO [default] [UartDeviceImpl.cpp:277]:Create the uart device object.
|
||||
|
||||
Can't Open Serial Port: No such file or directory
|
||||
2024-05-15 17:43:04,784 ERROR [default] [McuDevice.cpp:51]:IUartOpen failed.
|
||||
|
||||
2024-05-15 17:43:04,787 INFO [default] [UartDeviceImpl.cpp:277]:Create the uart device object.
|
||||
|
||||
Can't Open Serial Port: No such file or directory
|
||||
2024-05-15 17:43:04,787 ERROR [default] [McuDevice.cpp:51]:IUartOpen failed.
|
||||
|
||||
terminate called without an active exception
|
||||
Aborted (core dumped)
|
||||
```
|
||||
|
||||
## 1.1. coredump文件生成路径查询
|
||||
|
||||
```
|
||||
$ cat /proc/sys/kernel/core_pattern
|
||||
|/usr/share/apport/apport -p%p -s%s -c%c -d%d -P%P -u%u -g%g -- %E
|
||||
```
|
||||
|
||||
修改coredump文件生成路径:
|
||||
|
||||
```
|
||||
$ sudo sh -c 'echo /home/xiaojiazhu/project/rkipc/battery/ipc-rk1106/ipc-sdk/cmake-shell/core.%e.%p > /proc/sys/kernel/core_pattern'
|
||||
$ cat /proc/sys/kernel/core_pattern
|
||||
/home/xiaojiazhu/project/rkipc/battery/ipc-rk1106/ipc-sdk/cmake-shell/core.%e.%p
|
||||
```
|
||||
命令:
|
||||
sudo sh -c 'echo /path/core.%e.%p > /proc/sys/kernel/core_pattern'
|
||||
|
||||
例如:
|
||||
```
|
||||
sudo sh -c 'echo /home/xiaojiazhu/project/rkipc/battery/ipc-rk1106/ipc-sdk/cmake-shell/core.%e.%p > /proc/sys/kernel/core_pattern'
|
||||
```
|
||||
|
||||
**发现路径下并未生成coredump文件**
|
||||
|
||||
```
|
||||
$ ulimit -a
|
||||
core file size (blocks, -c) 0 // 0表示终端未开启core dump
|
||||
data seg size (kbytes, -d) unlimited
|
||||
scheduling priority (-e) 0
|
||||
file size (blocks, -f) unlimited
|
||||
pending signals (-i) 63499
|
||||
max locked memory (kbytes, -l) 65536
|
||||
max memory size (kbytes, -m) unlimited
|
||||
open files (-n) 1024
|
||||
pipe size (512 bytes, -p) 8
|
||||
POSIX message queues (bytes, -q) 819200
|
||||
real-time priority (-r) 0
|
||||
stack size (kbytes, -s) 8192
|
||||
cpu time (seconds, -t) unlimited
|
||||
max user processes (-u) 63499
|
||||
virtual memory (kbytes, -v) unlimited
|
||||
file locks (-x) unlimited
|
||||
```
|
||||
|
||||
解决:
|
||||
```
|
||||
$ ulimit -c unlimited
|
||||
```
|
||||
|
||||
sudo echo /home/xiaojiazhu/project/rkipc/battery/ipc-rk1106/ipc-sdk/cmake-shell/core.%e.%p > /proc/sys/kernel/core_pattern
|
||||
|
||||
## 1.2. gdb查看堆栈信息
|
||||
|
||||
**Ubuntu系统需要加sudo执行程序才会生成coredump文件。**
|
||||
|
||||
### 1.2.1. 无法识别coredump文件
|
||||
|
||||
  在gdb中无法识别coredump文件,如下所示:
|
||||
|
||||
```
|
||||
$ sudo gdb ../output_files/test/bin/McuManagerTest core.smbd.3390383
|
||||
[sudo] password for xiaojiazhu:
|
||||
Sorry, try again.
|
||||
[sudo] password for xiaojiazhu:
|
||||
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.1) 9.2
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
|
||||
This is free software: you are free to change and redistribute it.
|
||||
There is NO WARRANTY, to the extent permitted by law.
|
||||
Type "show copying" and "show warranty" for details.
|
||||
This GDB was configured as "x86_64-linux-gnu".
|
||||
Type "show configuration" for configuration details.
|
||||
For bug reporting instructions, please see:
|
||||
<http://www.gnu.org/software/gdb/bugs/>.
|
||||
Find the GDB manual and other documentation resources online at:
|
||||
<http://www.gnu.org/software/gdb/documentation/>.
|
||||
|
||||
For help, type "help".
|
||||
Type "apropos word" to search for commands related to "word"...
|
||||
Reading symbols from ../output_files/test/bin/McuManagerTest...
|
||||
|
||||
warning: core file may not match specified executable file. // 表示coredump文件与可执行文件不匹配
|
||||
[New LWP 3390383]
|
||||
Core was generated by `/usr/sbin/smbd --foreground --no-process-group'.
|
||||
Program terminated with signal SIGABRT, Aborted.
|
||||
#0 0x00007fd59718600b in ?? ()
|
||||
(gdb) bt
|
||||
#0 0x00007fd59718600b in ?? ()
|
||||
#1 0x0000000000001c80 in ?? ()
|
||||
#2 0x0000000000000000 in ?? ()
|
||||
```
|
||||
|
||||
由于gdb和asan同时启用会冲突,导致无法识别coredump文件。解决办法如下:
|
||||
|
||||
修改://build/sdk_config.cmake
|
||||
|
||||
```
|
||||
# Gdb debug
|
||||
if(${TARGET_PLATFORM} MATCHES ${DEFINE_LINUX})
|
||||
message("---------------------------Debug mode.-----------------------")
|
||||
SET(CMAKE_BUILD_TYPE "Debug")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -Wall -g -ggdb")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -Wall -g -ggdb")
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g -ggdb")
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")
|
||||
# asan
|
||||
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=leak -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined")
|
||||
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=leak -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined")
|
||||
else()
|
||||
message("---------------------------Release mode.-----------------------")
|
||||
SET(CMAKE_BUILD_TYPE "Release")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Os")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Os")
|
||||
endif()
|
||||
```
|
||||
|
||||
解决后:
|
||||
|
||||
```
|
||||
$ sudo gdb ../output_files/test/bin/McuManagerTest core.McuManagerTest.3406751
|
||||
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.1) 9.2
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
|
||||
This is free software: you are free to change and redistribute it.
|
||||
There is NO WARRANTY, to the extent permitted by law.
|
||||
Type "show copying" and "show warranty" for details.
|
||||
This GDB was configured as "x86_64-linux-gnu".
|
||||
Type "show configuration" for configuration details.
|
||||
For bug reporting instructions, please see:
|
||||
<http://www.gnu.org/software/gdb/bugs/>.
|
||||
Find the GDB manual and other documentation resources online at:
|
||||
<http://www.gnu.org/software/gdb/documentation/>.
|
||||
|
||||
For help, type "help".
|
||||
Type "apropos word" to search for commands related to "word"...
|
||||
Reading symbols from ../output_files/test/bin/McuManagerTest...
|
||||
[New LWP 3406751]
|
||||
[New LWP 3406753]
|
||||
[New LWP 3406752]
|
||||
[Thread debugging using libthread_db enabled]
|
||||
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
|
||||
Core was generated by `../output_files/test/bin/McuManagerTest --gtest_filter=McuManagerTest.RH_INTEGR'.
|
||||
Program terminated with signal SIGABRT, Aborted.
|
||||
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
|
||||
50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
|
||||
[Current thread is 1 (Thread 0x7fd355968740 (LWP 3406751))]
|
||||
(gdb) bt
|
||||
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
|
||||
#1 0x00007fd35598f859 in __GI_abort () at abort.c:79
|
||||
#2 0x00007fd355d678d1 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
|
||||
#3 0x00007fd355d7337c in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
|
||||
#4 0x00007fd355d733e7 in std::terminate() () from /lib/x86_64-linux-gnu/libstdc++.so.6
|
||||
#5 0x000055c247b3ae41 in std::thread::operator= (__t=..., this=0x55c248d19748) at /usr/include/c++/9/thread:152
|
||||
#6 McuProtocol::Init (this=this@entry=0x55c248d196f8) at /home/xiaojiazhu/project/rkipc/battery/ipc-rk1106/ipc-sdk/utils/McuProtocol/src/McuProtocol.cpp:58
|
||||
#7 0x000055c247b03e57 in McuManagerImpl::Init (this=0x55c248d19680)
|
||||
at /home/xiaojiazhu/project/rkipc/battery/ipc-rk1106/ipc-sdk/middleware/McuManager/src/McuManagerImpl.cpp:46
|
||||
#8 0x000055c247acd3d4 in McuManagerTest::McuManagerTest_RH_INTEGRATION_McuManager_AUTO_OtherSideSendIpcMission_Test::TestBody (this=<optimized out>)
|
||||
at /usr/include/c++/9/bits/shared_ptr_base.h:1020
|
||||
#9 0x000055c247b303fd in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) () at /home/xiaojiazhu/project/rkipc/battery/ipc-rk1106/ipc-sdk/utils/McuProtocol/./include/McuProtocol.h:121
|
||||
#10 0x000055c247b23343 in testing::Test::Run() () at /home/xiaojiazhu/project/rkipc/battery/ipc-rk1106/ipc-sdk/utils/McuProtocol/./include/McuProtocol.h:121
|
||||
#11 0x000055c247b2342b in testing::TestInfo::Run() ()
|
||||
at /home/xiaojiazhu/project/rkipc/battery/ipc-rk1106/ipc-sdk/utils/McuProtocol/./include/McuProtocol.h:121
|
||||
#12 0x000055c247b2376e in testing::TestSuite::Run() ()
|
||||
at /home/xiaojiazhu/project/rkipc/battery/ipc-rk1106/ipc-sdk/utils/McuProtocol/./include/McuProtocol.h:121
|
||||
#13 0x000055c247b2a0fa in testing::internal::UnitTestImpl::RunAllTests() ()
|
||||
at /home/xiaojiazhu/project/rkipc/battery/ipc-rk1106/ipc-sdk/utils/McuProtocol/./include/McuProtocol.h:121
|
||||
#14 0x000055c247b3085e in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) ()
|
||||
at /home/xiaojiazhu/project/rkipc/battery/ipc-rk1106/ipc-sdk/utils/McuProtocol/./include/McuProtocol.h:121
|
||||
#15 0x000055c247b23529 in testing::UnitTest::Run() ()
|
||||
at /home/xiaojiazhu/project/rkipc/battery/ipc-rk1106/ipc-sdk/utils/McuProtocol/./include/McuProtocol.h:121
|
||||
#16 0x000055c247ac9287 in RUN_ALL_TESTS ()
|
||||
at /home/xiaojiazhu/project/rkipc/battery/ipc-rk1106/ipc-sdk/external/gtest/googletest-release-1.11.0/googletest/include/gtest/gtest.h:2490
|
||||
#17 main (argc=<optimized out>, argv=<optimized out>)
|
||||
at /home/xiaojiazhu/project/rkipc/battery/ipc-rk1106/ipc-sdk/test/middleware/McuManager/mainTest.cpp:22
|
||||
(gdb)
|
||||
```
|
20
doc/huntting_project_report.md
Normal file
20
doc/huntting_project_report.md
Normal file
|
@ -0,0 +1,20 @@
|
|||
# 1. 项目进度汇总
|
||||
|
||||
## 1.1. 软件开发进度
|
||||
|
||||
```mermaid
|
||||
gantt
|
||||
dateFormat YYYY-MM-DD
|
||||
title 软件进度-3月
|
||||
section 3月
|
||||
6帧探RTSP推流 : done, rtsp_media, 2024-03-18,3d
|
||||
SC230AI快启验证(快启报错) : crit, active, 2024-03-21,3d
|
||||
6帧探视频回放 : active, 2024-03-25,3d
|
||||
```
|
||||
|
||||
### 1.1.1. 总结
|
||||
|
||||
* 截至2024-3-25:
|
||||
1. 6侦探协议框架含http和tcp,http协议框架开发完成,rtsp推流到手机APP完成;
|
||||
2. 存在问题:rtsp推流存在卡顿问题,待优化;
|
||||
3. 更换SC230AI调试快启,快启报错,需要提问题单找原厂协助;
|
101
doc/markdown_user_guide.md
Normal file
101
doc/markdown_user_guide.md
Normal file
|
@ -0,0 +1,101 @@
|
|||
# 1. Markdown使用手册
|
||||
|
||||
## 1.1. 概述
|
||||
|
||||
使用markdown编辑开发文档有以下好处:
|
||||
|
||||
* markdown语法是一种语言,类似代码一样可以方便git管理,查看修改记录;
|
||||
* 对代码显示支持良好;
|
||||
* 可以进行UML类图和时序图的编辑/迭代/维护(强烈推荐);
|
||||
|
||||
## 1.2. 如何使用Markdown
|
||||
|
||||
此处介绍基于vscode编辑环境下使用Markdown的方法:
|
||||
|
||||
* 首先安装vscode插件:
|
||||
1. Markdown All in One
|
||||
2. Markdown Preview Enhanced
|
||||
* 使用Markdown语法编辑开发文档,并使用vscode预览;
|
||||
* 右键使用浏览器打开并打印可生成PDF文档;
|
||||
|
||||
## 1.3. 基本语法介绍
|
||||
|
||||
提供常用语法参考,直接copy模块代码进行编辑。
|
||||
|
||||
### 1.3.1. 常用命令
|
||||
|
||||
```
|
||||
Markdown All in One: Create Table of Contents 创建目录
|
||||
Markdown All in One: Update Table of Contents 更新目录
|
||||
Markdown All in One: Add/Update section numbers 添加 / 更新章节编号
|
||||
Markdown All in One: Remove section numbers 删除章节编号
|
||||
Markdown All in One: Toggle code span 触发设置代码范围(`code`)
|
||||
Markdown All in One: Toggle code block 触发设置代码块(```codes```)
|
||||
Markdown All in One: Print current document to HTML
|
||||
Markdown All in One: Toggle math environment 触发设置数学环境
|
||||
Markdown All in One: Toggle list 触发设置列表环境
|
||||
```
|
||||
|
||||
### 1.3.2. 代码段
|
||||
|
||||
```
|
||||
/*This is your code.*/
|
||||
#include <stdio.h>
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
### 1.3.3. UML类图语法
|
||||
|
||||
```mermaid
|
||||
classDiagram
|
||||
Animal <|-- Fish:继承
|
||||
Animal <|.. Zebra:实现
|
||||
Animal : +int age
|
||||
Animal : +String gender
|
||||
Animal: +isMammal()
|
||||
Animal: +mate()
|
||||
class Animal{
|
||||
<<interface>>
|
||||
+call() int
|
||||
}
|
||||
class Fish{
|
||||
-int sizeInFeet
|
||||
-canEat()
|
||||
}
|
||||
class Zebra{
|
||||
<<class>>
|
||||
-func(int, int) int
|
||||
+bool is_wild
|
||||
+run(void)
|
||||
}
|
||||
```
|
||||
|
||||
实现:一般指对抽象类的实例类 \
|
||||
继承:一般指对普通功能基类的派生/重载
|
||||
|
||||
### 1.3.4. UML时序图
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
Alice->>+Jhon:Call function
|
||||
Jhon->>Jhon:handle
|
||||
Jhon-->>-Alice:Call return
|
||||
note left of Alice:function
|
||||
|
||||
Alice->>+Jhon:Call function
|
||||
Jhon->>+Fancy:Call
|
||||
Fancy-->>-Jhon:Call return
|
||||
Jhon-->>-Alice:Call return
|
||||
|
||||
Alice->>+Jhon:Call function
|
||||
Jhon->>+Fancy:Call
|
||||
Fancy->>-Fancy:End
|
||||
Jhon-->>-Alice:Call return
|
||||
```
|
||||
|
||||
### 1.3.5. 踩坑记录
|
||||
|
||||
1. 状态图不能使用default关键字作为一个状态名称,无法画图;
|
9
doc/sdk_build_guide.md
Normal file
9
doc/sdk_build_guide.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
# 1. SDK构建设计文档
|
||||
|
||||
## 1.1. 概述
|
||||
|
||||
  SDK使用cmake构建,把分层解耦合的独立模块编译成静态库,应用程序根据依赖关系进行自动关联链接。
|
||||
|
||||
## 1.2. 启用/禁用功能模块
|
||||
|
||||
  根据不同的产品需求来启用/禁用功能模块,避免编译不需要的模块。
|
89
doc/vscode_ssh_guide.md
Normal file
89
doc/vscode_ssh_guide.md
Normal file
|
@ -0,0 +1,89 @@
|
|||
# 1. vscode使用ssh链接虚拟机服务器
|
||||
|
||||
# 2. 前言
|
||||
|
||||
   在vscode使用ssh工具远程登录虚拟机服务器进行代码编辑。
|
||||
|
||||
| 内容 | 时间 | 作者 | 备注 |
|
||||
|----|----|----|----|
|
||||
| 首版 | 2024-2-26 | xjz | - |
|
||||
|
||||
## 2.1. Windows系统
|
||||
|
||||
* 安装ssh
|
||||
|
||||
   直接安装git工具即可支持ssh
|
||||
|
||||
安装完后确认:
|
||||
```
|
||||
xiaojiazhu@ubuntu:~/project/rkipc/battery/ipc-rk1106/ipc-sdk/cmake-shell$ ssh
|
||||
usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface]
|
||||
[-b bind_address] [-c cipher_spec] [-D [bind_address:]port]
|
||||
[-E log_file] [-e escape_char] [-F configfile] [-I pkcs11]
|
||||
[-i identity_file] [-J [user@]host[:port]] [-L address]
|
||||
[-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
|
||||
[-Q query_option] [-R address] [-S ctl_path] [-W host:port]
|
||||
[-w local_tun[:remote_tun]] destination [command]
|
||||
```
|
||||
|
||||
* vscode安装ssh插件
|
||||
|
||||
   使用 Remote - SSH 插件
|
||||
|
||||
* ssh密钥配置
|
||||
|
||||
1. Windows生成密钥;
|
||||
2. 把xxx.pub文件内容拷贝到虚拟机的ssh目录下的authorized_keys文件;
|
||||
此处是:
|
||||
|
||||
```
|
||||
xiaojiazhu@ubuntu:~/project/.ssh$ pwd
|
||||
/home/xiaojiazhu/project/.ssh
|
||||
xiaojiazhu@ubuntu:~/project/.ssh$ ls
|
||||
authorized_keys id_rsa id_rsa.pub
|
||||
```
|
||||
|
||||
这样设置后,每次登录ssh无需手动输入密码;
|
||||
|
||||
3. 在Windows远程登录虚拟机:
|
||||
|
||||
参考命令:ssh xiaojiazhu@192.168.1.29
|
||||
|
||||
```
|
||||
PS C:\Users\xjz\.ssh> ssh xiaojiazhu@192.168.1.29
|
||||
Welcome to Ubuntu 20.04.6 LTS (GNU/Linux 5.15.0-94-generic x86_64)
|
||||
|
||||
* Documentation: https://help.ubuntu.com
|
||||
* Management: https://landscape.canonical.com
|
||||
* Support: https://ubuntu.com/advantage
|
||||
|
||||
Expanded Security Maintenance for Applications is not enabled.
|
||||
|
||||
75 updates can be applied immediately.
|
||||
To see these additional updates run: apt list --upgradable
|
||||
|
||||
9 additional security updates can be applied with ESM Apps.
|
||||
Learn more about enabling ESM Apps service at https://ubuntu.com/esm
|
||||
|
||||
New release '22.04.3 LTS' available.
|
||||
Run 'do-release-upgrade' to upgrade to it.
|
||||
|
||||
Your Hardware Enablement Stack (HWE) is supported until April 2025.
|
||||
*** System restart required ***
|
||||
Last login: Sun Feb 25 17:20:04 2024 from 192.168.1.29
|
||||
xiaojiazhu@ubuntu:~$
|
||||
```
|
||||
## 2.2. vscode设置
|
||||
|
||||
配置文件参考
|
||||
|
||||
```
|
||||
Host dgiot // 自定义的主机名
|
||||
HostName 192.168.1.29 // 远端的IP地址
|
||||
User xiaojiazhu 用户名
|
||||
Port 22
|
||||
IdentityFile "C:\Users\xjz\.ssh\id_ed25519" // 本端的私钥文件路径
|
||||
ForwardAgent yes // 忽略
|
||||
```
|
||||
|
||||
多个远端IP复制即可。
|
3
external/CMakeLists.txt
vendored
3
external/CMakeLists.txt
vendored
|
@ -20,4 +20,5 @@ add_subdirectory(httpserver.h-master/src)
|
|||
|
||||
add_subdirectory(cJSON-1.7.17)
|
||||
add_subdirectory(libhv/libhv-1.3.2)
|
||||
add_subdirectory(ffmpeg)
|
||||
add_subdirectory(ffmpeg)
|
||||
add_subdirectory(libconfig)
|
5
external/ffmpeg/CMakeLists.txt
vendored
5
external/ffmpeg/CMakeLists.txt
vendored
|
@ -1,11 +1,6 @@
|
|||
|
||||
|
||||
add_custom_target(
|
||||
ffmpeg
|
||||
# DEPENDS ${EXTERNAL_LIBS_OUTPUT_PATH}/libgo.a
|
||||
# COMMAND mkdir ${GOAHEAD_UPLOAD_TMP_PATH}
|
||||
# COMMAND cp ${EXTERNAL_SOURCE_PATH}/goahead-5.2.0/modify/http.c ${EXTERNAL_SOURCE_PATH}/goahead-5.2.0/GoAhead/src
|
||||
# COMMAND touch ${EXTERNAL_SOURCE_PATH}/goahead-5.2.0/GoAhead/src/http.c
|
||||
COMMAND test -f ${EXTERNAL_SOURCE_PATH}/ffmpeg/Makefile || tar -xf ffmpeg_6.1.1.orig.tar.xz
|
||||
COMMAND chmod 777 -R ffmpeg-6.1.1
|
||||
COMMAND cd ffmpeg-6.1.1 && ./configure --enable-cross-compile --target-os=linux --arch=arm64
|
||||
|
|
26
external/libconfig/CMakeLists.txt
vendored
Normal file
26
external/libconfig/CMakeLists.txt
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
set(LIBCONFIG_INSTALL_PATH "${EXTERNAL_LIBS_OUTPUT_PATH}/libconfig")
|
||||
if(${TARGET_PLATFORM} MATCHES ${DEFINE_LINUX})
|
||||
set(CONFIGURE_COMMAND "--disable-cxx --enable-static=yes --prefix=${LIBCONFIG_INSTALL_PATH}")
|
||||
else()
|
||||
set(CONFIGURE_COMMAND "--host=${COMPILE_HOST} --disable-cxx --enable-static=yes --prefix=${LIBCONFIG_INSTALL_PATH}")
|
||||
endif()
|
||||
message("Compile libconfig comand : ${CONFIGURE_COMMAND}")
|
||||
add_custom_target(
|
||||
libconfig
|
||||
COMMAND test -f ${EXTERNAL_SOURCE_PATH}/libconfig-1.7.3/Makefile || tar zxvf libconfig-1.7.3.tar.gz
|
||||
COMMAND chmod 777 -R libconfig-1.7.3
|
||||
# COMMAND cd libconfig-1.7.3 && ./configure --disable-cxx --enable-static=yes --prefix=${LIBCONFIG_INSTALL_PATH}
|
||||
COMMAND cd libconfig-1.7.3 && bash -c "./configure ${CONFIGURE_COMMAND}"
|
||||
COMMAND cd libconfig-1.7.3 && make
|
||||
COMMAND cd libconfig-1.7.3 && make install
|
||||
COMMAND cd libconfig-1.7.3 && make clean
|
||||
WORKING_DIRECTORY ${EXTERNAL_SOURCE_PATH}/libconfig/
|
||||
)
|
||||
add_custom_target(
|
||||
remove_libconfig_source_files
|
||||
COMMAND rm -rf libconfig-1.7.3
|
||||
WORKING_DIRECTORY ${EXTERNAL_SOURCE_PATH}/libconfig/
|
||||
)
|
||||
|
||||
# 将clean目标依赖于我们自定义的clean_script目标
|
||||
add_dependencies(sdk_clean remove_libconfig_source_files)
|
|
@ -14,7 +14,10 @@
|
|||
*/
|
||||
#include "IHalCpp.h"
|
||||
#include "ILog.h"
|
||||
#include "StatusCode.h"
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
camera_report_event::camera_report_event(const std::string &fileName, const CameraType &cameraType)
|
||||
: mFileName(fileName), mCameraType(cameraType)
|
||||
{
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "CameraHal.h"
|
||||
#include "ILog.h"
|
||||
#include "IHalCpp.h"
|
||||
#include "StatusCode.h"
|
||||
CameraHal::CameraHal() : mTaskRuning(false), mAudioStreamCallback(nullptr), mVideoStreamCallback(nullptr)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -13,7 +13,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "Hal.h"
|
||||
#include "IHal.h"
|
||||
#include "ILog.h"
|
||||
#include "StatusCode.h"
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
StatusCode HalInit(IHal *hal)
|
||||
|
|
|
@ -14,9 +14,15 @@
|
|||
*/
|
||||
#include "HalCpp.h"
|
||||
#include "HalMakePtr.h"
|
||||
#include "IHalCpp.h"
|
||||
#include "ILog.h"
|
||||
#include "SdCardHal.h"
|
||||
#include "StatusCode.h"
|
||||
#include "WifiHal.h"
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
StatusCode HalCpp::Init(void)
|
||||
{
|
||||
LogInfo("HalCpp::Init\n");
|
||||
|
|
|
@ -15,14 +15,21 @@
|
|||
#include "HalMakePtr.h"
|
||||
#include "Hal.h"
|
||||
#include "HalCpp.h"
|
||||
#include "IHal.h"
|
||||
#include "IHalCpp.h"
|
||||
#include "ILog.h"
|
||||
#include "KeyControl.h"
|
||||
#include "LedControl.h"
|
||||
#include "SdCardHal.h"
|
||||
#include "StatusCode.h"
|
||||
#include "WifiHal.h"
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
StatusCode CreateHalModule(void)
|
||||
{
|
||||
IHal *hal = NULL;
|
||||
IHal *hal = nullptr;
|
||||
StatusCode code = HalMakePtr::GetInstance()->CreateHalPtr(&hal);
|
||||
if (IsCodeOK(code) && NULL != hal) {
|
||||
if (IsCodeOK(code) && nullptr != hal) {
|
||||
LogInfo("Create Hal instance ok.\n");
|
||||
ResetHalImpl((IHal *)hal);
|
||||
}
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
#define HALMAKEPTR_H
|
||||
#include "IHal.h"
|
||||
#include "IHalCpp.h"
|
||||
#include "StatusCode.h"
|
||||
#include "KeyControl.h"
|
||||
#include "LedControl.h"
|
||||
#include "StatusCode.h"
|
||||
#include <memory>
|
||||
class HalMakePtr
|
||||
{
|
||||
|
|
|
@ -13,17 +13,19 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "SdCardHal.h"
|
||||
#include "IHalCpp.h"
|
||||
#include "ILog.h"
|
||||
#include "LinuxApi.h"
|
||||
#include <errno.h>
|
||||
#include "StatusCode.h"
|
||||
#include <chrono>
|
||||
#include <fcntl.h>
|
||||
#include <memory>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/statvfs.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/statfs.h>
|
||||
#include <sys/vfs.h>
|
||||
#include <thread>
|
||||
#include <unistd.h>
|
||||
const char *SD_CARD_DEVICE = SD_CARD_DEV;
|
||||
const char *SD_MOUNT_PATH = SD_CARD_MOUNT_PATH;
|
||||
|
|
|
@ -23,7 +23,8 @@ public:
|
|||
virtual ~SdCardHal() = default;
|
||||
void SetSdCardMonitor(std::shared_ptr<VSdCardHalMonitor> &monitor) override;
|
||||
SdCardHalStatus GetSdCardStatus(void) override;
|
||||
StatusCode GetCapacity(unsigned long long &totalSizeMB, unsigned long long &freeSizeMB, unsigned long long &usedSizeMB) override;
|
||||
StatusCode GetCapacity(unsigned long long &totalSizeMB, unsigned long long &freeSizeMB,
|
||||
unsigned long long &usedSizeMB) override;
|
||||
void Init(void);
|
||||
void UnInit(void);
|
||||
void DevDetectingThread(void);
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
#include "WifiHal.h"
|
||||
#include "ILog.h"
|
||||
#include "LinuxApi.h"
|
||||
#include "StatusCode.h"
|
||||
#include <chrono>
|
||||
#include <dirent.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -94,7 +96,5 @@ bool WifiHal::CheckWlan0IfExist(void)
|
|||
if (wlan0_found) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
|
@ -13,9 +13,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "AppClient.h"
|
||||
#include "IAppManager.h"
|
||||
#include "IAppProtocolHandle.h"
|
||||
#include "ILog.h"
|
||||
#include "TcpModule.h"
|
||||
#include <memory>
|
||||
#include <string>
|
||||
AppClient::AppClient(const void *clientObject) : mClientObject(clientObject)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -15,10 +15,15 @@
|
|||
#include "AppManager.h"
|
||||
#include "AppClient.h"
|
||||
#include "AppManagerMakePtr.h"
|
||||
#include "IAppManager.h"
|
||||
#include "IAppProtocolHandle.h"
|
||||
#include "IHalCpp.h"
|
||||
#include "ILog.h"
|
||||
#include "StatusCode.h"
|
||||
#include "TcpModule.h"
|
||||
#include "WebServer.h"
|
||||
#include <memory>
|
||||
#include <sys/types.h>
|
||||
AppManager::AppManager() : mTcpServer(nullptr), mInitRuning(false)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -14,7 +14,11 @@
|
|||
*/
|
||||
#include "AppManagerMakePtr.h"
|
||||
#include "AppManager.h"
|
||||
#include "IAppManager.h"
|
||||
#include "IAppProtocolHandle.h"
|
||||
#include "ILog.h"
|
||||
#include "StatusCode.h"
|
||||
#include <memory>
|
||||
// extern bool CreateProtocolHandleImpl();
|
||||
bool CreateAppManagerModule(void)
|
||||
{
|
||||
|
|
|
@ -14,6 +14,10 @@
|
|||
*/
|
||||
#include "IAppManager.h"
|
||||
#include "ILog.h"
|
||||
#include "StatusCode.h"
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
app_get_product_info::app_get_product_info()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -13,7 +13,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "IAppProtocolHandle.h"
|
||||
#include "IAppManager.h"
|
||||
#include "ILog.h"
|
||||
#include "WebServer.h"
|
||||
#include <cstdlib>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
protocol_packet::~protocol_packet()
|
||||
{
|
||||
if (nullptr != mData) {
|
||||
|
|
|
@ -13,11 +13,21 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "SixFrameHandle.h"
|
||||
#include "IAppManager.h"
|
||||
#include "IAppProtocolHandle.h"
|
||||
#include "ILog.h"
|
||||
#include <WebServer.h>
|
||||
#include <cJSON.h>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include <time.h>
|
||||
#include <vector>
|
||||
using std::placeholders::_1;
|
||||
using std::placeholders::_2;
|
||||
using std::placeholders::_3;
|
||||
|
@ -1004,10 +1014,8 @@ std::shared_ptr<ProtocolPacket> SixFrameHandle::MakePacket(const cJSON *json)
|
|||
if (nullptr != resultStr) {
|
||||
return std::make_shared<ProtocolPacket>(resultStr, strlen(resultStr));
|
||||
}
|
||||
else {
|
||||
LogError("MakePacket failed.\n");
|
||||
return std::make_shared<ProtocolPacket>();
|
||||
}
|
||||
LogError("MakePacket failed.\n");
|
||||
return std::make_shared<ProtocolPacket>();
|
||||
}
|
||||
void SixFrameHandle::SetAppMonitor(std::shared_ptr<VAppMonitor> &monitor)
|
||||
{
|
||||
|
|
|
@ -13,8 +13,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "SixFrameMakePtr.h"
|
||||
#include "AppManagerMakePtr.h"
|
||||
#include "IAppProtocolHandle.h"
|
||||
#include "ILog.h"
|
||||
#include "SixFrameHandle.h"
|
||||
#include "StatusCode.h"
|
||||
#include <memory>
|
||||
bool CreateProtocolHandleImpl(void)
|
||||
{
|
||||
LogInfo("CreateProtocolHandleImpl SixFrameMakePtr.\n");
|
||||
|
|
|
@ -13,10 +13,13 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "DeviceManager.h"
|
||||
#include "IDeviceManager.h"
|
||||
#include "ILog.h"
|
||||
#include "KeyManager.h"
|
||||
#include "LedManager.h"
|
||||
#include <vector>
|
||||
#include "StatusCode.h"
|
||||
#include <memory>
|
||||
#include <string>
|
||||
const StatusCode DeviceManager::Init(void)
|
||||
{
|
||||
KeyManager::GetInstance()->Init();
|
||||
|
|
|
@ -14,7 +14,10 @@
|
|||
*/
|
||||
#include "DeviceManagerMakePtr.h"
|
||||
#include "DeviceManager.h"
|
||||
#include "IDeviceManager.h"
|
||||
#include "ILog.h"
|
||||
#include "StatusCode.h"
|
||||
#include <memory>
|
||||
bool CreateDeviceManagerModule(void)
|
||||
{
|
||||
auto instance = std::make_shared<IDeviceManager>();
|
||||
|
|
|
@ -14,6 +14,9 @@
|
|||
*/
|
||||
#include "IDeviceManager.h"
|
||||
#include "ILog.h"
|
||||
#include "StatusCode.h"
|
||||
#include <memory>
|
||||
#include <string>
|
||||
void VKeyMonitor::KeyEventReport(const std::string &keyName, const VirtualKeyEvent &event, const unsigned int &timeMs)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -13,7 +13,17 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "KeyManager.h"
|
||||
#include "IDeviceManager.h"
|
||||
#include "IHalCpp.h"
|
||||
#include "ILog.h"
|
||||
// #include "KeyControl.h"
|
||||
#include "StatusCode.h"
|
||||
#include <chrono>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <utility>
|
||||
std::shared_ptr<KeyManager> &KeyManager::GetInstance(std::shared_ptr<KeyManager> *impl)
|
||||
{
|
||||
static auto instance = std::make_shared<KeyManager>();
|
||||
|
|
|
@ -13,7 +13,16 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "LedManager.h"
|
||||
#include "IDeviceManager.h"
|
||||
#include "IHalCpp.h"
|
||||
#include "ILog.h"
|
||||
#include "LedControl.h"
|
||||
#include <chrono>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
std::shared_ptr<LedManager> &LedManager::GetInstance(std::shared_ptr<LedManager> *impl)
|
||||
{
|
||||
static auto instance = std::make_shared<LedManager>();
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
*/
|
||||
#ifndef FILES_DATABASE_H
|
||||
#define FILES_DATABASE_H
|
||||
#include "StatusCode.h"
|
||||
#include "FilesHandle.h"
|
||||
#include "IFilesManager.h"
|
||||
#include "StatusCode.h"
|
||||
class FilesDatabase : public FilesHandle
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -14,17 +14,14 @@
|
|||
*/
|
||||
#include "FilesHandle.h"
|
||||
#include "ILog.h"
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
#include <chrono>
|
||||
#include <cstring>
|
||||
#include <ctime>
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <string>
|
||||
std::string FilesHandle::CreateFilePathName(const std::string &sourceFile)
|
||||
{
|
||||
const std::string ERROR_SUFFIX = "";
|
||||
|
|
|
@ -13,7 +13,10 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "FilesManagerImpl.h"
|
||||
#include "IStorageManager.h"
|
||||
#include "IFilesManager.h"
|
||||
// #include "IStorageManager.h"
|
||||
#include "FilesDatabase.h"
|
||||
#include "StatusCode.h"
|
||||
StatusCode FilesManagerImpl::Init(void)
|
||||
{
|
||||
FilesDatabase::Init();
|
||||
|
|
|
@ -13,8 +13,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "FilesManagerMakePtr.h"
|
||||
#include "ILog.h"
|
||||
#include "FilesManagerImpl.h"
|
||||
#include "IFilesManager.h"
|
||||
#include "ILog.h"
|
||||
#include "StatusCode.h"
|
||||
#include <memory>
|
||||
bool CreateFilesManagerModule(void)
|
||||
{
|
||||
auto instance = std::make_shared<IFilesManager>();
|
||||
|
|
|
@ -14,6 +14,9 @@
|
|||
*/
|
||||
#include "IFilesManager.h"
|
||||
#include "ILog.h"
|
||||
#include "StatusCode.h"
|
||||
#include <memory>
|
||||
#include <string>
|
||||
save_file_info::save_file_info(const std::string &fileName) : mFileName(fileName)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -13,9 +13,13 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "FilesDatabase.h"
|
||||
#include "FilesHandle.h"
|
||||
#include "IFilesManager.h"
|
||||
#include "ILog.h"
|
||||
#include "IStorageManager.h"
|
||||
#include "SqliteHandle.h"
|
||||
#include "StatusCode.h"
|
||||
#include <string>
|
||||
void FilesDatabase::Init(void)
|
||||
{
|
||||
SqliteHandle::GetInstance()->Init();
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
#include "SqliteHandle.h"
|
||||
#include "ILog.h"
|
||||
#include "sqlite3.h"
|
||||
#include <memory>
|
||||
#include <stdio.h>
|
||||
std::shared_ptr<SqliteHandle> &SqliteHandle::GetInstance(std::shared_ptr<SqliteHandle> *impl)
|
||||
{
|
||||
static auto instance = std::make_shared<SqliteHandle>();
|
||||
|
@ -31,7 +33,7 @@ std::shared_ptr<SqliteHandle> &SqliteHandle::GetInstance(std::shared_ptr<SqliteH
|
|||
}
|
||||
void SqliteHandle::Init(void)
|
||||
{
|
||||
sqlite3 *db;
|
||||
sqlite3 *db;
|
||||
int rc;
|
||||
rc = sqlite3_open("test.db", &db);
|
||||
if (rc) {
|
||||
|
@ -42,5 +44,4 @@ void SqliteHandle::Init(void)
|
|||
}
|
||||
void SqliteHandle::UnInit(void)
|
||||
{
|
||||
|
||||
}
|
|
@ -14,6 +14,8 @@
|
|||
*/
|
||||
#include "HuntingUpgradeImpl.h"
|
||||
#include "ILog.h"
|
||||
#include "StatusCode.h"
|
||||
#include "UpgradeBase.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
|
|
@ -14,7 +14,10 @@
|
|||
*/
|
||||
#include "HuntingUpgradeMakePtr.h"
|
||||
#include "HuntingUpgradeImpl.h"
|
||||
#include "IHuntingUpgrade.h"
|
||||
#include "ILog.h"
|
||||
#include "StatusCode.h"
|
||||
#include <memory>
|
||||
bool CreateHuntingUpgradeModule(void)
|
||||
{
|
||||
auto instance = std::make_shared<IHuntingUpgrade>();
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
*/
|
||||
#include "IHuntingUpgrade.h"
|
||||
#include "ILog.h"
|
||||
#include "StatusCode.h"
|
||||
#include <memory>
|
||||
std::shared_ptr<IHuntingUpgrade> &IHuntingUpgrade::GetInstance(std::shared_ptr<IHuntingUpgrade> *impl)
|
||||
{
|
||||
static auto instance = std::make_shared<IHuntingUpgrade>();
|
||||
|
|
|
@ -14,6 +14,9 @@
|
|||
*/
|
||||
#include "IIpcConfig.h"
|
||||
#include "ILog.h"
|
||||
#include "StatusCode.h"
|
||||
#include <memory>
|
||||
#include <string>
|
||||
working_time::working_time() : mHourFrom(0), mHourTo(0), mMinuteFrom(0), mMinuteTo(0)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -13,13 +13,22 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "IpcConfigImpl.h"
|
||||
#include "ConfigBase.h"
|
||||
#include "IIpcConfig.h"
|
||||
#include "ILog.h"
|
||||
#include "LinuxApi.h"
|
||||
#include <dirent.h>
|
||||
#include "StatusCode.h"
|
||||
#include <chrono>
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <utility>
|
||||
#define CHECK_MAP(map) (map.size() == 1 ? true : false)
|
||||
const char *CONFIG_WIFI_SSID = "wifi_ssid";
|
||||
const char *CONFIG_WIFI_SSID_DEFAULT = "Hunting 2024";
|
||||
|
|
|
@ -13,8 +13,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "IpcConfigMakePtr.h"
|
||||
#include "IIpcConfig.h"
|
||||
#include "ILog.h"
|
||||
#include "IpcConfigImpl.h"
|
||||
#include "StatusCode.h"
|
||||
#include <memory>
|
||||
bool CreateIpcConfigModule(void)
|
||||
{
|
||||
auto instance = std::make_shared<IIpcConfig>();
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "McuAskBase.h"
|
||||
#include "ILog.h"
|
||||
#include "IMcuManager.h"
|
||||
#include <semaphore.h>
|
||||
McuAskBase::McuAskBase(const McuAskBlock isBlock, const McuAskReply needReply, const unsigned int timeoutMs)
|
||||
: mIsBlock(isBlock), mNeedReply(needReply), mTimeout(timeoutMs)
|
||||
{
|
||||
|
|
|
@ -14,6 +14,9 @@
|
|||
*/
|
||||
#include "IMcuManager.h"
|
||||
#include "ILog.h"
|
||||
#include "IMcuManager.h"
|
||||
#include "StatusCode.h"
|
||||
#include <memory>
|
||||
mcu_ask_date_time::mcu_ask_date_time(const unsigned short year, const unsigned char mon, const unsigned char day,
|
||||
const unsigned char hour, const unsigned char min, const unsigned char second)
|
||||
: mYear(year), mMon(mon), mDay(day), mHour(hour), mMin(min), mSecond(second)
|
||||
|
|
|
@ -14,7 +14,19 @@
|
|||
*/
|
||||
#include "McuDevice.h"
|
||||
#include "ILog.h"
|
||||
#include "IMcuManager.h"
|
||||
#include "McuProtocol.h"
|
||||
#include "StatusCode.h"
|
||||
#include "UartDevice.h"
|
||||
#include <chrono>
|
||||
#include <cstdlib>
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <thread>
|
||||
constexpr int SLEEP_TIME_MS = 1000;
|
||||
constexpr bool REMOVE_THE_ASK = true;
|
||||
constexpr bool KEEP_THE_ASK = false;
|
||||
|
|
|
@ -14,7 +14,19 @@
|
|||
*/
|
||||
#include "McuManagerImpl.h"
|
||||
#include "ILog.h"
|
||||
#include "IMcuManager.h"
|
||||
#include "McuAskBase.h"
|
||||
#include "McuDevice.h"
|
||||
#include "McuProtocol.h"
|
||||
#include "StatusCode.h"
|
||||
#include <chrono>
|
||||
#include <condition_variable>
|
||||
#include <functional>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
class McuRecvImpl
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -14,7 +14,10 @@
|
|||
*/
|
||||
#include "McuManagerMakePtr.h"
|
||||
#include "ILog.h"
|
||||
#include "IMcuManager.h"
|
||||
#include "McuManagerImpl.h"
|
||||
#include "StatusCode.h"
|
||||
#include <memory>
|
||||
bool CreateMcuManager(void)
|
||||
{
|
||||
auto instance = std::make_shared<IMcuManager>();
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "UartRecvAsk.h"
|
||||
#include "McuAskBase.h"
|
||||
UartRecvAsk::UartRecvAsk() : McuAskBase(McuAskBlock::NOT_BLOCK, McuAskReply::NEED_REPLY)
|
||||
{
|
||||
}
|
|
@ -14,6 +14,10 @@
|
|||
*/
|
||||
#include "IMediaManager.h"
|
||||
#include "ILog.h"
|
||||
#include "StatusCode.h"
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
media_report_event::media_report_event(const std::string &fileName, const MediaChannel &mediaChannedl)
|
||||
: mFileName(fileName), mMediaChannedl(mediaChannedl)
|
||||
{
|
||||
|
|
|
@ -13,8 +13,17 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "MediaHandle.h"
|
||||
#include "IHalCpp.h"
|
||||
#include "ILog.h"
|
||||
#include "IMediaManager.h"
|
||||
#include "SaveStream.h"
|
||||
#include "StatusCode.h"
|
||||
#include <chrono>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
MediaHandle::MediaHandle(const MediaChannel &mediaChannel, const std::shared_ptr<VCameraHal> &cameraHal)
|
||||
: mMediaChannel(mediaChannel), mCameraHal(cameraHal), mTaskRuning(false)
|
||||
{
|
||||
|
|
|
@ -13,8 +13,14 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "MediaManagerImpl.h"
|
||||
#include "IHalCpp.h"
|
||||
#include "ILog.h"
|
||||
#include "IMediaManager.h"
|
||||
#include "MediaHandle.h"
|
||||
#include "StatusCode.h"
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
StatusCode MediaManagerImpl::Init(void)
|
||||
{
|
||||
IHalCpp::GetInstance()->GetCameraHal(mAllCameras);
|
||||
|
|
|
@ -14,7 +14,10 @@
|
|||
*/
|
||||
#include "MediaManagerMakePtr.h"
|
||||
#include "ILog.h"
|
||||
#include "IMediaManager.h"
|
||||
#include "MediaManagerImpl.h"
|
||||
#include "StatusCode.h"
|
||||
#include <memory>
|
||||
bool CreateMediaManagerModule(void)
|
||||
{
|
||||
auto instance = std::make_shared<IMediaManager>();
|
||||
|
|
|
@ -14,6 +14,9 @@
|
|||
*/
|
||||
#include "SaveStream.h"
|
||||
#include "ILog.h"
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
SaveStream::SaveStream() : mFileAudio(nullptr), mFileVideo(nullptr)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -14,7 +14,10 @@
|
|||
*/
|
||||
#include "IStateMachine.h"
|
||||
#include "ILog.h"
|
||||
#include <thread>
|
||||
#include "StatusCode.h"
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
std::string State::GetStateName()
|
||||
{
|
||||
return mStateName;
|
||||
|
|
|
@ -13,7 +13,10 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "StateMachineImpl.h"
|
||||
#include "IStateMachine.h"
|
||||
#include "StateMachineMakePtr.h"
|
||||
#include "StatusCode.h"
|
||||
#include <memory>
|
||||
const StatusCode StateMachineImpl::CreateStateMachine(std::shared_ptr<VStateMachineHandle> &stateMachine)
|
||||
{
|
||||
return StateMachineMakePtr::GetInstance()->CreateStateMachine(stateMachine);
|
||||
|
|
|
@ -16,8 +16,10 @@
|
|||
#include "ILog.h"
|
||||
#include "IStateMachine.h"
|
||||
#include "StateMachineImpl.h"
|
||||
#include "StatusCode.h"
|
||||
#include "state_machine.h"
|
||||
#include <thread>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
bool CreateStateMachine(void)
|
||||
{
|
||||
auto instance = std::make_shared<IStateMachine>();
|
||||
|
|
|
@ -12,4 +12,4 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "EmmcHandle.h"
|
||||
// #include "EmmcHandle.h"
|
|
@ -14,6 +14,9 @@
|
|||
*/
|
||||
#include "IStorageManager.h"
|
||||
#include "ILog.h"
|
||||
#include "StatusCode.h"
|
||||
#include <memory>
|
||||
#include <string>
|
||||
sd_card_info::sd_card_info() : mEvent(StorageEvent::END), mTotalSizeMB(0), mFreeSizeMB(0)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -13,8 +13,15 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "SdCardHandle.h"
|
||||
#include "IHalCpp.h"
|
||||
#include "ILog.h"
|
||||
#include "IStorageManager.h"
|
||||
#include "LinuxApi.h"
|
||||
#include "StatusCode.h"
|
||||
#include "StorageBase.h"
|
||||
#include <memory>
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
void SdCardHandle::ReportEvent(const SdCardHalStatus &status)
|
||||
{
|
||||
LogInfo("SdCardHal: ReportEvent.\n");
|
||||
|
|
|
@ -14,11 +14,12 @@
|
|||
*/
|
||||
#include "StorageBase.h"
|
||||
#include "ILog.h"
|
||||
#include "IStorageManager.h"
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
bool StorageBase::CheckDirectory(const char *filepath)
|
||||
{
|
||||
LogInfo("CheckDirectory:%s\n", filepath);
|
||||
|
|
|
@ -13,7 +13,13 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "StorageManagerImpl.h"
|
||||
#include "ILog.h"
|
||||
// #include "ILog.h"
|
||||
#include "IStorageManager.h"
|
||||
#include "SdCardHandle.h"
|
||||
#include "StatusCode.h"
|
||||
#include "StorageBase.h"
|
||||
#include <memory>
|
||||
#include <string>
|
||||
StatusCode StorageManagerImpl::Init(void)
|
||||
{
|
||||
SdCardHandle::SdCardInit();
|
||||
|
|
|
@ -14,7 +14,10 @@
|
|||
*/
|
||||
#include "StorageManagerMakePtr.h"
|
||||
#include "ILog.h"
|
||||
#include "IStorageManager.h"
|
||||
#include "StatusCode.h"
|
||||
#include "StorageManagerImpl.h"
|
||||
#include <memory>
|
||||
bool CreateStorageManagerModule(void)
|
||||
{
|
||||
auto instance = std::make_shared<IStorageManager>();
|
||||
|
|
|
@ -16,6 +16,7 @@ include_directories(
|
|||
link_directories(
|
||||
${LIBS_OUTPUT_PATH}
|
||||
${EXTERNAL_LIBS_OUTPUT_PATH}
|
||||
${EXTERNAL_LIBS_OUTPUT_PATH}/libconfig/lib
|
||||
)
|
||||
|
||||
aux_source_directory(. SRC_FILES)
|
||||
|
|
|
@ -31,6 +31,7 @@ include_directories(
|
|||
link_directories(
|
||||
${LIBS_OUTPUT_PATH}
|
||||
${EXTERNAL_LIBS_OUTPUT_PATH}
|
||||
${EXTERNAL_LIBS_OUTPUT_PATH}/libconfig/lib
|
||||
${TEST_TOOLS_OUTPUT_PATH}
|
||||
)
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ include_directories(
|
|||
link_directories(
|
||||
${LIBS_OUTPUT_PATH}
|
||||
${EXTERNAL_LIBS_OUTPUT_PATH}
|
||||
${EXTERNAL_LIBS_OUTPUT_PATH}/libconfig/lib
|
||||
${TEST_TOOLS_OUTPUT_PATH}
|
||||
)
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ include_directories(
|
|||
link_directories(
|
||||
${LIBS_OUTPUT_PATH}
|
||||
${EXTERNAL_LIBS_OUTPUT_PATH}
|
||||
${EXTERNAL_LIBS_OUTPUT_PATH}/libconfig/lib
|
||||
)
|
||||
|
||||
aux_source_directory(. SRC_FILES)
|
||||
|
|
|
@ -9,7 +9,7 @@ include_directories(
|
|||
./include
|
||||
${UTILS_SOURCE_PATH}/StatusCode/include
|
||||
${UTILS_SOURCE_PATH}/Log/include
|
||||
${EXTERNAL_SOURCE_PATH}/libconfig/libconfig-1.7.3/lib
|
||||
${EXTERNAL_LIBS_OUTPUT_PATH}/libconfig/include
|
||||
)
|
||||
# link_directories(
|
||||
# ${EXTERNAL_SOURCE_PATH}/libconfig/libconfig-1.7.3/lib/.libs
|
||||
|
@ -19,7 +19,7 @@ aux_source_directory(./src SRC_FILES)
|
|||
|
||||
set(TARGET_NAME ConfigBase)
|
||||
add_library(${TARGET_NAME} STATIC ${SRC_FILES})
|
||||
target_link_libraries(${TARGET_NAME} StatusCode Log libconfig.a)
|
||||
target_link_libraries(${TARGET_NAME} StatusCode Log config)
|
||||
|
||||
if ("${COMPILE_IMPROVE_SUPPORT}" MATCHES "true")
|
||||
add_custom_target(
|
||||
|
@ -57,18 +57,29 @@ add_custom_command(
|
|||
endif()
|
||||
|
||||
# build libconfig before make libConfigBase.a
|
||||
# add_custom_command(
|
||||
# OUTPUT ${EXTERNAL_LIBS_OUTPUT_PATH}/libconfig.a
|
||||
# COMMAND echo "Build libconfig-1.7.3. COMPILE_HOST = ${COMPILE_HOST}"
|
||||
# COMMAND sh build_libconfig.sh ${TARGET_PLATFORM} ${COMPILE_HOST}
|
||||
# COMMAND mv ${EXTERNAL_SOURCE_PATH}/libconfig/libconfig-1.7.3/lib/.libs/libconfig.a ${EXTERNAL_LIBS_OUTPUT_PATH}/libconfig.a
|
||||
# COMMAND cd libconfig-1.7.3; make clean;
|
||||
# WORKING_DIRECTORY ${EXTERNAL_SOURCE_PATH}/libconfig/
|
||||
# )
|
||||
# add_custom_target(
|
||||
# libconfig.a
|
||||
# DEPENDS ${EXTERNAL_LIBS_OUTPUT_PATH}/libconfig.a
|
||||
# )
|
||||
add_custom_command(
|
||||
OUTPUT ${EXTERNAL_LIBS_OUTPUT_PATH}/libconfig.a
|
||||
COMMAND echo "Build libconfig-1.7.3. COMPILE_HOST = ${COMPILE_HOST}"
|
||||
COMMAND sh build_libconfig.sh ${TARGET_PLATFORM} ${COMPILE_HOST}
|
||||
COMMAND mv ${EXTERNAL_SOURCE_PATH}/libconfig/libconfig-1.7.3/lib/.libs/libconfig.a ${EXTERNAL_LIBS_OUTPUT_PATH}/libconfig.a
|
||||
COMMAND cd libconfig-1.7.3; make clean;
|
||||
WORKING_DIRECTORY ${EXTERNAL_SOURCE_PATH}/libconfig/
|
||||
OUTPUT ${EXTERNAL_LIBS_OUTPUT_PATH}/libconfig/lib/libconfig.a
|
||||
COMMAND echo "Did not libconfig libs in output_files, now compile libconfig."
|
||||
COMMAND make libconfig
|
||||
WORKING_DIRECTORY ${PLATFORM_PATH}/cmake-shell/
|
||||
)
|
||||
add_custom_target(
|
||||
libconfig.a
|
||||
DEPENDS ${EXTERNAL_LIBS_OUTPUT_PATH}/libconfig.a
|
||||
compile_libconfig
|
||||
DEPENDS ${EXTERNAL_LIBS_OUTPUT_PATH}/libconfig/lib/libconfig.a
|
||||
)
|
||||
add_dependencies(${TARGET_NAME} compile_libconfig)
|
||||
|
||||
define_file_name(${TARGET_NAME})
|
||||
config_owner(${TARGET_NAME})
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
#include "ConfigBase.h"
|
||||
#include "IConfigBase.h"
|
||||
#include "ILog.h"
|
||||
#include "StatusCode.h"
|
||||
#include <memory>
|
||||
#include <stdlib.h>
|
||||
static bool ObjectCheck(void *object)
|
||||
{
|
||||
if (nullptr == object) {
|
||||
|
|
|
@ -13,7 +13,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "ConfigBaseCode.h"
|
||||
#include "ConfigBase.h"
|
||||
#include "ILog.h"
|
||||
#include "StatusCode.h"
|
||||
#include <string.h>
|
||||
static const char *ConfigCodeString[CONFIG_CODE_END - STATUS_CODE_END + 1] = {"CONFIG_CODE_PARAM_NOT_EXIST",
|
||||
"CONFIG_CODE_END"};
|
||||
|
|
|
@ -13,10 +13,16 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "ConfigBaseImpl.h"
|
||||
#include "ConfigBase.h"
|
||||
#include "ConfigBaseCode.h"
|
||||
#include "ILog.h"
|
||||
#include "StatusCode.h"
|
||||
#include <libconfig.h>
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
#include <unistd.h>
|
||||
|
||||
constexpr int INVALID_RESULT = -1;
|
||||
|
@ -38,7 +44,8 @@ bool ConfigBaseImpl::OpenConfigFile(void)
|
|||
if (FIEL_EXIST == access(mFileName.c_str(), F_OK)) {
|
||||
if (!config_read_file(&mCfg, mFileName.c_str())) {
|
||||
LogError("Read file failed[%s].\n", mFileName.c_str());
|
||||
fprintf(stderr, "%s:%d - %s\n", config_error_file(&mCfg), config_error_line(&mCfg), config_error_text(&mCfg));
|
||||
fprintf(
|
||||
stderr, "%s:%d - %s\n", config_error_file(&mCfg), config_error_line(&mCfg), config_error_text(&mCfg));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user