蓝牙协议栈中关于回连和断开的定义

  蓝牙耳机或者音响设备中,蓝牙回连是经常碰到的,这里也经常出问题,这里我就梳理一下,看看协议栈怎么讲的。

回连的流程一般是这样的,耳机重新打开或者耳机距离远断开后又距离拉近,这时候就会启动回连,一般是耳机要回连接手机的,协议栈的命令是这个:

     

流程描述如下,感觉自己怎么翻译也没有蓝牙协议栈上说的清楚,就原班过来了:

   The Accept_Connection_Request command is used to accept a new incomiing connection request. The Accept_Connection_Request command shall only be

issued after a Connection Request event has occurred. The Connection Request event will return the BD_ADDR of the device which is requesting the

connection. This command will cause the Link Manager to create a connectio to the BR/EDR Controller, with the BD_ADDR specified by the command

parameters. The Link Manager will determine how the new connection will be established. This will be determined by the current state of the device, its

piconet, and the state of the device to be connected. The Role command parameter allows the Host to specify if the Link Manager shall request a role 

switch and become the Master for this connection. This is a preference and not a requirement. If the Role Switch fails then the connection will still be accepted,

and the Role Discovery Command will reflect the current role.

  Note: The Link Manager may terminate the connection if it would be low on resources if the role switch fails. The decision to accept a connection must be 

completed before the connection accept timeout expires on the local Bluetooth Module.

  Note:When accepting synchronous connection request, the Role parameter is

not used and will be ignored by the BR/EDR Controller.

   成功标志:

  The Accept_Connection_Request command shall cause the Command Status event to be sent from the BR/EDR Controller when the BR/EDR Controller 

begins setting up the connection. In addition, when the Link Manager determines the connection is established, the local BR/EDR Controller shall

send a Connection Complete event to its Host, and the remote Controller will send a Connection Complete event or a Synchronous Connection Complete

event to the Host. The Connection Complete event contains the Connection_Handle if this command is successful.

   Note: No Command Complete event will be sent by the BR/EDR Controller to indicate that this command has been completed. Instead, the Connecti No Command Complete event will be sent by the BR/EDR Controller to indicate that this command has been completed. Instead, the Connection Complete event will indicate that this command has been completed.

    参考文档:蓝牙5.0协议

原文地址:https://www.cnblogs.com/dylancao/p/11162296.html