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[]
commandStationNames
protected int
commandStationType
protected int[]
commandStationTypes
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
DCCppNetworkPortController()
protected
DCCppNetworkPortController(DCCppSystemConnectionMemo connectionMemo)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
configureOption3(java.lang.String value)
Set the third port option.DCCppSystemConnectionMemo
getSystemConnectionMemo()
Get theSystemConnectionMemo
associated with this object.abstract boolean
okToSend()
Can the port accept additional characters?protected void
resetupConnection()
Customizable method to deal with resetting a system connection after a successful recovery of a connection.void
setCommandStationType(int value)
Set config info from the command station type enum.void
setCommandStationType(java.lang.String name)
Set config info from a name, which needs to be one of the valid ones.void
setOutputBufferEmpty(boolean s)
We need a way to say if the output buffer is empty or notvoid
setTurnoutHandling(java.lang.String value)
abstract boolean
status()
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: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)
-
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
-
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:
status
in interfaceDCCppPortController
- Specified by:
status
in interfaceNetworkPortAdapter
- Specified by:
status
in interfacePortAdapter
- Overrides:
status
in 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:
okToSend
in interfaceDCCppPortController
- Returns:
- true if OK to send, else false.
-
setOutputBufferEmpty
public void setOutputBufferEmpty(boolean s)
Description copied from interface:DCCppPortController
We need a way to say if the output buffer is empty or not- Specified by:
setOutputBufferEmpty
in 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:
resetupConnection
in classAbstractNetworkPortController
-
-