mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-01-13 03:07:32 +01:00
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"))) {
|
||||
write(mPebbleProtocol.encodeActivateHealth(true));
|
||||
write(mPebbleProtocol.encodeSaneDistanceUnit());
|
||||
write(mPebbleProtocol.encodeSetSaneDistanceUnit(true));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
||||
static final byte BLOBDB_APP = 2;
|
||||
static final byte BLOBDB_REMINDER = 3;
|
||||
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_GENERALFAILURE = 2;
|
||||
static final byte BLOBDB_INVALIDOPERATION = 3;
|
||||
@ -369,7 +369,7 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
||||
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<>();
|
||||
@ -709,15 +709,17 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
||||
} else {
|
||||
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() {
|
||||
byte[] blob;
|
||||
byte command;
|
||||
command = BLOBDB_INSERT;
|
||||
blob = new byte[]{0x00};
|
||||
return encodeBlobdb("unitsDistance", command, BLOBDB_HEALTH, blob);
|
||||
public byte[] encodeSetSaneDistanceUnit(boolean sane) {
|
||||
byte value;
|
||||
if (sane) {
|
||||
value = 0x00;
|
||||
} else {
|
||||
value = 0x01;
|
||||
}
|
||||
return encodeBlobdb("unitsDistance", BLOBDB_INSERT, BLOBDB_PREFERENCES, new byte[]{value});
|
||||
}
|
||||
|
||||
public byte[] encodeReportDataLogSessions() {
|
||||
@ -1859,7 +1861,7 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
||||
break;
|
||||
}
|
||||
GBDeviceEventSendBytes sendBytes = new GBDeviceEventSendBytes();
|
||||
if(ack) {
|
||||
if (ack) {
|
||||
LOG.info("sending ACK (0x85)");
|
||||
sendBytes.encodedBytes = encodeDatalog(id, DATALOG_ACK);
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user