Package jmri.jmrix.lenz
Class XNetSensor
- java.lang.Object
-
- jmri.implementation.AbstractNamedBean
-
- jmri.implementation.AbstractSensor
-
- jmri.jmrix.lenz.XNetSensor
-
- All Implemented Interfaces:
java.lang.Comparable<NamedBean>
,java.util.EventListener
,PropertyChangeProvider
,DigitalIO
,AbstractMRListener
,XNetListener
,NamedBean
,Sensor
public class XNetSensor extends AbstractSensor implements XNetListener
Extend jmri.AbstractSensor for XpressNet layouts.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jmri.NamedBean
NamedBean.BadNameException, NamedBean.BadSystemNameException, NamedBean.BadUserNameException, NamedBean.DisplayOptions, NamedBean.DuplicateSystemNameException
-
Nested classes/interfaces inherited from interface jmri.Sensor
Sensor.PullResistance
-
-
Field Summary
Fields Modifier and Type Field Description protected XNetTrafficController
tc
-
Fields inherited from class jmri.implementation.AbstractSensor
_inverted, _knownState, _rawState, r, sensorDebounceGoingActive, sensorDebounceGoingInActive, thr, useDefaultTimerSettings
-
Fields inherited from class jmri.implementation.AbstractNamedBean
listenerRefs, mSystemName, register
-
Fields inherited from interface jmri.NamedBean
DISPLAY_NAME_FORMAT, INCONSISTENT, PROPERTY_STATE, QUOTED_NAME_FORMAT, UNKNOWN
-
Fields inherited from interface jmri.Sensor
ACTIVE, INACTIVE, MAX_DEBOUNCE
-
-
Constructor Summary
Constructors Constructor Description XNetSensor(java.lang.String systemName, java.lang.String userName, XNetTrafficController controller, java.lang.String prefix)
XNetSensor(java.lang.String systemName, XNetTrafficController controller, java.lang.String prefix)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) int
getBaseAddress()
Package protected routine to get the Sensor Base Address.(package private) int
getNibble()
Package protected routine to get the Sensor Nibble.(package private) int
getNumber()
Package protected routine to get the Sensor Number.(package private) void
initmessage(XNetReply l)
initmessage is a package protected class which allows the Manger to send a feedback message at initialization without changing the state of the sensor with respect to whether or not a feedback request was sent.void
message(XNetMessage l)
Listen for the messages to the LI100/LI101.void
message(XNetReply l)
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)void
notifyTimeout(XNetMessage msg)
Handle a timeout notification.void
requestUpdateFromLayout()
Request an update on status by sending an XpressNet message.-
Methods inherited from class jmri.implementation.AbstractSensor
canInvert, describeState, dispose, getBeanType, getInverted, getKnownState, getPullResistance, getRawState, getReporter, getSensorDebounceGoingActiveTimer, getSensorDebounceGoingInActiveTimer, getState, getUseDefaultTimerSettings, sensorDebounce, setInverted, setKnownState, setOwnState, setPullResistance, setReporter, setSensorDebounceGoingActiveTimer, setSensorDebounceGoingInActiveTimer, setState, setUseDefaultTimerSettings, stateChangeCheck
-
Methods 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, vetoableChange
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods 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, vetoableChange
-
Methods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Methods inherited from interface jmri.Sensor
getCommandedState, isConsistentState, setCommandedState
-
-
-
-
Field Detail
-
tc
protected XNetTrafficController tc
-
-
Constructor Detail
-
XNetSensor
public XNetSensor(java.lang.String systemName, java.lang.String userName, XNetTrafficController controller, java.lang.String prefix)
-
XNetSensor
public XNetSensor(java.lang.String systemName, XNetTrafficController controller, java.lang.String prefix)
-
-
Method Detail
-
requestUpdateFromLayout
public void requestUpdateFromLayout()
Request an update on status by sending an XpressNet message.- Specified by:
requestUpdateFromLayout
in interfaceDigitalIO
-
initmessage
void initmessage(XNetReply l)
initmessage is a package protected class which allows the Manger to send a feedback message at initialization without changing the state of the sensor with respect to whether or not a feedback request was sent. This is used only when the sensor is created by on layout feedback.- Parameters:
l
- Reply message
-
message
public void message(XNetReply l)
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)- Specified by:
message
in interfaceXNetListener
- Parameters:
l
- Reply message
-
message
public void message(XNetMessage l)
Listen for the messages to the LI100/LI101.- Specified by:
message
in interfaceXNetListener
- Parameters:
l
- message to process
-
notifyTimeout
public void notifyTimeout(XNetMessage msg)
Handle a timeout notification.- Specified by:
notifyTimeout
in interfaceXNetListener
- Parameters:
msg
- The message that timed out
-
getNumber
int getNumber()
Package protected routine to get the Sensor Number.- Returns:
- current Sensor address number
-
getBaseAddress
int getBaseAddress()
Package protected routine to get the Sensor Base Address.- Returns:
- the Sensor base address
-
getNibble
int getNibble()
Package protected routine to get the Sensor Nibble.- Returns:
- contents of sensor nibble
-
-