Pebble 2: call both requestMTU and use the characteristic write

here
Andreas Shimokawa 2016-11-21 15:16:30 +01:00
parent fce86482b9
commit 647b67cfca
1 changed files with 6 additions and 3 deletions

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