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 int
COMMUNICATION_TCP_PORT
(package private) static java.lang.String
DEFAULT_IP_ADDRESS
(package private) ZeroConfClient
mdnsClient
-
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 void
autoConfigure()
Set the server's host name and port using mdns autoconfiguration.void
configure()
Set up all of the other objects to operate with a LIUSB Ethernet interface.void
connect()
Open the connection.java.lang.String
getAdvertisementName()
Get the ZeroConf/mDNS advertisement name.boolean
getMdnsConfigure()
Get whether or not this adapter is configured to use autoconfiguration via MDNS.java.lang.String
getServiceType()
Get the ZeroConf/mDNS service type.boolean
okToSend()
Can the port accept additional characters?void
setMdnsConfigure(boolean autoconfig)
Set whether or not this adapter should be configured automatically via MDNS.boolean
status()
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:PortAdapter
Open the connection.- Specified by:
connect
in interfacePortAdapter
- Overrides:
connect
in classAbstractNetworkPortController
- Throws:
java.io.IOException
- if unable to connect
-
okToSend
public boolean okToSend()
Can the port accept additional characters?- Specified by:
okToSend
in interfaceDCCppPortController
- Specified by:
okToSend
in classDCCppNetworkPortController
- Returns:
- true if the port is opened
-
status
public boolean status()
Description copied from class:DCCppNetworkPortController
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
- Specified by:
status
in 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:
setMdnsConfigure
in interfaceNetworkPortAdapter
- Overrides:
setMdnsConfigure
in classAbstractNetworkPortController
- Parameters:
autoconfig
- boolean value.
-
getMdnsConfigure
public boolean getMdnsConfigure()
Get whether or not this adapter is configured to use autoconfiguration via MDNS.- Specified by:
getMdnsConfigure
in interfaceNetworkPortAdapter
- Overrides:
getMdnsConfigure
in classAbstractNetworkPortController
- Returns:
- true if configured using MDNS.
-
autoConfigure
public void autoConfigure()
Set the server's host name and port using mdns autoconfiguration.- Specified by:
autoConfigure
in interfaceNetworkPortAdapter
- Overrides:
autoConfigure
in 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:
getAdvertisementName
in interfaceNetworkPortAdapter
- Overrides:
getAdvertisementName
in 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:
getServiceType
in interfaceNetworkPortAdapter
- Overrides:
getServiceType
in classAbstractNetworkPortController
-
-