gnu.io
Interface SerialPortInterface

All Superinterfaces:
CommPortInterface
All Known Implementing Classes:
RXTXPort, SerialPort

public interface SerialPortInterface
extends CommPortInterface

An RS-232 serial communications port. SerialPort describes the low-level interface to a serial communications port made available by the underlying system. SerialPort defines the minimum required functionality for serial communications ports.

See Also:
CommPort, CommPortIdentifier

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
           
static int PARITY_NONE
          No parity bit.
static int PARITY_ODD
          ODD parity scheme.
static int PARITY_SPACE
           
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.
 
Method Summary
 void addEventListener(SerialPortEventListener lsnr)
           
 int getBaudBase()
           
 int getBaudRate()
           
 boolean getCallOutHangup()
           
 int getDataBits()
           
 int getDivisor()
           
 byte getEndOfInputChar()
           
 int getFlowControlMode()
           
 boolean getLowLatency()
           
 int getParity()
           
 byte getParityErrorChar()
           
 int getStopBits()
           
 java.lang.String getUARTType()
           
 boolean isCD()
           
 boolean isCTS()
           
 boolean isDSR()
           
 boolean isDTR()
           
 boolean isRI()
           
 boolean isRTS()
           
 void notifyOnBreakInterrupt(boolean enable)
           
 void notifyOnCarrierDetect(boolean enable)
           
 void notifyOnCTS(boolean enable)
           
 void notifyOnDataAvailable(boolean enable)
           
 void notifyOnDSR(boolean enable)
           
 void notifyOnFramingError(boolean enable)
           
 void notifyOnOutputEmpty(boolean enable)
           
 void notifyOnOverrunError(boolean enable)
           
 void notifyOnParityError(boolean enable)
           
 void notifyOnRingIndicator(boolean enable)
           
 void removeEventListener()
           
 void sendBreak(int millis)
          Sends a break of the specified duration.
 boolean setBaudBase(int BaudBase)
           
 boolean setCallOutHangup(boolean NoHup)
           
 boolean setDivisor(int Divisor)
           
 void setDTR(boolean dtr)
          Sets or clears the DTR bit in the UART.
 boolean setEndOfInputChar(byte b)
           
 void setFlowControlMode(int flowcontrol)
          Sets the flow control mode.
 boolean setLowLatency()
           
 boolean setParityErrorChar(byte b)
           
 void setRcvFifoTrigger(int trigger)
          Deprecated.  
 void setRTS(boolean rts)
          Sets or clears the RTS bit in the UART.
 void setSerialPortParams(int baudRate, int dataBits, int stopBits, int parity)
          Sets the serial port parameters.
 boolean setUARTType(java.lang.String type, boolean test)
           
 
Methods inherited from interface comm.CommPortInterface
close, disableReceiveFraming, disableReceiveThreshold, disableReceiveTimeout, enableReceiveFraming, enableReceiveThreshold, enableReceiveTimeout, getInputBufferSize, getInputStream, getName, getOutputBufferSize, getOutputStream, getReceiveFramingByte, getReceiveThreshold, getReceiveTimeout, isReceiveFramingEnabled, isReceiveThresholdEnabled, isReceiveTimeoutEnabled, setInputBufferSize, setOutputBufferSize, toString
 

Field Detail

DATABITS_5

static final int DATABITS_5
5 data bit format.

See Also:
Constant Field Values

DATABITS_6

static final int DATABITS_6
6 data bit format.

See Also:
Constant Field Values

DATABITS_7

static final int DATABITS_7
7 data bit format.

See Also:
Constant Field Values

DATABITS_8

static final int DATABITS_8
8 data bit format.

See Also:
Constant Field Values

PARITY_NONE

static final int PARITY_NONE
No parity bit.

See Also:
Constant Field Values

PARITY_ODD

static final int PARITY_ODD
ODD parity scheme. The parity bit is added so there are an odd number of TRUE bits.

See Also:
Constant Field Values

PARITY_EVEN

