2009-01-09 1.2.0

org.eclipse.soda.dk.comm
Class NSSerialPort

java.lang.Object
  extended by javax.comm.CommPort
      extended by javax.comm.SerialPort
          extended by org.eclipse.soda.dk.comm.NSSerialPort

 class NSSerialPort
extends SerialPort

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.

Since:
1.0
Version:
1.2.0

Field Summary
static int DATABITS_5
          Define the databits5 (int) constant.
static int DATABITS_6
          Define the databits6 (int) constant.
static int DATABITS_7
          Define the databits7 (int) constant.
static int DATABITS_8
          Define the databits8 (int) constant.
(package private)  int fd
          Define the fd (int) field.
(package private)  java.io.FileDescriptor FD
          Define the fd (FileDescriptor) field.
static int FLOWCONTROL_NONE
          Define the flowcontrol none (int) constant.
static int FLOWCONTROL_RTSCTS_IN
          Define the flowcontrol rtscts in (int) constant.
static int FLOWCONTROL_RTSCTS_OUT
          Define the flowcontrol rtscts out (int) constant.
static int FLOWCONTROL_XONXOFF_IN
          Define the flowcontrol xonxoff in (int) constant.
static int FLOWCONTROL_XONXOFF_OUT
          Define the flowcontrol xonxoff out (int) constant.
(package private)  int insBufferCount
          Define the ins buffer count (int) field.
(package private)  int insBufferSize
          Disable read buffering for now
(package private)  boolean notifyOnBufferFlag
          Define the notify on buffer flag (boolean) field.
(package private)  int outsBufferCount
          Define the outs buffer count (int) field.
(package private)  int outsBufferSize
          Disable write buffering for default
static int PARITY_EVEN
          Define the parity even (int) constant.
static int PARITY_MARK
          Define the parity mark (int) constant.
static int PARITY_NONE
          Define the parity none (int) constant.
static int PARITY_ODD
          Define the parity odd (int) constant.
static int PARITY_SPACE
          Define the parity space (int) constant.
(package private)  boolean rcvFraming
          Define the rcv framing (boolean) field.
(package private)  int rcvFramingByte
          Define the rcv framing byte (int) field.
(package private)  boolean rcvFramingByteReceived
          Define the rcv framing byte received (boolean) field.
(package private)  int rcvThreshold
          Define the rcv threshold (int) field.
(package private)  int rcvTimeout
          Define the rcv timeout (int) field.
static int STOPBITS_1
          Define the stopbits1 (int) constant.
static int STOPBITS_1_5
          Define the stopbits15 (int) constant.
static int STOPBITS_2
          Define the stopbits2 (int) constant.
 
Fields inherited from class javax.comm.CommPort
name
 
Constructor Summary
NSSerialPort(java.lang.String portName, NSCommDriver driver)
          Constructor
 
Method Summary
 void addEventListener(SerialPortEventListener lstnr)
          Add event listener with the specified lstnr parameter.
 void close()
          Close.
 void disableReceiveFraming()
          Disable receive framing.
 void disableReceiveThreshold()
          Disable receive threshold.
 void disableReceiveTimeout()
          Disable receive timeout.
 void enableReceiveFraming(int rcvFramingByte)
          Enable receive framing with the specified rcv framing byte parameter.
 void enableReceiveThreshold(int thresh)
          Enable receive threshold with the specified thresh parameter.
 void enableReceiveTimeout(int rt)
          Enable receive timeout with the specified rt parameter.
