only:code duplication

This commit is contained in:
Andrey 2023-09-14 07:17:57 -04:00
parent faaabd5e2b
commit 1dc0cab4a9
3 changed files with 3 additions and 3 deletions

View File

@ -46,7 +46,7 @@ public class SerialAutoChecker {
try {
HelloCommand.send(stream);
byte[] response = incomingData.getPacket("auto detect");
if (!checkResponseCode(response, (byte) Fields.TS_RESPONSE_OK))
if (!checkResponseCode(response))
return null;
String signature = new String(response, 1, response.length - 1);
if (!signature.startsWith(Fields.PROTOCOL_SIGNATURE_PREFIX)) {

View File

@ -30,7 +30,7 @@ public class HelloCommand implements Command {
@Nullable
public static String getStringResponse(String msg, IncomingDataBuffer incomingData) throws EOFException {
byte[] response = incomingData.getPacket(msg);
if (!checkResponseCode(response, (byte) Fields.TS_RESPONSE_OK))
if (!checkResponseCode(response))
return null;
return new String(response, 1, response.length - 1);
}

View File

@ -54,7 +54,7 @@ public class Elm327Sandbox {
{
tsStream.sendPacket(new byte[]{Fields.TS_HELLO_COMMAND});
byte[] response = dataBuffer.getPacket("[hello command]");
if (!checkResponseCode(response, (byte) Fields.TS_RESPONSE_OK))
if (!checkResponseCode(response))
return;
String signature = new String(response, 1, response.length - 1);
System.out.println(Fields.TS_HELLO_COMMAND + " returned " + signature);