NeuronRobotics / nrjavaserial

A Java Serial Port system. This is a fork of the RXTX project that uses in jar loading of the native code.
Other
345 stars 143 forks source link

Setting notifyOnOutputEmpty to true causes no events to be fired anymore #128

Closed abuis closed 4 years ago

abuis commented 5 years ago

When setting notifyOnOutputEmpty to true, no serial port events seem to be fired anymore.

When I do not set it to true, I receive serial port events when CTS or RTS changes and when data is available, but if I do set it to true I do not receive any event anymore.

CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier(portName);
SerialPort port = portId.open("Me", 5000);
port.setSerialPortParams(baudRate, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
port.setFlowControlMode(SerialPort.FLOWCONTROL_NONE);
//port.setFlowControlMode(gnu.io.SerialPort.FLOWCONTROL_RTSCTS_IN | gnu.io.SerialPort.FLOWCONTROL_RTSCTS_OUT);

port.setOutputBufferSize(1);
port.setInputBufferSize(1);
port.enableReceiveTimeout(receiveTimeOutMillis);
port.notifyOnDataAvailable(true);
//port.notifyOnOutputEmpty(true); // turning this on seems to disable other events
port.notifyOnCTS(true);
port.notifyOnDSR(true);

port.setRTS(false);
port.addEventListener(eventHandler);
madhephaestus commented 4 years ago

stale