Преглед изворни кода

[更新]文档格式调整

misonyo пре 7 година
родитељ
комит
45691cf350
7 измењених фајлова са 125 додато и 134 уклоњено
  1. 5 5
      README.md
  2. 1 1
      docs/README.md
  3. 10 10
      docs/api.md
  4. 2 2
      docs/introduction.md
  5. 92 101
      docs/samples.md
  6. 14 14
      docs/user-guide.md
  7. 1 1
      docs/version.md

+ 5 - 5
README.md

@@ -60,7 +60,7 @@ ROM(CODE + RO + RW)             : 32962 bytes(32.18K)
 
 - 使用 `menuconfig` 使能 iotkit 软件包并填写设备信息
 
-```shell
+```c
 RT-Thread online packages  --->
     IoT - internet of things  --->
         IoT Cloud  --->
@@ -81,7 +81,7 @@ RT-Thread online packages  --->
 
 - 增加 `mbedTLS` 帧大小(OTA 的时候**至少需要 8K 大小**)
 
-```shell
+```c
 RT-Thread online packages  --->
     security packages  --->
       -*- mbedtls:An open source, portable, easy to use, readable and flexible SSL library  --->
@@ -98,7 +98,7 @@ RT-Thread online packages  --->
 
 该示例程序演示了如何使用 MQTT 发布、订阅 Topic,MSH 命令如下所示:
 
-```shell
+```c
 msh />ali_mqtt_test
 ali_mqtt_test|502 :: iotkit-embedded sdk version: V2.10
 [inf] iotx_device_info_init(40): device_info created successfully!
@@ -114,7 +114,7 @@ mqtt_client|324 :: out of sample!
 
 该示例程序演示了如何使用 MQTT 发布、订阅 Topic,并一直监听订阅 Topic 的消息,MSH 命令如下所示:
 
-```shell
+```c
 msh />ali_mqtt_test loop
 ali_mqtt_test|502 :: iotkit-embedded sdk version: V2.10
 [dbg] iotx_device_info_init(32): device_info already created, return!
@@ -133,7 +133,7 @@ event_handle|111 :: subscribe success, packet-id=0
 
 该示例程序演示了如何使用阿里云 OTA 服务,使用 `ali_ota_test` 命令启动例程,这个时候,设备首先会上报当前版本号到阿里云,然后等待云端下发 OTA 升级命令。
 
-```shell
+```c
 msh />ali_ota_test
 ali_ota_main|325 :: iotkit-embedded sdk version: V2.10
 [dbg] iotx_device_info_init(32): device_info already created, return!

+ 1 - 1
docs/README.md

@@ -2,7 +2,7 @@
 
 ## 文档列表
 
-|文件名                             |描述|
+|**文件名**                             |**描述**|
 |:-----                             |:----|
 |[version.md](version.md)           |版本信息|
 |[introduction.md](introduction.md) |详细介绍|

+ 10 - 10
docs/api.md

@@ -9,7 +9,7 @@
 
 ## 必选 API
 
-| 序号  | 函数名 | 说明  |
+|**序号**  |**函数名** |**说明**  |
 |:- | :------ |:------|
 | 1 | IOT_OpenLog | 开始打印日志信息(log), 接受一个 `const char *` 为入参, 表示模块名字    |
 | 2 | IOT_CloseLog | 停止打印日志信息(log), 入参为空                                  |
@@ -19,7 +19,7 @@
 
 ## MQTT 功能相关 API
 
-| 序号  | 函数名   | 说明   |
+|**序号**  |**函数名**   |**说明**   |
 |:-  | :------- |:------|
 |  1    | IOT_SetupConnInfo            | MQTT连接前的准备, 基于`DeviceName + DeviceSecret + ProductKey`产生MQTT连接的用户名和密码等 |
 |  2    | IOT_SetupConnInfoSecure      | MQTT连接前的准备, 基于`ID2 + DeviceSecret + ProductKey`产生MQTT连接的用户名和密码等,ID2模式启用|
