Package jmri.jmrix.loconet
Class LnSensor
java.lang.Object
jmri.implementation.AbstractNamedBean
jmri.implementation.AbstractSensor
jmri.jmrix.loconet.LnSensor
- All Implemented Interfaces:
Comparable<NamedBean>,PropertyChangeProvider,DigitalIO,NamedBean,Sensor
Extend jmri.AbstractSensor for LocoNet layouts.
Some of the message formats used in this class are Copyright Digitrax, Inc. and used with permission as part of the JMRI project. That permission does not extend to uses in other software products. If you wish to use this code, algorithm or these message formats outside of JMRI, please contact Digitrax Inc for separate permission.
-
Nested Class Summary
Nested classes/interfaces inherited from interface jmri.NamedBean
NamedBean.BadNameException, NamedBean.BadSystemNameException, NamedBean.BadUserNameException, NamedBean.DisplayOptions, NamedBean.DuplicateSystemNameExceptionNested classes/interfaces inherited from interface jmri.Sensor
Sensor.PullResistance -
Field Summary
FieldsFields inherited from class jmri.implementation.AbstractSensor
_inverted, _knownState, _rawState, r, sensorDebounceGoingActive, sensorDebounceGoingInActive, thr, useDefaultTimerSettingsFields inherited from class jmri.implementation.AbstractNamedBean
listenerRefs, mSystemName, registerFields inherited from interface jmri.NamedBean
DISPLAY_NAME_FORMAT, INCONSISTENT, PROPERTY_COMMENT, PROPERTY_ENABLED, PROPERTY_KNOWN_STATE, PROPERTY_STATE, PROPERTY_USERNAME, QUOTED_NAME_FORMAT, UNKNOWNFields inherited from interface jmri.Sensor
ACTIVE, INACTIVE, MAX_DEBOUNCE, PROPERTY_ACTIVE_TIMER, PROPERTY_GLOBAL_TIMER, PROPERTY_INACTIVE_TIMER, PROPERTY_SENSOR_INVERTED -
Constructor Summary
ConstructorsConstructorDescriptionLnSensor(String systemName, String userName, LnTrafficController tc, String prefix) LnSensor(String systemName, LnTrafficController tc, String prefix) -
Method Summary
Modifier and TypeMethodDescriptionvoidimplementing classes will typically have a function/listener to get updates from the layout, which will then call public void firePropertyChange(String propertyName, Object oldValue, Object newValue) _once_ if anything has changed state (or set the commanded state directly)voidRequest an update on status by sending a LocoNet message.voidsetKnownState(int s) User request to set the state, which means that we need to broadcast the new state over the loconet so that other attached devices.Methods inherited from class jmri.implementation.AbstractSensor
canInvert, describeState, dispose, getBeanType, getInverted, getKnownState, getPullResistance, getRawState, getReporter, getSensorDebounceGoingActiveTimer, getSensorDebounceGoingInActiveTimer, getState, getUseDefaultTimerSettings, sensorDebounce, setInverted, setOwnState, setPullResistance, setReporter, setSensorDebounceGoingActiveTimer, setSensorDebounceGoingInActiveTimer, setState, setUseDefaultTimerSettings, stateChangeCheckMethods inherited from class jmri.implementation.AbstractNamedBean
addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, equals, firePropertyChange, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeListenersByReference, getPropertyKeys, getSystemName, getUserName, hashCode, removeProperty, removePropertyChangeListener, removePropertyChangeListener, setComment, setProperty, setUserName, toString, toStringSuffix, updateListenerRef, vetoableChangeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface jmri.NamedBean
addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, compareTo, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListenersByReference, getPropertyKeys, getRecommendedToolTip, getSystemName, getUsageReport, getUserName, removeProperty, setComment, setProperty, setUserName, toString, updateListenerRef, vetoableChangeMethods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListenerMethods inherited from interface jmri.Sensor
getCommandedState, isConsistentState, setCommandedState
-
Field Details
-
tc
-
-
Constructor Details
-
LnSensor
-
LnSensor
-
-
Method Details
-
requestUpdateFromLayout
Request an update on status by sending a LocoNet message. The only known way to do this from LocoNet is to request the status of _all_ devices, which is here considered too heavyweight. See LnSensorManager.updateAll() -
setKnownState
User request to set the state, which means that we need to broadcast the new state over the loconet so that other attached devices. The incoming message will in turn, be processed by the SensorManager.- Specified by:
setKnownStatein interfaceSensor- Overrides:
setKnownStatein classAbstractSensor- Parameters:
s- the state to set- Throws:
JmriException- if unable to set the state
-
messageFromManager
implementing classes will typically have a function/listener to get updates from the layout, which will then call public void firePropertyChange(String propertyName, Object oldValue, Object newValue) _once_ if anything has changed state (or set the commanded state directly)- Parameters:
l- LocoNet message from manager.
-