mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-26 02:25:50 +01:00
Add untested Mi Band 4 support (basically runs on Mi Band 3 code)
This is COMPLETELY untested, we do not have the device.
This commit is contained in:
parent
f959022cad
commit
d48d3cdea3
@ -48,6 +48,7 @@ public class HuamiConst {
|
|||||||
public static final String MI_BAND2_NAME_HRX = "Mi Band HRX";
|
public static final String MI_BAND2_NAME_HRX = "Mi Band HRX";
|
||||||
public static final String MI_BAND3_NAME = "Mi Band 3";
|
public static final String MI_BAND3_NAME = "Mi Band 3";
|
||||||
public static final String MI_BAND3_NAME_2 = "Xiaomi Band 3";
|
public static final String MI_BAND3_NAME_2 = "Xiaomi Band 3";
|
||||||
|
public static final String MI_BAND4_NAME = "Mi Smart Band 4";
|
||||||
|
|
||||||
public static final String PREF_ACTIVATE_DISPLAY_ON_LIFT = "activate_display_on_lift_wrist";
|
public static final String PREF_ACTIVATE_DISPLAY_ON_LIFT = "activate_display_on_lift_wrist";
|
||||||
public static final String PREF_DISPLAY_ON_LIFT_START = "display_on_lift_start";
|
public static final String PREF_DISPLAY_ON_LIFT_START = "display_on_lift_start";
|
||||||
|
@ -0,0 +1,91 @@
|
|||||||
|
/* Copyright (C) 2016-2019 Andreas Shimokawa
|
||||||
|
|
||||||
|
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 <http://www.gnu.org/licenses/>. */
|
||||||
|
package nodomain.freeyourgadget.gadgetbridge.devices.huami.miband4;
|
||||||
|
|
||||||
|
import android.bluetooth.BluetoothDevice;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.net.Uri;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
||||||
|
|
||||||
|
public class MiBand4Coordinator extends HuamiCoordinator {
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(MiBand4Coordinator.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeviceType getDeviceType() {
|
||||||
|
return DeviceType.MIBAND4;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public DeviceType getSupportedType(GBDeviceCandidate candidate) {
|
||||||
|
try {
|
||||||
|
BluetoothDevice device = candidate.getDevice();
|
||||||
|
String name = device.getName();
|
||||||
|
if (name != null && name.equalsIgnoreCase(HuamiConst.MI_BAND4_NAME)) {
|
||||||
|
return DeviceType.MIBAND4;
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
LOG.error("unable to check device support", ex);
|
||||||
|
}
|
||||||
|
return DeviceType.UNKNOWN;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public InstallHandler findInstallHandler(Uri uri, Context context) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supportsHeartRateMeasurement(GBDevice device) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supportsWeather() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supportsActivityTracks() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
|
||||||
|
return new int[]{
|
||||||
|
R.xml.devicesettings_miband3,
|
||||||
|
R.xml.devicesettings_nightmode,
|
||||||
|
R.xml.devicesettings_donotdisturb_withauto,
|
||||||
|
R.xml.devicesettings_liftwrist_display,
|
||||||
|
R.xml.devicesettings_swipeunlock,
|
||||||
|
R.xml.devicesettings_pairingkey
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -38,6 +38,7 @@ public enum DeviceType {
|
|||||||
AMAZFITCOR(13, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_amazfit_cor),
|
AMAZFITCOR(13, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_amazfit_cor),
|
||||||
MIBAND3(14, R.drawable.ic_device_miband2, R.drawable.ic_device_miband2_disabled, R.string.devicetype_miband3),
|
MIBAND3(14, R.drawable.ic_device_miband2, R.drawable.ic_device_miband2_disabled, R.string.devicetype_miband3),
|
||||||
AMAZFITCOR2(15, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_amazfit_cor2),
|
AMAZFITCOR2(15, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_amazfit_cor2),
|
||||||
|
MIBAND4(15, R.drawable.ic_device_miband2, R.drawable.ic_device_miband2_disabled, R.string.devicetype_miband4),
|
||||||
VIBRATISSIMO(20, R.drawable.ic_device_lovetoy, R.drawable.ic_device_lovetoy_disabled, R.string.devicetype_vibratissimo),
|
VIBRATISSIMO(20, R.drawable.ic_device_lovetoy, R.drawable.ic_device_lovetoy_disabled, R.string.devicetype_vibratissimo),
|
||||||
LIVEVIEW(30, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_liveview),
|
LIVEVIEW(30, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_liveview),
|
||||||
HPLUS(40, R.drawable.ic_device_hplus, R.drawable.ic_device_hplus_disabled, R.string.devicetype_hplus),
|
HPLUS(40, R.drawable.ic_device_hplus, R.drawable.ic_device_hplus_disabled, R.string.devicetype_hplus),
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
/* Copyright (C) 2017-2019 Andreas Shimokawa
|
||||||
|
|
||||||
|
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 <http://www.gnu.org/licenses/>. */
|
||||||
|
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband4;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.net.Uri;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband3.MiBand3Support;
|
||||||
|
|
||||||
|
public class MiBand4Support extends MiBand3Support {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HuamiFWHelper createFWHelper(Uri uri, Context context) throws IOException {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -52,6 +52,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitcor2.AmazfitCor
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband2.MiBand2Coordinator;
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband2.MiBand2Coordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband2.MiBand2HRXCoordinator;
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband2.MiBand2HRXCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband3.MiBand3Coordinator;
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband3.MiBand3Coordinator;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband4.MiBand4Coordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.id115.ID115Coordinator;
|
import nodomain.freeyourgadget.gadgetbridge.devices.id115.ID115Coordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.jyou.BFH16DeviceCoordinator;
|
import nodomain.freeyourgadget.gadgetbridge.devices.jyou.BFH16DeviceCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.jyou.TeclastH30Coordinator;
|
import nodomain.freeyourgadget.gadgetbridge.devices.jyou.TeclastH30Coordinator;
|
||||||
@ -204,6 +205,7 @@ public class DeviceHelper {
|
|||||||
result.add(new AmazfitCorCoordinator()); // Note: must come before MiBand2 because detection is hacky, atm
|
result.add(new AmazfitCorCoordinator()); // Note: must come before MiBand2 because detection is hacky, atm
|
||||||
result.add(new AmazfitCor2Coordinator()); // Note: must come before MiBand2 because detection is hacky, atm
|
result.add(new AmazfitCor2Coordinator()); // Note: must come before MiBand2 because detection is hacky, atm
|
||||||
result.add(new MiBand3Coordinator()); // Note: must come before MiBand2 because detection is hacky, atm
|
result.add(new MiBand3Coordinator()); // Note: must come before MiBand2 because detection is hacky, atm
|
||||||
|
result.add(new MiBand4Coordinator()); // Note: must come before MiBand2 because detection is hacky, atm
|
||||||
result.add(new MiBand2HRXCoordinator()); // Note: must come before MiBand2 because detection is hacky, atm
|
result.add(new MiBand2HRXCoordinator()); // Note: must come before MiBand2 because detection is hacky, atm
|
||||||
result.add(new MiBand2Coordinator()); // Note: MiBand2 must come before MiBand because detection is hacky, atm
|
result.add(new MiBand2Coordinator()); // Note: MiBand2 must come before MiBand because detection is hacky, atm
|
||||||
result.add(new MiBandCoordinator());
|
result.add(new MiBandCoordinator());
|
||||||
|
@ -620,6 +620,7 @@
|
|||||||
<string name="devicetype_miband">Mi Band</string>
|
<string name="devicetype_miband">Mi Band</string>
|
||||||
<string name="devicetype_miband2">Mi Band 2</string>
|
<string name="devicetype_miband2">Mi Band 2</string>
|
||||||
<string name="devicetype_miband3">Mi Band 3</string>
|
<string name="devicetype_miband3">Mi Band 3</string>
|
||||||
|
<string name="devicetype_miband4">Mi Band 4</string>
|
||||||
<string name="devicetype_amazfit_bip">Amazfit Bip</string>
|
<string name="devicetype_amazfit_bip">Amazfit Bip</string>
|
||||||
<string name="devicetype_amazfit_cor">Amazfit Cor</string>
|
<string name="devicetype_amazfit_cor">Amazfit Cor</string>
|
||||||
<string name="devicetype_amazfit_cor2">Amazfit Cor 2</string>
|
<string name="devicetype_amazfit_cor2">Amazfit Cor 2</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user