Package jmri.jmrix.loconet
Class LnNetworkPortController
- java.lang.Object
-
- jmri.jmrix.AbstractPortController
-
- jmri.jmrix.AbstractNetworkPortController
-
- jmri.jmrix.loconet.LnNetworkPortController
-
- All Implemented Interfaces:
NetworkPortAdapter
,PortAdapter
- Direct Known Subclasses:
LnTcpDriverAdapter
public abstract class LnNetworkPortController extends AbstractNetworkPortController
Base for classes representing a LocoNet communications port.
-
-
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[]
commandStationNames
protected LnCommandStationType
commandStationType
protected LnCommandStationType[]
commandStationTypes
protected boolean
mInterrogateAtStart
protected boolean
mLoconetProtocolAutoDetect
protected boolean
mTranspondingAvailable
protected boolean
mTurnoutExtraSpace
protected boolean
mTurnoutNoRetry
-
Fields inherited from class jmri.jmrix.AbstractNetworkPortController
connTimeout, m_HostName, m_port, socketConn
-
Fields inherited from class jmri.jmrix.AbstractPortController
allowConnectionRecovery, manufacturerName, opened, option1Name, option2Name, option3Name, option4Name, options, reconnectinterval, reconnectMaxAttempts, reconnectMaxInterval
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
LnNetworkPortController(LocoNetSystemConnectionMemo connectionMemo)
Base class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
configureOption3(java.lang.String value)
Set the third port option.void
connect()
While opening, also register a ShutDown item that makes sure the socket is cleanly closed.LocoNetSystemConnectionMemo
getSystemConnectionMemo()
Get theSystemConnectionMemo
associated with this object.void
setCommandStationType(java.lang.String name)
Set config info from a name, which needs to be one of the valid ones.void
setCommandStationType(LnCommandStationType value)
Set configcommand station type.void
setInterrogateOnStart(java.lang.String value)
Set whether to interrogate at startupvoid
setLoconetProtocolAutoDetect(java.lang.String value)
Set whether to use XP slots if available or not.void
setTranspondingAvailable(java.lang.String value)
Set whether transponding is available.void
setTurnoutHandling(java.lang.String value)
-
Methods inherited from class jmri.jmrix.AbstractNetworkPortController
autoConfigure, closeConnection, connect, getAdvertisementName, getConnectionTimeout, getCurrentPortName, getHostAddress, getHostName, getInputStream, getMdnsConfigure, getOutputStream, getPort, getServiceType, reconnectFromLoop, resetupConnection, setAdvertisementName, setConnectionTimeout, setHostAddress, setHostName, setMdnsConfigure, setPort, setPort, setServiceType
-
Methods inherited from class jmri.jmrix.AbstractPortController
configureOption1, configureOption2, configureOption4, dispose, getDisabled, getManufacturer, getOption1Name, getOption2Name, getOption3Name, getOption4Name, getOptionChoices, getOptionDisplayName, getOptions, getOptionState, getReconnectMaxAttempts, getReconnectMaxInterval, getSystemPrefix, getUserName, isDirty, isOptionAdvanced, isOptionTypePassword, isOptionTypeText, isRestartRequired, purgeStream, reconnect, recover, 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.NetworkPortAdapter
configure, status
-
Methods inherited from interface jmri.jmrix.PortAdapter
configureOption1, configureOption2, configureOption4, dispose, getDisabled, getManufacturer, getOption1Name, getOption2Name, getOption3Name, getOption4Name, getOptionChoices, getOptionDisplayName, getOptions, getOptionState, getReconnectMaxAttempts, getReconnectMaxInterval, getSystemPrefix, getUserName, isDirty, isOptionAdvanced, isOptionTypePassword, isOptionTypeText, isRestartRequired, recover, setDisabled, setManufacturer, setOptionState, setReconnectMaxAttempts, setReconnectMaxInterval, setSystemConnectionMemo, setSystemPrefix, setUserName
-
-
-
-
Field Detail
-
commandStationType
protected LnCommandStationType commandStationType
-
mTurnoutNoRetry
protected boolean mTurnoutNoRetry
-
mTurnoutExtraSpace
protected boolean mTurnoutExtraSpace
-
mInterrogateAtStart
protected boolean mInterrogateAtStart
-
mTranspondingAvailable
protected boolean mTranspondingAvailable
-
mLoconetProtocolAutoDetect
protected boolean mLoconetProtocolAutoDetect
-
commandStationTypes
protected LnCommandStationType[] commandStationTypes
-
commandStationNames
protected java.lang.String[] commandStationNames
-
-
Constructor Detail
-
LnNetworkPortController
protected LnNetworkPortController(LocoNetSystemConnectionMemo connectionMemo)
Base class. Implementations will provide InputStream and OutputStream objects to LnTrafficController classes, who in turn will deal in messages.- Parameters:
connectionMemo
- associated memo for this connection
-
-
Method Detail
-
connect
public void connect() throws java.io.IOException
While opening, also register a ShutDown item that makes sure the socket is cleanly closed.- Specified by:
connect
in interfacePortAdapter
- Overrides:
connect
in classAbstractNetworkPortController
- Throws:
java.io.IOException
- if unable to connect
-
setCommandStationType
public void setCommandStationType(java.lang.String name)
Set config info from a name, which needs to be one of the valid ones.- Parameters:
name
- the name of the command station
-
setCommandStationType
public void setCommandStationType(LnCommandStationType value)
Set configcommand station type.- Parameters:
value
- command station type enum
-
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
-
setTurnoutHandling
public void setTurnoutHandling(java.lang.String value)
-
setTranspondingAvailable
public void setTranspondingAvailable(java.lang.String value)
Set whether transponding is available.- Parameters:
value
- either yes or no
-
setLoconetProtocolAutoDetect
public void setLoconetProtocolAutoDetect(java.lang.String value)
Set whether to use XP slots if available or not.- Parameters:
value
- either Bundle.getMessage("LoconetProtocolAutoDetect") or no
-
setInterrogateOnStart
public void setInterrogateOnStart(java.lang.String value)
Set whether to interrogate at startup- Parameters:
value
- either yes or no
-
configureOption3
public void configureOption3(java.lang.String value)
Set the third port option. Only to be used after construction, but before the openPort call.- Specified by:
configureOption3
in interfacePortAdapter
- Overrides:
configureOption3
in classAbstractPortController
- Parameters:
value
- to set the option to
-
-