From 05a44862776b8893e35c8c01615ed86d8c55754b Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Sun, 28 May 2017 23:43:37 +0200 Subject: [PATCH] Pebble 2/LE: try to improve pairing results by setting another unknown flag This might help with "bad pairing" where a pebble wont connect anymore after toggling bluetooth on the watch A workaround was to scan bluetooth before connecting after toggling bluetooth on the watch --- .../service/devices/pebble/ble/PebbleGATTClient.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 c688cc3d..cea21d19 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 @@ -164,7 +164,14 @@ class PebbleGATTClient extends BluetoothGattCallback { if (doPairing) { BluetoothGattCharacteristic characteristic = gatt.getService(SERVICE_UUID).getCharacteristic(PAIRING_TRIGGER_CHARACTERISTIC); if ((characteristic.getProperties() & PROPERTY_WRITE) != 0) { - characteristic.setValue(new byte[]{1}); + LOG.info("This seems to be a >=4.0 FW Pebble, writing to pairing trigger"); + // flags: + // 0 - always 1 + // 1 - unknown + // 2 - always 0 + // 3 - unknown, set on kitkat (seems to help to get a "better" pairing) + // 4 - unknown, set on some phones + characteristic.setValue(new byte[]{9}); gatt.writeCharacteristic(characteristic); } else { LOG.info("This seems to be some <4.0 FW Pebble, reading pairing trigger");