1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-24 10:56:50 +01:00

Amazfit GTR/GTS: Fix flashing watchfaces and _maybe_ firmware/res update (still untested)

This commit is contained in:
Andreas Shimokawa 2020-04-14 10:40:24 +02:00
parent 973e2bd34e
commit 12d5f1d88b
5 changed files with 15 additions and 5 deletions

View File

@ -22,7 +22,6 @@ import android.net.Uri;
import java.io.IOException; import java.io.IOException;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr.AmazfitGTRFWHelper;
import nodomain.freeyourgadget.gadgetbridge.devices.miband.AbstractMiBandFWHelper; import nodomain.freeyourgadget.gadgetbridge.devices.miband.AbstractMiBandFWHelper;
import nodomain.freeyourgadget.gadgetbridge.devices.miband.AbstractMiBandFWInstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.miband.AbstractMiBandFWInstallHandler;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
@ -40,7 +39,7 @@ class AmazfitGTSFWInstallHandler extends AbstractMiBandFWInstallHandler {
@Override @Override
protected AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException { protected AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException {
return new AmazfitGTRFWHelper(uri, context); return new AmazfitGTSFWHelper(uri, context);
} }
@Override @Override

View File

@ -77,7 +77,7 @@ public class AmazfitGTRFirmwareInfo extends HuamiFirmwareInfo {
} }
return HuamiFirmwareType.INVALID; return HuamiFirmwareType.INVALID;
} }
if (ArrayUtils.startsWith(bytes, WATCHFACE_HEADER)) { if (ArrayUtils.startsWith(bytes, WATCHFACE_HEADER) || ArrayUtils.equals(bytes, WATCHFACE_HEADER, COMPRESSED_RES_HEADER_OFFSET_NEW) || ArrayUtils.equals(bytes, WATCHFACE_HEADER, COMPRESSED_RES_HEADER_OFFSET)) {
return HuamiFirmwareType.WATCHFACE; return HuamiFirmwareType.WATCHFACE;
} }
if (ArrayUtils.startsWith(bytes, NEWFT_HEADER)) { if (ArrayUtils.startsWith(bytes, NEWFT_HEADER)) {

View File

@ -26,6 +26,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr.AmazfitGTRF
import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec;
import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder; import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip.AmazfitBipSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip.AmazfitBipSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.operations.UpdateFirmwareOperationNew;
public class AmazfitGTRSupport extends AmazfitBipSupport { public class AmazfitGTRSupport extends AmazfitBipSupport {
@ -49,6 +50,11 @@ public class AmazfitGTRSupport extends AmazfitBipSupport {
return new AmazfitGTRFWHelper(uri, context); return new AmazfitGTRFWHelper(uri, context);
} }
@Override
public UpdateFirmwareOperationNew createUpdateFirmwareOperation(Uri uri) {
return new UpdateFirmwareOperationNew(uri, this);
}
@Override @Override
protected AmazfitGTRSupport setDisplayItems(TransactionBuilder builder) { protected AmazfitGTRSupport setDisplayItems(TransactionBuilder builder) {
// not supported yet // not supported yet

View File

@ -77,7 +77,7 @@ public class AmazfitGTSFirmwareInfo extends HuamiFirmwareInfo {
} }
return HuamiFirmwareType.INVALID; return HuamiFirmwareType.INVALID;
} }
if (ArrayUtils.startsWith(bytes, WATCHFACE_HEADER)) { if (ArrayUtils.startsWith(bytes, WATCHFACE_HEADER) || ArrayUtils.equals(bytes, WATCHFACE_HEADER, COMPRESSED_RES_HEADER_OFFSET_NEW) || ArrayUtils.equals(bytes, WATCHFACE_HEADER, COMPRESSED_RES_HEADER_OFFSET)) {
return HuamiFirmwareType.WATCHFACE; return HuamiFirmwareType.WATCHFACE;
} }
if (ArrayUtils.startsWith(bytes, NEWFT_HEADER)) { if (ArrayUtils.startsWith(bytes, NEWFT_HEADER)) {

View File

@ -22,11 +22,11 @@ import android.net.Uri;
import java.io.IOException; import java.io.IOException;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr.AmazfitGTRFWHelper;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgts.AmazfitGTSFWHelper; import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgts.AmazfitGTSFWHelper;
import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec;
import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder; import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip.AmazfitBipSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip.AmazfitBipSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.operations.UpdateFirmwareOperationNew;
public class AmazfitGTSSupport extends AmazfitBipSupport { public class AmazfitGTSSupport extends AmazfitBipSupport {
@ -51,6 +51,11 @@ public class AmazfitGTSSupport extends AmazfitBipSupport {
return new AmazfitGTSFWHelper(uri, context); return new AmazfitGTSFWHelper(uri, context);
} }
@Override
public UpdateFirmwareOperationNew createUpdateFirmwareOperation(Uri uri) {
return new UpdateFirmwareOperationNew(uri, this);
}
@Override @Override
protected AmazfitGTSSupport setDisplayItems(TransactionBuilder builder) { protected AmazfitGTSSupport setDisplayItems(TransactionBuilder builder) {
// not supported yet // not supported yet