static final int PARITY_EVEN
EVEN parity scheme. The parity bit is added so there are an even number of TRUE bits.

See Also:
Constant Field Values

PARITY_MARK

static final int PARITY_MARK
See Also:
Constant Field Values

PARITY_SPACE

static final int PARITY_SPACE
See Also:
Constant Field Values

STOPBITS_1

static final int STOPBITS_1
Number of STOP bits - 1.

See Also:
Constant Field Values

STOPBITS_2

static final int STOPBITS_2
Number of STOP bits - 2.

See Also:
Constant Field Values

STOPBITS_1_5

static final int STOPBITS_1_5
Number of STOP bits - 1-1/2. Some UARTs permit 1-1/2 STOP bits only with 5 data bit format, but permit 1 or 2 STOP bits with any format.

See Also:
Constant Field Values

FLOWCONTROL_NONE

static final int FLOWCONTROL_NONE
Flow control off.

See Also:
Constant Field Values

FLOWCONTROL_RTSCTS_IN

static final int FLOWCONTROL_RTSCTS_IN
RTS/CTS flow control on input.

See Also:
Constant Field Values

FLOWCONTROL_RTSCTS_OUT

static final int FLOWCONTROL_RTSCTS_OUT
RTS/CTS flow control on output.

See Also:
Constant Field Values

FLOWCONTROL_XONXOFF_IN

static final int FLOWCONTROL_XONXOFF_IN
XON/XOFF flow control on input.

See Also:
Constant Field Values

FLOWCONTROL_XONXOFF_OUT

static final int FLOWCONTROL_XONXOFF_OUT
XON/XOFF flow control on output.

See Also:
Constant Field Values
Method Detail

isCTS

boolean isCTS()
Returns:
true if the DTR bit is set.
See Also:
setDTR(boolean)

isDSR

boolean isDSR()
Returns:
true if the DTR bit is set.

isCD

boolean isCD()
Returns:
true if the CD bit is set.

isRI

boolean isRI()
Returns:
true if the RI bit is set.

isRTS

boolean isRTS()
Returns:
true if the RTS bit is set.
See Also:
setRTS(boolean)

addEventListener

void addEventListener(SerialPortEventListener lsnr)
                      throws java.util.TooManyListenersException
Throws:
java.util.TooManyListenersException

removeEventListener

void removeEventListener()

notifyOnDataAvailable

void notifyOnDataAvailable(boolean enable)

notifyOnOutputEmpty

void notifyOnOutputEmpty(boolean enable)

notifyOnCTS

void notifyOnCTS(boolean enable)

notifyOnDSR

void notifyOnDSR(boolean enable)

notifyOnRingIndicator

void notifyOnRingIndicator(boolean enable)

notifyOnCarrierDetect

void notifyOnCarrierDetect(boolean enable)

notifyOnOverrunError

void notifyOnOverrunError(boolean enable)

notifyOnParityError

void notifyOnParityError(boolean enable)

notifyOnFramingError

void notifyOnFramingError(boolean enable)

notifyOnBreakInterrupt

void notifyOnBreakInterrupt(boolean enable)

getParityErrorChar

byte getParityErrorChar()
                        throws UnsupportedCommOperationException
Throws:
UnsupportedCommOperationException

setParityErrorChar

boolean setParityErrorChar(byte b)
                           throws UnsupportedCommOperationException
Throws:
UnsupportedCommOperationException

getEndOfInputChar

byte getEndOfInputChar()
                       throws UnsupportedCommOperationException
Throws:
UnsupportedCommOperationException

setEndOfInputChar

boolean setEndOfInputChar(byte b)
                          throws UnsupportedCommOperationException
Throws:
UnsupportedCommOperationException

setUARTType

boolean setUARTType(java.lang.String type,
                    boolean test)
                    throws UnsupportedCommOperationException
Throws:
UnsupportedCommOperationException

getUARTType

java.lang.String getUARTType()
                             throws UnsupportedCommOperationException
