refactoring: rename `StatusConsumer.append` method into 'appendStatus` to distinguish it from `UpdateStatusWindow.append` method #7199
This commit is contained in:
parent
b4a2168261
commit
2ac19f5279
|
@ -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);
|
||||
statusListener.appendStatus("Error initializing PCAN: " + status);
|
||||
return null;
|
||||
}
|
||||
statusListener.append("Creating PCAN stream...");
|
||||
statusListener.appendStatus("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);
|
||||
statusListener.appendStatus("Unable to write the CAN message: " + status);
|
||||
System.exit(0);
|
||||
}
|
||||
// log.info("Send OK! length=" + payLoad.length);
|
||||
|
|
|
@ -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);
|
||||
statusConsumer.appendStatus("ERROR BinaryProtocolProxy::run " + e);
|
||||
close(clientStream);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
statusConsumer.appendStatus("ServerSocket " + p + " created. Feel free to point TS at IP Address 'localhost' port " + p);
|
||||
return serverSocket;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ public interface StatusConsumer {
|
|||
StatusConsumer VOID = (status, breakLineOnTextArea, sendToLogger) -> {
|
||||
};
|
||||
|
||||
default void append(String status) {
|
||||
default void appendStatus(String status) {
|
||||
appendStatus(status, true, true);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ public class MassUpdater {
|
|||
SerialPortScanner.INSTANCE.addListener(currentHardware -> {
|
||||
|
||||
if (!isUsingDfu.get() && currentHardware.isDfuFound() != previousDfuState.get()) {
|
||||
mainStatus.append(currentHardware.isDfuFound() ? "I see a DFU device!" : "No DFU...");
|
||||
mainStatus.appendStatus(currentHardware.isDfuFound() ? "I see a DFU device!" : "No DFU...");
|
||||
if (currentHardware.isDfuFound()) {
|
||||
isUsingDfu.set(true);
|
||||
UpdateOperationCallbacks releaseSemaphore = new UpdateOperationCallbacks() {
|
||||
|
@ -60,14 +60,14 @@ public class MassUpdater {
|
|||
for (Iterator<String> it = knownBlts.iterator(); it.hasNext(); ) {
|
||||
String port = it.next();
|
||||
if (!currentSet.contains(port)) {
|
||||
mainStatus.append(port + ": No longer present");
|
||||
mainStatus.appendStatus(port + ": No longer present");
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
for (SerialPortScanner.PortResult openBltPort : currentBltList) {
|
||||
if (!knownBlts.contains(openBltPort.port)) {
|
||||
knownBlts.add(openBltPort.port);
|
||||
mainStatus.append("New OpenBlt " + openBltPort);
|
||||
mainStatus.appendStatus("New OpenBlt " + openBltPort);
|
||||
|
||||
SwingUtilities.invokeLater(() -> AsyncJobExecutor.INSTANCE.executeJob(new OpenBltManualJob(openBltPort, mainStatus.getContent())));
|
||||
}
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
package com.rusefi.tools;
|
||||
|
||||
import com.rusefi.binaryprotocol.BinaryProtocol;
|
||||
import com.rusefi.config.generated.Integration;
|
||||
import com.rusefi.io.serial.AbstractIoStream;
|
||||
import com.rusefi.io.serial.RateCounter;
|
||||
import com.rusefi.io.tcp.BinaryProtocolProxy;
|
||||
import com.rusefi.io.tcp.BinaryProtocolServer;
|
||||
import com.rusefi.io.tcp.TcpConnector;
|
||||
import com.rusefi.ui.StatusConsumer;
|
||||
|
||||
|
@ -23,9 +21,9 @@ public class CANConnectorStartup {
|
|||
|
||||
String signature = BinaryProtocol.getSignature(tsStream);
|
||||
if (signature == null) {
|
||||
statusListener.append("Error: no ECU signature from " + tsStream);
|
||||
statusListener.appendStatus("Error: no ECU signature from " + tsStream);
|
||||
} else {
|
||||
statusListener.append("Got [" + signature + "] ECU signature via " + tsStream);
|
||||
statusListener.appendStatus("Got [" + signature + "] ECU signature via " + tsStream);
|
||||
}
|
||||
Map<Byte, RateCounter> rateCounters = new HashMap<>();
|
||||
|
||||
|
@ -35,7 +33,7 @@ public class CANConnectorStartup {
|
|||
for (Map.Entry<Byte, RateCounter> e : rateCounters.entrySet()) {
|
||||
String name = BinaryProtocol.findCommand(e.getKey());
|
||||
|
||||
statusListener.append(new Date() + ": Command " + name + ": " + e.getValue().getCurrentRate());
|
||||
statusListener.appendStatus(new Date() + ": Command " + name + ": " + e.getValue().getCurrentRate());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -48,7 +48,7 @@ public class PcanConnectorUI {
|
|||
if (stream != null)
|
||||
CANConnectorStartup.start(stream, statusConsumer);
|
||||
} catch (IOException e) {
|
||||
statusConsumer.append("Error " + e);
|
||||
statusConsumer.appendStatus("Error " + e);
|
||||
}
|
||||
}).start();
|
||||
|
||||
|
|
Loading…
Reference in New Issue