diff --git a/java_console/io/src/main/java/com/rusefi/io/can/PCanIoStream.java b/java_console/io/src/main/java/com/rusefi/io/can/PCanIoStream.java index d2a575b8ce..81e0d16055 100644 --- a/java_console/io/src/main/java/com/rusefi/io/can/PCanIoStream.java +++ b/java_console/io/src/main/java/com/rusefi/io/can/PCanIoStream.java @@ -42,15 +42,9 @@ public class PCanIoStream extends AbstractIoStream { private final IsoTpConnector isoTpConnector = new IsoTpConnector() { @Override - public void sendCanData(byte[] hdr, byte[] data, int dataOffset, int dataLength) { - byte[] total = combineArrays(hdr, data, dataOffset, dataLength); - + public void sendCanData(byte[] total) { sendCanPacket(total); } - - @Override - public void receiveData() { - } }; private int logSkipRate; diff --git a/java_console/io/src/main/java/com/rusefi/io/can/SocketCANIoStream.java b/java_console/io/src/main/java/com/rusefi/io/can/SocketCANIoStream.java index a50887692d..f785a2ae18 100644 --- a/java_console/io/src/main/java/com/rusefi/io/can/SocketCANIoStream.java +++ b/java_console/io/src/main/java/com/rusefi/io/can/SocketCANIoStream.java @@ -39,15 +39,9 @@ public class SocketCANIoStream extends AbstractIoStream { private final IsoTpConnector isoTpConnector = new IsoTpConnector() { @Override - public void sendCanData(byte[] hdr, byte[] data, int dataOffset, int dataLength) { - byte[] total = combineArrays(hdr, data, dataOffset, dataLength); - + public void sendCanData(byte[] total) { sendCanPacket(total); } - - @Override - public void receiveData() { - } }; private void sendCanPacket(byte[] total) { diff --git a/java_console/io/src/main/java/com/rusefi/io/can/elm/Elm327Connector.java b/java_console/io/src/main/java/com/rusefi/io/can/elm/Elm327Connector.java index 63d0fdb3fd..18c937f3ed 100644 --- a/java_console/io/src/main/java/com/rusefi/io/can/elm/Elm327Connector.java +++ b/java_console/io/src/main/java/com/rusefi/io/can/elm/Elm327Connector.java @@ -154,8 +154,7 @@ public class Elm327Connector implements Closeable { private final IsoTpConnector connector = new IsoTpConnector() { @Override - public void sendCanData(byte[] hdr, byte[] data, int dataOffset, int dataLength) { - byte[] total = combineArrays(hdr, data, dataOffset, dataLength); + public void sendCanData(byte[] total) { Elm327Connector.this.sendCanData(total); } diff --git a/java_console/io/src/main/java/com/rusefi/io/can/elm/Elm327IoStream.java b/java_console/io/src/main/java/com/rusefi/io/can/elm/Elm327IoStream.java index 5a6983a183..a2426be9f4 100644 --- a/java_console/io/src/main/java/com/rusefi/io/can/elm/Elm327IoStream.java +++ b/java_console/io/src/main/java/com/rusefi/io/can/elm/Elm327IoStream.java @@ -3,6 +3,7 @@ package com.rusefi.io.can.elm; import com.opensr5.io.DataListener; import com.rusefi.binaryprotocol.IncomingDataBuffer; import com.rusefi.binaryprotocol.IoHelper; +import com.rusefi.io.can.isotp.IsoTpCanDecoder; import com.rusefi.io.serial.AbstractIoStream; import org.jetbrains.annotations.NotNull; diff --git a/java_console/io/src/main/java/com/rusefi/io/can/isotp/IsoTpConnector.java b/java_console/io/src/main/java/com/rusefi/io/can/isotp/IsoTpConnector.java index 6423d074d7..64a13937f7 100644 --- a/java_console/io/src/main/java/com/rusefi/io/can/isotp/IsoTpConnector.java +++ b/java_console/io/src/main/java/com/rusefi/io/can/isotp/IsoTpConnector.java @@ -56,7 +56,13 @@ public abstract class IsoTpConnector { sendCanData(new byte[]{(byte) hdr0, (byte) hdr1}, data, dataOffset, dataLength); } - public abstract void sendCanData(byte[] hdr, byte[] data, int dataOffset, int dataLength); + public void sendCanData(byte[] hdr, byte[] data, int dataOffset, int dataLength) { + byte[] total = combineArrays(hdr, data, dataOffset, dataLength); + sendCanData(total); + } - public abstract void receiveData(); + public abstract void sendCanData(byte[] total); + + public void receiveData() { + } } diff --git a/java_console/io/src/test/java/com/rusefi/io/can/IsoTpConnectorTest.java b/java_console/io/src/test/java/com/rusefi/io/can/IsoTpConnectorTest.java index ceb98347e6..d33e52b233 100644 --- a/java_console/io/src/test/java/com/rusefi/io/can/IsoTpConnectorTest.java +++ b/java_console/io/src/test/java/com/rusefi/io/can/IsoTpConnectorTest.java @@ -19,16 +19,10 @@ public class IsoTpConnectorTest { IsoTpConnector testConnector = new IsoTpConnector() { @Override - public void sendCanData(byte[] hdr, byte[] data, int dataOffset, int dataLength) { - byte[] total = combineArrays(hdr, data, dataOffset, dataLength); - + public void sendCanData(byte[] total) { String packetAsString = HexBinary.printHexBinary(total); packets.add(packetAsString); } - - @Override - public void receiveData() { - } }; IsoTpConnector.sendStrategy(crcWrappedCrcRequest, testConnector);