Send 2.x style notifications when on FW 3.x (on FW 2.x else use 1.x style notifications)
This could improve #24. Unfortunally I cannot test it since I have no Pebble Time.
This commit is contained in:
parent
818399b157
commit
ad4f708140
|
@ -164,7 +164,7 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
||||||
private static final String[] hwRevisions = {"unknown", "ev1", "ev2", "ev2_3", "ev2_4", "v1_5", "v2_0", "evt2", "dvt"};
|
private static final String[] hwRevisions = {"unknown", "ev1", "ev2", "ev2_3", "ev2_4", "v1_5", "v2_0", "evt2", "dvt"};
|
||||||
private static Random mRandom = new Random();
|
private static Random mRandom = new Random();
|
||||||
|
|
||||||
boolean isFw3x = true;
|
boolean isFw3x = false;
|
||||||
byte last_id = -1;
|
byte last_id = -1;
|
||||||
private ArrayList<UUID> tmpUUIDS = new ArrayList<>();
|
private ArrayList<UUID> tmpUUIDS = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -221,14 +221,13 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
||||||
ts += (SimpleTimeZone.getDefault().getOffset(ts));
|
ts += (SimpleTimeZone.getDefault().getOffset(ts));
|
||||||
ts /= 1000;
|
ts /= 1000;
|
||||||
|
|
||||||
|
if (isFw3x) {
|
||||||
if (!isFw3x || true) { // remove || true if necessary on FW 3.x
|
String[] parts = {from, null, body};
|
||||||
|
return encodeExtensibleNotification(mRandom.nextInt(), (int) (ts & 0xffffffff), parts);
|
||||||
|
} else {
|
||||||
String[] parts = {from, body, ts.toString()};
|
String[] parts = {from, body, ts.toString()};
|
||||||
return encodeMessage(ENDPOINT_NOTIFICATION, NOTIFICATION_SMS, 0, parts);
|
return encodeMessage(ENDPOINT_NOTIFICATION, NOTIFICATION_SMS, 0, parts);
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] parts = {from, null, body};
|
|
||||||
return encodeExtensibleNotification(mRandom.nextInt(), (int) (ts & 0xffffffff), parts);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -236,10 +235,14 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
||||||
Long ts = System.currentTimeMillis();
|
Long ts = System.currentTimeMillis();
|
||||||
ts += (SimpleTimeZone.getDefault().getOffset(ts));
|
ts += (SimpleTimeZone.getDefault().getOffset(ts));
|
||||||
ts /= 1000;
|
ts /= 1000;
|
||||||
String tsstring = ts.toString(); // SIC
|
|
||||||
String[] parts = {from, body, tsstring, subject};
|
|
||||||
|
|
||||||
return encodeMessage(ENDPOINT_NOTIFICATION, NOTIFICATION_EMAIL, 0, parts);
|
if (isFw3x) {
|
||||||
|
String[] parts = {from, subject, body};
|
||||||
|
return encodeExtensibleNotification(mRandom.nextInt(), (int) (ts & 0xffffffff), parts);
|
||||||
|
} else {
|
||||||
|
String[] parts = {from, body, ts.toString(), subject};
|
||||||
|
return encodeMessage(ENDPOINT_NOTIFICATION, NOTIFICATION_EMAIL, 0, parts);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue