Package jmri.jmrix.dccpp.network
Class DCCppEthernetAdapter
- java.lang.Object
-
- jmri.jmrix.AbstractPortController
-
- jmri.jmrix.AbstractNetworkPortController
-
- jmri.jmrix.dccpp.DCCppNetworkPortController
-
- jmri.jmrix.dccpp.network.DCCppEthernetAdapter
-
- All Implemented Interfaces:
DCCppPortController,NetworkPortAdapter,PortAdapter
public class DCCppEthernetAdapter extends DCCppNetworkPortController
Provide access to DCC++ Base Station via Ethernet. NOTES: By default, the LIUSBEthernet has an IP address of 192.168.0.200 and listens to port 5550. The LIUSBEtherenet disconnects both ports if there is 60 seconds of inactivity on the port.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jmri.jmrix.AbstractPortController
AbstractPortController.Option
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static intCOMMUNICATION_TCP_PORT(package private) static java.lang.StringDEFAULT_IP_ADDRESS(package private) ZeroConfClientmdnsClient-
Fields inherited from class jmri.jmrix.dccpp.DCCppNetworkPortController
commandStationNames, commandStationType, commandStationTypes, mTurnoutExtraSpace, 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 Constructor Description DCCppEthernetAdapter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidautoConfigure()Set the server's host name and port using mdns autoconfiguration.voidconfigure()Set up all of the other objects to operate with a LIUSB Ethernet interface.voidconnect()Open the connection.java.lang.StringgetAdvertisementName()Get the ZeroConf/mDNS advertisement name.booleangetMdnsConfigure()Get whether or not this adapter is configured to use autoconfiguration via MDNS.java.lang.StringgetServiceType()Get the ZeroConf/mDNS service type.booleanokToSend()Can the port accept additional characters?voidsetMdnsConfigure(boolean autoconfig)Set whether or not this adapter should be configured automatically via MDNS.booleanstatus()Check that this object is ready to operate.-
Methods inherited from class jmri.jmrix.dccpp.DCCppNetworkPortController
configureOption3, getSystemConnectionMemo, resetupConnection, setCommandStationType, setCommandStationType, setOutputBufferEmpty, setTurnoutHandling
-
Methods inherited from class jmri.jmrix.AbstractNetworkPortController
closeConnection, connect, getConnectionTimeout, getCurrentPortName, getHostAddress, getHostName, getInputStream, getOutputStream, getPort, reconnectFromLoop, setAdvertisementName, setConnectionTimeout, setHostAddress, setHostName, 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.PortAdapter
configureOption1, configureOption2, configureOption4, 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
-
COMMUNICATION_TCP_PORT
static final int COMMUNICATION_TCP_PORT
- See Also:
- Constant Field Values
-
DEFAULT_IP_ADDRESS
static final java.lang.String DEFAULT_IP_ADDRESS
- See Also:
- Constant Field Values
-
mdnsClient
ZeroConfClient mdnsClient
-
-
Constructor Detail
-
DCCppEthernetAdapter
public DCCppEthernetAdapter()
-
-
Method Detail
-
connect
public void connect() throws java.io.IOException
Description copied from interface:PortAdapterOpen the connection.- Specified by:
connectin interfacePortAdapter- Overrides:
connectin classAbstractNetworkPortController- Throws:
java.io.IOException- if unable to connect
-
okToSend
public boolean okToSend()
Can the port accept additional characters?- Specified by:
okToSendin interfaceDCCppPortController- Specified by:
okToSendin classDCCppNetworkPortController- Returns:
- true if the port is opened
-
status
public boolean status()
Description copied from class:DCCppNetworkPortControllerCheck 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- Specified by:
statusin classDCCppNetworkPortController- 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 LIUSB Ethernet interface.
-
setMdnsConfigure
public void setMdnsConfigure(boolean autoconfig)
Set whether or not this adapter should be configured automatically via MDNS.- Specified by:
setMdnsConfigurein interfaceNetworkPortAdapter- Overrides:
setMdnsConfigurein classAbstractNetworkPortController- Parameters:
autoconfig- boolean value.
-
getMdnsConfigure
public boolean getMdnsConfigure()
Get whether or not this adapter is configured to use autoconfiguration via MDNS.- Specified by:
getMdnsConfigurein interfaceNetworkPortAdapter- Overrides:
getMdnsConfigurein classAbstractNetworkPortController- Returns:
- true if configured using MDNS.
-
autoConfigure
public void autoConfigure()
Set the server's host name and port using mdns autoconfiguration.- Specified by:
autoConfigurein interfaceNetworkPortAdapter- Overrides:
autoConfigurein classAbstractNetworkPortController
-
getAdvertisementName
public java.lang.String getAdvertisementName()
Get the ZeroConf/mDNS advertisement name. this value is fixed on the LIUSB-Ethernet, so return the default value.- Specified by:
getAdvertisementNamein interfaceNetworkPortAdapter- Overrides:
getAdvertisementNamein classAbstractNetworkPortController
-
getServiceType
public java.lang.String getServiceType()
Get the ZeroConf/mDNS service type. this value is fixed on the LIUSB-Ethernet, so return the default value.- Specified by:
getServiceTypein interfaceNetworkPortAdapter- Overrides:
getServiceTypein classAbstractNetworkPortController
-
-