protected  void finalize()
          Finalize.
 int getBaudrate()
          Gets the baudrate (int) value.
 int getBaudRate()
          Gets the baud rate (int) value.
 int getDataBits()
          Gets the data bits (int) value.
 int getFlowControlMode()
          Gets the currently configured flow control mode.
 int getInputBufferSize()
          Gets the input buffer size (int) value.
 java.io.InputStream getInputStream()
          Gets the input stream value.
 int getOutputBufferSize()
          Gets the output buffer size (int) value.
 java.io.OutputStream getOutputStream()
          Gets the output stream value.
 int getParity()
          Gets the parity (int) value.
 int getReceiveFramingByte()
          Gets the receive framing byte (int) value.
 int getReceiveThreshold()
          Gets the receive threshold (int) value.
 int getReceiveTimeout()
          Gets the receive timeout (int) value.
 int getStopBits()
          Gets the stop bits (int) value.
 boolean isCD()
          Gets the cd (boolean) value.
 boolean isCTS()
          Gets the cts (boolean) value.
 boolean isDSR()
          Gets the dsr (boolean) value.
 boolean isDtr()
          Gets the dtr (boolean) value.
 boolean isDTR()
          Gets the dtr (boolean) value.
 boolean isReceiveFramingEnabled()
          Gets the receive framing enabled (boolean) value.
 boolean isReceiveThresholdEnabled()
          Gets the receive threshold enabled (boolean) value.
 boolean isReceiveTimeoutEnabled()
          Gets the receive timeout enabled (boolean) value.
 boolean isRI()
          Gets the ri (boolean) value.
 boolean isRts()
          Gets the rts (boolean) value.
 boolean isRTS()
          Gets the rts (boolean) value.
 void notifyOnBreakInterrupt(boolean notify)
          Notify on break interrupt with the specified notify parameter.
 void notifyOnCarrierDetect(boolean notify)
          Notify on carrier detect with the specified notify parameter.
 void notifyOnCTS(boolean notify)
          Notify on cts with the specified notify parameter.
 void notifyOnDataAvailable(boolean notify)
          Notify on data available with the specified notify parameter.
 void notifyOnDSR(boolean notify)
          Notify on dsr with the specified notify parameter.
 void notifyOnFramingError(boolean notify)
          Notify on framing error with the specified notify parameter.
 void notifyOnOutputEmpty(boolean notify)
          Notify on output empty with the specified notify parameter.
 void notifyOnOverrunError(boolean notify)
          Notify on overrun error with the specified notify parameter.
 void notifyOnParityError(boolean notify)
          Notify on parity error with the specified notify parameter.
 void notifyOnRingIndicator(boolean notify)
          Notify on ring indicator with the specified notify parameter.
 void removeEventListener()
          Remove event listener.
(package private)  void reportSerialEvent(int eventType, boolean oldvalue, boolean newvalue)
          Report serial event with the specified event type, oldvalue and newvalue parameters.
 void sendBreak(int millis)
          Send break with the specified millis parameter.
 void setDTR(boolean dtr)
          Sets the dtr value.
 void setFlowControlMode(int flowctrl)
          Sets the flow control mode value.
 void setInputBufferSize(int size)
          Sets the input buffer size value.
 void setOutputBufferSize(int size)
          Sets the output buffer size value.
 void setRcvFifoTrigger(int trigger)
          Sets the rcv fifo trigger value.
 void setRTS(boolean rts)
          Sets the rts value.
 void setSerialPortParams(int bd, int db, int sb, int par)
          Set serial port params with the specified bd, db, sb and par parameters.
 
Methods inherited from class javax.comm.CommPort
getName, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DATABITS_5

public static final int DATABITS_5
Define the databits5 (int) constant.

See Also:
Constant Field Values

DATABITS_6

public static final int DATABITS_6
Define the databits6 (int) constant.

See Also:
Constant Field Values

DATABITS_7

public static final int DATABITS_7
Define the databits7 (int) constant.

See Also:
Constant Field Values

DATABITS_8

public static final int DATABITS_8
Define the databits8 (int) constant.

See Also:
Constant Field Values

STOPBITS_1

public static final int STOPBITS_1
Define the stopbits1 (int) constant.

See Also:
Constant Field Values

STOPBITS_2

public static final int STOPBITS_2
Define the stopbits2 (int) constant.

See Also:
Constant Field Values

STOPBITS_1_5

