Package jmri.jmrix.loconet.streamport
Class LnStreamPortController
- java.lang.Object
-
- jmri.jmrix.AbstractPortController
-
- jmri.jmrix.AbstractStreamPortController
-
- jmri.jmrix.loconet.streamport.LnStreamPortController
-
- All Implemented Interfaces:
PortAdapter
- Direct Known Subclasses:
Z21LnStreamPortController
public class LnStreamPortController extends AbstractStreamPortController
Base for classes representing a LocoNet communications port connected via streams.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jmri.jmrix.AbstractPortController
AbstractPortController.Option
-
-
Field Summary
Fields Modifier and Type Field Description protected LnCommandStationType
commandStationType
protected boolean
mInterrogateAtStart
protected boolean
mTurnoutExtraSpace
protected boolean
mTurnoutNoRetry
-
Fields inherited from class jmri.jmrix.AbstractStreamPortController
_name, input, output
-
Fields inherited from class jmri.jmrix.AbstractPortController
allowConnectionRecovery, manufacturerName, opened, option1Name, option2Name, option3Name, option4Name, options, reconnectinterval, reconnectMaxAttempts, reconnectMaxInterval
-
-
Constructor Summary
Constructors Constructor Description LnStreamPortController()
LnStreamPortController(java.io.DataInputStream in, java.io.DataOutputStream out, java.lang.String pname)
LnStreamPortController(LocoNetSystemConnectionMemo 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
configure()
Set up all of the other objects to operate with a LocoNet connected via this class.LocoNetSystemConnectionMemo
getSystemConnectionMemo()
Get theSystemConnectionMemo
associated with this object.boolean
okToSend()
Can the port accept additional characters?void
setCommandStationType(LnCommandStationType value)
Set config info from the Command Station type enum.void
setInterrogateOnStart(java.lang.String value)
Set whether to interrogate at startupvoid
setTurnoutHandling(java.lang.String value)
boolean
status()
Check that this object is ready to operate.-
Methods inherited from class jmri.jmrix.AbstractStreamPortController
connect, connect, dispose, getCurrentPortName, getInputStream, getOutputStream, recover
-
Methods inherited from class jmri.jmrix.AbstractPortController
closeConnection, configureOption1, configureOption2, configureOption3, configureOption4, getDisabled, getManufacturer, getOption1Name, getOption2Name, getOption3Name, getOption4Name, getOptionChoices, getOptionDisplayName, getOptions, getOptionState, getReconnectMaxAttempts, getReconnectMaxInterval, getSystemPrefix, getUserName, isDirty, isOptionAdvanced, isOptionTypePassword, isOptionTypeText, isRestartRequired, purgeStream, reconnect, reconnectFromLoop, resetupConnection, safeSleep, setClosed, setDisabled, setManufacturer, setOpened, setOptionState, setReconnectMaxAttempts, setReconnectMaxInterval, setSystemConnectionMemo, setSystemPrefix, setUserName
-
-
-
-
Field Detail
-
commandStationType
protected LnCommandStationType commandStationType
-
mTurnoutNoRetry
protected boolean mTurnoutNoRetry
-
mTurnoutExtraSpace
protected boolean mTurnoutExtraSpace
-
mInterrogateAtStart
protected boolean mInterrogateAtStart
-
-
Constructor Detail
-
LnStreamPortController
public LnStreamPortController(LocoNetSystemConnectionMemo connectionMemo, java.io.DataInputStream in, java.io.DataOutputStream out, java.lang.String pname)
-
LnStreamPortController
public LnStreamPortController(java.io.DataInputStream in, java.io.DataOutputStream out, java.lang.String pname)
-
LnStreamPortController
public LnStreamPortController()
-
-
Method Detail
-
status
public boolean status()
Check that this object is ready to operate. This is a question of configuration, not transient hardware status.- Specified by:
status
in interfacePortAdapter
- Overrides:
status
in classAbstractPortController
- Returns:
- true if OK, at least as far as known
-
configure
public void configure()
Set up all of the other objects to operate with a LocoNet connected via this class.
-
okToSend
public boolean okToSend()
Can the port accept additional characters? This might go false for short intervals, but it might also stick off if something goes wrong.Provide a default implementation for the MS100, etc, in which this is _always_ true, as we rely on the queueing in the port itself.
- Returns:
- always true.
-
setCommandStationType
public void setCommandStationType(LnCommandStationType value)
Set config info from the Command Station type enum.- Parameters:
value
- Command Station Type, can be null while switching protocols.
-
setTurnoutHandling
public void setTurnoutHandling(java.lang.String value)
-
setInterrogateOnStart
public void setInterrogateOnStart(java.lang.String value)
Set whether to interrogate at startup- Parameters:
value
- either yes or no
-
getSystemConnectionMemo
public LocoNetSystemConnectionMemo getSystemConnectionMemo()
Description copied from class:AbstractPortController
Get theSystemConnectionMemo
associated with this object.This method should only be overridden to ensure that a specific subclass of SystemConnectionMemo is returned. The recommended pattern is:
public MySystemConnectionMemo getSystemConnectionMemo() { return (MySystemConnectionMemo) super.getSystemConnectionMemo(); }
- Specified by:
getSystemConnectionMemo
in interfacePortAdapter
- Overrides:
getSystemConnectionMemo
in classAbstractPortController
- Returns:
- the currently associated SystemConnectionMemo
-
-