@@ -35,7 +35,7 @@
 
 ## CoAP 功能相关 API
 
-| 序号  | 函数名   | 说明   |
+|**序号**  |**函数名**   |**说明**   |
 |:-  | :------- |:------|
 |  1    | IOT_CoAP_Init                | CoAP实例的构造函数, 入参为`iotx_coap_config_t`结构体, 返回创建的CoAP会话句柄   |
 |  2    | IOT_CoAP_Deinit              | CoAP实例的摧毁函数, 入参为`IOT_CoAP_Init()`所创建的句柄                        |
@@ -47,7 +47,7 @@
 
 ## HTTP 功能相关 API
 
-| 序号  | 函数名   | 说明   |
+|**序号**  |**函数名**   |**说明**   |
 |:-  | :------- |:------|
 |  1    | IOT_HTTP_Init                | Https实例的构造函数, 创建一个HTTP会话的句柄并返回                                      |
 |  2    | IOT_HTTP_DeInit              | Https实例的摧毁函数, 销毁所有相关的数据结构                                            |
@@ -57,7 +57,7 @@
 
 ## OTA 功能相关 API
 
-| 序号  | 函数名   | 说明   |
+|**序号**  |**函数名**   |**说明**   |
 |:-  | :------ |:------|
 |  1    | IOT_OTA_Init                 | OTA实例的构造函数, 创建一个OTA会话的句柄并返回                                         |
 |  2    | IOT_OTA_Deinit               | OTA实例的摧毁函数, 销毁所有相关的数据结构                                              |
@@ -73,7 +73,7 @@
 
 ## 云端连接 Cloud Connection 功能相关 API
 
-| 序号  | 函数名   | 说明   |
+|**序号**  |**函数名**   |**说明**   |
 |:-  | :------- |:------|
 |  1    | IOT_Cloud_Connection_Init    | 云端连接实例的构造函数, 入参为`iotx_cloud_connection_param_pt`结构体, 返回创建的云端连接会话句柄   |
 |  2    | IOT_Cloud_Connection_Deinit  | 云端连接实例的摧毁函数, 入参为`IOT_Cloud_Connection_Init()`所创建的句柄                        |
@@ -82,7 +82,7 @@
 
 ## CMP 功能相关 API
 
-| 序号  | 函数名   | 说明   |
+|**序号**  |**函数名**   |**说明**   |
 |:-  | :------- |:------|
 |  1    | IOT_CMP_Init                 | CMP实例的构造函数, 入参为`iotx_cmp_init_param_pt`结构体,只存在一个CMP实例     |
 |  2    | IOT_CMP_Register             | 通过CMP订阅服务                                                                |
@@ -100,7 +100,7 @@
 
 ## 设备影子相关(可选功能) API
 
-| 序号  | 函数名   | 说明   |
+|**序号**  |**函数名**   |**说明**   |
 |:-  | :------- |:------|
 |  1    | IOT_Shadow_Construct            | 建立一个设备影子的MQTT连接, 并返回被创建的会话句柄                              |
 |  2    | IOT_Shadow_Destroy              | 摧毁一个设备影子的MQTT连接, 销毁所有相关的数据结构, 释放内存, 断开连接          |
@@ -116,7 +116,7 @@
 
 ## 主子设备相关(可选功能) API
 
-| 序号  | 函数名   | 说明   |
+|**序号**  |**函数名**   |**说明**   |
 |:-  | :------- |:------|
 |  1    | IOT_Gateway_Construct           | 建立一个主设备,建立MQTT连接, 并返回被创建的会话句柄                            |
 |  2    | IOT_Gateway_Destroy             | 摧毁一个主设备的MQTT连接, 销毁所有相关的数据结构, 释放内存, 断开连接            |
@@ -135,7 +135,7 @@
 
 ## linkkit 功能相关 API
 
