From 35c557b62afb72859420c44d88fa00a9f21deefb Mon Sep 17 00:00:00 2001 From: MrYoranimo Date: Sun, 15 Sep 2024 13:13:02 +0200 Subject: [PATCH] Xiaomi Smart Band 9: add experimental support --- .../xiaomi/miband9/MiBand9Coordinator.java | 54 +++++++++++++++++++ .../gadgetbridge/model/DeviceType.java | 2 + app/src/main/res/values/strings.xml | 1 + 3 files changed, 57 insertions(+) create mode 100644 app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/miband9/MiBand9Coordinator.java diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/miband9/MiBand9Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/miband9/MiBand9Coordinator.java new file mode 100644 index 000000000..e096baf91 --- /dev/null +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/miband9/MiBand9Coordinator.java @@ -0,0 +1,54 @@ +/* Copyright (C) 2024 Yoran Vulker + + This file is part of Gadgetbridge. + + Gadgetbridge is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Gadgetbridge is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . */ +package nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.miband9; + +import java.util.regex.Pattern; + +import nodomain.freeyourgadget.gadgetbridge.R; +import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.XiaomiCoordinator; + +public class MiBand9Coordinator extends XiaomiCoordinator { + @Override + public int getDeviceNameResource() { + return R.string.devicetype_miband9; + } + + @Override + protected Pattern getSupportedDeviceName() { + return Pattern.compile("^Xiaomi Smart Band 9 [0-9A-F]{4}$"); + } + + @Override + public int getDefaultIconResource() { + return R.drawable.ic_device_miband6; + } + + @Override + public int getDisabledIconResource() { + return R.drawable.ic_device_miband6_disabled; + } + + @Override + public ConnectionType getConnectionType() { + return ConnectionType.BT_CLASSIC; + } + + @Override + public boolean isExperimental() { + return true; + } +} diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java index b62e38c4e..e2042fcc7 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java @@ -249,6 +249,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.miband7pro.MiBand7Pro import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.miband8.MiBand8Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.miband8active.MiBand8ActiveCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.miband8pro.MiBand8ProCoordinator; +import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.miband9.MiBand9Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.miwatch.MiWatchLiteCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.miwatchcolorsport.MiWatchColorSportCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmismartband2.RedmiSmartBand2Coordinator; @@ -319,6 +320,7 @@ public enum DeviceType { MIBAND8(MiBand8Coordinator.class), MIBAND8ACTIVE(MiBand8ActiveCoordinator.class), MIBAND8PRO(MiBand8ProCoordinator.class), + MIBAND9(MiBand9Coordinator.class), MIWATCHLITE(MiWatchLiteCoordinator.class), MIWATCHCOLORSPORT(MiWatchColorSportCoordinator.class), REDMIWATCH3ACTIVE(RedmiWatch3ActiveCoordinator.class), diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 265d30b32..cf0649ea7 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1665,6 +1665,7 @@ Xiaomi Smart Band 8 Xiaomi Smart Band 8 Active Xiaomi Smart Band 8 Pro + Xiaomi Smart Band 9 Amazfit Balance Amazfit Active Amazfit Active Edge