Ver código fonte

[update]补充 RW007 BLE 功能说明。

liangyingjian 4 anos atrás
pai
commit
e01666cfcb
2 arquivos alterados com 586 adições e 2 exclusões
  1. 287 0
      README.md
  2. 299 2
      README_ZH.md

+ 287 - 0
README.md

@@ -42,6 +42,9 @@ Type description
 |PKG_USING_RW007|bool|Enable rw007 driver, use this software package, you need to define this macro|
 |RW007_USING_STM32_DRIVERS|bool|Enable STM32 platform migration example|
 |RW007_USING_IMXRT_DRIVERS|bool|Enable IMXRT platform migration example|
+|RW007_USING_BLE|bool|Enable the BLE function (only effective in V2.1.0 or later)|
+|RW007_USING_POWERSWITCH_EXAMPLE|bool|Enable the power-saving example of the switch under the STM32 platform(only effective in V2.1.0 or later)|
+|RW007_USING_SPI_TEST|bool|Enable the SPI throughput test function(only effective in V2.1.0 or later)|
 |RW007_SPI_BUS_NAME|string|The SPI bus device name used in example|
 |RW007_CS_PIN|int|The serial number of the SPI chip select pin used in the example in the pin driver|
 |RW007_BOOT0_PIN|int|The serial number of the BOOT0 pin used in the example in the pin driver (the same pin is multiplexed with the CLK of SPI)|
@@ -49,6 +52,290 @@ Type description
 |RW007_INT_BUSY_PIN|int|The serial number of the INT/BUSY pin used in the example in the pin driver|
 |RW007_RST_PIN|int|The serial number of the RST pin used in the example in the pin driver|
 
