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[]commandStationNamesprotected LnCommandStationTypecommandStationTypeprotected LnCommandStationType[]commandStationTypesprotected booleanmInterrogateAtStartprotected booleanmLoconetProtocolAutoDetectprotected booleanmTranspondingAvailableprotected booleanmTurnoutExtraSpaceprotected booleanmTurnoutNoRetry-
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 protectedLnNetworkPortController(LocoNetSystemConnectionMemo connectionMemo)Base class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconfigureOption3(java.lang.String value)Set the third port option.voidconnect()While opening, also register a ShutDown item that makes sure the socket is cleanly closed.LocoNetSystemConnectionMemogetSystemConnectionMemo()Get theSystemConnectionMemoassociated with this object.voidsetCommandStationType(java.lang.String name)Set config info from a name, which needs to be one of the valid ones.voidsetCommandStationType(LnCommandStationType value)Set configcommand station type.voidsetInterrogateOnStart(java.lang.String value)Set whether to interrogate at startupvoidsetLoconetProtocolAutoDetect(java.lang.String value)Set whether to use XP slots if available or not.voidsetTranspondingAvailable(java.lang.String value)Set whether transponding is available.voidsetTurnoutHandling(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:
connectin interfacePortAdapter- Overrides:
connectin 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:AbstractPortControllerGet theSystemConnectionMemoassociated 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:
getSystemConnectionMemoin interfacePortAdapter- Overrides:
getSystemConnectionMemoin 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:
configureOption3in interfacePortAdapter- Overrides:
configureOption3in classAbstractPortController- Parameters:
value- to set the option to
-
-