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 4941e83db..06a9e4a6c 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 @@ -66,6 +66,7 @@ public final class HuaweiConstants { public static final String HU_WATCHGT3PRO_NAME = "huawei watch gt 3 pro-"; public static final String HU_WATCHGT4_NAME = "huawei watch gt 4-"; public static final String HU_WATCHFIT_NAME = "huawei watch fit-"; + public static final String HU_WATCHFIT2_NAME = "huawei watch fit 2-"; public static final String HU_WATCHULTIMATE_NAME = "huawei watch ultimate-"; public static final String PREF_HUAWEI_ADDRESS = "huawei_address"; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/huaweiwatchfit2/HuaweiWatchFit2Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/huaweiwatchfit2/HuaweiWatchFit2Coordinator.java new file mode 100644 index 000000000..bdac89831 --- /dev/null +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/huaweiwatchfit2/HuaweiWatchFit2Coordinator.java @@ -0,0 +1,56 @@ +/* Copyright (C) 2024 Damien Gaignon + + 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.huaweiwatchfit2; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +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 HuaweiWatchFit2Coordinator extends HuaweiBRCoordinator { + private static final Logger LOG = LoggerFactory.getLogger(HuaweiWatchFit2Coordinator.class); + + public HuaweiWatchFit2Coordinator() { + super(); + getHuaweiCoordinator().setTransactionCrypted(true); + } + + @Override + public boolean isExperimental() { + return true; + } + + @Override + public DeviceType getDeviceType() { + return DeviceType.HUAWEIWATCHFIT2; + } + + @Override + protected Pattern getSupportedDeviceName() { + return Pattern.compile("(" + HuaweiConstants.HU_WATCHFIT2_NAME + ").*", Pattern.CASE_INSENSITIVE); + } + + @Override + public int getDeviceNameResource() { + return R.string.devicetype_huawei_watchfit2; + } +} 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 5f8f2b2f8..3a6b9dee2 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java @@ -366,6 +366,7 @@ public enum DeviceType { HUAWEIWATCHGT4(HuaweiWatchGT4Coordinator.class), HUAWEIBAND8(HuaweiBand8Coordinator.class), HUAWEIWATCHFIT(HuaweiWatchFitCoordinator.class), + HUAWEIWATCHFIT2(HuaweiWatchFitCoordinator.class), HUAWEIWATCHULTIMATE(HuaweiWatchUltimateCoordinator.class), VESC(VescCoordinator.class), BINARY_SENSOR(BinarySensorCoordinator.class), diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index fa1ebc3c8..2549fd6d5 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1552,6 +1552,7 @@ Huawei Watch GT 3 (Pro) Huawei Watch GT 4 Huawei Watch Fit + Huawei Watch Fit 2 Huawei Watch Ultimate Femometer Vinca II Xiaomi Watch Lite