-| 序号  | 函数名   | 说明   |
+|**序号**  |**函数名**   |**说明**   |
 |:-  | :------- |:------|
 |  1    | linkkit_start                   | 启动 linkkit 服务,与云端建立连接并安装回调函数                                 |
 |  2    | linkkit_end                     | 停止 linkkit 服务,与云端断开连接并回收资源                                     |

+ 2 - 2
docs/introduction.md

@@ -39,7 +39,7 @@ iotkit SDK 为了方便设备上云封装了丰富的连接协议,如 MQTT、C
 
 **iotkit-embedded** 软件包是阿里物联网平台 C-SDK 源码,包含连接阿里云所必须的软件包。
 
-```shell
+```c
 ali-iotkit
 |   README.md                       // 软件包使用说明
 |   SConscript                      // RT-Thread 默认的构建脚本
@@ -68,7 +68,7 @@ iotkit-embedded 软件包是阿里物联网平台 C-SDK 源码,未经修改,
 
 iotkit-embedded 软件包目录结构如下所示:
 
-```shell
+```c
 +-- LICENSE           : 软件许可证, Apache-2.0 版本软件许可证
 +-- make.settings     : 功能裁剪配置, 如 MQTT|CoAP, 或裁剪如 OTA|Shadow
 +-- README.md         : 快速开始导引

+ 92 - 101
docs/samples.md

@@ -48,48 +48,44 @@ LinkDevelop 平台以 RGB_LED 为例,介绍设备与云端如何进行双向
 
 - **获取软件包**
 
-    打开 RT-Thread 提供的 ENV 工具,使用 **menuconfig** 配置软件包。
-  
-    - 配置 iotkit 软件包
-  
-      配置使能 iotkit 软件包并**填写设备激活凭证**。
-
-      `menuconfig` 中选择阿里云平台为 **LinkDevelop**,`OTA channel` 选择 **MQTT**(以 MQTT 为例),详细的配置如下所示:
-
-    ```shell
-    RT-Thread online packages  --->
-        IoT - internet of things  --->
-            IoT Cloud  --->
-              [*] Ali-iotkit:  Ali Cloud SDK for IoT platform  --->
-                    Select Aliyun platform (LinkDevelop Platform)  --->
-              (a1dSQSGZ77X) Config Product Key
-              (RGB-LED-DEV-1) Config Device Name
-              (Ghuiyd9nmGowdZzjPqFtxhm3WUHEbIlI) Config Device Secret
-              -*-   Enable MQTT
-              [*]     Enable MQTT sample
-              [*]     Enable MQTT direct connect
-              [*]     Enable SSL
-              [ ]   Enable COAP
-              [*]   Enable OTA
-                          Select OTA channel (Use MQTT OTA channel)  --->
-                        version (latest)  --->
-    ```
+打开 RT-Thread 提供的 Env 工具,使用 **menuconfig** 配置软件包。
+
+* **配置 iotkit 软件包**
+
+配置使能 iotkit 软件包并**填写设备激活凭证**。 `menuconfig` 中选择阿里云平台为 **LinkDevelop**,`OTA channel` 选择 **MQTT**(以 MQTT 为例),详细的配置如下所示:
+
+```c
+RT-Thread online packages  --->
+    IoT - internet of things  --->
+        IoT Cloud  --->
+          [*] Ali-iotkit:  Ali Cloud SDK for IoT platform  --->
+                Select Aliyun platform (LinkDevelop Platform)  --->
+          (a1dSQSGZ77X) Config Product Key
+          (RGB-LED-DEV-1) Config Device Name
+          (Ghuiyd9nmGowdZzjPqFtxhm3WUHEbIlI) Config Device Secret
+          -*-   Enable MQTT
+          [*]     Enable MQTT sample
+          [*]     Enable MQTT direct connect
+          [*]     Enable SSL
+          [ ]   Enable COAP
+          [*]   Enable OTA
+                      Select OTA channel (Use MQTT OTA channel)  --->
+                    version (latest)  --->
+```
   
