Skip to contentSkip to conversation

RequestDisconnection() Operation

DISCUSSION Randy Yates 2 participants 2 messages Feb 24, 2013 – Feb 25, 2013 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

The following question is regarding bluez 5.2:

There are at least two cases in which a remote bluetooth device "client" connected to a profile managed by a local bluetooth device "server" (via bluez) would disconnect:

1. The remote bluetooth device client initiates a disconnect.

2. The remote bluetooth device goes out of range.

Would a RequestDisconnection() method be invoked by the bluez stack in both these cases?

Signature · 3 lines
Randy Yates
Digital Signal Labs
http://www.digitalsignallabs.com
#1 lore raw

Hi Randy,

Quoted 6 lines · Randy Yates

The following question is regarding bluez 5.2:

There are at least two cases in which a remote bluetooth device "client" connected to a profile managed by a local bluetooth device "server" (via bluez) would disconnect:

Quoted 6 lines

1. The remote bluetooth device client initiates a disconnect.

2. The remote bluetooth device goes out of range.

Would a RequestDisconnection() method be invoked by the bluez stack in both these cases?

If the remote device start the disconnection there is nothing you can do, so no RequestDisconnection is not called in any of these cases. Also note that in case of link loss it might take a while until the controller notify it has lost the link, usually it will only report after a timeout specified by link supervision timeout (20 seconds by default). RequestDisconnection is for connection cleanup when the disconnection is started locally, so it is called before the link is disconnected, because of this you might want to watch the events on the fd that you got in the NewConnection directly so you can react to e.g. HUP or ERR. Another important detail is that if you want to force a disconnection you should use shudown, close will just release the process reference to the fd but bluetoothd has another one to track which profiles are connected.

--
Luiz Augusto von Dentz