1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-25 19:36:50 +01:00

Zepp OS: Fix file transfer service incoming file size parse

This commit is contained in:
José Rebelo 2023-06-11 16:36:57 +01:00
parent 3217e4a2dd
commit d29e092ce7

View File

@ -173,11 +173,16 @@ public class ZeppOsFileTransferService extends AbstractZeppOsService {
private void handleFileTransferData(final byte[] payload) {
final ByteBuffer buf = ByteBuffer.wrap(payload).order(ByteOrder.LITTLE_ENDIAN);
buf.get(); // Discard first byte
final byte secondByte = buf.get();
final boolean firstPacket = (secondByte == 1);
final boolean lastPacket = (secondByte == 2);
final byte flags = buf.get();
final boolean firstPacket = (flags == 1);
final boolean lastPacket = (flags == 2);
final byte session = buf.get();
final byte index = buf.get();
if ((flags & 0x01) != 0) {
buf.getInt(); // ?
}
final short size = buf.getShort();
final FileTransferRequest request = mSessionRequests.get(session);