-    - 增加 `mbedTLS` 帧大小
-
-      阿里 TLS 认证过程中数据包较大,这里需要增加 TLS 帧大小,OTA 的时候**至少需要 8K** 大小。
+* **增加 `mbedTLS` 帧大小**
 
-      打开 RT-Thread 提供的 ENV 工具,使用 **menuconfig** 配置 **TLS** 帧大小。
+阿里 TLS 认证过程中数据包较大,这里需要增加 TLS 帧大小,OTA 的时候**至少需要 8K** 大小。 打开 RT-Thread 提供的 Env 工具,使用 **menuconfig** 配置 **TLS** 帧大小。
 
-    ```shell
-    RT-Thread online packages  --->
-        security packages  --->
-          -*- mbedtls:An open source, portable, easy to use, 
-                      readable and flexible SSL library  --->
-          (8192) Maxium fragment length in bytes
-    ```
+```c
+RT-Thread online packages  --->
+    security packages  --->
+      -*- mbedtls:An open source, portable, easy to use, 
+                  readable and flexible SSL library  --->
+      (8192) Maxium fragment length in bytes
+```
 
-    - 使用 `pkgs --update` 命令下载软件包
+配置好后使用 `pkgs --update` 命令下载软件包。
 
 ### MQTT 示例
 
@@ -97,7 +93,7 @@ LinkDevelop 平台以 RGB_LED 为例,介绍设备与云端如何进行双向
 
 **示例文件**
 
-| 示例程序路径                   | 验证平台      | 说明 |
+| **示例程序路径**                   | **验证平台**      | **说明** |
 | ----                          | ---          | ---- |
 | samples/mqtt/mqtt-example.c   | LinkDevelop, LinkPlatform | 基于 MQTT 通道的设备和云双向通信例程 |
 
@@ -105,7 +101,7 @@ LinkDevelop 平台以 RGB_LED 为例,介绍设备与云端如何进行双向
 
 例程中,使用 MSH 命令启动 MQTT 例程,命令如下所示:
 
-|命令|说明|
+|**命令**|**说明**|
 |----|----|
 | ali_mqtt_test start     | 启动 MQTT 示例 |
 | ali_mqtt_test pub open  | 开灯,并向云端同步开灯状态 |
@@ -118,7 +114,7 @@ LinkDevelop 平台以 RGB_LED 为例,介绍设备与云端如何进行双向
 
 设备 log 如下所示:
 
-```shell
+```c
 msh />ali_mqtt_test start
 ali_mqtt_main|645 :: iotkit-embedded sdk version: V2.10
 [inf] iotx_device_info_init(40): device_info created successfully!
@@ -148,7 +144,7 @@ event_handle|124 :: subscribe success, packet-id=0
 
 设备 log 如下所示:
 
-```shell
+```c
 msh />ali_mqtt_test pub open
 ···
 [dbg] iotx_mc_cycle(1277): PUBLISH
@@ -191,7 +187,7 @@ _demo_message_arrive|192 :: ----
 
 使用调试控制台发送命令后,设备可以接受到命令,log 如下所示:
 
-```shell
+```c
 [dbg] iotx_mc_handle_recv_PUBLISH(1091):         Packet Ident : 00000000
 [dbg] iotx_mc_handle_recv_PUBLISH(1092):         Topic Length : 52
 [dbg] iotx_mc_handle_recv_PUBLISH(1096):           Topic Name : /sys/a1Ayv8xhoIl/RGB-DEV1/thing/service/property/set
@@ -231,7 +227,7 @@ mqtt_client|329 :: out of sample!
 
 **示例文件**
 
-| 示例程序路径                                    | 验证平台      | 说明 |
+| **示例程序路径**                                    | **验证平台**      | **说明** |
 | ----                                           | ---          | ---- |
 | samples/ota/ota_mqtt-example.c     | LinkDevelop, LinkPlatform  | 基于 MQTT 通道的设备 OTA 例程 |
 
