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) {
|
} else if (endpoint == PebbleProtocol.ENDPOINT_DATALOG) {
|
||||||
Log.i(TAG, "datalog to endpoint " + endpoint + " (" + length + " bytes)");
|
Log.i(TAG, "datalog to endpoint " + endpoint + " (" + length + " bytes)");
|
||||||
if (length <= 64) {
|
Log.i(TAG, "first two bytes: " + GB.hexdump(buffer, 4, 2));
|
||||||
Log.i(TAG, "hexdump: " + GB.hexdump(buffer, 4, length));
|
write(mPebbleProtocol.encodeDatalog(buffer[5], (byte) 0x85));
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
GBDeviceCommand deviceCmd = mPebbleProtocol.decodeResponse(buffer);
|
GBDeviceCommand deviceCmd = mPebbleProtocol.decodeResponse(buffer);
|
||||||
if (deviceCmd == null) {
|
if (deviceCmd == null) {
|
||||||
|
@ -402,12 +402,13 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
|||||||
return buf.array();
|
return buf.array();
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] encodeDatalog(byte[] buffer) {
|
public byte[] encodeDatalog(byte handle, byte reply) {
|
||||||
ByteBuffer buf = ByteBuffer.allocate(LENGTH_PREFIX + buffer.length);
|
ByteBuffer buf = ByteBuffer.allocate(LENGTH_PREFIX + 2);
|
||||||
buf.order(ByteOrder.BIG_ENDIAN);
|
buf.order(ByteOrder.BIG_ENDIAN);
|
||||||
buf.putShort((short) buffer.length);
|
buf.putShort((short) 2);
|
||||||
buf.putShort(ENDPOINT_DATALOG);
|
buf.putShort(ENDPOINT_DATALOG);
|
||||||
buf.put(buffer);
|
buf.put(reply);
|
||||||
|
buf.put(handle);
|
||||||
|
|
||||||
return buf.array();
|
return buf.array();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user