参见蓝牙core spec v5.3。
6.21 Link supervision timeout
Vol 4: Host Controller Interface -> Part E: Host Controller Interface Functional Specification -> 6 HCI configuration parameters-> 6.21 Link supervision timeout
Link_Supervision_Timeout 参数用于controller监控链路丢失(link loss)。如果由于某种原因,在超过 Link_Supervision_Timeout 的时间内没有收到来自 Connection_Handle 的任何数据包,则应断开连接。
对于BR/EDR 控制器(controller),由Connection_Handle 所指定设备的synchronous和ACL连接(connections)使用相同的超时值。
注意: 在 BR/EDR 控制器上将 Link_Supervision_Timeout 设置为 "无链路监控超时(No link supervision timeout)"(0x0000),将禁用对指定 Connection_Handle 的 Link_Supervision_Timeout 检查。
Value | Parameter Description |
0x0000 | No link supervision timeout. |
N = 0xXXXX | Size: 2 octets Range: 0x0001 to 0xFFFF Default: 0x7D00 Mandatory Range: 0x0190 to 0xFFFF Time = N * 0.625 ms Time Range: 0.625 ms to 40.9 s Time Default: BR/EDR 20 s |
7.3.41 Read Link Supervision Timeout command (读取BR/EDR controller的Supervision参数)
Vol 4: Host Controller Interface -> Part E: Host Controller Interface Functional Specification -> 7 HCI commands and events -> 7.3 Controller & Baseband commands -> 7.3.41 Read Link Supervision Timeout command
For the HCI Control and Baseband commands, the OGF is defined as 0x03.
Command | OCF | Command Parameters | Return Parameters |
HCI_Read_Link_Supervision_Timeout | 0x0036 | Handle | Status, Handle, Link_Supervision_Timeout |
-
Command parameters:
Handle - Size: 2 octets (12 bits meaningful) - 这个Handle指的是已连接设备的ACL connection。
Value | Parameter Description |
0xXXXX | 指定要读取的Link Supervision Timeout是哪个Handle的。 Handle表示的是BR/EDR Controller的Connection_Handle。 Range: 0x0000 to 0x0EFF |
-
Return parameters:
Status - Size: 1 octet
Value | Parameter Description |
0x00 | 命令执行成功 |
0x01 to 0xFF | 命令执行失败,返回的error code。 |
Handle:
同上面的命令参数
Link_Supervision_Timeout:
Value | Parameter Description |
0x0000 | 没有设置Link_Supervision_Timeout |
N = 0xXXXX | 使用BR/EDR Baseband slots作为测量的数值单位。 Link_Supervision_Timeout = N * 0.625 ms (1 Baseband slot) Range: 0x0001 to 0xFFFF Time Range: 0.625 ms to 40.9 s |
Event(s) generated (unless masked away):
当此命令执行结束后,会生成一个HCI_Command_Complete event。
7.3.42 Write Link Supervision Timeout command (设置BR/EDR controller的Supervision参数)
Vol 4: Host Controller Interface -> Part E: Host Controller Interface Functional Specification -> 7 HCI commands and events -> 7.3 Controller & Baseband commands -> 7.3.42 Write Link Supervision Timeout command
For the HCI Control and Baseband commands, the OGF is defined as 0x03.
Command | OCF | Command Parameters | Return Parameters |
HCI_Write_Link_Supervision_Timeout | 0x0037 | Handle, Link_Supervision_Timeout | Status, Handle |
如果从Host向一个Peripheral角色的Controller发送此命令,Controller会返回一个Command Disallowed (0x0C)的error code。
也就是说如果没有发生角色切换的情况下,只有发起连接的蓝牙设备,也就是角色是master的设备,才能够使用这个命令,向蓝牙芯片发送修改supervision timeout的命令。
这个命令里使用的Handle,关联的是已连接设备的ACL connection。这个命令也设置了这个已连接设备的其他Synchronous Handles的Link_Supervision_Timeout值。
-
Command parameters:
Handle - Size: 2 octets (12 bits meaningful)
Value | Parameter Description |
0xXXXX | 指定要写入的Link Supervision Timeout是哪个Handle的。 Handle表示的是BR/EDR Controller的Connection_Handle。 Range: 0x0000 to 0x0EFF |
Link_Supervision_Timeout:
Value | Parameter Description |
0x0000 | 没有设置Link_Supervision_Timeout |
N = 0xXXXX | 使用BR/EDR Baseband slots作为测量的数值单位。 Link_Supervision_Timeout = N * 0.625 ms (1 Baseband slot) Range: 0x0001 to 0xFFFF Time Range: 0.625 ms to 40.9 s Default: 0x7D00 Link_Supervision_Timeout = 20 s Mandatory Range for Controller: 0x0190 to 0xFFFF; plus 0 for infinite timeout |
-
Return parameters:
Status - Size: 1 octet
Value | Parameter Description |
0x00 | 命令执行成功 |
0x01 to 0xFF | 命令执行失败,返回的error code。 |
Handle:
同上面的命令参数
Event(s) generated (unless masked away):
当此命令执行结束后,会生成一个HCI_Command_Complete event。