org.mbari.siam.core.nvt
Class NVTSerialPort

java.lang.Object
  extended by gnu.io.CommPort
      extended by gnu.io.SerialPort
          extended by org.mbari.siam.core.nvt.NVTSerialPort

public class NVTSerialPort
extends gnu.io.SerialPort

Implements gnu.io.SerialPortInterface for NVT (RFC 2217) serial devices.

This class does not implement EventListeners or any of notifyXXX() methods that impact notification.

Author:
Bob Herlien

Field Summary
protected  NVTInputStream _inStream
           
protected  int _ipPort
           
protected  boolean _isOpen
           
protected static org.apache.log4j.Logger _log4j
          Log4j logger
protected  NVTCom _nvtCom
           
protected  NVTOutputStream _outStream
           
protected  java.lang.String _serialPortName
           
protected  java.lang.String _server
           
static int DEFAULT_PORT
           
 
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
 
Fields inherited from class gnu.io.CommPort
name
 
Constructor Summary
NVTSerialPort(java.lang.String name)
          Constructor with default TCP Port
NVTSerialPort(java.lang.String host, int port)
          Constructor with IP address and port
 
Method Summary
 void addEventListener(gnu.io.SerialPortEventListener listener)
          Not Implemented.
 void close()
          Close the connection to the server
 void closeInputStream()
          Close the associated InputStream.
 void closeOutputStream()
          Close the associated OutputStream.
 void disableReceiveFraming()
          Not Implemented
 void disableReceiveThreshold()
          Not Implemented
 void disableReceiveTimeout()
          Not Implemented
 void enableReceiveFraming(int f)
           
 void enableReceiveThreshold(int threshold)
           
 void enableReceiveTimeout(int time)
           
 void flush()
          Flush the OutputStream
 int getBaudBase()
           
 int getBaudRate()
           
 boolean getCallOutHangup()
           
 int getDataBits()
           
 int getDivisor()
           
 byte getEndOfInputChar()
           
 int getFlowControlMode()
           
 int getInputBufferSize()
           
 java.io.InputStream getInputStream()
          Get the associated NVTInputStream
 boolean getLowLatency()
           
 java.lang.String getName()
           
 NVTCom getNVT()
          Get the underlying NVTCom.
 int getOutputBufferSize()
           
 java.io.OutputStream getOutputStream()
          Get the associated NVTOutputStream
 int getParity()
           
 byte getParityErrorChar()
           
 int getReceiveFramingByte()
           
 int getReceiveThreshold()
           
 int getReceiveTimeout()
           
 int getStopBits()
           
 java.lang.String getUARTType()
           
 boolean isCD()
           
 boolean isCTS()
           
 boolean isDSR()
           
 boolean isDTR()
           
 boolean isOpen()
           
 boolean isReceiveFramingEnabled()
           
 boolean isReceiveThresholdEnabled()
           
 boolean isReceiveTimeoutEnabled()
           
 boolean isRI()
           
 boolean isRTS()
           
 void notifyOnBreakInterrupt(boolean enable)
          Not Implemented
 void notifyOnCarrierDetect(boolean enable)
          Not Implemented
 void notifyOnCTS(boolean enable)
          Not Implemented
 void notifyOnDataAvailable(boolean enable)
          Not Implemented
 void notifyOnDSR(boolean enable)
          Not Implemented
 void notifyOnFramingError(boolean enable)
          Not Implemented
 void notifyOnOutputEmpty(boolean enable)
          Not Implemented
 void notifyOnOverrunError(boolean enable)
          Not Implemented
 void notifyOnParityError(boolean enable)
          Not Implemented
 void notifyOnRingIndicator(boolean enable)
          Not Implemented
 void open()
          Open the NVTCom
 void removeEventListener()
          Not Implemented
 void sendBreak(int duration)
          Send BREAK for duration milliseconds
 boolean setBaudBase(int base)
           
 boolean setCallOutHangup(boolean noHup)
           
 boolean setDivisor(int divisor)
           
 void setDTR(boolean state)
          Turn on/off DTR line
 boolean setEndOfInputChar(byte b)
           
 void setFlowControlMode(int flowcontrol)
           
 void setInputBufferSize(int size)
          Not Implemented
 boolean setLowLatency()
           
 void setOutputBufferSize(int size)
          Not Implemented
 boolean setParityErrorChar(byte b)
           
 void setRTS(boolean state)
          Turn on/off RTS line
 void setSerialPortParams(int baud, int databits, int stopbits, int parity)
          Set serial port baud, datasize, etc
 boolean setUARTType(java.lang.String type, boolean test)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_log4j

