Pebble 2: call both requestMTU and use the characteristic write
This commit is contained in:
parent
fce86482b9
commit
647b67cfca
|
@ -60,7 +60,7 @@ class PebbleGATTClient extends BluetoothGattCallback {
|
||||||
}
|
}
|
||||||
if (characteristic.getUuid().equals(MTU_CHARACTERISTIC)) {
|
if (characteristic.getUuid().equals(MTU_CHARACTERISTIC)) {
|
||||||
int newMTU = characteristic.getIntValue(FORMAT_UINT16, 0);
|
int newMTU = characteristic.getIntValue(FORMAT_UINT16, 0);
|
||||||
LOG.info("Pebble requested MTU = " + newMTU);
|
LOG.info("Pebble requested MTU: " + newMTU);
|
||||||
} else {
|
} else {
|
||||||
LOG.info("onCharacteristicChanged()" + characteristic.getUuid().toString() + " " + GB.hexdump(characteristic.getValue(), 0, -1));
|
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) {
|
if (newState == BluetoothGatt.STATE_CONNECTED) {
|
||||||
LOG.info("calling discoverServices()");
|
LOG.info("calling discoverServices()");
|
||||||
gatt.discoverServices();
|
gatt.discoverServices();
|
||||||
}
|
} else if (newState == BluetoothGatt.STATE_DISCONNECTED) {
|
||||||
else if (newState == BluetoothGatt.STATE_DISCONNECTED){
|
|
||||||
mPebbleLESupport.close();
|
mPebbleLESupport.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,6 +111,10 @@ class PebbleGATTClient extends BluetoothGattCallback {
|
||||||
} else {
|
} else {
|
||||||
subscribeToConnectionParams(gatt);
|
subscribeToConnectionParams(gatt);
|
||||||
}
|
}
|
||||||
|
} else if (characteristic.getUuid().equals(MTU_CHARACTERISTIC)) {
|
||||||
|
if (GBApplication.isRunningLollipopOrLater()) {
|
||||||
|
gatt.requestMtu(339);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue