From 4bb18b97953a6953b6af6114c0a8ddf0e9aa316d Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Fri, 25 Aug 2017 01:04:36 +0200 Subject: [PATCH] Amazfit Bip: enable caller name display upon initialization This is neccessary for newer firmwares (0.0.8.74 at least) (I assume this command also exists on Mi2, hope it is true :D) --- .../gadgetbridge/devices/miband/MiBand2Service.java | 2 ++ .../service/devices/miband2/MiBand2Support.java | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBand2Service.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBand2Service.java index 5c07a42d..96231c1a 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBand2Service.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBand2Service.java @@ -170,6 +170,8 @@ public class MiBand2Service { public static final byte[] COMMAND_DISABLE_GOAL_NOTIFICATION = new byte[]{ENDPOINT_DISPLAY, 0x06, 0x00, 0x00}; public static final byte[] COMMAND_ENABLE_ROTATE_WRIST_TO_SWITCH_INFO = new byte[]{ENDPOINT_DISPLAY, 0x0d, 0x00, 0x01}; public static final byte[] COMMAND_DISABLE_ROTATE_WRIST_TO_SWITCH_INFO = new byte[]{ENDPOINT_DISPLAY, 0x0d, 0x00, 0x00}; + public static final byte[] COMMAND_ENABLE_DISPLAY_CALLER = new byte[]{ENDPOINT_DISPLAY, 0x10, 0x00, 0x00, 0x01}; + public static final byte[] COMMAND_DISABLE_DISPLAY_CALLER = new byte[]{ENDPOINT_DISPLAY, 0x10, 0x00, 0x00, 0x00}; public static final byte[] DISPLAY_XXX = new byte[] {ENDPOINT_DISPLAY, 0x03, 0x0, 0x0 }; public static final byte[] DISPLAY_YYY = new byte[] {ENDPOINT_DISPLAY, 0x10, 0x0, 0x1, 0x1 }; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband2/MiBand2Support.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband2/MiBand2Support.java index 012aeef1..92244714 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband2/MiBand2Support.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband2/MiBand2Support.java @@ -1215,6 +1215,11 @@ public class MiBand2Support extends AbstractBTLEDeviceSupport { return this; } + private MiBand2Support setDisplayCaller(TransactionBuilder builder) { + builder.write(getCharacteristic(MiBand2Service.UUID_CHARACTERISTIC_3_CONFIGURATION), MiBand2Service.COMMAND_ENABLE_DISPLAY_CALLER); + return this; + } + private MiBand2Support setDoNotDisturb(TransactionBuilder builder) { DoNotDisturb doNotDisturb = MiBand2Coordinator.getDoNotDisturb(getContext()); LOG.info("Setting do not disturb to " + doNotDisturb); @@ -1314,6 +1319,7 @@ public class MiBand2Support extends AbstractBTLEDeviceSupport { setDoNotDisturb(builder); setRotateWristToSwitchInfo(builder); setActivateDisplayOnLiftWrist(builder); + setDisplayCaller(builder); setGoalNotification(builder); setInactivityWarnings(builder); setHeartrateSleepSupport(builder);