1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-24 02:46:50 +01:00

When there are cached services, skip service discovery

This commit is contained in:
cpfeiffer 2016-07-08 22:15:36 +02:00
parent ce47f62c5b
commit 8154a887cb

View File

@ -330,8 +330,14 @@ public final class BtLEQueue {
LOG.info("Connected to GATT server.");
setDeviceConnectionState(State.CONNECTED);
// Attempts to discover services after successful connection.
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.");