From d225743d642e5da27ec59c67bee98a04a4015428 Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Wed, 15 Jun 2016 22:53:05 +0200 Subject: [PATCH] Pebble: some preparations for Pebble 2 --- .../gadgetbridge/devices/pebble/PBWReader.java | 2 +- .../service/devices/pebble/PebbleProtocol.java | 12 ++++++++---- .../gadgetbridge/util/PebbleUtils.java | 4 ++++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pebble/PBWReader.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pebble/PBWReader.java index 42f05b74..8248d257 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pebble/PBWReader.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pebble/PBWReader.java @@ -103,7 +103,7 @@ public class PBWReader { * we still prefer the subfolders if present. * chalk needs to be its subfolder */ - if (platform.equals("aplite") || platform.equals("basalt")) { + if (platform.equals("aplite") || platform.equals("basalt") || platform.equals("diorite")) { boolean hasPlatformDir = false; InputStream afin = new BufferedInputStream(cr.openInputStream(uri)); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleProtocol.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleProtocol.java index c350bd76..95ff6628 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleProtocol.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleProtocol.java @@ -245,15 +245,19 @@ public class PebbleProtocol extends GBDeviceProtocol { static final long GB_UUID_MASK = 0x4767744272646700L; - // base is -5 + // base is -8 private static final String[] hwRevisions = { // Emulator - "spalding_bb2", "snowy_bb2", "snowy_bb", "bb2", "bb", + "silk_bb2", "unknown", "silk_bb", + "spalding_bb2", "snowy_bb2", "snowy_bb", + "bb2", "bb", "unknown", // Pebble "ev1", "ev2", "ev2_3", "ev2_4", "v1_5", "v2_0", // Pebble Time - "snowy_evt2", "snowy_dvt", "spalding_dvt", "snowy_s3", "spalding" + "snowy_evt2", "snowy_dvt", "spalding_dvt", "snowy_s3", "spalding", + // Pebble 2 + "silk_evt", "unknown", "silk" }; private static final Random mRandom = new Random(); @@ -2041,7 +2045,7 @@ public class PebbleProtocol extends GBDeviceProtocol { } buf.get(tmp, 0, 9); - int hwRev = buf.get() + 5; + int hwRev = buf.get() + 8; if (hwRev >= 0 && hwRev < hwRevisions.length) { versionCmd.hwVersion = hwRevisions[hwRev]; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/PebbleUtils.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/PebbleUtils.java index 11ec9678..848235e6 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/PebbleUtils.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/PebbleUtils.java @@ -7,6 +7,8 @@ public class PebbleUtils { platformName = "basalt"; } else if (hwRev.startsWith("spalding")) { platformName = "chalk"; + } else if (hwRev.startsWith("silk")) { + platformName = "diorite"; } else { platformName = "aplite"; } @@ -20,6 +22,8 @@ public class PebbleUtils { model = "pebble_time_black"; } else if (hwRev.startsWith("spalding")) { model = "pebble_time_round_black_20mm"; + } else if (hwRev.startsWith("silk")) { + model = "pebble2_black"; } else { model = "pebble_black"; }