Investigate JSSC connector removal fix #858
This commit is contained in:
parent
0994f3db9d
commit
ec80aaffaa
|
@ -119,15 +119,7 @@ public class PortHolder {
|
|||
}
|
||||
|
||||
public EstablishConnection invoke() {
|
||||
// todo: BUG: Mac version 10 also 'is windows10 == true' at the moment :)
|
||||
boolean windows10 = isWindows10();
|
||||
FileLog.MAIN.logLine("Is windows10: " + windows10);
|
||||
if (windows10) {
|
||||
// this implementation is way simpler but seems to kind of work, keeping just in case
|
||||
stream = SerialIoStreamJSerialComm.open(port, BAUD_RATE, FileLog.LOGGER);
|
||||
} else {
|
||||
stream = SerialIoStreamJSSC.open(port, BAUD_RATE, FileLog.LOGGER);
|
||||
}
|
||||
stream = SerialIoStreamJSerialComm.open(port, BAUD_RATE, FileLog.LOGGER);
|
||||
if (stream == null) {
|
||||
isConnected = false;
|
||||
return this;
|
||||
|
|
|
@ -10,6 +10,8 @@ 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.
|
||||
*/
|
||||
|
@ -61,7 +63,7 @@ public class SerialIoStreamJSSC implements IoStream {
|
|||
public void close() {
|
||||
isClosed = true;
|
||||
try {
|
||||
FileLog.MAIN.logLine("CLOSING PORT... " + serialPort.getPortName());
|
||||
FileLog.MAIN.logLine("CLOSING PORT... " + serialPort.getPortName());
|
||||
serialPort.removeEventListener();
|
||||
serialPort.closePort();
|
||||
FileLog.MAIN.logLine("PORT CLOSED: " + serialPort.getPortName());
|
||||
|
|
|
@ -69,7 +69,7 @@ public class SerialIoStreamJSerialComm implements IoStream {
|
|||
}
|
||||
|
||||
public static IoStream open(String port, int baudRate, Logger logger) {
|
||||
logger.info("[SerialIoStreamJSerialComm]");
|
||||
logger.info("[SerialIoStreamJSerialComm] " + port);
|
||||
SerialPort sp = SerialPort.getCommPort(port);
|
||||
sp.setBaudRate(baudRate);
|
||||
sp.openPort();
|
||||
|
|
Loading…
Reference in New Issue