public static final int STOPBITS_1_5
Define the stopbits15 (int) constant.

See Also:
Constant Field Values

PARITY_NONE

public static final int PARITY_NONE
Define the parity none (int) constant.

See Also:
Constant Field Values

PARITY_ODD

public static final int PARITY_ODD
Define the parity odd (int) constant.

See Also:
Constant Field Values

PARITY_EVEN

public static final int PARITY_EVEN
Define the parity even (int) constant.

See Also:
Constant Field Values

PARITY_MARK

public static final int PARITY_MARK
Define the parity mark (int) constant.

See Also:
Constant Field Values

PARITY_SPACE

public static final int PARITY_SPACE
Define the parity space (int) constant.

See Also:
Constant Field Values

FLOWCONTROL_NONE

public static final int FLOWCONTROL_NONE
Define the flowcontrol none (int) constant.

See Also:
Constant Field Values

FLOWCONTROL_RTSCTS_IN

public static final int FLOWCONTROL_RTSCTS_IN
Define the flowcontrol rtscts in (int) constant.

See Also:
Constant Field Values

FLOWCONTROL_RTSCTS_OUT

public static final int FLOWCONTROL_RTSCTS_OUT
Define the flowcontrol rtscts out (int) constant.

See Also:
Constant Field Values

FLOWCONTROL_XONXOFF_IN

public static final int FLOWCONTROL_XONXOFF_IN
Define the flowcontrol xonxoff in (int) constant.

See Also:
Constant Field Values

FLOWCONTROL_XONXOFF_OUT

public static final int FLOWCONTROL_XONXOFF_OUT
Define the flowcontrol xonxoff out (int) constant.

See Also:
Constant Field Values

fd

int fd
Define the fd (int) field.


FD

java.io.FileDescriptor FD
Define the fd (FileDescriptor) field.


rcvThreshold

int rcvThreshold
Define the rcv threshold (int) field.


rcvTimeout

int rcvTimeout
Define the rcv timeout (int) field.


rcvFraming

boolean rcvFraming
Define the rcv framing (boolean) field.


rcvFramingByte

int rcvFramingByte
Define the rcv framing byte (int) field.


rcvFramingByteReceived

boolean rcvFramingByteReceived
Define the rcv framing byte received (boolean) field.


insBufferSize

int insBufferSize
Disable read buffering for now


insBufferCount

int insBufferCount
Define the ins buffer count (int) field.


outsBufferSize

int outsBufferSize
Disable write buffering for default


outsBufferCount

int outsBufferCount
Define the outs buffer count (int) field.


notifyOnBufferFlag

boolean notifyOnBufferFlag
Define the notify on buffer flag (boolean) field.

Constructor Detail

NSSerialPort

public NSSerialPort(java.lang.String portName,
                    NSCommDriver driver)
             throws java.io.IOException
Constructor

Parameters:
portName - The port name (String) parameter.
driver - The driver (NSCommDriver) parameter.
Throws:
java.io.IOException - IOException.
Method Detail

addEventListener

public void addEventListener(SerialPortEventListener lstnr)
                      throws java.util.TooManyListenersException
Add event listener with the specified lstnr parameter.

Specified by:
addEventListener in class SerialPort
Parameters:
lstnr - The lstnr (SerialPortEventListener) parameter.
Throws:
java.util.TooManyListenersException - Too Many Listeners Exception.
See Also:
removeEventListener()

close

public void close()
Close.

Overrides:
close in class CommPort

disableReceiveFraming

public void disableReceiveFraming()
Disable receive framing.

Specified by:
disableReceiveFraming in class CommPort
See Also:
enableReceiveFraming(int)

disableReceiveThreshold

public void disableReceiveThreshold()
Disable receive threshold.

Specified by:
disableReceiveThreshold in class CommPort
See Also:
enableReceiveThreshold(int), getReceiveThreshold()

disableReceiveTimeout