+### 1.5 BLE function description
+The version above V2.1.0 supports enabling the Bluetooth BLE function. The usage method is as follows.
+   Enter `menuconfig` in the `env` command line to configure
+```
+-> RT-Thread online packages
+  -> IoT
+    ->internet of things
+      -> WiFi
+        --- rw007: SPI WIFI rw007 driver
+              version(v2.1.0)
+          [*] use ble function
+          (300000000) SPI Max Hz
+          (spi1) RW007 BUS NAME
+          (22) CS pin index
+          (39) INT/BUSY pin index
+          (9) RESET pin index
+          [*] example driver: rw007 for stm32
+          [*] test: spi throughput capability and packet loss testing
+          [*] example: save power by switching
+```
+#### 1.5.1 BLE function test example command description
+When the `ble` function in the `rw007` software package is turned on, the relevant functional test examples will be opened by default. You can enter `rw007_ble` to query through the `msh` command line.
+
+```
+msh />rw007_ble
+rw007_ble help
+rw007_ble init central/peripheral                           Note: init ble mode
+rw007_ble get_addr                                          Note: get ble address
+rw007_ble update_params                                     Note: update connect parameters(no support)
+rw007_ble scan                                              Note: scan ble slave
+rw007_ble stop_scan                                         Note: stop scan
+rw007_ble connect xx:xx:xx:xx:xx:xx                         Note: use slave addr to connect
+rw007_ble disconnect [conn_handle]                          Note: disconnect slave
+rw007_ble get_server                                        Note: discover all server(no support)
+rw007_ble get_char                                          Note: discover all description(no support)
+rw007_ble get_disc                                          Note: discover all characteristic(no support)
+rw007_ble mtu_exch                                          Note: ble mtu exchange(no support)
+rw007_ble notify                                            Note: enable ble notify(no support)
+rw007_ble write                                             Note: ble write data(no support)
+rw007_ble read                                              Note: ble read data(no support)
+rw007_ble notify_change [conn_handle] [UUID] [char_value]   Note: ble notify configure by uuid
+rw007_ble write_uuid [conn_handle] [UUID] [data]            Note: ble write data by uuid
+rw007_ble read_uuid [conn_handle] [UUID]                    Note: ble read data by uuid
+rw007_ble cfgwifi [duration_ms]                             Note: enable ble configuration wifi
+
+```
+#### 1.5.2 BLE function initialization
+The `BLE` function initialization function must be called to use the `BLE` function.
+
+* 1. The `RW007` BLE function is initialized as a host device.
+```
+rw007_ble init central
+```
+Example
+```
+msh />rw007_ble init central
+122-ble_cmd_init
+start ble central
+msh />
+```
+* 2. The `RW007`BLE function is initialized as a slave device.
+```
+rw007_ble init peripheral
+```
+Special note: At present, the slave function of RW007 only supports the use of WeChat applet.
+
+#### 1.5.3 Get the local BLE device address
+The address of BLE device is divided into `public`  address and `random` address.
+
+```
+rw007_ble get_addr
+```
+Example
+```
+msh />rw007_ble get_addr
+339 - ble_cmd_get_addr
+msh />ble data input packet resp_type: 0, len: 12
+public_id_addr = c8:47:8c:41:10:04
+random_id_addr = 00:00:00:00:00:00
+```
+#### 1.5.4 SCAN
+The `RW007` BLE function supports scanning the surrounding `BLE` devices through the `scan` command.
+
+* 1. Scanning of surrounding `BLE` devices
+```
+rw007_ble scan
+```
+Example
+```
+msh >rw007_ble scan
+365 - ble_cmd_scan
+msh >
+ble data input packet resp_type: 1, len: 37
+RW007_BLE_NTF_TYPE_DISCOVER
+received advertisement; event_type=0 rssi=-69 addr_type=1 addr=61:97:58:84:b3:fe
+mfg_data = 02 01 1a 02 0a 0c 0a ff 4c 00 10 05 42 1c e0 56 bc
+```
+The content of the `addr` address here can be used by the connected device later. Since the name of the corresponding BLE device is not directly displayed at present, the address of the BLE device needs to be manually determined first.
+
+* 2. Stop scanning surrounding `BLE` devices
+```
+rw007_ble stop_scan
+```
+#### 1.5.5 CONNECT
+`RW007` BLE function device supports to connect to the device through the class `mac` address of the `BLE` device. This command only supports the master mode to connect to the class `mac` address of the slave device. After the connection is successful, there will be a corresponding `conn_handle `Value, this `conn_handle` value is used in other functions.
+
+Test command 
+```
+rw007_ble connect xx:xx:xx:xx:xx:xx
+```
+Example
+```
+msh />rw007_ble connect 4c:ed:fb:00:04:b1
+198 - ble_cmd_connect
+str_addr: 4c:ed:fb:00:04:b1
+mac addr: b1: 4: 0:fb:ed:4c
+msh />resp_type: 1, len: 52
+RW007_BLE_NTF_TYPE_CONNECT
+type: 0, status: 0, conn_handle: 1
+
+resp_type: 1, len: 44
+RW007_BLE_NTF_TYPE_CONNECT_DESC
+our_id_addr: c9:47:8c:42:00:48
+peer_id_addr: b1:04:00:fb:ed:4c
+```
+#### 1.5.6 DISCONNECT
+`RW007`BLE function device supports active disconnection of the slave device.
+```
+rw007_ble disconnect [conn_handle]
+```
+The requirements of `conn_handle` and `connect` are the same.
+
+Example
+```
+msh />rw007_ble disconnect 1
+341 - ble_cmd_disconnect
+msh />resp_type: 1, len: 52
+RW007_BLE_NTF_TYPE_DISCONN
+```
+#### 1.5.7 WRITE
+
+`RW007`BLE function to write data, supports writing corresponding data by specifying `UUID`.
+```
+rw007_ble write_uuid [conn_handle] [UUID] [data]
+```
+Instruction description: `[conn_handle]` is the corresponding value generated when `RW007` is connected to the device, `[UUID]` is the characteristic parameter of the corresponding `BLE` device, and `[data]` is the data to be sent.
+
+Example
+```
+msh />rw007_ble write_uuid 1 ebe0ccbe7a0a4b0c8a1a6ff2997da3a6 00
+data: 00
+write conn_hanle:1 uuid:ebe0ccbe7a0a4b0c8a1a6ff2997da3a6
+write rc:0
+```
+Note: In the test example, `[conn_handle]` is 1, `[UUID]` is `ebe0ccbe7a0a4b0c8a1a6ff2997da3a6`, and `[data]` is `0x00` (Hex value is used here)
+
+#### 1.5.8 Update the NOTIFY parameter
+
+`RW007` BLE function supports modifying the receiving `notify` parameters.
+```
+rw007_ble notify_change [conn_handle] [char_value] [UUID]
+```
+Parameter Description:
+
+`[conn_handle]` is the corresponding value generated when `RW007` is connected to the device
+
+`[char_value]` is the configuration parameter, as follows.
+```
+0:disable indication&notification
+1:enable notification,disable indication
+2:enable indication, disable notification
+3:enable indication &notification
+```
+`[UUID]` is the characteristic parameter value of the corresponding `BLE` device.
+#### 1.5.9 Description of broadcast packet types
+The type of broadcast packet `event` in the `RW007` BLE function can be divided into the following types.
+```
+/* Advertising report */
+#define BLE_HCI_ADV_RPT_EVTYPE_ADV_IND      (0)
+#define BLE_HCI_ADV_RPT_EVTYPE_DIR_IND      (1)
+#define BLE_HCI_ADV_RPT_EVTYPE_SCAN_IND     (2)
+#define BLE_HCI_ADV_RPT_EVTYPE_NONCONN_IND  (3)
+#define BLE_HCI_ADV_RPT_EVTYPE_SCAN_RSP     (4)
+```
+The broadcast packet structure is as follows:
+```
+Broadcast package structure description:
+struct ble_gap_disc_desc {
+     uint8_t event_type;
+     uint8_t length_data;
+     ble_addr_t addr;
+     int8_t rssi;
+     uint8_t *data;
+
+     /***
+      * LE direct advertising report fields; direct_addr is BLE_ADDR_ANY if
+      * direct address fields are not present.
+      */
+     ble_addr_t direct_addr;
+};
+
+Different broadcast packet types are distinguished by event_type. All types are divided into the following types:
+/* Advertising report */
+0: normal broadcast packet
+1: Direct broadcast package
+2: Scan request package
+3: Not connect to broadcast instructions
+4: Scan response packet
+```
+Therefore, in the `scan` scan response of the device, the corresponding `event_type` can be used to determine the type of broadcast packet.
+
+#### 1.6.0 READ
+`RW007` supports the function of reading data through `UUID`.
+```
+rw007_ble read_uuid [conn_handle] [UUID]
+```
+Parameter Description:
+
+`[conn_handle]` is the corresponding value generated when `RW007` is connected to the device
+
+`[UUID]` is the characteristic parameter of the corresponding `BLE` device.
+
+Example
+```
+msh />rw007_ble read_uuid 1 2a24
+read conn_hanle:1 uuid:2a24
+read rc:0
+msh />ble data input packet resp_type: 0, len: 18
+RW007_BLE_RSP_TYPE_READ
+connect:1 attr_handle:14 uuid: 24 2a  read data:
+00000000: 4C 59 57 53 44 30 33 4D 4D 43 00                 LYWSD03MMC.
+```
+Note: Here, `[conn_handle]` is 1, `[UUID]` is `2a24`, and the data read is the name of the BLE device.
+
+The RW007 module already supports the function of reading 128-bit UUID.
+
+Example
+
+```
+msh />rw007_ble read_uuid 1 ebe0ccbe7a0a4b0c8a1a6ff2997da3a6
+read conn_hanle:1 uuid:ebe0ccbe7a0a4b0c8a1a6ff2997da3a6
+read rc:0
+msh />ble data input packet resp_type: 0, len: 22
+RW007_BLE_RSP_TYPE_READ
+connect:1 attr_handle:51 uuid: a6 a3 7d 99 f2 6f 1a 8a 0c 4b 0a 7a be cc e0 eb  read data:
+00000000: 00                     
+```
+Note: Here `[conn_handle]` is 1, `[UUID]` is 128-bit `ebe0ccbe7a0a4b0c8a1a6ff2997da3a6`, and the read data value is `00`
+
+#### 1.6.1 BLE network configuration function description
+
+`RW007` supports the WeChat applet `BLE` network configuration function.
+
+```
+rw007_ble cfgwifi [duration_ms]    
+```
+Parameter Description:
+
+[duration_ms] is the duration for the module to broadcast to the outside world as a slave, in milliseconds (ms). The name of the `RW007` module to broadcast to the outside world is `RW007-XXXX`, where `XXXX` is the last 4 digits of the module's `mac` address .
+
+For the host-driven code, the host side can refer to the following implementation code to enter the `BLE` network distribution mode.
+```c
+rt_err_t rw007_ble_cfgwifi(uint32_t duration_ms)
+{
+    struct rw007_ble_cfgwifi cfgwifi;
+
+    cfgwifi.duration_ms = duration_ms;
+
+    return spi_set_data(wifi_sta.wlan, RW00x_CMD_BLE_CFGWIFI, &cfgwifi, sizeof(struct rw007_ble_cfgwifi));
+}
+```
+Example
+```
+msh />rw007_ble cfgwifi 30000
+msh />[420332] I/WLAN.mgnt: wifi connect success ssid:
+[421341] I/WLAN.lwip: Got IP address : 192.168.1.212
+```
+Note: `30000` is the duration of external broadcast of the `RW007` module as a slave. Once the duration exceeds the duration, the external broadcast will stop.
+
+***Some restrictions on the simultaneous use of BLE network configuration and BLE host functions***
+(1) The SCAN function of the host and the BLE network distribution cannot be used at the same time. When the `RW007` module is in the `Advertise` broadcast state (BLE slave function opens broadcast), and the host (stm32) executes the scan operation again, the scan operation will return an error Code, it means that the scan operation is invalid. The scan operation can not be performed normally until the broadcast status of `Advertise` ends, but this process does not affect the status of the connected device.
+
+(2) The SCAN function of the host and the BLE network configuration cannot be used at the same time. When the host (stm32) is performing the scan operation of the BLE host, and the `RW007` module is configured for `Advertise` broadcast at the same time, the scan operation will be interrupted. The scan operation can only be performed normally after the broadcast status of `Advertise` ends, but this process does not affect the status of connected devices.
+
 ## 2. Matters needing attention
 
 Because of the pin multiplexing situation, the driver of the bsp SPI needs to be configured during Config.

