From 7ba3a874a2ca44fbb44f3124ec792ce447e583e5 Mon Sep 17 00:00:00 2001 From: danielegobbetti Date: Mon, 25 Jan 2016 23:15:19 +0100 Subject: [PATCH 1/4] Message to activate Pebble Health, possibly. --- .../devices/pebble/PebbleProtocol.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) 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 f0373381..c7077c92 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 @@ -654,6 +654,38 @@ public class PebbleProtocol extends GBDeviceProtocol { return buf.array(); } + private byte[] encodeBlobdbActivateHealth() { + byte[] activityPreferences = new byte[] {0x61,0x63,0x74,0x69,0x76,0x69,0x74,0x79,0x50,0x72,0x65,0x66,0x65,0x72,0x65,0x6e,0x63,0x65,0x73}; + byte[] blob = new byte[] {0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02}; + int length = LENGTH_BLOBDB+3; + if (blob != null) { + length += blob.length + 2; + } + + ByteBuffer buf = ByteBuffer.allocate(LENGTH_PREFIX + length); + + buf.order(ByteOrder.BIG_ENDIAN); + buf.putShort((short) length); + buf.putShort(ENDPOINT_BLOBDB); + + buf.order(ByteOrder.LITTLE_ENDIAN); + buf.put(BLOBDB_INSERT); + buf.putShort((short) mRandom.nextInt()); // token + buf.put((byte) 0x07); + buf.put((byte)activityPreferences.length); + //TODO: works this way, but perhaps should be reversed? + //buf.order(ByteOrder.BIG_ENDIAN); + buf.put(activityPreferences); + //buf.order(ByteOrder.LITTLE_ENDIAN); + + if (blob != null) { + buf.putShort((short) blob.length); + buf.put(blob); + } + + return buf.array(); + } + private byte[] encodeBlobDBClear(byte database) { final short LENGTH_BLOBDB_CLEAR = 4; ByteBuffer buf = ByteBuffer.allocate(LENGTH_PREFIX + LENGTH_BLOBDB_CLEAR); From 666c53a1e4c86e0d9227de9388337ae5ab626fa3 Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Tue, 26 Jan 2016 10:48:50 +0100 Subject: [PATCH 2/4] Pebble: make encodeBlobDB accept Strings and UUIDS as keys, use it for Heath activation --- .../devices/pebble/PebbleProtocol.java | 78 ++++++++++--------- 1 file changed, 40 insertions(+), 38 deletions(-) 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 c7077c92..87c0c313 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 @@ -81,7 +81,7 @@ public class PebbleProtocol extends GBDeviceProtocol { static final byte BLOBDB_APP = 2; static final byte BLOBDB_REMINDER = 3; static final byte BLOBDB_NOTIFICATION = 4; - + static final byte BLOBDB_HEALTH = 7; // might also be some generic registry database static final byte BLOBDB_SUCCESS = 1; static final byte BLOBDB_GENERALFAILURE = 2; static final byte BLOBDB_INVALIDOPERATION = 3; @@ -216,7 +216,6 @@ public class PebbleProtocol extends GBDeviceProtocol { static final short LENGTH_APPFETCH = 2; static final short LENGTH_APPRUNSTATE = 17; - static final short LENGTH_BLOBDB = 21; static final short LENGTH_PING = 5; static final short LENGTH_PHONEVERSION = 17; static final short LENGTH_REMOVEAPP_2X = 17; @@ -623,9 +622,25 @@ public class PebbleProtocol extends GBDeviceProtocol { return buf.array(); } - private byte[] encodeBlobdb(UUID uuid, byte command, byte db, byte[] blob) { + private byte[] encodeBlobdb(Object key, byte command, byte db, byte[] blob) { + + int length = 5; + + int key_length; + if (key instanceof UUID) { + key_length = LENGTH_UUID; + } else if (key instanceof String) { + key_length = ((String) key).getBytes().length; + } else { + LOG.warn("unknown key type"); + return null; + } + if (key_length > 255) { + LOG.warn("key is too long"); + return null; + } + length += key_length; - int length = LENGTH_BLOBDB; if (blob != null) { length += blob.length + 2; } @@ -640,11 +655,17 @@ public class PebbleProtocol extends GBDeviceProtocol { buf.put(command); buf.putShort((short) mRandom.nextInt()); // token buf.put(db); - buf.put(LENGTH_UUID); - buf.order(ByteOrder.BIG_ENDIAN); - buf.putLong(uuid.getMostSignificantBits()); - buf.putLong(uuid.getLeastSignificantBits()); - buf.order(ByteOrder.LITTLE_ENDIAN); + + buf.put((byte) key_length); + if (key instanceof UUID) { + UUID uuid = (UUID) key; + buf.order(ByteOrder.BIG_ENDIAN); + buf.putLong(uuid.getMostSignificantBits()); + buf.putLong(uuid.getLeastSignificantBits()); + buf.order(ByteOrder.LITTLE_ENDIAN); + } else { + buf.put(((String) key).getBytes()); + } if (blob != null) { buf.putShort((short) blob.length); @@ -654,36 +675,17 @@ public class PebbleProtocol extends GBDeviceProtocol { return buf.array(); } - private byte[] encodeBlobdbActivateHealth() { - byte[] activityPreferences = new byte[] {0x61,0x63,0x74,0x69,0x76,0x69,0x74,0x79,0x50,0x72,0x65,0x66,0x65,0x72,0x65,0x6e,0x63,0x65,0x73}; - byte[] blob = new byte[] {0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02}; - int length = LENGTH_BLOBDB+3; - if (blob != null) { - length += blob.length + 2; + private byte[] encodeBlobdbActivateHealth(boolean activate) { + byte[] blob; + byte command; + if (activate) { + command = BLOBDB_INSERT; + blob = new byte[]{0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02}; + } else { + command = BLOBDB_DELETE; + blob = null; } - - ByteBuffer buf = ByteBuffer.allocate(LENGTH_PREFIX + length); - - buf.order(ByteOrder.BIG_ENDIAN); - buf.putShort((short) length); - buf.putShort(ENDPOINT_BLOBDB); - - buf.order(ByteOrder.LITTLE_ENDIAN); - buf.put(BLOBDB_INSERT); - buf.putShort((short) mRandom.nextInt()); // token - buf.put((byte) 0x07); - buf.put((byte)activityPreferences.length); - //TODO: works this way, but perhaps should be reversed? - //buf.order(ByteOrder.BIG_ENDIAN); - buf.put(activityPreferences); - //buf.order(ByteOrder.LITTLE_ENDIAN); - - if (blob != null) { - buf.putShort((short) blob.length); - buf.put(blob); - } - - return buf.array(); + return encodeBlobdb("activityPreferences", command, BLOBDB_HEALTH, blob); } private byte[] encodeBlobDBClear(byte database) { From b9cb89ab8b2285f498663bcdd232f0aec0009bea Mon Sep 17 00:00:00 2001 From: cpfeiffer Date: Tue, 26 Jan 2016 23:05:54 +0100 Subject: [PATCH 3/4] Component diagram giving an overview (created with umbrello) --- app/src/main/assets/devintro.png | Bin 0 -> 15586 bytes app/src/main/assets/devintro.xmi | 175 +++++++++++++++++++++++++++++++ 2 files changed, 175 insertions(+) create mode 100644 app/src/main/assets/devintro.png create mode 100644 app/src/main/assets/devintro.xmi diff --git a/app/src/main/assets/devintro.png b/app/src/main/assets/devintro.png new file mode 100644 index 0000000000000000000000000000000000000000..6fc1a5935225628c74997c0ea15d14aaf82fc86e GIT binary patch literal 15586 zcmc(G1yq&Yy6&Po79rgT2uMmdEK*9OJ4ES_ZlsY$2?;4Bq`Nz%OS(g8LFv4c|KIzZ zz5l)MJ?D%&?zn3VV64Tr<~P3??|k0pdERhUWmznAQgjFef+a5pQ-eU@Ss@U(I#hV@ z$u>HREBJ%pBq^_sii$eFsZ}=1pLJ zi*h*fvhqg$q|R(LZN7#xU{siCd8637(J#`SXfw)2`UsC$MFvr zC%@JAaOW>EBGQ5Ip!i%Gk5Z3GDo5ELf3AEX}oNU7%?%+TdK}T*r!0E#c zS|2zNZQ+tI5OdXVrk5;G=?&)GZ0y{e<#ay!JiB4iz{w5cp zf%wy3tD)yxbPy)Co+b|$=cNiH7R{A@!hH2)ZWK1QYL}9!Jc$83Xth3O)+O^}X$z(X zx89$vW&?>kH1FfyBok|EXS&(X%&&JKc^@Ig$K&D$4ySWEGfi6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(S7#H<`x(|I5s&VKao99Vb30$q3mW0fo8oQG)wE zPntkZb5D(}-bwdn9F@l>0YiKshgDmJfTiA%tF*PCbH%Rf5S{4(? zIkM|XMmyRO*Y2By5Y>X%k0oX~lnb$!k+bh{cc!qO=USA$RmzASA5SEZM3;|url1Cf zELBZpCqf0Rt5y$X>|eiE_w;XUR9tz{F<43=-(+=3i;9fRHO@$tlnUM6y(-XHI1zu9 zfo$22%3~`xQP^PQD{5miS`F&&V$-qY@tk|#GOaWlh6zuEN#CD&DgDFBXIS>6M^QJP zOK##ncE0fN9#9Hjl4j*%S$b;lSVGTa-Es3Q@S)Y}3=E*+&um_mm)p3>I0 zY}uCofm;3xFDElE=CjP$+=1f4YhO%c9+Xf6G4|M;Cr_Q+1_m=#jmk PN*N+Atqd!XG!FP*aBklg literal 0 HcmV?d00001 diff --git a/app/src/main/assets/devintro.xmi b/app/src/main/assets/devintro.xmi new file mode 100644 index 00000000..97ec1375 --- /dev/null +++ b/app/src/main/assets/devintro.xmi @@ -0,0 +1,175 @@ + + + + + umbrello uml modeller http://umbrello.kde.org + 1.6.9 + UnicodeUTF8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 33cf76172bf2b679c0480925ef011b7ec113501e Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Wed, 27 Jan 2016 23:00:44 +0100 Subject: [PATCH 4/4] Pebble: add hack to enable and maybe disable Health from the App Manager activity --- .../gadgetbridge/activities/AppManagerActivity.java | 9 ++++++++- .../service/devices/pebble/PebbleIoThread.java | 5 +++++ .../service/devices/pebble/PebbleProtocol.java | 7 +++++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AppManagerActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AppManagerActivity.java index 19d07b16..172f5285 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AppManagerActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AppManagerActivity.java @@ -31,6 +31,7 @@ import nodomain.freeyourgadget.gadgetbridge.GBApplication; import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.adapter.GBDeviceAppAdapter; import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceApp; +import nodomain.freeyourgadget.gadgetbridge.service.devices.pebble.PebbleProtocol; import nodomain.freeyourgadget.gadgetbridge.util.FileUtils; @@ -76,6 +77,7 @@ public class AppManagerActivity extends Activity { List systemApps = new ArrayList<>(); systemApps.add(new GBDeviceApp(UUID.fromString("4dab81a6-d2fc-458a-992c-7a1f3b96a970"), "Sports (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM)); systemApps.add(new GBDeviceApp(UUID.fromString("cf1e816a-9db0-4511-bbb8-f60c48ca8fac"), "Golf (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM)); + systemApps.add(new GBDeviceApp(PebbleProtocol.UUID_PEBBLE_HEALTH, "Health (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM)); return systemApps; } @@ -155,7 +157,7 @@ public class AppManagerActivity extends Activity { AdapterView.AdapterContextMenuInfo acmi = (AdapterView.AdapterContextMenuInfo) menuInfo; selectedApp = appList.get(acmi.position); - if (!selectedApp.isInCache()) { + if (!selectedApp.isInCache() && !PebbleProtocol.UUID_PEBBLE_HEALTH.equals(selectedApp.getUUID())) { menu.removeItem(R.id.appmanager_app_reinstall); } menu.setHeaderTitle(selectedApp.getName()); @@ -168,6 +170,11 @@ public class AppManagerActivity extends Activity { GBApplication.deviceService().onAppDelete(selectedApp.getUUID()); return true; case R.id.appmanager_app_reinstall: + if (PebbleProtocol.UUID_PEBBLE_HEALTH.equals(selectedApp.getUUID())) { + GBApplication.deviceService().onInstallApp(Uri.parse("fake://health")); + return true; + } + File cachePath; try { cachePath = new File(FileUtils.getExternalFilesDir().getPath() + "/pbw-cache/" + selectedApp.getUUID() + ".pbw"); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleIoThread.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleIoThread.java index 3d0597e0..49165df4 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleIoThread.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleIoThread.java @@ -570,6 +570,11 @@ public class PebbleIoThread extends GBDeviceIoThread { return; } + if (uri.equals(Uri.parse("fake://health"))) { + write(mPebbleProtocol.encodeActivateHealth(true)); + return; + } + String hwRev = gbDevice.getHardwareVersion(); String platformName; if (hwRev.startsWith("snowy")) { 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 87c0c313..d1e3fb13 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 @@ -343,11 +343,11 @@ public class PebbleProtocol extends GBDeviceProtocol { byte last_id = -1; private final ArrayList tmpUUIDS = new ArrayList<>(); + public static final UUID UUID_PEBBLE_HEALTH = UUID.fromString("36d8c6ed-4c83-4fa1-a9e2-8f12dc941f8c"); // FIXME: store somewhere else, this is also accessed by other code private static final UUID UUID_GBPEBBLE = UUID.fromString("61476764-7465-7262-6469-656775527a6c"); private static final UUID UUID_MORPHEUZ = UUID.fromString("5be44f1d-d262-4ea6-aa30-ddbec1e3cab2"); private static final UUID UUID_WHETHERNEAT = UUID.fromString("3684003b-a685-45f9-a713-abc6364ba051"); private static final UUID UUID_MISFIT = UUID.fromString("0b73b76a-cd65-4dc2-9585-aaa213320858"); - private static final UUID UUID_PEBBLE_HEALTH = UUID.fromString("36d8c6ed-4c83-4fa1-a9e2-8f12dc941f8c"); private static final UUID UUID_PEBBLE_TIMESTYLE = UUID.fromString("4368ffa4-f0fb-4823-90be-f754b076bdaa"); private static final UUID UUID_PEBSTYLE = UUID.fromString("da05e84d-e2a2-4020-a2dc-9cdcf265fcdd"); @@ -675,7 +675,7 @@ public class PebbleProtocol extends GBDeviceProtocol { return buf.array(); } - private byte[] encodeBlobdbActivateHealth(boolean activate) { + public byte[] encodeActivateHealth(boolean activate) { byte[] blob; byte command; if (activate) { @@ -1092,6 +1092,9 @@ public class PebbleProtocol extends GBDeviceProtocol { @Override public byte[] encodeAppDelete(UUID uuid) { if (isFw3x) { + if (UUID_PEBBLE_HEALTH.equals(uuid)) { + return encodeActivateHealth(false); + } return encodeBlobdb(uuid, BLOBDB_DELETE, BLOBDB_APP, null); } else { ByteBuffer buf = ByteBuffer.allocate(LENGTH_PREFIX + LENGTH_REMOVEAPP_2X);