1

I have a application for controlling multiple Bluetooth LE lamps.

When I want to disconnect all devices at same time, I call BluetoothGatt disconnect, and close from onConnectionStateChange, getConnectionState will return STATE_DISCONNECTED, but sometimes some devices' connection is still alive.

I can see the closed logs.

BluetoothGatt: close()

unregisterApp() - mClientIf=xx

But I can't see the disconnected log.

onReceive: android.bluetooth.device.action.ACL_DISCONNECTED

TrustAgent.Tracker: [BluetoothConnectionTracker] Bluetooth disconnect broadast for xxx

I used ReentrantLock to make sure every device only has one Gatt, and executing control functions on main thread by MainThread annotation, but the issue still exists.

How can I fix this issue?


Finally, I solved this problem. The reason is that I can't connect multiple devices at the same time. So I used a queue to connect the devices one by one.

Lucas
  • 11
  • 2
  • I see the same thing sometimes, here´s a discussion btw https://github.com/evothings/cordova-ble/issues/108. – Erik Feb 17 '19 at 19:49
  • Thank you, but this issue is different than that. After I disconnected the device, I can discover again, BluetoothManager told me the device was disconnected, but the device is connection is still alive, and I didn't received the disconnected broadcast message. – Lucas Feb 18 '19 at 13:04

0 Answers0