1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-29 12:05:53 +01:00

Pebble: remove null termination from cstrings when converting to json for PebbleKit

This commit is contained in:
Andreas Shimokawa 2017-01-11 22:39:08 +01:00
parent 5e74338efe
commit 50cb3c9db3

View File

@ -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: