mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-25 08:05:55 +01:00
Huawei: Fix notification constraints for Watch 3
* Watch 3 reports some values as integer, while internal buffer now uses short values. Actually all values here fits in short so just cut leading zeros now. Addin exception for case cutted values was non zeros
This commit is contained in:
parent
a994603389
commit
5a6a39d059
@ -135,7 +135,13 @@ public class Notifications {
|
||||
|
||||
private void putByteBuffer(ByteBuffer bBuffer, byte position, byte[] value) {
|
||||
ByteBuffer bValue = ByteBuffer.wrap(value);
|
||||
if (bValue.capacity() == 2) {
|
||||
if (bValue.capacity() == 4) {
|
||||
short highbytes = bValue.getShort();
|
||||
if (highbytes != 0) {
|
||||
throw new RuntimeException("This should not happen until very large messages allowed");
|
||||
}
|
||||
bBuffer.putShort(position, bValue.getShort());
|
||||
} else if (bValue.capacity() == 2) {
|
||||
bBuffer.putShort(position, bValue.getShort());
|
||||
} else {
|
||||
bBuffer.put(position, (byte) 0x00);
|
||||
|
Loading…
Reference in New Issue
Block a user