mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-01-26 01:27:33 +01:00
parent
cac7b27aeb
commit
090e0c7b33
@ -13,7 +13,6 @@ import org.slf4j.Logger;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband5.MiBand5Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
||||
@ -42,8 +41,8 @@ public class MiBand6Coordinator extends HuamiCoordinator {
|
||||
|
||||
@Override
|
||||
public InstallHandler findInstallHandler(Uri uri, Context context) {
|
||||
// TODO!
|
||||
return null;
|
||||
MiBand6FWInstallHandler handler = new MiBand6FWInstallHandler(uri, context);
|
||||
return handler.isValid() ? handler : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,7 +22,7 @@ import android.net.Uri;
|
||||
import java.io.IOException;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband5.MiBand5FirmwareInfo;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband6.MiBand6FirmwareInfo;
|
||||
|
||||
public class MiBand6FWHelper extends HuamiFWHelper {
|
||||
|
||||
@ -32,6 +32,9 @@ public class MiBand6FWHelper extends HuamiFWHelper {
|
||||
|
||||
@Override
|
||||
protected void determineFirmwareInfo(byte[] wholeFirmwareBytes) {
|
||||
throw new IllegalArgumentException("Not implemented.");
|
||||
firmwareInfo = new MiBand6FirmwareInfo(wholeFirmwareBytes);
|
||||
if (!firmwareInfo.isHeaderValid()) {
|
||||
throw new IllegalArgumentException("Not a Mi Band 6 firmware");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,8 +21,10 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.HuamiFirmwareInfo;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.HuamiFirmwareType;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.ArrayUtils;
|
||||
|
||||
public class MiBand6FirmwareInfo extends HuamiFirmwareInfo {
|
||||
|
||||
@ -34,14 +36,17 @@ public class MiBand6FirmwareInfo extends HuamiFirmwareInfo {
|
||||
|
||||
@Override
|
||||
protected HuamiFirmwareType determineFirmwareType(byte[] bytes) {
|
||||
if (ArrayUtils.startsWith(bytes, UIHH_HEADER) && (bytes[4] == 1 || bytes[4] == 2)) {
|
||||
return HuamiFirmwareType.WATCHFACE;
|
||||
}
|
||||
return HuamiFirmwareType.INVALID;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isGenerallyCompatibleWith(GBDevice device) {
|
||||
// return isHeaderValid() && device.getType() == DeviceType.MIBAND5;
|
||||
return false;
|
||||
return isHeaderValid() && device.getType() == DeviceType.MIBAND6;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,14 +26,21 @@ import java.io.IOException;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband5.MiBand5FWHelper;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband6.MiBand6FWHelper;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband5.MiBand5Support;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.operations.UpdateFirmwareOperation;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.operations.UpdateFirmwareOperation2020;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.operations.UpdateFirmwareOperationNew;
|
||||
|
||||
public class MiBand6Support extends MiBand5Support {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MiBand6Support.class);
|
||||
|
||||
@Override
|
||||
public UpdateFirmwareOperation createUpdateFirmwareOperation(Uri uri) {
|
||||
return new UpdateFirmwareOperation2020(uri, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MiBand6Support setDisplayItems(TransactionBuilder builder) {
|
||||
setDisplayItemsNew(builder, false, true, R.array.pref_miband6_display_items_default);
|
||||
|
Loading…
x
Reference in New Issue
Block a user