diff --git a/src/main/java/com/romraider/io/j2534/api/J2534ConnectionISO15765.java b/src/main/java/com/romraider/io/j2534/api/J2534ConnectionISO15765.java index 95be16c8..badfc8da 100644 --- a/src/main/java/com/romraider/io/j2534/api/J2534ConnectionISO15765.java +++ b/src/main/java/com/romraider/io/j2534/api/J2534ConnectionISO15765.java @@ -55,7 +55,7 @@ public final class J2534ConnectionISO15765 implements ConnectionManager { @Override public void open(byte[] start, byte[] stop) { checkNotNull(start, "start"); - checkNotNull(start, "stop"); + checkNotNull(stop, "stop"); this.stopRequest = stop; LOGGER.debug(String.format("Start Diagnostics Request ---> %s", asHex(start))); @@ -94,12 +94,14 @@ public final class J2534ConnectionISO15765 implements ConnectionManager { @Override public void close() { - LOGGER.debug(String.format("Stop Diagnostics Request ---> %s", - asHex(stopRequest))); - api.writeMsg(channelId, stopRequest, timeout, TxFlags.ISO15765_FRAME_PAD); - final byte[] response = api.readMsg(channelId, 1, timeout); - LOGGER.debug(String.format("Stop Diagnostics Response <--- %s", - asHex(response))); + if (stopRequest != null) { // OBD has no open or close procedure + LOGGER.debug(String.format("Stop Diagnostics Request ---> %s", + asHex(stopRequest))); + api.writeMsg(channelId, stopRequest, timeout, TxFlags.ISO15765_FRAME_PAD); + final byte[] response = api.readMsg(channelId, 1, timeout); + LOGGER.debug(String.format("Stop Diagnostics Response <--- %s", + asHex(response))); + } stopFcFilter(); disconnectChannel(); closeDevice();