mirror of https://github.com/rusefi/rusefi-1.git
TS SD integration #1653
This commit is contained in:
parent
530439c424
commit
20c290a9f4
|
@ -10,6 +10,8 @@ import java.awt.*;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.ByteOrder;
|
||||||
|
|
||||||
import static com.rusefi.config.generated.Fields.TS_SD_PROTOCOL_FETCH_INFO;
|
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);
|
response = stream.getDataBuffer().getPacket("read command", true);
|
||||||
System.out.println("read command " + IoStream.printHexBinary(response));
|
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) {
|
} catch (IOException ioException) {
|
||||||
ioException.printStackTrace();
|
ioException.printStackTrace();
|
||||||
|
|
Loading…
Reference in New Issue