jmri.jmrix
Class NetworkPortAdapter

java.lang.Object
  extended by jmri.jmrix.AbstractPortController
      extended by jmri.jmrix.NetworkPortAdapter
All Implemented Interfaces:
PortAdapter, SerialPortAdapter

public abstract class NetworkPortAdapter
extends AbstractPortController

Enables basic setup of a network client interface for a jmrix implementation.

Author:
Paul Bender Copyright (C) 2009
See Also:
NetworkConfigException

Field Summary
protected  String m_HostName
           
protected  int m_port
           
protected  Socket socketConn
           
 
Fields inherited from class jmri.jmrix.AbstractPortController
mBaudRate, mOpt1, mOpt2, mPort
 
Constructor Summary
NetworkPortAdapter()
           
 
Method Summary
 String getHostName()
           
 DataInputStream getInputStream()
           
 DataOutputStream getOutputStream()
           
 int getPort()
           
 String openPort(String ipAddress, int port, String appName)
          Open an IP port.
 String openPort(String portName, String appName)
          Open a specified port.
 void setHostName(String s)
          Remember the associated host name
 void setPort(int p)
          Remeber the associated port number
 boolean status()
          Query the status of this connection.
 String[] validBaudRates()
          Get an array of valid baud rates.
 
Methods inherited from class jmri.jmrix.AbstractPortController
configureBaudRate, configureOption1, configureOption2, currentBaudNumber, getCurrentBaudRate, getCurrentOption1Setting, getCurrentOption2Setting, getCurrentPortName, getPortNames, handlePortBusy, handlePortNotFound, option1Name, option2Name, reloadDriver, setPort, validBaudNumber, validOption1, validOption2
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jmri.jmrix.SerialPortAdapter
configure
 

Field Detail

m_HostName

protected String m_HostName

m_port

protected int m_port

socketConn

protected Socket socketConn
Constructor Detail

NetworkPortAdapter

public NetworkPortAdapter()
Method Detail

openPort

public String openPort(String portName,
                       String appName)
Open a specified port. The appname argument is to be provided to the underlying OS during startup so that it can show on status displays, etc


openPort

public String openPort(String ipAddress,
                       int port,
                       String appName)
Open an IP port. The appname argument is to be provided to the underlying OS during startup so that it can show on status displays, etc


status

public boolean status()
Query the status of this connection. If all OK, at least as far as is known, return true

Specified by:
status in interface PortAdapter
Specified by:
status in interface SerialPortAdapter
Specified by:
status in class AbstractPortController

setHostName

public void setHostName(String s)
Remember the associated host name

Parameters:
s -

getHostName

public String getHostName()

setPort

public void setPort(int p)
Remeber the associated port number

Parameters:
p -

getPort

public int getPort()

getInputStream

public DataInputStream getInputStream()
Specified by:
getInputStream in interface PortAdapter
Specified by:
getInputStream in class AbstractPortController

getOutputStream

public DataOutputStream getOutputStream()
Specified by:
getOutputStream in interface PortAdapter
Specified by:
getOutputStream in class AbstractPortController

validBaudRates

public String[] validBaudRates()
Get an array of valid baud rates. This is currently just a message saying its fixed



Copyright © 1997 - 2009 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads