|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectutil.PropertyContainer
util.PropertyResources
util.PropertyBundles
util.rmi.RmiPropertyContainer
util.rmi.AbstractRmiCaster
stella.sensor.AbstractSensor
stella.sensor.TimerTaskSensor
public abstract class TimerTaskSensor
The abstract base class used for reading abstract sensors. It is
implemented as a demon thread, which, once started,
keeps reading the sensor values at fixed time intervalls, until the
method cancel() is called. The stop() method of Thread
is deprecated and should not be used.
To work for different kind of sensors, it is assumed that any
sensor has the following properties.
getRespawn())stella.rmi.RmiPropertyBearing are automatically bound.RmiErrorCaster functionality is automatically bound.RmiErrorListener.
This class and therefore all its subclasses support RMI access.
In the basic version a sensor exports its properties to rmi
clients via the stella.rmi.RmiPropertyBearing interface and allows
rmi error listeners to register via the RmiErrorListener
interface. Methods for registering this services to the rmi-registry
are provided but must be called seperately. If the appropriate
property is set the binding is done at construct.
As from version 1.1, sensors are split into threadless and threaded sensors. Only threaded sesnors with a defined, fixed read-time may be used as cumulating, smoothing and/or deriving sensors due to the necessety of identical step-size used for smoothing and the like.
ConvertToPhysical,
SmoothingSensor,
CumulativeSensor| Nested Class Summary | |
|---|---|
protected class |
TimerTaskSensor.SensorRead
The timer task helper class to allow this sensor to be scheduled via a Timer object. |
| Nested classes/interfaces inherited from class util.PropertyResources |
|---|
PropertyResources.URLResource |
| Field Summary | |
|---|---|
private static long |
DEFRESPAWN
The default re-read time, in ms. |
private boolean |
isnew
Is true, if a new measurement is available. |
static String |
KEY_RESPAWN
The key in the Map list referring to the respawning intervall. |
private double |
reading
The actual (read-only) measurement. |
private TimerTask |
sensorThread
The thread this sensor runs in. |
private Date |
timeofread
The (approximate) date of the measurement (read-only). |
| Fields inherited from class stella.sensor.AbstractSensor |
|---|
KEY_BIND, KEY_BINDNAME, KEY_CONVERT, KEY_DESCRIPTION, KEY_SENSORNAME |
| Fields inherited from class util.rmi.AbstractRmiCaster |
|---|
ALTERNATEHOST, ALTERNATEPORT, KEY_EXPORTPORT, KEY_REGISTRYHOST, KEY_REGISTRYPORT |
| Fields inherited from class util.PropertyBundles |
|---|
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES |
| Fields inherited from class util.PropertyResources |
|---|
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset |
| Fields inherited from class util.PropertyContainer |
|---|
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR |
| Fields inherited from interface util.PropertySupplying |
|---|
CONFIG, KEY_CLASS |
| Fields inherited from interface util.ResourceSupplying |
|---|
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME |
| Constructor Summary | |
|---|---|
protected |
TimerTaskSensor(Map qualify)
Constructs a fully-qualified sensor. |
| Method Summary | |
|---|---|
void |
cancel()
Stops the execution of this thread. |
protected void |
conductOneMeasure()
Conducts a single measurement of the sensor value. |
boolean |
equals(Object that)
Tests for equality of two sensors. |
String |
getRawToggleInfo()
Further information on toggle events. |
double |
getReading()
Returns the raw value of the sensor reading. |
long |
getRespawn()
Returns the respawning for this sensor, in ms. |
Date |
getTimeOfRead()
Returns the approximate time of the last sensor reading. |
int |
hashCode()
Returns a hash code for this sensor. |
TimerTask |
initSensorTimerTask()
Initializes this sensors thread. |
boolean |
isReady()
Checks if a new measurement is available. |
protected void |
newData(double raw,
Date time)
This method is called immediately after ne data is available. |
protected abstract double |
readSensor()
This method reads the sensor value. |
double |
regetRaw()
Returns the raw value of the sensor reading. |
protected void |
setTimeOfRead(Date time)
Sets the time of the reading. |
boolean |
validReading(double raw)
Checks if a reading is valid. |
| Methods inherited from class stella.sensor.AbstractSensor |
|---|
addRmiErrorListener, createSensor, exit, getBindName, getConvert, getSensorDescription, getSensorInitInfo, getSensorName, init, notifyErrorListener, removeRmiErrorListener, setConvert, status, toString |
| Methods inherited from class util.rmi.AbstractRmiCaster |
|---|
bindAlternate, bindToRegistry, bindToRegistry, bindToRegistry, casterExit, casterExit, getBindName, isValid, unbindFromRegistry, unbindFromRegistry |
| Methods inherited from class util.rmi.RmiPropertyContainer |
|---|
containsRemoteProperty, getRemoteProperties, getRemoteProperty, setRemoteProperty |
| Methods inherited from class util.PropertyBundles |
|---|
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource |
| Methods inherited from class util.PropertyResources |
|---|
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, keyCreate, keyCreate, reload, setApplet |
| Methods inherited from class util.PropertyContainer |
|---|
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface stella.sensor.Telemetering |
|---|
validReading |
| Methods inherited from interface util.PropertySupplying |
|---|
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties |
| Methods inherited from interface util.rmi.RmiCaster |
|---|
bindToRegistry, isValid, unbindFromRegistry |
| Methods inherited from interface util.ResourceSupplying |
|---|
getResource, getResourceAsStream, getResources |
| Field Detail |
|---|
public static final String KEY_RESPAWN
private static final long DEFRESPAWN
private double reading
private boolean isnew
private Date timeofread
private transient TimerTask sensorThread
| Constructor Detail |
|---|
protected TimerTaskSensor(Map qualify)
qualify - The Map object describing this sensor.| Method Detail |
|---|
public TimerTask initSensorTimerTask()
This method does not start the thread.
initSensorTimerTask in interface TelemeteringinitSensorTimerTask in class AbstractSensorTelemetering.getRespawn()protected void conductOneMeasure()
protected void newData(double raw,
Date time)
protected abstract double readSensor()
ConvertToPhysicalpublic boolean isReady()
public boolean validReading(double raw)
public double getReading()
ConvertToPhysicalpublic double regetRaw()
getReading()public Date getTimeOfRead()
protected void setTimeOfRead(Date time)
public long getRespawn()
getRespawn in interface TelemeteringgetRespawn in class AbstractSensorpublic void cancel()
public int hashCode()
hashCode in class Objectpublic boolean equals(Object that)
equals in class Objectthat - The sensor to compare to.
public String getRawToggleInfo()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||