Add LISTENING_EVENT_PORT_DISCONNECTED event type
This commit is contained in:
parent
7778b924e5
commit
541b76d864
|
@ -2,7 +2,7 @@
|
|||
* SerialPort.java
|
||||
*
|
||||
* Created on: Feb 25, 2012
|
||||
* Last Updated on: Jan 01, 2022
|
||||
* Last Updated on: Jan 04, 2022
|
||||
* Author: Will Hedgecock
|
||||
*
|
||||
* Copyright (C) 2012-2022 Fazecast, Inc.
|
||||
|
@ -485,6 +485,7 @@ public final class SerialPort
|
|||
static final public int LISTENING_EVENT_FIRMWARE_OVERRUN_ERROR = 0x00400000;
|
||||
static final public int LISTENING_EVENT_SOFTWARE_OVERRUN_ERROR = 0x00800000;
|
||||
static final public int LISTENING_EVENT_PARITY_ERROR = 0x01000000;
|
||||
static final public int LISTENING_EVENT_PORT_DISCONNECTED = 0x10000000;
|
||||
|
||||
// Serial Port Parameters
|
||||
private volatile long portHandle = -1;
|
||||
|
@ -914,7 +915,7 @@ public final class SerialPort
|
|||
/**
|
||||
* Adds a {@link SerialPortDataListener} to the serial port interface.
|
||||
* <p>
|
||||
* Calling this function enables event-based serial port callbacks to be used instead of, or in addition to, direct serial port read/write calls or the {@link java.io.InputStream}/{@link java.io.OutputStream} interface.
|
||||
* Calling this function enables event-based serial port callbacks to be used instead of direct serial port read/write calls or the {@link java.io.InputStream}/{@link java.io.OutputStream} interface.
|
||||
* <p>
|
||||
* The parameter passed into this method must be an implementation of either {@link SerialPortDataListener}, {@link SerialPortDataListenerWithExceptions},
|
||||
* {@link SerialPortPacketListener}, {@link SerialPortMessageListener} or {@link SerialPortMessageListenerWithExceptions}.
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
* SerialPortDataListener.java
|
||||
*
|
||||
* Created on: Feb 25, 2015
|
||||
* Last Updated on: Dec 17, 2021
|
||||
* Last Updated on: Jan 04, 2022
|
||||
* Author: Will Hedgecock
|
||||
*
|
||||
* Copyright (C) 2012-2021 Fazecast, Inc.
|
||||
* Copyright (C) 2012-2022 Fazecast, Inc.
|
||||
*
|
||||
* This file is part of jSerialComm.
|
||||
*
|
||||
|
@ -44,6 +44,7 @@ public interface SerialPortDataListener extends EventListener
|
|||
* {@link SerialPort#LISTENING_EVENT_DATA_AVAILABLE}<br>
|
||||
* {@link SerialPort#LISTENING_EVENT_DATA_RECEIVED}<br>
|
||||
* {@link SerialPort#LISTENING_EVENT_DATA_WRITTEN}<br>
|
||||
* {@link SerialPort#LISTENING_EVENT_PORT_DISCONNECTED}<br>
|
||||
* {@link SerialPort#LISTENING_EVENT_BREAK_INTERRUPT}<br>
|
||||
* {@link SerialPort#LISTENING_EVENT_CARRIER_DETECT}<br>
|
||||
* {@link SerialPort#LISTENING_EVENT_CTS}<br>
|
||||
|
@ -58,11 +59,17 @@ public interface SerialPortDataListener extends EventListener
|
|||
* <p>
|
||||
* Note that event-based <i>write</i> callbacks are only supported on Windows operating systems. As such, the {@link SerialPort#LISTENING_EVENT_DATA_WRITTEN}
|
||||
* event will never be called on a non-Windows system.
|
||||
* <p>
|
||||
* It is recommended to <b>only</b> use the {@link SerialPort#LISTENING_EVENT_DATA_AVAILABLE}, {@link SerialPort#LISTENING_EVENT_DATA_RECEIVED},
|
||||
* {@link SerialPort#LISTENING_EVENT_DATA_WRITTEN}, and/or {@link SerialPort#LISTENING_EVENT_PORT_DISCONNECTED} listening events in production or cross-platform code
|
||||
* since underlying differences and lack of support for the control line status and error events among the various operating systems and device drivers make it
|
||||
* unlikely that code listening for these events will behave similarly across different serial devices or OS's, if it works at all.
|
||||
*
|
||||
* @return The event constants that should trigger the {@link #serialEvent(SerialPortEvent)} callback.
|
||||
* @see SerialPort#LISTENING_EVENT_DATA_AVAILABLE
|
||||
* @see SerialPort#LISTENING_EVENT_DATA_RECEIVED
|
||||
* @see SerialPort#LISTENING_EVENT_DATA_WRITTEN
|
||||
* @see SerialPort#LISTENING_EVENT_PORT_DISCONNECTED
|
||||
* @see SerialPort#LISTENING_EVENT_BREAK_INTERRUPT
|
||||
* @see SerialPort#LISTENING_EVENT_CARRIER_DETECT
|
||||
* @see SerialPort#LISTENING_EVENT_CTS
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
* SerialPortEvent.java
|
||||
*
|
||||
* Created on: Feb 25, 2015
|
||||
* Last Updated on: Dec 17, 2021
|
||||
* Last Updated on: Jan 04, 2022
|
||||
* Author: Will Hedgecock
|
||||
*
|
||||
* Copyright (C) 2012-2021 Fazecast, Inc.
|
||||
* Copyright (C) 2012-2022 Fazecast, Inc.
|
||||
*
|
||||
* This file is part of jSerialComm.
|
||||
*
|
||||
|
@ -50,6 +50,7 @@ public class SerialPortEvent extends EventObject
|
|||
* {@link SerialPort#LISTENING_EVENT_DATA_AVAILABLE}<br>
|
||||
* {@link SerialPort#LISTENING_EVENT_DATA_RECEIVED}<br>
|
||||
* {@link SerialPort#LISTENING_EVENT_DATA_WRITTEN}<br>
|
||||
* {@link SerialPort#LISTENING_EVENT_PORT_DISCONNECTED}<br>
|
||||
* {@link SerialPort#LISTENING_EVENT_BREAK_INTERRUPT}<br>
|
||||
* {@link SerialPort#LISTENING_EVENT_CARRIER_DETECT}<br>
|
||||
* {@link SerialPort#LISTENING_EVENT_CTS}<br>
|
||||
|
@ -62,12 +63,16 @@ public class SerialPortEvent extends EventObject
|
|||
* <p>
|
||||
* Note that event-based write callbacks are only supported on Windows operating systems. As such, the {@link SerialPort#LISTENING_EVENT_DATA_WRITTEN}
|
||||
* event will never be called on a non-Windows system.
|
||||
* <p>
|
||||
* Also, most control line status and error events from {@link SerialPort#LISTENING_EVENT_BREAK_INTERRUPT} to {@link SerialPort#LISTENING_EVENT_PARITY_ERROR}
|
||||
* are unlikely to function the same across different operating systems or serial devices on the same operating system, if they work properly at all.
|
||||
*
|
||||
* @param comPort The {@link SerialPort} about which this object is being created.
|
||||
* @param serialEventType The type of serial port event that this object describes.
|
||||
* @see SerialPort#LISTENING_EVENT_DATA_AVAILABLE
|
||||
* @see SerialPort#LISTENING_EVENT_DATA_RECEIVED
|
||||
* @see SerialPort#LISTENING_EVENT_DATA_WRITTEN
|
||||
* @see SerialPort#LISTENING_EVENT_PORT_DISCONNECTED
|
||||
* @see SerialPort#LISTENING_EVENT_BREAK_INTERRUPT
|
||||
* @see SerialPort#LISTENING_EVENT_CARRIER_DETECT
|
||||
* @see SerialPort#LISTENING_EVENT_CTS
|
||||
|
@ -93,6 +98,7 @@ public class SerialPortEvent extends EventObject
|
|||
* {@link SerialPort#LISTENING_EVENT_DATA_AVAILABLE}<br>
|
||||
* {@link SerialPort#LISTENING_EVENT_DATA_RECEIVED}<br>
|
||||
* {@link SerialPort#LISTENING_EVENT_DATA_WRITTEN}<br>
|
||||
* {@link SerialPort#LISTENING_EVENT_PORT_DISCONNECTED}<br>
|
||||
* {@link SerialPort#LISTENING_EVENT_BREAK_INTERRUPT}<br>
|
||||
* {@link SerialPort#LISTENING_EVENT_CARRIER_DETECT}<br>
|
||||
* {@link SerialPort#LISTENING_EVENT_CTS}<br>
|
||||
|
@ -105,6 +111,9 @@ public class SerialPortEvent extends EventObject
|
|||
* <p>
|
||||
* Note that event-based write callbacks are only supported on Windows operating systems. As such, the {@link SerialPort#LISTENING_EVENT_DATA_WRITTEN}
|
||||
* event will never be called on a non-Windows system.
|
||||
* <p>
|
||||
* Also, most control line status and error events from {@link SerialPort#LISTENING_EVENT_BREAK_INTERRUPT} to {@link SerialPort#LISTENING_EVENT_PARITY_ERROR}
|
||||
* are unlikely to function the same across different operating systems or serial devices on the same operating system, if they work properly at all.
|
||||
*
|
||||
* @param comPort The {@link SerialPort} about which this object is being created.
|
||||
* @param serialEventType The type of serial port event that this object describes.
|
||||
|
@ -112,6 +121,7 @@ public class SerialPortEvent extends EventObject
|
|||
* @see SerialPort#LISTENING_EVENT_DATA_AVAILABLE
|
||||
* @see SerialPort#LISTENING_EVENT_DATA_RECEIVED
|
||||
* @see SerialPort#LISTENING_EVENT_DATA_WRITTEN
|
||||
* @see SerialPort#LISTENING_EVENT_PORT_DISCONNECTED
|
||||
* @see SerialPort#LISTENING_EVENT_BREAK_INTERRUPT
|
||||
* @see SerialPort#LISTENING_EVENT_CARRIER_DETECT
|
||||
* @see SerialPort#LISTENING_EVENT_CTS
|
||||
|
@ -144,6 +154,7 @@ public class SerialPortEvent extends EventObject
|
|||
* {@link SerialPort#LISTENING_EVENT_DATA_AVAILABLE}<br>
|
||||
* {@link SerialPort#LISTENING_EVENT_DATA_RECEIVED}<br>
|
||||
* {@link SerialPort#LISTENING_EVENT_DATA_WRITTEN}<br>
|
||||
* {@link SerialPort#LISTENING_EVENT_PORT_DISCONNECTED}<br>
|
||||
* {@link SerialPort#LISTENING_EVENT_BREAK_INTERRUPT}<br>
|
||||
* {@link SerialPort#LISTENING_EVENT_CARRIER_DETECT}<br>
|
||||
* {@link SerialPort#LISTENING_EVENT_CTS}<br>
|
||||
|
@ -156,11 +167,15 @@ public class SerialPortEvent extends EventObject
|
|||
* <p>
|
||||
* Note that event-based write callbacks are only supported on Windows operating systems. As such, the {@link SerialPort#LISTENING_EVENT_DATA_WRITTEN}
|
||||
* event will never be called on a non-Windows system.
|
||||
* <p>
|
||||
* Also, most control line status and error events from {@link SerialPort#LISTENING_EVENT_BREAK_INTERRUPT} to {@link SerialPort#LISTENING_EVENT_PARITY_ERROR}
|
||||
* are unlikely to function the same across different operating systems or serial devices on the same operating system, if they work properly at all.
|
||||
*
|
||||
* @return The serial port event that this object describes.
|
||||
* @see SerialPort#LISTENING_EVENT_DATA_AVAILABLE
|
||||
* @see SerialPort#LISTENING_EVENT_DATA_RECEIVED
|
||||
* @see SerialPort#LISTENING_EVENT_DATA_WRITTEN
|
||||
* @see SerialPort#LISTENING_EVENT_PORT_DISCONNECTED
|
||||
* @see SerialPort#LISTENING_EVENT_BREAK_INTERRUPT
|
||||
* @see SerialPort#LISTENING_EVENT_CARRIER_DETECT
|
||||
* @see SerialPort#LISTENING_EVENT_CTS
|
||||
|
|
Loading…
Reference in New Issue