1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-28 04:46:51 +01:00

Garmin: send blocks that are smaller than MaxPacketSize

Fixes 4047
This commit is contained in:
Daniele Gobbetti 2024-08-29 16:52:50 +02:00
parent e54fd95a8b
commit d4df00ccbf

View File

@ -248,7 +248,7 @@ public CreateFileMessage initiateUpload(byte[] fileAsByteArray, FileType.FILETYP
public static class FileFragment {
private final DirectoryEntry directoryEntry;
private final int maxBlockSize = 500;
private final int maxBlockSize = 500; //TODO: why 500?
private int dataSize;
private ByteBuffer dataHolder;
private int runningCrc;
@ -268,7 +268,7 @@ public CreateFileMessage initiateUpload(byte[] fileAsByteArray, FileType.FILETYP
}
private int getMaxBlockSize() {
return Math.max(maxBlockSize, GFDIMessage.getMaxPacketSize());
return Math.min(maxBlockSize, GFDIMessage.getMaxPacketSize()); //TODO: can we use GFDIMessage.getMaxPacketSize() directly?
}
public String getFileName() {