@@ -239,7 +235,7 @@ mqtt_client|329 :: out of sample!
 
 例程中,使用 MSH 命令启动 OTA 例程,命令如下所示:
 
-|命令|说明|
+|**命令**|**说明**|
 |----|----|
 | ali_ota_test start | 启动 OTA 示例 |
 | ali_ota_test stop  | 手动退出 OTA 示例 |
@@ -250,7 +246,7 @@ mqtt_client|329 :: out of sample!
 
 设备 log 如下所示:
 
-```shell
+```c
 msh />ali_ota_test start
 ali_ota_main|372 :: iotkit-embedded sdk version: V2.10
 [inf] iotx_device_info_init(40): device_info created successfully!
@@ -288,7 +284,7 @@ mqtt_client|241 :: wait ota upgrade command....
 
 推送成功后,设备开始下载固件,下载完成后自动进行固件完整性校验,设备端测试日志如下所示:
 
-```shell
+```c
 ···
 mqtt_client|254 :: Here write OTA data to file....
 [dbg] IOT_OTA_Ioctl(457): 
@@ -311,7 +307,7 @@ mqtt_client|294 :: OTA FW version: v10
 
 升级成功或者升级失败会自动退出 OTA 例程,如果需要手动退出 OTA 例程,请使用 **`ali_ota_test stop`** 命令。
 
-```shell
+```c
 msh />ali_ota_test stop
 msh />[dbg] iotx_mc_disconnect(2121): rc = MQTTDisconnect() = 0
 [inf] _network_ssl_disconnect(514): ssl_disconnect
@@ -365,49 +361,44 @@ mqtt_client|340 :: out of sample!
 
 * **获取软件包**
 
-    打开 RT-Thread 提供的 ENV 工具,使用 **menuconfig** 配置软件包。
+打开 RT-Thread 提供的 Env 工具,使用 **menuconfig** 配置软件包。
   
-    + 配置 iotkit 软件包
++ 配置 iotkit 软件包
   
-      配置使能 iotkit 软件包并**填写设备激活凭证**。
-
-      `menuconfig` 中选择阿里云平台为 **LinkPlatform**,`OTA channel` 选择 **MQTT**(以 MQTT 为例),详细的配置如下所示:
-
-    ```shell
-    RT-Thread online packages  --->
-        IoT - internet of things  --->
-            IoT Cloud  --->
-              [*] Ali-iotkit:  Ali Cloud SDK for IoT platform  --->
-                    Select Aliyun platform (LinkPlatform Platform)  --->
-              (a1dSQSGZ77X) Config Product Key
-              (RGB-LED-DEV-1) Config Device Name
-              (Ghuiyd9nmGowdZzjPqFtxhm3WUHEbIlI) Config Device Secret
-              -*-   Enable MQTT
-              [*]     Enable MQTT sample
-              [*]     Enable MQTT direct connect
-              [*]     Enable SSL
-              [ ]   Enable COAP
-              [*]   Enable OTA
-                          Select OTA channel (Use MQTT OTA channel)  --->
-                        version (latest)  --->
-    ```
+配置使能 iotkit 软件包并**填写设备激活凭证**。`menuconfig` 中选择阿里云平台为 **LinkPlatform**,`OTA channel` 选择 **MQTT**(以 MQTT 为例),详细的配置如下所示:
+
+```c
+RT-Thread online packages  --->
+    IoT - internet of things  --->
+        IoT Cloud  --->
+          [*] Ali-iotkit:  Ali Cloud SDK for IoT platform  --->
+                Select Aliyun platform (LinkPlatform Platform)  --->
+          (a1dSQSGZ77X) Config Product Key
+          (RGB-LED-DEV-1) Config Device Name
+          (Ghuiyd9nmGowdZzjPqFtxhm3WUHEbIlI) Config Device Secret
+          -*-   Enable MQTT
+          [*]     Enable MQTT sample
+          [*]     Enable MQTT direct connect
+          [*]     Enable SSL
+          [ ]   Enable COAP
+          [*]   Enable OTA
+                      Select OTA channel (Use MQTT OTA channel)  --->
+                    version (latest)  --->
+```
   
