From 1dc516442345221c15062d3c479ec83ec578db25 Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Sun, 31 Jan 2021 22:55:22 +0100 Subject: [PATCH] Zepp E: Address problems mentioned in #2180 Also move the package to huami --- .../gadgetbridge/devices/huami/zeppe/ZeppEFWHelper.java | 4 ++-- .../gadgetbridge/service/DeviceSupportFactory.java | 2 +- .../service/devices/{ => huami}/zeppe/ZeppEFirmwareInfo.java | 4 ++-- .../service/devices/{ => huami}/zeppe/ZeppESupport.java | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) rename app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/{ => huami}/zeppe/ZeppEFirmwareInfo.java (96%) rename app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/{ => huami}/zeppe/ZeppESupport.java (96%) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/zeppe/ZeppEFWHelper.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/zeppe/ZeppEFWHelper.java index f1eacdfc8..ca7e7195e 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/zeppe/ZeppEFWHelper.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/zeppe/ZeppEFWHelper.java @@ -23,7 +23,7 @@ import android.net.Uri; import java.io.IOException; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper; -import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgtr.AmazfitGTRFirmwareInfo; +import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppe.ZeppEFirmwareInfo; public class ZeppEFWHelper extends HuamiFWHelper { @@ -33,7 +33,7 @@ public class ZeppEFWHelper extends HuamiFWHelper { @Override protected void determineFirmwareInfo(byte[] wholeFirmwareBytes) { - firmwareInfo = new AmazfitGTRFirmwareInfo(wholeFirmwareBytes); + firmwareInfo = new ZeppEFirmwareInfo(wholeFirmwareBytes); if (!firmwareInfo.isHeaderValid()) { throw new IllegalArgumentException("Not a Zepp E firmware"); } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceSupportFactory.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceSupportFactory.java index 3e6a4f77e..7fd4104a4 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceSupportFactory.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceSupportFactory.java @@ -82,7 +82,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.tlw64.TLW64Support; import nodomain.freeyourgadget.gadgetbridge.service.devices.vibratissimo.VibratissimoSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.watch9.Watch9DeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.xwatch.XWatchSupport; -import nodomain.freeyourgadget.gadgetbridge.service.devices.zeppe.ZeppESupport; +import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppe.ZeppESupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.zetime.ZeTimeDeviceSupport; import nodomain.freeyourgadget.gadgetbridge.util.GB; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/zeppe/ZeppEFirmwareInfo.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/zeppe/ZeppEFirmwareInfo.java similarity index 96% rename from app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/zeppe/ZeppEFirmwareInfo.java rename to app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/zeppe/ZeppEFirmwareInfo.java index bc9c52fcf..e8720f0b1 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/zeppe/ZeppEFirmwareInfo.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/zeppe/ZeppEFirmwareInfo.java @@ -15,7 +15,7 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ -package nodomain.freeyourgadget.gadgetbridge.service.devices.zeppe; +package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppe; import java.util.HashMap; import java.util.Map; @@ -73,7 +73,7 @@ public class ZeppEFirmwareInfo extends HuamiFirmwareInfo { return HuamiFirmwareType.RES_COMPRESSED; } if (ArrayUtils.equals(bytes, FW_HEADER, FW_OFFSET)) { - if (searchString32BitAligned(bytes, "Amazfit GTR 2")) { + if (searchString32BitAligned(bytes, "Zepp E")) { return HuamiFirmwareType.FIRMWARE; } return HuamiFirmwareType.INVALID; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/zeppe/ZeppESupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/zeppe/ZeppESupport.java similarity index 96% rename from app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/zeppe/ZeppESupport.java rename to app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/zeppe/ZeppESupport.java index 5022e64f6..aef430683 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/zeppe/ZeppESupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/zeppe/ZeppESupport.java @@ -15,7 +15,7 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ -package nodomain.freeyourgadget.gadgetbridge.service.devices.zeppe; +package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppe; import android.content.Context; import android.net.Uri;