Merge branch 'master' into new_GUI
This commit is contained in:
commit
8603c3ffa0
|
@ -1,5 +1,10 @@
|
||||||
###Changelog
|
###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
|
####Version 0.13.6
|
||||||
* Mi Band 2: Support for multiple alarms (3 at the moment)
|
* Mi Band 2: Support for multiple alarms (3 at the moment)
|
||||||
* Mi Band 2: Fix for alarms not working when just one is enabled
|
* Mi Band 2: Fix for alarms not working when just one is enabled
|
||||||
|
|
|
@ -26,8 +26,8 @@ android {
|
||||||
targetSdkVersion 23
|
targetSdkVersion 23
|
||||||
|
|
||||||
// note: always bump BOTH versionCode and versionName!
|
// note: always bump BOTH versionCode and versionName!
|
||||||
versionName "0.13.6"
|
versionName "0.13.7"
|
||||||
versionCode 68
|
versionCode 69
|
||||||
|
|
||||||
vectorDrawables.useSupportLibrary = true
|
vectorDrawables.useSupportLibrary = true
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,23 +161,22 @@ public class ExternalPebbleJSActivity extends GBActivity {
|
||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void sendAppMessage(String msg) {
|
public void sendAppMessage(String msg) {
|
||||||
LOG.debug("from WEBVIEW: ", msg);
|
LOG.debug("from WEBVIEW: " + msg);
|
||||||
JSONObject knownKeys = getAppConfigurationKeys();
|
JSONObject knownKeys = getAppConfigurationKeys();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
JSONObject in = new JSONObject(msg);
|
JSONObject in = new JSONObject(msg);
|
||||||
JSONObject out = new JSONObject();
|
JSONObject out = new JSONObject();
|
||||||
String inKey, outKey;
|
String inKey, outKey;
|
||||||
boolean passKey = false;
|
boolean passKey;
|
||||||
for (Iterator<String> key = in.keys(); key.hasNext(); ) {
|
for (Iterator<String> key = in.keys(); key.hasNext(); ) {
|
||||||
passKey = false;
|
passKey = false;
|
||||||
inKey = key.next();
|
inKey = key.next();
|
||||||
outKey = null;
|
outKey = null;
|
||||||
int pebbleAppIndex = knownKeys.optInt(inKey);
|
int pebbleAppIndex = knownKeys.optInt(inKey, -1);
|
||||||
if (pebbleAppIndex != 0) {
|
if (pebbleAppIndex != -1) {
|
||||||
passKey = true;
|
passKey = true;
|
||||||
outKey = String.valueOf(pebbleAppIndex);
|
outKey = String.valueOf(pebbleAppIndex);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//do not discard integer keys (see https://developer.pebble.com/guides/communication/using-pebblekit-js/ )
|
//do not discard integer keys (see https://developer.pebble.com/guides/communication/using-pebblekit-js/ )
|
||||||
Scanner scanner = new Scanner(inKey);
|
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);
|
Object obj = in.get(inKey);
|
||||||
if (obj instanceof Boolean) {
|
if (obj instanceof Boolean) {
|
||||||
obj = ((Boolean) obj) ? "true" : "false";
|
obj = ((Boolean) obj) ? "true" : "false";
|
||||||
|
|
|
@ -1645,6 +1645,9 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
||||||
} else if (pair.second instanceof byte[]) {
|
} else if (pair.second instanceof byte[]) {
|
||||||
length += ((byte[]) pair.second).length;
|
length += ((byte[]) pair.second).length;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
LOG.warn("unknown type: " + pair.second.getClass().toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteBuffer buf = ByteBuffer.allocate(LENGTH_PREFIX + length);
|
ByteBuffer buf = ByteBuffer.allocate(LENGTH_PREFIX + length);
|
||||||
|
|
|
@ -3,6 +3,7 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.pebble;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
|
|
||||||
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
@ -59,6 +60,14 @@ public class PebbleSupport extends AbstractSerialDeviceSupport {
|
||||||
while (keysIterator.hasNext()) {
|
while (keysIterator.hasNext()) {
|
||||||
String keyStr = keysIterator.next();
|
String keyStr = keysIterator.next();
|
||||||
Object object = json.get(keyStr);
|
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));
|
pairs.add(new Pair<>(Integer.parseInt(keyStr), object));
|
||||||
}
|
}
|
||||||
getDeviceIOThread().write(((PebbleProtocol) getDeviceProtocol()).encodeApplicationMessagePush(PebbleProtocol.ENDPOINT_APPLICATIONMESSAGE, uuid, pairs));
|
getDeviceIOThread().write(((PebbleProtocol) getDeviceProtocol()).encodeApplicationMessagePush(PebbleProtocol.ENDPOINT_APPLICATIONMESSAGE, uuid, pairs));
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<changelog>
|
<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">
|
<release version="0.13.6" versioncode="68">
|
||||||
<change>Mi Band 2: Support multiple alarms (3 at the moment)</change>
|
<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>
|
<change>Mi Band 2: Fix for alarms not working when just one is enabled</change>
|
||||||
|
|
Loading…
Reference in New Issue