diff --git a/java_console/ui/src/main/java/UiLinkManagerHelper.java b/java_console/ui/src/main/java/UiLinkManagerHelper.java new file mode 100644 index 0000000000..ad79849074 --- /dev/null +++ b/java_console/ui/src/main/java/UiLinkManagerHelper.java @@ -0,0 +1,16 @@ +import com.rusefi.io.IoStream; +import com.rusefi.io.serial.BufferedSerialIoStream; +import com.rusefi.io.tcp.TcpConnector; +import com.rusefi.io.tcp.TcpIoStream; +import org.jetbrains.annotations.NotNull; + +import java.io.IOException; + +public class UiLinkManagerHelper { + @NotNull + public static IoStream open(String port) throws IOException { + if (TcpConnector.isTcpPort(port)) + return TcpIoStream.open(port); + return BufferedSerialIoStream.openPort(port); + } +}