mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-01-12 18:57:36 +01:00
Garmin: Improve logging during file downloading
This commit is contained in:
parent
88a9c81dcc
commit
88f687496c
@ -154,6 +154,7 @@ public class FileTransferHandler implements MessageHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void parseDirectoryEntries() {
|
private void parseDirectoryEntries() {
|
||||||
|
LOG.debug("Parsing directory entries for {}", currentlyDownloading.directoryEntry);
|
||||||
if ((currentlyDownloading.getDataSize() % 16) != 0)
|
if ((currentlyDownloading.getDataSize() % 16) != 0)
|
||||||
throw new IllegalArgumentException("Invalid directory data length");
|
throw new IllegalArgumentException("Invalid directory data length");
|
||||||
final GarminByteBufferReader reader = new GarminByteBufferReader(currentlyDownloading.dataHolder.array());
|
final GarminByteBufferReader reader = new GarminByteBufferReader(currentlyDownloading.dataHolder.array());
|
||||||
@ -169,10 +170,15 @@ public class FileTransferHandler implements MessageHandler {
|
|||||||
final int fileSize = reader.readInt();//12
|
final int fileSize = reader.readInt();//12
|
||||||
final Date fileDate = new Date(GarminTimeUtils.garminTimestampToJavaMillis(reader.readInt()));//16
|
final Date fileDate = new Date(GarminTimeUtils.garminTimestampToJavaMillis(reader.readInt()));//16
|
||||||
final DirectoryEntry directoryEntry = new DirectoryEntry(fileIndex, filetype, fileNumber, specificFlags, fileFlags, fileSize, fileDate);
|
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;
|
continue;
|
||||||
if (!FILE_TYPES_TO_PROCESS.contains(directoryEntry.filetype))
|
}
|
||||||
|
if (!FILE_TYPES_TO_PROCESS.contains(directoryEntry.filetype)) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
LOG.debug("Queueing {} for download", directoryEntry);
|
||||||
deviceSupport.addFileToDownloadList(directoryEntry);
|
deviceSupport.addFileToDownloadList(directoryEntry);
|
||||||
}
|
}
|
||||||
currentlyDownloading = null;
|
currentlyDownloading = null;
|
||||||
|
@ -37,8 +37,11 @@ public class FileType {
|
|||||||
public enum FILETYPE { //TODO: add specialized method to parse each file type to the enum?
|
public enum FILETYPE { //TODO: add specialized method to parse each file type to the enum?
|
||||||
// virtual/undocumented
|
// virtual/undocumented
|
||||||
DIRECTORY(0, 0),
|
DIRECTORY(0, 0),
|
||||||
|
UNKNOWN_1_0(1, 0), // venu 3, fileIndex=4096
|
||||||
|
|
||||||
// fit files
|
// fit files
|
||||||
|
DEVICE(128, 1),
|
||||||
|
SETTINGS(128, 2),
|
||||||
ACTIVITY(128, 4),
|
ACTIVITY(128, 4),
|
||||||
WORKOUTS(128, 5),
|
WORKOUTS(128, 5),
|
||||||
SCHEDULES(128, 7),
|
SCHEDULES(128, 7),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user