diff --git a/CHANGELOG.md b/CHANGELOG.md index f6719b893..85bd2d5f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ###Changelog +####Version 0.13.7 +* Pebble: Fix configuration of certain pebble apps (eg. QR Generator, Squared 4.0) +* Mi Band: allow to delete Mi Band address from development settings +* Mi Band 2: Some initial hacky support for hr readings (Debug activity only) + ####Version 0.13.6 * Mi Band 2: Support for multiple alarms (3 at the moment) * Mi Band 2: Fix for alarms not working when just one is enabled diff --git a/app/build.gradle b/app/build.gradle index dc6725f37..7f9770cd0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -26,8 +26,8 @@ android { targetSdkVersion 23 // note: always bump BOTH versionCode and versionName! - versionName "0.13.6" - versionCode 68 + versionName "0.13.7" + versionCode 69 vectorDrawables.useSupportLibrary = true } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ExternalPebbleJSActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ExternalPebbleJSActivity.java index ed9ed5085..44d5d93a6 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ExternalPebbleJSActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ExternalPebbleJSActivity.java @@ -161,23 +161,22 @@ public class ExternalPebbleJSActivity extends GBActivity { @JavascriptInterface public void sendAppMessage(String msg) { - LOG.debug("from WEBVIEW: ", msg); + LOG.debug("from WEBVIEW: " + msg); JSONObject knownKeys = getAppConfigurationKeys(); try { JSONObject in = new JSONObject(msg); JSONObject out = new JSONObject(); String inKey, outKey; - boolean passKey = false; + boolean passKey; for (Iterator key = in.keys(); key.hasNext(); ) { passKey = false; inKey = key.next(); outKey = null; - int pebbleAppIndex = knownKeys.optInt(inKey); - if (pebbleAppIndex != 0) { + int pebbleAppIndex = knownKeys.optInt(inKey, -1); + if (pebbleAppIndex != -1) { passKey = true; outKey = String.valueOf(pebbleAppIndex); - } else { //do not discard integer keys (see https://developer.pebble.com/guides/communication/using-pebblekit-js/ ) Scanner scanner = new Scanner(inKey); @@ -187,7 +186,7 @@ public class ExternalPebbleJSActivity extends GBActivity { } } - if (passKey && outKey != null) { + if (passKey) { Object obj = in.get(inKey); if (obj instanceof Boolean) { obj = ((Boolean) obj) ? "true" : "false"; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleProtocol.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleProtocol.java index a2a7e73f5..57c58b70d 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleProtocol.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleProtocol.java @@ -1645,6 +1645,9 @@ public class PebbleProtocol extends GBDeviceProtocol { } else if (pair.second instanceof byte[]) { length += ((byte[]) pair.second).length; } + else { + LOG.warn("unknown type: " + pair.second.getClass().toString()); + } } ByteBuffer buf = ByteBuffer.allocate(LENGTH_PREFIX + length); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleSupport.java index a6beb9ffa..dcf14ada3 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleSupport.java @@ -3,6 +3,7 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.pebble; import android.net.Uri; import android.util.Pair; +import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -59,6 +60,14 @@ public class PebbleSupport extends AbstractSerialDeviceSupport { while (keysIterator.hasNext()) { String keyStr = keysIterator.next(); Object object = json.get(keyStr); + if (object instanceof JSONArray) { + JSONArray jsonArray = (JSONArray) object; + byte[] byteArray = new byte[jsonArray.length()]; + for (int i = 0; i < jsonArray.length(); i++) { + byteArray[i] = ((Integer) jsonArray.get(i)).byteValue(); + } + object = byteArray; + } pairs.add(new Pair<>(Integer.parseInt(keyStr), object)); } getDeviceIOThread().write(((PebbleProtocol) getDeviceProtocol()).encodeApplicationMessagePush(PebbleProtocol.ENDPOINT_APPLICATIONMESSAGE, uuid, pairs)); diff --git a/app/src/main/res/xml/changelog_master.xml b/app/src/main/res/xml/changelog_master.xml index 6459f6044..f778baba0 100644 --- a/app/src/main/res/xml/changelog_master.xml +++ b/app/src/main/res/xml/changelog_master.xml @@ -1,5 +1,10 @@ + + Pebble: Fix configuration of certain pebble apps (eg. QR Generator, Squared 4.0) + Mi Band: allow to delete Mi Band address from development settings + Mi Band 2: Some initial hacky support for hr readings (Debug activity only) + Mi Band 2: Support multiple alarms (3 at the moment) Mi Band 2: Fix for alarms not working when just one is enabled