refresh directoy of doc

This commit is contained in:
daishengdong
2019-11-14 20:00:48 +08:00
parent 74572d20fe
commit 39911b4ba3
44 changed files with 28 additions and 28 deletions

View File

@@ -36,7 +36,7 @@ TencentOS tiny可以有效减少开发人员在任务管理、硬件支持、网
## TencentOS tiny整体架构
![](./picture/introduction/TencentOS_tiny_Architecture.png)
![](./image/introduction/TencentOS_tiny_Architecture.png)
TencentOS tiny主要由一个轻量级RTOS内核+多个物联网组件构成如下图所示为TencentOS tiny的主体架构图从下到上主要包括

View File

@@ -12,7 +12,7 @@
**腾讯云物联网通信产品架构**
![](img/qcloud_arch.png)
![](image/iothub_guide/qcloud_arch.png)
在上图所示的架构中, 本文只讨论"用户设备"和腾讯云的对接. 这上图中可以看到, "用户设备"和腾讯云之间是基于**MQTT**协议或是**CoAP**协议进行通信的. 因此, 在"用户设备"上, 需要包含连接SDK或是实现了MQTT或CoAP协议的代码. 本文讲述MQTT连接方法, CoAP协议类似.
@@ -20,7 +20,7 @@
物联网 (IoT) 设备必须连接互联网. 通过连接到互联网, 设备就能相互协作, 以及与后端服务协同工作. 互联网的基础网络协议是 TCP/IP. MQTT(消息队列遥测传输)是基于 TCP/IP 协议栈而构建的, 已成为 IoT 通信的标准. MQTT本身是个轻量级的协议, 可以在硬件受限设备上实现. 同时, MQTT协议支持在各方之间异步通信的消息协议, 异步消息协议在空间和时间上将消息发送者与接收者分离, 因此可以在不可靠的网络环境中进行扩展. MQTT的灵活性使得为 IoT 设备和服务的多样化应用场景提供支持成为可能.
![](img/mqtt_client_broker.png)
![](image/iothub_guide/mqtt_client_broker.png)
MQTT协议基于发布(Publish)和订阅(Subscribe)模型. 在网络中定义了两种实体类型: **消息代理端(Broker)**和**客户端(Client)**, 代理是一个服务器, 它从客户端接收所有消息, 然后将这些消息路由到相关的目标客户端. 客户端是能够与代理交互来发送和接收消息的任何事物. 客户端可以是现场的 IoT 传感器, 或者是数据中心内处理 IoT 数据的应用程序.
@@ -35,15 +35,15 @@ Client和Broker之间的发布和订阅是根据主题(Topic)来进行的, 不
登录腾讯云, 搜索"云产品"下的"物联网通信"产品, 或直接访问 https://console.cloud.tencent.com/iotcloud
![](img/login_iotcloud.png)
![](image/iothub_guide/login_iotcloud.png)
**创建新产品**
![](img/create_new_product.png)
![](image/iothub_guide/create_new_product.png)
![](img/add_prodcut.png)
![](image/iothub_guide/add_prodcut.png)
在"添加新产品"的时候, 注意选择. 产品类型选择**普通产品**, 产品名称随意, 认证方式选择**密钥认证**, 数据格式选择**自定义**.
@@ -57,7 +57,7 @@ Client和Broker之间的发布和订阅是根据主题(Topic)来进行的, 不
注: 这里的数据格式选择会影响之后腾讯云"规则引擎"组件的设置.
![](img/product_info.png)
![](image/iothub_guide/product_info.png)
新建完产品后, 会获得一个平台分配的**productID**.
@@ -65,19 +65,19 @@ Client和Broker之间的发布和订阅是根据主题(Topic)来进行的, 不
**创建新设备**
![](img/new_device.png)
![](image/iothub_guide/new_device.png)
![](img/add_dev.png)
![](image/iothub_guide/add_dev.png)
设置的时候只需要设置设备名称即可, 由于我们在创建产品的时候, 认证方式选择了密钥认证, 因此在创建设备的时候将会提供设备对应的密钥, 这里选择默认的"使用物联通通信提供的密钥"即可.
![](img/add_dev_done.png)
![](image/iothub_guide/add_dev_done.png)
添加完设备后, 会告知设备对应的密钥. 该密钥将会用于之后设备与平台通信时的认证.
为了实现设备间的通信, 我们还需要创建第二个设备, 操作同上, 不妨将其命名为"dev2".
![](img/dev_list.png)
![](image/iothub_guide/dev_list.png)
此时, 在产品"my_product"下面, 有2个我们添加的设备, 分别为"dev1"和"dev2".
@@ -87,7 +87,7 @@ Client和Broker之间的发布和订阅是根据主题(Topic)来进行的, 不
我们知道, 设备通过MQTT协议进行通信, 是基于发布(publish)和订阅(subscribe)相关的话题(topic)来进行的, 因此, 还需要在云端对话题进行设置.
![](img/topic_list.png)
![](image/iothub_guide/topic_list.png)
我们可以在"权限列表"中看到Topic对应的操作权限, 此处还可以添加新的Topic.
@@ -130,7 +130,7 @@ Client和Broker之间的发布和订阅是根据主题(Topic)来进行的, 不
因为不允许直接跨设备访问Topic, 所以需要依靠"规则引擎"来手动添加规则, 将指定的Topic消息转发到另一个Topic上, 实现不同设备之间的通信.
![](img/rule_engine.png)
![](image/iothub_guide/rule_engine.png)
上图介绍了规则引擎的主要作用"republish", 即将一个Topic下的消息republish到另一个Topic下. 从图中我们可以看到, 规则引擎将`QOW7EO9S31/dev2/event`的消息republish到了`QOW7EO9S31/dev1/control`下. 将`QOW7EO9S31/dev1/event`的消息republish到了`QOW7EO9S31/dev2/control`下.
@@ -138,15 +138,15 @@ Client和Broker之间的发布和订阅是根据主题(Topic)来进行的, 不
3. 设置规则引擎
![](img/new_rule.png)
![](image/iothub_guide/new_rule.png)
在物联网通信界面选择"规则引擎"--"新建规则", 随意指定一个规则名称, 我们这里不妨设置为"1to2".
![](img/rule_info.png)
![](image/iothub_guide/rule_info.png)
这里, 我们看到规则的详细设置信息, 主要包括"筛选数据"和"行为操作". "筛选数据"针对指定Topic接收到的消息内容进行进一步的筛选, 比如匹配消息中的字段来决定是否执行之后的设置的"行为操作". 而"行为操作"则是指定对通过匹配的消息进行何种操作, 主要的操作有"数据转发到另一个Topic(Republish)", "转发到第三方服务(Forward)"以及转发到腾讯云各个对应组件中.
![](img/rule_set.png)
![](image/iothub_guide/rule_set.png)
上图是设置好的规则, 这里, 我们将"筛选数据"部分的筛选字段设置为`*`, 筛选的Topic为`QOW7EO9S31/dev1/event`, 条件设置为空, 即不筛选数据, 全部匹配. 然后, 执行的操作是将数据转发到`QOW7EO9S31/dev2/control`, 设置完这条规则, 就实现了dev2通过订阅control就能收到dev1发送到event的数据.
@@ -158,7 +158,7 @@ Client和Broker之间的发布和订阅是根据主题(Topic)来进行的, 不
同理, 我们再设置新的一个规则"2to1", 实现`QOW7EO9S31/dev2/event``QOW7EO9S31/dev1/control`的转发.
![](img/rule_set_2to1.png)
![](image/iothub_guide/rule_set_2to1.png)
这样, 在平台侧dev1到dev2的双向数据通路就打通了.
@@ -170,21 +170,21 @@ Client和Broker之间的发布和订阅是根据主题(Topic)来进行的, 不
可以在产品列表下找到"云日志", 点击搜索即可显示对应的行为日志
![](img/log_search.png)
![](image/iothub_guide/log_search.png)
参考日志如下, 可以看到日志记录了设备的连接, 连接断开, 发布, 订阅等行为, 也记录了规则引擎的操作, 还有CMQ队列的一些行为日志. 但是关于设备发布的消息内容, 在云日志中无法查看, 需要借助消息队列CMQ.
![](img/log.png)
![](image/iothub_guide/log.png)
消息队列CMQ
可以在产品列表中找到"消息队列"选项, 设置队列所想要接收的消息类型后保存配置, 即可将平台侧收到的设备消息额外发送到腾讯云消息队列CMQ组件中.
![](img/cmq.png)
![](image/iothub_guide/cmq.png)
设置完消息队列后可以在"云产品"中搜索CMQ, 即可找到对应的消息队列, 点击"开始接收消息" 接收消息队列中的内容, 参考如下
![](img/cmq_info.png)
![](image/iothub_guide/cmq_info.png)
其中可以看到有些消息带有"PayloadLen"和"Playload"字段, 即为具体的消息内容.
@@ -208,13 +208,13 @@ Client和Broker之间的发布和订阅是根据主题(Topic)来进行的, 不
在工程中新建`hal``at``mqtt`组, 并添加下列源文件可以参考TencentOS_tiny\board\TencentOS_tiny_EVB_MX\KEIL\tencent_os_mqtt工程:
![](img\mqtt_file.png)
![](image/iothub_guide/mqtt_file.png)
上述文件分别位于`TencentOS_tiny\net\at`, `TencentOS_tiny\components\connectivity\Eclipse-Paho-MQTT``TencentOS_tiny\platform\hal\st\stm32l4xx\src`目录下.
相应的, 也需要引入对应的头文件
![](img\mqtt_header.png)
![](image/iothub_guide/mqtt_header.png)
**适配AT HAL层串口及网络接口函数**

