diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/ble/PebbleGATTClient.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/ble/PebbleGATTClient.java index 37b9dcea..a9a2acd0 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/ble/PebbleGATTClient.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/ble/PebbleGATTClient.java @@ -60,7 +60,7 @@ class PebbleGATTClient extends BluetoothGattCallback { } if (characteristic.getUuid().equals(MTU_CHARACTERISTIC)) { int newMTU = characteristic.getIntValue(FORMAT_UINT16, 0); - LOG.info("Pebble requested MTU = " + newMTU); + LOG.info("Pebble requested MTU: " + newMTU); } else { LOG.info("onCharacteristicChanged()" + characteristic.getUuid().toString() + " " + GB.hexdump(characteristic.getValue(), 0, -1)); } @@ -92,8 +92,7 @@ class PebbleGATTClient extends BluetoothGattCallback { if (newState == BluetoothGatt.STATE_CONNECTED) { LOG.info("calling discoverServices()"); gatt.discoverServices(); - } - else if (newState == BluetoothGatt.STATE_DISCONNECTED){ + } else if (newState == BluetoothGatt.STATE_DISCONNECTED) { mPebbleLESupport.close(); } } @@ -112,6 +111,10 @@ class PebbleGATTClient extends BluetoothGattCallback { } else { subscribeToConnectionParams(gatt); } + } else if (characteristic.getUuid().equals(MTU_CHARACTERISTIC)) { + if (GBApplication.isRunningLollipopOrLater()) { + gatt.requestMtu(339); + } } }