mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-25 18:15:49 +01:00
Amazfit Bip/Cor: for untested installable files, at least display the type (res/font/gps/watchface)
For res the version is also displayed (the same as noted in the wiki)
This commit is contained in:
parent
ff93122ddc
commit
b7b96b5ab5
@ -45,7 +45,37 @@ public abstract class HuamiFirmwareInfo {
|
|||||||
public String toVersion(int crc16) {
|
public String toVersion(int crc16) {
|
||||||
String version = getCrcMap().get(crc16);
|
String version = getCrcMap().get(crc16);
|
||||||
if (version == null) {
|
if (version == null) {
|
||||||
version = searchVersion(bytes);
|
if (firmwareType == HuamiFirmwareType.FIRMWARE) {
|
||||||
|
version = searchFirmwareVersion(bytes);
|
||||||
|
}
|
||||||
|
else if (firmwareType == HuamiFirmwareType.RES) {
|
||||||
|
version = "RES " + Integer.toString(bytes[5]);
|
||||||
|
}
|
||||||
|
else if (firmwareType == HuamiFirmwareType.RES_NEW) {
|
||||||
|
version = "RES " + Integer.toString(bytes[14]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (version == null) {
|
||||||
|
switch (firmwareType) {
|
||||||
|
case FIRMWARE:
|
||||||
|
version = "(unknown)";
|
||||||
|
break;
|
||||||
|
case FONT:
|
||||||
|
version = "(unknown font)";
|
||||||
|
break;
|
||||||
|
case GPS:
|
||||||
|
version = "(unknown GPS)";
|
||||||
|
break;
|
||||||
|
case GPS_CEP:
|
||||||
|
version = "(unknown CEP)";
|
||||||
|
break;
|
||||||
|
case GPS_ALMANAC:
|
||||||
|
version = "(unknown ALM)";
|
||||||
|
break;
|
||||||
|
case WATCHFACE:
|
||||||
|
version = "(unknown watchface)";
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
@ -102,7 +132,7 @@ public abstract class HuamiFirmwareInfo {
|
|||||||
|
|
||||||
protected abstract HuamiFirmwareType determineFirmwareType(byte[] bytes);
|
protected abstract HuamiFirmwareType determineFirmwareType(byte[] bytes);
|
||||||
|
|
||||||
protected String searchVersion(byte[] fwbytes) {
|
protected String searchFirmwareVersion(byte[] fwbytes) {
|
||||||
ByteBuffer buf = ByteBuffer.wrap(fwbytes);
|
ByteBuffer buf = ByteBuffer.wrap(fwbytes);
|
||||||
buf.order(ByteOrder.BIG_ENDIAN);
|
buf.order(ByteOrder.BIG_ENDIAN);
|
||||||
while (buf.remaining() > 3) {
|
while (buf.remaining() > 3) {
|
||||||
|
@ -87,7 +87,7 @@ public class Mi2FirmwareInfo extends HuamiFirmwareInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String searchVersion(byte[] fwbytes) {
|
protected String searchFirmwareVersion(byte[] fwbytes) {
|
||||||
// does not work for Mi Band 2
|
// does not work for Mi Band 2
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user