Package jmri.jmrix.dccpp
Class DCCppNetworkPortController
- java.lang.Object
-
- jmri.jmrix.AbstractPortController
-
- jmri.jmrix.AbstractNetworkPortController
-
- jmri.jmrix.dccpp.DCCppNetworkPortController
-
- All Implemented Interfaces:
DCCppPortController,NetworkPortAdapter,PortAdapter
- Direct Known Subclasses:
DCCppEthernetAdapter,DCCppTcpDriverAdapter
public abstract class DCCppNetworkPortController extends AbstractNetworkPortController implements DCCppPortController
Base for classes representing a DCCpp 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 intcommandStationTypeprotected int[]commandStationTypesprotected 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 protectedDCCppNetworkPortController()protectedDCCppNetworkPortController(DCCppSystemConnectionMemo connectionMemo)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidconfigureOption3(java.lang.String value)Set the third port option.DCCppSystemConnectionMemogetSystemConnectionMemo()Get theSystemConnectionMemoassociated with this object.abstract booleanokToSend()Can the port accept additional characters?protected voidresetupConnection()Customizable method to deal with resetting a system connection after a successful recovery of a connection.voidsetCommandStationType(int value)Set config info from the command station type enum.voidsetCommandStationType(java.lang.String name)Set config info from a name, which needs to be one of the valid ones.voidsetOutputBufferEmpty(boolean s)We need a way to say if the output buffer is empty or notvoidsetTurnoutHandling(java.lang.String value)abstract booleanstatus()Check that this object is ready to operate.-
Methods inherited from class jmri.jmrix.AbstractNetworkPortController
autoConfigure, closeConnection, connect, connect, getAdvertisementName, getConnectionTimeout, getCurrentPortName, getHostAddress, getHostName, getInputStream, getMdnsConfigure, getOutputStream, getPort, getServiceType, reconnectFromLoop, 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
-
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
-
Methods inherited from interface jmri.jmrix.PortAdapter
configureOption1, configureOption2, configureOption4, connect, dispose, getDisabled, getInputStream, getManufacturer, getOption1Name, getOption2Name, getOption3Name, getOption4Name, getOptionChoices, getOptionDisplayName, getOptions, getOptionState, getOutputStream, getReconnectMaxAttempts, getReconnectMaxInterval, getSystemPrefix, getUserName, isDirty, isOptionAdvanced, isOptionTypePassword, isOptionTypeText, isRestartRequired, recover, setDisabled, setManufacturer, setOptionState, setReconnectMaxAttempts, setReconnectMaxInterval, setSystemConnectionMemo, setSystemPrefix, setUserName
-
-
-
-
Field Detail
-
commandStationType
protected int commandStationType
-
mTurnoutNoRetry
protected boolean mTurnoutNoRetry
-
mTurnoutExtraSpace
protected boolean mTurnoutExtraSpace
-
commandStationTypes
protected int[] commandStationTypes
-
commandStationNames
protected java.lang.String[] commandStationNames
-
-
Constructor Detail
-
DCCppNetworkPortController
protected DCCppNetworkPortController()
-
DCCppNetworkPortController
protected DCCppNetworkPortController(DCCppSystemConnectionMemo connectionMemo)
-
-
Method Detail
-
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- exact name of command station type.
-
setCommandStationType
public void setCommandStationType(int value)
Set config info from the command station type enum.- Parameters:
value- command station type.
-
getSystemConnectionMemo
public DCCppSystemConnectionMemo 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)
-
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
-
status
public abstract boolean status()
Check that this object is ready to operate. This is a question of configuration, not transient hardware status.- Specified by:
statusin interfaceDCCppPortController- Specified by:
statusin interfaceNetworkPortAdapter- Specified by:
statusin interfacePortAdapter- Overrides:
statusin classAbstractPortController- Returns:
- true if OK, at least as far as known
-
okToSend
public abstract 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.- Specified by:
okToSendin interfaceDCCppPortController- Returns:
- true if OK to send, else false.
-
setOutputBufferEmpty
public void setOutputBufferEmpty(boolean s)
Description copied from interface:DCCppPortControllerWe need a way to say if the output buffer is empty or not- Specified by:
setOutputBufferEmptyin interfaceDCCppPortController- Parameters:
s- true to set buffer empty, else false.
-
resetupConnection
protected void resetupConnection()
Customizable method to deal with resetting a system connection after a successful recovery of a connection.- Overrides:
resetupConnectionin classAbstractNetworkPortController
-
-