refactoring

This commit is contained in:
rusefi 2020-08-04 19:03:22 -04:00
parent 34b34bbe4a
commit 9774c74f42
4 changed files with 7 additions and 2 deletions

View File

@ -40,7 +40,7 @@ public class SerialAutoChecker implements Runnable {
IncomingDataBuffer incomingData = stream.getDataBuffer();
try {
HelloCommand.send(stream);
byte[] response = incomingData.getPacket("", false);
byte[] response = incomingData.getPacket("");
if (!checkResponseCode(response, BinaryProtocolCommands.RESPONSE_OK))
return;
String signature = new String(response, 1, response.length - 1);

View File

@ -46,6 +46,10 @@ public class IncomingDataBuffer {
return incomingData;
}
public byte[] getPacket(String msg) throws EOFException {
return getPacket(msg, false, System.currentTimeMillis());
}
public byte[] getPacket(String msg, boolean allowLongResponse) throws EOFException {
return getPacket(msg, allowLongResponse, System.currentTimeMillis());
}

View File

@ -25,7 +25,7 @@ public class HelloCommand implements Command {
@Nullable
public static String getHelloResponse(IncomingDataBuffer incomingData) throws EOFException {
byte[] response = incomingData.getPacket("[hello]", false);
byte[] response = incomingData.getPacket("[hello]");
if (!checkResponseCode(response, BinaryProtocolCommands.RESPONSE_OK))
return null;
return new String(response, 1, response.length - 1);

View File

@ -34,6 +34,7 @@ import static com.rusefi.config.generated.Fields.*;
* This class makes rusEfi console a proxy for other tuning software, this way we can have two tools connected via same
* serial port simultaneously
*
* See BinaryProtocolServerSandbox
* @author Andrey Belomutskiy
* 11/24/15
*/