Package jssc
Class SerialPortEvent
- java.lang.Object
-
- jssc.SerialPortEvent
-
public class SerialPortEvent extends Object
- Author:
- scream3r
-
-
Field Summary
Fields Modifier and Type Field Description static intBREAKDeprecated.static intCTSDeprecated.static intDSRDeprecated.static intERRDeprecated.static intRINGDeprecated.static intRLSDDeprecated.static intRXCHARDeprecated.static intRXFLAGDeprecated.static intTXEMPTYDeprecated.
-
Constructor Summary
Constructors Constructor Description SerialPortEvent(String portName, int eventType, int eventValue)Deprecated.SerialPortEvent(SerialPort port, int eventType, int eventValue)Constructs a SerialPortEvent representing a port, event type and event value.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description intgetEventType()Getting event typeintgetEventValue()Getting event value
Event values depending on their types:
RXCHAR - bytes count in input buffer
RXFLAG - bytes count in input buffer (Not supported in Linux)
TXEMPTY - bytes count in output buffer
CTS - state of CTS line (0 - OFF, 1 - ON)
DSR - state of DSR line (0 - OFF, 1 - ON)
RLSD - state of RLSD line (0 - OFF, 1 - ON)
BREAK - 0
RING - state of RING line (0 - OFF, 1 - ON)
ERR - mask of errorsSerialPortgetPort()Getting the port that set off this eventStringgetPortName()Deprecated.booleanisBREAK()Convenience method to check ifgetEventType()isSerialPort.MASK_BREAKbooleanisCTS()Convenience method to check ifgetEventType()isSerialPort.MASK_CTSbooleanisDSR()Convenience method to check ifgetEventType()isSerialPort.MASK_DSRbooleanisERR()Convenience method to check ifgetEventType()isSerialPort.MASK_ERRbooleanisRING()Convenience method to check ifgetEventType()isSerialPort.MASK_RINGbooleanisRLSD()Convenience method to check ifgetEventType()isSerialPort.MASK_RLSDbooleanisRXCHAR()Convenience method to check ifgetEventType()isSerialPort.MASK_RXCHARbooleanisRXFLAG()Convenience method to check ifgetEventType()isSerialPort.MASK_RXFLAGbooleanisTXEMPTY()Convenience method to check ifgetEventType()isSerialPort.MASK_TXEMPTY
-
-
-
Field Detail
-
RXCHAR
@Deprecated public static final int RXCHAR
Deprecated.Deprecated: UseSerialPort.MASK_RXCHARinstead- See Also:
- Constant Field Values
-
RXFLAG
@Deprecated public static final int RXFLAG
Deprecated.Deprecated: UseSerialPort.MASK_RXFLAGinstead- See Also:
- Constant Field Values
-
TXEMPTY
@Deprecated public static final int TXEMPTY
Deprecated.Deprecated: UseSerialPort.MASK_TXEMPTYinstead- See Also:
- Constant Field Values
-
CTS
@Deprecated public static final int CTS
Deprecated.Deprecated: UseSerialPort.MASK_CTSinstead- See Also:
- Constant Field Values
-
DSR
@Deprecated public static final int DSR
Deprecated.Deprecated: UseSerialPort.MASK_DSRinstead- See Also:
- Constant Field Values
-
RLSD
@Deprecated public static final int RLSD
Deprecated.Deprecated: UseSerialPort.MASK_RLSDinstead- See Also:
- Constant Field Values
-
BREAK
@Deprecated public static final int BREAK
Deprecated.Deprecated: UseSerialPort.MASK_BREAKinstead- See Also:
- Constant Field Values
-
ERR
@Deprecated public static final int ERR
Deprecated.Deprecated: UseSerialPort.MASK_ERRinstead- See Also:
- Constant Field Values
-
RING
@Deprecated public static final int RING
Deprecated.Deprecated: UseSerialPort.MASK_RINGinstead- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SerialPortEvent
public SerialPortEvent(SerialPort port, int eventType, int eventValue)
Constructs a SerialPortEvent representing a port, event type and event value.- Parameters:
port-SerialPortobject which the event occurredeventType- Can be any value fromSerialPort.MASK_*orLinuxEventThread.INTERRUPT_*eventValue- Event value which changes context depending ongetEventType()- See Also:
getEventType()
-
SerialPortEvent
@Deprecated public SerialPortEvent(String portName, int eventType, int eventValue)
Deprecated.Constructs a SerialPortEvent representing a port, event type and event value. Deprecated: UseSerialPortEvent(SerialPort, int, int)instead.- Parameters:
portName- port which the event occurredeventType- Can be any value fromSerialPort.MASK_*orLinuxEventThread.INTERRUPT_*eventValue- Event value which changes context depending ongetEventType()- See Also:
SerialPortEvent(SerialPort, int, int)
-
-
Method Detail
-
getPort
public SerialPort getPort()
Getting the port that set off this event- Returns:
- The
SerialPortobject the event occurred on
-
getPortName
@Deprecated public String getPortName()
Deprecated.Getting port name which sent the event- Returns:
- The port name the event occurred on
-
getEventType
public int getEventType()
Getting event type- Returns:
- The
SerialPort.MASK_*event mask
-
getEventValue
public int getEventValue()
Getting event value
Event values depending on their types:
RXCHAR - bytes count in input buffer
RXFLAG - bytes count in input buffer (Not supported in Linux)
TXEMPTY - bytes count in output buffer
CTS - state of CTS line (0 - OFF, 1 - ON)
DSR - state of DSR line (0 - OFF, 1 - ON)
RLSD - state of RLSD line (0 - OFF, 1 - ON)
BREAK - 0
RING - state of RING line (0 - OFF, 1 - ON)
ERR - mask of errors- Returns:
- Event value which changes context depending on
getEventType()(see listing)
-
isRXCHAR
public boolean isRXCHAR()
Convenience method to check ifgetEventType()isSerialPort.MASK_RXCHAR- Returns:
- true or false
-
isRXFLAG
public boolean isRXFLAG()
Convenience method to check ifgetEventType()isSerialPort.MASK_RXFLAG- Returns:
- true or false
-
isTXEMPTY
public boolean isTXEMPTY()
Convenience method to check ifgetEventType()isSerialPort.MASK_TXEMPTY- Returns:
- true or false
-
isCTS
public boolean isCTS()
Convenience method to check ifgetEventType()isSerialPort.MASK_CTS- Returns:
- true or false
-
isDSR
public boolean isDSR()
Convenience method to check ifgetEventType()isSerialPort.MASK_DSR- Returns:
- true or false
-
isRLSD
public boolean isRLSD()
Convenience method to check ifgetEventType()isSerialPort.MASK_RLSD- Returns:
- true or false
-
isBREAK
public boolean isBREAK()
Convenience method to check ifgetEventType()isSerialPort.MASK_BREAK- Returns:
- true or false
-
isERR
public boolean isERR()
Convenience method to check ifgetEventType()isSerialPort.MASK_ERR- Returns:
- true or false
-
isRING
public boolean isRING()
Convenience method to check ifgetEventType()isSerialPort.MASK_RING- Returns:
- true or false
-
-