-    + 增加 `mbedTLS` 帧大小
-
-      阿里 TLS 认证过程中数据包较大,这里需要增加 TLS 帧大小,OTA 的时候**至少需要 8K** 大小。
-
-      打开 RT-Thread 提供的 ENV 工具,使用 **menuconfig** 配置 **TLS** 帧大小。
++ 增加 `mbedTLS` 帧大小
 
-    ```{.c}
-    RT-Thread online packages  --->
-        security packages  --->
-          -*- mbedtls:An open source, portable, easy to use, 
-                      readable and flexible SSL library  --->
-          (8192) Maxium fragment length in bytes
-    ```
+阿里 TLS 认证过程中数据包较大,这里需要增加 TLS 帧大小,OTA 的时候**至少需要 8K** 大小。打开 RT-Thread 提供的 Env 工具,使用 **menuconfig** 配置 **TLS** 帧大小。
 
-    + 使用 `pkgs --update` 命令下载软件包
+```c
+RT-Thread online packages  --->
+    security packages  --->
+      -*- mbedtls:An open source, portable, easy to use, 
+                  readable and flexible SSL library  --->
+      (8192) Maxium fragment length in bytes
+```
 
++ 使用 `pkgs --update` 命令下载软件包
 
 ### MQTT 示例
 
@@ -415,7 +406,7 @@ mqtt_client|340 :: out of sample!
 
 **示例文件**
 
-| 示例程序路径                   | 验证平台      | 说明 |
+|**示例程序路径**                   |**验证平台**      |**说明** |
 | ----                          | ---          | ---- |
 | samples/mqtt/mqtt-example.c   | LinkDevelop, LinkPlatform | 基于 MQTT 通道的设备和云双向通信例程 |
 
@@ -436,7 +427,7 @@ mqtt_client|340 :: out of sample!
 
 设备 log 如下所示:
 
-```shell
+```c
 msh />ali_mqtt_test start
 ali_mqtt_main|645 :: iotkit-embedded sdk version: V2.10
 [inf] iotx_device_info_init(40): device_info created successfully!
@@ -463,7 +454,7 @@ event_handle|124 :: subscribe success, packet-id=0
 
 设备 log 如下所示:
 
-```shell
+```c
 msh />ali_mqtt_test pub open
 ali_mqtt_test_pub|583 ::
  publish message:
@@ -502,7 +493,7 @@ _demo_message_arrive|192 :: ----
 
 使用调试控制台发送命令后,设备可以接受到命令,log 如下所示:
 
-```shell
+```c
 msh />[dbg] iotx_mc_cycle(1277): PUBLISH
 [dbg] iotx_mc_handle_recv_PUBLISH(1091):         Packet Ident : 00000000
 [dbg] iotx_mc_handle_recv_PUBLISH(1092):         Topic Length : 31
@@ -540,7 +531,7 @@ mqtt_client|329 :: out of sample!
 
 **示例文件**
 
-| 示例程序路径                                    | 验证平台      | 说明 |
+|**示例程序路径**                                    |**验证平台**      |**说明** |
 | ----                                           | ---          | ---- |
 | samples/ota/ota_mqtt-example.c     | LinkDevelop, LinkPlatform  | 基于 MQTT 通道的设备 OTA 例程 |
 
@@ -548,7 +539,7 @@ mqtt_client|329 :: out of sample!
 
 例程中,使用 MSH 命令启动 OTA 例程,命令如下所示:
 
-|命令|说明|
+|**命令**|**说明**|
 |----|----|
 | ali_ota_test start | 启动 OTA 示例 |
 | ali_ota_test stop  | 手动退出 OTA 示例 |
