1.0.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.


Field Summary
static int DATABITS_5
           
static int DATABITS_6
           
static int DATABITS_7
           
static int DATABITS_8
           
(package private)  int fd
           
(package private)  java.io.FileDescriptor FD
           
static int FLOWCONTROL_NONE
           
static int FLOWCONTROL_RTSCTS_IN
           
static int FLOWCONTROL_RTSCTS_OUT
           
static int FLOWCONTROL_XONXOFF_IN
           
static int FLOWCONTROL_XONXOFF_OUT
           
(package private)  int insBufferCount
           
(package private)  int insBufferSize
          Disable read buffering for now
(package private)  boolean notifyOnBufferFlag
           
(package private)  int outsBufferCount
           
(package private)  int outsBufferSize
          Disable write buffering for default
static int PARITY_EVEN
           
static int PARITY_MARK
           
static int PARITY_NONE
           
static int PARITY_ODD
           
static int PARITY_SPACE
           
(package private)  boolean rcvFraming
           
(package private)  int rcvFramingByte
           
(package private)  boolean rcvFramingByteReceived
           
(package private)  int rcvThreshold
           
(package private)  int rcvTimeout
           
static int STOPBITS_1
           
static int STOPBITS_1_5
           
static int STOPBITS_2
           
 
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 lsnr 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 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 rcv timeout parameter.
protected  void finalize()
           
 int getBaudrate()
           
 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()
           
 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()
           
 boolean isRTS()
          Gets the rts (boolean) value.
 void notifyOnBreakInterrupt(boolean notify)
          Notify on break interrupt with the specified enable parameter.
 void notifyOnCarrierDetect(boolean notify)
          Notify on carrier detect with the specified enable parameter.
 void notifyOnCTS(boolean notify)
          Notify on cts with the specified enable parameter.
 void notifyOnDataAvailable(boolean notify)
          Notify on data available with the specified enable parameter.
 void notifyOnDSR(boolean notify)
          Notify on dsr with the specified enable parameter.
 void notifyOnFramingError(boolean notify)
          Notify on framing error with the specified enable parameter.
 void notifyOnOutputEmpty(boolean notify)
          Notify on output empty with the specified enable parameter.
 void notifyOnOverrunError(boolean notify)
          Notify on overrun error with the specified enable parameter.
 void notifyOnParityError(boolean notify)
          Notify on parity error with the specified enable parameter.
 void notifyOnRingIndicator(boolean notify)
          Notify on ring indicator with the specified enable parameter.
 void removeEventListener()
          Remove event listener.
(package private)  void reportSerialEvent(int eventType, boolean oldvalue, boolean newvalue)
           
 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.
 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 baudrate, data bits, stop bits and parity 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
See Also:
Constant Field Values

DATABITS_6

public static final int DATABITS_6
See Also:
Constant Field Values

DATABITS_7

public static final int DATABITS_7
See Also:
Constant Field Values

DATABITS_8

public static final int DATABITS_8
See Also:
Constant Field Values

STOPBITS_1

public static final int STOPBITS_1
See Also:
Constant Field Values

STOPBITS_2

public static final int STOPBITS_2
See Also:
Constant Field Values

STOPBITS_1_5

public static final int STOPBITS_1_5
See Also:
Constant Field Values

PARITY_NONE

public static final int PARITY_NONE
See Also:
Constant Field Values

PARITY_ODD

public static final int PARITY_ODD
See Also:
Constant Field Values

PARITY_EVEN

public static final int PARITY_EVEN
See Also:
Constant Field Values

PARITY_MARK

public static final int PARITY_MARK
See Also:
Constant Field Values

PARITY_SPACE

public static final int PARITY_SPACE
See Also:
Constant Field Values

FLOWCONTROL_NONE

public static final int FLOWCONTROL_NONE
See Also:
Constant Field Values

FLOWCONTROL_RTSCTS_IN

public static final int FLOWCONTROL_RTSCTS_IN
See Also:
Constant Field Values

FLOWCONTROL_RTSCTS_OUT

