- All Implemented Interfaces:
Serializable
- See Also:
-
Field Summary
Fields inherited from class java.util.EventObject
source -
Constructor Summary
ConstructorsConstructorDescriptionSerialPortEvent(SerialPort comPort, int serialEventType) Constructs aSerialPortEventobject corresponding to the specified serial event type.SerialPortEvent(SerialPort comPort, int serialEventType, byte[] data) Constructs aSerialPortEventobject corresponding to the specified serial event type and containing the passed-in data bytes. -
Method Summary
Modifier and TypeMethodDescriptionfinal intReturns the type of serial port events that caused this object to be created.final byte[]Returns any raw data bytes associated with this serial port event.final SerialPortReturns theSerialPortthat triggered this event.final StringtoString()Returns a string representation of the type of event represented by this object.Methods inherited from class java.util.EventObject
getSource
-
Constructor Details
-
SerialPortEvent
Constructs aSerialPortEventobject corresponding to the specified serial event type.This constructor should only be used when the
SerialPortEventdoes not contain any data bytes.Valid serial event types are:
SerialPort.LISTENING_EVENT_DATA_AVAILABLE
SerialPort.LISTENING_EVENT_DATA_RECEIVED
SerialPort.LISTENING_EVENT_DATA_WRITTEN
SerialPort.LISTENING_EVENT_PORT_DISCONNECTED
SerialPort.LISTENING_EVENT_BREAK_INTERRUPT
SerialPort.LISTENING_EVENT_CARRIER_DETECT
SerialPort.LISTENING_EVENT_CTS
SerialPort.LISTENING_EVENT_DSR
SerialPort.LISTENING_EVENT_RING_INDICATOR
SerialPort.LISTENING_EVENT_FRAMING_ERROR
SerialPort.LISTENING_EVENT_FIRMWARE_OVERRUN_ERROR
SerialPort.LISTENING_EVENT_SOFTWARE_OVERRUN_ERROR
SerialPort.LISTENING_EVENT_PARITY_ERROR
Note that event-based write callbacks are only supported on Windows operating systems. As such, the
SerialPort.LISTENING_EVENT_DATA_WRITTENevent will never be called on a non-Windows system.Also, most control line status and error events from
SerialPort.LISTENING_EVENT_BREAK_INTERRUPTtoSerialPort.LISTENING_EVENT_PARITY_ERRORare unlikely to function the same across different operating systems or serial devices on the same operating system, if they work properly at all.- Parameters:
comPort- TheSerialPortabout which this object is being created.serialEventType- The type of serial port event that this object describes.- See Also:
-
SerialPortEvent
Constructs aSerialPortEventobject corresponding to the specified serial event type and containing the passed-in data bytes.Valid serial event types are:
SerialPort.LISTENING_EVENT_DATA_AVAILABLE
SerialPort.LISTENING_EVENT_DATA_RECEIVED
SerialPort.LISTENING_EVENT_DATA_WRITTEN
SerialPort.LISTENING_EVENT_PORT_DISCONNECTED
SerialPort.LISTENING_EVENT_BREAK_INTERRUPT
SerialPort.LISTENING_EVENT_CARRIER_DETECT
SerialPort.LISTENING_EVENT_CTS
SerialPort.LISTENING_EVENT_DSR
SerialPort.LISTENING_EVENT_RING_INDICATOR
SerialPort.LISTENING_EVENT_FRAMING_ERROR
SerialPort.LISTENING_EVENT_FIRMWARE_OVERRUN_ERROR
SerialPort.LISTENING_EVENT_SOFTWARE_OVERRUN_ERROR
SerialPort.LISTENING_EVENT_PARITY_ERROR
Note that event-based write callbacks are only supported on Windows operating systems. As such, the
SerialPort.LISTENING_EVENT_DATA_WRITTENevent will never be called on a non-Windows system.Also, most control line status and error events from
SerialPort.LISTENING_EVENT_BREAK_INTERRUPTtoSerialPort.LISTENING_EVENT_PARITY_ERRORare unlikely to function the same across different operating systems or serial devices on the same operating system, if they work properly at all.- Parameters:
comPort- TheSerialPortabout which this object is being created.serialEventType- The type of serial port event that this object describes.data- The raw data bytes corresponding to this serial port event.- See Also:
-
-
Method Details
-
toString
Returns a string representation of the type of event represented by this object.- Overrides:
toStringin classEventObject- Returns:
- A string representation of the type of event represented by this object.
-
getSerialPort
Returns theSerialPortthat triggered this event.- Returns:
- The
SerialPortthat triggered this event.
-
getEventType
public final int getEventType()Returns the type of serial port events that caused this object to be created.Return value will be a bitmask containing one or more of the following items OR'd together:
SerialPort.LISTENING_EVENT_DATA_AVAILABLE
SerialPort.LISTENING_EVENT_DATA_RECEIVED
SerialPort.LISTENING_EVENT_DATA_WRITTEN
SerialPort.LISTENING_EVENT_PORT_DISCONNECTED
SerialPort.LISTENING_EVENT_BREAK_INTERRUPT
SerialPort.LISTENING_EVENT_CARRIER_DETECT
SerialPort.LISTENING_EVENT_CTS
SerialPort.LISTENING_EVENT_DSR
SerialPort.LISTENING_EVENT_RING_INDICATOR
SerialPort.LISTENING_EVENT_FRAMING_ERROR
SerialPort.LISTENING_EVENT_FIRMWARE_OVERRUN_ERROR
SerialPort.LISTENING_EVENT_SOFTWARE_OVERRUN_ERROR
SerialPort.LISTENING_EVENT_PARITY_ERROR
Note that event-based write callbacks are only supported on Windows operating systems. As such, the
SerialPort.LISTENING_EVENT_DATA_WRITTENevent will never be called on a non-Windows system.Also, most control line status and error events from
SerialPort.LISTENING_EVENT_BREAK_INTERRUPTtoSerialPort.LISTENING_EVENT_PARITY_ERRORare unlikely to function the same across different operating systems or serial devices on the same operating system, if they work properly at all.- Returns:
- The serial port event that this object describes.
- See Also:
-
getReceivedData
public final byte[] getReceivedData()Returns any raw data bytes associated with this serial port event.- Returns:
- Any data bytes associated with this serial port event or null if none exist.
-