@@ -559,7 +550,7 @@ mqtt_client|329 :: out of sample!
 
 设备 log 如下所示:
 
-```shell
+```c
 msh />ali_ota_test start
 ali_ota_main|372 :: iotkit-embedded sdk version: V2.10
 [inf] iotx_device_info_init(40): device_info created successfully!
@@ -594,7 +585,7 @@ mqtt_client|241 :: wait ota upgrade command....
 
 推送成功后,设备开始下载固件,下载完成后自动进行固件完整性校验,设备端测试日志如下所示:
 
-```shell
+```c
 ···
 mqtt_client|254 :: Here write OTA data to file....
 [dbg] IOT_OTA_Ioctl(457): 
@@ -615,7 +606,7 @@ mqtt_client|294 :: OTA FW version: v10
 
 升级成功或者升级失败会自动退出 OTA 例程,如果需要手动退出 OTA 例程,请使用 **`ali_ota_test stop`** 命令。
 
-```shell
+```c
 msh />ali_ota_test stop
 msh />[dbg] iotx_mc_disconnect(2121): rc = MQTTDisconnect() = 0
 [inf] _network_ssl_disconnect(514): ssl_disconnect
@@ -625,14 +616,14 @@ msh />[dbg] iotx_mc_disconnect(2121): rc = MQTTDisconnect() = 0
 mqtt_client|340 :: out of sample!
 ```
 
-## 注意事项
-
-- 使用前请在 `menuconfig` 里配置自己的设备激活凭证(PRODUCT_KEY、DEVICE_NAME 和 DEVICE_SECRET)
-- 使用 `menuconfig` 配置选择要接入的平台(**LinkDevelop** 或者 **LinkPlatform**)
-- 开启 OTA 功能必须使能加密连接,默认选择(因为 OTA 升级**必须使用 HTTPS** 下载固件)
+!!! note "注意事项"
+    - 使用前请在 `menuconfig` 里配置自己的设备激活凭证(PRODUCT_KEY、DEVICE_NAME 和 DEVICE_SECRET)
+    - 使用 `menuconfig` 配置选择要接入的平台(**LinkDevelop** 或者 **LinkPlatform**)
+    - 开启 OTA 功能必须使能加密连接,默认选择(因为 OTA 升级**必须使用 HTTPS** 下载固件)
 
 ## 常见问题
 
-- MbedTLS 返回 0x7200 错误
+### Q: MbedTLS 返回 0x7200 错误
 
-    通常是由于 MbedTLS 帧长度过小,请增加 MbedTLS 帧长度(**至少需要 8K 大小**)。
+**A:** 通常是由于 MbedTLS 帧长度过小,请增加 MbedTLS 帧长度(**至少需要 8K 大小**)。
+ 

+ 14 - 14
docs/user-guide.md

@@ -58,7 +58,7 @@
 
 示例代码如下:
 
-```{.c}
+```c
 while(1)
 {
     IOT_MQTT_Yield(pclient, 200); 
@@ -72,7 +72,7 @@ while(1)
 
 代码如下:
 
-```{.c}
+```c
 /* Subscribe the specific topic */
 rc = IOT_MQTT_Subscribe(pclient, TOPIC_DATA, IOTX_MQTT_QOS1, 
                         _demo_message_arrive, NULL);
@@ -90,7 +90,7 @@ if (rc < 0) {
 
 代码如下:
 
-```{.c}
+```c
 /* Initialize topic information */
 memset(&topic_msg, 0x0, sizeof(iotx_mqtt_topic_info_t));
 strcpy(msg_pub, "message: hello! start!");
@@ -115,7 +115,7 @@ EXAMPLE_TRACE("rc = IOT_MQTT_Publish() = %d", rc);
 
 代码如下:
 
-```{.c}
+```c
 /* handle the MQTT packet received from TCP or SSL connection */
 IOT_MQTT_Yield(pclient, 200);
 ```
