mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-27 20:36:51 +01:00
Pebble: try to shut up datalog, which might cause battery drain on the watch
This commit is contained in:
parent
613ff1fc91
commit
c06ef3d260
@ -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) {
|
||||
|
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user