Skip to content

Commit

Permalink
1. 支持多地域域名配置。
Browse files Browse the repository at this point in the history
2. 数据模板client增加设备信息成员,支持网关case下多设备复用同一个mqtt client.
3. HAL层相关接口与hub SDK同步一致。
4. 封装数据模板及网关yield线程创建及销毁接口,完善多线程case下的mqtt收包处理。
5. 修复几处潜在的内存泄露问题。
6. clang-format统一代码风格,增加clang-tidy及cpplint代码检查。
  • Loading branch information
yougaliu committed May 13, 2020
1 parent 6e4e6a9 commit f651087
Show file tree
Hide file tree
Showing 143 changed files with 8,806 additions and 7,938 deletions.
10 changes: 10 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
BasedOnStyle: Google
BreakBeforeBraces: Linux
AlignConsecutiveDeclarations: true
AlignConsecutiveMacros: true
AlignConsecutiveAssignments: true
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: false
SortIncludes: false
IndentWidth: 4
ColumnLimit: 120
27 changes: 25 additions & 2 deletions cmake_build.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#! /bin/bash

if [ "$#" -eq "0" ]; then
rm -rf output
rm -rf build
echo "Build all (SDK libs and samples)"
mkdir -p build
cd build
cmake ..
#-DSAMPLE_ONLY=OFF ..
make
exit
elif [ "$#" -eq "1" -a $1 == "samples" ]; then
Expand All @@ -29,7 +30,29 @@ elif [ "$#" -eq "1" -a $1 == "clean" ]; then
rm -rf output
rm -rf build
exit
elif [ "$#" -eq "1" -a $1 == "code-check" ]; then
# code-check requires clang-tidy and cpplint
# sudo apt install clang-tidy
# pip install cpplint
echo "run code check"
rm -rf build
mkdir -p build
cd build
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
echo "clang-tidy check begin"
clang_extra_arg="-extra-arg=-I/usr/lib/gcc/x86_64-linux-gnu/5/include -extra-arg=-I/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed"
clang_check_rules="-checks=-clang-analyzer-osx*,-clang-analyzer-security.insecureAPI.strcpy,-clang-diagnostic-missing-braces,-clang-diagnostic-varargs"
../tools/run-clang-tidy.py ${clang_extra_arg} ${clang_check_rules} >../code-check-clang-tidy.txt
echo "clang-tidy check end"
echo "cpplint check begin"
cd ..
find ./samples/ ./include/ ./sdk_src/ ./platform/ -name *.c -o -name *.h | xargs clang-format -i
cpplint_rules="--filter=-whitespace/line_length,-readability/casting,-build/include_subdir,-whitespace/braces,-whitespace/comments,-whitespace/blank_line,-whitespace/parens,-whitespace/semicolon,-whitespace/end_of_line,-whitespace/ending_newline,-whitespace/comma,-build/header_guard,-runtime/int,-runtime/printf,-readability/todo,-build/include_order,-build/include_what_you_use"
cpplint_coverage="include/ samples/ platform/ sdk_src/"
cpplint ${cpplint_rules} --recursive ${cpplint_coverage} &>./code-check-cpplint.txt
echo "cpplint check end"
exit
else
echo "Usage: "$0" <null for all/samples/clean>"
echo "Usage: "$0" <null for all/samples/clean/code-check>"
exit
fi
4 changes: 3 additions & 1 deletion device_info.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,7 @@
{"sub_productId": "Y8T6NB8DM0", "sub_devName": "test002"},
{"sub_productId": "Y8T6NB8DM0", "sub_devName": "test003"}
]
}
},

"region":"china"
}
9 changes: 7 additions & 2 deletions docs/数据模板开发/数据模板协议.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## 简介

用户创建完产品后即可定义数据模板,设备开发阶段会基于数据模板生成 MCU SDK 代码,设备调试阶段的在线调试会接收设备的上报数据并可在控制台下发控制指令到设备进行调试。本文档介绍数据模板协议。
用户创建完产品后即可定义数据模板,基于导出数据模板json配置文件通过SDK提供的脚本工具可以自动生成数据模板配置代码,设备调试阶段的在线调试会接收设备的上报数据并可在控制台下发控制指令到设备进行调试。本文档介绍数据模板协议。

## 数据模板协议

Expand Down Expand Up @@ -224,6 +224,7 @@
</table>
3. 响应
- 响应消息格式:

```
{
"method": "get_status_reply",
Expand All @@ -239,6 +240,7 @@
}
}
```

- 响应参数
<table>
<tr>
Expand Down Expand Up @@ -336,6 +338,7 @@
</table>
3. 响应
- 响应消息格式:

```
{
"method": "event_reply",
Expand All @@ -346,6 +349,7 @@
"data": {}
}
```

- 响应参数:
<table>
<tr>
Expand Down Expand Up @@ -438,7 +442,7 @@
</tr>
</table>
3. 响应
- 响应消息格式:
- 响应消息格式:
```
{
"method": "action_reply",
Expand All @@ -450,6 +454,7 @@
}
}
```

- 响应参数:
<table>
<tr>
Expand Down
Loading

0 comments on commit f651087

Please sign in to comment.