@@ -126,7 +126,7 @@ IOT_MQTT_Yield(pclient, 200);
 
 代码如下:
 
-```{.c}
+```c
 IOT_MQTT_Destroy(&pclient);
 ```
 
@@ -146,7 +146,7 @@ IOT_MQTT_Destroy(&pclient);
 
 示例代码:
 
-```{.c}
+```c
 iotx_mqtt_param_t mqtt_params;
 
 memset(&mqtt_params, 0x0, sizeof(mqtt_params));
@@ -184,7 +184,7 @@ CoAP 协议适用在资源受限的低功耗设备上,尤其是 NB-IoT 的设
 
 示例代码:
 
-```{.c}
+```c
 iotx_coap_context_t *p_ctx = NULL;
 p_ctx = IOT_CoAP_Init(&config);
 if (NULL != p_ctx) {
@@ -208,7 +208,7 @@ SDK 使用接口 IOT_CoAP_SendMessage 发送数据,使用 IOT_CoAP_GetMessageP
 
 示例代码:
 
-```{.c}
+```c
 /* send data */
 static void iotx_post_data_to_server(void *param)
 {
@@ -289,7 +289,7 @@ static void iotx_response_handler(void *arg, void *p_response)
 
 OTA 模块的初始化依赖于 MQTT 连接,即先获得的 MQTT 客户端句柄 pclient。
 
-```{.c}
+```c
 h_ota = IOT_OTA_Init(PRODUCT_KEY, DEVICE_NAME, pclient);
 if (NULL == h_ota) {
     rc = -1;
@@ -303,7 +303,7 @@ if (NULL == h_ota) {
 
 示例代码如下:
 
-```{.c}
+```c
 if (0 != IOT_OTA_ReportVersion(h_ota, "version2.0")) {
     rc = -1;
     printf("report OTA version failed\n");
@@ -320,7 +320,7 @@ MQTT 通道获取到 OTA 固件下载的 URL 后,使用 HTTPS 下载固件,
 
 示例代码:
 
-```{.c}
+```c
 // 判断是否有固件可下载
 if (IOT_OTA_IsFetching(h_ota)) {
     unsigned char buf_ota[OTA_BUF_LEN];
@@ -339,7 +339,7 @@ if (IOT_OTA_IsFetching(h_ota)) {
 
 使用 IOT_OTA_ReportProgress 接口上报固件下载进度。
 
-```{.c}
+```c
 if (percent - last_percent > 0) {
     IOT_OTA_ReportProgress(h_ota, percent, NULL);
 }
@@ -350,7 +350,7 @@ IOT_MQTT_Yield(pclient, 100);
 
 固件下载完成后,使用 IOT_OTA_Ioctl 接口校验固件的完整性。
 
-```{.c}
+```c
 int32_t firmware_valid;
 IOT_OTA_Ioctl(h_ota, IOT_OTAG_CHECK_FIRMWARE, &firmware_valid, 4);
 if (0 == firmware_valid) {
@@ -364,7 +364,7 @@ if (0 == firmware_valid) {
 
 使用 IOT_OTA_Deinit 销毁 OTA 连接并释放内存。
 
-## 参考
+## 参考资料
 
 - 以上内容引自阿里云物联网平台使用文档,详细内容请访问[阿里云物联网平台文档中心](https://help.aliyun.com/document_detail/30522.html?spm=a2c4g.11186623.6.539.8UAzmn)进行查阅
 - 更多的 API 使用说明请参考 API 使用文档

+ 1 - 1
docs/version.md

@@ -1,5 +1,5 @@
 # 版本和修订 #
 
-| Date       | Version   |  Author    | Note  |
+| **Date**       | **Version**  |  **Author**    | **Note**  |
 | --------   | :-----:   | :----      | :---- |
 | 2018-07-21 | v0.1      | MurphyZhao | 初始版本 |