public void disableReceiveTimeout()
Disable receive timeout.

Specified by:
disableReceiveTimeout in class CommPort
See Also:
enableReceiveTimeout(int), getReceiveTimeout()

enableReceiveFraming

public void enableReceiveFraming(int rcvFramingByte)
                          throws UnsupportedCommOperationException
Enable receive framing with the specified rcv framing byte parameter.

Specified by:
enableReceiveFraming in class CommPort
Parameters:
rcvFramingByte - The rcv framing byte (int) parameter.
Throws:
UnsupportedCommOperationException - Unsupported Comm Operation Exception.
See Also:
disableReceiveFraming()

enableReceiveThreshold

public void enableReceiveThreshold(int thresh)
                            throws UnsupportedCommOperationException
Enable receive threshold with the specified thresh parameter.

Specified by:
enableReceiveThreshold in class CommPort
Parameters:
thresh - The thresh (int) parameter.
Throws:
UnsupportedCommOperationException - Unsupported Comm Operation Exception.
See Also:
disableReceiveThreshold(), getReceiveThreshold()

enableReceiveTimeout

public void enableReceiveTimeout(int rt)
                          throws UnsupportedCommOperationException
Enable receive timeout with the specified rt parameter.

Specified by:
enableReceiveTimeout in class CommPort
Parameters:
rt - The rt (int) parameter.
Throws:
UnsupportedCommOperationException - Unsupported Comm Operation Exception.
See Also:
disableReceiveTimeout(), getReceiveTimeout()

finalize

protected void finalize()
                 throws java.io.IOException
Finalize.

Overrides:
finalize in class java.lang.Object
Throws:
java.io.IOException - IOException.

getBaudRate

public int getBaudRate()
Gets the baud rate (int) value.

Specified by:
getBaudRate in class SerialPort
Returns:
The baud rate (int) value.

getBaudrate

public int getBaudrate()
Gets the baudrate (int) value.

Returns:
The baudrate (int) value.

getDataBits

public int getDataBits()
Gets the data bits (int) value.

Specified by:
getDataBits in class SerialPort
Returns:
The data bits (int) value.

getFlowControlMode

public int getFlowControlMode()
Gets the currently configured flow control mode. Returns: an integer bitmask of the modes FLOWCONTROL_NONE, FLOWCONTROL_RTSCTS_IN, FLOWCONTROL_RTSCTS_OUT, FLOWCONTROL_XONXOFF_IN, and FLOWCONTROL_XONXOFF_OUT.

Specified by:
getFlowControlMode in class SerialPort
Returns:
Results of the get flow control mode (int) value.
See Also:
setFlowControlMode(int)

getInputBufferSize

public int getInputBufferSize()
Gets the input buffer size (int) value.

Specified by:
getInputBufferSize in class CommPort
Returns:
The input buffer size (int) value.
See Also:
setInputBufferSize(int)

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Gets the input stream value.

Specified by:
getInputStream in class CommPort
Returns:
The input stream (InputStream) value.
Throws:
java.io.IOException - IOException.

getOutputBufferSize

public int getOutputBufferSize()
Gets the output buffer size (int) value.

Specified by:
getOutputBufferSize in class CommPort
Returns:
The output buffer size (int) value.
See Also:
setOutputBufferSize(int)

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Gets the output stream value.

Specified by:
getOutputStream in class CommPort
Returns:
The output stream (OutputStream) value.
Throws:
java.io.IOException - IOException.

getParity

public int getParity()
Gets the parity (int) value.

Specified by:
getParity in class SerialPort
Returns:
The parity (int) value.

getReceiveFramingByte

public int getReceiveFramingByte()
Gets the receive framing byte (int) value.

Specified by:
getReceiveFramingByte in class CommPort
Returns:
The receive framing byte (int) value.

getReceiveThreshold

public int getReceiveThreshold()
Gets the receive threshold (int) value.

