Merge branch 'bugfix/doc_blufi' into 'master'

bugfix/doc_blufi

See merge request idf/esp-idf!2644
This commit is contained in:
Angus Gratton 2018-07-02 12:12:48 +08:00
commit fdee0b64a0
2 changed files with 98 additions and 40 deletions

View file

@ -41,7 +41,7 @@ The following uses Station as an example to illustrate the core parts of the pro
2. The data lengths before and after symmetric encryption/decryption must stay the same. It also supports in-place encryption and decryption.
The flow chat of BluFi
The flow chart of BluFi
-----------------------
.. seqdiag::
@ -77,35 +77,64 @@ The frame formats for the communication between the mobile phone App and ESP32 a
The frame format with no fragment (8 bit)
+------------+---------------+-----------------+-------------+----------------+----------------+
| LSB - Type | Frame Control | Sequence Number | Data Length | Data | MSB - CheckSum |
+============+===============+=================+=============+================+================+
| 1 | 1 | 1 | 1 | ${Data Length} | 2 |
+------------+---------------+-----------------+-------------+----------------+----------------+
+-----------------+----------------+
| Description | Value |
+=================+================+
| LSB - Type | 1 |
+-----------------+----------------+
| Frame Control | 1 |
+-----------------+----------------+
| Sequence Number | 1 |
+-----------------+----------------+
| Data Length | 1 |
+-----------------+----------------+
| Data | ${Data Length} |
+-----------------+----------------+
| MSB - CheckSum | 2 |
+-----------------+----------------+
If the **Frame Ctrl** bit is enabled, the **Total length** bit indicates the length of remaining part of the frame. It can tell the remote how much memory needs to be alloced.
The frame format with fragments8 bit
+------------+--------------------+----------------+------------+-------------------------------------------+----------------+
| LSB - Type | FrameControl(Frag) | SequenceNumber | DataLength | Data | MSB - CheckSum |
+ + + + +----------------------+--------------------+ +
| | | | | Total Content Length | Content | |
+============+====================+================+============+======================+====================+================+
| 1 | 1 | 1 | 1 | 2 | ${Data Length} - 2 | 2 |
+------------+--------------------+----------------+------------+----------------------+--------------------+----------------+
+--------------------+-------------------------------------------+
| Description | Value |
+====================+===========================================+
| LSB - Type | 1 |
+--------------------+-------------------------------------------+
| FrameControl(Frag) | 1 |
+--------------------+-------------------------------------------+
| SequenceNumber | 1 |
+--------------------+-------------------------------------------+
| DataLength | 1 |
+--------------------+----------------------+--------------------+
| | Total Content Length | 2 |
+ Data +----------------------+--------------------+
| | Content | ${Data Length} - 2 |
+--------------------+----------------------+--------------------+
| MSB - CheckSum | 2 |
+--------------------+-------------------------------------------+
Normally, the control frame does not contain data bits, except for Ack Frame.
The format of Ack Frame8 bit
+------------------+----------------+------------------+--------------+-----------------------+----------------+
| LSB - Type (Ack) | Frame Control | SequenceNumber | Data Length | Data | MSB - CheckSum |
+ + + + +-----------------------+ +
| | | | | Acked Sequence Number | |
+==================+================+==================+==============+=======================+================+
| 1 | 1 | 1 | 1 | 1 | 2 |
+------------------+----------------+------------------+--------------+-----------------------+----------------+
+------------------+--------------------------------------------+
| Description | Value |
+------------------+--------------------------------------------+
| LSB - Type (Ack) | 1 |
+------------------+--------------------------------------------+
| Frame Control | 1 |
+------------------+--------------------------------------------+
| SequenceNumber | 1 |
+------------------+--------------------------------------------+
| DataLength | 1 |
+------------------+-----------------------+--------------------+
+ Data + Acked Sequence Number + 2 +
| | | |
+------------------+-----------------------+--------------------+
| MSB - CheckSum | 2 |
+------------------+--------------------------------------------+
1. Type

View file

@ -81,35 +81,64 @@ BluFi 传输格式
帧不分片情况下的标准格式 (8 bit)
+------------+---------------+-----------------+-------------+----------------+----------------+
| LSB - Type | Frame Control | Sequence Number | Data Length | Data | MSB - CheckSum |
+============+===============+=================+=============+================+================+
| 1 | 1 | 1 | 1 | ${Data Length} | 2 |
+------------+---------------+-----------------+-------------+----------------+----------------+
+-----------------+----------------+
| Description | Value |
+=================+================+
| LSB - Type | 1 |
+-----------------+----------------+
| Frame Control | 1 |
+-----------------+----------------+
| Sequence Number | 1 |
+-----------------+----------------+
| Data Length | 1 |
+-----------------+----------------+
| Data | ${Data Length} |
+-----------------+----------------+
| MSB - CheckSum | 2 |
+-----------------+----------------+
如果 **Frame Control** 帧中的 **More Frag** 使能,则 **Total Content Length** 为数据帧中剩余部分的总长度,用于报告终端需要分配多少内存。
帧分片格式8 bit
+------------+--------------------+----------------+------------+-------------------------------------------+----------------+
| LSB - Type | FrameControl(Frag) | SequenceNumber | DataLength | Data | MSB - CheckSum |
+ + + + +----------------------+--------------------+ +
| | | | | Total Content Length | Content | |
+============+====================+================+============+======================+====================+================+
| 1 | 1 | 1 | 1 | 2 | ${Data Length} - 2 | 2 |
+------------+--------------------+----------------+------------+----------------------+--------------------+----------------+
+--------------------+-------------------------------------------+
| Description | Value |
+====================+===========================================+
| LSB - Type | 1 |
+--------------------+-------------------------------------------+
| FrameControl(Frag) | 1 |
+--------------------+-------------------------------------------+
| SequenceNumber | 1 |
+--------------------+-------------------------------------------+
| DataLength | 1 |
+--------------------+----------------------+--------------------+
| | Total Content Length | 2 |
+ Data +----------------------+--------------------+
| | Content | ${Data Length} - 2 |
+--------------------+----------------------+--------------------+
| MSB - CheckSum | 2 |
+--------------------+-------------------------------------------+
通常情况下控制帧不包含数据位Ack 帧类型除外。
Ack 帧格式8 bit
+------------------+---------------+-----------------+-------------+-----------------------+----------------+
| LSB - Type (Ack) | Frame Control | SequenceNumber | Data Length | Data | MSB - CheckSum |
+ + + + +-----------------------+ +
| | | | | Acked Sequence Number | |
+==================+===============+=================+=============+=======================+================+
| 1 | 1 | 1 | 1 | 1 | 2 |
+------------------+---------------+-----------------+-------------+-----------------------+----------------+
+------------------+--------------------------------------------+
| Description | Value |
+------------------+--------------------------------------------+
| LSB - Type (Ack) | 1 |
+------------------+--------------------------------------------+
| Frame Control | 1 |
+------------------+--------------------------------------------+
| SequenceNumber | 1 |
+------------------+--------------------------------------------+
| DataLength | 1 |
+------------------+-----------------------+--------------------+
+ Data + Acked Sequence Number + 2 +
| | | |
+------------------+-----------------------+--------------------+
| MSB - CheckSum | 2 |
+------------------+--------------------------------------------+
1. Type
@ -424,4 +453,4 @@ BluFi ESP32 -> 手机) 特性0xFF02主要权限可读可通知
1. 目前 Ack 机制已经在该 Profile 协议中定义,但是还没有代码实现。
2. 其他部分均已实现。
2. 其他部分均已实现。