TS SD integration #1653

This commit is contained in:
rusefi 2020-08-05 00:11:52 -04:00
parent 530439c424
commit 20c290a9f4
1 changed files with 17 additions and 0 deletions

View File

@ -10,6 +10,8 @@ import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import static com.rusefi.config.generated.Fields.TS_SD_PROTOCOL_FETCH_INFO;
@ -73,6 +75,21 @@ public class ConnectPanel {
response = stream.getDataBuffer().getPacket("read command", true);
System.out.println("read command " + IoStream.printHexBinary(response));
int fileIndex = 0;
int offset = 32 * fileIndex;
String fileNamePart = new String(response, 1 + offset, 8).trim();
String fileExt = new String(response, 1 + offset + 8, 3).trim();
String fileName = fileNamePart + "." + fileExt;
ByteBuffer bb = ByteBuffer.wrap(response, 1 + offset + 28, 4);
bb.order(ByteOrder.LITTLE_ENDIAN);
int size = bb.getInt();
System.out.println("Filename " + fileName + " size " + size);
} catch (IOException ioException) {
ioException.printStackTrace();