Fazecast / jSerialComm

Platform-independent serial port access for Java
GNU Lesser General Public License v3.0
1.34k stars 287 forks source link

Would this work? #452

Closed EasyG0ing1 closed 1 year ago

EasyG0ing1 commented 2 years ago

Would this method (or one like it) work in the SerialPortEvent class?

@Override
public final String toString() {
    return switch(eventType) {
        case SerialPort.LISTENING_EVENT_DATA_AVAILABLE -> "LISTENING_EVENT_DATA_AVAILABLE";
        case SerialPort.LISTENING_EVENT_DATA_RECEIVED -> "LISTENING_EVENT_DATA_RECEIVED";
        case SerialPort.LISTENING_EVENT_DATA_WRITTEN -> "LISTENING_EVENT_DATA_WRITTEN";
        case SerialPort.LISTENING_EVENT_PORT_DISCONNECTED -> "LISTENING_EVENT_PORT_DISCONNECTED";
        case SerialPort.LISTENING_EVENT_BREAK_INTERRUPT -> "LISTENING_EVENT_BREAK_INTERRUPT";
        case SerialPort.LISTENING_EVENT_CARRIER_DETECT -> "LISTENING_EVENT_CARRIER_DETECT";
        case SerialPort.LISTENING_EVENT_CTS -> "LISTENING_EVENT_CTS";
        case SerialPort.LISTENING_EVENT_DSR -> "LISTENING_EVENT_DSR";
        case SerialPort.LISTENING_EVENT_RING_INDICATOR -> "LISTENING_EVENT_RING_INDICATOR";
        case SerialPort.LISTENING_EVENT_FRAMING_ERROR -> "LISTENING_EVENT_FRAMING_ERROR";
        case SerialPort.LISTENING_EVENT_FIRMWARE_OVERRUN_ERROR -> "LISTENING_EVENT_FIRMWARE_OVERRUN_ERROR";
        case SerialPort.LISTENING_EVENT_SOFTWARE_OVERRUN_ERROR -> "LISTENING_EVENT_SOFTWARE_OVERRUN_ERROR";
        case SerialPort.LISTENING_EVENT_PARITY_ERROR -> "LISTENING_EVENT_PARITY_ERROR";
    }
}
hedgecrw commented 2 years ago

Absolutely. Adding this to the next release (should be coming out shortly, couple of weeks tops).

hedgecrw commented 1 year ago

Implemented in new release v2.9.3