iDevicesInc / SweetBlue

BLE on Android, the easy way. THIS IS NOW DEPRECATED. Please visit website for info on new versions.
https://sweetblue.io
GNU General Public License v3.0
357 stars 57 forks source link

Pairing failed first time - SOFTLY_CANCELLED #459

Open sweetyTV opened 2 years ago

sweetyTV commented 2 years ago

Hello, I'm working with a device that implements "Just Works" bonding/pairing. If I want to reproduce this issue, I go to Android (Android 8 tablet) Settings - Connections - Bluetooth - Paired devices - Unpair and reset the tablet.

From nRF Connect I can discover, connect, say "OK" when the pairing request dialog appears and bonding fails - nRF reports "Bonding failed" in the text log and a "Pairing rejected..." toast appears at the bottom of the screen and it disconnects. Next time I try to connect, I say "OK" again to the pairing dialog and it connects and bonds OK,

In our software, which uses sweetblue, we get similar bonding failures the first time we try to use the device (i.e. if it has been removed from System - Connections - Buetooth - Paired device) . If the device is then switched off and switched on again, subsequent attempts to bond and connect are fine - and subsequent attempts seem to fine so long as the device appears in System "Paired devices".

But when it fails, I see the logs report previous=BOND_BONDING(11) new=BOND_NONE(10) and UNBOND_REASON_AUTH_FAILED(1)

and also Connect(SOFTLY_CANCELLED

It's

Any tips? Thank you. It's been suggested that sweetblue is working as it should in this case, certainly I've seen the same issue using nRF Connect, the issue is in the device itself but how to handle it using sweetblue?