NordicSemiconductor / Android-BLE-Library

A library that makes working with Bluetooth LE on Android a pleasure. Seriously.
BSD 3-Clause "New" or "Revised" License
1.98k stars 413 forks source link

Reconnection fixed #528

Closed philips77 closed 10 months ago

philips77 commented 10 months ago

This PR fixes #526.

I think this is minimal required change to fix the issue. The call to notifyDeviceDisconnected(...) was added to BleServerManager in #521. It was supposed to fix no disconnection callback in server-only mode when attachClientConnection is used.

However, as @corentin-c noticed, that broke bidirectional connection, as that method is now called twice, from server and client, and client doesn't reconnect.

The proposed check ensures that it is called only in server-only mode when bluetoothGatt object is null.

corentin-c commented 10 months ago

I think it was the best and easiest way to fix it. I can confirm this fixed #526 . Thank you @philips77 !