only:API change

This commit is contained in:
rusefi 2024-08-18 19:17:41 -04:00
parent 6046c552a2
commit a0eca54325
6 changed files with 12 additions and 8 deletions

View File

@ -59,10 +59,10 @@ public class PCanIoStream extends AbstractIoStream {
PCANBasic can = PCanHelper.create();
TPCANStatus status = PCanHelper.init(can);
if (status != TPCANStatus.PCAN_ERROR_OK) {
statusListener.append("Error initializing PCAN: " + status, true, true);
statusListener.append("Error initializing PCAN: " + status);
return null;
}
statusListener.append("Creating PCAN stream...", true, true);
statusListener.append("Creating PCAN stream...");
return new PCanIoStream(can, statusListener);
}
@ -75,7 +75,7 @@ public class PCanIoStream extends AbstractIoStream {
TPCANStatus status = PCanHelper.send(can, isoTpConnector.canId(), payLoad);
if (status != TPCANStatus.PCAN_ERROR_OK) {
statusListener.append("Unable to write the CAN message: " + status, true, true);
statusListener.append("Unable to write the CAN message: " + status);
System.exit(0);
}
// log.info("Send OK! length=" + payLoad.length);

View File

@ -44,7 +44,7 @@ public class BinaryProtocolProxy {
clientStream = new TcpIoStream("[[proxy]] ", clientSocket);
runProxy(targetEcuSocket, clientStream, clientApplicationActivityListener, USER_IO_TIMEOUT);
} catch (IOException e) {
statusConsumer.append("ERROR BinaryProtocolProxy::run " + e, true, true);
statusConsumer.append("ERROR BinaryProtocolProxy::run " + e);
close(clientStream);
}
};

View File

@ -97,7 +97,7 @@ public class BinaryProtocolServer {
public static ServerSocketReference tcpServerSocket(int port, String threadName, CompatibleFunction<Socket, Runnable> socketRunnableFactory, Listener serverSocketCreationCallback, StatusConsumer statusConsumer) throws IOException {
return tcpServerSocket(socketRunnableFactory, port, threadName, serverSocketCreationCallback, p -> {
ServerSocket serverSocket = new ServerSocket(p);
statusConsumer.append("ServerSocket " + p + " created. Feel free to point TS at IP Address 'localhost' port " + p, true, true);
statusConsumer.append("ServerSocket " + p + " created. Feel free to point TS at IP Address 'localhost' port " + p);
return serverSocket;
});
}

View File

@ -18,5 +18,9 @@ public interface StatusConsumer {
StatusConsumer VOID = (status, breakLineOnTextArea, sendToLogger) -> {
};
default void append(String status) {
append(status, true, true);
}
void append(String status, boolean breakLineOnTextArea, boolean sendToLogger);
}

View File

@ -15,9 +15,9 @@ public class CANConnectorStartup {
String signature = BinaryProtocol.getSignature(tsStream);
if (signature == null) {
statusListener.append("Error: no ECU signature from " + tsStream, true, true);
statusListener.append("Error: no ECU signature from " + tsStream);
} else {
statusListener.append("Got [" + signature + "] ECU signature via " + tsStream, true, true);
statusListener.append("Got [" + signature + "] ECU signature via " + tsStream);
}
BinaryProtocolProxy.createProxy(tsStream, TcpConnector.DEFAULT_PORT, BinaryProtocolProxy.ClientApplicationActivityListener.VOID, statusListener);

View File

@ -43,7 +43,7 @@ public class PcanConnectorUI {
if (stream != null)
CANConnectorStartup.start(stream, statusConsumer);
} catch (IOException e) {
statusConsumer.append("Error " + e, true, true);
statusConsumer.append("Error " + e);
}
}).start();