bluetooth: Disconnect doesn't always disconnect on Android |
|
Issue descriptionVersion: 54.0.2823.2 OS: Android 6.0 Nexus 5X What steps will reproduce the problem? (1) Connect to a nearby BLE device from the nRF Connect Android App (https://play.google.com/store/apps/details?id=no.nordicsemi.android.mcp&hl=en) (2) Go to https://googlechrome.github.io/samples/web-bluetooth/device-disconnect.html (3) Connect to the nearby BLE device by clicking "Scan" button (4) Click "Disconnect" What is the expected output? BLE device should be disconnected. What do you see instead? It says "> Bluetooth Device disconnected" while it is not true as it is still connected from the nRF Connect Android App. This affects workflow for Eddystone Beacon Configuration Web App (https://beaufortfrancois.github.io/sandbox/web-bluetooth/eddystone-url-config/index.html) as disconnecting device is part of the update process.
,
Aug 9 2016
Yeah I know this is the exact opposite of https://bugs.chromium.org/p/chromium/issues/detail?id=630586 ;) As we've established with https://github.com/thegecko/web-bluetooth-dfu/issues/12 (DFU), a disconnection can be an essential part of a process: Being able to respond to it (as we already do with gattserverdisconnected) and trigger it (with disconnect) should both work. Is this "just" about adding a gattServer.disconnect({forReal: true})?
,
Aug 9 2016
I'll try to see if there is anything we can do. But from what I understood Android ref counts the connections and disconnects when the count reaches zero. If nRF Connect is connected that count will never reach zero.
,
Aug 9 2016
According to nRF Connect developer, this is the intended behavior on Android. nRF Connect connects to a connected device if: - In foreground or background (e.g. exited with home button) - GATT server is enabled (doesn't have to have any services) - Settings->Connectivity->Show incoming connections is enabled (default) It's not only nRF Connect that could do that, any other app, including Bluetooth Settings for HID, as well. To avoid it in nRF Connect make sure at least one of the conditions above is not fulfilled.
,
Aug 9 2016
I guess I'll have to catch the non-disconnected event and warn users someone may still be holding a connection.
,
Aug 9 2016
According to https://github.com/thegecko/web-bluetooth-dfu/issues/12#issuecomment-194183605, DFU asks for the remote side to disconnect by writing a particular characteristic. That's going to be the only reliable way to disconnect from a device from Web Bluetooth: ask the other side to physically disconnect. Calling .disconnect() only releases a refcount; it doesn't force a disconnection.
,
Aug 10 2016
I've added a comment to https://github.com/WebBluetoothCG/web-bluetooth/issues/256#issuecomment-238843459 to discuss possibility to add a `gattserverphysicallyconnected` event.
,
Aug 11 2016
`gattserverphysicallyDISconnected` event François :)
,
Aug 11 2016
|
|
►
Sign in to add a comment |
|
Comment 1 by ortuno@chromium.org
, Aug 9 2016