1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-29 12:05:53 +01:00

Pebble 2: call both requestMTU and use the characteristic write

This commit is contained in:
Andreas Shimokawa 2016-11-21 15:16:30 +01:00
parent fce86482b9
commit 647b67cfca

View File

@ -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);
}
}
}