Specified by:
getReceiveThreshold in class CommPort
Returns:
The receive threshold (int) value.
See Also:
disableReceiveThreshold(), enableReceiveThreshold(int)

getReceiveTimeout

public int getReceiveTimeout()
Gets the receive timeout (int) value.

Specified by:
getReceiveTimeout in class CommPort
Returns:
The receive timeout (int) value.
See Also:
disableReceiveTimeout(), enableReceiveTimeout(int)

getStopBits

public int getStopBits()
Gets the stop bits (int) value.

Specified by:
getStopBits in class SerialPort
Returns:
The stop bits (int) value.

isCD

public boolean isCD()
Gets the cd (boolean) value.

Specified by:
isCD in class SerialPort
Returns:
The cd (boolean) value.

isCTS

public boolean isCTS()
Gets the cts (boolean) value.

Specified by:
isCTS in class SerialPort
Returns:
The cts (boolean) value.
See Also:
notifyOnCTS(boolean)

isDSR

public boolean isDSR()
Gets the dsr (boolean) value.

Specified by:
isDSR in class SerialPort
Returns:
The dsr (boolean) value.
See Also:
notifyOnDSR(boolean)

isDTR

public boolean isDTR()
Gets the dtr (boolean) value.

Specified by:
isDTR in class SerialPort
Returns:
The dtr (boolean) value.
See Also:
setDTR(boolean)

isDtr

public boolean isDtr()
Gets the dtr (boolean) value.

Returns:
The dtr (boolean) value.

isRI

public boolean isRI()
Gets the ri (boolean) value.

Specified by:
isRI in class SerialPort
Returns:
The ri (boolean) value.

isRTS

public boolean isRTS()
Gets the rts (boolean) value.

Specified by:
isRTS in class SerialPort
Returns:
The rts (boolean) value.
See Also:
setRTS(boolean)

isReceiveFramingEnabled

public boolean isReceiveFramingEnabled()
Gets the receive framing enabled (boolean) value.

Specified by:
isReceiveFramingEnabled in class CommPort
Returns:
The receive framing enabled (boolean) value.

isReceiveThresholdEnabled

public boolean isReceiveThresholdEnabled()
Gets the receive threshold enabled (boolean) value.

Specified by:
isReceiveThresholdEnabled in class CommPort
Returns:
The receive threshold enabled (boolean) value.

isReceiveTimeoutEnabled

public boolean isReceiveTimeoutEnabled()
Gets the receive timeout enabled (boolean) value.

Specified by:
isReceiveTimeoutEnabled in class CommPort
Returns:
The receive timeout enabled (boolean) value.

isRts

public boolean isRts()
Gets the rts (boolean) value.

Returns:
The rts (boolean) value.

notifyOnBreakInterrupt

public void notifyOnBreakInterrupt(boolean notify)
Notify on break interrupt with the specified notify parameter.

Specified by:
notifyOnBreakInterrupt in class SerialPort
Parameters:
notify - The notify (boolean) parameter.

notifyOnCTS

public void notifyOnCTS(boolean notify)
Notify on cts with the specified notify parameter.

Specified by:
notifyOnCTS in class SerialPort
Parameters:
notify - The notify (boolean) parameter.

notifyOnCarrierDetect

public void notifyOnCarrierDetect(boolean notify)
Notify on carrier detect with the specified notify parameter.

Specified by:
notifyOnCarrierDetect in class SerialPort
Parameters:
notify - The notify (boolean) parameter.

notifyOnDSR

public void notifyOnDSR(boolean notify)
Notify on dsr with the specified notify parameter.

Specified by:
notifyOnDSR in class SerialPort
Parameters:
notify - The notify (boolean) parameter.

notifyOnDataAvailable

public void notifyOnDataAvailable(boolean notify)
Notify on data available with the specified notify parameter.

Specified by:
notifyOnDataAvailable in class SerialPort
Parameters:
notify - The notify (boolean) parameter.

notifyOnFramingError