View File

@@ -31,17 +31,17 @@ make install
## 配置eclipse
![](./img/riscv/properties.png)
![](./image/riscv/properties.png)
配置toolchain路径
![](./img/riscv/toolchain.png)
![](./image/riscv/toolchain.png)
配置openocd路径
![](./img/riscv/openocd.png)
![](./image/riscv/openocd.png)
##调试设置
@@ -53,7 +53,7 @@ set arch riscv:rv32
set remotetimeout 250
```
![](./img/riscv/debug.png)
![](./image/riscv/debug.png)
## 如果用gd-link调试

View File

@@ -58,7 +58,7 @@ $ mv TencentOS_tiny tiny
tiny/osal/cmsis_os/
```
![](./picture/porting/porting_cubeide_006.png)
![](./image/porting/porting_cubeide_006.png)
3. 在Inc目录下新建一个头文件`tos_config.h`

View File

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

Before

Width:  |  Height:  |  Size: 268 KiB

After

Width:  |  Height:  |  Size: 268 KiB

View File

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 130 KiB

View File

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 79 KiB

View File

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 69 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 1.5 MiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 116 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 117 KiB

After

Width:  |  Height:  |  Size: 117 KiB

View File

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 85 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 62 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

View File

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View File

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 393 KiB

After

Width:  |  Height:  |  Size: 393 KiB

View File

Before

Width:  |  Height:  |  Size: 204 KiB

After

Width:  |  Height:  |  Size: 204 KiB

View File

Before

Width:  |  Height:  |  Size: 636 KiB

After

Width:  |  Height:  |  Size: 636 KiB

View File

Before

Width:  |  Height:  |  Size: 209 KiB

After

Width:  |  Height:  |  Size: 209 KiB