parent
32f9a98ed2
commit
847b2a3caa
|
@ -9,6 +9,7 @@ import com.rusefi.binaryprotocol.BinaryProtocolState;
|
|||
import com.rusefi.core.EngineState;
|
||||
import com.rusefi.io.serial.BufferedSerialIoStream;
|
||||
import com.rusefi.io.serial.StreamConnector;
|
||||
import com.rusefi.io.stream.PCanIoStream;
|
||||
import com.rusefi.io.tcp.TcpConnector;
|
||||
import com.rusefi.io.tcp.TcpIoStream;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
@ -30,6 +31,7 @@ import static com.devexperts.logging.Logging.getLogging;
|
|||
*/
|
||||
public class LinkManager implements Closeable {
|
||||
private static final Logging log = getLogging(LinkManager.class);
|
||||
public static final String PCAN = "PCAN";
|
||||
|
||||
@NotNull
|
||||
public static LogLevel LOG_LEVEL = LogLevel.INFO;
|
||||
|
@ -209,6 +211,9 @@ public class LinkManager implements Closeable {
|
|||
log.info("LinkManager: Starting " + port);
|
||||
if (isLogViewerMode(port)) {
|
||||
setConnector(LinkConnector.VOID);
|
||||
} else if (PCAN.equals(port)) {
|
||||
Callable<IoStream> streamFactory = PCanIoStream::getPCANIoStream;
|
||||
setConnector(new StreamConnector(this, streamFactory));
|
||||
} else if (TcpConnector.isTcpPort(port)) {
|
||||
Callable<IoStream> streamFactory = new Callable<IoStream>() {
|
||||
@Override
|
||||
|
|
|
@ -2,10 +2,8 @@ package com.rusefi;
|
|||
|
||||
import com.rusefi.io.LinkManager;
|
||||
import com.rusefi.io.tcp.TcpConnector;
|
||||
import com.rusefi.ui.util.UiUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
@ -19,6 +17,8 @@ public enum SerialPortScanner {
|
|||
|
||||
private volatile boolean isRunning = true;
|
||||
|
||||
private static final boolean SHOW_PCAN = Boolean.parseBoolean(System.getenv().get("RUSEFI_PCAN"));
|
||||
|
||||
static final String AUTO_SERIAL = "Auto Serial";
|
||||
@NotNull
|
||||
private final List<String> knownPorts = new ArrayList<>();
|
||||
|
@ -36,6 +36,8 @@ public enum SerialPortScanner {
|
|||
ports.addAll(Arrays.asList(serialPorts));
|
||||
if (includeSlowTcpLookup)
|
||||
ports.addAll(TcpConnector.getAvailablePorts());
|
||||
if (SHOW_PCAN)
|
||||
ports.add(LinkManager.PCAN);
|
||||
|
||||
boolean isListUpdated;
|
||||
synchronized (knownPorts) {
|
||||
|
|
Loading…
Reference in New Issue