public void notifyOnFramingError(boolean notify)
Notify on framing error with the specified notify parameter.

Specified by:
notifyOnFramingError in class SerialPort
Parameters:
notify - The notify (boolean) parameter.

notifyOnOutputEmpty

public void notifyOnOutputEmpty(boolean notify)
Notify on output empty with the specified notify parameter.

Specified by:
notifyOnOutputEmpty in class SerialPort
Parameters:
notify - The notify (boolean) parameter.

notifyOnOverrunError

public void notifyOnOverrunError(boolean notify)
Notify on overrun error with the specified notify parameter.

Specified by:
notifyOnOverrunError in class SerialPort
Parameters:
notify - The notify (boolean) parameter.

notifyOnParityError

public void notifyOnParityError(boolean notify)
Notify on parity error with the specified notify parameter.

Specified by:
notifyOnParityError in class SerialPort
Parameters:
notify - The notify (boolean) parameter.

notifyOnRingIndicator

public void notifyOnRingIndicator(boolean notify)
Notify on ring indicator with the specified notify parameter.

Specified by:
notifyOnRingIndicator in class SerialPort
Parameters:
notify - The notify (boolean) parameter.

removeEventListener

public void removeEventListener()
Remove event listener.

Specified by:
removeEventListener in class SerialPort
See Also:
addEventListener(SerialPortEventListener)

reportSerialEvent

void reportSerialEvent(int eventType,
                       boolean oldvalue,
                       boolean newvalue)
Report serial event with the specified event type, oldvalue and newvalue parameters.

Parameters:
eventType - The event type (int) parameter.
oldvalue - The oldvalue (boolean) parameter.
newvalue - The newvalue (boolean) parameter.

sendBreak

public void sendBreak(int millis)
Send break with the specified millis parameter.

Specified by:
sendBreak in class SerialPort
Parameters:
millis - The millis (int) parameter.

setDTR

public void setDTR(boolean dtr)
Sets the dtr value.

Specified by:
setDTR in class SerialPort
Parameters:
dtr - The dtr (boolean) parameter.
See Also:
isDTR()

setFlowControlMode

public void setFlowControlMode(int flowctrl)
                        throws UnsupportedCommOperationException
Sets the flow control mode value.

Specified by:
setFlowControlMode in class SerialPort
Parameters:
flowctrl - The flowctrl (int) parameter.
Throws:
UnsupportedCommOperationException - Unsupported Comm Operation Exception.
See Also:
getFlowControlMode()

setInputBufferSize

public void setInputBufferSize(int size)
Sets the input buffer size value.

Specified by:
setInputBufferSize in class CommPort
Parameters:
size - The size (int) parameter.
See Also:
getInputBufferSize()

setOutputBufferSize

public void setOutputBufferSize(int size)
Sets the output buffer size value.

Specified by:
setOutputBufferSize in class CommPort
Parameters:
size - The size (int) parameter.
See Also:
getOutputBufferSize()

setRTS

public void setRTS(boolean rts)
Sets the rts value.

Specified by:
setRTS in class SerialPort
Parameters:
rts - The rts (boolean) parameter.
See Also:
isRTS()

setRcvFifoTrigger

public void setRcvFifoTrigger(int trigger)
Sets the rcv fifo trigger value.

Overrides:
setRcvFifoTrigger in class SerialPort
Parameters:
trigger - The trigger (int) parameter.

setSerialPortParams

public void setSerialPortParams(int bd,
                                int db,
                                int sb,
                                int par)
                         throws UnsupportedCommOperationException
Set serial port params with the specified bd, db, sb and par parameters.

Specified by:
setSerialPortParams in class SerialPort
Parameters:
bd - The bd (int) parameter.
db - The db (int) parameter.
sb - The sb (int) parameter.
par - The par (int) parameter.
Throws:
UnsupportedCommOperationException - Unsupported Comm Operation Exception.

2009-01-09 1.2.0

Copyright (c) 2009 IBM. See license in Legal section.