mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-01 06:22:55 +01:00
Add Honor Magic Watch 2
This commit is contained in:
parent
5999eb01d0
commit
0e5545191d
@ -48,6 +48,7 @@ public final class HuaweiConstants {
|
||||
public static final String HO_BAND5_NAME = "honor band 5-";
|
||||
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 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-";
|
||||
|
@ -0,0 +1,82 @@
|
||||
/* 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 <https://www.gnu.org/licenses/>. */
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.huawei.honormagicwatch2;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.TimeSampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiBRCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiConstants;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiSpo2SampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.Spo2Sample;
|
||||
|
||||
public class HonorMagicWatch2Coordinator extends HuaweiBRCoordinator {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(HonorMagicWatch2Coordinator.class);
|
||||
|
||||
public HonorMagicWatch2Coordinator() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getManufacturer() {
|
||||
return "Honor";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceType getDeviceType() {
|
||||
return DeviceType.HONORMAGICWATCH2;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Pattern getSupportedDeviceName() {
|
||||
return Pattern.compile(HuaweiConstants.HO_MAGICWATCH2_NAME + ".*", Pattern.CASE_INSENSITIVE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBondingStyle(){
|
||||
return BONDING_STYLE_ASK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsSpo2() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimeSampleProvider<? extends Spo2Sample> getSpo2SampleProvider(GBDevice device, DaoSession session) {
|
||||
return new HuaweiSpo2SampleProvider(device, session);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
|
||||
return getHuaweiCoordinator().genericHuaweiSupportedDeviceSpecificSettings(new int[]{
|
||||
R.xml.devicesettings_spo_automatic_enable,
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDeviceNameResource() {
|
||||
return R.string.devicetype_honor_magicwatch2;
|
||||
}
|
||||
}
|
@ -110,6 +110,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.huawei.honorband4.HonorBand4
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.honorband5.HonorBand5Coordinator;
|
||||
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.huaweiband4pro.HuaweiBand4ProCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.huaweiband6.HuaweiBand6Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.huaweiband7.HuaweiBand7Coordinator;
|
||||
@ -344,6 +345,7 @@ public enum DeviceType {
|
||||
HUAWEIBAND7(HuaweiBand7Coordinator.class),
|
||||
HONORBAND6(HonorBand6Coordinator.class),
|
||||
HONORBAND7(HonorBand7Coordinator.class),
|
||||
HONORMAGICWATCH2(HonorMagicWatch2Coordinator.class),
|
||||
HUAWEIWATCHGT3(HuaweiWatchGT3Coordinator.class),
|
||||
HUAWEIBAND8(HuaweiBand8Coordinator.class),
|
||||
VESC(VescCoordinator.class),
|
||||
|
@ -1524,6 +1524,7 @@
|
||||
<string name="devicetype_honor_band5">Honor Band 5</string>
|
||||
<string name="devicetype_honor_band6">Honor Band 6</string>
|
||||
<string name="devicetype_honor_band7">Honor Band 7</string>
|
||||
<string name="devicetype_honor_magicwatch2">Honor MagicWatch 2</string>
|
||||
<string name="devicetype_huawei_band_aw70">Huawei Band (AW70)</string>
|
||||
<string name="devicetype_huawei_band6">Huawei Band 6</string>
|
||||
<string name="devicetype_huawei_band7">Huawei Band 7</string>
|
||||
|
Loading…
Reference in New Issue
Block a user