protected static org.apache.log4j.Logger _log4j
Log4j logger


DEFAULT_PORT

public static final int DEFAULT_PORT
See Also:
Constant Field Values

_nvtCom

protected NVTCom _nvtCom

_server

protected java.lang.String _server

_serialPortName

protected java.lang.String _serialPortName

_ipPort

protected int _ipPort

_inStream

protected NVTInputStream _inStream

_outStream

protected NVTOutputStream _outStream

_isOpen

protected boolean _isOpen
Constructor Detail

NVTSerialPort

public NVTSerialPort(java.lang.String host,
                     int port)
Constructor with IP address and port

Parameters:
host - Host name, either as DNS name ("focets4.mars.mbari.org") or dotted quad ("134.89.42.127")
port - TCP port to use.

NVTSerialPort

public NVTSerialPort(java.lang.String name)
Constructor with default TCP Port

Method Detail

open

public void open()
          throws java.io.IOException,
                 java.net.UnknownHostException
Open the NVTCom

Throws:
java.io.IOException - if can't connect to server
java.net.UnknownHostException

close

public void close()
Close the connection to the server

Overrides:
close in class gnu.io.CommPort

isOpen

public boolean isOpen()

getNVT

public NVTCom getNVT()
              throws java.io.IOException
Get the underlying NVTCom. If not open, open it. throws IOException if open fails

Throws:
java.io.IOException

closeInputStream

public void closeInputStream()
Close the associated InputStream.


closeOutputStream

public void closeOutputStream()
Close the associated OutputStream.


flush

public void flush()
           throws java.io.IOException
Flush the OutputStream

Throws:
java.io.IOException

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Get the associated NVTInputStream

Specified by:
getInputStream in class gnu.io.CommPort
Throws:
java.io.IOException

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Get the associated NVTOutputStream

Specified by:
getOutputStream in class gnu.io.CommPort
Throws:
java.io.IOException

getBaudRate

public int getBaudRate()
Specified by:
getBaudRate in class gnu.io.SerialPort

getDataBits

public int getDataBits()
Specified by:
getDataBits in class gnu.io.SerialPort

getFlowControlMode

public int getFlowControlMode()
Specified by:
getFlowControlMode in class gnu.io.SerialPort

getParity

public int getParity()
Specified by:
getParity in class gnu.io.SerialPort

getStopBits

public int getStopBits()
Specified by:
getStopBits in class gnu.io.SerialPort

isCD

public boolean isCD()
Specified by:
isCD in class gnu.io.SerialPort

isCTS

public boolean isCTS()
Specified by:
isCTS in class gnu.io.SerialPort

isDSR

public boolean isDSR()
Specified by:
isDSR in class gnu.io.SerialPort

isDTR

public boolean isDTR()
Specified by:
isDTR in class gnu.io.SerialPort

isRI

public boolean isRI()
Specified by:
isRI in class gnu.io.SerialPort

isRTS

public boolean isRTS()
Specified by:
isRTS in class gnu.io.SerialPort

addEventListener

public void addEventListener(gnu.io.SerialPortEventListener listener)
                      throws java.util.TooManyListenersException
Not Implemented. Just throws TooManyListenersException.

Specified by:
addEventListener in class gnu.io.SerialPort
Throws:
java.util.TooManyListenersException

removeEventListener

public void removeEventListener()
Not Implemented

Specified by:
removeEventListener in class gnu.io.SerialPort

notifyOnBreakInterrupt

public void notifyOnBreakInterrupt(boolean enable)
Not Implemented

Specified by:
notifyOnBreakInterrupt in class gnu.io.SerialPort

notifyOnCarrierDetect

public void notifyOnCarrierDetect(boolean enable)
Not Implemented

Specified by:
notifyOnCarrierDetect in class gnu.io.SerialPort

notifyOnCTS

public void notifyOnCTS(boolean enable)
Not Implemented

Specified by:
notifyOnCTS in class gnu.io.SerialPort

notifyOnDataAvailable

public void notifyOnDataAvailable(boolean enable)
Not Implemented

Specified by:
notifyOnDataAvailable in class gnu.io.SerialPort

notifyOnDSR

public void notifyOnDSR(boolean enable)
Not Implemented

Specified by:
notifyOnDSR in class gnu.io.SerialPort

notifyOnFramingError

public void notifyOnFramingError(boolean enable)
Not Implemented

Specified by:
notifyOnFramingError in class gnu.io.SerialPort

notifyOnOutputEmpty

public void notifyOnOutputEmpty(boolean enable)
Not Implemented

Specified by:
notifyOnOutputEmpty in class gnu.io.SerialPort

notifyOnOverrunError

public void notifyOnOverrunError(boolean enable)
Not Implemented

Specified by:
notifyOnOverrunError in class gnu.io.SerialPort

notifyOnParityError

public void notifyOnParityError(boolean enable)
Not Implemented

Specified by:
notifyOnParityError in class gnu.io.SerialPort

notifyOnRingIndicator

public void notifyOnRingIndicator(boolean enable)
Not Implemented

Specified by:
notifyOnRingIndicator in class gnu.io.SerialPort

sendBreak

public void sendBreak(int duration)
Send BREAK for duration milliseconds

Specified by:
sendBreak in class gnu.io.SerialPort

setDTR

public void setDTR(boolean state)
Turn on/off DTR line

Specified by:
setDTR in class gnu.io.SerialPort

setRTS

public void setRTS(boolean state)
Turn on/off RTS line

Specified by:
setRTS in class gnu.io.SerialPort

setSerialPortParams

public void setSerialPortParams(int baud,
                                int databits,
                                int stopbits,
                                int parity)
Set serial port baud, datasize, etc

Specified by:
setSerialPortParams in class gnu.io.SerialPort

setFlowControlMode

public void setFlowControlMode(int flowcontrol)
                        throws gnu.io.UnsupportedCommOperationException
Specified by:
setFlowControlMode in class gnu.io.SerialPort
Throws:
gnu.io.UnsupportedCommOperationException

getName

public java.lang.String getName()
Overrides:
getName in class gnu.io.CommPort

toString

public java.lang.String toString()
Overrides:
toString in class gnu.io.CommPort

disableReceiveFraming

public void disableReceiveFraming()
Not Implemented

Specified by:
disableReceiveFraming in class gnu.io.CommPort

disableReceiveThreshold

public void disableReceiveThreshold()
Not Implemented

Specified by:
disableReceiveThreshold in class gnu.io.CommPort

disableReceiveTimeout

public void disableReceiveTimeout()
Not Implemented

Specified by:
disableReceiveTimeout in class gnu.io.CommPort

setInputBufferSize

public void setInputBufferSize(int size)
Not Implemented

Specified by:
setInputBufferSize in class gnu.io.CommPort

setOutputBufferSize

public void setOutputBufferSize(int size)
Not Implemented

Specified by:
setOutputBufferSize in class gnu.io.CommPort

enableReceiveFraming

public void enableReceiveFraming(int f)
                          throws gnu.io.UnsupportedCommOperationException
Specified by:
enableReceiveFraming in class gnu.io.CommPort
Throws:
gnu.io.UnsupportedCommOperationException

enableReceiveThreshold

public void enableReceiveThreshold(int threshold)
                            throws gnu.io.UnsupportedCommOperationException
Specified by:
enableReceiveThreshold in class gnu.io.CommPort
Throws:
gnu.io.UnsupportedCommOperationException

enableReceiveTimeout

public void enableReceiveTimeout(int time)
                          throws gnu.io.UnsupportedCommOperationException
Specified by:
enableReceiveTimeout in class gnu.io.CommPort
Throws:
gnu.io.UnsupportedCommOperationException

getInputBufferSize

public int getInputBufferSize()
Specified by:
getInputBufferSize in class gnu.io.CommPort

getOutputBufferSize

public int getOutputBufferSize()
Specified by:
getOutputBufferSize in class gnu.io.CommPort

getReceiveFramingByte

public int getReceiveFramingByte()
Specified by:
getReceiveFramingByte in class gnu.io.CommPort

getReceiveThreshold

public int getReceiveThreshold()
Specified by:
getReceiveThreshold in class gnu.io.CommPort

getReceiveTimeout

public int getReceiveTimeout()
Specified by:
getReceiveTimeout in class gnu.io.CommPort

isReceiveFramingEnabled

public boolean isReceiveFramingEnabled()
Specified by:
isReceiveFramingEnabled in class gnu.io.CommPort

isReceiveThresholdEnabled

public boolean isReceiveThresholdEnabled()
Specified by:
isReceiveThresholdEnabled in class gnu.io.CommPort

isReceiveTimeoutEnabled

public boolean isReceiveTimeoutEnabled()
Specified by:
isReceiveTimeoutEnabled in class gnu.io.CommPort

getCallOutHangup

public boolean getCallOutHangup()
                         throws gnu.io.UnsupportedCommOperationException
Specified by:
getCallOutHangup in class gnu.io.SerialPort
Throws:
gnu.io.UnsupportedCommOperationException

setCallOutHangup

public boolean setCallOutHangup(boolean noHup)
                         throws gnu.io.UnsupportedCommOperationException
Specified by:
setCallOutHangup in class gnu.io.SerialPort
Throws:
gnu.io.UnsupportedCommOperationException

getBaudBase

public int getBaudBase()
                throws gnu.io.UnsupportedCommOperationException
Specified by:
getBaudBase in class gnu.io.SerialPort
Throws:
gnu.io.UnsupportedCommOperationException

setBaudBase

public boolean setBaudBase(int base)
                    throws gnu.io.UnsupportedCommOperationException
Specified by:
setBaudBase in class gnu.io.SerialPort
Throws:
gnu.io.UnsupportedCommOperationException

getDivisor

public int getDivisor()
               throws gnu.io.UnsupportedCommOperationException
Specified by:
getDivisor in class gnu.io.SerialPort
Throws:
gnu.io.UnsupportedCommOperationException

setDivisor

public boolean setDivisor(int divisor)
                   throws gnu.io.UnsupportedCommOperationException
Specified by:
setDivisor in class gnu.io.SerialPort
Throws:
gnu.io.UnsupportedCommOperationException

getEndOfInputChar

public byte getEndOfInputChar()
                       throws gnu.io.UnsupportedCommOperationException
Specified by:
getEndOfInputChar in class gnu.io.SerialPort
Throws:
gnu.io.UnsupportedCommOperationException

setEndOfInputChar

public boolean setEndOfInputChar(byte b)
                          throws gnu.io.UnsupportedCommOperationException
Specified by:
setEndOfInputChar in class gnu.io.SerialPort
Throws:
gnu.io.UnsupportedCommOperationException

getLowLatency

public boolean getLowLatency()
                      throws gnu.io.UnsupportedCommOperationException
Specified by:
getLowLatency in class gnu.io.SerialPort
Throws:
gnu.io.UnsupportedCommOperationException

setLowLatency

public boolean setLowLatency()
                      throws gnu.io.UnsupportedCommOperationException
Specified by:
setLowLatency in class gnu.io.SerialPort
Throws:
gnu.io.UnsupportedCommOperationException

getUARTType

public java.lang.String getUARTType()
                             throws gnu.io.UnsupportedCommOperationException
Specified by:
getUARTType in class gnu.io.SerialPort
Throws:
gnu.io.UnsupportedCommOperationException

setUARTType

public boolean setUARTType(java.lang.String type,
                           boolean test)
                    throws gnu.io.UnsupportedCommOperationException
Specified by:
setUARTType in class gnu.io.SerialPort
Throws:
gnu.io.UnsupportedCommOperationException

getParityErrorChar

public byte getParityErrorChar()
                        throws gnu.io.UnsupportedCommOperationException
Specified by:
getParityErrorChar in class gnu.io.SerialPort
Throws:
gnu.io.UnsupportedCommOperationException

setParityErrorChar

public boolean setParityErrorChar(byte b)
                           throws gnu.io.UnsupportedCommOperationException
Specified by:
setParityErrorChar in class gnu.io.SerialPort
Throws:
gnu.io.UnsupportedCommOperationException


Copyright © 2003 MBARI.

The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement.