1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-24 02:46:50 +01:00

Pebble: try to shut up datalog, which might cause battery drain on the watch

This commit is contained in:
Andreas Shimokawa 2015-04-26 01:43:24 +02:00
parent 613ff1fc91
commit c06ef3d260
2 changed files with 7 additions and 7 deletions

View File

@ -229,9 +229,8 @@ public class PebbleIoThread extends GBDeviceIoThread {
}
} else if (endpoint == PebbleProtocol.ENDPOINT_DATALOG) {
Log.i(TAG, "datalog to endpoint " + endpoint + " (" + length + " bytes)");
if (length <= 64) {
Log.i(TAG, "hexdump: " + GB.hexdump(buffer, 4, length));
}
Log.i(TAG, "first two bytes: " + GB.hexdump(buffer, 4, 2));
write(mPebbleProtocol.encodeDatalog(buffer[5], (byte) 0x85));
} else {
GBDeviceCommand deviceCmd = mPebbleProtocol.decodeResponse(buffer);
if (deviceCmd == null) {

View File

@ -402,12 +402,13 @@ public class PebbleProtocol extends GBDeviceProtocol {
return buf.array();
}
public byte[] encodeDatalog(byte[] buffer) {
ByteBuffer buf = ByteBuffer.allocate(LENGTH_PREFIX + buffer.length);
public byte[] encodeDatalog(byte handle, byte reply) {
ByteBuffer buf = ByteBuffer.allocate(LENGTH_PREFIX + 2);
buf.order(ByteOrder.BIG_ENDIAN);
buf.putShort((short) buffer.length);
buf.putShort((short) 2);
buf.putShort(ENDPOINT_DATALOG);
buf.put(buffer);
buf.put(reply);
buf.put(handle);
return buf.array();
}