public abstract class TimerTaskSensor extends AbstractSensor
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| Modifier and Type | Class and Description |
|---|---|
protected class |
TimerTaskSensor.SensorRead
The timer task helper class to allow this sensor to be scheduled via a
Timer object.
|
PropertyResources.Load, PropertyResources.URLResource| Modifier and Type | Field and Description |
|---|---|
private static long |
DEFLOGREADLAG
The default re-read time, in ms.
|
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_LOGRAWABOVE
If present, we report raw-readings surpassing this.
|
static String |
KEY_LOGRAWBELOW
If present, we report raw-readings below this.
|
static String |
KEY_LOGREADLAG
we report reading lags surpassing this.
|
static String |
KEY_RESPAWN
The key in the Map list referring to the respawning intervall.
|
private boolean |
rawabove
True after first rise above raw threshold.
|
private boolean |
rawbelow
True after first drop below raw threshold.
|
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).
|
KEY_BIND, KEY_BINDNAME, KEY_CONVERT, KEY_DESCRIPTION, KEY_SENSORNAMEALTERNATEHOST, ALTERNATEPORT, KEY_EXPORTPORT, KEY_REGISTRYHOST, KEY_REGISTRYPORTKEY_NOINITONCREATE, POSTFIX_ALPHABET, POSTFIX_BYTES, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_MODTIME, POSTFIX_URLKEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATORCONFIG, KEY_CLASSKEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME| Modifier | Constructor and Description |
|---|---|
protected |
TimerTaskSensor(Map<String,String> qualify)
Constructs a fully-qualified sensor.
|
| Modifier and Type | Method and Description |
|---|---|
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 new 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.
|
addRmiErrorListener, createSensor, exit, getBindName, getConvert, getSensorDescription, getSensorInitInfo, getSensorName, init, notifyErrorListener, removeRmiErrorListener, setConvert, status, toStringbindToRegistry, bindToRegistry, bindToRegistry, bindToRegistry, bindToRegistry, bindToRegistry, casterExit, casterExit, getBindName, isValid, unbindFromRegistry, unbindFromRegistrycontainsRemoteProperty, getRemoteProperties, getRemoteProperty, setRemotePropertyclone, createFrom, createFrom, createFrom, createInstance, getApplet, getAsResources, getLocate, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, hasLocalURLs, initProperties, keyCreate, keyCreate, reload, setAppletaugment, augment, 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, parseObject, reload, removeProperty, requires, rescanned, setObject, setProperties, setProperty, stringPropertiesfinalize, getClass, notify, notifyAll, wait, wait, waitvalidReadingdefaultBoolean, 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, stringPropertiesbindToRegistry, isValid, unbindFromRegistrypublic static final String KEY_RESPAWN
public static final String KEY_LOGREADLAG
public static final String KEY_LOGRAWABOVE
public static final String KEY_LOGRAWBELOW
private static final long DEFRESPAWN
private static final long DEFLOGREADLAG
private double reading
private boolean isnew
private boolean rawabove
private boolean rawbelow
private Date timeofread
private transient TimerTask sensorThread
protected TimerTaskSensor(Map<String,String> qualify)
qualify - The Map object describing this sensor.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()
public boolean equals(Object that)
public String getRawToggleInfo()