public static final int FLOWCONTROL_RTSCTS_OUT
See Also:
Constant Field Values

FLOWCONTROL_XONXOFF_IN

public static final int FLOWCONTROL_XONXOFF_IN
See Also:
Constant Field Values

FLOWCONTROL_XONXOFF_OUT

public static final int FLOWCONTROL_XONXOFF_OUT
See Also:
Constant Field Values

fd

int fd

FD

java.io.FileDescriptor FD

rcvThreshold

int rcvThreshold

rcvTimeout

int rcvTimeout

rcvFraming

boolean rcvFraming

rcvFramingByte

int rcvFramingByte

rcvFramingByteReceived

boolean rcvFramingByteReceived

insBufferSize

int insBufferSize
Disable read buffering for now


insBufferCount

int insBufferCount

outsBufferSize

int outsBufferSize
Disable write buffering for default


outsBufferCount

int outsBufferCount

notifyOnBufferFlag

boolean notifyOnBufferFlag
Constructor Detail

NSSerialPort

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

Throws:
java.io.IOException
Method Detail

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Description copied from class: CommPort
Gets the input stream value.

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

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Description copied from class: CommPort
Gets the output stream value.

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

close

public void close()
Description copied from class: CommPort
Close.

Overrides:
close in class CommPort

finalize

protected void finalize()
                 throws java.io.IOException
Overrides:
finalize in class java.lang.Object
Throws:
java.io.IOException

enableReceiveThreshold

public void enableReceiveThreshold(int thresh)
                            throws UnsupportedCommOperationException
Description copied from class: CommPort
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:
CommPort.disableReceiveThreshold(), CommPort.getReceiveThreshold()

disableReceiveThreshold

public void disableReceiveThreshold()
Description copied from class: CommPort
Disable receive threshold.

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

isReceiveThresholdEnabled

public boolean isReceiveThresholdEnabled()
Description copied from class: CommPort
Gets the receive threshold enabled (boolean) value.

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

getReceiveThreshold

public int getReceiveThreshold()
Description copied from class: CommPort
Gets the receive threshold (int) value.

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

enableReceiveTimeout

public void enableReceiveTimeout(int rt)
                          throws UnsupportedCommOperationException
Description copied from class: CommPort
Enable receive timeout with the specified rcv timeout parameter.

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

disableReceiveTimeout

public void disableReceiveTimeout()
Description copied from class: CommPort
Disable receive timeout.

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

isReceiveTimeoutEnabled

public boolean isReceiveTimeoutEnabled()
Description copied from class: CommPort
Gets the receive timeout enabled (boolean) value.

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

getReceiveTimeout

public int getReceiveTimeout()
Description copied from class: CommPort
Gets the receive timeout (int) value.

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

enableReceiveFraming

public void enableReceiveFraming(int rcvFramingByte)
                          throws UnsupportedCommOperationException
Description copied from class: CommPort
Enable receive framing with the specified framing byte parameter.

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

disableReceiveFraming

public void disableReceiveFraming()
Description copied from class: CommPort
Disable receive framing.

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

isReceiveFramingEnabled

public boolean isReceiveFramingEnabled()
Description copied from class: CommPort
Gets the receive framing enabled (boolean) value.

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

getReceiveFramingByte

public int getReceiveFramingByte()
Description copied from class: CommPort
Gets the receive framing byte (int) value.

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

getBaudrate

public int getBaudrate()

isDtr

public boolean isDtr()

isRts

public boolean isRts()

setInputBufferSize

public void setInputBufferSize(int size)
Description copied from class: CommPort
Sets the input buffer size value.

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

getInputBufferSize

public int getInputBufferSize()
Description copied from class: CommPort
Gets the input buffer size (int) value.

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

setOutputBufferSize

public void setOutputBufferSize(int size)
Description copied from class: CommPort
Sets the output buffer size value.

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

getOutputBufferSize

public int getOutputBufferSize()
Description copied from class: CommPort
Gets the output buffer size (int) value.

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

addEventListener

