Pebble: enable dismiss action on FW 3.x if force option is set
NOTES: - Might break notifications altogehter (can't test) - Cannot work because we do not interpret the response yet.
This commit is contained in:
parent
1f2b0329c5
commit
3c35f94a7e
|
@ -341,20 +341,19 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
|||
buf.put(s.getBytes(), 0, partlength);
|
||||
}
|
||||
}
|
||||
|
||||
// ACTION
|
||||
buf.put((byte) 0x01);
|
||||
buf.put((byte) 0x04);
|
||||
buf.put((byte) 0x01);
|
||||
|
||||
buf.put((byte) 0x01); // id
|
||||
buf.put((byte) 0x04); // dismiss action
|
||||
buf.put((byte) 0x01); // number attributes
|
||||
buf.put((byte) 0x01); // attribute id (title)
|
||||
String actionstring = "dismiss all";
|
||||
|
||||
buf.put((byte) 0x01);
|
||||
buf.putShort((short) actionstring.length());
|
||||
buf.put(actionstring.getBytes());
|
||||
return buf.array();
|
||||
}
|
||||
|
||||
private static byte[] encodeBlobdbNotification(int timestamp, String[] parts) {
|
||||
private byte[] encodeBlobdbNotification(int timestamp, String[] parts) {
|
||||
// Calculate length first
|
||||
final short BLOBDB_LENGTH = 23;
|
||||
final short NOTIFICATION_PIN_LENGTH = 46;
|
||||
|
@ -374,6 +373,12 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
|||
|
||||
int length = BLOBDB_LENGTH + NOTIFICATION_PIN_LENGTH + attributes_length;
|
||||
|
||||
byte actions_count = 0;
|
||||
if (mForceProtocol) {
|
||||
actions_count = 1;
|
||||
length += 13; // dismiss action
|
||||
}
|
||||
|
||||
// Encode Prefix
|
||||
ByteBuffer buf = ByteBuffer.allocate(length + LENGTH_PREFIX);
|
||||
|
||||
|
@ -403,8 +408,8 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
|||
buf.putShort((short) 0x0010); // flags 0x0010 = read?
|
||||
buf.put((byte) 0x01); // layout (0x01 = default?)
|
||||
buf.putShort((short) attributes_length); // total length of all attributes in bytes
|
||||
buf.put(attributes_count); // count attributes
|
||||
buf.put((byte) 0); // count actions - none so far
|
||||
buf.put(attributes_count);
|
||||
buf.put(actions_count);
|
||||
|
||||
byte attribute_id = 0;
|
||||
// Encode Pascal-Style Strings
|
||||
|
@ -423,6 +428,17 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
|||
}
|
||||
}
|
||||
|
||||
if (mForceProtocol) {
|
||||
// ACTION
|
||||
buf.put((byte) 0x01); // id
|
||||
buf.put((byte) 0x04); // dismiss action
|
||||
buf.put((byte) 0x01); // number attributes
|
||||
buf.put((byte) 0x01); // attribute id (title)
|
||||
String actionstring = "dismiss all";
|
||||
buf.putShort((short) actionstring.length());
|
||||
buf.put(actionstring.getBytes());
|
||||
}
|
||||
|
||||
return buf.array();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue