mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-09-01 03:55:47 +02:00
[Huawei] Add Huawei Watch GT Runner gadget
* created new gadget classes * make tag 0x01 in TimeRequest response optional. There is no such tag on GT Runner, at least on HarmonyOS 2 firmware.
This commit is contained in:
parent
75962612bc
commit
bf6d0d0f83
@ -65,6 +65,7 @@ public final class HuaweiConstants {
|
||||
public static final String HU_BAND9_NAME = "huawei band 9-";
|
||||
public static final String HU_WATCHGT3_NAME = "huawei watch gt 3-";
|
||||
public static final String HU_WATCHGT3PRO_NAME = "huawei watch gt 3 pro-";
|
||||
public static final String HU_WATCHGTRUNNER_NAME = "huawei watch gt runner-";
|
||||
public static final String HU_WATCH3_NAME = "huawei watch 3-";
|
||||
public static final String HU_WATCH3PRO_NAME = "huawei watch 3 pro-";
|
||||
public static final String HU_WATCHGT4_NAME = "huawei watch gt 4-";
|
||||
|
@ -0,0 +1,41 @@
|
||||
/* Copyright (C) 2024 Vitalii 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 <https://www.gnu.org/licenses/>. */
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.huawei.huaweiwatchgtrunner;
|
||||
|
||||
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 HuaweiWatchGTRunnerCoordinator extends HuaweiBRCoordinator {
|
||||
@Override
|
||||
public DeviceType getDeviceType() {
|
||||
return DeviceType.HUAWEIWATCHGTRUNNER;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Pattern getSupportedDeviceName() {
|
||||
return Pattern.compile("(" + HuaweiConstants.HU_WATCHGTRUNNER_NAME + ").*", Pattern.CASE_INSENSITIVE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDeviceNameResource() {
|
||||
return R.string.devicetype_huawei_watchgtrunner;
|
||||
}
|
||||
}
|
@ -401,7 +401,7 @@ public class DeviceConfig {
|
||||
}
|
||||
|
||||
public static class Response extends HuaweiPacket {
|
||||
public int deviceTime;
|
||||
public int deviceTime=0;
|
||||
|
||||
public Response(ParamsProvider paramsProvider) {
|
||||
super(paramsProvider);
|
||||
@ -409,7 +409,9 @@ public class DeviceConfig {
|
||||
|
||||
@Override
|
||||
public void parseTlv() throws ParseException {
|
||||
this.deviceTime = this.tlv.getInteger(0x01);
|
||||
if (this.tlv.contains(0x01)) {
|
||||
this.deviceTime = this.tlv.getInteger(0x01);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -167,6 +167,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.huawei.huaweiwatchgt2.Huawei
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.huaweiwatchgt2e.HuaweiWatchGT2eCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.huaweiwatchgt3.HuaweiWatchGT3Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.huaweiwatchgt4.HuaweiWatchGT4Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.huaweiwatchgtrunner.HuaweiWatchGTRunnerCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.huaweiwatchultimate.HuaweiWatchUltimateCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.id115.ID115Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.itag.ITagCoordinator;
|
||||
@ -449,6 +450,7 @@ public enum DeviceType {
|
||||
HONORMAGICWATCH2(HonorMagicWatch2Coordinator.class),
|
||||
HUAWEIWATCHGT3(HuaweiWatchGT3Coordinator.class),
|
||||
HUAWEIWATCHGT4(HuaweiWatchGT4Coordinator.class),
|
||||
HUAWEIWATCHGTRUNNER(HuaweiWatchGTRunnerCoordinator.class),
|
||||
HUAWEIBAND8(HuaweiBand8Coordinator.class),
|
||||
HUAWEIBAND9(HuaweiBand9Coordinator.class),
|
||||
HUAWEIWATCHFIT(HuaweiWatchFitCoordinator.class),
|
||||
|
@ -1613,6 +1613,7 @@
|
||||
<string name="devicetype_huawei_talk_band_b6">Huawei Talk Band B6</string>
|
||||
<string name="devicetype_huawei_watchgt3">Huawei Watch GT 3 (Pro)</string>
|
||||
<string name="devicetype_huawei_watchgt4">Huawei Watch GT 4</string>
|
||||
<string name="devicetype_huawei_watchgtrunner">Huawei Watch GT Runner</string>
|
||||
<string name="devicetype_huawei_watchfit">Huawei Watch Fit</string>
|
||||
<string name="devicetype_huawei_watchfit2">Huawei Watch Fit 2</string>
|
||||
<string name="devicetype_huawei_watchfit3">Huawei Watch Fit 3</string>
|
||||
|
Loading…
Reference in New Issue
Block a user