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(package private) Map<SystemConnectionMemo,PropertyChangeSupport> -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a connection with a given memo to the portStatus set if not yet present in the set.voidvoid(package private) static voidprotected voidfirePropertyChange(String p, Object old, SystemConnectionMemo memo) Get the status of a communication port with a given name.static ConnectionStatusinstance()booleanConfirm 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.voidvoidvoidsetConnectionState(SystemConnectionMemo memo, 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
-
pcsMap
-
-
Method Details
-
instance
-
clearInstance
-
addConnection
Add a connection with a given memo to the portStatus set if not yet present in the set.- Parameters:
memo- the system memo
-
setConnectionState
Set the connection state of a communication port.- Parameters:
memo- the system memostate- one of ConnectionStatus.UP, ConnectionStatus.DOWN, or ConnectionStatus.UNKNOWN.
-
getConnectionState
Get the status of a communication port with a given name.- Parameters:
memo- the system memo- Returns:
- the status
-
isConnectionOk
Confirm status of a communication port is not down.- Parameters:
memo- the system memo- 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
-
addPropertyChangeListener
public void addPropertyChangeListener(@Nonnull SystemConnectionMemo memo, @Nonnull PropertyChangeListener l) -
firePropertyChange
protected void firePropertyChange(@Nonnull String p, Object old, @Nonnull SystemConnectionMemo memo) -
removePropertyChangeListener
-
removePropertyChangeListener
public void removePropertyChangeListener(@Nonnull SystemConnectionMemo memo, @Nonnull PropertyChangeListener l)
-