mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-25 10:05:49 +01:00
When there are cached services, skip service discovery
This commit is contained in:
parent
ce47f62c5b
commit
8154a887cb
@ -330,8 +330,14 @@ public final class BtLEQueue {
|
||||
LOG.info("Connected to GATT server.");
|
||||
setDeviceConnectionState(State.CONNECTED);
|
||||
// Attempts to discover services after successful connection.
|
||||
LOG.info("Attempting to start service discovery:" +
|
||||
gatt.discoverServices());
|
||||
List<BluetoothGattService> cachedServices = gatt.getServices();
|
||||
if (cachedServices != null && cachedServices.size() > 0) {
|
||||
LOG.info("Using cached services, skipping discovery");
|
||||
onServicesDiscovered(gatt, BluetoothGatt.GATT_SUCCESS);
|
||||
} else {
|
||||
LOG.info("Attempting to start service discovery:" +
|
||||
gatt.discoverServices());
|
||||
}
|
||||
break;
|
||||
case BluetoothProfile.STATE_DISCONNECTED:
|
||||
LOG.info("Disconnected from GATT server.");
|
||||
|
Loading…
Reference in New Issue
Block a user