+ 299 - 2
README_ZH.md

@@ -4,7 +4,7 @@
 
 ## 1. 简介
 
-**RW007**是由上海睿赛德电子科技有限公司开发基于Cortex-M4 WIFI SOC的SPI/UART 高速wifi模块。该仓库为**rw007**的SPI驱动
+**RW007**是由上海睿赛德电子科技有限公司开发基于 WIFI SOC的SPI/UART 高速wifi模块。该仓库为**rw007**的SPI驱动
 
 **RW007**硬件设计简单,SPI模式下用户只需要预留1组SPI信号,一个中断输入,一个IO输出即可,包含电源和地总共8个引脚。
 
@@ -18,7 +18,7 @@
 
 ### 1.2 许可证
 
-at_device package 遵循 Apache 2.0 许可,详见 `LICENSE` 文件。
+rw007 package 遵循 Apache 2.0 许可,详见 `LICENSE` 文件。
 
 ### 1.3 依赖
 
@@ -42,6 +42,9 @@ at_device package 遵循 Apache 2.0 许可,详见 `LICENSE` 文件。
 |PKG_USING_RW007|bool|开启rw007驱动,使用该软件包则需要定义该宏|
 |RW007_USING_STM32_DRIVERS|bool|使能STM32平台移植示例|
 |RW007_USING_IMXRT_DRIVERS|bool|使能IMXRT平台移植示例|
