How to catch all kinds of interrupt Requests in jSerialCom library?

307 Views Asked by At

As we all know, jSerialCom is a high-quality Java library for reading serial data; Previously, RXTX was also a good choice,

So in jSerialCom, how to catch all kinds of interrupt events like RXTX?

In RXTX, there are these java statements to catch various interrupts event

serialPort.notifyOnFramingError (true);

serialPort.notifyOnBreakInterrupt (true);

then,in catch code,we can write:

switch ( event.getEventType ()) {

    case SerialPortEvent.FE :

        break;

    case SerialPortEvent.OUTPUT_ BUFFER_ EMPTY:

        break;

    case SerialPortEvent.DATA_ AVAILABLE:

        //read data of serial port ...  
        break;

    case default:

        break;

But what about of jSerialCom? There is only 'LISTENING_EVENT_DATA_AVAILABLE' like blow code ? No need to catch other interrupt Requests?

if ( event.getEventType () != SerialPort.LISTENING_EVENT_DATA_AVAILABLE ) {

     return;

}
1

There are 1 best solutions below