Huawei: add Huawei Band 2 (Pro)

This commit is contained in:
Simon Brand 2024-12-04 18:35:25 +00:00 committed by José Rebelo
parent d850439b4e
commit 6c7649264f
4 changed files with 46 additions and 0 deletions

View File

@ -56,8 +56,10 @@ 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_BAND2_NAME = "huawei band 2-";
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_BAND2PRO_NAME = "huawei band 2 pro-";
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-";

View File

@ -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 <https://www.gnu.org/licenses/>. */
package nodomain.freeyourgadget.gadgetbridge.devices.huawei.huaweiband2pro;
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 HuaweiBand2ProCoordinator extends HuaweiLECoordinator {
@Override
public DeviceType getDeviceType() {
return DeviceType.HUAWEIBAND2PRO;
}
@Override
protected Pattern getSupportedDeviceName() {
return Pattern.compile("(" + HuaweiConstants.HU_BAND2_NAME + "|" + HuaweiConstants.HU_BAND2PRO_NAME + ").*", Pattern.CASE_INSENSITIVE);
}
@Override
public int getDeviceNameResource() {
return R.string.devicetype_huawei_band2pro;
}
}

View File

@ -179,6 +179,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.huaweiband2pro.HuaweiBand2ProCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.huaweiband3pro.HuaweiBand3ProCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.huaweiband4pro.HuaweiBand4ProCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.huaweiband6.HuaweiBand6Coordinator;
@ -522,6 +523,7 @@ public enum DeviceType {
HUAWEIBANDAW70(HuaweiBandAw70Coordinator.class),
HUAWEIBAND6(HuaweiBand6Coordinator.class),
HUAWEIWATCHGT(HuaweiWatchGTCoordinator.class),
HUAWEIBAND2PRO(HuaweiBand2ProCoordinator.class),
HUAWEIBAND3PRO(HuaweiBand3ProCoordinator.class),
HUAWEIBAND4PRO(HuaweiBand4ProCoordinator.class),
HUAWEIWATCHGT2(HuaweiWatchGT2Coordinator.class),

View File

@ -1863,6 +1863,7 @@
<string name="devicetype_huawei_band8">Huawei Band 8</string>
<string name="devicetype_huawei_band9">Huawei Band 9</string>
<string name="devicetype_huawei_watch_gt">Huawei Watch GT</string>
<string name="devicetype_huawei_band2pro">Huawei Band 2 (Pro)</string>
<string name="devicetype_huawei_band3pro">Huawei Band 3 (Pro)</string>
<string name="devicetype_huawei_band4pro">Huawei Band 4 (Pro)</string>
<string name="devicetype_huawei_watchgt2">Huawei Watch GT 2 (Pro)</string>