refactoring
This commit is contained in:
parent
34b34bbe4a
commit
9774c74f42
|
@ -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);
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue