mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-01-13 03:07:32 +01:00
Pebble: more length calculation fixes for 3.x notifications with actions
This commit is contained in:
parent
6c1e41b4ec
commit
b3a04f7afb
@ -372,16 +372,16 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
short length = (short) (BLOBDB_LENGTH + NOTIFICATION_PIN_LENGTH + attributes_length);
|
|
||||||
short pin_length = (short) (NOTIFICATION_PIN_LENGTH + attributes_length);
|
|
||||||
|
|
||||||
byte actions_count = 0;
|
byte actions_count = 0;
|
||||||
|
|
||||||
if (mForceProtocol) {
|
if (mForceProtocol) {
|
||||||
actions_count = 1;
|
actions_count = 1;
|
||||||
length += ACTIONS_LENGTH; // dismiss action
|
attributes_length += ACTIONS_LENGTH;
|
||||||
pin_length += ACTIONS_LENGTH; // dismiss_action
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
short length = (short) (BLOBDB_LENGTH + NOTIFICATION_PIN_LENGTH + attributes_length);
|
||||||
|
short pin_length = (short) (NOTIFICATION_PIN_LENGTH + attributes_length);
|
||||||
|
|
||||||
// Encode Prefix
|
// Encode Prefix
|
||||||
ByteBuffer buf = ByteBuffer.allocate(length + LENGTH_PREFIX);
|
ByteBuffer buf = ByteBuffer.allocate(length + LENGTH_PREFIX);
|
||||||
|
|
||||||
@ -410,7 +410,7 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
|||||||
buf.put((byte) 0x01); // type (0x01 = notification)
|
buf.put((byte) 0x01); // type (0x01 = notification)
|
||||||
buf.putShort((short) 0x0010); // flags 0x0010 = read?
|
buf.putShort((short) 0x0010); // flags 0x0010 = read?
|
||||||
buf.put((byte) 0x01); // layout (0x01 = default?)
|
buf.put((byte) 0x01); // layout (0x01 = default?)
|
||||||
buf.putShort(attributes_length); // total length of all attributes in bytes
|
buf.putShort(attributes_length); // total length of all attributes and actions in bytes
|
||||||
buf.put(attributes_count);
|
buf.put(attributes_count);
|
||||||
buf.put(actions_count);
|
buf.put(actions_count);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user