public interface ISensor
Modifier and Type | Method and Description |
---|---|
boolean |
checkForEventOverflow()
• Checks for an overflow of the event handling and resets the overflow flag.
|
void |
clearListener()
• Clears a registered sensor listener.
|
float |
getChangeRate()
• Returns the change rate for the measurand.
|
float |
getFilterToleranceRate()
• Returns the currently stored tolerance limit
for the sensor event filtering by change rate.
|
float |
getFilterToleranceValue()
• Returns the currently stored tolerance limit
for the sensor event filtering by measurand.
|
int |
getIntegrationTime()
• Returns the integration time constant which determines the inertia of the sensor.
|
float |
getMeasuredValue()
• Returns a single measurand of the sensor.
|
void |
setFilterTolerances(float tolerance_value,
float tolerance_rate)
• Sets the tolerance limits for indicating changes
of the measurand and its change rate.
|
void |
setIntegrationTime(int time)
• Sets the integration time of the sensor.
|
void |
setListener(ISensorListener listener)
• Registers a sensor listener.
|
void |
waitUntilBelowLimit(float limit)
• Waits until the measurand has fallen below the given value.
|
boolean |
waitUntilBelowLimit(float limit,
int timeout)
• Waits until the measurand has fallen below the given value or the timeout period has passed.
|
void |
waitUntilBeyondLimit(float limit)
• Waits until the measurand exceeds the given value.
|
boolean |
waitUntilBeyondLimit(float limit,
int timeout)
• Waits until the measurand exceeds the given value or the timeout period has passed.
|
boolean checkForEventOverflow()
ISensorListener
void clearListener()
setListener(ISensorListener)
.setListener(ISensorListener)
float getChangeRate()
float getFilterToleranceRate()
ISensorListener.manageEvent(ISensor,float,float,float,float)
.
The default value for this tolerance is 0, which means that no filtering by change rate
will be done for sensor events. In addition to filtering by change rate, filtering by
measurand has to be taken into account.getFilterToleranceValue()
,
setFilterTolerances(float,float)
,
ISensorListener
float getFilterToleranceValue()
ISensorListener.manageEvent(ISensor,float,float,float,float)
.
Since the tolerance limit must not exceed the possible range of measured values, it is fixed
to a value of 1 for touch sensors. For other sensors, the tolerance limit is set to 1
by default, since this is in general the resolution of a sensor's raw data.
A tolerance value of 0 will turn off the filtering by measurand. Sensor data will be passed
to a listener at the sensor's measuring rate in this case unless the filtering by change rate
has been turned on.getFilterToleranceRate()
,
setFilterTolerances(float,float)
,
ISensorListener
int getIntegrationTime()
getMeasuredValue()
represents a mean value
that will be calculated over the integration time (in ms) from the sensor's raw data.
If the integration time is large, the response of the sensor will be slow.
The integration time will also influence the calculated change rate (see getChangeRate()
).
The default value for the integration time is 0 (ms), that is, integration is turned off
corresponding to the fastest possible response of the sensor.float getMeasuredValue()
void setFilterTolerances(float tolerance_value, float tolerance_rate)
tolerance_value
- the new tolerance limit for changes of the measurandtolerance_rate
- the new tolerance limit for changes of the change rategetFilterToleranceValue()
,
getFilterToleranceRate()
void setIntegrationTime(int time)
time
- the new integration time of the sensor (in ms)getIntegrationTime()
void setListener(ISensorListener listener)
listener
- the sensor listener that will receive event notifications on changes of the measurandclearListener()
void waitUntilBelowLimit(float limit)
limit
- the limit that the measurand has to fall below for the method to return to the callerboolean waitUntilBelowLimit(float limit, int timeout)
limit
- the limit that the measurand should fall below for the method to return to the callertimeout
- the maximum time period to wait for the measurand to fall below the given limitvoid waitUntilBeyondLimit(float limit)
limit
- the limit that needs to be exceeded by the measurand for the method to return to the callerboolean waitUntilBeyondLimit(float limit, int timeout)
limit
- the limit that should be exceeded by the measurand for the method to return to the callertimeout
- the maximum time period to wait for the measurand to exceed the given limit