mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-01 06:22:55 +01:00
Pebble: remove null termination from cstrings when converting to json for PebbleKit
This commit is contained in:
parent
5e74338efe
commit
50cb3c9db3
@ -1783,6 +1783,9 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
||||
byte type = buf.get();
|
||||
short length = buf.getShort();
|
||||
jsonObject.put("key", key);
|
||||
if (type == TYPE_CSTRING) {
|
||||
length--;
|
||||
}
|
||||
jsonObject.put("length", length);
|
||||
switch (type) {
|
||||
case TYPE_UINT:
|
||||
@ -1815,6 +1818,7 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
||||
} else {
|
||||
jsonObject.put("type", "string");
|
||||
jsonObject.put("value", new String(bytes));
|
||||
buf.get(); // skip null-termination;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user