1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-06-24 22:10:55 +02:00

Garmin: Improve logging during file downloading

This commit is contained in:
José Rebelo 2024-05-18 20:59:50 +01:00 committed by Daniele Gobbetti
parent 88a9c81dcc
commit 88f687496c
2 changed files with 11 additions and 2 deletions

View File

@ -154,6 +154,7 @@ public class FileTransferHandler implements MessageHandler {
}
private void parseDirectoryEntries() {
LOG.debug("Parsing directory entries for {}", currentlyDownloading.directoryEntry);
if ((currentlyDownloading.getDataSize() % 16) != 0)
throw new IllegalArgumentException("Invalid directory data length");
final GarminByteBufferReader reader = new GarminByteBufferReader(currentlyDownloading.dataHolder.array());
@ -169,10 +170,15 @@ public class FileTransferHandler implements MessageHandler {
final int fileSize = reader.readInt();//12
final Date fileDate = new Date(GarminTimeUtils.garminTimestampToJavaMillis(reader.readInt()));//16
final DirectoryEntry directoryEntry = new DirectoryEntry(fileIndex, filetype, fileNumber, specificFlags, fileFlags, fileSize, fileDate);
if (directoryEntry.filetype == null) //silently discard unsupported files
if (directoryEntry.filetype == null) {
// discard unsupported files
LOG.warn("Unsupported directory entry of type {}/{}", fileDataType, fileSubType);
continue;
if (!FILE_TYPES_TO_PROCESS.contains(directoryEntry.filetype))
}
if (!FILE_TYPES_TO_PROCESS.contains(directoryEntry.filetype)) {
continue;
}
LOG.debug("Queueing {} for download", directoryEntry);
deviceSupport.addFileToDownloadList(directoryEntry);
}
currentlyDownloading = null;

View File

@ -37,8 +37,11 @@ public class FileType {
public enum FILETYPE { //TODO: add specialized method to parse each file type to the enum?
// virtual/undocumented
DIRECTORY(0, 0),
UNKNOWN_1_0(1, 0), // venu 3, fileIndex=4096
// fit files
DEVICE(128, 1),
SETTINGS(128, 2),
ACTIVITY(128, 4),
WORKOUTS(128, 5),
SCHEDULES(128, 7),