Throws:
UnsupportedCommOperationException

setBaudBase

boolean setBaudBase(int BaudBase)
                    throws UnsupportedCommOperationException
Throws:
UnsupportedCommOperationException

getBaudBase

int getBaudBase()
                throws UnsupportedCommOperationException
Throws:
UnsupportedCommOperationException

setDivisor

boolean setDivisor(int Divisor)
                   throws UnsupportedCommOperationException
Throws:
UnsupportedCommOperationException

getDivisor

int getDivisor()
               throws UnsupportedCommOperationException
Throws:
UnsupportedCommOperationException

setLowLatency

boolean setLowLatency()
                      throws UnsupportedCommOperationException
Throws:
UnsupportedCommOperationException

getLowLatency

boolean getLowLatency()
                      throws UnsupportedCommOperationException
Throws:
UnsupportedCommOperationException

setCallOutHangup

boolean setCallOutHangup(boolean NoHup)
                         throws UnsupportedCommOperationException
Throws:
UnsupportedCommOperationException

getCallOutHangup

boolean getCallOutHangup()
                         throws UnsupportedCommOperationException
Throws:
UnsupportedCommOperationException

getBaudRate

int getBaudRate()
Returns:
the current baud rate

getDataBits

int getDataBits()
Returns:
the current number of data bits: DATABITS_5, DATABITS_6, DATABITS_7, or DATABITS_8.

getStopBits

int getStopBits()
Returns:
the current number of stop bits: STOPBITS_1, STOPBITS_2, or STOPBITS_1_5.

getParity

int getParity()
Returns:
the current parity scheme: PARITY_NONE, PARITY_ODD, PARITY_EVEN, PARITY_MARK or PARITY_SPACE.

sendBreak

void sendBreak(int millis)
Sends a break of the specified duration.

Parameters:
millis - the duration in milliseconds

setFlowControlMode

void setFlowControlMode(int flowcontrol)
Sets the flow control mode.

Parameters:
flowcontrol - a bitmask combination of FLOWCONTROL_NONE, FLOWCONTROL_RTSCTS_IN, FLOWCONTROL_RTSCTS_OUT, FLOWCONTROL_XONXOFF_IN, and/or FLOWCONTROL_XONXOFF_OUT.

getFlowControlMode

int getFlowControlMode()
Returns:
the current flow control mode as a bitmask of FLOWCONTROL_NONE, FLOWCONTROL_RTSCTS_IN, FLOWCONTROL_RTSCTS_OUT, FLOWCONTROL_XONXOFF_IN, and/or FLOWCONTROL_XONXOFF_OUT.

setRcvFifoTrigger

void setRcvFifoTrigger(int trigger)
Deprecated. 

Set the Receive Fifo trigger level. If the UART has a FIFO and if it can have programmable trigger levels, then this method will cause the UART to raise an interrupt after trigger bytes have been received.

Parameters:
trigger - the trigger level

setSerialPortParams

void setSerialPortParams(int baudRate,
                         int dataBits,
                         int stopBits,
                         int parity)
                         throws UnsupportedCommOperationException
Sets the serial port parameters.

Parameters:
baudRate - the baud rate
dataBits - the number of data bits: DATABITS_5, DATABITS_6, DATABITS_7, or DATABITS_8
stopBits - the number of stop bits: STOPBITS_1, STOPBITS_2, or STOPBITS_1_5
parity - the parity schema: PARITY_NONE, PARITY_ODD, PARITY_EVEN, PARITY_MARK or PARITY_SPACE
Throws:
UnsupportedCommOperationException

setDTR

void setDTR(boolean dtr)
Sets or clears the DTR bit in the UART.

Parameters:
dtr - the Data Terminal Ready bit value
See Also:
isDTR()

isDTR

boolean isDTR()
Returns:
true if the DTR bit is set.
See Also:
setDTR(boolean)

setRTS

void setRTS(boolean rts)
Sets or clears the RTS bit in the UART.

Parameters:
rts - the Request To Send bit value