1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-27 20:36:51 +01:00

Fossil Hybrid: cleaned up handle handling

This commit is contained in:
Daniel Dakhno 2020-10-29 02:42:52 +01:00
parent 50f99a5b59
commit 6850837a30
2 changed files with 12 additions and 9 deletions

View File

@ -22,20 +22,25 @@ public enum FileHandle {
LOOK_UP_TABLE(0x0f, 0x00),
RATE(0x10, 0x00),
REPLY_MESSAGES(0x13, 0x00),
APP_CODE(0x15, 0xFE),
;
private byte handle, subHandle;
private int handle, subHandle;
FileHandle(int handle, int subHandle) {
this.handle = (byte) handle;
this.subHandle = (byte) subHandle;
this.handle = handle;
this.subHandle = subHandle;
}
public short getHandle(){
return (short)((handle << 8) | (subHandle));
}
public byte getMinorHandle(){
return (byte) subHandle;
}
public byte getMajorHandle() {
return handle;
return (byte) handle;
}
}

View File

@ -19,14 +19,12 @@ public class SupportedFileVersionsInfo implements DeviceInfo {
short version = buffer.getShort();
supportedFileVersions.put(handle, version);
}
supportedFileVersions.put((byte) 0x15, (short) 0x0003);
}
public short getSupportedFileVersion(FileHandle fileHandle){
return getSupportedFileVersion(fileHandle.getHandle());
}
public short getSupportedFileVersion(short fileHandle){
return getSupportedFileVersion((byte)((fileHandle >> 8) & 0xFF));
return getSupportedFileVersion(fileHandle.getMajorHandle());
}
public short getSupportedFileVersion(byte fileHandle){