public abstract class DataValue extends AbstractValue implements DataListener
Parameter representation of a sensor reading.
This is a tiny
wrapper to funnel DataEvents produced by
DataSensors into
Parameter variables. The sensor global follows the generic
AbstractParameter contract and provides a
constructor with a
Map object as the single argument.
To properly work, this class must provide at least three keys in its
properties, namely
#KEY_SENSOR: The unique sensor name to wrap.KEY_DATA: The type of the sensor data to wrap. Vaild
mappings are RAW, SMOOTH, DERIVATIVE,
VALUE, SMOOTHVALUE, and DERIVATIVEVALUE, their
meaning following from the name. It is the users responsibility to provide
data channels that are served by the particular sensor.
If this key is not present or not
matched to one of the default data source type, it is (re)mapped to
RAW.KEY_BLOCK: Defines whether a first call to AbstractValue.get()
should block until data is available or simply return nullPropertyResources.Load, PropertyResources.URLResource| Modifier and Type | Field and Description |
|---|---|
private Object |
blocking
Gets true if data is available or if sensor value is non-blocking.
|
private static boolean |
DEFBLOCK
The default blocking behavior.
|
private static String |
DEFDATA
The default data type.
|
static String |
DERIVATIVE
A constant defining raw sensor data as the data source.
|
static String |
DERIVATIVEVALUE
A constant defining raw sensor data as the data source.
|
static String |
KEY_BLOCK
If this key maps to true the get-method blocks till data is available.
|
static String |
KEY_DATA
The key to the data source funneled from the sensor.
|
static String |
PREDICT
A constant defining raw sensor data as the data source.
|
static String |
PREDICTVALUE
A constant defining raw sensor data as the data source.
|
static String |
RAW
A constant defining raw sensor data as the data source.
|
private Double |
sensorvalue
The last measurement.
|
static String |
SMOOTH
A constant defining raw sensor data as the data source.
|
static String |
SMOOTHVALUE
A constant defining raw sensor data as the data source.
|
static String |
VALUE
A constant defining raw sensor data as the data source.
|
KEY_FORMAT, KEY_NAME, KEY_PRESERVE, UNKNOWNKEY_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 |
DataValue(Map info)
Constructs a new sensor global.
|
| Modifier and Type | Method and Description |
|---|---|
void |
dataAvailable(DataEvent de)
This method is called by subclasses of the data value to funnel a data
event, received either locally or via rmi, to this parameter's value.
|
String |
getString()
Formats the last sensor reading.
|
Number |
getValue()
The remote get method of the sensor global.
|
Number |
setValue(Number num)
Sensor wrapping parameters should not be set externally.
|
get, setcreateParameter, delivers, exit, getFormatted, getFormatted, getName, getPreserveFile, getString, init, overrideDefaultName, register, rescanned, setName, toStringclone, 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, setObject, setProperties, setProperty, stringPropertiesequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetFormatted, getNamedefaultBoolean, 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, stringPropertiesinitpublic static final String KEY_BLOCK
public static final String KEY_DATA
RAW, PREDICT, SMOOTH,
DERIVATIVE, VALUE, PREDICTVALUE,
SMOOTHVALUE, and DERIVATIVEVALUE.public static final String RAW
public static final String PREDICT
public static final String SMOOTH
public static final String DERIVATIVE
public static final String VALUE
public static final String PREDICTVALUE
public static final String SMOOTHVALUE
public static final String DERIVATIVEVALUE
private static final boolean DEFBLOCK
private static final String DEFDATA
private Double sensorvalue
private Object blocking
protected DataValue(Map info)
RAW. This guarantees
that this key is present and points to a allowed value once the
construction phase is finished.public Number setValue(Number num)
public Number getValue()
AbstractValue.get() method, but transports it remotely.public String getString()
getString in interface ParametergetString in class AbstractParameterpublic void dataAvailable(DataEvent de)
DataEvent into a single double
representing the data type specified in its properties.dataAvailable in interface DataListener