Partially revert "huami+pebble: replace deprecated writeCharacteristic and writeDescriptor"

The reverted change sent the updated descriptor value to the watch, breaking the connection.

It is unclear why the descriptor is set to an unknown value and never sent to the watch, but this restores the previous working behavior.
This commit is contained in:
Daniele Gobbetti
2025-06-15 17:35:28 +02:00
parent 871f4f3167
commit b0ec5e73c7
@@ -252,7 +252,10 @@ class PebbleGATTClient extends BluetoothGattCallback {
LOG.info("setting MTU");
BluetoothGattCharacteristic characteristic = gatt.getService(SERVICE_UUID).getCharacteristic(MTU_CHARACTERISTIC);
BluetoothGattDescriptor descriptor = characteristic.getDescriptor(CHARACTERISTIC_CONFIGURATION_DESCRIPTOR);
NotifyAction.writeDescriptor(gatt, descriptor, new byte[]{0x0b, 0x01}); // unknown
descriptor.setValue(new byte[]{0x0b, 0x01}); // unknown
// descriptor is not wrote back to the device, but the characteristic is.
// Reason is unclear but writing back the descriptor instead of the characteristic breaks the connection.
WriteAction.writeCharacteristic(gatt,characteristic, characteristic.getValue());
}
private void subscribeToPPoGATT(BluetoothGatt gatt) {