gnu.io.SerialPortEventListener Java Examples

The following examples show how to use gnu.io.SerialPortEventListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SerialWrapper.java    From gsn with GNU General Public License v3.0 5 votes vote down vote up
public void addEventListener ( SerialPortEventListener listener ) {
	try {
		sPort.addEventListener( listener );
	} catch ( TooManyListenersException e ) {
		sPort.close( );
		logger.warn( e.getMessage( ) , e );
	}
}
 
Example #2
Source File: SerialConnector.java    From openhab1-addons with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Set the serial event handler
 */
private void setSerialEventHandler(SerialPortEventListener serialPortEventListenser) {
    try {
        // Add the serial port event listener
        serialPort.addEventListener(serialPortEventListenser);
        serialPort.notifyOnDataAvailable(true);
    } catch (TooManyListenersException tooManyListenersException) {
        logger.error("open(): Too Many Listeners Exception: ", tooManyListenersException);
    }
}
 
Example #3
Source File: NRSerial.java    From cncgcodecontroller with MIT License 4 votes vote down vote up
public void addEventListener(SerialPortEventListener lsnr)
                      throws TooManyListenersException {
  serial.addEventListener(lsnr);
}