removing dead code

This commit is contained in:
rusefi 2020-06-07 11:47:47 -04:00
parent 7a5fd95bf0
commit 549c5e8ce3
13 changed files with 20 additions and 150 deletions

View File

@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="jssc">
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/jssc.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/lib/jssc-src.jar!/src" />
</SOURCES>
</library>
</component>

View File

@ -9,6 +9,5 @@
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="io" />
<orderEntry type="module" module-name="models" />
<orderEntry type="library" name="jssc" level="project" />
</component>
</module>

View File

@ -38,7 +38,7 @@
<target name="compile">
<mkdir dir="build/classes"/>
<javac debug="yes" destdir="build/classes"
classpath="../java_tools/configuration_definition/lib/snakeyaml.jar:lib/jaxb-api.jar:lib/httpclient.jar:lib/httpmime.jar:lib/httpcore.jar:lib/jSerialComm.jar:lib/jcip-annotations-1.0.jar:lib/jlatexmath-1.0.6.jar:lib/swing-layout-1.0.jar:lib/jep.jar:lib/log4j.jar:lib/junit.jar:lib/jssc.jar:lib/SteelSeries-3.9.30.jar:lib/annotations.jar:lib/miglayout-4.0.jar:lib/surfaceplotter-2.0.1.jar">
classpath="../java_tools/configuration_definition/lib/snakeyaml.jar:lib/jaxb-api.jar:lib/httpclient.jar:lib/httpmime.jar:lib/httpcore.jar:lib/jSerialComm.jar:lib/jcip-annotations-1.0.jar:lib/jlatexmath-1.0.6.jar:lib/swing-layout-1.0.jar:lib/jep.jar:lib/log4j.jar:lib/junit.jar:lib/SteelSeries-3.9.30.jar:lib/annotations.jar:lib/miglayout-4.0.jar:lib/surfaceplotter-2.0.1.jar">
<src path="autotest/src"/>
<src path="autoupdate/src"/>
<src path="../java_tools/configuration_definition/src"/>
@ -69,7 +69,7 @@
<jvmarg value="-XX:+HeapDumpOnOutOfMemoryError"/>
<formatter type="brief"/>
<classpath
path="lib/jssc.jar:build/classes:lib/junit.jar:lib/SteelSeries-3.9.30.jar:lib/miglayout-4.0.jar"/>
path="build/classes:lib/junit.jar:lib/SteelSeries-3.9.30.jar:lib/miglayout-4.0.jar"/>
<batchtest todir="build">
<fileset dir="autotest/src" includes="**/test/**/*Test.java"/>
<fileset dir="autoupdate/src" includes="**/test/**/*Test.java"/>
@ -116,7 +116,6 @@
<zipfileset src="lib/httpcore.jar" includes="**/*.class"/>
<zipfileset src="lib/httpmime.jar" includes="**/*.class"/>
<zipfileset src="lib/jaxb-api.jar" includes="**/*.class"/>
<zipfileset src="lib/jssc.jar" includes="**/*.class **/*.so **/*.dll **/*.jnilib"/>
<zipfileset src="lib/jSerialComm.jar" includes="**/*.class **/*.so **/*.dll **/*.jnilib"/>
<zipfileset src="lib/annotations.jar" includes="**/*.class"/>
<zipfileset src="lib/miglayout-4.0.jar" includes="**/*.class"/>

View File

@ -7,7 +7,6 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="jssc" level="project" />
<orderEntry type="module" module-name="models" exported="" />
<orderEntry type="module" module-name="logging" exported="" />
<orderEntry type="library" exported="" name="jcip-annotations" level="project" />

View File

@ -1,113 +0,0 @@
package com.rusefi.io.serial;
import com.rusefi.FileLog;
import com.opensr5.Logger;
import com.opensr5.io.DataListener;
import com.rusefi.io.IoStream;
import jssc.SerialPort;
import jssc.SerialPortException;
import java.io.IOException;
/**
* JSSC connector does not seem to be supported and might have some issues like inability to close/re-open connection nicely
* <p>
* (c) Andrey Belomutskiy
* 5/11/2015.
*/
public class SerialIoStreamJSSC implements IoStream {
private final SerialPort serialPort;
private final Logger logger;
private boolean isClosed;
public SerialIoStreamJSSC(SerialPort serialPort, Logger logger) {
this.serialPort = serialPort;
this.logger = logger;
}
public static void setupPort(SerialPort serialPort, int baudRate) throws SerialPortException {
serialPort.setRTS(false);
serialPort.setDTR(false);
serialPort.setParams(baudRate, 8, 1, 0);//Set params.
int mask = SerialPort.MASK_RXCHAR;
//Set the prepared mask
serialPort.setEventsMask(mask);
serialPort.setFlowControlMode(0);
}
public static SerialIoStreamJSSC open(String port, int baudRate, Logger logger) {
logger.info("[SerialIoStreamJSSC]");
SerialPort serialPort = new SerialPort(port);
try {
FileLog.MAIN.logLine("Opening " + port + " @ " + baudRate);
boolean opened = serialPort.openPort();//Open serial port
if (!opened)
FileLog.MAIN.logLine(port + ": not opened!");
SerialIoStreamJSSC.setupPort(serialPort, baudRate);
} catch (SerialPortException e) {
FileLog.MAIN.logLine("ERROR " + e.getMessage());
return null;
}
FileLog.MAIN.logLine("PortHolder: Sleeping a bit");
try {
// todo: why is this delay here? add a comment
Thread.sleep(200);
} catch (InterruptedException e) {
throw new IllegalStateException(e);
}
SerialIoStreamJSSC stream = new SerialIoStreamJSSC(serialPort, logger);
return stream;
}
@Override
public void close() {
isClosed = true;
try {
FileLog.MAIN.logLine("CLOSING PORT... " + serialPort.getPortName());
serialPort.removeEventListener();
serialPort.closePort();
FileLog.MAIN.logLine("PORT CLOSED: " + serialPort.getPortName());
} catch (SerialPortException e) {
logger.error("Error closing port: " + e);
}
}
@Override
public void write(byte[] bytes) throws IOException {
try {
synchronized (serialPort) {
serialPort.writeBytes(bytes);
}
} catch (SerialPortException e) {
throw new IOException(e);
}
}
@Override
public void purge() {
try {
synchronized (serialPort) {
serialPort.purgePort(SerialPort.PURGE_RXCLEAR | SerialPort.PURGE_TXCLEAR);
}
} catch (SerialPortException e) {
logger.info("Error while purge: " + e);
close();
}
}
@Override
public void setInputListener(DataListener listener) {
try {
JSSCPortReader reader = new JSSCPortReader(serialPort, listener, this);
serialPort.addEventListener(reader.getSerialPortEventListener());
reader.readInitial();
} catch (SerialPortException e) {
throw new IllegalStateException(e);
}
}
@Override
public boolean isClosed() {
return isClosed;
}
}

