Pebble Time Round support ("chalk" platform)

live-activity-data
Andreas Shimokawa 2015-09-23 23:19:38 +02:00
parent d9b4bbe550
commit 3bb673d33a
4 changed files with 37 additions and 8 deletions

View File

@ -39,7 +39,17 @@ public class PBWInstallHandler implements InstallHandler {
return;
}
mPBWReader = new PBWReader(mUri, mContext, device.getHardwareVersion().equals("dvt") ? "basalt" : "aplite");
String hwRev = device.getHardwareVersion();
String platformName;
if (hwRev.startsWith("snowy")) {
platformName = "basalt";
} else if (hwRev.startsWith("spalding")) {
platformName = "chalk";
} else {
platformName = "aplite";
}
mPBWReader = new PBWReader(mUri, mContext, platformName);
if (!mPBWReader.isValid()) {
installActivity.setInfoText("pbw/pbz is broken or incompatible with your Hardware or Firmware.");
installActivity.setInstallEnabled(false);

View File

@ -59,7 +59,7 @@ public class PBWReader {
public PBWReader(Uri uri, Context context, String platform) {
String platformDir = "";
if (!uri.toString().endsWith(".pbz") && platform.equals("basalt")) {
if (!uri.toString().endsWith(".pbz") && !platform.equals("aplite")) {
platformDir = platform + "/";
}

View File

@ -541,7 +541,17 @@ public class PebbleIoThread extends GBDeviceIoThread {
return;
}
mPBWReader = new PBWReader(uri, getContext(), gbDevice.getHardwareVersion().startsWith("snowy") ? "basalt" : "aplite");
String hwRev = gbDevice.getHardwareVersion();
String platformName;
if (hwRev.startsWith("snowy")) {
platformName = "basalt";
} else if (hwRev.startsWith("spalding")) {
platformName = "chalk";
} else {
platformName = "aplite";
}
mPBWReader = new PBWReader(uri, getContext(), platformName);
mPebbleInstallables = mPBWReader.getPebbleInstallables();
mCurrentInstallableIndex = 0;

View File

@ -214,8 +214,17 @@ public class PebbleProtocol extends GBDeviceProtocol {
static final byte LENGTH_UUID = 16;
// base is -4
private static final String[] hwRevisions = {"snowy_bb2", "snowy_bb", "bb2", "bb", "unknown", "ev1", "ev2", "ev2_3", "ev2_4", "v1_5", "v2_0", "snowy_evt2", "snowy_dvt", "unknown", "snowy_s3"};
// base is -5
private static final String[] hwRevisions = {
// Emulator
"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_pvt"
};
private static Random mRandom = new Random();
boolean isFw3x = false;
@ -1578,9 +1587,9 @@ public class PebbleProtocol extends GBDeviceProtocol {
}
buf.get(tmp, 0, 9);
Byte hwRev = buf.get();
if (hwRev >= -4 && hwRev < hwRevisions.length - 4) {
versionCmd.hwVersion = hwRevisions[hwRev+4];
int hwRev = buf.get() + 5;
if (hwRev >= 0 && hwRev < hwRevisions.length) {
versionCmd.hwVersion = hwRevisions[hwRev];
}
devEvts = new GBDeviceEvent[]{versionCmd};
break;