Package jmri.jmrix
Class ConnectionStatus
java.lang.Object
jmri.jmrix.ConnectionStatus
Interface for classes that wish to get notification when the connection to
the layout changes.
Maintains a single instance, as there is only one set of connections for the running program.
The "system name" referred to here is the human-readable name like "LocoNet 2"
which can be obtained from i.e.
SystemConnectionMemo.getUserName().
Not clear whether ConnectionConfig.getConnectionName() is correct.
It's not intended to be the prefix from i.e. PortAdapter.getSystemPrefix().
Maybe the right thing is to pass in the SystemConnectionMemo?
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final String(package private) PropertyChangeSupport -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConnection(String systemName, String portName) Add a connection with a given name and port name to the portStatus set if not yet present in the set.void(package private) static voidprotected voidfirePropertyChange(String p, Object old, Object n) getConnectionState(String systemName, String portName) Get the status of a communication port with a given name.getSystemState(String systemName) Get the status of a communication port, based on the system name only.static ConnectionStatusinstance()booleanisConnectionOk(String systemName, String portName) Confirm status of a communication port is not down.booleanisSystemOk(String systemName) Confirm status of a communication port is not down, based on the system name.voidvoidsetConnectionState(String systemName, String portName, String state) Set the connection state of a communication port.
-
Field Details
-
CONNECTION_UNKNOWN
- See Also:
-
CONNECTION_UP
- See Also:
-
CONNECTION_DOWN
- See Also:
-
pcs
-
-
Method Details
-
instance
-
clearInstance
-
addConnection
Add a connection with a given name and port name to the portStatus set if not yet present in the set.- Parameters:
systemName- human-readable name for system like "LocoNet 2" which can be obtained from i.e.SystemConnectionMemo.getUserName().portName- the port name
-
setConnectionState
Set the connection state of a communication port.- Parameters:
systemName- human-readable name for system like "LocoNet 2" which can be obtained from i.e.SystemConnectionMemo.getUserName().portName- the port namestate- one of ConnectionStatus.UP, ConnectionStatus.DOWN, or ConnectionStatus.UNKNOWN.
-
getConnectionState
Get the status of a communication port with a given name.- Parameters:
systemName- human-readable name for system like "LocoNet 2" which can be obtained from i.e.SystemConnectionMemo.getUserName().portName- the port name- Returns:
- the status
-
getSystemState
Get the status of a communication port, based on the system name only.- Parameters:
systemName- human-readable name for system like "LocoNet 2" which can be obtained from i.e.SystemConnectionMemo.getUserName().- Returns:
- the status
-
isConnectionOk
Confirm status of a communication port is not down.- Parameters:
systemName- human-readable name for system like "LocoNet 2" which can be obtained from i.e.SystemConnectionMemo.getUserName().portName- the port name- Returns:
- true if port connection is operational or unknown, false if not
-
isSystemOk
Confirm status of a communication port is not down, based on the system name.- Parameters:
systemName- human-readable name for system like "LocoNet 2" which can be obtained from i.e.SystemConnectionMemo.getUserName().- Returns:
- true if port connection is operational or unknown, false if not. This includes returning true if the connection is not recognized.
-
addPropertyChangeListener
-
firePropertyChange
-
removePropertyChangeListener
-