|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgnu.io.CommPort
gnu.io.SerialPort
gnu.io.RXTXPort
Field Summary |
Fields inherited from class gnu.io.SerialPort |
DATABITS_5, DATABITS_6, DATABITS_7, DATABITS_8, FLOWCONTROL_NONE, FLOWCONTROL_RTSCTS_IN, FLOWCONTROL_RTSCTS_OUT, FLOWCONTROL_XONXOFF_IN, FLOWCONTROL_XONXOFF_OUT, PARITY_EVEN, PARITY_MARK, PARITY_NONE, PARITY_ODD, PARITY_SPACE, STOPBITS_1, STOPBITS_1_5, STOPBITS_2 |
Constructor Summary | |
RXTXPort(java.lang.String _portName)
Constructor |
Method Summary | |
void |
addEventListener(SerialPortEventListener lsnr)
Registers a SerialPortEventListener object to listen for SerialEvents. |
void |
close()
Closes the communications port. |
int |
getBaudRate()
Gets the currently configured baud rate. |
int |
getDataBits()
Gets the currently configured number of data bits. |
int |
getFlowControlMode()
Gets the currently configured flow control mode. |
int |
getParity()
Get the currently configured parity setting. |
int |
getStopBits()
Gets the currently defined stop bits. |
boolean |
isCD()
Gets the state of the CD (Carrier Detect) bit in the UART, if supported by the underlying implementation. |
boolean |
isCTS()
Gets the state of the CTS (Clear To Send) bit in the UART, if supported by the underlying implementation. |
boolean |
isDSR()
Gets the state of the DSR (Data Set Ready) bit in the UART, if supported by the underlying implementation. |
boolean |
isDTR()
Gets the state of the DTR (Data Terminal Ready) bit in the UART, if supported by the underlying implementation. |
boolean |
isRI()
Gets the state of the RI (Ring Indicator) bit in the UART, if supported by the underlying implementation. |
boolean |
isRTS()
Gets the state of the RTS (Request To Send) bit in the UART, if supported by the underlying implementation. |
void |
notifyOnBreakInterrupt(boolean enable)
Expresses interest in receiving notification when there is a break interrupt on the line. |
void |
notifyOnCarrierDetect(boolean enable)
Expresses interest in receiving notification when the CD (Carrier Detect) bit changes. |
void |
notifyOnCTS(boolean enable)
Expresses interest in receiving notification when the CTS (Clear To Send) bit changes. |
void |
notifyOnDataAvailable(boolean enable)
Expresses interest in receiving notification when input data is available. |
void |
notifyOnDSR(boolean enable)
Expresses interest in receiving notification when the DSR (Data Set Ready) bit changes. |
void |
notifyOnFramingError(boolean enable)
Expresses interest in receiving notification when there is a framing error. |
void |
notifyOnOutputEmpty(boolean enable)
Expresses interest in receiving notification when the output buffer is empty. |
void |
notifyOnOverrunError(boolean enable)
Expresses interest in receiving notification when there is an overrun error. |
void |
notifyOnParityError(boolean enable)
Expresses interest in receiving notification when there is a parity error. |
void |
notifyOnRingIndicator(boolean enable)
Expresses interest in receiving notification when the RI (Ring Indicator) bit changes. |
void |
removeEventListener()
Deregisters event listener registered using addEventListener. |
void |
sendBreak(int millis)
Sends a break of millis milliseconds duration. |
void |
setDTR(boolean dtr)
Sets or clears the DTR (Data Terminal Ready) bit in the UART, if supported by the underlying implementation. |
void |
setFlowControlMode(int flowcontrol)
Sets the flow control mode. |
void |
setRTS(boolean rts)
Sets or clears the RTS (Request To Send) bit in the UART, if supported by the underlying implementation. |
void |
setSerialPortParams(int _baudRate,
int _dataBits,
int _stopBits,
int _parity)
Sets serial port parameters. |
Methods inherited from class gnu.io.CommPort |
getName, toString |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public RXTXPort(java.lang.String _portName) throws PortInUseException
_portName
-
PortInUseException
Method Detail |
public void close()
close
in class CommPort
public int getBaudRate()
SerialPort
getBaudRate
in class SerialPort
public int getDataBits()
SerialPort
getDataBits
in class SerialPort
public int getStopBits()
SerialPort
getStopBits
in class SerialPort
public int getParity()
SerialPort
getParity
in class SerialPort
public void sendBreak(int millis)
SerialPort
sendBreak
in class SerialPort
millis
- - duration of break to sendpublic void setFlowControlMode(int flowcontrol) throws UnsupportedCommOperationException
SerialPort
setFlowControlMode
in class SerialPort
flowcontrol
- - control Can be a bitmask combination of
- FLOWCONTROL_NONE: no flow control
- FLOWCONTROL_RTSCTS_IN: RTS/CTS (hardware) flow control for input
- FLOWCONTROL_RTSCTS_OUT: RTS/CTS (hardware) flow control for output
- FLOWCONTROL_XONXOFF_IN: XON/XOFF (software) flow control for input
- FLOWCONTROL_XONXOFF_OUT: XON/XOFF (software) flow control for output
UnsupportedCommOperationException
- - if any of the flow control mode
was not supported by the underline OS, or if input and output flow control
are set to different values, i.e. one hardware and one software.
The flow control mode will revert to the value before the call was made.public int getFlowControlMode()
SerialPort
getFlowControlMode
in class SerialPort
public void setSerialPortParams(int _baudRate, int _dataBits, int _stopBits, int _parity) throws UnsupportedCommOperationException
setSerialPortParams
in class SerialPort
_baudRate
- - If the baudrate passed in by the application is unsupported
by the driver, the driver will throw an UnsupportedCommOperationException_dataBits
- - One of the following constants:
- DATABITS_5: 5 bits
- DATABITS_6: 6 bits
- DATABITS_7: 7 bits
- DATABITS_8: 8 bits_stopBits
- - One of the following constants:
- STOPBITS_1: 1 stop bit
- STOPBITS_2: 2 stop bits
- STOPBITS_1_5: 1.5 stop bits_parity
- - One of the following constants:
- PARITY_NONE: no parity
- PARITY_ODD: odd parity
- PARITY_EVEN: even parity
- PARITY_MARK: mark parity
- PARITY_SPACE: space parity
UnsupportedCommOperationException
- - if any of the above parameters
are specified incorrectly. All four of the parameters will revert to the
values before the call was made.
DEFAULT: 9600 baud, 8 data bits, 1 stop bit, no paritypublic void setDTR(boolean dtr)
SerialPort
setDTR
in class SerialPort
dtr
- - true: set DTR
- false: clear DTRpublic boolean isDTR()
SerialPort
isDTR
in class SerialPort
public void setRTS(boolean rts)
SerialPort
setRTS
in class SerialPort
rts
- - true: set RTS
- false: clear RTSpublic boolean isRTS()
SerialPort
isRTS
in class SerialPort
public boolean isCTS()
SerialPort
isCTS
in class SerialPort
public boolean isDSR()
SerialPort
isDSR
in class SerialPort
public boolean isRI()
SerialPort
isRI
in class SerialPort
public boolean isCD()
SerialPort
isCD
in class SerialPort
public void addEventListener(SerialPortEventListener lsnr) throws java.util.TooManyListenersException
SerialPort
addEventListener
in class SerialPort
lsnr
- - The SerialPortEventListener object whose serialEvent method
will be called with a SerialEvent describing the event.
java.util.TooManyListenersException
- - If an initial attempt
to attach a listener succeeds, subsequent attempts will throw
TooManyListenersException without effecting the first listener.public void removeEventListener()
SerialPort
removeEventListener
in class SerialPort
public void notifyOnDataAvailable(boolean enable)
SerialPort
notifyOnDataAvailable
in class SerialPort
enable
- - true: enable notification
- false: disable notificationpublic void notifyOnOutputEmpty(boolean enable)
SerialPort
notifyOnOutputEmpty
in class SerialPort
enable
- - true: enable notification
- false: disable notificationpublic void notifyOnCTS(boolean enable)
SerialPort
notifyOnCTS
in class SerialPort
enable
- - true: enable notification
- false: disable notificationpublic void notifyOnDSR(boolean enable)
SerialPort
notifyOnDSR
in class SerialPort
enable
- - true: enable notification
- false: disable notificationpublic void notifyOnRingIndicator(boolean enable)
SerialPort
notifyOnRingIndicator
in class SerialPort
enable
- - true: enable notification
- false: disable notificationpublic void notifyOnCarrierDetect(boolean enable)
SerialPort
notifyOnCarrierDetect
in class SerialPort
enable
- - true: enable notification
- false: disable notificationpublic void notifyOnOverrunError(boolean enable)
SerialPort
notifyOnOverrunError
in class SerialPort
enable
- - true: enable notification
- false: disable notificationpublic void notifyOnParityError(boolean enable)
SerialPort
notifyOnParityError
in class SerialPort
enable
- - true: enable notification
- false: disable notificationpublic void notifyOnFramingError(boolean enable)
SerialPort
notifyOnFramingError
in class SerialPort
enable
- - true: enable notification
- false: disable notificationpublic void notifyOnBreakInterrupt(boolean enable)
SerialPort
notifyOnBreakInterrupt
in class SerialPort
enable
- - true: enable notification
- false: disable notification
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |