Package jmri
Interface DigitalIO
- All Superinterfaces:
Comparable<NamedBean>,NamedBean,PropertyChangeProvider
- All Known Subinterfaces:
Light,Sensor,Turnout,VariableLight
- All Known Implementing Classes:
AbstractLight,AbstractSensor,AbstractTurnout,AbstractVariableLight,AcelaLight,AcelaSensor,AcelaTurnout,AnymaDMX_UsbLight,BiDiBLight,BiDiBSensor,BiDiBTurnout,CbusLight,CbusSensor,CbusTurnout,Dcc4PcSensor,DCCppLight,DCCppSensor,DCCppTurnout,EasyDccTurnout,EcosSensor,EcosTurnout,EliteXNetTurnout,IpocsLight,IpocsSensor,IpocsTurnout,JMRIClientLight,JMRIClientSensor,JMRIClientTurnout,LnLight,LnSensor,LnTurnout,MarklinSensor,MarklinTurnout,MqttLight,MqttSensor,MqttTurnout,MrcTurnout,Mx1Turnout,NceLight,NceSensor,NceTurnout,OlcbLight,OlcbSensor,OlcbTurnout,RaspberryPiSensor,RaspberryPiTurnout,RfidSensor,RpsSensor,SerialLight,SerialLight,SerialLight,SerialLight,SerialLight,SerialLight,SerialSensor,SerialSensor,SerialSensor,SerialSensor,SerialSensor,SerialSensor,SerialTurnout,SerialTurnout,SerialTurnout,SerialTurnout,SerialTurnout,SerialTurnout,SerialTurnout,SerialX10Light,SpecificDmxLight,SpecificInsteonLight,SpecificInsteonLight,SpecificLight,SpecificLight,SpecificLight,SpecificX10Light,SpecificX10Light,SprogCSTurnout,SprogTurnout,SRCPSensor,SRCPTurnout,TamsSensor,TamsTurnout,TimeoutRfidSensor,XBeeLight,XBeeSensor,XBeeTurnout,XNetLight,XNetSensor,XNetTurnout,XpaTurnout,Z21CanSensor,Z21RMBusSensor,Z21XNetTurnout,ZTC611XNetTurnout
Represent a digital I/O on the layout.
-
Nested Class Summary
Nested classes/interfaces inherited from interface jmri.NamedBean
NamedBean.BadNameException, NamedBean.BadSystemNameException, NamedBean.BadUserNameException, NamedBean.DisplayOptions, NamedBean.DuplicateSystemNameException -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intState value indicating output is off.static final intState value indicating output is on.Fields inherited from interface jmri.NamedBean
DISPLAY_NAME_FORMAT, INCONSISTENT, PROPERTY_COMMENT, PROPERTY_ENABLED, PROPERTY_KNOWN_STATE, PROPERTY_STATE, PROPERTY_USERNAME, QUOTED_NAME_FORMAT, UNKNOWN -
Method Summary
Modifier and TypeMethodDescriptionintQuery the commanded state.intQuery the known state.booleanShow whether state is stable.voidRequest an update from the layout soft/hardware.voidsetCommandedState(int s) Change the commanded state, which results in the relevant command(s) being sent to the hardware.Methods inherited from interface jmri.NamedBean
addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, compareTo, describeState, dispose, getBeanType, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListenersByReference, getPropertyKeys, getRecommendedToolTip, getState, getSystemName, getUsageReport, getUserName, removeProperty, setComment, setProperty, setState, setUserName, toString, updateListenerRef, vetoableChangeMethods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Field Details
-
ON
State value indicating output is on.- See Also:
-
OFF
State value indicating output is off.- See Also:
-
-
Method Details
-
isConsistentState
boolean isConsistentState()Show whether state is stable. For turnouts, a consistent state is one you can safely run trains over. For lights, it's a state which is either on or off, not in between.- Returns:
- true if state is valid and the known state is the same as commanded
-
setCommandedState
Change the commanded state, which results in the relevant command(s) being sent to the hardware. The exception is thrown if there are problems communicating with the layout hardware.- Parameters:
s- the desired state
-
getCommandedState
int getCommandedState()Query the commanded state. This is a bound parameter, so you can also register a listener to be informed of changes.- Returns:
- the commanded state
-
getKnownState
int getKnownState()Query the known state. This is a bound parameter, so you can also register a listener to be informed of changes. A result is always returned; if no other feedback method is available, the commanded state will be used.- Returns:
- the known state
-
requestUpdateFromLayout
Request an update from the layout soft/hardware. May not even happen, and if it does it will happen later; listen for the result.
-