Package jmri.jmrix
Class AbstractStreamPortController
- java.lang.Object
-
- jmri.jmrix.AbstractPortController
-
- jmri.jmrix.AbstractStreamPortController
-
- All Implemented Interfaces:
PortAdapter
- Direct Known Subclasses:
DCCppStreamPortController
,LnStreamPortController
,RfidStreamPortController
,SprogCSStreamPortController
,XNetStreamPortController
public abstract class AbstractStreamPortController extends AbstractPortController
Provide an abstract implementation of a *StreamPortController for stream based ports.Implementing classes need to implement status and configure from the portAdapter interface, along with any system specific requirements.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jmri.jmrix.AbstractPortController
AbstractPortController.Option
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
_name
protected java.io.DataInputStream
input
protected java.io.DataOutputStream
output
-
Fields inherited from class jmri.jmrix.AbstractPortController
allowConnectionRecovery, manufacturerName, opened, option1Name, option2Name, option3Name, option4Name, options, reconnectinterval, reconnectMaxAttempts, reconnectMaxInterval
-
-
Constructor Summary
Constructors Constructor Description AbstractStreamPortController(SystemConnectionMemo connectionMemo)
AbstractStreamPortController(SystemConnectionMemo connectionMemo, java.io.DataInputStream in, java.io.DataOutputStream out, java.lang.String pname)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
connect()
Open the connection.void
connect(AbstractPortController port)
void
dispose()
Clean up before removal.java.lang.String
getCurrentPortName()
java.io.DataInputStream
getInputStream()
Get the InputStream from the port.java.io.DataOutputStream
getOutputStream()
Get the outputStream to the port.void
recover()
This is called when a connection is initially lost.-
Methods inherited from class jmri.jmrix.AbstractPortController
closeConnection, configureOption1, configureOption2, configureOption3, configureOption4, getDisabled, getManufacturer, getOption1Name, getOption2Name, getOption3Name, getOption4Name, getOptionChoices, getOptionDisplayName, getOptions, getOptionState, getReconnectMaxAttempts, getReconnectMaxInterval, getSystemConnectionMemo, getSystemPrefix, getUserName, isDirty, isOptionAdvanced, isOptionTypePassword, isOptionTypeText, isRestartRequired, purgeStream, reconnect, reconnectFromLoop, resetupConnection, safeSleep, setClosed, setDisabled, setManufacturer, setOpened, setOptionState, setReconnectMaxAttempts, setReconnectMaxInterval, setSystemConnectionMemo, setSystemPrefix, setUserName, status
-
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
-
-
-
-
Constructor Detail
-
AbstractStreamPortController
public AbstractStreamPortController(SystemConnectionMemo connectionMemo, java.io.DataInputStream in, java.io.DataOutputStream out, java.lang.String pname)
-
AbstractStreamPortController
public AbstractStreamPortController(SystemConnectionMemo connectionMemo)
-
-
Method Detail
-
getInputStream
public java.io.DataInputStream getInputStream()
Description copied from class:AbstractPortController
Get the InputStream from the port.- Specified by:
getInputStream
in interfacePortAdapter
- Specified by:
getInputStream
in classAbstractPortController
- Returns:
- the InputStream from the port
-
getOutputStream
public java.io.DataOutputStream getOutputStream()
Description copied from class:AbstractPortController
Get the outputStream to the port.- Specified by:
getOutputStream
in interfacePortAdapter
- Specified by:
getOutputStream
in classAbstractPortController
- Returns:
- the outputStream to the port
-
getCurrentPortName
public java.lang.String getCurrentPortName()
- Specified by:
getCurrentPortName
in interfacePortAdapter
- Specified by:
getCurrentPortName
in classAbstractPortController
-
recover
public void recover()
Description copied from class:AbstractPortController
This is called when a connection is initially lost. After checking the allowConnectionRecovery flag, closes the connection, resets the open flag and attempts a reconnection.- Specified by:
recover
in interfacePortAdapter
- Overrides:
recover
in classAbstractPortController
-
connect
public void connect()
Description copied from interface:PortAdapter
Open the connection.
-
connect
public void connect(AbstractPortController port)
-
dispose
public void dispose()
Description copied from class:AbstractPortController
Clean up before removal. Overriding methods must callsuper.dispose()
or document why they are not calling the overridden implementation. In most cases, failure to call the overridden implementation will cause user-visible error.- Specified by:
dispose
in interfacePortAdapter
- Overrides:
dispose
in classAbstractPortController
-
-