mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-02-23 16:01:13 +01:00
Try to blindly add support for Amazfit Cor
This commit is contained in:
parent
7e5301e963
commit
0f46ea2a59
@ -0,0 +1,59 @@
|
|||||||
|
/* Copyright (C) 2017 Andreas Shimokawa, João Paulo Barraca
|
||||||
|
|
||||||
|
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.amazfitcor;
|
||||||
|
|
||||||
|
import android.bluetooth.BluetoothDevice;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband2.MiBand2Coordinator;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
||||||
|
|
||||||
|
public class AmazfitCorCoordinator extends MiBand2Coordinator {
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(AmazfitCorCoordinator.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeviceType getDeviceType() {
|
||||||
|
return DeviceType.AMAZFITCOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public DeviceType getSupportedType(GBDeviceCandidate candidate) {
|
||||||
|
try {
|
||||||
|
BluetoothDevice device = candidate.getDevice();
|
||||||
|
String name = device.getName();
|
||||||
|
if (name != null && name.equalsIgnoreCase("Amazfit Band")) {
|
||||||
|
return DeviceType.AMAZFITCOR;
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
LOG.error("unable to check device support", ex);
|
||||||
|
}
|
||||||
|
return DeviceType.UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public InstallHandler findInstallHandler(Uri uri, Context context) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -33,6 +33,7 @@ public enum DeviceType {
|
|||||||
MIBAND(10, R.drawable.ic_device_miband, R.drawable.ic_device_miband_disabled),
|
MIBAND(10, R.drawable.ic_device_miband, R.drawable.ic_device_miband_disabled),
|
||||||
MIBAND2(11, R.drawable.ic_device_miband, R.drawable.ic_device_miband_disabled),
|
MIBAND2(11, R.drawable.ic_device_miband, R.drawable.ic_device_miband_disabled),
|
||||||
AMAZFITBIP(12, R.drawable.ic_device_hplus, R.drawable.ic_device_hplus_disabled),
|
AMAZFITBIP(12, R.drawable.ic_device_hplus, R.drawable.ic_device_hplus_disabled),
|
||||||
|
AMAZFITCOR(13, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled),
|
||||||
VIBRATISSIMO(20, R.drawable.ic_device_lovetoy, R.drawable.ic_device_lovetoy_disabled),
|
VIBRATISSIMO(20, R.drawable.ic_device_lovetoy, R.drawable.ic_device_lovetoy_disabled),
|
||||||
LIVEVIEW(30, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled),
|
LIVEVIEW(30, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled),
|
||||||
HPLUS(40, R.drawable.ic_device_hplus, R.drawable.ic_device_hplus_disabled),
|
HPLUS(40, R.drawable.ic_device_hplus, R.drawable.ic_device_hplus_disabled),
|
||||||
|
@ -114,6 +114,7 @@ public class DeviceSupportFactory {
|
|||||||
deviceSupport = new ServiceDeviceSupport(new MiBand2Support(), EnumSet.of(ServiceDeviceSupport.Flags.THROTTLING, ServiceDeviceSupport.Flags.BUSY_CHECKING));
|
deviceSupport = new ServiceDeviceSupport(new MiBand2Support(), EnumSet.of(ServiceDeviceSupport.Flags.THROTTLING, ServiceDeviceSupport.Flags.BUSY_CHECKING));
|
||||||
break;
|
break;
|
||||||
case AMAZFITBIP:
|
case AMAZFITBIP:
|
||||||
|
case AMAZFITCOR:
|
||||||
deviceSupport = new ServiceDeviceSupport(new AmazfitBipSupport(), EnumSet.of(ServiceDeviceSupport.Flags.BUSY_CHECKING));
|
deviceSupport = new ServiceDeviceSupport(new AmazfitBipSupport(), EnumSet.of(ServiceDeviceSupport.Flags.BUSY_CHECKING));
|
||||||
break;
|
break;
|
||||||
case VIBRATISSIMO:
|
case VIBRATISSIMO:
|
||||||
|
@ -43,6 +43,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbip.AmazfitBipC
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.devices.hplus.EXRIZUK8Coordinator;
|
import nodomain.freeyourgadget.gadgetbridge.devices.hplus.EXRIZUK8Coordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.hplus.HPlusCoordinator;
|
import nodomain.freeyourgadget.gadgetbridge.devices.hplus.HPlusCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.hplus.MakibesF68Coordinator;
|
import nodomain.freeyourgadget.gadgetbridge.devices.hplus.MakibesF68Coordinator;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitcor.AmazfitCorCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband2.MiBand2HRXCoordinator;
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband2.MiBand2HRXCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.jyou.TeclastH30Coordinator;
|
import nodomain.freeyourgadget.gadgetbridge.devices.jyou.TeclastH30Coordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.liveview.LiveviewCoordinator;
|
import nodomain.freeyourgadget.gadgetbridge.devices.liveview.LiveviewCoordinator;
|
||||||
@ -190,6 +191,7 @@ public class DeviceHelper {
|
|||||||
private List<DeviceCoordinator> createCoordinators() {
|
private List<DeviceCoordinator> createCoordinators() {
|
||||||
List<DeviceCoordinator> result = new ArrayList<>();
|
List<DeviceCoordinator> result = new ArrayList<>();
|
||||||
result.add(new AmazfitBipCoordinator()); // Note: must come before MiBand2 because detection is hacky, atm
|
result.add(new AmazfitBipCoordinator()); // 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 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());
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
<item android:maxLevel="110" android:drawable="@drawable/ic_device_miband_disabled" />
|
<item android:maxLevel="110" android:drawable="@drawable/ic_device_miband_disabled" />
|
||||||
<item android:maxLevel="111" android:drawable="@drawable/ic_device_miband_disabled" />
|
<item android:maxLevel="111" android:drawable="@drawable/ic_device_miband_disabled" />
|
||||||
<item android:maxLevel="112" android:drawable="@drawable/ic_device_hplus_disabled" />
|
<item android:maxLevel="112" android:drawable="@drawable/ic_device_hplus_disabled" />
|
||||||
|
<item android:maxLevel="113" android:drawable="@drawable/ic_device_default_disabled" />
|
||||||
<item android:maxLevel="120" android:drawable="@drawable/ic_device_lovetoy_disabled" />
|
<item android:maxLevel="120" android:drawable="@drawable/ic_device_lovetoy_disabled" />
|
||||||
<item android:maxLevel="130" android:drawable="@drawable/ic_device_default_disabled" />
|
<item android:maxLevel="130" android:drawable="@drawable/ic_device_default_disabled" />
|
||||||
<item android:maxLevel="140" android:drawable="@drawable/ic_device_hplus_disabled" />
|
<item android:maxLevel="140" android:drawable="@drawable/ic_device_hplus_disabled" />
|
||||||
@ -17,6 +18,7 @@
|
|||||||
<item android:maxLevel="210" android:drawable="@drawable/ic_device_miband" />
|
<item android:maxLevel="210" android:drawable="@drawable/ic_device_miband" />
|
||||||
<item android:maxLevel="211" android:drawable="@drawable/ic_device_miband" />
|
<item android:maxLevel="211" android:drawable="@drawable/ic_device_miband" />
|
||||||
<item android:maxLevel="212" android:drawable="@drawable/ic_device_hplus" />
|
<item android:maxLevel="212" android:drawable="@drawable/ic_device_hplus" />
|
||||||
|
<item android:maxLevel="213" android:drawable="@drawable/ic_device_default" />
|
||||||
<item android:maxLevel="220" android:drawable="@drawable/ic_device_lovetoy" />
|
<item android:maxLevel="220" android:drawable="@drawable/ic_device_lovetoy" />
|
||||||
<item android:maxLevel="230" android:drawable="@drawable/ic_launcher" />
|
<item android:maxLevel="230" android:drawable="@drawable/ic_launcher" />
|
||||||
<item android:maxLevel="240" android:drawable="@drawable/ic_device_hplus" />
|
<item android:maxLevel="240" android:drawable="@drawable/ic_device_hplus" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user