From 346bb208d5fc96c75607bc71bb23e4eebb94fdcb Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Thu, 30 Oct 2025 16:54:38 +0100 Subject: [PATCH] Pebble: try to fix pebble time regession --- .../devices/pebble/PebbleIoThread.java | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleIoThread.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleIoThread.java index b89b8c7b26..af52ebc826 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleIoThread.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleIoThread.java @@ -188,7 +188,7 @@ class PebbleIoThread extends GBDeviceIoThread { deviceAddress = gbDevice.getVolatileAddress(); } BluetoothDevice btDevice = mBtAdapter.getRemoteDevice(deviceAddress); - if (btDevice.getType() == BluetoothDevice.DEVICE_TYPE_LE || btDevice.getType() == BluetoothDevice.DEVICE_TYPE_DUAL) { + if (btDevice.getType() == BluetoothDevice.DEVICE_TYPE_LE) { LOG.info("This is a Pebble 2 or Pebble-LE/Pebble Time LE, will use BLE"); mInStream = new PipedInputStream(); mOutStream = new PipedOutputStream(); @@ -201,15 +201,21 @@ class PebbleIoThread extends GBDeviceIoThread { for (ParcelUuid uuid : uuids) { LOG.info("found service UUID {}", uuid); } + if (uuids.length > 1) { + final UUID UuidSDP = UUID.fromString("00001101-0000-1000-8000-00805f9b34fb"); + mBtSocket = btDevice.createRfcommSocketToServiceRecord(UuidSDP); - final UUID UuidSDP = UUID.fromString("00001101-0000-1000-8000-00805f9b34fb"); - mBtSocket = btDevice.createRfcommSocketToServiceRecord(UuidSDP); - - // TODO: Why is this comment here? - //mBtSocket = btDevice.createRfcommSocketToServiceRecord(uuids[0].getUuid()); - mBtSocket.connect(); - mInStream = mBtSocket.getInputStream(); - mOutStream = mBtSocket.getOutputStream(); + // TODO: Why is this comment here? + //mBtSocket = btDevice.createRfcommSocketToServiceRecord(uuids[0].getUuid()); + mBtSocket.connect(); + mInStream = mBtSocket.getInputStream(); + mOutStream = mBtSocket.getOutputStream(); + } else { + LOG.info("This seems to be a 2025 Pebble will use BLE"); + mInStream = new PipedInputStream(); + mOutStream = new PipedOutputStream(); + mPebbleLESupport = new PebbleLESupport(this.getContext(), gbDevice, btDevice, (PipedInputStream) mInStream, (PipedOutputStream) mOutStream); + } } } if (((PebbleCoordinator) gbDevice.getDeviceCoordinator()).isBackgroundJsEnabled(gbDevice)) {