jmri.jmrix
Class AbstractPortController

Show UML class diagram
java.lang.Object
  extended by jmri.jmrix.AbstractPortController
All Implemented Interfaces:
PortAdapter
Direct Known Subclasses:
AbstractNetworkPortController, AbstractSerialPortController, AbstractStreamPortController, XBeeIOStream

public abstract class AbstractPortController
extends Object
implements PortAdapter

Provide an abstract base for *PortController classes.

This is complicated by the lack of multiple inheritance. SerialPortAdapter is an Interface, and its implementing classes also inherit from various PortController types. But we want some common behaviors for those, so we put them here.

See Also:
SerialPortAdapter

Nested Class Summary
protected static class AbstractPortController.Option
           
 
Field Summary
protected  boolean allowConnectionRecovery
           
protected  boolean mDisabled
           
protected  String mManufacturer
           
protected  boolean opened
           
protected  String option1Name
           
protected  String option2Name
           
protected  String option3Name
           
protected  String option4Name
           
protected  Hashtable<String,AbstractPortController.Option> options
           
protected  int reconnectinterval
           
protected  int retryAttempts
           
 
Constructor Summary
AbstractPortController()
           
 
Method Summary
 void configureOption1(String value)
          Set the first port option.
 void configureOption2(String value)
          Set the second port option.
 void configureOption3(String value)
          Set the third port option.
 void configureOption4(String value)
          Set the fourth port option.
abstract  String getCurrentPortName()
           
 boolean getDisabled()
          Return the disabled state of the adapter
abstract  DataInputStream getInputStream()
           
 String getManufacturer()
          Get and set of the Manufacturer for network (TCP/IP) based connections is handled by the ConnectionConfig code in each connector.
 String getOption1Name()
           
 String getOption2Name()
           
 String getOption3Name()
           
 String getOption4Name()
           
 String[] getOptionChoices(String option)
          return a list of the various choices allowed with an option.
 String getOptionDisplayName(String option)
           
 String[] getOptions()
          Get a list of all the options configured against this adapter.
 String getOptionState(String option)
          Get the value of a specific option
abstract  DataOutputStream getOutputStream()
           
abstract  SystemConnectionMemo getSystemConnectionMemo()
           
 boolean isOptionAdvanced(String option)
           
abstract  void recover()
           
protected static void safeSleep(long milliseconds, String s)
           
protected  void setClosed()
           
abstract  void setDisabled(boolean disabled)
          Sets whether the connection is disabled
 void setManufacturer(String manufacturer)
          Set the System Manufacturers Name
protected  void setOpened()
           
 void setOptionState(String option, String value)
          Set the value of an option
 boolean status()
          Query the status of this connection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jmri.jmrix.PortAdapter
configure, connect, dispose
 

Field Detail

opened

protected boolean opened

option1Name

protected String option1Name

option2Name

protected String option2Name

option3Name

protected String option3Name

option4Name

protected String option4Name

options

protected Hashtable<String,AbstractPortController.Option> options

mManufacturer

protected String mManufacturer

mDisabled

protected boolean mDisabled

allowConnectionRecovery

protected boolean allowConnectionRecovery

reconnectinterval

protected int reconnectinterval

retryAttempts

protected int retryAttempts
Constructor Detail

AbstractPortController

public AbstractPortController()
Method Detail

getInputStream

public abstract DataInputStream getInputStream()
Specified by:
getInputStream in interface PortAdapter

getOutputStream

public abstract DataOutputStream getOutputStream()
Specified by:
getOutputStream in interface PortAdapter

status

public boolean status()
Description copied from interface: PortAdapter
Query the status of this connection. If all OK, at least as far as is known, return true

Specified by:
status in interface PortAdapter

setOpened

protected void setOpened()

setClosed

protected void setClosed()

getCurrentPortName

public abstract String getCurrentPortName()
Specified by:
getCurrentPortName in interface PortAdapter

configureOption1

public void configureOption1(String value)
Description copied from interface: PortAdapter
Set the first port option. Only to be used after construction, but before the openPort call

Specified by:
configureOption1 in interface PortAdapter

configureOption2

public void configureOption2(String value)
Description copied from interface: PortAdapter
Set the second port option. Only to be used after construction, but before the openPort call

Specified by:
configureOption2 in interface PortAdapter

configureOption3

public void configureOption3(String value)
Description copied from interface: PortAdapter
Set the third port option. Only to be used after construction, but before the openPort call

Specified by:
configureOption3 in interface PortAdapter

configureOption4

public void configureOption4(String value)
Description copied from interface: PortAdapter
Set the fourth port option. Only to be used after construction, but before the openPort call

Specified by:
configureOption4 in interface PortAdapter

getOption1Name

public String getOption1Name()
Specified by:
getOption1Name in interface PortAdapter

getOption2Name

public String getOption2Name()
Specified by:
getOption2Name in interface PortAdapter

getOption3Name

public String getOption3Name()
Specified by:
getOption3Name in interface PortAdapter

getOption4Name

public String getOption4Name()
Specified by:
getOption4Name in interface PortAdapter

getOptions

public String[] getOptions()
Get a list of all the options configured against this adapter.

Specified by:
getOptions in interface PortAdapter

setOptionState

public void setOptionState(String option,
                           String value)
Set the value of an option

Specified by:
setOptionState in interface PortAdapter

getOptionState

public String getOptionState(String option)
Get the value of a specific option

Specified by:
getOptionState in interface PortAdapter

getOptionChoices

public String[] getOptionChoices(String option)
return a list of the various choices allowed with an option.

Specified by:
getOptionChoices in interface PortAdapter

getOptionDisplayName

public String getOptionDisplayName(String option)
Specified by:
getOptionDisplayName in interface PortAdapter

isOptionAdvanced

public boolean isOptionAdvanced(String option)
Specified by:
isOptionAdvanced in interface PortAdapter

getManufacturer

public String getManufacturer()
Get and set of the Manufacturer for network (TCP/IP) based connections is handled by the ConnectionConfig code in each connector. this is here as we implement the serialdriveradpter.

Specified by:
getManufacturer in interface PortAdapter

setManufacturer

public void setManufacturer(String manufacturer)
Description copied from interface: PortAdapter
Set the System Manufacturers Name

Specified by:
setManufacturer in interface PortAdapter

getDisabled

public boolean getDisabled()
Description copied from interface: PortAdapter
Return the disabled state of the adapter

Specified by:
getDisabled in interface PortAdapter

setDisabled

public abstract void setDisabled(boolean disabled)
Description copied from interface: PortAdapter
Sets whether the connection is disabled

Specified by:
setDisabled in interface PortAdapter

getSystemConnectionMemo

public abstract SystemConnectionMemo getSystemConnectionMemo()
Specified by:
getSystemConnectionMemo in interface PortAdapter

recover

public abstract void recover()
Specified by:
recover in interface PortAdapter

safeSleep

protected static void safeSleep(long milliseconds,
                                String s)


Copyright © 1997-2014 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