From 7c1d44fcd376e9598948d6981aef3a2f95e78227 Mon Sep 17 00:00:00 2001 From: gjaekel Date: Sat, 9 Nov 2024 15:20:48 +0000 Subject: [PATCH] Add support for HUAWEI Band3Pro (#4296) Co-authored-by: gjaekel Co-committed-by: gjaekel --- .../devices/huawei/HuaweiConstants.java | 2 + .../HuaweiBand3ProCoordinator.java | 41 +++++++++++++++++++ .../gadgetbridge/model/DeviceType.java | 4 +- app/src/main/res/values/strings.xml | 1 + 4 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/huaweiband3pro/HuaweiBand3ProCoordinator.java diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/HuaweiConstants.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/HuaweiConstants.java index fc52fd879..90523c102 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/HuaweiConstants.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/HuaweiConstants.java @@ -56,7 +56,9 @@ public final class HuaweiConstants { public static final String HU_BAND4E_NAME = "huawei band 4e-"; public static final String HU_BAND6_NAME = "huawei band 6-"; public static final String HU_WATCHGT_NAME = "huawei watch gt-"; + public static final String HU_BAND3_NAME = "huawei band 3-"; public static final String HU_BAND4_NAME = "huawei band 4-"; + public static final String HU_BAND3PRO_NAME = "huawei band 3 pro-"; public static final String HU_BAND4PRO_NAME = "huawei band 4 pro-"; public static final String HU_WATCHGT2_NAME = "huawei watch gt 2-"; public static final String HU_WATCHGT2E_NAME = "huawei watch gt 2e-"; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/huaweiband3pro/HuaweiBand3ProCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/huaweiband3pro/HuaweiBand3ProCoordinator.java new file mode 100644 index 000000000..ed5d0676f --- /dev/null +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/huaweiband3pro/HuaweiBand3ProCoordinator.java @@ -0,0 +1,41 @@ +/* Copyright (C) 2024 Damien Gaignon, Guido Jäkel, Martin.JM + + 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.huawei.huaweiband3pro; + +import java.util.regex.Pattern; + +import nodomain.freeyourgadget.gadgetbridge.R; +import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiConstants; +import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiLECoordinator; +import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; + +public class HuaweiBand3ProCoordinator extends HuaweiLECoordinator { + @Override + public DeviceType getDeviceType() { + return DeviceType.HUAWEIBAND3PRO; + } + + @Override + protected Pattern getSupportedDeviceName() { + return Pattern.compile("(" + HuaweiConstants.HU_BAND3_NAME + "|" + HuaweiConstants.HU_BAND3PRO_NAME + ").*", Pattern.CASE_INSENSITIVE); + } + + @Override + public int getDeviceNameResource() { + return R.string.devicetype_huawei_band3pro; + } +} 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 e4f36ea80..fdeb23950 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java @@ -2,7 +2,7 @@ Andreas Böhler, Andreas Shimokawa, Andrew Watkins, angelpup, Carsten Pfeiffer, Cre3per, Damien Gaignon, DanialHanif, Daniel Dakhno, Daniele Gobbetti, Daniel Thompson, Da Pa, Dmytro Bielik, Frank Ertl, Gabriele Monaco, GeekosaurusR3x, - Gordon Williams, Jean-François Greffier, jfgreffier, jhey, João Paulo + Guido Jäkel, Gordon Williams, Jean-François Greffier, jfgreffier, jhey, João Paulo Barraca, Jochen S, Johannes Krude, José Rebelo, ksiwczynski, ladbsoft, Lesur Frederic, Maciej Kuśnierz, mamucho, Manuel Ruß, Maxime Reyrolle, maxirnilian, Michael, narektor, Noodlez, odavo32nof, opavlov, pangwalla, @@ -175,6 +175,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.huawei.honorband7.HonorBand7 import nodomain.freeyourgadget.gadgetbridge.devices.huawei.honormagicwatch2.HonorMagicWatch2Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huawei.honorwatchgs3.HonorWatchGS3Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huawei.honorwatchgspro.HonorWatchGSProCoordinator; +import nodomain.freeyourgadget.gadgetbridge.devices.huawei.huaweiband3pro.HuaweiBand3ProCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huawei.huaweiband4pro.HuaweiBand4ProCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huawei.huaweiband6.HuaweiBand6Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huawei.huaweiband7.HuaweiBand7Coordinator; @@ -507,6 +508,7 @@ public enum DeviceType { HUAWEIBANDAW70(HuaweiBandAw70Coordinator.class), HUAWEIBAND6(HuaweiBand6Coordinator.class), HUAWEIWATCHGT(HuaweiWatchGTCoordinator.class), + HUAWEIBAND3PRO(HuaweiBand3ProCoordinator.class), HUAWEIBAND4PRO(HuaweiBand4ProCoordinator.class), HUAWEIWATCHGT2(HuaweiWatchGT2Coordinator.class), HUAWEIWATCHGT2E(HuaweiWatchGT2eCoordinator.class), diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d7ea29942..7c0d89187 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1846,6 +1846,7 @@ Huawei Band 8 Huawei Band 9 Huawei Watch GT + Huawei Band 3 (Pro) Huawei Band 4 (Pro) Huawei Watch GT 2 (Pro) Huawei Watch GT 2e