|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.implementation.AbstractNamedBean
jmri.implementation.AbstractSensor
public abstract class AbstractSensor
Abstract class providing the basic logic of the Sensor interface
Sensor system names are always upper case.
| Field Summary | |
|---|---|
protected boolean |
_inverted
|
protected int |
_knownState
|
protected int |
_rawState
|
protected Runnable |
r
|
(package private) Reporter |
reporter
|
(package private) int |
restartcount
|
protected long |
sensorDebounceGoingActive
|
protected long |
sensorDebounceGoingInActive
|
protected Thread |
thr
|
protected boolean |
useDefaultTimerSettings
|
| Fields inherited from class jmri.implementation.AbstractNamedBean |
|---|
listenerRefs, log, mSystemName, mUserName, parameters, pcs, register |
| Fields inherited from interface jmri.Sensor |
|---|
ACTIVE, INACTIVE |
| Fields inherited from interface jmri.NamedBean |
|---|
INCONSISTENT, UNKNOWN |
| Constructor Summary | |
|---|---|
AbstractSensor(String systemName)
|
|
AbstractSensor(String systemName,
String userName)
|
|
| Method Summary | |
|---|---|
boolean |
getInverted()
Get the inverted state. |
int |
getKnownState()
Known state on layout is a bound parameter |
int |
getRawState()
Used to return the Raw state of a sensor prior to the known state of a sensor being set. |
Reporter |
getReporter()
Retrieve the reporter assocated with this sensor if there is one. |
long |
getSensorDebounceGoingActiveTimer()
Get the Active debounce delay in milliSeconds. |
long |
getSensorDebounceGoingInActiveTimer()
Get the InActive debounce delay in milliSeconds. |
int |
getState()
Implement a shorter name for getKnownState. |
protected void |
sensorDebounce()
|
void |
setInverted(boolean inverted)
Control whether the actual sensor input is considered to be inverted, e.g. the normal electrical signal that results in an ACTIVE state now results in an INACTIVE state. |
void |
setKnownState(int s)
Potentially allow the user to set the known state on the layout. |
void |
setOwnState(int s)
Set our internal state information, and notify bean listeners. |
void |
setReporter(Reporter er)
Some sensor boards also serve the function of being able to report back train identities via such methods as RailCom. |
void |
setSensorDebounceGoingActiveTimer(long time)
Set the Active debounce delay in milliSeconds. |
void |
setSensorDebounceGoingInActiveTimer(long time)
Set the InActive debounce delay in milliSeconds. |
void |
setState(int s)
Implement a shorter name for setKnownState. |
boolean |
useDefaultTimerSettings()
Does this sensor use the default timers for |
void |
useDefaultTimerSettings(boolean boo)
Use the timers specified in the Sensor manager, for the debounce delay |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface jmri.Sensor |
|---|
addPropertyChangeListener, dispose, removePropertyChangeListener, requestUpdateFromLayout |
| Methods inherited from interface jmri.NamedBean |
|---|
addPropertyChangeListener, getComment, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getPropertyKeys, getSystemName, getUserName, removeProperty, setComment, setProperty, setUserName, updateListenerRef |
| Field Detail |
|---|
protected long sensorDebounceGoingActive
protected long sensorDebounceGoingInActive
protected boolean useDefaultTimerSettings
protected Thread thr
protected Runnable r
int restartcount
protected boolean _inverted
protected int _knownState
protected int _rawState
Reporter reporter
| Constructor Detail |
|---|
public AbstractSensor(String systemName)
public AbstractSensor(String systemName,
String userName)
| Method Detail |
|---|
public int getKnownState()
Sensor
getKnownState in interface Sensorpublic void setSensorDebounceGoingActiveTimer(long time)
Sensor
setSensorDebounceGoingActiveTimer in interface Sensorpublic long getSensorDebounceGoingActiveTimer()
Sensor
getSensorDebounceGoingActiveTimer in interface Sensorpublic void setSensorDebounceGoingInActiveTimer(long time)
Sensor
setSensorDebounceGoingInActiveTimer in interface Sensorpublic long getSensorDebounceGoingInActiveTimer()
Sensor
getSensorDebounceGoingInActiveTimer in interface Sensorpublic void useDefaultTimerSettings(boolean boo)
Sensor
useDefaultTimerSettings in interface Sensorpublic boolean useDefaultTimerSettings()
Sensor
useDefaultTimerSettings in interface Sensorprotected void sensorDebounce()
public void setKnownState(int s)
throws JmriException
Sensor
setKnownState in interface SensorJmriExceptionpublic void setOwnState(int s)
public int getRawState()
Sensor
getRawState in interface Sensor
public void setState(int s)
throws JmriException
This generally shouldn't be used by Java code; use setKnownState instead. The is provided to make Jython script access easier to read.
setState in interface NamedBeanJmriException - general error when cant do the needed operationpublic int getState()
This generally shouldn't be used by Java code; use getKnownState instead. The is provided to make Jython script access easier to read.
getState in interface NamedBeanpublic void setInverted(boolean inverted)
setInverted in interface Sensorpublic final boolean getInverted()
Used in polling loops in system-specific code, so made final to allow optimization.
getInverted in interface Sensorpublic void setReporter(Reporter er)
returns null if there is no direct reporter.
setReporter in interface Sensorpublic Reporter getReporter()
Sensorreturns null if there is no direct reporter.
getReporter in interface Sensor
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||