From fcf680f79993d621051c830293155c6e6018286e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Rebelo?= Date: Sun, 8 Oct 2023 13:46:26 +0100 Subject: [PATCH] Mi Band 8: Add find watch --- .../service/devices/xiaomi/XiaomiSupport.java | 3 +-- .../xiaomi/services/XiaomiSystemService.java | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/XiaomiSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/XiaomiSupport.java index a61aed003..a71dff193 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/XiaomiSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/XiaomiSupport.java @@ -303,8 +303,7 @@ public class XiaomiSupport extends AbstractBTLEDeviceSupport { @Override public void onFindDevice(final boolean start) { - // TODO onFindDevice - super.onFindDevice(start); + systemService.onFindWatch(start); } @Override diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/services/XiaomiSystemService.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/services/XiaomiSystemService.java index b33e35f9f..a42d00732 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/services/XiaomiSystemService.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/services/XiaomiSystemService.java @@ -55,6 +55,7 @@ public class XiaomiSystemService extends AbstractXiaomiService { public static final int CMD_CLOCK = 3; public static final int CMD_PASSWORD_GET = 9; public static final int CMD_FIND_PHONE = 17; + public static final int CMD_FIND_WATCH = 18; public static final int CMD_PASSWORD_SET = 21; public static final int CMD_DISPLAY_ITEMS_GET = 29; public static final int CMD_CHARGER = 79; @@ -301,4 +302,17 @@ public class XiaomiSystemService extends AbstractXiaomiService { ); } } + + public void onFindWatch(final boolean start) { + LOG.debug("Find watch: {}", start); + + getSupport().sendCommand( + "find watch " + start, + XiaomiProto.Command.newBuilder() + .setType(COMMAND_TYPE) + .setSubtype(CMD_FIND_WATCH) + .setSystem(XiaomiProto.System.newBuilder().setFindDevice(start ? 0 : 1).build()) + .build() + ); + } }