From 8ded52a0d16f23eb1e6e6f9e1232610e345401a3 Mon Sep 17 00:00:00 2001 From: Vitaliy Tomin Date: Fri, 23 Aug 2024 17:47:36 +0800 Subject: [PATCH] huawei: Add honor watch gs 3 gadget --- .../devices/huawei/HuaweiConstants.java | 1 + .../HonorWatchGS3Coordinator.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/honorwatchgs3/HonorWatchGS3Coordinator.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 88a839d82..447746208 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 @@ -50,6 +50,7 @@ public final class HuaweiConstants { public static final String HO_BAND6_NAME = "honor band 6-"; 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 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/honorwatchgs3/HonorWatchGS3Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/honorwatchgs3/HonorWatchGS3Coordinator.java new file mode 100644 index 000000000..0666adf35 --- /dev/null +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/honorwatchgs3/HonorWatchGS3Coordinator.java @@ -0,0 +1,51 @@ +/* Copyright (C) 2024 Vitaly Tomin + + 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.honorwatchgs3; + +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 HonorWatchGS3Coordinator extends HuaweiBRCoordinator { + public HonorWatchGS3Coordinator() { + super(); + getHuaweiCoordinator().setTransactionCrypted(false); + } + + @Override + public String getManufacturer() { + return "Honor"; + } + + @Override + public DeviceType getDeviceType() { + return DeviceType.HONORWATCHGS3; + } + + @Override + protected Pattern getSupportedDeviceName() { + return Pattern.compile(HuaweiConstants.HO_WATCHGS3_NAME + ".*", Pattern.CASE_INSENSITIVE); + } + + @Override + public int getDeviceNameResource() { + return R.string.devicetype_honor_watchgs3; + } +} 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 1499c9d66..e17761727 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java @@ -157,6 +157,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.huawei.honorband5.HonorBand5 import nodomain.freeyourgadget.gadgetbridge.devices.huawei.honorband6.HonorBand6Coordinator; 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.huaweiband4pro.HuaweiBand4ProCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huawei.huaweiband6.HuaweiBand6Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huawei.huaweiband7.HuaweiBand7Coordinator; @@ -463,6 +464,7 @@ public enum DeviceType { HONORBAND6(HonorBand6Coordinator.class), HONORBAND7(HonorBand7Coordinator.class), HONORMAGICWATCH2(HonorMagicWatch2Coordinator.class), + HONORWATCHGS3(HonorWatchGS3Coordinator.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 ef552543b..796f8a8cc 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1783,6 +1783,7 @@ Honor Band 6 Honor Band 7 Honor MagicWatch 2 + Honor Watch GS 3 Huawei Band (AW70) Huawei Band 6 Huawei Band 7