+|RW007_USING_BLE|bool|使能开启BLE功能(仅在V2.1.0以上版本生效)|
+|RW007_USING_POWERSWITCH_EXAMPLE|bool|使能开启STM32平台下的开关省电示例(仅在V2.1.0以上版本生效)|
+|RW007_USING_SPI_TEST|bool|使能开启SPI 吞吐量测试功能(仅在V2.1.0以上版本生效)|
 |RW007_SPI_BUS_NAME|string|example中使用的SPI总线设备名称|
 |RW007_CS_PIN|int|example中使用的SPI 片选引脚在pin驱动中的序号|
 |RW007_BOOT0_PIN|int|example中使用的BOOT0引脚在pin驱动中的序号(与SPI的CLK是同一引脚复用)|
@@ -49,6 +52,300 @@ at_device package 遵循 Apache 2.0 许可,详见 `LICENSE` 文件。
 |RW007_INT_BUSY_PIN|int|example中使用的INT/BUSY引脚在pin驱动中的序号|
 |RW007_RST_PIN|int|example中使用的RST引脚在pin驱动中的序号|
 
+### 1.5 BLE 功能说明
+  在 V2.1.0 以上的版本支持开启蓝牙 BLE 功能,使用方法如下。
+  在`env`命令行输入`menuconfig`进行配置
+```
+-> RT-Thread online packages
+  -> IoT
+    ->internet of things
+      -> WiFi
+        --- rw007: SPI WIFI rw007 driver
+              version(v2.1.0)
+          [*] use ble function
+          (300000000) SPI Max Hz
+          (spi1) RW007 BUS NAME
+          (22) CS pin index
+          (39) INT/BUSY pin index
+          (9) RESET pin index
+          [*] example driver: rw007 for stm32
+          [*] test: spi throughput capability and packet loss testing
+          [*] example: save power by switching
+```
+
+#### 1.5.1 BLE 功能测试示例命令说明
+  在开启`rw007`软件包中的`ble`功能,会默认打开相关的功能测试示例,可以通过`msh`命令行输入`rw007_ble`查询。
+
+```
+msh />rw007_ble
+rw007_ble help
+rw007_ble init central/peripheral                           Note: init ble mode
+rw007_ble get_addr                                          Note: get ble address
+rw007_ble update_params                                     Note: update connect parameters(no support)
+rw007_ble scan                                              Note: scan ble slave
+rw007_ble stop_scan                                         Note: stop scan
+rw007_ble connect xx:xx:xx:xx:xx:xx                         Note: use slave addr to connect
+rw007_ble disconnect [conn_handle]                          Note: disconnect slave
+rw007_ble get_server                                        Note: discover all server(no support)
+rw007_ble get_char                                          Note: discover all description(no support)
+rw007_ble get_disc                                          Note: discover all characteristic(no support)
+rw007_ble mtu_exch                                          Note: ble mtu exchange(no support)
+rw007_ble notify                                            Note: enable ble notify(no support)
+rw007_ble write                                             Note: ble write data(no support)
+rw007_ble read                                              Note: ble read data(no support)
+rw007_ble notify_change [conn_handle] [UUID] [char_value]   Note: ble notify configure by uuid
+rw007_ble write_uuid [conn_handle] [UUID] [data]            Note: ble write data by uuid
+rw007_ble read_uuid [conn_handle] [UUID]                    Note: ble read data by uuid
+rw007_ble cfgwifi [duration_ms]                             Note: enable ble configuration wifi
+
+```
+#### 1.5.2 BLE 功能初始化
+
+`BLE`功能初始化函数,使用`BLE`功能必须调用。
+* 1.`RW007` BLE 功能初始化为主机设备。
+
+```
+rw007_ble init central
+```
+测试示例
+```
+msh />rw007_ble init central
+122 - ble_cmd_init
+start ble central
+msh />
+```
+* 2.`RW007`BLE 功能初始化为从机设备。
+
+```
+rw007_ble init peripheral
+```
+*特别说明:目前 RW007 的从机功能仅支持微信小程序配网使用。*
+
+#### 1.5.3 获取本机的BLE设备地址
+由于BLE设备的地址分为`public`公共地址和`random`随机地址。
+
+```
+rw007_ble get_addr
+```
+测试示例
+```
+msh />rw007_ble get_addr
+339 - ble_cmd_get_addr
+msh />ble data input packet resp_type: 0, len: 12
+public_id_addr = c8:47:8c:41:10:04
+random_id_addr = 00:00:00:00:00:00
+```
+
+#### 1.5.4 扫描设备
+目前 `RW007` BLE 功能支持通过 `scan`命令,扫描周围的`BLE`设备。
+* 1.执行扫描周围`BLE`设备
+```
+rw007_ble scan
+```
+测试示例
+```
+msh >rw007_ble scan
+365 - ble_cmd_scan
+msh >
+ble data input packet resp_type: 1, len: 37
+RW007_BLE_NTF_TYPE_DISCOVER
+received advertisement; event_type=0 rssi=-69 addr_type=1 addr=61:97:58:84:b3:fe
+mfg_data = 02 01 1a 02 0a 0c 0a ff 4c 00 10 05 42 1c e0 56 bc
+```
+这里的 `addr`地址内容可以为后面连接设备使用,由于目前没有直接显示对应 BLE 设备的名称,需要先人工确定 BLE 设备的地址。
+
+* 2.停止扫描周围`BLE`设备
+该指令用于 `RW007`模块正在执行`scan`扫描操作过程中,马上停止扫描的动作,可以执行此命令。
+```
+rw007_ble stop_scan
+```
+
+#### 1.5.5 连接设备
+
+目前 `RW007` BLE 功能设备支持通过 `BLE`设备的类`mac`地址来连接设备,该命令仅支持主机模式去连接从机设备的类`mac`地址,连接成功后会有对应的`conn_handle`值,这个`conn_handle`值在其他功能沿用。
+
+测试命令
+```
+rw007_ble connect xx:xx:xx:xx:xx:xx
+```
+
+测试示例
+```
+msh />rw007_ble connect 4c:ed:fb:00:04:b1
+198 - ble_cmd_connect
+str_addr: 4c:ed:fb:00:04:b1
+mac addr: b1: 4: 0:fb:ed:4c
+msh />resp_type: 1, len: 52
+RW007_BLE_NTF_TYPE_CONNECT
+type: 0, status: 0, conn_handle: 1
+
+resp_type: 1, len: 44
+RW007_BLE_NTF_TYPE_CONNECT_DESC
+our_id_addr: c9:47:8c:42:00:48
+peer_id_addr: b1:04:00:fb:ed:4c
+```
+
+#### 1.5.6 设备断开连接
+目前`RW007`BLE 功能设备支持主动断开从设备的连接。
+```
+rw007_ble disconnect [conn_handle]
+```
+其中 `conn_handle`与 `connect`连接时的需要一致。
+
+测试示例
+```
+msh />rw007_ble disconnect 1
+341 - ble_cmd_disconnect
+msh />resp_type: 1, len: 52
+RW007_BLE_NTF_TYPE_DISCONN
+```
+
+#### 1.5.7 设备写数据
+目前`RW007`BLE 功能写数据,支持通过指定`UUID`来写对应的数据。
+```
+rw007_ble write_uuid [conn_handle] [UUID] [data]
+```
+指令说明:`[conn_handle]`为 `RW007`连接设备时生成的对应值,`[UUID]`为对应 `BLE`设备的特征参数,`[data]`为需要发送的数据。
+
+测试示例
+```
+msh />rw007_ble write_uuid 1 ebe0ccbe7a0a4b0c8a1a6ff2997da3a6 00
+data: 00
+write conn_hanle:1 uuid:ebe0ccbe7a0a4b0c8a1a6ff2997da3a6
+write rc:0
+```
+说明:测试示例中的 `[conn_handle]`为 1,`[UUID]`为`ebe0ccbe7a0a4b0c8a1a6ff2997da3a6`,`[data]`为 `0x00`(这里是使用 hex 值)
+
+#### 1.5.8 更新 NOTIFY 参数
+目前 `RW007` BLE 功能支持修改接收 `notify`参数。
+```
+rw007_ble notify_change [conn_handle] [char_value] [UUID]
+```
+参数说明:
+
+`[conn_handle]`为 `RW007`连接设备时生成的对应值
+
+`[char_value]` 为配置参数,具体如下
+
+```
+0:disable indication&notification
+1:enable notification,disable indication
+2:enable indication, disable notification
+3:enable indication &notification
+```
+
+`[UUID]`为对应 `BLE`设备的特征参数值。
+
+#### 1.5.9 广播包类型的说明
+目前 `RW007`  BLE 功能中可以关于广播包 `event`的类型可以分为下面几种。
+```
+/* Advertising report */
+#define BLE_HCI_ADV_RPT_EVTYPE_ADV_IND      (0)
+#define BLE_HCI_ADV_RPT_EVTYPE_DIR_IND      (1)
+#define BLE_HCI_ADV_RPT_EVTYPE_SCAN_IND     (2)
+#define BLE_HCI_ADV_RPT_EVTYPE_NONCONN_IND  (3)
+#define BLE_HCI_ADV_RPT_EVTYPE_SCAN_RSP     (4)
+```
+广播包结构如下:
+```
+广播包结构描述:
+struct ble_gap_disc_desc {
+    uint8_t event_type;
+    uint8_t length_data;
+    ble_addr_t addr;
+    int8_t rssi;
+    uint8_t *data;
+
+    /***
+     * LE direct advertising report fields; direct_addr is BLE_ADDR_ANY if
+     * direct address fields are not present.
+     */
+    ble_addr_t direct_addr;
+};
+
+通过event_type区分出不同的广播包类型,所有类型分为如下几种:
+/* Advertising report */
+0 : 普通广播数据包
+1 : 直接广播包 
+2 : 扫描请求包 
+3 : 不可连接广播指示
+4 : 扫描响应数据包
+```
+因此,在设备的`scan`扫描回应中可以通过对应的`event_type`来判定是哪种广播包的类型。
+
+#### 1.6.0 设备读取数据
+
+目前 `RW007`支持通过 `UUID` 读取数据的功能。
+```
+rw007_ble read_uuid [conn_handle] [UUID]
+```
+参数说明:
+
+`[conn_handle]`为 `RW007`连接设备时生成的对应值
+
+`[UUID]`为对应 `BLE`设备的特征参数。
+
+测试示例
+```
+msh />rw007_ble read_uuid 1 2a24
+read conn_hanle:1 uuid:2a24
+read rc:0
+msh />ble data input packet resp_type: 0, len: 18
+RW007_BLE_RSP_TYPE_READ
+connect:1 attr_handle:14 uuid: 24 2a  read data:
+00000000: 4C 59 57 53 44 30 33 4D 4D 43 00                 LYWSD03MMC.
+```
+说明:这里的 `[conn_handle]`为 1,`[UUID]` 为 `2a24 `,读取到的数据为 BLE 设备的名称。
+
+目前 RW007 模块已经支持读取 128 位的 UUID 的功能。
+测试示例
+```
+msh />rw007_ble read_uuid 1 ebe0ccbe7a0a4b0c8a1a6ff2997da3a6
+read conn_hanle:1 uuid:ebe0ccbe7a0a4b0c8a1a6ff2997da3a6
+read rc:0
+msh />ble data input packet resp_type: 0, len: 22
+RW007_BLE_RSP_TYPE_READ
+connect:1 attr_handle:51 uuid: a6 a3 7d 99 f2 6f 1a 8a 0c 4b 0a 7a be cc e0 eb  read data:
+00000000: 00                     
+```
+说明:这里的 `[conn_handle]`为 1,`[UUID]` 为128位的 `ebe0ccbe7a0a4b0c8a1a6ff2997da3a6 `,读取到的数据值为 `00`
+
+#### 1.6.1 微信小程序 BLE 配网功能说明
+
+目前`RW007`支持微信小程序 `BLE`配网功能。
+
+```
+rw007_ble cfgwifi [duration_ms]    
+```
+参数说明:
+
+[duration_ms] 为模块作为从机对外进行广播的时长,以毫秒(ms)为单位,`RW007`模块对外广播的名称为`RW007-XXXX`其中`XXXX`为模块`mac`地址的后4位。
+
+主机驱动的代码,主机端可以参考下面的实现代码,进入 `BLE` 配网模式。
+
+```c
+rt_err_t rw007_ble_cfgwifi(uint32_t duration_ms)
+{
+    struct rw007_ble_cfgwifi cfgwifi;
+
+    cfgwifi.duration_ms = duration_ms;
+
+    return spi_set_data(wifi_sta.wlan, RW00x_CMD_BLE_CFGWIFI, &cfgwifi, sizeof(struct rw007_ble_cfgwifi));
+}
+```
+测试示例
+```
+msh />rw007_ble cfgwifi 30000
+msh />[420332] I/WLAN.mgnt: wifi connect success ssid:
+[421341] I/WLAN.lwip: Got IP address : 192.168.1.212
+```
+说明:`30000`为`RW007`模块作为从机对外广播的时长,一旦超过时长后,就会停止对外广播。
+
+***关于 BLE 配网和 BLE 主机功能同时使用的一些限制事项***
+(1)主机的 SCAN 功能和 BLE 配网不能同时使用,当`RW007` 模块处于`Advertise`广播状态(BLE 从机功能开启广播),主机(stm32)再执行 scan 操作时,scan操作会返回错误码,代表本次 scan 操作无效,直到 `Advertise`广播状态结束后,才能正常执行 scan 操作,但是此过程不影响已连接设备的状态。
+
+(2)主机的 SCAN 功能和 BLE 配网不能同时使用,当主机(stm32)正在在执行BLE 主机的 scan 操作时,同时配置`RW007` 模块进行`Advertise`广播,此时 scan 操作会被打断,直到`Advertise`广播状态结束后,才能正常执行 scan 操作,但是此过程不影响已连接设备的状态。
+
 ## 2. 注意事项
 
 由于存在引脚复用情况,所以bsp的SPI的驱动需要引脚配置在Config时进行。