|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgnu.io.CommPort
gnu.io.SerialPort
Field Summary | |
static int |
DATABITS_5
5 data bit format. |
static int |
DATABITS_6
6 data bit format. |
static int |
DATABITS_7
7 data bit format. |
static int |
DATABITS_8
8 data bit format. |
static int |
FLOWCONTROL_NONE
Flow control off. |
static int |
FLOWCONTROL_RTSCTS_IN
RTS/CTS flow control on input. |
static int |
FLOWCONTROL_RTSCTS_OUT
RTS/CTS flow control on output. |
static int |
FLOWCONTROL_XONXOFF_IN
XON/XOFF flow control on input. |
static int |
FLOWCONTROL_XONXOFF_OUT
XON/XOFF flow control on output. |
static int |
PARITY_EVEN
EVEN parity scheme. |
static int |
PARITY_MARK
MARK parity scheme. |
static int |
PARITY_NONE
No parity bit. |
static int |
PARITY_ODD
ODD parity scheme. |
static int |
PARITY_SPACE
SPACE parity scheme. |
static int |
STOPBITS_1
Number of STOP bits - 1. |
static int |
STOPBITS_1_5
Number of STOP bits - 1-1/2. |
static int |
STOPBITS_2
Number of STOP bits - 2. |
Constructor Summary | |
SerialPort()
Constructor. |
Method Summary | |
abstract void |
addEventListener(SerialPortEventListener lsnr)
Registers a SerialPortEventListener object to listen for SerialEvents. |
void |
disableReceiveFraming()
Disables receive framing. |
void |
disableReceiveThreshold()
Disables receive threshold. |
void |
disableReceiveTimeout()
Disables receive timeout. |
void |
enableReceiveFraming(int framingByte)
Enables receive framing, if this feature is supported by the driver. |
void |
enableReceiveThreshold(int thresh)
Enables receive threshold, if this feature is supported by the driver. |
void |
enableReceiveTimeout(int rcvTimeout)
Enables receive timeout, if this feature is supported by the driver. |
abstract int |
getBaudRate()
Gets the currently configured baud rate. |
abstract int |
getDataBits()
Gets the currently configured number of data bits. |
abstract int |
getFlowControlMode()
Gets the currently configured flow control mode. |
int |
getInputBufferSize()
Gets the input buffer size. |
java.io.InputStream |
getInputStream()
Returns an input stream. |
int |
getOutputBufferSize()
Gets the output buffer size. |
java.io.OutputStream |
getOutputStream()
Returns an output stream. |
abstract int |
getParity()
Get the currently configured parity setting. |
int |
getReceiveFramingByte()
Gets the current byte used for receive framing. |
int |
getReceiveThreshold()
Gets the integer value of the receive threshold. |
int |
getReceiveTimeout()
Gets the integer value of the receive timeout. |
abstract int |
getStopBits()
Gets the currently defined stop bits. |
abstract boolean |
isCD()
Gets the state of the CD (Carrier Detect) bit in the UART, if supported by the underlying implementation. |
abstract boolean |
isCTS()
Gets the state of the CTS (Clear To Send) bit in the UART, if supported by the underlying implementation. |
abstract boolean |
isDSR()
Gets the state of the DSR (Data Set Ready) bit in the UART, if supported by the underlying implementation. |
abstract boolean |
isDTR()
Gets the state of the DTR (Data Terminal Ready) bit in the UART, if supported by the underlying implementation. |
boolean |
isReceiveFramingEnabled()
Checks if receive framing is enabled. |
boolean |
isReceiveThresholdEnabled()
Checks if receive threshold is enabled. |
boolean |
isReceiveTimeoutEnabled()
Checks if receive timeout is enabled. |
abstract boolean |
isRI()
Gets the state of the RI (Ring Indicator) bit in the UART, if supported by the underlying implementation. |
abstract boolean |
isRTS()
Gets the state of the RTS (Request To Send) bit in the UART, if supported by the underlying implementation. |
abstract void |
notifyOnBreakInterrupt(boolean enable)
Expresses interest in receiving notification when there is a break interrupt on the line. |
abstract void |
notifyOnCarrierDetect(boolean enable)
Expresses interest in receiving notification when the CD (Carrier Detect) bit changes. |
abstract void |
notifyOnCTS(boolean enable)
Expresses interest in receiving notification when the CTS (Clear To Send) bit changes. |
abstract void |
notifyOnDataAvailable(boolean enable)
Expresses interest in receiving notification when input data is available. |
abstract void |
notifyOnDSR(boolean enable)
Expresses interest in receiving notification when the DSR (Data Set Ready) bit changes. |
abstract void |
notifyOnFramingError(boolean enable)
Expresses interest in receiving notification when there is a framing error. |
abstract void |
notifyOnOutputEmpty(boolean enable)
Expresses interest in receiving notification when the output buffer is empty. |
abstract void |
notifyOnOverrunError(boolean enable)
Expresses interest in receiving notification when there is an overrun error. |
abstract void |
notifyOnParityError(boolean enable)
Expresses interest in receiving notification when there is a parity error. |
abstract void |
notifyOnRingIndicator(boolean enable)
Expresses interest in receiving notification when the RI (Ring Indicator) bit changes. |
abstract void |
removeEventListener()
Deregisters event listener registered using addEventListener. |
abstract void |
sendBreak(int millis)
Sends a break of millis milliseconds duration. |
abstract void |
setDTR(boolean dtr)
Sets or clears the DTR (Data Terminal Ready) bit in the UART, if supported by the underlying implementation. |
abstract void |
setFlowControlMode(int flowcontrol)
Sets the flow control mode. |
void |
setInputBufferSize(int size)
Sets the input buffer size. |
void |
setOutputBufferSize(int size)
Sets the output buffer size. |
void |
setRcvFifoTrigger(int trigger)
Deprecated. |
abstract void |
setRTS(boolean rts)
Sets or clears the RTS (Request To Send) bit in the UART, if supported by the underlying implementation. |
abstract void |
setSerialPortParams(int baudrate,
int dataBits,
int stopBits,
int parity)
Sets serial port parameters. |
Methods inherited from class gnu.io.CommPort |
close, getName, toString |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int DATABITS_5
public static final int DATABITS_6
public static final int DATABITS_7
public static final int DATABITS_8
public static final int STOPBITS_1
public static final int STOPBITS_2
public static final int STOPBITS_1_5
public static final int PARITY_NONE
public static final int PARITY_ODD
public static final int PARITY_EVEN
public static final int PARITY_MARK
public static final int PARITY_SPACE
public static final int FLOWCONTROL_NONE
public static final int FLOWCONTROL_RTSCTS_IN
public static final int FLOWCONTROL_RTSCTS_OUT
public static final int FLOWCONTROL_XONXOFF_IN
public static final int FLOWCONTROL_XONXOFF_OUT
Constructor Detail |
public SerialPort()
Method Detail |
public abstract int getBaudRate()
public abstract int getDataBits()
public abstract int getStopBits()
public abstract int getParity()
public abstract void sendBreak(int millis)
millis
- - duration of break to sendpublic abstract void setFlowControlMode(int flowcontrol) throws UnsupportedCommOperationException
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 abstract int getFlowControlMode()
public void setRcvFifoTrigger(int trigger)
trigger
- - levelpublic abstract void setSerialPortParams(int baudrate, int dataBits, int stopBits, int parity) throws UnsupportedCommOperationException
baudrate
- - If the baudrate passed in by the application is unsupported
by the driver, the driver will throw an UnsupportedCommOperationExceptiondataBits
- - One of the following constants:
- DATABITS_5: 5 bits
- DATABITS_6: 6 bits
- DATABITS_7: 7 bits
- DATABITS_8: 8 bitsstopBits
- - One of the following constants:
- STOPBITS_1: 1 stop bit
- STOPBITS_2: 2 stop bits
- STOPBITS_1_5: 1.5 stop bitsparity
- - 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 abstract void setDTR(boolean dtr)
dtr
- - true: set DTR
- false: clear DTRpublic abstract boolean isDTR()
public abstract void setRTS(boolean rts)
rts
- - true: set RTS
- false: clear RTSpublic abstract boolean isRTS()
public abstract boolean isCTS()
public abstract boolean isDSR()
public abstract boolean isRI()
public abstract boolean isCD()
public abstract void addEventListener(SerialPortEventListener lsnr) throws java.util.TooManyListenersException
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 abstract void removeEventListener()
public abstract void notifyOnDataAvailable(boolean enable)
enable
- - true: enable notification
- false: disable notificationpublic abstract void notifyOnOutputEmpty(boolean enable)
enable
- - true: enable notification
- false: disable notificationpublic abstract void notifyOnCTS(boolean enable)
enable
- - true: enable notification
- false: disable notificationpublic abstract void notifyOnDSR(boolean enable)
enable
- - true: enable notification
- false: disable notificationpublic abstract void notifyOnRingIndicator(boolean enable)
enable
- - true: enable notification
- false: disable notificationpublic abstract void notifyOnCarrierDetect(boolean enable)
enable
- - true: enable notification
- false: disable notificationpublic abstract void notifyOnOverrunError(boolean enable)
enable
- - true: enable notification
- false: disable notificationpublic abstract void notifyOnParityError(boolean enable)
enable
- - true: enable notification
- false: disable notificationpublic abstract void notifyOnFramingError(boolean enable)
enable
- - true: enable notification
- false: disable notificationpublic abstract void notifyOnBreakInterrupt(boolean enable)
enable
- - true: enable notification
- false: disable notificationpublic java.io.InputStream getInputStream() throws java.io.IOException
getInputStream
in class CommPort
java.io.IOException
- - if an I/O error occurredpublic java.io.OutputStream getOutputStream() throws java.io.IOException
getOutputStream
in class CommPort
java.io.IOException
- - if an I/O error occurredpublic void enableReceiveThreshold(int thresh) throws UnsupportedCommOperationException
CommPort
enableReceiveThreshold
in class CommPort
thresh
- - when this many bytes are in the input buffer, return immediately from read.
UnsupportedCommOperationException
- - is thrown if receive threshold is not supported by the underlying driver.public void disableReceiveThreshold()
CommPort
disableReceiveThreshold
in class CommPort
public boolean isReceiveThresholdEnabled()
CommPort
isReceiveThresholdEnabled
in class CommPort
public int getReceiveThreshold()
CommPort
getReceiveThreshold
in class CommPort
public void enableReceiveTimeout(int rcvTimeout) throws UnsupportedCommOperationException
CommPort
enableReceiveTimeout
in class CommPort
rcvTimeout
- - when this many milliseconds have elapsed,
return immediately from read, regardless of bytes in input buffer.
UnsupportedCommOperationException
- - is thrown if receive timeout
is not supported by the underlying driver.public void disableReceiveTimeout()
CommPort
disableReceiveTimeout
in class CommPort
public boolean isReceiveTimeoutEnabled()
CommPort
isReceiveTimeoutEnabled
in class CommPort
public int getReceiveTimeout()
CommPort
getReceiveTimeout
in class CommPort
public void enableReceiveFraming(int framingByte) throws UnsupportedCommOperationException
CommPort
enableReceiveFraming
in class CommPort
framingByte
- - this byte in the input stream suggests the end of the
received frame. Blocked reads will return immediately. Only the low 8 bits
of framingByte are used while the upper 24 bits are masked off. A value
outside the range of 0-255 will be converted to the value of its lowest 8 bits.
UnsupportedCommOperationException
- - is thrown if receive timeout
is not supported by the underlying driver.public void disableReceiveFraming()
CommPort
disableReceiveFraming
in class CommPort
public boolean isReceiveFramingEnabled()
CommPort
isReceiveFramingEnabled
in class CommPort
public int getReceiveFramingByte()
CommPort
getReceiveFramingByte
in class CommPort
public void setInputBufferSize(int size)
CommPort
setInputBufferSize
in class CommPort
size
- - size of the input bufferpublic int getInputBufferSize()
CommPort
getInputBufferSize
in class CommPort
public void setOutputBufferSize(int size)
CommPort
setOutputBufferSize
in class CommPort
size
- - size of the output bufferpublic int getOutputBufferSize()
CommPort
getOutputBufferSize
in class CommPort
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |