it.m2.net.telnet
Class NVTCom

java.lang.Object
  extended by it.m2.net.telnet.Telnet
      extended by it.m2.net.telnet.NVT
          extended by it.m2.net.telnet.NVTCom
All Implemented Interfaces:
TelnetOptions

public class NVTCom
extends NVT

Network Virtual Telnet Client Base on RFC2217 Permit to use a Serial Line connect a one terminal server compliant with RFC2217. - Tested with sredird 2.1.1

Version:
$Id: NVTCom.java,v 1.2 2009/07/16 22:04:51 headley Exp $
Author:
Mario Viara Modified by Bob Herlien, MBARI, to add capability to specify log file on command line for main()

Field Summary
static int FLOW_CTSRTS
           
static int FLOW_NONE
           
static int FLOW_QUERY
           
static int FLOW_XONXOFF
           
 
Fields inherited from class it.m2.net.telnet.Telnet
socket
 
Fields inherited from interface it.m2.net.telnet.TelnetOptions
COM_PORT_OPTION, CR, DATASIZE5, DATASIZE6, DATASIZE7, DATASIZE8, DO, DONT, ECHO, FLOW_CTRL_DCD, FLOW_CTRL_DSR, FLOW_CTRL_DTR, FLOW_CTRL_IN_HARDWARE, FLOW_CTRL_IN_NONE, FLOW_CTRL_IN_XONXOFF, FLOWCONTROL_RESUME, FLOWCONTROL_SUSPEND, IAC, LF, MODEM_CTS, MODEM_DCD, MODEM_DCTS, MODEM_DDCD, MODEM_DDSR, MODEM_DRI, MODEM_DSR, MODEM_RI, NOP, NOTIFY_LINESTATE, NOTIFY_MODEMSTATE, PARITY_EVEN, PARITY_MARK, PARITY_NONE, PARITY_ODD, PARITY_SPACE, PURGE_DATA, REQUEST_INBOUND, SB, SE, SERVER_PREFIX, SET_BAUDRATE, SET_CONTROL, SET_DATASIZE, SET_LINESTATE_MASK, SET_MODEMSTATE_MASK, SET_PARITY, SET_STOPSIZE, SIGNATURE, STOP_1, STOP_15, STOP_2, SUPPRESS_GO_AHEAD, TERMINAL_TYPE, TERMINAL_TYPE_IS, TERMINAL_TYPE_SEND, TRASMIT_BINARY, WILL, WONT
 
Constructor Summary
NVTCom(java.lang.String host, int port)
          Standard constructor
 
Method Summary
 void addModemChangeListener(NVTListener listener)
           
 int getBaud()
          Return the current baud rate
 boolean getBREAK()
           
 boolean getCTS()
           
 int getDataSize()
           
 boolean getDCD()
           
 boolean getDSR()
           
 boolean getDTR()
           
 int getFlow()
           
 int getModemState()
          Return the current modem state
 java.lang.String getParity()
           
 java.lang.String getPortConfig()
           
 boolean getRI()
           
 boolean getRTS()
           
 java.lang.String getSignature()
          Return the port signature or null if the option is not received
 int getStopSize()
           
 boolean isComSupported()
           
static void main(java.lang.String[] args)
           
 boolean sendInfo()
           
 boolean sendTest()
           
 int setBaud(int baud)
           
 boolean setBREAK(boolean mode)
           
 int setDataSize(int data)
           
 void setDefaults()
           
 boolean setDTR(boolean mode)
           
 int setFlow(int flow)
           
 boolean setModemMask(int mask)
           
protected  void setOptions()
           
 java.lang.String setParity(java.lang.String s)
          Set parity
 boolean setRTS(boolean mode)
           
 int setStopSize(int stop)
           
 
Methods inherited from class it.m2.net.telnet.NVT
addReceivedListener, isRunning
 
Methods inherited from class it.m2.net.telnet.Telnet
addLogger, addLogger, addLogger, addOption, available, close, flush, getInetAddress, getLocalOption, getLogLevel, getReceivedByteCount, getRemoteHost, getRemoteOption, getRemotePort, getSentByteCount, isDo, isLog, isWill, log, log, negotiate, read, read, read, releaseCpu, sendIAC, sendIAC, sendIACNOP, sendSB, sendSB, sendSB, sendSB, setDoOption, setLogLevel, setSocket, setSocket, setWillOption, setWillOption, updateReceivedByteCount, updateSentByteCount, write, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FLOW_QUERY

public static final int FLOW_QUERY
See Also:
Constant Field Values

FLOW_NONE

public static final int FLOW_NONE
See Also:
Constant Field Values

FLOW_XONXOFF

public static final int FLOW_XONXOFF
See Also:
Constant Field Values

FLOW_CTSRTS

public static final int FLOW_CTSRTS
See Also:
Constant Field Values
Constructor Detail

NVTCom

public NVTCom(java.lang.String host,
              int port)
       throws java.io.IOException
Standard constructor

Parameters:
host - RFC2217 host
port - RFC2217 port
Throws:
java.io.IOException
Method Detail

addModemChangeListener

public void addModemChangeListener(NVTListener listener)

setDefaults

public void setDefaults()
                 throws java.io.IOException
Overrides:
setDefaults in class NVT
Throws:
java.io.IOException

setOptions

protected void setOptions()
                   throws java.io.IOException
Overrides:
setOptions in class NVT
Throws:
java.io.IOException

getSignature

public java.lang.String getSignature()
                              throws java.io.IOException
Return the port signature or null if the option is not received

Throws:
java.io.IOException

getBaud

public int getBaud()
            throws java.io.IOException
Return the current baud rate

Throws:
java.io.IOException

getModemState

public int getModemState()
Return the current modem state


setModemMask

public boolean setModemMask(int mask)
                     throws java.io.IOException
Throws:
java.io.IOException

setBaud

public int setBaud(int baud)
            throws java.io.IOException
Throws:
java.io.IOException

getDataSize

public int getDataSize()
                throws java.io.IOException
Throws:
java.io.IOException

setDataSize

public int setDataSize(int data)
                throws java.io.IOException
Throws:
java.io.IOException

getStopSize

public int getStopSize()
                throws java.io.IOException
Throws:
java.io.IOException

setStopSize

public int setStopSize(int stop)
                throws java.io.IOException
Throws:
java.io.IOException

getParity

public java.lang.String getParity()
                           throws java.io.IOException
Throws:
java.io.IOException

setParity

public java.lang.String setParity(java.lang.String s)
                           throws java.io.IOException
Set parity

Parameters:
s - Parity (None,Even,Odd,Mark,Space) onlu the first char is checked and it is case insensitive.
Throws:
java.io.IOException

getFlow

public int getFlow()
            throws java.io.IOException
Throws:
java.io.IOException

setFlow

public int setFlow(int flow)
            throws java.io.IOException
Throws:
java.io.IOException

getDSR

public boolean getDSR()
               throws java.io.IOException
Throws:
java.io.IOException

getDCD

public boolean getDCD()
               throws java.io.IOException
Throws:
java.io.IOException

getCTS

public boolean getCTS()
               throws java.io.IOException
Throws:
java.io.IOException

getRI

public boolean getRI()
              throws java.io.IOException
Throws:
java.io.IOException

getDTR

public boolean getDTR()
               throws java.io.IOException
Throws:
java.io.IOException

setDTR

public boolean setDTR(boolean mode)
               throws java.io.IOException
Throws:
java.io.IOException

getRTS

public boolean getRTS()
               throws java.io.IOException
Throws:
java.io.IOException

setRTS

public boolean setRTS(boolean mode)
               throws java.io.IOException
Throws:
java.io.IOException

getBREAK

public boolean getBREAK()
                 throws java.io.IOException
Throws:
java.io.IOException

setBREAK

public boolean setBREAK(boolean mode)
                 throws java.io.IOException
Throws:
java.io.IOException

getPortConfig

public java.lang.String getPortConfig()
                               throws java.io.IOException
Throws:
java.io.IOException

isComSupported

public boolean isComSupported()

sendInfo

public boolean sendInfo()
                 throws java.io.IOException
Throws:
java.io.IOException

sendTest

public boolean sendTest()
                 throws java.io.IOException
Throws:
java.io.IOException

main

public static void main(java.lang.String[] args)


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.