Package jmri.jmrix.srcp
Class SRCPSensor
- java.lang.Object
-
- jmri.implementation.AbstractNamedBean
-
- jmri.implementation.AbstractSensor
-
- jmri.jmrix.srcp.SRCPSensor
-
- All Implemented Interfaces:
java.lang.Comparable<NamedBean>
,java.util.EventListener
,PropertyChangeProvider
,DigitalIO
,AbstractMRListener
,SRCPListener
,NamedBean
,Sensor
public class SRCPSensor extends AbstractSensor implements SRCPListener
SRCPSensor implementation of the Sensor interface.
-
-
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 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 SRCPSensor(int number, SRCPBusConnectionMemo memo)
SRCP sensors use the sensor number on the remote host.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getNumber()
void
message(SRCPMessage m)
void
reply(SimpleNode n)
void
reply(SRCPReply m)
void
requestUpdateFromLayout()
Request an update from the layout soft/hardware.protected void
sendMessage(boolean active)
void
setKnownState(int newState)
Handle a request to change state by sending a formatted packet to the server.-
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, 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, 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
-
-
-
-
Constructor Detail
-
SRCPSensor
public SRCPSensor(int number, SRCPBusConnectionMemo memo)
SRCP sensors use the sensor number on the remote host.- Parameters:
number
- sensor number on remote hostmemo
- associated connection memo
-
-
Method Detail
-
getNumber
public int getNumber()
-
setKnownState
public void setKnownState(int newState) throws JmriException
Handle a request to change state by sending a formatted packet to the server.- Specified by:
setKnownState
in interfaceSensor
- Overrides:
setKnownState
in classAbstractSensor
- Parameters:
newState
- the state to set- Throws:
JmriException
- if unable to set the state
-
requestUpdateFromLayout
public void requestUpdateFromLayout()
Description copied from interface:DigitalIO
Request an update from the layout soft/hardware. May not even happen, and if it does it will happen later; listen for the result.- Specified by:
requestUpdateFromLayout
in interfaceDigitalIO
-
sendMessage
protected void sendMessage(boolean active)
-
reply
public void reply(SRCPReply m)
- Specified by:
reply
in interfaceSRCPListener
-
reply
public void reply(SimpleNode n)
- Specified by:
reply
in interfaceSRCPListener
-
message
public void message(SRCPMessage m)
- Specified by:
message
in interfaceSRCPListener
-
-