mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-08-19 22:00:53 +02:00
Pebble: Pass booleans from Javascript Appmessage as such and convert to int16 later when sending to pebble
https://developer.pebble.com/guides/communication/using-pebblekit-js/#type-conversion
This commit is contained in:
parent
8353026c08
commit
c2af2dd15c
@ -221,9 +221,6 @@ public class ExternalPebbleJSActivity extends GBActivity {
|
||||
|
||||
if (passKey) {
|
||||
Object obj = in.get(inKey);
|
||||
if (obj instanceof Boolean) {
|
||||
obj = ((Boolean) obj) ? "true" : "false";
|
||||
}
|
||||
out.put(outKey, obj);
|
||||
} else {
|
||||
GB.toast("Discarded key " + inKey + ", not found in the local configuration and is not an integer key.", Toast.LENGTH_SHORT, GB.WARN);
|
||||
|
@ -87,6 +87,8 @@ public class PebbleSupport extends AbstractSerialDeviceSupport {
|
||||
byteArray[i] = ((Integer) jsonArray.get(i)).byteValue();
|
||||
}
|
||||
object = byteArray;
|
||||
} else if (object instanceof Boolean) {
|
||||
object = (short) (((Boolean) object) ? 1 : 0);
|
||||
}
|
||||
pairs.add(new Pair<>(Integer.parseInt(keyStr), object));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user