diff --git a/README.md b/README.md index 2d68d0a..4f9f28c 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,8 @@ 阅读小技巧: -* 本工程所有文档描述路径时,"//"双斜杠表示工程根目录; +* SDK工程所有开发文档均使用markdown语法编写,需要使用markdown语法解析器进行解析,方便阅读,如:Typora;开发工程师建议使用vscode安装markdownlint插件进行阅读; +* SDK工程所有文档描述路径时,"//"双斜杠表示工程根目录; ## 1.2. 编译 diff --git a/doc/markdown_user_guide.md b/doc/markdown_user_guide.md new file mode 100644 index 0000000..4cb0f9b --- /dev/null +++ b/doc/markdown_user_guide.md @@ -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 +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{ + <> + +call() int + } + class Fish{ + -int sizeInFeet + -canEat() + } + class Zebra{ + <> + -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关键字作为一个状态名称,无法画图; \ No newline at end of file diff --git a/external/sqlite3/sqlite-3430000/CMakeLists.txt b/external/sqlite3/sqlite-3430000/CMakeLists.txt index f20efef..2309190 100644 --- a/external/sqlite3/sqlite-3430000/CMakeLists.txt +++ b/external/sqlite3/sqlite-3430000/CMakeLists.txt @@ -14,4 +14,4 @@ file(GLOB_RECURSE SRC_FILES ./sqlite3.c) set(TARGET_NAME sqlite3) add_library(${TARGET_NAME} STATIC ${SRC_FILES}) -install(FILES ./sqlite3.h DESTINATION include) \ No newline at end of file +install(FILES sqlite3.h DESTINATION include) \ No newline at end of file diff --git a/utils/McuProtocol/src/ProtocolHandle.cpp b/utils/McuProtocol/src/ProtocolHandle.cpp index 3af7d6c..0cbeb7c 100644 --- a/utils/McuProtocol/src/ProtocolHandle.cpp +++ b/utils/McuProtocol/src/ProtocolHandle.cpp @@ -58,6 +58,8 @@ ProtocolHandle::ProtocolHandle(const void *data, const size_t &length) /**************************************************************************************************************************/ mAnalyzePacketFunc[OTHER_SIDE_ASK_SEND_IPC_MISSION] = std::bind(&ProtocolHandle::AnalyzeOtherSideSendIpcMissionPacket, this, _1); + mAnalyzePacketFunc[OTHER_SIDE_ASK_SEND_HEART_BEAT] = + std::bind(&ProtocolHandle::AnalyzeOtherSideSendHeartBeatPacket, this, _1); } ProtocolHandle::~ProtocolHandle() { @@ -227,6 +229,12 @@ void ProtocolHandle::AnalyzeOtherSideSendIpcMissionPacket(const ProtocolPacket & unsigned char ipcMission = ReplyOneBytePacketResult(packet); VProtocolRecv::GetInstance()->OtherSideSendIpcMission(mProtocolSerialNumber, ipcMission); } +void ProtocolHandle::AnalyzeOtherSideSendHeartBeatPacket(const ProtocolPacket &packet) +{ + LogInfo("AnalyzeOtherSideSendHeartBeatPacket\n"); + unsigned char ipcMission = ReplyOneBytePacketResult(packet); + VProtocolRecv::GetInstance()->OtherSideSendIpcMission(mProtocolSerialNumber, ipcMission); +} bool ProtocolHandle::CheckoutTheCheckCode(const ProtocolPacket &packet) { short code = calculate_check_sum(mProtocolData, mProtocolDataLength - CHECK_CODE_LENGTH); diff --git a/utils/McuProtocol/src/ProtocolHandle.h b/utils/McuProtocol/src/ProtocolHandle.h index 7089493..1411ab1 100644 --- a/utils/McuProtocol/src/ProtocolHandle.h +++ b/utils/McuProtocol/src/ProtocolHandle.h @@ -49,16 +49,18 @@ enum PROTOCOL_COMMAND REPLY_SET_DATE_TIME = 0x0107, ASK_SET_PIR_SENSITIVITY = 0x8108, REPLY_SET_PIR_SENSITIVITY = 0x0108, - ASK_CONTORL_INFRARED_LIGHT = 0x810A, - REPLY_CONTORL_INFRARED_LIGHT = 0x010A, - ASK_GET_PHOTOSENSITIVITY = 0x810B, - REPLY_GET_PHOTOSENSITIVITY = 0x010B, + ASK_CONTORL_INFRARED_LIGHT = 0x810A, // Temporarily cancelled, reserved. + REPLY_CONTORL_INFRARED_LIGHT = 0x010A, // Temporarily cancelled, reserved. + ASK_GET_PHOTOSENSITIVITY = 0x810B, // Temporarily cancelled, reserved. + REPLY_GET_PHOTOSENSITIVITY = 0x010B, // Temporarily cancelled, reserved. /** * @brief The protocol starting from here is a request sent from the other end. * */ REPLY_OTHER_SIDE_ASK_SEND_IPC_MISSION = 0xC101, OTHER_SIDE_ASK_SEND_IPC_MISSION = 0x4101, + REPLY_OTHER_SIDE_ASK_SEND_HEART_BEAT = 0xC102, + OTHER_SIDE_ASK_SEND_HEART_BEAT = 0x4102, PROTOCOL_COMMAND_END }; constexpr unsigned char ZERO_MEANS_SHUTDOWN_WATCH_DOG = 0x00; @@ -181,6 +183,7 @@ private: void AnalyzeReplyResultPacket(const ProtocolPacket &packet); void AnalyzeReplyIpcMissionPacket(const ProtocolPacket &packet); void AnalyzeOtherSideSendIpcMissionPacket(const ProtocolPacket &packet); + void AnalyzeOtherSideSendHeartBeatPacket(const ProtocolPacket &packet); private: virtual void BigEndianConversion(ProtocolPacket &packet)