From 02286d2c2ccdb2fbe79b3b1fee752863419f4fec Mon Sep 17 00:00:00 2001 From: Vitaliy Tomin Date: Thu, 12 Sep 2024 12:36:11 +0800 Subject: [PATCH] huawei: Add honor watch gs pro gadget --- .../devices/huawei/HuaweiConstants.java | 1 + .../HonorWatchGSProCoordinator.java | 51 +++++++++++++++++++ .../gadgetbridge/model/DeviceType.java | 2 + app/src/main/res/values/strings.xml | 1 + 4 files changed, 55 insertions(+) create mode 100644 app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/honorwatchgspro/HonorWatchGSProCoordinator.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 4cd555a92..3f5083b36 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 @@ -51,6 +51,7 @@ public final class HuaweiConstants { public static final String HO_BAND7_NAME = "honor band 7-"; public static final String HO_MAGICWATCH2_NAME = "honor magicwatch 2-"; public static final String HO_WATCHGS3_NAME = "honor watch gs 3-"; + public static final String HO_WATCHGSPRO_NAME = "honor watch gs pro-"; public static final String HU_BAND3E_NAME = "huawei band 3e-"; public static final String HU_BAND4E_NAME = "huawei band 4e-"; public static final String HU_BAND6_NAME = "huawei band 6-"; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/honorwatchgspro/HonorWatchGSProCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/honorwatchgspro/HonorWatchGSProCoordinator.java new file mode 100644 index 000000000..0d4691e54 --- /dev/null +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/honorwatchgspro/HonorWatchGSProCoordinator.java @@ -0,0 +1,51 @@ +/* Copyright (C) 2024 Vitaly Tomin, Gaignon Damien + + 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.honorwatchgspro; + +import java.util.regex.Pattern; + +import nodomain.freeyourgadget.gadgetbridge.R; +import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiBRCoordinator; +import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiConstants; +import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; + +public class HonorWatchGSProCoordinator extends HuaweiBRCoordinator { + public HonorWatchGSProCoordinator() { + super(); + getHuaweiCoordinator().setTransactionCrypted(false); + } + + @Override + public String getManufacturer() { + return "Honor"; + } + + @Override + public DeviceType getDeviceType() { + return DeviceType.HONORWATCHGSPRO; + } + + @Override + protected Pattern getSupportedDeviceName() { + return Pattern.compile(HuaweiConstants.HO_WATCHGSPRO_NAME + ".*", Pattern.CASE_INSENSITIVE); + } + + @Override + public int getDeviceNameResource() { + return R.string.devicetype_honor_watchgspro; + } +} 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 8303a9e81..428ca732a 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java @@ -160,6 +160,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.huawei.honorband6.HonorBand6 import nodomain.freeyourgadget.gadgetbridge.devices.huawei.honorband7.HonorBand7Coordinator; 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.huaweiband4pro.HuaweiBand4ProCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huawei.huaweiband6.HuaweiBand6Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huawei.huaweiband7.HuaweiBand7Coordinator; @@ -474,6 +475,7 @@ public enum DeviceType { HONORBAND7(HonorBand7Coordinator.class), HONORMAGICWATCH2(HonorMagicWatch2Coordinator.class), HONORWATCHGS3(HonorWatchGS3Coordinator.class), + HONORWATCHGSPRO(HonorWatchGSProCoordinator.class), HUAWEIWATCHGT3(HuaweiWatchGT3Coordinator.class), HUAWEIWATCHGT4(HuaweiWatchGT4Coordinator.class), HUAWEIWATCHGTRUNNER(HuaweiWatchGTRunnerCoordinator.class), diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7c4046eb6..a35da6c2b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1808,6 +1808,7 @@ Honor Band 7 Honor MagicWatch 2 Honor Watch GS 3 + Honor Watch GS Pro Huawei Band (AW70) Huawei Band 6 Huawei Band 7