From 29017946ca5dac538c761c128dd5e83fce06d57a Mon Sep 17 00:00:00 2001 From: rusefillc Date: Wed, 16 Nov 2022 22:47:40 -0500 Subject: [PATCH] Show cams in TS trigger logger #2496 --- .../binaryprotocol/test/TcpServerSandbox.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/java_console/io/src/test/java/com/rusefi/binaryprotocol/test/TcpServerSandbox.java b/java_console/io/src/test/java/com/rusefi/binaryprotocol/test/TcpServerSandbox.java index 7c8f0a51d8..2f5d8df335 100644 --- a/java_console/io/src/test/java/com/rusefi/binaryprotocol/test/TcpServerSandbox.java +++ b/java_console/io/src/test/java/com/rusefi/binaryprotocol/test/TcpServerSandbox.java @@ -1,9 +1,11 @@ package com.rusefi.binaryprotocol.test; +import com.macfaq.io.LittleEndianOutputStream; import com.rusefi.CompatibleFunction; import com.rusefi.Listener; import com.rusefi.binaryprotocol.BinaryProtocol; import com.rusefi.binaryprotocol.IncomingDataBuffer; +import com.rusefi.binaryprotocol.IoHelper; import com.rusefi.config.generated.Fields; import com.rusefi.config.generated.TsOutputs; import com.rusefi.io.IoStream; @@ -13,6 +15,7 @@ import com.rusefi.io.tcp.TcpIoStream; import com.rusefi.ui.StatusConsumer; import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; import java.io.DataInputStream; import java.io.IOException; import java.net.Socket; @@ -99,7 +102,22 @@ public class TcpServerSandbox { } else if (command == Fields.TS_CRC_CHECK_COMMAND) { stream.sendPacket(BinaryProtocolServer.createCrcResponse(TOTALLY_EMPTY_CONFIGURATION)); } else if (command == Fields.TS_SET_LOGGER_SWITCH) { + stream.sendPacket(TS_OK.getBytes()); } else if (command == Fields.TS_GET_LOGGER_GET_BUFFER) { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + baos.write(TS_OK.charAt(0)); + LittleEndianOutputStream dout = new LittleEndianOutputStream(baos); + int count = 256; + dout.writeShort(count * 5); + + for (int i = 0; i < count; i++) { + baos.write(i); + baos.write(0); + baos.write(0); + baos.write(0); + baos.write(100); + } + stream.sendPacket(baos.toByteArray()); } else if (command == Fields.TS_OUTPUT_COMMAND) { byte[] response = getOutputCommandResponse(payload, ecuState.outputs); stream.sendPacket(response);