View File

@ -8,7 +8,7 @@ import com.rusefi.FileLog;
import com.rusefi.io.IoStream;
/**
* https://github.com/Fazecast/jSerialComm looks to be alive as of 2019
* https://github.com/Fazecast/jSerialComm looks to be alive as of 2020
* <p>
* (c) Andrey Belomutskiy
* 06/03/2019
@ -18,7 +18,10 @@ public class SerialIoStreamJSerialComm implements IoStream {
private SerialPort sp;
private final String port;
SerialIoStreamJSerialComm(SerialPort sp, String port) {
/**
* @see #openPort(String)
*/
private SerialIoStreamJSerialComm(SerialPort sp, String port) {
this.sp = sp;
this.port = port;
}

Binary file not shown.

Binary file not shown.

View File

@ -7,7 +7,6 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="jssc" level="project" />
<orderEntry type="module" module-name="inifile" exported="" />
</component>
</module>

View File

@ -9,7 +9,5 @@
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="models" />
<orderEntry type="module" module-name="io" />
<orderEntry type="library" name="jssc" level="project" />
</component>
</module>
</module>

View File

@ -2,15 +2,11 @@ package com.rusefi;
import com.opensr5.ConfigurationImage;
import com.opensr5.Logger;
import com.rusefi.binaryprotocol.BinaryProtocol;
import com.opensr5.io.ConfigurationImageFile;
import com.rusefi.binaryprotocol.BinaryProtocolHolder;
import com.rusefi.config.generated.Fields;
import com.rusefi.io.LinkManager;
import com.rusefi.io.serial.SerialIoStreamJSSC;
import com.rusefi.ui.RecentCommands;
import com.rusefi.ui.StatusWindow;
import jssc.SerialPort;
import jssc.SerialPortException;
import javax.swing.*;
@ -59,6 +55,7 @@ public class UploadChanges {
}
private static void showUi(String port) throws SerialPortException, IOException, InterruptedException {
/*
SerialPort serialPort;
serialPort = new SerialPort(port);
@ -77,6 +74,8 @@ public class UploadChanges {
bp.setController(ci1);
scheduleUpload(ci2);
*/
}
public static void scheduleUpload(final ConfigurationImage newVersion) {

View File

@ -7,8 +7,7 @@ import com.romraider.editor.ecu.ECUEditor;
import com.rusefi.RomRaiderWrapper;
import com.rusefi.UploadChanges;
import com.rusefi.config.generated.Fields;
import com.rusefi.io.serial.SerialIoStreamJSSC;
import jssc.SerialPort;
import com.rusefi.io.serial.SerialIoStreamJSerialComm;
/**
* (c) Andrey Belomutskiy
@ -26,15 +25,15 @@ public class BinaryProtocolCmdSandbox {
Logger logger = UploadChanges.logger;
SerialPort serialPort;
serialPort = new SerialPort(port);
boolean opened = serialPort.openPort();
if (!opened) {
logger.error("failed to open " + port);
}
BinaryProtocol bp = BinaryProtocolHolder.getInstance().create(logger, new SerialIoStreamJSSC(serialPort, logger));
//SerialPort serialPort;
// serialPort = new SerialPort(port);
// boolean opened = serialPort.openPort();
// if (!opened) {
// logger.error("failed to open " + port);
// }
BinaryProtocol bp = BinaryProtocolHolder.getInstance().create(logger, SerialIoStreamJSerialComm.openPort(port));
SerialIoStreamJSSC.setupPort(serialPort, 38400);
//SerialIoStreamJSSC.setupPort(serialPort, 38400);
logger.info("Binary looks good!");
bp.readImage(Fields.TOTAL_CONFIG_SIZE);

View File

@ -9,7 +9,6 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="io" />
<orderEntry type="library" name="jssc" level="project" />
<orderEntry type="library" name="miglayout" level="project" />
<orderEntry type="library" name="surfaceplotter" level="project" />
<orderEntry type="library" name="batik" level="project" />