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() {
|
public EstablishConnection invoke() {
|
||||||
// todo: BUG: Mac version 10 also 'is windows10 == true' at the moment :)
|
stream = SerialIoStreamJSerialComm.open(port, BAUD_RATE, FileLog.LOGGER);
|
||||||
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);
|
|
||||||
}
|
|
||||||
if (stream == null) {
|
if (stream == null) {
|
||||||
isConnected = false;
|
isConnected = false;
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -10,6 +10,8 @@ import jssc.SerialPortException;
|
||||||
import java.io.IOException;
|
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
|
* (c) Andrey Belomutskiy
|
||||||
* 5/11/2015.
|
* 5/11/2015.
|
||||||
*/
|
*/
|
||||||
|
@ -61,7 +63,7 @@ public class SerialIoStreamJSSC implements IoStream {
|
||||||
public void close() {
|
public void close() {
|
||||||
isClosed = true;
|
isClosed = true;
|
||||||
try {
|
try {
|
||||||
FileLog.MAIN.logLine("CLOSING PORT... " + serialPort.getPortName());
|
FileLog.MAIN.logLine("CLOSING PORT... " + serialPort.getPortName());
|
||||||
serialPort.removeEventListener();
|
serialPort.removeEventListener();
|
||||||
serialPort.closePort();
|
serialPort.closePort();
|
||||||
FileLog.MAIN.logLine("PORT CLOSED: " + serialPort.getPortName());
|
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) {
|
public static IoStream open(String port, int baudRate, Logger logger) {
|
||||||
logger.info("[SerialIoStreamJSerialComm]");
|
logger.info("[SerialIoStreamJSerialComm] " + port);
|
||||||
SerialPort sp = SerialPort.getCommPort(port);
|
SerialPort sp = SerialPort.getCommPort(port);
|
||||||
sp.setBaudRate(baudRate);
|
sp.setBaudRate(baudRate);
|
||||||
sp.openPort();
|
sp.openPort();
|
||||||
|
|
Loading…
Reference in New Issue