mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-10 17:11:56 +01:00
Compare commits
7 Commits
4b38a67a58
...
2a377ba5ab
Author | SHA1 | Date | |
---|---|---|---|
|
2a377ba5ab | ||
|
3e08a754e0 | ||
|
90d4bebdf5 | ||
|
b647631c07 | ||
|
dbfb8e5c38 | ||
|
aa4a7912ef | ||
|
34fd18885a |
@ -2,17 +2,26 @@
|
|||||||
|
|
||||||
#### Next Version (WIP)
|
#### Next Version (WIP)
|
||||||
|
|
||||||
|
* Initial support for Honor Magic Watch 2
|
||||||
* Initial support for Mijia MHO-C303
|
* Initial support for Mijia MHO-C303
|
||||||
|
* Initial support for Nothing CMF Watch Pro
|
||||||
* Initial support for Sony WI-SP600N
|
* Initial support for Sony WI-SP600N
|
||||||
|
* Experimental support for Redmi Watch 2
|
||||||
* Experimental support for Xiaomi Smart Band 8 Pro
|
* Experimental support for Xiaomi Smart Band 8 Pro
|
||||||
* Experimental support for Xiaomi Watch S1 Pro
|
* Experimental support for Xiaomi Watch S1 Pro
|
||||||
* Experimental support for Xiaomi Watch S1
|
* Experimental support for Xiaomi Watch S1
|
||||||
* Experimental support for Xiaomi Watch S3
|
* Experimental support for Xiaomi Watch S3
|
||||||
* Redmi Smart Band Pro: Fix password digits
|
* Redmi Smart Band Pro: Fix password digits
|
||||||
|
* Pebble: Fix app configuration page
|
||||||
|
* PineTime: Fix weather forecast on InfiniTime's new simple weather
|
||||||
* Xiaomi: Fix sleep sometimes extending past the wakeup time
|
* Xiaomi: Fix sleep sometimes extending past the wakeup time
|
||||||
* Xiaomi: Request battery level and charging state periodically
|
* Xiaomi: Request battery level and charging state periodically
|
||||||
|
* Xiaomi: Fix sleep stage parsing for some devices
|
||||||
|
* Zepp OS: Improve device discovery
|
||||||
* Zepp OS: Fix weather not working on some devices
|
* Zepp OS: Fix weather not working on some devices
|
||||||
|
* Zepp OS: Prevent crash when installing large firmware updates
|
||||||
* Fix sport activity summary group order
|
* Fix sport activity summary group order
|
||||||
|
* Fix reconnection to devices failing occasionally
|
||||||
|
|
||||||
#### 0.78.0
|
#### 0.78.0
|
||||||
* Initial support for Honor Band 3,4,5,6
|
* Initial support for Honor Band 3,4,5,6
|
||||||
|
@ -25,7 +25,6 @@ import java.io.IOException;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.miband.AbstractMiBandFWHelper;
|
import nodomain.freeyourgadget.gadgetbridge.devices.miband.AbstractMiBandFWHelper;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.AbstractHuamiFirmwareInfo;
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.AbstractHuamiFirmwareInfo;
|
||||||
@ -46,42 +45,7 @@ public abstract class HuamiFWHelper extends AbstractMiBandFWHelper {
|
|||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String getFirmwareKind() {
|
public String getFirmwareKind() {
|
||||||
int resId = R.string.kind_invalid;
|
return GBApplication.getContext().getString(getFirmwareInfo().getFirmwareType().getNameResId());
|
||||||
switch (getFirmwareInfo().getFirmwareType()) {
|
|
||||||
case FONT:
|
|
||||||
case FONT_LATIN:
|
|
||||||
resId = R.string.kind_font;
|
|
||||||
break;
|
|
||||||
case GPS:
|
|
||||||
resId = R.string.kind_gps;
|
|
||||||
break;
|
|
||||||
case GPS_ALMANAC:
|
|
||||||
resId = R.string.kind_gps_almanac;
|
|
||||||
break;
|
|
||||||
case GPS_CEP:
|
|
||||||
resId = R.string.kind_gps_cep;
|
|
||||||
break;
|
|
||||||
case AGPS_UIHH:
|
|
||||||
resId = R.string.kind_agps_bundle;
|
|
||||||
break;
|
|
||||||
case RES:
|
|
||||||
case RES_COMPRESSED:
|
|
||||||
resId = R.string.kind_resources;
|
|
||||||
break;
|
|
||||||
case FIRMWARE:
|
|
||||||
case FIRMWARE_UIHH_2021_ZIP_WITH_CHANGELOG:
|
|
||||||
resId = R.string.kind_firmware;
|
|
||||||
break;
|
|
||||||
case WATCHFACE:
|
|
||||||
resId = R.string.kind_watchface;
|
|
||||||
break;
|
|
||||||
case APP:
|
|
||||||
resId = R.string.kind_app;
|
|
||||||
break;
|
|
||||||
case INVALID:
|
|
||||||
// fall through
|
|
||||||
}
|
|
||||||
return GBApplication.getContext().getString(resId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -16,25 +16,24 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitactive;
|
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitactive;
|
||||||
|
|
||||||
import android.content.Context;
|
import java.util.Arrays;
|
||||||
import android.net.Uri;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitactive.AmazfitActiveSupport;
|
|
||||||
|
|
||||||
public class AmazfitActiveCoordinator extends ZeppOsCoordinator {
|
public class AmazfitActiveCoordinator extends ZeppOsCoordinator {
|
||||||
@NonNull
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends DeviceSupport> getDeviceSupportClass() {
|
public String getDeviceBluetoothName() {
|
||||||
return AmazfitActiveSupport.class;
|
return HuamiConst.AMAZFIT_ACTIVE_NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<Integer> getDeviceSources() {
|
||||||
|
return new HashSet<>(Arrays.asList(8323328));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -42,17 +41,6 @@ public class AmazfitActiveCoordinator extends ZeppOsCoordinator {
|
|||||||
return R.string.devicetype_amazfit_active;
|
return R.string.devicetype_amazfit_active;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean supports(final GBDeviceCandidate candidate) {
|
|
||||||
final String name = candidate.getName();
|
|
||||||
return name.startsWith(HuamiConst.AMAZFIT_ACTIVE_NAME) && !name.contains("Edge");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AbstractZeppOsFwInstallHandler createFwInstallHandler(final Uri uri, final Context context) {
|
|
||||||
return new AmazfitActiveFWInstallHandler(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsContinuousFindDevice() {
|
public boolean supportsContinuousFindDevice() {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitactive;
|
|
||||||
|
|
||||||
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.amazfitactive.AmazfitActiveFirmwareInfo;
|
|
||||||
|
|
||||||
public class AmazfitActiveFWHelper extends HuamiFWHelper {
|
|
||||||
public AmazfitActiveFWHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getMaxExpectedFileSize() {
|
|
||||||
return 1024 * 1024 * 128; // 128.0MB
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void determineFirmwareInfo(final byte[] wholeFirmwareBytes) {
|
|
||||||
firmwareInfo = new AmazfitActiveFirmwareInfo(wholeFirmwareBytes);
|
|
||||||
if (!firmwareInfo.isHeaderValid()) {
|
|
||||||
throw new IllegalArgumentException("Not a Amazfit Active firmware");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitactive;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
|
|
||||||
class AmazfitActiveFWInstallHandler extends AbstractZeppOsFwInstallHandler {
|
|
||||||
AmazfitActiveFWInstallHandler(final Uri uri, final Context context) {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getFwUpgradeNotice() {
|
|
||||||
final String deviceName = mContext.getString(R.string.devicetype_amazfit_active);
|
|
||||||
return mContext.getString(R.string.fw_upgrade_notice_zepp_os, helper.getHumanFirmwareVersion(), deviceName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected HuamiFWHelper createHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
return new AmazfitActiveFWHelper(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isSupportedDeviceType(final GBDevice device) {
|
|
||||||
return device.getType() == DeviceType.AMAZFITACTIVE;
|
|
||||||
}
|
|
||||||
}
|
|
@ -16,20 +16,14 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitactiveedge;
|
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitactiveedge;
|
||||||
|
|
||||||
import android.content.Context;
|
import java.util.Arrays;
|
||||||
import android.net.Uri;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitactiveedge.AmazfitActiveEdgeSupport;
|
|
||||||
|
|
||||||
public class AmazfitActiveEdgeCoordinator extends ZeppOsCoordinator {
|
public class AmazfitActiveEdgeCoordinator extends ZeppOsCoordinator {
|
||||||
@Override
|
@Override
|
||||||
@ -37,10 +31,14 @@ public class AmazfitActiveEdgeCoordinator extends ZeppOsCoordinator {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends DeviceSupport> getDeviceSupportClass() {
|
public String getDeviceBluetoothName() {
|
||||||
return AmazfitActiveEdgeSupport.class;
|
return HuamiConst.AMAZFIT_ACTIVE_EDGE_NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<Integer> getDeviceSources() {
|
||||||
|
return new HashSet<>(Arrays.asList(8388864, 8388865));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -48,16 +46,6 @@ public class AmazfitActiveEdgeCoordinator extends ZeppOsCoordinator {
|
|||||||
return R.string.devicetype_amazfit_active_edge;
|
return R.string.devicetype_amazfit_active_edge;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Pattern getSupportedDeviceName() {
|
|
||||||
return Pattern.compile(HuamiConst.AMAZFIT_ACTIVE_EDGE_NAME + ".*");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AbstractZeppOsFwInstallHandler createFwInstallHandler(final Uri uri, final Context context) {
|
|
||||||
return new AmazfitActiveEdgeFWInstallHandler(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsContinuousFindDevice() {
|
public boolean supportsContinuousFindDevice() {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitactiveedge;
|
|
||||||
|
|
||||||
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.amazfitactiveedge.AmazfitActiveEdgeFirmwareInfo;
|
|
||||||
|
|
||||||
public class AmazfitActiveEdgeFWHelper extends HuamiFWHelper {
|
|
||||||
public AmazfitActiveEdgeFWHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getMaxExpectedFileSize() {
|
|
||||||
return 1024 * 1024 * 128; // 128.0MB
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void determineFirmwareInfo(final byte[] wholeFirmwareBytes) {
|
|
||||||
firmwareInfo = new AmazfitActiveEdgeFirmwareInfo(wholeFirmwareBytes);
|
|
||||||
if (!firmwareInfo.isHeaderValid()) {
|
|
||||||
throw new IllegalArgumentException("Not a Amazfit Active Edge firmware");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitactiveedge;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
|
|
||||||
class AmazfitActiveEdgeFWInstallHandler extends AbstractZeppOsFwInstallHandler {
|
|
||||||
AmazfitActiveEdgeFWInstallHandler(final Uri uri, final Context context) {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getFwUpgradeNotice() {
|
|
||||||
final String deviceName = mContext.getString(R.string.devicetype_amazfit_active_edge);
|
|
||||||
return mContext.getString(R.string.fw_upgrade_notice_zepp_os, helper.getHumanFirmwareVersion(), deviceName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected HuamiFWHelper createHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
return new AmazfitActiveEdgeFWHelper(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isSupportedDeviceType(final GBDevice device) {
|
|
||||||
return device.getType() == DeviceType.AMAZFITACTIVEEDGE;
|
|
||||||
}
|
|
||||||
}
|
|
@ -16,26 +16,24 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbalance;
|
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbalance;
|
||||||
|
|
||||||
import android.content.Context;
|
import java.util.Arrays;
|
||||||
import android.net.Uri;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbalance.AmazfitBalanceSupport;
|
|
||||||
|
|
||||||
public class AmazfitBalanceCoordinator extends ZeppOsCoordinator {
|
public class AmazfitBalanceCoordinator extends ZeppOsCoordinator {
|
||||||
@NonNull
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends DeviceSupport> getDeviceSupportClass() {
|
public String getDeviceBluetoothName() {
|
||||||
return AmazfitBalanceSupport.class;
|
return HuamiConst.AMAZFIT_BALANCE_NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<Integer> getDeviceSources() {
|
||||||
|
return new HashSet<>(Arrays.asList(8519936, 8519937, 8519939));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -43,16 +41,6 @@ public class AmazfitBalanceCoordinator extends ZeppOsCoordinator {
|
|||||||
return R.string.devicetype_amazfit_balance;
|
return R.string.devicetype_amazfit_balance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Pattern getSupportedDeviceName() {
|
|
||||||
return Pattern.compile(HuamiConst.AMAZFIT_BALANCE_NAME + ".*");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AbstractZeppOsFwInstallHandler createFwInstallHandler(final Uri uri, final Context context) {
|
|
||||||
return new AmazfitBalanceFWInstallHandler(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsContinuousFindDevice() {
|
public boolean supportsContinuousFindDevice() {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 Maxime Reyrolle
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbalance;
|
|
||||||
|
|
||||||
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.amazfitbalance.AmazfitBalanceFirmwareInfo;
|
|
||||||
|
|
||||||
public class AmazfitBalanceFWHelper extends HuamiFWHelper {
|
|
||||||
public AmazfitBalanceFWHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getMaxExpectedFileSize() {
|
|
||||||
return 1024 * 1024 * 128; // 128.0MB
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void determineFirmwareInfo(final byte[] wholeFirmwareBytes) {
|
|
||||||
firmwareInfo = new AmazfitBalanceFirmwareInfo(wholeFirmwareBytes);
|
|
||||||
if (!firmwareInfo.isHeaderValid()) {
|
|
||||||
throw new IllegalArgumentException("Not a Amazfit Balance firmware");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 Maxime Reyrolle
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbalance;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
|
|
||||||
class AmazfitBalanceFWInstallHandler extends AbstractZeppOsFwInstallHandler {
|
|
||||||
AmazfitBalanceFWInstallHandler(final Uri uri, final Context context) {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getFwUpgradeNotice() {
|
|
||||||
final String deviceName = mContext.getString(R.string.devicetype_amazfit_balance);
|
|
||||||
return mContext.getString(R.string.fw_upgrade_notice_zepp_os, helper.getHumanFirmwareVersion(), deviceName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected HuamiFWHelper createHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
return new AmazfitBalanceFWHelper(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isSupportedDeviceType(final GBDevice device) {
|
|
||||||
return device.getType() == DeviceType.AMAZFITBALANCE;
|
|
||||||
}
|
|
||||||
}
|
|
@ -16,40 +16,24 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitband7;
|
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitband7;
|
||||||
|
|
||||||
import android.content.Context;
|
import java.util.Arrays;
|
||||||
import android.net.Uri;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitband7.AmazfitBand7Support;
|
|
||||||
|
|
||||||
public class AmazfitBand7Coordinator extends ZeppOsCoordinator {
|
public class AmazfitBand7Coordinator extends ZeppOsCoordinator {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(AmazfitBand7Coordinator.class);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Pattern getSupportedDeviceName() {
|
public String getDeviceBluetoothName() {
|
||||||
return Pattern.compile(HuamiConst.AMAZFIT_BAND7_NAME + ".*", Pattern.CASE_INSENSITIVE);
|
return HuamiConst.AMAZFIT_BAND7_NAME;
|
||||||
}
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public Class<? extends DeviceSupport> getDeviceSupportClass() {
|
|
||||||
return AmazfitBand7Support.class;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AbstractZeppOsFwInstallHandler createFwInstallHandler(final Uri uri, final Context context) {
|
public Set<Integer> getDeviceSources() {
|
||||||
return new AmazfitBand7FWInstallHandler(uri, context);
|
return new HashSet<>(Arrays.asList(252, 253, 254));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -68,7 +52,6 @@ public class AmazfitBand7Coordinator extends ZeppOsCoordinator {
|
|||||||
return R.string.devicetype_amazfit_band7;
|
return R.string.devicetype_amazfit_band7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getDefaultIconResource() {
|
public int getDefaultIconResource() {
|
||||||
return R.drawable.ic_device_default;
|
return R.drawable.ic_device_default;
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
/* Copyright (C) 2022-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitband7;
|
|
||||||
|
|
||||||
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.amazfitband7.AmazfitBand7FirmwareInfo;
|
|
||||||
|
|
||||||
public class AmazfitBand7FWHelper extends HuamiFWHelper {
|
|
||||||
public AmazfitBand7FWHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getMaxExpectedFileSize() {
|
|
||||||
return 1024 * 1024 * 32; // 32.0MB
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void determineFirmwareInfo(final byte[] wholeFirmwareBytes) {
|
|
||||||
firmwareInfo = new AmazfitBand7FirmwareInfo(wholeFirmwareBytes);
|
|
||||||
if (!firmwareInfo.isHeaderValid()) {
|
|
||||||
throw new IllegalArgumentException("Not an Amazfit Band 7 firmware");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
/* Copyright (C) 2022-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitband7;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
|
|
||||||
class AmazfitBand7FWInstallHandler extends AbstractZeppOsFwInstallHandler {
|
|
||||||
AmazfitBand7FWInstallHandler(final Uri uri, final Context context) {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getFwUpgradeNotice() {
|
|
||||||
return mContext.getString(R.string.fw_upgrade_notice_amazfit_band7, helper.getHumanFirmwareVersion());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected HuamiFWHelper createHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
return new AmazfitBand7FWHelper(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isSupportedDeviceType(final GBDevice device) {
|
|
||||||
return device.getType() == DeviceType.AMAZFITBAND7;
|
|
||||||
}
|
|
||||||
}
|
|
@ -16,41 +16,24 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbip5;
|
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbip5;
|
||||||
|
|
||||||
import android.content.Context;
|
import java.util.Arrays;
|
||||||
import android.net.Uri;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip5.AmazfitBip5Support;
|
|
||||||
|
|
||||||
public class AmazfitBip5Coordinator extends ZeppOsCoordinator {
|
public class AmazfitBip5Coordinator extends ZeppOsCoordinator {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(AmazfitBip5Coordinator.class);
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends DeviceSupport> getDeviceSupportClass() {
|
public String getDeviceBluetoothName() {
|
||||||
return AmazfitBip5Support.class;
|
return HuamiConst.AMAZFIT_BIP5_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Pattern getSupportedDeviceName() {
|
public Set<Integer> getDeviceSources() {
|
||||||
return Pattern.compile(HuamiConst.AMAZFIT_BIP5_NAME + ".*");
|
return new HashSet<>(Arrays.asList(8454400, 8454401));
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AbstractZeppOsFwInstallHandler createFwInstallHandler(final Uri uri, final Context context) {
|
|
||||||
return new AmazfitBip5FWInstallHandler(uri, context);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -88,13 +71,11 @@ public class AmazfitBip5Coordinator extends ZeppOsCoordinator {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getDeviceNameResource() {
|
public int getDeviceNameResource() {
|
||||||
return R.string.devicetype_amazfit_bip5;
|
return R.string.devicetype_amazfit_bip5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getDefaultIconResource() {
|
public int getDefaultIconResource() {
|
||||||
return R.drawable.ic_device_amazfit_bip;
|
return R.drawable.ic_device_amazfit_bip;
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbip5;
|
|
||||||
|
|
||||||
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.amazfitbip5.AmazfitBip5FirmwareInfo;
|
|
||||||
|
|
||||||
public class AmazfitBip5FWHelper extends HuamiFWHelper {
|
|
||||||
public AmazfitBip5FWHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getMaxExpectedFileSize() {
|
|
||||||
return 1024 * 1024 * 128; // 128.0MB
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void determineFirmwareInfo(final byte[] wholeFirmwareBytes) {
|
|
||||||
firmwareInfo = new AmazfitBip5FirmwareInfo(wholeFirmwareBytes);
|
|
||||||
if (!firmwareInfo.isHeaderValid()) {
|
|
||||||
throw new IllegalArgumentException("Not a Amazfit Bip 5 firmware");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbip5;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
|
|
||||||
class AmazfitBip5FWInstallHandler extends AbstractZeppOsFwInstallHandler {
|
|
||||||
AmazfitBip5FWInstallHandler(final Uri uri, final Context context) {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getFwUpgradeNotice() {
|
|
||||||
final String deviceName = mContext.getString(R.string.devicetype_amazfit_bip5);
|
|
||||||
return mContext.getString(R.string.fw_upgrade_notice_zepp_os, helper.getHumanFirmwareVersion(), deviceName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected HuamiFWHelper createHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
return new AmazfitBip5FWHelper(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isSupportedDeviceType(final GBDevice device) {
|
|
||||||
return device.getType() == DeviceType.AMAZFITBIP5;
|
|
||||||
}
|
|
||||||
}
|
|
@ -16,36 +16,24 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitcheetahpro;
|
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitcheetahpro;
|
||||||
|
|
||||||
import android.content.Context;
|
import java.util.Arrays;
|
||||||
import android.net.Uri;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitcheetahpro.AmazfitCheetahProSupport;
|
|
||||||
|
|
||||||
public class AmazfitCheetahProCoordinator extends ZeppOsCoordinator {
|
public class AmazfitCheetahProCoordinator extends ZeppOsCoordinator {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(AmazfitCheetahProCoordinator.class);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Pattern getSupportedDeviceName() {
|
public String getDeviceBluetoothName() {
|
||||||
return Pattern.compile(HuamiConst.AMAZFIT_CHEETAH_PRO_NAME + ".*");
|
return HuamiConst.AMAZFIT_CHEETAH_PRO_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends DeviceSupport> getDeviceSupportClass() {
|
public Set<Integer> getDeviceSources() {
|
||||||
return AmazfitCheetahProSupport.class;
|
return new HashSet<>(Arrays.asList(8126720, 8126721));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -53,11 +41,6 @@ public class AmazfitCheetahProCoordinator extends ZeppOsCoordinator {
|
|||||||
return R.string.devicetype_amazfit_cheetah_pro;
|
return R.string.devicetype_amazfit_cheetah_pro;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public AbstractZeppOsFwInstallHandler createFwInstallHandler(final Uri uri, final Context context) {
|
|
||||||
return new AmazfitCheetahProFWInstallHandler(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsContinuousFindDevice() {
|
public boolean supportsContinuousFindDevice() {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,45 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 Raghd Hamzeh
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitcheetahpro;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitcheetahpro.AmazfitCheetahProFirmwareInfo;
|
|
||||||
|
|
||||||
public class AmazfitCheetahProFWHelper extends HuamiFWHelper {
|
|
||||||
public AmazfitCheetahProFWHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getMaxExpectedFileSize() {
|
|
||||||
return 1024 * 1024 * 128; // 128.0MB
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void determineFirmwareInfo(final byte[] wholeFirmwareBytes) {
|
|
||||||
firmwareInfo = new AmazfitCheetahProFirmwareInfo(wholeFirmwareBytes);
|
|
||||||
if (!firmwareInfo.isHeaderValid()) {
|
|
||||||
throw new IllegalArgumentException("Not a " + DeviceType.AMAZFITCHEETAHPRO + " firmware");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 Raghd Hamzeh
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitcheetahpro;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
|
|
||||||
class AmazfitCheetahProFWInstallHandler extends AbstractZeppOsFwInstallHandler {
|
|
||||||
AmazfitCheetahProFWInstallHandler(final Uri uri, final Context context) {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getFwUpgradeNotice() {
|
|
||||||
return mContext.getString(R.string.fw_upgrade_notice_amazfit_cheetah_pro, helper.getHumanFirmwareVersion());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected HuamiFWHelper createHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
return new AmazfitCheetahProFWHelper(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isSupportedDeviceType(final GBDevice device) {
|
|
||||||
return device.getType() == DeviceType.AMAZFITCHEETAHPRO;
|
|
||||||
}
|
|
||||||
}
|
|
@ -16,36 +16,29 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitcheetahround;
|
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitcheetahround;
|
||||||
|
|
||||||
import android.content.Context;
|
import java.util.Arrays;
|
||||||
import android.net.Uri;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitcheetahround.AmazfitCheetahRoundSupport;
|
|
||||||
|
|
||||||
public class AmazfitCheetahRoundCoordinator extends ZeppOsCoordinator {
|
public class AmazfitCheetahRoundCoordinator extends ZeppOsCoordinator {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(AmazfitCheetahRoundCoordinator.class);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isExperimental() {
|
public boolean isExperimental() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends DeviceSupport> getDeviceSupportClass() {
|
public String getDeviceBluetoothName() {
|
||||||
return AmazfitCheetahRoundSupport.class;
|
return HuamiConst.AMAZFIT_CHEETAH_ROUND_NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<Integer> getDeviceSources() {
|
||||||
|
return new HashSet<>(Arrays.asList(8192256, 8192257));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -53,16 +46,6 @@ public class AmazfitCheetahRoundCoordinator extends ZeppOsCoordinator {
|
|||||||
return R.string.devicetype_amazfit_cheetah_round;
|
return R.string.devicetype_amazfit_cheetah_round;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Pattern getSupportedDeviceName() {
|
|
||||||
return Pattern.compile(HuamiConst.AMAZFIT_CHEETAH_ROUND_NAME + ".*");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AbstractZeppOsFwInstallHandler createFwInstallHandler(final Uri uri, final Context context) {
|
|
||||||
return new AmazfitCheetahRoundFWInstallHandler(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsContinuousFindDevice() {
|
public boolean supportsContinuousFindDevice() {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitcheetahround;
|
|
||||||
|
|
||||||
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.amazfitcheetahround.AmazfitCheetahRoundFirmwareInfo;
|
|
||||||
|
|
||||||
public class AmazfitCheetahRoundFWHelper extends HuamiFWHelper {
|
|
||||||
public AmazfitCheetahRoundFWHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getMaxExpectedFileSize() {
|
|
||||||
return 1024 * 1024 * 128; // 128.0MB
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void determineFirmwareInfo(final byte[] wholeFirmwareBytes) {
|
|
||||||
firmwareInfo = new AmazfitCheetahRoundFirmwareInfo(wholeFirmwareBytes);
|
|
||||||
if (!firmwareInfo.isHeaderValid()) {
|
|
||||||
throw new IllegalArgumentException("Not a Amazfit Cheetah (Round) firmware");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitcheetahround;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
|
|
||||||
class AmazfitCheetahRoundFWInstallHandler extends AbstractZeppOsFwInstallHandler {
|
|
||||||
AmazfitCheetahRoundFWInstallHandler(final Uri uri, final Context context) {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getFwUpgradeNotice() {
|
|
||||||
final String deviceName = mContext.getString(R.string.devicetype_amazfit_cheetah_round);
|
|
||||||
return mContext.getString(R.string.fw_upgrade_notice_zepp_os, helper.getHumanFirmwareVersion(), deviceName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected HuamiFWHelper createHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
return new AmazfitCheetahRoundFWHelper(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isSupportedDeviceType(final GBDevice device) {
|
|
||||||
return device.getType() == DeviceType.AMAZFITCHEETAHROUND;
|
|
||||||
}
|
|
||||||
}
|
|
@ -16,46 +16,29 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitcheetahsquare;
|
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitcheetahsquare;
|
||||||
|
|
||||||
import android.content.Context;
|
import java.util.Collections;
|
||||||
import android.net.Uri;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitcheetahsquare.AmazfitCheetahSquareSupport;
|
|
||||||
|
|
||||||
public class AmazfitCheetahSquareCoordinator extends ZeppOsCoordinator {
|
public class AmazfitCheetahSquareCoordinator extends ZeppOsCoordinator {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(AmazfitCheetahSquareCoordinator.class);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isExperimental() {
|
public boolean isExperimental() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends DeviceSupport> getDeviceSupportClass() {
|
public String getDeviceBluetoothName() {
|
||||||
return AmazfitCheetahSquareSupport.class;
|
return HuamiConst.AMAZFIT_CHEETAH_SQUARE_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Pattern getSupportedDeviceName() {
|
public Set<Integer> getDeviceSources() {
|
||||||
return Pattern.compile(HuamiConst.AMAZFIT_CHEETAH_SQUARE_NAME + ".*");
|
return new HashSet<>(Collections.singletonList(8257793));
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AbstractZeppOsFwInstallHandler createFwInstallHandler(final Uri uri, final Context context) {
|
|
||||||
return new AmazfitCheetahSquareFWInstallHandler(uri, context);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -98,13 +81,11 @@ public class AmazfitCheetahSquareCoordinator extends ZeppOsCoordinator {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getDeviceNameResource() {
|
public int getDeviceNameResource() {
|
||||||
return R.string.devicetype_amazfit_cheetah_square;
|
return R.string.devicetype_amazfit_cheetah_square;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getDefaultIconResource() {
|
public int getDefaultIconResource() {
|
||||||
return R.drawable.ic_device_amazfit_bip;
|
return R.drawable.ic_device_amazfit_bip;
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitcheetahsquare;
|
|
||||||
|
|
||||||
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.amazfitcheetahsquare.AmazfitCheetahSquareFirmwareInfo;
|
|
||||||
|
|
||||||
public class AmazfitCheetahSquareFWHelper extends HuamiFWHelper {
|
|
||||||
public AmazfitCheetahSquareFWHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getMaxExpectedFileSize() {
|
|
||||||
return 1024 * 1024 * 128; // 128.0MB
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void determineFirmwareInfo(final byte[] wholeFirmwareBytes) {
|
|
||||||
firmwareInfo = new AmazfitCheetahSquareFirmwareInfo(wholeFirmwareBytes);
|
|
||||||
if (!firmwareInfo.isHeaderValid()) {
|
|
||||||
throw new IllegalArgumentException("Not a Amazfit Cheetah (Square) firmware");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitcheetahsquare;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
|
|
||||||
class AmazfitCheetahSquareFWInstallHandler extends AbstractZeppOsFwInstallHandler {
|
|
||||||
AmazfitCheetahSquareFWInstallHandler(final Uri uri, final Context context) {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getFwUpgradeNotice() {
|
|
||||||
final String deviceName = mContext.getString(R.string.devicetype_amazfit_cheetah_square);
|
|
||||||
return mContext.getString(R.string.fw_upgrade_notice_zepp_os, helper.getHumanFirmwareVersion(), deviceName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected HuamiFWHelper createHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
return new AmazfitCheetahSquareFWHelper(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isSupportedDeviceType(final GBDevice device) {
|
|
||||||
return device.getType() == DeviceType.AMAZFITCHEETAHSQUARE;
|
|
||||||
}
|
|
||||||
}
|
|
@ -16,36 +16,29 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitfalcon;
|
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitfalcon;
|
||||||
|
|
||||||
import android.content.Context;
|
import java.util.Arrays;
|
||||||
import android.net.Uri;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitfalcon.AmazfitFalconSupport;
|
|
||||||
|
|
||||||
public class AmazfitFalconCoordinator extends ZeppOsCoordinator {
|
public class AmazfitFalconCoordinator extends ZeppOsCoordinator {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(AmazfitFalconCoordinator.class);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isExperimental() {
|
public boolean isExperimental() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends DeviceSupport> getDeviceSupportClass() {
|
public String getDeviceBluetoothName() {
|
||||||
return AmazfitFalconSupport.class;
|
return HuamiConst.AMAZFIT_FALCON_NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<Integer> getDeviceSources() {
|
||||||
|
return new HashSet<>(Arrays.asList(414, 415));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -53,16 +46,6 @@ public class AmazfitFalconCoordinator extends ZeppOsCoordinator {
|
|||||||
return R.string.devicetype_amazfit_falcon;
|
return R.string.devicetype_amazfit_falcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Pattern getSupportedDeviceName() {
|
|
||||||
return Pattern.compile(HuamiConst.AMAZFIT_FALCON_NAME + ".*");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AbstractZeppOsFwInstallHandler createFwInstallHandler(final Uri uri, final Context context) {
|
|
||||||
return new AmazfitFalconFWInstallHandler(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean sendAgpsAsFileTransfer() {
|
public boolean sendAgpsAsFileTransfer() {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitfalcon;
|
|
||||||
|
|
||||||
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.amazfitfalcon.AmazfitFalconFirmwareInfo;
|
|
||||||
|
|
||||||
public class AmazfitFalconFWHelper extends HuamiFWHelper {
|
|
||||||
public AmazfitFalconFWHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getMaxExpectedFileSize() {
|
|
||||||
return 1024 * 1024 * 128; // 128.0MB
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void determineFirmwareInfo(final byte[] wholeFirmwareBytes) {
|
|
||||||
firmwareInfo = new AmazfitFalconFirmwareInfo(wholeFirmwareBytes);
|
|
||||||
if (!firmwareInfo.isHeaderValid()) {
|
|
||||||
throw new IllegalArgumentException("Not a Amazfit Falcon firmware");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitfalcon;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
|
|
||||||
class AmazfitFalconFWInstallHandler extends AbstractZeppOsFwInstallHandler {
|
|
||||||
AmazfitFalconFWInstallHandler(final Uri uri, final Context context) {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getFwUpgradeNotice() {
|
|
||||||
final String deviceName = mContext.getString(R.string.devicetype_amazfit_falcon);
|
|
||||||
return mContext.getString(R.string.fw_upgrade_notice_zepp_os, helper.getHumanFirmwareVersion(), deviceName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected HuamiFWHelper createHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
return new AmazfitFalconFWHelper(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isSupportedDeviceType(final GBDevice device) {
|
|
||||||
return device.getType() == DeviceType.AMAZFITFALCON;
|
|
||||||
}
|
|
||||||
}
|
|
@ -16,45 +16,24 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr3;
|
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr3;
|
||||||
|
|
||||||
import android.content.Context;
|
import java.util.Arrays;
|
||||||
import android.net.Uri;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgtr3.AmazfitGTR3Support;
|
|
||||||
|
|
||||||
public class AmazfitGTR3Coordinator extends ZeppOsCoordinator {
|
public class AmazfitGTR3Coordinator extends ZeppOsCoordinator {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTR3Coordinator.class);
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supports(final GBDeviceCandidate candidate) {
|
public String getDeviceBluetoothName() {
|
||||||
try {
|
return HuamiConst.AMAZFIT_GTR3_NAME;
|
||||||
final String name = candidate.getName();
|
|
||||||
if (name != null && name.startsWith(HuamiConst.AMAZFIT_GTR3_NAME) && !name.contains("Pro")) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} catch (final Exception e) {
|
|
||||||
LOG.error("unable to check device support", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends DeviceSupport> getDeviceSupportClass() {
|
public Set<Integer> getDeviceSources() {
|
||||||
return AmazfitGTR3Support.class;
|
return new HashSet<>(Arrays.asList(226, 227));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -62,11 +41,6 @@ public class AmazfitGTR3Coordinator extends ZeppOsCoordinator {
|
|||||||
return R.string.devicetype_amazfit_gtr3;
|
return R.string.devicetype_amazfit_gtr3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public AbstractZeppOsFwInstallHandler createFwInstallHandler(final Uri uri, final Context context) {
|
|
||||||
return new AmazfitGTR3FWInstallHandler(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean sendAgpsAsFileTransfer() {
|
public boolean sendAgpsAsFileTransfer() {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
/* Copyright (C) 2022-2024 José Rebelo, thermatk
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr3;
|
|
||||||
|
|
||||||
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.amazfitgtr3.AmazfitGTR3FirmwareInfo;
|
|
||||||
|
|
||||||
public class AmazfitGTR3FWHelper extends HuamiFWHelper {
|
|
||||||
public AmazfitGTR3FWHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getMaxExpectedFileSize() {
|
|
||||||
return 1024 * 1024 * 128; // 128.0MB
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void determineFirmwareInfo(final byte[] wholeFirmwareBytes) {
|
|
||||||
firmwareInfo = new AmazfitGTR3FirmwareInfo(wholeFirmwareBytes);
|
|
||||||
if (!firmwareInfo.isHeaderValid()) {
|
|
||||||
throw new IllegalArgumentException("Not a Amazfit GTR 3 firmware");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
/* Copyright (C) 2022-2024 José Rebelo, thermatk
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr3;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
|
|
||||||
class AmazfitGTR3FWInstallHandler extends AbstractZeppOsFwInstallHandler {
|
|
||||||
AmazfitGTR3FWInstallHandler(Uri uri, Context context) {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getFwUpgradeNotice() {
|
|
||||||
return mContext.getString(R.string.fw_upgrade_notice_amazfit_gtr3, helper.getHumanFirmwareVersion());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected HuamiFWHelper createHelper(Uri uri, Context context) throws IOException {
|
|
||||||
return new AmazfitGTR3FWHelper(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isSupportedDeviceType(GBDevice device) {
|
|
||||||
return device.getType() == DeviceType.AMAZFITGTR3;
|
|
||||||
}
|
|
||||||
}
|
|
@ -16,36 +16,24 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr3pro;
|
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr3pro;
|
||||||
|
|
||||||
import android.content.Context;
|
import java.util.Arrays;
|
||||||
import android.net.Uri;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgtr3pro.AmazfitGTR3ProSupport;
|
|
||||||
|
|
||||||
public class AmazfitGTR3ProCoordinator extends ZeppOsCoordinator {
|
public class AmazfitGTR3ProCoordinator extends ZeppOsCoordinator {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTR3ProCoordinator.class);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Pattern getSupportedDeviceName() {
|
public String getDeviceBluetoothName() {
|
||||||
return Pattern.compile(HuamiConst.AMAZFIT_GTR3_PRO_NAME + ".*");
|
return HuamiConst.AMAZFIT_GTR3_PRO_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends DeviceSupport> getDeviceSupportClass() {
|
public Set<Integer> getDeviceSources() {
|
||||||
return AmazfitGTR3ProSupport.class;
|
return new HashSet<>(Arrays.asList(229, 230, 6095106));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -53,11 +41,6 @@ public class AmazfitGTR3ProCoordinator extends ZeppOsCoordinator {
|
|||||||
return R.string.devicetype_amazfit_gtr3_pro;
|
return R.string.devicetype_amazfit_gtr3_pro;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public AbstractZeppOsFwInstallHandler createFwInstallHandler(final Uri uri, final Context context) {
|
|
||||||
return new AmazfitGTR3ProFWInstallHandler(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean sendAgpsAsFileTransfer() {
|
public boolean sendAgpsAsFileTransfer() {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr3pro;
|
|
||||||
|
|
||||||
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.amazfitgtr3pro.AmazfitGTR3ProFirmwareInfo;
|
|
||||||
|
|
||||||
public class AmazfitGTR3ProFWHelper extends HuamiFWHelper {
|
|
||||||
public AmazfitGTR3ProFWHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getMaxExpectedFileSize() {
|
|
||||||
return 1024 * 1024 * 128; // 128.0MB
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void determineFirmwareInfo(final byte[] wholeFirmwareBytes) {
|
|
||||||
firmwareInfo = new AmazfitGTR3ProFirmwareInfo(wholeFirmwareBytes);
|
|
||||||
if (!firmwareInfo.isHeaderValid()) {
|
|
||||||
throw new IllegalArgumentException("Not a Amazfit GTR 3 Pro firmware");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr3pro;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
|
|
||||||
class AmazfitGTR3ProFWInstallHandler extends AbstractZeppOsFwInstallHandler {
|
|
||||||
AmazfitGTR3ProFWInstallHandler(Uri uri, Context context) {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getFwUpgradeNotice() {
|
|
||||||
return mContext.getString(R.string.fw_upgrade_notice_amazfit_gtr3_pro, helper.getHumanFirmwareVersion());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected HuamiFWHelper createHelper(Uri uri, Context context) throws IOException {
|
|
||||||
return new AmazfitGTR3ProFWHelper(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isSupportedDeviceType(GBDevice device) {
|
|
||||||
return device.getType() == DeviceType.AMAZFITGTR3PRO;
|
|
||||||
}
|
|
||||||
}
|
|
@ -16,36 +16,39 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr4;
|
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr4;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.regex.Pattern;
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgtr4.AmazfitGTR4Support;
|
|
||||||
|
|
||||||
public class AmazfitGTR4Coordinator extends ZeppOsCoordinator {
|
public class AmazfitGTR4Coordinator extends ZeppOsCoordinator {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTR4Coordinator.class);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Pattern getSupportedDeviceName() {
|
public String getDeviceBluetoothName() {
|
||||||
return Pattern.compile(HuamiConst.AMAZFIT_GTR4_NAME + ".*");
|
return HuamiConst.AMAZFIT_GTR4_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends DeviceSupport> getDeviceSupportClass() {
|
public Set<Integer> getDeviceSources() {
|
||||||
return AmazfitGTR4Support.class;
|
return new HashSet<>(Arrays.asList(7930112, 7930113, 7864577));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Map<Integer, String> getCrcMap() {
|
||||||
|
return new HashMap<Integer, String>() {{
|
||||||
|
// firmware
|
||||||
|
put(1699, "3.17.0.2");
|
||||||
|
put(20712, "3.18.1.1 (diff from 3.17.0.2)");
|
||||||
|
put(49685, "3.23.3.1 (diff from 3.21.0.1)");
|
||||||
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -53,11 +56,6 @@ public class AmazfitGTR4Coordinator extends ZeppOsCoordinator {
|
|||||||
return R.string.devicetype_amazfit_gtr4;
|
return R.string.devicetype_amazfit_gtr4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public AbstractZeppOsFwInstallHandler createFwInstallHandler(final Uri uri, final Context context) {
|
|
||||||
return new AmazfitGTR4FWInstallHandler(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsContinuousFindDevice() {
|
public boolean supportsContinuousFindDevice() {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
/* Copyright (C) 2022-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr4;
|
|
||||||
|
|
||||||
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.amazfitgtr4.AmazfitGTR4FirmwareInfo;
|
|
||||||
|
|
||||||
public class AmazfitGTR4FWHelper extends HuamiFWHelper {
|
|
||||||
public AmazfitGTR4FWHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getMaxExpectedFileSize() {
|
|
||||||
return 1024 * 1024 * 128; // 128.0MB
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void determineFirmwareInfo(final byte[] wholeFirmwareBytes) {
|
|
||||||
firmwareInfo = new AmazfitGTR4FirmwareInfo(wholeFirmwareBytes);
|
|
||||||
if (!firmwareInfo.isHeaderValid()) {
|
|
||||||
throw new IllegalArgumentException("Not a Amazfit GTR 4 firmware");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
/* Copyright (C) 2022-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr4;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
|
|
||||||
class AmazfitGTR4FWInstallHandler extends AbstractZeppOsFwInstallHandler {
|
|
||||||
AmazfitGTR4FWInstallHandler(final Uri uri, final Context context) {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getFwUpgradeNotice() {
|
|
||||||
return mContext.getString(R.string.fw_upgrade_notice_amazfit_gtr4, helper.getHumanFirmwareVersion());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected HuamiFWHelper createHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
return new AmazfitGTR4FWHelper(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isSupportedDeviceType(final GBDevice device) {
|
|
||||||
return device.getType() == DeviceType.AMAZFITGTR4;
|
|
||||||
}
|
|
||||||
}
|
|
@ -16,31 +16,24 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtrmini;
|
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtrmini;
|
||||||
|
|
||||||
import android.content.Context;
|
import java.util.Arrays;
|
||||||
import android.net.Uri;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgtrmini.AmazfitGTRMiniSupport;
|
|
||||||
|
|
||||||
public class AmazfitGTRMiniCoordinator extends ZeppOsCoordinator {
|
public class AmazfitGTRMiniCoordinator extends ZeppOsCoordinator {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTRMiniCoordinator.class);
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends DeviceSupport> getDeviceSupportClass() {
|
public String getDeviceBluetoothName() {
|
||||||
return AmazfitGTRMiniSupport.class;
|
return HuamiConst.AMAZFIT_GTR_MINI_NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<Integer> getDeviceSources() {
|
||||||
|
return new HashSet<>(Arrays.asList(250, 251));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -48,16 +41,6 @@ public class AmazfitGTRMiniCoordinator extends ZeppOsCoordinator {
|
|||||||
return R.string.devicetype_amazfit_gtr_mini;
|
return R.string.devicetype_amazfit_gtr_mini;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Pattern getSupportedDeviceName() {
|
|
||||||
return Pattern.compile(HuamiConst.AMAZFIT_GTR_MINI_NAME + ".*");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AbstractZeppOsFwInstallHandler createFwInstallHandler(final Uri uri, final Context context) {
|
|
||||||
return new AmazfitGTRMiniFWInstallHandler(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean sendAgpsAsFileTransfer() {
|
public boolean sendAgpsAsFileTransfer() {
|
||||||
// Even though it's a Zepp OS 2.0 device, it doesn't seem to support the AGPS service
|
// Even though it's a Zepp OS 2.0 device, it doesn't seem to support the AGPS service
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtrmini;
|
|
||||||
|
|
||||||
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.amazfitgtrmini.AmazfitGTRMiniFirmwareInfo;
|
|
||||||
|
|
||||||
public class AmazfitGTRMiniFWHelper extends HuamiFWHelper {
|
|
||||||
public AmazfitGTRMiniFWHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getMaxExpectedFileSize() {
|
|
||||||
return 1024 * 1024 * 128; // 128.0MB
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void determineFirmwareInfo(final byte[] wholeFirmwareBytes) {
|
|
||||||
firmwareInfo = new AmazfitGTRMiniFirmwareInfo(wholeFirmwareBytes);
|
|
||||||
if (!firmwareInfo.isHeaderValid()) {
|
|
||||||
throw new IllegalArgumentException("Not a Amazfit GTR Mini firmware");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtrmini;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
|
|
||||||
class AmazfitGTRMiniFWInstallHandler extends AbstractZeppOsFwInstallHandler {
|
|
||||||
AmazfitGTRMiniFWInstallHandler(final Uri uri, final Context context) {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getFwUpgradeNotice() {
|
|
||||||
final String deviceName = mContext.getString(R.string.devicetype_amazfit_gtr_mini);
|
|
||||||
return mContext.getString(R.string.fw_upgrade_notice_zepp_os, helper.getHumanFirmwareVersion(), deviceName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected HuamiFWHelper createHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
return new AmazfitGTRMiniFWHelper(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isSupportedDeviceType(final GBDevice device) {
|
|
||||||
return device.getType() == DeviceType.AMAZFITGTRMINI;
|
|
||||||
}
|
|
||||||
}
|
|
@ -16,41 +16,24 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgts3;
|
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgts3;
|
||||||
|
|
||||||
import android.content.Context;
|
import java.util.Arrays;
|
||||||
import android.net.Uri;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgts3.AmazfitGTS3Support;
|
|
||||||
|
|
||||||
public class AmazfitGTS3Coordinator extends ZeppOsCoordinator {
|
public class AmazfitGTS3Coordinator extends ZeppOsCoordinator {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTS3Coordinator.class);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Pattern getSupportedDeviceName() {
|
public String getDeviceBluetoothName() {
|
||||||
return Pattern.compile(HuamiConst.AMAZFIT_GTS3_NAME + ".*");
|
return HuamiConst.AMAZFIT_GTS3_NAME;
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public Class<? extends DeviceSupport> getDeviceSupportClass() {
|
|
||||||
return AmazfitGTS3Support.class;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AbstractZeppOsFwInstallHandler createFwInstallHandler(final Uri uri, final Context context) {
|
public Set<Integer> getDeviceSources() {
|
||||||
return new AmazfitGTS3FWInstallHandler(uri, context);
|
return new HashSet<>(Arrays.asList(224, 225));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -63,13 +46,11 @@ public class AmazfitGTS3Coordinator extends ZeppOsCoordinator {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getDeviceNameResource() {
|
public int getDeviceNameResource() {
|
||||||
return R.string.devicetype_amazfit_gts3;
|
return R.string.devicetype_amazfit_gts3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getDefaultIconResource() {
|
public int getDefaultIconResource() {
|
||||||
return R.drawable.ic_device_amazfit_bip;
|
return R.drawable.ic_device_amazfit_bip;
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
/* Copyright (C) 2022-2024 José Rebelo, sedy89
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgts3;
|
|
||||||
|
|
||||||
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.amazfitgts3.AmazfitGTS3FirmwareInfo;
|
|
||||||
|
|
||||||
public class AmazfitGTS3FWHelper extends HuamiFWHelper {
|
|
||||||
public AmazfitGTS3FWHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getMaxExpectedFileSize() {
|
|
||||||
return 1024 * 1024 * 128; // 128.0MB
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void determineFirmwareInfo(final byte[] wholeFirmwareBytes) {
|
|
||||||
firmwareInfo = new AmazfitGTS3FirmwareInfo(wholeFirmwareBytes);
|
|
||||||
if (!firmwareInfo.isHeaderValid()) {
|
|
||||||
throw new IllegalArgumentException("Not a Amazfit GTS 3 firmware");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
/* Copyright (C) 2022-2024 José Rebelo, sedy89
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgts3;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
|
|
||||||
class AmazfitGTS3FWInstallHandler extends AbstractZeppOsFwInstallHandler {
|
|
||||||
AmazfitGTS3FWInstallHandler(Uri uri, Context context) {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getFwUpgradeNotice() {
|
|
||||||
return mContext.getString(R.string.fw_upgrade_notice_amazfit_gts3, helper.getHumanFirmwareVersion());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected HuamiFWHelper createHelper(Uri uri, Context context) throws IOException {
|
|
||||||
return new AmazfitGTS3FWHelper(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isSupportedDeviceType(GBDevice device) {
|
|
||||||
return device.getType() == DeviceType.AMAZFITGTS3;
|
|
||||||
}
|
|
||||||
}
|
|
@ -16,49 +16,24 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgts4;
|
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgts4;
|
||||||
|
|
||||||
import android.content.Context;
|
import java.util.Arrays;
|
||||||
import android.net.Uri;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgts4.AmazfitGTS4Support;
|
|
||||||
|
|
||||||
public class AmazfitGTS4Coordinator extends ZeppOsCoordinator {
|
public class AmazfitGTS4Coordinator extends ZeppOsCoordinator {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTS4Coordinator.class);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supports(final GBDeviceCandidate candidate) {
|
public String getDeviceBluetoothName() {
|
||||||
try {
|
return HuamiConst.AMAZFIT_GTS4_NAME;
|
||||||
final String name = candidate.getName();
|
|
||||||
if (name != null && name.startsWith(HuamiConst.AMAZFIT_GTS4_NAME) && !name.contains("Mini")) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} catch (final Exception e) {
|
|
||||||
LOG.error("unable to check device support", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public Class<? extends DeviceSupport> getDeviceSupportClass() {
|
|
||||||
return AmazfitGTS4Support.class;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AbstractZeppOsFwInstallHandler createFwInstallHandler(final Uri uri, final Context context) {
|
public Set<Integer> getDeviceSources() {
|
||||||
return new AmazfitGTS4FWInstallHandler(uri, context);
|
return new HashSet<>(Arrays.asList(7995648, 7995649));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -96,13 +71,11 @@ public class AmazfitGTS4Coordinator extends ZeppOsCoordinator {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getDeviceNameResource() {
|
public int getDeviceNameResource() {
|
||||||
return R.string.devicetype_amazfit_gts4;
|
return R.string.devicetype_amazfit_gts4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getDefaultIconResource() {
|
public int getDefaultIconResource() {
|
||||||
return R.drawable.ic_device_amazfit_bip;
|
return R.drawable.ic_device_amazfit_bip;
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
/* Copyright (C) 2022-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgts4;
|
|
||||||
|
|
||||||
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.amazfitgts4.AmazfitGTS4FirmwareInfo;
|
|
||||||
|
|
||||||
public class AmazfitGTS4FWHelper extends HuamiFWHelper {
|
|
||||||
public AmazfitGTS4FWHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getMaxExpectedFileSize() {
|
|
||||||
return 1024 * 1024 * 128; // 128.0MB
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void determineFirmwareInfo(final byte[] wholeFirmwareBytes) {
|
|
||||||
firmwareInfo = new AmazfitGTS4FirmwareInfo(wholeFirmwareBytes);
|
|
||||||
if (!firmwareInfo.isHeaderValid()) {
|
|
||||||
throw new IllegalArgumentException("Not a Amazfit GTS 4 firmware");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
/* Copyright (C) 2022-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgts4;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
|
|
||||||
class AmazfitGTS4FWInstallHandler extends AbstractZeppOsFwInstallHandler {
|
|
||||||
AmazfitGTS4FWInstallHandler(final Uri uri, final Context context) {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getFwUpgradeNotice() {
|
|
||||||
return mContext.getString(R.string.fw_upgrade_notice_amazfit_gts4, helper.getHumanFirmwareVersion());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected HuamiFWHelper createHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
return new AmazfitGTS4FWHelper(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isSupportedDeviceType(final GBDevice device) {
|
|
||||||
return device.getType() == DeviceType.AMAZFITGTS4;
|
|
||||||
}
|
|
||||||
}
|
|
@ -16,41 +16,24 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgts4mini;
|
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgts4mini;
|
||||||
|
|
||||||
import android.content.Context;
|
import java.util.Arrays;
|
||||||
import android.net.Uri;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgts4mini.AmazfitGTS4MiniSupport;
|
|
||||||
|
|
||||||
public class AmazfitGTS4MiniCoordinator extends ZeppOsCoordinator {
|
public class AmazfitGTS4MiniCoordinator extends ZeppOsCoordinator {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTS4MiniCoordinator.class);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Pattern getSupportedDeviceName() {
|
public String getDeviceBluetoothName() {
|
||||||
return Pattern.compile(HuamiConst.AMAZFIT_GTS4_MINI_NAME + ".*");
|
return HuamiConst.AMAZFIT_GTS4_MINI_NAME;
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public Class<? extends DeviceSupport> getDeviceSupportClass() {
|
|
||||||
return AmazfitGTS4MiniSupport.class;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AbstractZeppOsFwInstallHandler createFwInstallHandler(final Uri uri, final Context context) {
|
public Set<Integer> getDeviceSources() {
|
||||||
return new AmazfitGTS4MiniFWInstallHandler(uri, context);
|
return new HashSet<>(Arrays.asList(246, 247));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -63,13 +46,11 @@ public class AmazfitGTS4MiniCoordinator extends ZeppOsCoordinator {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getDeviceNameResource() {
|
public int getDeviceNameResource() {
|
||||||
return R.string.devicetype_amazfit_gts4_mini;
|
return R.string.devicetype_amazfit_gts4_mini;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getDefaultIconResource() {
|
public int getDefaultIconResource() {
|
||||||
return R.drawable.ic_device_amazfit_bip;
|
return R.drawable.ic_device_amazfit_bip;
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
/* Copyright (C) 2022-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgts4mini;
|
|
||||||
|
|
||||||
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.amazfitgts4mini.AmazfitGTS4MiniFirmwareInfo;
|
|
||||||
|
|
||||||
public class AmazfitGTS4MiniFWHelper extends HuamiFWHelper {
|
|
||||||
public AmazfitGTS4MiniFWHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getMaxExpectedFileSize() {
|
|
||||||
return 1024 * 1024 * 128; // 128.0MB
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void determineFirmwareInfo(final byte[] wholeFirmwareBytes) {
|
|
||||||
firmwareInfo = new AmazfitGTS4MiniFirmwareInfo(wholeFirmwareBytes);
|
|
||||||
if (!firmwareInfo.isHeaderValid()) {
|
|
||||||
throw new IllegalArgumentException("Not a Amazfit GTS 4 Mini firmware");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
/* Copyright (C) 2022-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgts4mini;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
|
|
||||||
class AmazfitGTS4MiniFWInstallHandler extends AbstractZeppOsFwInstallHandler {
|
|
||||||
AmazfitGTS4MiniFWInstallHandler(final Uri uri, final Context context) {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getFwUpgradeNotice() {
|
|
||||||
return mContext.getString(R.string.fw_upgrade_notice_amazfit_gts4_mini, helper.getHumanFirmwareVersion());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected HuamiFWHelper createHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
return new AmazfitGTS4MiniFWHelper(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isSupportedDeviceType(final GBDevice device) {
|
|
||||||
return device.getType() == DeviceType.AMAZFITGTS4MINI;
|
|
||||||
}
|
|
||||||
}
|
|
@ -16,36 +16,24 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfittrex2;
|
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfittrex2;
|
||||||
|
|
||||||
import android.content.Context;
|
import java.util.Arrays;
|
||||||
import android.net.Uri;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfittrex2.AmazfitTRex2Support;
|
|
||||||
|
|
||||||
public class AmazfitTRex2Coordinator extends ZeppOsCoordinator {
|
public class AmazfitTRex2Coordinator extends ZeppOsCoordinator {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(AmazfitTRex2Coordinator.class);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Pattern getSupportedDeviceName() {
|
public String getDeviceBluetoothName() {
|
||||||
return Pattern.compile(HuamiConst.AMAZFIT_TREX_2_NAME + ".*");
|
return HuamiConst.AMAZFIT_TREX_2_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends DeviceSupport> getDeviceSupportClass() {
|
public Set<Integer> getDeviceSources() {
|
||||||
return AmazfitTRex2Support.class;
|
return new HashSet<>(Arrays.asList(418, 419));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -53,11 +41,6 @@ public class AmazfitTRex2Coordinator extends ZeppOsCoordinator {
|
|||||||
return R.string.devicetype_amazfit_trex_2;
|
return R.string.devicetype_amazfit_trex_2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public AbstractZeppOsFwInstallHandler createFwInstallHandler(final Uri uri, final Context context) {
|
|
||||||
return new AmazfitTRex2FWInstallHandler(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsControlCenter() {
|
public boolean supportsControlCenter() {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfittrex2;
|
|
||||||
|
|
||||||
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.amazfittrex2.AmazfitTRex2FirmwareInfo;
|
|
||||||
|
|
||||||
public class AmazfitTRex2FWHelper extends HuamiFWHelper {
|
|
||||||
public AmazfitTRex2FWHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getMaxExpectedFileSize() {
|
|
||||||
return 1024 * 1024 * 128; // 128.0MB
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void determineFirmwareInfo(final byte[] wholeFirmwareBytes) {
|
|
||||||
firmwareInfo = new AmazfitTRex2FirmwareInfo(wholeFirmwareBytes);
|
|
||||||
if (!firmwareInfo.isHeaderValid()) {
|
|
||||||
throw new IllegalArgumentException("Not a Amazfit T-Rex 2 firmware");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfittrex2;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
|
|
||||||
class AmazfitTRex2FWInstallHandler extends AbstractZeppOsFwInstallHandler {
|
|
||||||
AmazfitTRex2FWInstallHandler(final Uri uri, final Context context) {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getFwUpgradeNotice() {
|
|
||||||
return mContext.getString(R.string.fw_upgrade_notice_amazfit_trex2, helper.getHumanFirmwareVersion());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected HuamiFWHelper createHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
return new AmazfitTRex2FWHelper(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isSupportedDeviceType(final GBDevice device) {
|
|
||||||
return device.getType() == DeviceType.AMAZFITTREX2;
|
|
||||||
}
|
|
||||||
}
|
|
@ -16,31 +16,24 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfittrexultra;
|
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfittrexultra;
|
||||||
|
|
||||||
import android.content.Context;
|
import java.util.Arrays;
|
||||||
import android.net.Uri;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfittrexultra.AmazfitTRexUltraSupport;
|
|
||||||
|
|
||||||
public class AmazfitTRexUltraCoordinator extends ZeppOsCoordinator {
|
public class AmazfitTRexUltraCoordinator extends ZeppOsCoordinator {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(AmazfitTRexUltraCoordinator.class);
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends DeviceSupport> getDeviceSupportClass() {
|
public String getDeviceBluetoothName() {
|
||||||
return AmazfitTRexUltraSupport.class;
|
return HuamiConst.AMAZFIT_TREX_ULTRA;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<Integer> getDeviceSources() {
|
||||||
|
return new HashSet<>(Arrays.asList(6553856, 6553857));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -48,16 +41,6 @@ public class AmazfitTRexUltraCoordinator extends ZeppOsCoordinator {
|
|||||||
return R.string.devicetype_amazfit_trex_ultra;
|
return R.string.devicetype_amazfit_trex_ultra;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Pattern getSupportedDeviceName() {
|
|
||||||
return Pattern.compile(HuamiConst.AMAZFIT_TREX_ULTRA + ".*");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AbstractZeppOsFwInstallHandler createFwInstallHandler(final Uri uri, final Context context) {
|
|
||||||
return new AmazfitTRexUltraFWInstallHandler(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsContinuousFindDevice() {
|
public boolean supportsContinuousFindDevice() {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfittrexultra;
|
|
||||||
|
|
||||||
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.amazfittrexultra.AmazfitTRexUltraFirmwareInfo;
|
|
||||||
|
|
||||||
public class AmazfitTRexUltraFWHelper extends HuamiFWHelper {
|
|
||||||
public AmazfitTRexUltraFWHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getMaxExpectedFileSize() {
|
|
||||||
return 1024 * 1024 * 128; // 128.0MB
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void determineFirmwareInfo(final byte[] wholeFirmwareBytes) {
|
|
||||||
firmwareInfo = new AmazfitTRexUltraFirmwareInfo(wholeFirmwareBytes);
|
|
||||||
if (!firmwareInfo.isHeaderValid()) {
|
|
||||||
throw new IllegalArgumentException("Not a Amazfit T-Rex Ultra firmware");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfittrexultra;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
|
|
||||||
class AmazfitTRexUltraFWInstallHandler extends AbstractZeppOsFwInstallHandler {
|
|
||||||
AmazfitTRexUltraFWInstallHandler(final Uri uri, final Context context) {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getFwUpgradeNotice() {
|
|
||||||
final String deviceName = mContext.getString(R.string.devicetype_amazfit_trex_ultra);
|
|
||||||
return mContext.getString(R.string.fw_upgrade_notice_zepp_os, helper.getHumanFirmwareVersion(), deviceName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected HuamiFWHelper createHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
return new AmazfitTRexUltraFWHelper(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isSupportedDeviceType(final GBDevice device) {
|
|
||||||
return device.getType() == DeviceType.AMAZFITTREXULTRA;
|
|
||||||
}
|
|
||||||
}
|
|
@ -16,30 +16,37 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.miband7;
|
package nodomain.freeyourgadget.gadgetbridge.devices.huami.miband7;
|
||||||
|
|
||||||
import android.content.Context;
|
import java.util.Arrays;
|
||||||
import android.net.Uri;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import androidx.annotation.NonNull;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos.ZeppOsCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband7.MiBand7Support;
|
|
||||||
|
|
||||||
public class MiBand7Coordinator extends ZeppOsCoordinator {
|
public class MiBand7Coordinator extends ZeppOsCoordinator {
|
||||||
@Override
|
@Override
|
||||||
public boolean supports(final GBDeviceCandidate candidate) {
|
public String getDeviceBluetoothName() {
|
||||||
final String name = candidate.getName();
|
return HuamiConst.XIAOMI_SMART_BAND7_NAME;
|
||||||
return name.startsWith(HuamiConst.XIAOMI_SMART_BAND7_NAME) && !name.contains("Pro");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AbstractZeppOsFwInstallHandler createFwInstallHandler(final Uri uri, final Context context) {
|
public Set<Integer> getDeviceSources() {
|
||||||
return new MiBand7FWInstallHandler(uri, context);
|
return new HashSet<>(Arrays.asList(260, 262, 263, 264, 265));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Map<Integer, String> getCrcMap() {
|
||||||
|
return new HashMap<Integer, String>() {{
|
||||||
|
// firmware
|
||||||
|
put(26036, "1.20.3.1");
|
||||||
|
put(55449, "1.27.0.4");
|
||||||
|
put(14502, "2.0.0.2");
|
||||||
|
put(25658, "2.1.0.1");
|
||||||
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -52,24 +59,16 @@ public class MiBand7Coordinator extends ZeppOsCoordinator {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public Class<? extends DeviceSupport> getDeviceSupportClass() {
|
|
||||||
return MiBand7Support.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsBluetoothPhoneCalls(final GBDevice device) {
|
public boolean supportsBluetoothPhoneCalls(final GBDevice device) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getDeviceNameResource() {
|
public int getDeviceNameResource() {
|
||||||
return R.string.devicetype_miband7;
|
return R.string.devicetype_miband7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getDefaultIconResource() {
|
public int getDefaultIconResource() {
|
||||||
return R.drawable.ic_device_miband6;
|
return R.drawable.ic_device_miband6;
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
/* Copyright (C) 2022-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.miband7;
|
|
||||||
|
|
||||||
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.miband7.MiBand7FirmwareInfo;
|
|
||||||
|
|
||||||
public class MiBand7FWHelper extends HuamiFWHelper {
|
|
||||||
public MiBand7FWHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getMaxExpectedFileSize() {
|
|
||||||
return 1024 * 1024 * 32; // 32.0MB
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void determineFirmwareInfo(final byte[] wholeFirmwareBytes) {
|
|
||||||
firmwareInfo = new MiBand7FirmwareInfo(wholeFirmwareBytes);
|
|
||||||
if (!firmwareInfo.isHeaderValid()) {
|
|
||||||
throw new IllegalArgumentException("Not a Xiaomi Smart Band 7 firmware");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
/* Copyright (C) 2022-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.huami.miband7;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
|
||||||
|
|
||||||
class MiBand7FWInstallHandler extends AbstractZeppOsFwInstallHandler {
|
|
||||||
MiBand7FWInstallHandler(Uri uri, Context context) {
|
|
||||||
super(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getFwUpgradeNotice() {
|
|
||||||
return mContext.getString(R.string.fw_upgrade_notice_miband7, helper.getHumanFirmwareVersion());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected HuamiFWHelper createHelper(Uri uri, Context context) throws IOException {
|
|
||||||
return new MiBand7FWHelper(uri, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isSupportedDeviceType(GBDevice device) {
|
|
||||||
return device.getType() == DeviceType.MIBAND7;
|
|
||||||
}
|
|
||||||
}
|
|
@ -28,7 +28,11 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.activities.appmanager.AppManagerActivity;
|
import nodomain.freeyourgadget.gadgetbridge.activities.appmanager.AppManagerActivity;
|
||||||
@ -54,7 +58,9 @@ import nodomain.freeyourgadget.gadgetbridge.entities.HuamiSpo2SampleDao;
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.entities.HuamiStressSampleDao;
|
import nodomain.freeyourgadget.gadgetbridge.entities.HuamiStressSampleDao;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.ActivitySummaryParser;
|
import nodomain.freeyourgadget.gadgetbridge.model.ActivitySummaryParser;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.AbstractZeppOsFwInstallHandler;
|
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsFwInstallHandler;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsSupport;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.services.ZeppOsAlexaService;
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.services.ZeppOsAlexaService;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.services.ZeppOsContactsService;
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.services.ZeppOsContactsService;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.services.ZeppOsLogsService;
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.services.ZeppOsLogsService;
|
||||||
@ -69,7 +75,29 @@ import nodomain.freeyourgadget.gadgetbridge.util.FileUtils;
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
|
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
|
||||||
|
|
||||||
public abstract class ZeppOsCoordinator extends HuamiCoordinator {
|
public abstract class ZeppOsCoordinator extends HuamiCoordinator {
|
||||||
public abstract AbstractZeppOsFwInstallHandler createFwInstallHandler(final Uri uri, final Context context);
|
public abstract String getDeviceBluetoothName();
|
||||||
|
|
||||||
|
public abstract Set<Integer> getDeviceSources();
|
||||||
|
|
||||||
|
protected Map<Integer, String> getCrcMap() {
|
||||||
|
// A map from CRC16 to human-readable version for flashable files
|
||||||
|
return Collections.emptyMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final Pattern getSupportedDeviceName() {
|
||||||
|
// Most devices use the exact bluetooth name
|
||||||
|
// Some devices have a " XXXX" suffix with the last 4 digits of mac address (eg. Mi Band 7)
|
||||||
|
// *However*, some devices broadcast a 2nd bluetooth device with "-XXXX" suffix, which is only
|
||||||
|
// used for calls and Gadgetbridge can't use for pairing.
|
||||||
|
return Pattern.compile("^" + getDeviceBluetoothName() + "( [A-Z0-9]{4})?$");
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public final Class<? extends DeviceSupport> getDeviceSupportClass() {
|
||||||
|
return ZeppOsSupport.class;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InstallHandler findInstallHandler(final Uri uri, final Context context) {
|
public InstallHandler findInstallHandler(final Uri uri, final Context context) {
|
||||||
@ -87,7 +115,12 @@ public abstract class ZeppOsCoordinator extends HuamiCoordinator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final AbstractZeppOsFwInstallHandler handler = createFwInstallHandler(uri, context);
|
final ZeppOsFwInstallHandler handler = new ZeppOsFwInstallHandler(
|
||||||
|
uri,
|
||||||
|
context,
|
||||||
|
getDeviceBluetoothName(),
|
||||||
|
getDeviceSources()
|
||||||
|
);
|
||||||
return handler.isValid() ? handler : null;
|
return handler.isValid() ? handler : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,453 @@
|
|||||||
|
/* Copyright (C) 2024 José Rebelo
|
||||||
|
|
||||||
|
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 <https://www.gnu.org/licenses/>. */
|
||||||
|
package nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppos;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.BitmapFactory;
|
||||||
|
import android.net.Uri;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.zip.CRC32;
|
||||||
|
import java.util.zip.ZipEntry;
|
||||||
|
import java.util.zip.ZipException;
|
||||||
|
import java.util.zip.ZipFile;
|
||||||
|
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceApp;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.HuamiFirmwareType;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.util.BitmapUtil;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.util.CheckSums;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.util.GBZipFile;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.util.UriHelper;
|
||||||
|
|
||||||
|
public class ZeppOsFwHelper {
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(ZeppOsFwHelper.class);
|
||||||
|
|
||||||
|
private final Uri uri;
|
||||||
|
private final Context context;
|
||||||
|
private final String deviceName;
|
||||||
|
private final Set<Integer> deviceSources;
|
||||||
|
|
||||||
|
private HuamiFirmwareType firmwareType = HuamiFirmwareType.INVALID;
|
||||||
|
private File file = null;
|
||||||
|
private int crc32;
|
||||||
|
private String version = "Unknown";
|
||||||
|
private GBDeviceApp gbDeviceApp = null;
|
||||||
|
|
||||||
|
public ZeppOsFwHelper(final Uri uri, final Context context, final String deviceName, final Set<Integer> deviceSources) {
|
||||||
|
this.uri = uri;
|
||||||
|
this.context = context;
|
||||||
|
this.deviceName = deviceName;
|
||||||
|
this.deviceSources = deviceSources;
|
||||||
|
|
||||||
|
processUri();
|
||||||
|
}
|
||||||
|
|
||||||
|
public HuamiFirmwareType getFirmwareType() {
|
||||||
|
return firmwareType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFirmwareVersion() {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public File getFile() {
|
||||||
|
if (file == null) {
|
||||||
|
throw new IllegalStateException("file is null");
|
||||||
|
}
|
||||||
|
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSize() {
|
||||||
|
if (file == null) {
|
||||||
|
throw new IllegalStateException("file is null");
|
||||||
|
}
|
||||||
|
|
||||||
|
return (int) file.length();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCrc32() {
|
||||||
|
return crc32;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processUri() {
|
||||||
|
// Copy file to cache first
|
||||||
|
final File cacheDir = context.getCacheDir();
|
||||||
|
final File zpkCacheDir = new File(cacheDir, "zeppos");
|
||||||
|
zpkCacheDir.mkdir();
|
||||||
|
|
||||||
|
try {
|
||||||
|
file = File.createTempFile("fwhelper","bin", context.getCacheDir());
|
||||||
|
file.deleteOnExit();
|
||||||
|
} catch (final IOException e) {
|
||||||
|
LOG.error("Failed to create temp file for zpk", e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final UriHelper uriHelper;
|
||||||
|
try {
|
||||||
|
uriHelper = UriHelper.get(uri, context);
|
||||||
|
} catch (final IOException e) {
|
||||||
|
LOG.error("Failed to get uri helper", e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final CRC32 crc = new CRC32();
|
||||||
|
try (FileOutputStream outputStream = new FileOutputStream(file);
|
||||||
|
InputStream inputStream = uriHelper.openInputStream()) {
|
||||||
|
final byte[] buffer = new byte[64 * 1024];
|
||||||
|
int len;
|
||||||
|
while ((len = inputStream.read(buffer)) != -1) {
|
||||||
|
outputStream.write(buffer, 0, len);
|
||||||
|
crc.update(buffer, 0, len);
|
||||||
|
}
|
||||||
|
crc32 = (int) crc.getValue();
|
||||||
|
} catch (final IOException e) {
|
||||||
|
LOG.error("Failed to write bytes to temporary file", e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try (ZipFile zipFile = new ZipFile(file, java.util.zip.ZipFile.OPEN_READ)) {
|
||||||
|
processZipFile(zipFile);
|
||||||
|
} catch (final ZipException e) {
|
||||||
|
LOG.warn("{} is not a valid zip file", uri, e);
|
||||||
|
} catch (final IOException e) {
|
||||||
|
LOG.warn("Error while processing {}", uri, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO process as UIHH
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processZipFile(final ZipFile zipFile) {
|
||||||
|
// Attempt to handle as a firmware
|
||||||
|
final byte[] firmwareBin = getFileFromZip(zipFile, "META/firmware.bin");
|
||||||
|
if (firmwareBin != null) {
|
||||||
|
if (isCompatibleFirmwareBin(firmwareBin)) {
|
||||||
|
firmwareType = HuamiFirmwareType.FIRMWARE;
|
||||||
|
final JSONObject fwInfoRoot = getJson(zipFile, "META/fw_info");
|
||||||
|
if (fwInfoRoot != null) {
|
||||||
|
final JSONArray fwInfoArr = fwInfoRoot.optJSONArray("fw_info");
|
||||||
|
if (fwInfoArr != null) {
|
||||||
|
for (int i = 0; i < fwInfoArr.length(); i++) {
|
||||||
|
final JSONObject fwInfo = fwInfoArr.optJSONObject(i);
|
||||||
|
if (fwInfo == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("firmware".equals(fwInfo.optString("name"))) {
|
||||||
|
version = fwInfo.optString("version");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
version = getFirmwareVersion(firmwareBin);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
firmwareType = HuamiFirmwareType.INVALID;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attempt to handle as an app / watchface
|
||||||
|
final JSONObject appJson = getJson(zipFile, "app.json");
|
||||||
|
if (appJson != null) {
|
||||||
|
final int appId;
|
||||||
|
final String appName;
|
||||||
|
final String appVersion;
|
||||||
|
final String appType;
|
||||||
|
final String appCreator;
|
||||||
|
final String appIconPath;
|
||||||
|
final JSONObject appJsonApp;
|
||||||
|
try {
|
||||||
|
appJsonApp = appJson.getJSONObject("app");
|
||||||
|
appId = appJsonApp.getInt("appId");
|
||||||
|
appName = appJsonApp.getString("appName");
|
||||||
|
appVersion = appJsonApp.getJSONObject("version").getString("name");
|
||||||
|
appType = appJsonApp.getString("appType");
|
||||||
|
appCreator = appJsonApp.getString("vender");
|
||||||
|
appIconPath = appJsonApp.getString("icon");
|
||||||
|
} catch (final Exception e) {
|
||||||
|
LOG.error("Failed to get appType from app.json", e);
|
||||||
|
firmwareType = HuamiFirmwareType.INVALID;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final GBDeviceApp.Type gbDeviceAppType;
|
||||||
|
switch (appType) {
|
||||||
|
case "watchface":
|
||||||
|
firmwareType = HuamiFirmwareType.WATCHFACE;
|
||||||
|
gbDeviceAppType = GBDeviceApp.Type.WATCHFACE;
|
||||||
|
version = String.format("%s (watchface)", appName);
|
||||||
|
break;
|
||||||
|
case "app":
|
||||||
|
firmwareType = HuamiFirmwareType.APP;
|
||||||
|
gbDeviceAppType = GBDeviceApp.Type.APP_GENERIC;
|
||||||
|
version = String.format("%s (app)", appName);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
LOG.warn("Unknown app type {}", appType);
|
||||||
|
firmwareType = HuamiFirmwareType.INVALID;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Bitmap icon = null;
|
||||||
|
final byte[] iconBytes = getFileFromZip(zipFile, "assets/" + appIconPath);
|
||||||
|
if (iconBytes != null) {
|
||||||
|
if (BitmapUtil.isPng(iconBytes)) {
|
||||||
|
icon = BitmapFactory.decodeByteArray(iconBytes, 0, iconBytes.length);
|
||||||
|
} else {
|
||||||
|
icon = BitmapUtil.decodeTga(iconBytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gbDeviceApp = new GBDeviceApp(
|
||||||
|
UUID.fromString(String.format("%08x-0000-0000-0000-000000000000", appId)),
|
||||||
|
appName,
|
||||||
|
appCreator,
|
||||||
|
appVersion,
|
||||||
|
gbDeviceAppType,
|
||||||
|
icon
|
||||||
|
);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attempt to handle as a zab file
|
||||||
|
final byte[] zpkBytes = handleZabPackage(zipFile);
|
||||||
|
if (zpkBytes != null) {
|
||||||
|
final File cacheDir = context.getCacheDir();
|
||||||
|
final File zpkCacheDir = new File(cacheDir, "zpk");
|
||||||
|
zpkCacheDir.mkdir();
|
||||||
|
|
||||||
|
final File zpkFile;
|
||||||
|
try {
|
||||||
|
zpkFile = File.createTempFile("zpk","zip", context.getCacheDir());
|
||||||
|
zpkFile.deleteOnExit();
|
||||||
|
} catch (final IOException e) {
|
||||||
|
LOG.error("Failed to create temp file for zpk", e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try (FileOutputStream outputStream = new FileOutputStream(zpkFile)) {
|
||||||
|
outputStream.write(zpkBytes);
|
||||||
|
} catch (final IOException e) {
|
||||||
|
LOG.error("Failed to write zpk bytes to temporary file", e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try (ZipFile zpkZpkFile = new ZipFile(zpkFile, java.util.zip.ZipFile.OPEN_READ)) {
|
||||||
|
processZipFile(zpkZpkFile);
|
||||||
|
} catch (final ZipException e) {
|
||||||
|
LOG.warn("{} is not a valid zip file", uri, e);
|
||||||
|
} catch (final IOException e) {
|
||||||
|
LOG.warn("Error while processing {}", uri, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (firmwareType != HuamiFirmwareType.INVALID) {
|
||||||
|
file = zpkFile;
|
||||||
|
crc32 = CheckSums.getCRC32(zpkBytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A zab package is a zip file with:
|
||||||
|
* - manifest.json
|
||||||
|
* - .sc (source code)
|
||||||
|
* - One or more zpk files
|
||||||
|
* <p>
|
||||||
|
* Right now, we only handle the first compatible zpk file that is supported by the connected device.
|
||||||
|
*/
|
||||||
|
private byte[] handleZabPackage(final ZipFile zipFile) {
|
||||||
|
final JSONObject manifest = getJson(zipFile, "manifest.json");
|
||||||
|
if (manifest == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
final JSONArray zpks;
|
||||||
|
try {
|
||||||
|
zpks = manifest.getJSONArray("zpks");
|
||||||
|
} catch (final Exception e) {
|
||||||
|
LOG.error("Failed to get zpks from manifest.json", e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Iterate all zpks until a compatible one is found
|
||||||
|
for (int i = 0; i < zpks.length(); i++) {
|
||||||
|
try {
|
||||||
|
final JSONObject zpkEntry = zpks.getJSONObject(i);
|
||||||
|
final JSONArray platforms = zpkEntry.getJSONArray("platforms");
|
||||||
|
|
||||||
|
// Check if this zpk is compatible with the current device
|
||||||
|
for (int j = 0; j < platforms.length(); j++) {
|
||||||
|
final JSONObject platform = platforms.getJSONObject(j);
|
||||||
|
|
||||||
|
if (deviceSources.contains(platform.getInt("deviceSource"))) {
|
||||||
|
// It's compatible with the device, fetch device.zip
|
||||||
|
final String name = zpkEntry.getString("name");
|
||||||
|
final byte[] zpkBytes = getFileFromZip(zipFile, name);
|
||||||
|
if (!GBZipFile.isZipFile(zpkBytes)) {
|
||||||
|
LOG.warn("bytes for {} not a zip file", name);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
final GBZipFile zpkFile = new GBZipFile(zpkBytes);
|
||||||
|
final byte[] deviceZip = zpkFile.getFileFromZip("device.zip");
|
||||||
|
if (!GBZipFile.isZipFile(zpkBytes)) {
|
||||||
|
LOG.warn("bytes for device.zip of zpk {} not a zip file", name);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return deviceZip;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (final Exception e) {
|
||||||
|
LOG.warn("Failed to parse zpk", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG.warn("No compatible zpk found in zab file");
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public GBDeviceApp getAppInfo() {
|
||||||
|
return gbDeviceApp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isValid() {
|
||||||
|
return firmwareType != HuamiFirmwareType.INVALID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public Bitmap getPreview() {
|
||||||
|
if (gbDeviceApp != null) {
|
||||||
|
return gbDeviceApp.getPreviewImage();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isCompatibleFirmwareBin(final byte[] firmwareBin) {
|
||||||
|
if (firmwareBin == null) {
|
||||||
|
LOG.error("firmware bin is null");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!searchString(firmwareBin, deviceName)) {
|
||||||
|
LOG.warn("Failed to find {} in fwBytes", deviceName);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getFirmwareVersion(final byte[] firmwareBin) {
|
||||||
|
int startIdx = 10;
|
||||||
|
int endIdx = -1;
|
||||||
|
|
||||||
|
for (int i = startIdx; i < startIdx + 20; i++) {
|
||||||
|
byte c = firmwareBin[i];
|
||||||
|
|
||||||
|
if (c == 0) {
|
||||||
|
endIdx = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (c != '.' && (c < '0' || c > '9')) {
|
||||||
|
// not a valid version character
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (endIdx == -1) {
|
||||||
|
LOG.warn("Failed to find firmware version in expected offset");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new String(Arrays.copyOfRange(firmwareBin, startIdx, endIdx));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private static JSONObject getJson(final ZipFile zipFile, final String path) {
|
||||||
|
final byte[] appJsonBin = getFileFromZip(zipFile, path);
|
||||||
|
if (appJsonBin == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
final String appJsonString = new String(appJsonBin, StandardCharsets.UTF_8)
|
||||||
|
// Remove UTF-8 BOM if present
|
||||||
|
.replace("\uFEFF", "");
|
||||||
|
return new JSONObject(appJsonString);
|
||||||
|
} catch (final Exception e) {
|
||||||
|
LOG.error("Failed to parse " + path, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private static byte[] getFileFromZip(final ZipFile zipFile, final String path) {
|
||||||
|
try {
|
||||||
|
final ZipEntry entry = zipFile.getEntry(path);
|
||||||
|
if (entry == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return GBZipFile.readAllBytes(zipFile.getInputStream(entry));
|
||||||
|
} catch (final IOException e) {
|
||||||
|
LOG.error("Failed to read " + path, e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean searchString(final byte[] fwBytes, final String str) {
|
||||||
|
final byte[] strBytes = (str + "\0").getBytes(StandardCharsets.UTF_8);
|
||||||
|
|
||||||
|
for (int i = 0; i < fwBytes.length - strBytes.length + 1; i++) {
|
||||||
|
boolean found = true;
|
||||||
|
for (int j = 0; j < strBytes.length; j++) {
|
||||||
|
if (fwBytes[i + j] != strBytes[j]) {
|
||||||
|
found = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (found) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -79,7 +79,7 @@ public abstract class HuaweiBRCoordinator extends AbstractBLClassicDeviceCoordin
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getBondingStyle(){
|
public int getBondingStyle(){
|
||||||
return BONDING_STYLE_NONE;
|
return BONDING_STYLE_ASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -54,11 +54,6 @@ public class HonorMagicWatch2Coordinator extends HuaweiBRCoordinator {
|
|||||||
return Pattern.compile(HuaweiConstants.HO_MAGICWATCH2_NAME + ".*", Pattern.CASE_INSENSITIVE);
|
return Pattern.compile(HuaweiConstants.HO_MAGICWATCH2_NAME + ".*", Pattern.CASE_INSENSITIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getBondingStyle(){
|
|
||||||
return BONDING_STYLE_ASK;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsSpo2() {
|
public boolean supportsSpo2() {
|
||||||
return true;
|
return true;
|
||||||
|
@ -16,8 +16,6 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.pinetime;
|
package nodomain.freeyourgadget.gadgetbridge.devices.pinetime;
|
||||||
|
|
||||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
|
||||||
@ -38,7 +36,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.GenericItem;
|
import nodomain.freeyourgadget.gadgetbridge.model.GenericItem;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.UriHelper;
|
import nodomain.freeyourgadget.gadgetbridge.util.UriHelper;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.ZipFile;
|
import nodomain.freeyourgadget.gadgetbridge.util.GBZipFile;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.ZipFileException;
|
import nodomain.freeyourgadget.gadgetbridge.util.ZipFileException;
|
||||||
|
|
||||||
public class PineTimeInstallHandler implements InstallHandler {
|
public class PineTimeInstallHandler implements InstallHandler {
|
||||||
@ -57,7 +55,7 @@ public class PineTimeInstallHandler implements InstallHandler {
|
|||||||
try {
|
try {
|
||||||
uriHelper = UriHelper.get(uri, this.context);
|
uriHelper = UriHelper.get(uri, this.context);
|
||||||
|
|
||||||
ZipFile dfuPackage = new ZipFile(uriHelper.openInputStream());
|
GBZipFile dfuPackage = new GBZipFile(uriHelper.openInputStream());
|
||||||
String manifest = new String(dfuPackage.getFileFromZip("manifest.json"));
|
String manifest = new String(dfuPackage.getFileFromZip("manifest.json"));
|
||||||
|
|
||||||
if (!manifest.trim().isEmpty()) {
|
if (!manifest.trim().isEmpty()) {
|
||||||
|
@ -16,9 +16,7 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami;
|
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami;
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiService;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
|
import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsSupport;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.miband.operations.AbstractMiBandOperation;
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.miband.operations.AbstractMiBandOperation;
|
||||||
|
|
||||||
public abstract class AbstractHuamiOperation extends AbstractMiBandOperation<HuamiSupport> {
|
public abstract class AbstractHuamiOperation extends AbstractMiBandOperation<HuamiSupport> {
|
||||||
@ -31,9 +29,5 @@ public abstract class AbstractHuamiOperation extends AbstractMiBandOperation<Hua
|
|||||||
// TODO: check which notifications we should disable and re-enable here
|
// TODO: check which notifications we should disable and re-enable here
|
||||||
// builder.notify(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_REALTIME_STEPS), enable)
|
// builder.notify(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_REALTIME_STEPS), enable)
|
||||||
// .notify(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_SENSOR_DATA), enable);
|
// .notify(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_SENSOR_DATA), enable);
|
||||||
if (getSupport() instanceof ZeppOsSupport) {
|
|
||||||
// Disable 2021 chunked reads, otherwise firmware upgrades and activity sync get interrupted
|
|
||||||
builder.notify(getCharacteristic(HuamiService.UUID_CHARACTERISTIC_CHUNKEDTRANSFER_2021_READ), enable);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,35 +16,47 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami;
|
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami;
|
||||||
|
|
||||||
|
import androidx.annotation.StringRes;
|
||||||
|
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
|
|
||||||
public enum HuamiFirmwareType {
|
public enum HuamiFirmwareType {
|
||||||
FIRMWARE((byte) 0),
|
FIRMWARE((byte) 0, R.string.kind_firmware),
|
||||||
CHANGELOG_TXT((byte) 16),
|
CHANGELOG_TXT((byte) 16, R.string.action_changelog),
|
||||||
// MB7 firmwares are sent as UIHH packing FIRMWARE (zip) + CHANGELOG_TXT, type 0xfd
|
// MB7 firmwares are sent as UIHH packing FIRMWARE (zip) + CHANGELOG_TXT, type 0xfd
|
||||||
FIRMWARE_UIHH_2021_ZIP_WITH_CHANGELOG((byte) -3),
|
FIRMWARE_UIHH_2021_ZIP_WITH_CHANGELOG((byte) -3, R.string.kind_firmware),
|
||||||
FONT((byte) 1),
|
FONT((byte) 1, R.string.kind_font),
|
||||||
RES((byte) 2),
|
RES((byte) 2, R.string.kind_resources),
|
||||||
RES_COMPRESSED((byte) 130),
|
RES_COMPRESSED((byte) 130, R.string.kind_resources),
|
||||||
GPS((byte) 3),
|
GPS((byte) 3, R.string.kind_gps),
|
||||||
GPS_CEP((byte) 4),
|
GPS_CEP((byte) 4, R.string.kind_gps_cep),
|
||||||
AGPS_UIHH((byte) -4),
|
AGPS_UIHH((byte) -4, R.string.kind_agps_bundle),
|
||||||
GPS_ALMANAC((byte) 5),
|
GPS_ALMANAC((byte) 5, R.string.kind_gps_almanac),
|
||||||
WATCHFACE((byte) 8),
|
WATCHFACE((byte) 8, R.string.kind_watchface),
|
||||||
APP((byte) 8),
|
APP((byte) 8, R.string.kind_app),
|
||||||
FONT_LATIN((byte) 11),
|
FONT_LATIN((byte) 11, R.string.kind_font),
|
||||||
ZEPPOS_UNKNOWN_0X13((byte) 0x13),
|
ZEPPOS_UNKNOWN_0X13((byte) 0x13, R.string.unknown),
|
||||||
ZEPPOS_APP((byte) 0xa0),
|
ZEPPOS_APP((byte) 0xa0, R.string.kind_app),
|
||||||
INVALID(Byte.MIN_VALUE);
|
INVALID(Byte.MIN_VALUE, R.string.kind_invalid),
|
||||||
|
;
|
||||||
|
|
||||||
private final byte value;
|
private final byte value;
|
||||||
|
private final int nameResId;
|
||||||
|
|
||||||
HuamiFirmwareType(byte value) {
|
HuamiFirmwareType(byte value, int nameResId) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
|
this.nameResId = nameResId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte getValue() {
|
public byte getValue() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@StringRes
|
||||||
|
public int getNameResId() {
|
||||||
|
return nameResId;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isApp() {
|
public boolean isApp() {
|
||||||
return this == APP || this == ZEPPOS_APP;
|
return this == APP || this == ZEPPOS_APP;
|
||||||
}
|
}
|
||||||
|
@ -2272,9 +2272,12 @@ public abstract class HuamiSupport extends AbstractBTLEDeviceSupport implements
|
|||||||
@Override
|
@Override
|
||||||
public boolean onCharacteristicChanged(BluetoothGatt gatt,
|
public boolean onCharacteristicChanged(BluetoothGatt gatt,
|
||||||
BluetoothGattCharacteristic characteristic) {
|
BluetoothGattCharacteristic characteristic) {
|
||||||
super.onCharacteristicChanged(gatt, characteristic);
|
if (super.onCharacteristicChanged(gatt, characteristic)) {
|
||||||
|
// handled upstream
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
UUID characteristicUUID = characteristic.getUuid();
|
final UUID characteristicUUID = characteristic.getUuid();
|
||||||
if (HuamiService.UUID_CHARACTERISTIC_6_BATTERY_INFO.equals(characteristicUUID)) {
|
if (HuamiService.UUID_CHARACTERISTIC_6_BATTERY_INFO.equals(characteristicUUID)) {
|
||||||
handleBatteryInfo(characteristic.getValue(), BluetoothGatt.GATT_SUCCESS);
|
handleBatteryInfo(characteristic.getValue(), BluetoothGatt.GATT_SUCCESS);
|
||||||
return true;
|
return true;
|
||||||
@ -2317,7 +2320,10 @@ public abstract class HuamiSupport extends AbstractBTLEDeviceSupport implements
|
|||||||
@Override
|
@Override
|
||||||
public boolean onCharacteristicRead(BluetoothGatt gatt,
|
public boolean onCharacteristicRead(BluetoothGatt gatt,
|
||||||
BluetoothGattCharacteristic characteristic, int status) {
|
BluetoothGattCharacteristic characteristic, int status) {
|
||||||
super.onCharacteristicRead(gatt, characteristic, status);
|
if (super.onCharacteristicRead(gatt, characteristic, status)) {
|
||||||
|
// handled upstream
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
UUID characteristicUUID = characteristic.getUuid();
|
UUID characteristicUUID = characteristic.getUuid();
|
||||||
if (GattCharacteristic.UUID_CHARACTERISTIC_DEVICE_NAME.equals(characteristicUUID)) {
|
if (GattCharacteristic.UUID_CHARACTERISTIC_DEVICE_NAME.equals(characteristicUUID)) {
|
||||||
|
@ -1,58 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitactive;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsFirmwareInfo;
|
|
||||||
|
|
||||||
public class AmazfitActiveFirmwareInfo extends ZeppOsFirmwareInfo {
|
|
||||||
private static final Map<Integer, String> crcToVersion = new HashMap<Integer, String>() {{
|
|
||||||
// firmware
|
|
||||||
}};
|
|
||||||
|
|
||||||
public AmazfitActiveFirmwareInfo(final byte[] bytes) {
|
|
||||||
super(bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String deviceName() {
|
|
||||||
return HuamiConst.AMAZFIT_ACTIVE_NAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<Integer> deviceSources() {
|
|
||||||
return new HashSet<>(Arrays.asList(8323328));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isGenerallyCompatibleWith(final GBDevice device) {
|
|
||||||
return isHeaderValid() && device.getType() == DeviceType.AMAZFITACTIVE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Map<Integer, String> getCrcMap() {
|
|
||||||
return crcToVersion;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitactive;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitactive.AmazfitActiveFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsSupport;
|
|
||||||
|
|
||||||
public class AmazfitActiveSupport extends ZeppOsSupport {
|
|
||||||
@Override
|
|
||||||
public HuamiFWHelper createFWHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
return new AmazfitActiveFWHelper(uri, context);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitactiveedge;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsFirmwareInfo;
|
|
||||||
|
|
||||||
public class AmazfitActiveEdgeFirmwareInfo extends ZeppOsFirmwareInfo {
|
|
||||||
private static final Map<Integer, String> crcToVersion = new HashMap<Integer, String>() {{
|
|
||||||
// firmware
|
|
||||||
}};
|
|
||||||
|
|
||||||
public AmazfitActiveEdgeFirmwareInfo(final byte[] bytes) {
|
|
||||||
super(bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String deviceName() {
|
|
||||||
return HuamiConst.AMAZFIT_ACTIVE_NAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<Integer> deviceSources() {
|
|
||||||
return new HashSet<>(Arrays.asList(8388864, 8388865));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isGenerallyCompatibleWith(final GBDevice device) {
|
|
||||||
return isHeaderValid() && device.getType() == DeviceType.AMAZFITACTIVEEDGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Map<Integer, String> getCrcMap() {
|
|
||||||
return crcToVersion;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitactiveedge;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitactiveedge.AmazfitActiveEdgeFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsSupport;
|
|
||||||
|
|
||||||
public class AmazfitActiveEdgeSupport extends ZeppOsSupport {
|
|
||||||
@Override
|
|
||||||
public HuamiFWHelper createFWHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
return new AmazfitActiveEdgeFWHelper(uri, context);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 Maxime Reyrolle
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbalance;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsFirmwareInfo;
|
|
||||||
|
|
||||||
public class AmazfitBalanceFirmwareInfo extends ZeppOsFirmwareInfo {
|
|
||||||
private static final Map<Integer, String> crcToVersion = new HashMap<Integer, String>() {{
|
|
||||||
// firmware
|
|
||||||
}};
|
|
||||||
|
|
||||||
public AmazfitBalanceFirmwareInfo(final byte[] bytes) {
|
|
||||||
super(bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String deviceName() {
|
|
||||||
return HuamiConst.AMAZFIT_BALANCE_NAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<Integer> deviceSources() {
|
|
||||||
return new HashSet<>(Arrays.asList(8519936, 8519937, 8519939));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isGenerallyCompatibleWith(final GBDevice device) {
|
|
||||||
return isHeaderValid() && device.getType() == DeviceType.AMAZFITBALANCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Map<Integer, String> getCrcMap() {
|
|
||||||
return crcToVersion;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 Maxime Reyrolle
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbalance;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbalance.AmazfitBalanceFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsSupport;
|
|
||||||
|
|
||||||
public class AmazfitBalanceSupport extends ZeppOsSupport {
|
|
||||||
@Override
|
|
||||||
public HuamiFWHelper createFWHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
return new AmazfitBalanceFWHelper(uri, context);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,57 +0,0 @@
|
|||||||
/* Copyright (C) 2022-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitband7;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsFirmwareInfo;
|
|
||||||
|
|
||||||
public class AmazfitBand7FirmwareInfo extends ZeppOsFirmwareInfo {
|
|
||||||
private static final Map<Integer, String> crcToVersion = new HashMap<Integer, String>() {{
|
|
||||||
}};
|
|
||||||
|
|
||||||
public AmazfitBand7FirmwareInfo(final byte[] bytes) {
|
|
||||||
super(bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String deviceName() {
|
|
||||||
return HuamiConst.AMAZFIT_BAND7_NAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<Integer> deviceSources() {
|
|
||||||
return new HashSet<>(Arrays.asList(252, 253, 254));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isGenerallyCompatibleWith(final GBDevice device) {
|
|
||||||
return isHeaderValid() && device.getType() == DeviceType.AMAZFITBAND7;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Map<Integer, String> getCrcMap() {
|
|
||||||
return crcToVersion;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
/* Copyright (C) 2022-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitband7;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitband7.AmazfitBand7FWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsSupport;
|
|
||||||
|
|
||||||
public class AmazfitBand7Support extends ZeppOsSupport {
|
|
||||||
@Override
|
|
||||||
public HuamiFWHelper createFWHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
return new AmazfitBand7FWHelper(uri, context);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip5;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsFirmwareInfo;
|
|
||||||
|
|
||||||
public class AmazfitBip5FirmwareInfo extends ZeppOsFirmwareInfo {
|
|
||||||
private static final Map<Integer, String> crcToVersion = new HashMap<Integer, String>() {{
|
|
||||||
// firmware
|
|
||||||
}};
|
|
||||||
|
|
||||||
public AmazfitBip5FirmwareInfo(final byte[] bytes) {
|
|
||||||
super(bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String deviceName() {
|
|
||||||
return HuamiConst.AMAZFIT_BIP5_NAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<Integer> deviceSources() {
|
|
||||||
return new HashSet<>(Arrays.asList(8454400, 8454401));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isGenerallyCompatibleWith(final GBDevice device) {
|
|
||||||
return isHeaderValid() && device.getType() == DeviceType.AMAZFITBIP5;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Map<Integer, String> getCrcMap() {
|
|
||||||
return crcToVersion;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip5;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbip5.AmazfitBip5FWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsSupport;
|
|
||||||
|
|
||||||
public class AmazfitBip5Support extends ZeppOsSupport {
|
|
||||||
@Override
|
|
||||||
public HuamiFWHelper createFWHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
return new AmazfitBip5FWHelper(uri, context);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 Raghd Hamzeh
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitcheetahpro;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsFirmwareInfo;
|
|
||||||
|
|
||||||
public class AmazfitCheetahProFirmwareInfo extends ZeppOsFirmwareInfo {
|
|
||||||
private static final Map<Integer, String> crcToVersion = new HashMap<Integer, String>() {{
|
|
||||||
// firmware
|
|
||||||
}};
|
|
||||||
|
|
||||||
public AmazfitCheetahProFirmwareInfo(final byte[] bytes) {
|
|
||||||
super(bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String deviceName() {
|
|
||||||
return HuamiConst.AMAZFIT_CHEETAH_PRO_NAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<Integer> deviceSources() {
|
|
||||||
return new HashSet<>(Arrays.asList(8126720, 8126721));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isGenerallyCompatibleWith(final GBDevice device) {
|
|
||||||
return isHeaderValid() && device.getType() == DeviceType.AMAZFITCHEETAHPRO;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Map<Integer, String> getCrcMap() {
|
|
||||||
return crcToVersion;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 Raghd Hamzeh
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitcheetahpro;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitcheetahpro.AmazfitCheetahProFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsSupport;
|
|
||||||
|
|
||||||
public class AmazfitCheetahProSupport extends ZeppOsSupport {
|
|
||||||
@Override
|
|
||||||
public HuamiFWHelper createFWHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
return new AmazfitCheetahProFWHelper(uri, context);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitcheetahround;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsFirmwareInfo;
|
|
||||||
|
|
||||||
public class AmazfitCheetahRoundFirmwareInfo extends ZeppOsFirmwareInfo {
|
|
||||||
private static final Map<Integer, String> crcToVersion = new HashMap<Integer, String>() {{
|
|
||||||
// firmware
|
|
||||||
}};
|
|
||||||
|
|
||||||
public AmazfitCheetahRoundFirmwareInfo(final byte[] bytes) {
|
|
||||||
super(bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String deviceName() {
|
|
||||||
return HuamiConst.AMAZFIT_CHEETAH_ROUND_NAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<Integer> deviceSources() {
|
|
||||||
return new HashSet<>(Arrays.asList(8192256, 8192257));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isGenerallyCompatibleWith(final GBDevice device) {
|
|
||||||
return isHeaderValid() && device.getType() == DeviceType.AMAZFITCHEETAHROUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Map<Integer, String> getCrcMap() {
|
|
||||||
return crcToVersion;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitcheetahround;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitcheetahround.AmazfitCheetahRoundFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsSupport;
|
|
||||||
|
|
||||||
public class AmazfitCheetahRoundSupport extends ZeppOsSupport {
|
|
||||||
@Override
|
|
||||||
public HuamiFWHelper createFWHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
return new AmazfitCheetahRoundFWHelper(uri, context);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitcheetahsquare;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsFirmwareInfo;
|
|
||||||
|
|
||||||
public class AmazfitCheetahSquareFirmwareInfo extends ZeppOsFirmwareInfo {
|
|
||||||
private static final Map<Integer, String> crcToVersion = new HashMap<Integer, String>() {{
|
|
||||||
// firmware
|
|
||||||
}};
|
|
||||||
|
|
||||||
public AmazfitCheetahSquareFirmwareInfo(final byte[] bytes) {
|
|
||||||
super(bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String deviceName() {
|
|
||||||
return HuamiConst.AMAZFIT_CHEETAH_SQUARE_NAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<Integer> deviceSources() {
|
|
||||||
return new HashSet<>(Collections.singletonList(8257793));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isGenerallyCompatibleWith(final GBDevice device) {
|
|
||||||
return isHeaderValid() && device.getType() == DeviceType.AMAZFITCHEETAHSQUARE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Map<Integer, String> getCrcMap() {
|
|
||||||
return crcToVersion;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitcheetahsquare;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitcheetahsquare.AmazfitCheetahSquareFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsSupport;
|
|
||||||
|
|
||||||
public class AmazfitCheetahSquareSupport extends ZeppOsSupport {
|
|
||||||
@Override
|
|
||||||
public HuamiFWHelper createFWHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
return new AmazfitCheetahSquareFWHelper(uri, context);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitfalcon;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsFirmwareInfo;
|
|
||||||
|
|
||||||
public class AmazfitFalconFirmwareInfo extends ZeppOsFirmwareInfo {
|
|
||||||
private static final Map<Integer, String> crcToVersion = new HashMap<Integer, String>() {{
|
|
||||||
// firmware
|
|
||||||
}};
|
|
||||||
|
|
||||||
public AmazfitFalconFirmwareInfo(final byte[] bytes) {
|
|
||||||
super(bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String deviceName() {
|
|
||||||
return HuamiConst.AMAZFIT_FALCON_NAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<Integer> deviceSources() {
|
|
||||||
return new HashSet<>(Arrays.asList(414, 415));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isGenerallyCompatibleWith(final GBDevice device) {
|
|
||||||
return isHeaderValid() && device.getType() == DeviceType.AMAZFITFALCON;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Map<Integer, String> getCrcMap() {
|
|
||||||
return crcToVersion;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitfalcon;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitfalcon.AmazfitFalconFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsSupport;
|
|
||||||
|
|
||||||
public class AmazfitFalconSupport extends ZeppOsSupport {
|
|
||||||
@Override
|
|
||||||
public HuamiFWHelper createFWHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
return new AmazfitFalconFWHelper(uri, context);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,63 +0,0 @@
|
|||||||
/* Copyright (C) 2022-2024 José Rebelo, thermatk
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgtr3;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsFirmwareInfo;
|
|
||||||
|
|
||||||
public class AmazfitGTR3FirmwareInfo extends ZeppOsFirmwareInfo {
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTR3FirmwareInfo.class);
|
|
||||||
|
|
||||||
private static final Map<Integer, String> crcToVersion = new HashMap<Integer, String>() {{
|
|
||||||
// firmware
|
|
||||||
}};
|
|
||||||
|
|
||||||
public AmazfitGTR3FirmwareInfo(final byte[] bytes) {
|
|
||||||
super(bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String deviceName() {
|
|
||||||
return HuamiConst.AMAZFIT_GTR3_NAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<Integer> deviceSources() {
|
|
||||||
return new HashSet<>(Arrays.asList(226, 227));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isGenerallyCompatibleWith(final GBDevice device) {
|
|
||||||
return isHeaderValid() && device.getType() == DeviceType.AMAZFITGTR3;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Map<Integer, String> getCrcMap() {
|
|
||||||
return crcToVersion;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
/* Copyright (C) 2022-2024 José Rebelo, thermatk
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgtr3;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr3.AmazfitGTR3FWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsSupport;
|
|
||||||
|
|
||||||
public class AmazfitGTR3Support extends ZeppOsSupport {
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTR3Support.class);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HuamiFWHelper createFWHelper(Uri uri, Context context) throws IOException {
|
|
||||||
return new AmazfitGTR3FWHelper(uri, context);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,63 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgtr3pro;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsFirmwareInfo;
|
|
||||||
|
|
||||||
public class AmazfitGTR3ProFirmwareInfo extends ZeppOsFirmwareInfo {
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTR3ProFirmwareInfo.class);
|
|
||||||
|
|
||||||
private static final Map<Integer, String> crcToVersion = new HashMap<Integer, String>() {{
|
|
||||||
// firmware
|
|
||||||
}};
|
|
||||||
|
|
||||||
public AmazfitGTR3ProFirmwareInfo(final byte[] bytes) {
|
|
||||||
super(bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String deviceName() {
|
|
||||||
return HuamiConst.AMAZFIT_GTR3_PRO_NAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<Integer> deviceSources() {
|
|
||||||
return new HashSet<>(Arrays.asList(229, 230, 6095106));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isGenerallyCompatibleWith(final GBDevice device) {
|
|
||||||
return isHeaderValid() && device.getType() == DeviceType.AMAZFITGTR3PRO;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Map<Integer, String> getCrcMap() {
|
|
||||||
return crcToVersion;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgtr3pro;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr3pro.AmazfitGTR3ProFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsSupport;
|
|
||||||
|
|
||||||
public class AmazfitGTR3ProSupport extends ZeppOsSupport {
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTR3ProSupport.class);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HuamiFWHelper createFWHelper(Uri uri, Context context) throws IOException {
|
|
||||||
return new AmazfitGTR3ProFWHelper(uri, context);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,61 +0,0 @@
|
|||||||
/* Copyright (C) 2022-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgtr4;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsFirmwareInfo;
|
|
||||||
|
|
||||||
public class AmazfitGTR4FirmwareInfo extends ZeppOsFirmwareInfo {
|
|
||||||
private static final Map<Integer, String> crcToVersion = new HashMap<Integer, String>() {{
|
|
||||||
// firmware
|
|
||||||
put(1699, "3.17.0.2");
|
|
||||||
put(20712, "3.18.1.1 (diff from 3.17.0.2)");
|
|
||||||
put(49685, "3.23.3.1 (diff from 3.21.0.1)");
|
|
||||||
}};
|
|
||||||
|
|
||||||
public AmazfitGTR4FirmwareInfo(final byte[] bytes) {
|
|
||||||
super(bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String deviceName() {
|
|
||||||
return HuamiConst.AMAZFIT_GTR4_NAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<Integer> deviceSources() {
|
|
||||||
return new HashSet<>(Arrays.asList(7930112, 7930113));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isGenerallyCompatibleWith(final GBDevice device) {
|
|
||||||
return isHeaderValid() && device.getType() == DeviceType.AMAZFITGTR4;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Map<Integer, String> getCrcMap() {
|
|
||||||
return crcToVersion;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
/* Copyright (C) 2022-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgtr4;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr4.AmazfitGTR4FWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsSupport;
|
|
||||||
|
|
||||||
public class AmazfitGTR4Support extends ZeppOsSupport {
|
|
||||||
@Override
|
|
||||||
public HuamiFWHelper createFWHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
return new AmazfitGTR4FWHelper(uri, context);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgtrmini;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsFirmwareInfo;
|
|
||||||
|
|
||||||
public class AmazfitGTRMiniFirmwareInfo extends ZeppOsFirmwareInfo {
|
|
||||||
private static final Map<Integer, String> crcToVersion = new HashMap<Integer, String>() {{
|
|
||||||
// firmware
|
|
||||||
}};
|
|
||||||
|
|
||||||
public AmazfitGTRMiniFirmwareInfo(final byte[] bytes) {
|
|
||||||
super(bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String deviceName() {
|
|
||||||
return HuamiConst.AMAZFIT_GTR_MINI_NAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<Integer> deviceSources() {
|
|
||||||
return new HashSet<>(Arrays.asList(250, 251));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isGenerallyCompatibleWith(final GBDevice device) {
|
|
||||||
return isHeaderValid() && device.getType() == DeviceType.AMAZFITGTRMINI;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Map<Integer, String> getCrcMap() {
|
|
||||||
return crcToVersion;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgtrmini;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtrmini.AmazfitGTRMiniFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsSupport;
|
|
||||||
|
|
||||||
public class AmazfitGTRMiniSupport extends ZeppOsSupport {
|
|
||||||
@Override
|
|
||||||
public HuamiFWHelper createFWHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
return new AmazfitGTRMiniFWHelper(uri, context);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,63 +0,0 @@
|
|||||||
/* Copyright (C) 2022-2024 José Rebelo, sedy89
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgts3;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsFirmwareInfo;
|
|
||||||
|
|
||||||
public class AmazfitGTS3FirmwareInfo extends ZeppOsFirmwareInfo {
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTS3FirmwareInfo.class);
|
|
||||||
|
|
||||||
private static final Map<Integer, String> crcToVersion = new HashMap<Integer, String>() {{
|
|
||||||
// firmware
|
|
||||||
}};
|
|
||||||
|
|
||||||
public AmazfitGTS3FirmwareInfo(final byte[] bytes) {
|
|
||||||
super(bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String deviceName() {
|
|
||||||
return HuamiConst.AMAZFIT_GTS3_NAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<Integer> deviceSources() {
|
|
||||||
return new HashSet<>(Arrays.asList(224, 225));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isGenerallyCompatibleWith(final GBDevice device) {
|
|
||||||
return isHeaderValid() && device.getType() == DeviceType.AMAZFITGTS3;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Map<Integer, String> getCrcMap() {
|
|
||||||
return crcToVersion;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
/* Copyright (C) 2022-2024 José Rebelo, sedy89
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgts3;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgts3.AmazfitGTS3FWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsSupport;
|
|
||||||
|
|
||||||
public class AmazfitGTS3Support extends ZeppOsSupport {
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTS3Support.class);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HuamiFWHelper createFWHelper(Uri uri, Context context) throws IOException {
|
|
||||||
return new AmazfitGTS3FWHelper(uri, context);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
/* Copyright (C) 2022-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgts4;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsFirmwareInfo;
|
|
||||||
|
|
||||||
public class AmazfitGTS4FirmwareInfo extends ZeppOsFirmwareInfo {
|
|
||||||
private static final Map<Integer, String> crcToVersion = new HashMap<Integer, String>() {{
|
|
||||||
// firmware
|
|
||||||
}};
|
|
||||||
|
|
||||||
public AmazfitGTS4FirmwareInfo(final byte[] bytes) {
|
|
||||||
super(bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String deviceName() {
|
|
||||||
return HuamiConst.AMAZFIT_GTS4_NAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<Integer> deviceSources() {
|
|
||||||
return new HashSet<>(Arrays.asList(7995648, 7995649));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isGenerallyCompatibleWith(final GBDevice device) {
|
|
||||||
return isHeaderValid() && device.getType() == DeviceType.AMAZFITGTS4;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Map<Integer, String> getCrcMap() {
|
|
||||||
return crcToVersion;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
/* Copyright (C) 2022-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgts4;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgts4.AmazfitGTS4FWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsSupport;
|
|
||||||
|
|
||||||
public class AmazfitGTS4Support extends ZeppOsSupport {
|
|
||||||
@Override
|
|
||||||
public HuamiFWHelper createFWHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
return new AmazfitGTS4FWHelper(uri, context);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
/* Copyright (C) 2022-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgts4mini;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsFirmwareInfo;
|
|
||||||
|
|
||||||
public class AmazfitGTS4MiniFirmwareInfo extends ZeppOsFirmwareInfo {
|
|
||||||
private static final Map<Integer, String> crcToVersion = new HashMap<Integer, String>() {{
|
|
||||||
// firmware
|
|
||||||
}};
|
|
||||||
|
|
||||||
public AmazfitGTS4MiniFirmwareInfo(final byte[] bytes) {
|
|
||||||
super(bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String deviceName() {
|
|
||||||
return HuamiConst.AMAZFIT_GTS4_MINI_NAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<Integer> deviceSources() {
|
|
||||||
return new HashSet<>(Arrays.asList(246, 247));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isGenerallyCompatibleWith(final GBDevice device) {
|
|
||||||
return isHeaderValid() && device.getType() == DeviceType.AMAZFITGTS4MINI;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Map<Integer, String> getCrcMap() {
|
|
||||||
return crcToVersion;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
/* Copyright (C) 2022-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgts4mini;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgts4mini.AmazfitGTS4MiniFWHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsSupport;
|
|
||||||
|
|
||||||
public class AmazfitGTS4MiniSupport extends ZeppOsSupport {
|
|
||||||
@Override
|
|
||||||
public HuamiFWHelper createFWHelper(final Uri uri, final Context context) throws IOException {
|
|
||||||
return new AmazfitGTS4MiniFWHelper(uri, context);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
/* Copyright (C) 2023-2024 José Rebelo
|
|
||||||
|
|
||||||
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 <https://www.gnu.org/licenses/>. */
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfittrex2;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.ZeppOsFirmwareInfo;
|
|
||||||
|
|
||||||
public class AmazfitTRex2FirmwareInfo extends ZeppOsFirmwareInfo {
|
|
||||||
private static final Map<Integer, String> crcToVersion = new HashMap<Integer, String>() {{
|
|
||||||
// firmware
|
|
||||||
}};
|
|
||||||
|
|
||||||
public AmazfitTRex2FirmwareInfo(final byte[] bytes) {
|
|
||||||
super(bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String deviceName() {
|
|
||||||
return HuamiConst.AMAZFIT_TREX_2_NAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<Integer> deviceSources() {
|
|
||||||
return new HashSet<>(Arrays.asList(418, 419));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isGenerallyCompatibleWith(final GBDevice device) {
|
|
||||||
return isHeaderValid() && device.getType() == DeviceType.AMAZFITTREX2;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Map<Integer, String> getCrcMap() {
|
|
||||||
return crcToVersion;
|
|
||||||
}
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user