public void addEventListener(SerialPortEventListener lstnr)
                      throws java.util.TooManyListenersException
Description copied from class: SerialPort
Add event listener with the specified lsnr parameter.

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

removeEventListener

public void removeEventListener()
Description copied from class: SerialPort
Remove event listener.

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

getBaudRate

public int getBaudRate()
Description copied from class: SerialPort
Gets the baud rate (int) value.

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

getDataBits

public int getDataBits()
Description copied from class: SerialPort
Gets the data bits (int) value.

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

getStopBits

public int getStopBits()
Description copied from class: SerialPort
Gets the stop bits (int) value.

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

getParity

public int getParity()
Description copied from class: SerialPort
Gets the parity (int) value.

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

sendBreak

public void sendBreak(int millis)
Description copied from class: SerialPort
Send break with the specified millis parameter.

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

setFlowControlMode

public void setFlowControlMode(int flowctrl)
                        throws UnsupportedCommOperationException
Sets the flow control mode. Parameters: flow - 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 Throws: 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.

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

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:
The flow control mode (int) value.
See Also:
SerialPort.setFlowControlMode(int)

setRcvFifoTrigger

public void setRcvFifoTrigger(int trigger)
Description copied from class: SerialPort
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
Description copied from class: SerialPort
Set serial port params with the specified baudrate, data bits, stop bits and parity parameters.

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

setDTR

public void setDTR(boolean dtr)
Description copied from class: SerialPort
Sets the dtr value.

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

isDTR

public boolean isDTR()
Description copied from class: SerialPort
Gets the dtr (boolean) value.

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

setRTS

public void setRTS(boolean rts)
Description copied from class: SerialPort
Sets the rts value.

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

isRTS

public boolean isRTS()
Description copied from class: SerialPort
Gets the rts (boolean) value.

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

isCTS

public boolean isCTS()
Description copied from class: SerialPort
Gets the cts (boolean) value.

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

isDSR

public boolean isDSR()
Description copied from class: SerialPort
Gets the dsr (boolean) value.

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

isRI

public boolean isRI()
Description copied from class: SerialPort
Gets the ri (boolean) value.

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

isCD

public boolean isCD()
Description copied from class: SerialPort
Gets the cd (boolean) value.

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

notifyOnDataAvailable

public void notifyOnDataAvailable(boolean notify)
Description copied from class: SerialPort
Notify on data available with the specified enable parameter.

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

notifyOnOutputEmpty

public void notifyOnOutputEmpty(boolean notify)
Description copied from class: SerialPort
Notify on output empty with the specified enable parameter.

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

notifyOnCTS

public void notifyOnCTS(boolean notify)
Description copied from class: SerialPort
Notify on cts with the specified enable parameter.

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

notifyOnDSR

public void notifyOnDSR(boolean notify)
Description copied from class: SerialPort
Notify on dsr with the specified enable parameter.

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

notifyOnRingIndicator

public void notifyOnRingIndicator(boolean notify)
Description copied from class: SerialPort
Notify on ring indicator with the specified enable parameter.

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

notifyOnCarrierDetect

public void notifyOnCarrierDetect(boolean notify)
Description copied from class: SerialPort
Notify on carrier detect with the specified enable parameter.

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

notifyOnOverrunError

public void notifyOnOverrunError(boolean notify)
Description copied from class: SerialPort
Notify on overrun error with the specified enable parameter.

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

notifyOnParityError

public void notifyOnParityError(boolean notify)
Description copied from class: SerialPort
Notify on parity error with the specified enable parameter.

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

notifyOnFramingError

public void notifyOnFramingError(boolean notify)
Description copied from class: SerialPort
Notify on framing error with the specified enable parameter.

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

notifyOnBreakInterrupt

public void notifyOnBreakInterrupt(boolean notify)
Description copied from class: SerialPort
Notify on break interrupt with the specified enable parameter.

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

reportSerialEvent

void reportSerialEvent(int eventType,
                       boolean oldvalue,
                       boolean newvalue)

1.0.0

Copyright (c) 1999, 2007 IBM