1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-25 10:05: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:
Andreas Shimokawa 2017-12-10 20:30:27 +01:00
parent ff93122ddc
commit b7b96b5ab5
2 changed files with 33 additions and 3 deletions

View File

@ -45,7 +45,37 @@ public abstract class HuamiFirmwareInfo {
public String toVersion(int crc16) {
String version = getCrcMap().get(crc16);
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;
}
@ -102,7 +132,7 @@ public abstract class HuamiFirmwareInfo {
protected abstract HuamiFirmwareType determineFirmwareType(byte[] bytes);
protected String searchVersion(byte[] fwbytes) {
protected String searchFirmwareVersion(byte[] fwbytes) {
ByteBuffer buf = ByteBuffer.wrap(fwbytes);
buf.order(ByteOrder.BIG_ENDIAN);
while (buf.remaining() > 3) {

View File

@ -87,7 +87,7 @@ public class Mi2FirmwareInfo extends HuamiFirmwareInfo {
}
@Override
protected String searchVersion(byte[] fwbytes) {
protected String searchFirmwareVersion(byte[] fwbytes) {
// does not work for Mi Band 2
return null;
}