Pebble: try to fix pebble time regession

This commit is contained in:
Andreas Shimokawa
2025-10-30 16:54:38 +01:00
parent ba0647b9dd
commit 346bb208d5
@@ -188,7 +188,7 @@ class PebbleIoThread extends GBDeviceIoThread {
deviceAddress = gbDevice.getVolatileAddress(); deviceAddress = gbDevice.getVolatileAddress();
} }
BluetoothDevice btDevice = mBtAdapter.getRemoteDevice(deviceAddress); 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"); LOG.info("This is a Pebble 2 or Pebble-LE/Pebble Time LE, will use BLE");
mInStream = new PipedInputStream(); mInStream = new PipedInputStream();
mOutStream = new PipedOutputStream(); mOutStream = new PipedOutputStream();
@@ -201,7 +201,7 @@ class PebbleIoThread extends GBDeviceIoThread {
for (ParcelUuid uuid : uuids) { for (ParcelUuid uuid : uuids) {
LOG.info("found service UUID {}", uuid); LOG.info("found service UUID {}", uuid);
} }
if (uuids.length > 1) {
final UUID UuidSDP = UUID.fromString("00001101-0000-1000-8000-00805f9b34fb"); final UUID UuidSDP = UUID.fromString("00001101-0000-1000-8000-00805f9b34fb");
mBtSocket = btDevice.createRfcommSocketToServiceRecord(UuidSDP); mBtSocket = btDevice.createRfcommSocketToServiceRecord(UuidSDP);
@@ -210,6 +210,12 @@ class PebbleIoThread extends GBDeviceIoThread {
mBtSocket.connect(); mBtSocket.connect();
mInStream = mBtSocket.getInputStream(); mInStream = mBtSocket.getInputStream();
mOutStream = mBtSocket.getOutputStream(); 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)) { if (((PebbleCoordinator) gbDevice.getDeviceCoordinator()).isBackgroundJsEnabled(gbDevice)) {