1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-27 20:36:51 +01:00

Merge branch 'master' into new_GUI

This commit is contained in:
Andreas Shimokawa 2016-10-28 00:53:03 +02:00
commit 8603c3ffa0
6 changed files with 29 additions and 8 deletions

View File

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

View File

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

View File

@ -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<String> 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";

View File

@ -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);

View File

@ -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));

View File

@ -1,5 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<changelog>
<release version="0.13.7" versioncode="69">
<change>Pebble: Fix configuration of certain pebble apps (eg. QR Generator, Squared 4.0)</change>
<change>Mi Band: allow to delete Mi Band address from development settings</change>
<change>Mi Band 2: Some initial hacky support for hr readings (Debug activity only)</change>
</release>
<release version="0.13.6" versioncode="68">
<change>Mi Band 2: Support multiple alarms (3 at the moment)</change>
<change>Mi Band 2: Fix for alarms not working when just one is enabled</change>