mirror of https://github.com/rusefi/rusefi-1.git
proxy progress
This commit is contained in:
parent
b9a7efa3ac
commit
ebecc65404
|
@ -118,7 +118,7 @@ public class BinaryProtocol implements BinaryProtocolCommands {
|
|||
}
|
||||
};
|
||||
|
||||
incomingData = createDataBuffer(stream, logger);
|
||||
incomingData = IncomingDataBuffer.createDataBuffer(stream, logger);
|
||||
Runtime.getRuntime().addShutdownHook(hook);
|
||||
rpmListener = value -> {
|
||||
if (value <= COMPOSITE_OFF_RPM) {
|
||||
|
@ -131,12 +131,6 @@ public class BinaryProtocol implements BinaryProtocolCommands {
|
|||
};
|
||||
}
|
||||
|
||||
public static IncomingDataBuffer createDataBuffer(IoStream stream, Logger logger) {
|
||||
IncomingDataBuffer incomingData = new IncomingDataBuffer(logger);
|
||||
stream.setInputListener(incomingData::addData);
|
||||
return incomingData;
|
||||
}
|
||||
|
||||
public static void sleep(int millis) {
|
||||
try {
|
||||
Thread.sleep(millis);
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.rusefi.binaryprotocol;
|
|||
import com.opensr5.Logger;
|
||||
import com.rusefi.Timeouts;
|
||||
import com.rusefi.config.generated.Fields;
|
||||
import com.rusefi.io.IoStream;
|
||||
import etch.util.CircularByteBuffer;
|
||||
import net.jcip.annotations.ThreadSafe;
|
||||
|
||||
|
@ -31,6 +32,12 @@ public class IncomingDataBuffer {
|
|||
this.logger = logger;
|
||||
}
|
||||
|
||||
public static IncomingDataBuffer createDataBuffer(IoStream stream, Logger logger) {
|
||||
IncomingDataBuffer incomingData = new IncomingDataBuffer(logger);
|
||||
stream.setInputListener(incomingData::addData);
|
||||
return incomingData;
|
||||
}
|
||||
|
||||
public byte[] getPacket(Logger logger, String msg, boolean allowLongResponse) throws InterruptedException, EOFException {
|
||||
return getPacket(logger, msg, allowLongResponse, System.currentTimeMillis());
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.rusefi.autodetect;
|
|||
|
||||
import com.opensr5.Logger;
|
||||
import com.rusefi.FileLog;
|
||||
import com.rusefi.binaryprotocol.BinaryProtocol;
|
||||
import com.rusefi.binaryprotocol.BinaryProtocolCommands;
|
||||
import com.rusefi.binaryprotocol.IncomingDataBuffer;
|
||||
import com.rusefi.config.generated.Fields;
|
||||
|
@ -40,7 +39,7 @@ public class SerialAutoChecker implements Runnable {
|
|||
public void run() {
|
||||
IoStream stream = SerialIoStreamJSerialComm.openPort(serialPort, logger);
|
||||
Logger logger = FileLog.LOGGER;
|
||||
IncomingDataBuffer incomingData = BinaryProtocol.createDataBuffer(stream, logger);
|
||||
IncomingDataBuffer incomingData = IncomingDataBuffer.createDataBuffer(stream, logger);
|
||||
try {
|
||||
stream.sendPacket(new byte[]{BinaryProtocolCommands.COMMAND_HELLO}, logger);
|
||||
byte[] response = incomingData.getPacket(logger, "", false);
|
||||
|
|
|
@ -308,7 +308,7 @@ public class ConsoleTools {
|
|||
}
|
||||
IoStream stream = SerialIoStreamJSerialComm.openPort(autoDetectedPort, FileLog.LOGGER);
|
||||
Logger logger = FileLog.LOGGER;
|
||||
IncomingDataBuffer incomingData = BinaryProtocol.createDataBuffer(stream, logger);
|
||||
IncomingDataBuffer incomingData = IncomingDataBuffer.createDataBuffer(stream, logger);
|
||||
byte[] commandBytes = BinaryProtocol.getTextCommandBytes("hello");
|
||||
stream.sendPacket(commandBytes, logger);
|
||||
// skipping response
|
||||
|
|
Loading…
Reference in New Issue