Pebble: rename BLOBDB_HEALTH to BLOBDB_PREFERENCES and encodeSaneDistanceUnit to encodeSetSaneDistanceUnit
Also allow to set insane units in the method
This commit is contained in:
parent
10b5c571bb
commit
0c4e606e74
|
@ -573,7 +573,7 @@ public class PebbleIoThread extends GBDeviceIoThread {
|
||||||
|
|
||||||
if (uri.equals(Uri.parse("fake://health"))) {
|
if (uri.equals(Uri.parse("fake://health"))) {
|
||||||
write(mPebbleProtocol.encodeActivateHealth(true));
|
write(mPebbleProtocol.encodeActivateHealth(true));
|
||||||
write(mPebbleProtocol.encodeSaneDistanceUnit());
|
write(mPebbleProtocol.encodeSetSaneDistanceUnit(true));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
||||||
static final byte BLOBDB_APP = 2;
|
static final byte BLOBDB_APP = 2;
|
||||||
static final byte BLOBDB_REMINDER = 3;
|
static final byte BLOBDB_REMINDER = 3;
|
||||||
static final byte BLOBDB_NOTIFICATION = 4;
|
static final byte BLOBDB_NOTIFICATION = 4;
|
||||||
static final byte BLOBDB_HEALTH = 7; // might also be some generic registry database
|
static final byte BLOBDB_PREFERENCES = 7;
|
||||||
static final byte BLOBDB_SUCCESS = 1;
|
static final byte BLOBDB_SUCCESS = 1;
|
||||||
static final byte BLOBDB_GENERALFAILURE = 2;
|
static final byte BLOBDB_GENERALFAILURE = 2;
|
||||||
static final byte BLOBDB_INVALIDOPERATION = 3;
|
static final byte BLOBDB_INVALIDOPERATION = 3;
|
||||||
|
@ -369,7 +369,7 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
||||||
private static final Map<Integer, DatalogHandler> mDatalogHandlers = new HashMap<>();
|
private static final Map<Integer, DatalogHandler> mDatalogHandlers = new HashMap<>();
|
||||||
|
|
||||||
{
|
{
|
||||||
mDatalogHandlers.put(81,new DatalogHandlerHealth(81, PebbleProtocol.this));
|
mDatalogHandlers.put(81, new DatalogHandlerHealth(81, PebbleProtocol.this));
|
||||||
}
|
}
|
||||||
|
|
||||||
private final HashMap<Byte, DatalogSession> mDatalogSessions = new HashMap<>();
|
private final HashMap<Byte, DatalogSession> mDatalogSessions = new HashMap<>();
|
||||||
|
@ -709,15 +709,17 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
||||||
} else {
|
} else {
|
||||||
blob = new byte[]{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
blob = new byte[]{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||||
}
|
}
|
||||||
return encodeBlobdb("activityPreferences", command, BLOBDB_HEALTH, blob);
|
return encodeBlobdb("activityPreferences", command, BLOBDB_PREFERENCES, blob);
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] encodeSaneDistanceUnit() {
|
public byte[] encodeSetSaneDistanceUnit(boolean sane) {
|
||||||
byte[] blob;
|
byte value;
|
||||||
byte command;
|
if (sane) {
|
||||||
command = BLOBDB_INSERT;
|
value = 0x00;
|
||||||
blob = new byte[]{0x00};
|
} else {
|
||||||
return encodeBlobdb("unitsDistance", command, BLOBDB_HEALTH, blob);
|
value = 0x01;
|
||||||
|
}
|
||||||
|
return encodeBlobdb("unitsDistance", BLOBDB_INSERT, BLOBDB_PREFERENCES, new byte[]{value});
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] encodeReportDataLogSessions() {
|
public byte[] encodeReportDataLogSessions() {
|
||||||
|
@ -1859,7 +1861,7 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
GBDeviceEventSendBytes sendBytes = new GBDeviceEventSendBytes();
|
GBDeviceEventSendBytes sendBytes = new GBDeviceEventSendBytes();
|
||||||
if(ack) {
|
if (ack) {
|
||||||
LOG.info("sending ACK (0x85)");
|
LOG.info("sending ACK (0x85)");
|
||||||
sendBytes.encodedBytes = encodeDatalog(id, DATALOG_ACK);
|
sendBytes.encodedBytes = encodeDatalog(id, DATALOG_ACK);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue