public class YProximity extends YSensor
Modifier and Type | Class and Description |
---|---|
static interface |
YProximity.TimedReportCallback
TimedReportCallback for Proximity
|
static interface |
YProximity.UpdateCallback
Deprecated UpdateCallback for Proximity
|
Modifier and Type | Field and Description |
---|---|
protected int |
_detectionThreshold |
protected int |
_isPresent |
protected long |
_lastTimeApproached |
protected long |
_lastTimeRemoved |
protected int |
_proximityReportMode |
protected long |
_pulseCounter |
protected long |
_pulseTimer |
protected double |
_signalValue |
protected YProximity.TimedReportCallback |
_timedReportCallbackProximity |
protected YProximity.UpdateCallback |
_valueCallbackProximity |
static int |
DETECTIONTHRESHOLD_INVALID
invalid detectionThreshold value
|
static int |
ISPRESENT_FALSE
invalid isPresent value
|
static int |
ISPRESENT_INVALID |
static int |
ISPRESENT_TRUE |
static long |
LASTTIMEAPPROACHED_INVALID
invalid lastTimeApproached value
|
static long |
LASTTIMEREMOVED_INVALID
invalid lastTimeRemoved value
|
static int |
PROXIMITYREPORTMODE_INVALID |
static int |
PROXIMITYREPORTMODE_NUMERIC
invalid proximityReportMode value
|
static int |
PROXIMITYREPORTMODE_PRESENCE |
static int |
PROXIMITYREPORTMODE_PULSECOUNT |
static long |
PULSECOUNTER_INVALID
invalid pulseCounter value
|
static long |
PULSETIMER_INVALID
invalid pulseTimer value
|
static double |
SIGNALVALUE_INVALID
invalid signalValue value
|
_calhdl, _calibrationParam, _calpar, _calraw, _calref, _caltyp, _currentRawValue, _currentValue, _decexp, _highestValue, _iresol, _isScal, _isScal32, _logFrequency, _lowestValue, _offset, _prevTimedReport, _reportFrequency, _resolution, _scale, _sensorState, _timedReportCallbackSensor, _unit, _valueCallbackSensor, CALIBRATIONPARAM_INVALID, CURRENTRAWVALUE_INVALID, CURRENTVALUE_INVALID, HIGHESTVALUE_INVALID, LOGFREQUENCY_INVALID, LOWESTVALUE_INVALID, REPORTFREQUENCY_INVALID, RESOLUTION_INVALID, SENSORSTATE_INVALID, UNIT_INVALID
_advertisedValue, _cacheExpiration, _className, _dataStreams, _func, _funId, _hwId, _lastErrorMsg, _lastErrorType, _logicalName, _serial, _userData, _valueCallbackFunction, _yapi, ADVERTISEDVALUE_INVALID, FUNCTIONDESCRIPTOR_INVALID, LOGICALNAME_INVALID
Modifier | Constructor and Description |
---|---|
protected |
YProximity(String func) |
protected |
YProximity(YAPIContext ctx,
String func) |
Modifier and Type | Method and Description |
---|---|
int |
_invokeTimedReportCallback(YMeasure value) |
int |
_invokeValueCallback(String value) |
protected void |
_parseAttr(org.json.JSONObject json_val) |
static YProximity |
FindProximity(String func)
Retrieves a proximity sensor for a given identifier.
|
static YProximity |
FindProximityInContext(YAPIContext yctx,
String func)
Retrieves a proximity sensor for a given identifier in a YAPI context.
|
static YProximity |
FirstProximity()
Starts the enumeration of proximity sensors currently accessible.
|
static YProximity |
FirstProximityInContext(YAPIContext yctx)
Starts the enumeration of proximity sensors currently accessible.
|
int |
get_detectionThreshold()
Returns the threshold used to determine the logical state of the proximity sensor, when considered
as a binary input (on/off).
|
int |
get_isPresent()
Returns true if the input (considered as binary) is active (detection value is smaller than the
specified threshold), and false otherwise.
|
long |
get_lastTimeApproached()
Returns the number of elapsed milliseconds between the module power on and the last observed
detection (the input contact transitioned from absent to present).
|
long |
get_lastTimeRemoved()
Returns the number of elapsed milliseconds between the module power on and the last observed
detection (the input contact transitioned from present to absent).
|
int |
get_proximityReportMode()
Returns the parameter (sensor value, presence or pulse count) returned by the get_currentValue
function and callbacks.
|
long |
get_pulseCounter()
Returns the pulse counter value.
|
long |
get_pulseTimer()
Returns the timer of the pulse counter (ms).
|
double |
get_signalValue()
Returns the current value of signal measured by the proximity sensor.
|
int |
getDetectionThreshold()
Returns the threshold used to determine the logical state of the proximity sensor, when considered
as a binary input (on/off).
|
int |
getIsPresent()
Returns true if the input (considered as binary) is active (detection value is smaller than the
specified threshold), and false otherwise.
|
long |
getLastTimeApproached()
Returns the number of elapsed milliseconds between the module power on and the last observed
detection (the input contact transitioned from absent to present).
|
long |
getLastTimeRemoved()
Returns the number of elapsed milliseconds between the module power on and the last observed
detection (the input contact transitioned from present to absent).
|
int |
getProximityReportMode()
Returns the parameter (sensor value, presence or pulse count) returned by the get_currentValue
function and callbacks.
|
long |
getPulseCounter()
Returns the pulse counter value.
|
long |
getPulseTimer()
Returns the timer of the pulse counter (ms).
|
double |
getSignalValue()
Returns the current value of signal measured by the proximity sensor.
|
YProximity |
nextProximity()
Continues the enumeration of proximity sensors started using yFirstProximity().
|
int |
registerTimedReportCallback(YProximity.TimedReportCallback callback)
Registers the callback function that is invoked on every periodic timed notification.
|
int |
registerValueCallback(YProximity.UpdateCallback callback)
Registers the callback function that is invoked on every change of advertised value.
|
int |
resetCounter()
Resets the pulse counter value as well as its timer.
|
int |
set_detectionThreshold(int newval)
Changes the threshold used to determine the logical state of the proximity sensor, when considered
as a binary input (on/off).
|
int |
set_proximityReportMode(int newval)
Modifies the parameter type (sensor value, presence or pulse count) returned by the
get_currentValue function and callbacks.
|
int |
set_pulseCounter(long newval) |
int |
setDetectionThreshold(int newval)
Changes the threshold used to determine the logical state of the proximity sensor, when considered
as a binary input (on/off).
|
int |
setProximityReportMode(int newval)
Modifies the parameter type (sensor value, presence or pulse count) returned by the
get_currentValue function and callbacks.
|
int |
setPulseCounter(long newval) |
_applyCalibration, _decodeAvg, _decodeTimedReport, _decodeVal, _encodeCalibrationPoints, _parserHelper, calibrateFromPoints, FindSensor, FindSensorInContext, FirstSensor, FirstSensorInContext, get_calibrationParam, get_currentRawValue, get_currentValue, get_highestValue, get_logFrequency, get_lowestValue, get_recordedData, get_reportFrequency, get_resolution, get_sensorState, get_unit, getCalibrationParam, getCurrentRawValue, getCurrentValue, getHighestValue, getLogFrequency, getLowestValue, getReportFrequency, getResolution, getSensorState, getUnit, isSensorReady, loadCalibrationPoints, nextSensor, registerTimedReportCallback, registerValueCallback, set_calibrationParam, set_highestValue, set_logFrequency, set_lowestValue, set_reportFrequency, set_resolution, setCalibrationParam, setHighestValue, setLogFrequency, setLowestValue, setReportFrequency, setResolution, startDataLogger, stopDataLogger
_AddToCache, _clearDataStreamCache, _devRequest, _download, _escapeAttr, _FindFromCache, _FindFromCacheInContext, _get_json_path_struct, _get_json_path, _json_get_array, _json_get_key, _json_get_string, _parse, _setAttr, _throw, _UpdateTimedReportCallbackList, _UpdateValueCallbackList, _upload, _upload, clearCache, describe, errMessage, errorMessage, errorType, errType, FindFunction, FindFunctionInContext, FirstFunction, FirstFunctionInContext, functionDescriptor, get_advertisedValue, get_errorMessage, get_errorType, get_friendlyName, get_functionDescriptor, get_functionId, get_hardwareId, get_logicalName, get_module, get_userData, getAdvertisedValue, getErrorMessage, getErrorType, getFriendlyName, getFunctionDescriptor, getFunctionId, getHardwareId, getLogicalName, getModule, getUserData, isOnline, load, loadAttribute, module, muteValueCallbacks, nextFunction, registerValueCallback, set_advertisedValue, set_logicalName, set_userData, setAdvertisedValue, setLogicalName, setUserData, toString, unmuteValueCallbacks, userData
public static final double SIGNALVALUE_INVALID
public static final int DETECTIONTHRESHOLD_INVALID
public static final int ISPRESENT_FALSE
public static final int ISPRESENT_TRUE
public static final int ISPRESENT_INVALID
public static final long LASTTIMEAPPROACHED_INVALID
public static final long LASTTIMEREMOVED_INVALID
public static final long PULSECOUNTER_INVALID
public static final long PULSETIMER_INVALID
public static final int PROXIMITYREPORTMODE_NUMERIC
public static final int PROXIMITYREPORTMODE_PRESENCE
public static final int PROXIMITYREPORTMODE_PULSECOUNT
public static final int PROXIMITYREPORTMODE_INVALID
protected double _signalValue
protected int _detectionThreshold
protected int _isPresent
protected long _lastTimeApproached
protected long _lastTimeRemoved
protected long _pulseCounter
protected long _pulseTimer
protected int _proximityReportMode
protected YProximity.UpdateCallback _valueCallbackProximity
protected YProximity.TimedReportCallback _timedReportCallbackProximity
protected YProximity(YAPIContext ctx, String func)
func
- : functionidprotected YProximity(String func)
func
- : functionidprotected void _parseAttr(org.json.JSONObject json_val) throws org.json.JSONException
_parseAttr
in class YSensor
org.json.JSONException
public double get_signalValue() throws YAPI_Exception
YAPI_Exception
- on errorpublic double getSignalValue() throws YAPI_Exception
YAPI_Exception
- on errorpublic int get_detectionThreshold() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getDetectionThreshold() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_detectionThreshold(int newval) throws YAPI_Exception
newval
- : an integer corresponding to the threshold used to determine the logical state of
the proximity sensor, when considered
as a binary input (on/off)YAPI_Exception
- on errorpublic int setDetectionThreshold(int newval) throws YAPI_Exception
newval
- : an integer corresponding to the threshold used to determine the logical state of
the proximity sensor, when considered
as a binary input (on/off)YAPI_Exception
- on errorpublic int get_isPresent() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getIsPresent() throws YAPI_Exception
YAPI_Exception
- on errorpublic long get_lastTimeApproached() throws YAPI_Exception
YAPI_Exception
- on errorpublic long getLastTimeApproached() throws YAPI_Exception
YAPI_Exception
- on errorpublic long get_lastTimeRemoved() throws YAPI_Exception
YAPI_Exception
- on errorpublic long getLastTimeRemoved() throws YAPI_Exception
YAPI_Exception
- on errorpublic long get_pulseCounter() throws YAPI_Exception
YAPI_Exception
- on errorpublic long getPulseCounter() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_pulseCounter(long newval) throws YAPI_Exception
YAPI_Exception
public int setPulseCounter(long newval) throws YAPI_Exception
YAPI_Exception
public long get_pulseTimer() throws YAPI_Exception
YAPI_Exception
- on errorpublic long getPulseTimer() throws YAPI_Exception
YAPI_Exception
- on errorpublic int get_proximityReportMode() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getProximityReportMode() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_proximityReportMode(int newval) throws YAPI_Exception
newval
- : a value among YProximity.PROXIMITYREPORTMODE_NUMERIC,
YProximity.PROXIMITYREPORTMODE_PRESENCE and YProximity.PROXIMITYREPORTMODE_PULSECOUNTYAPI_Exception
- on errorpublic int setProximityReportMode(int newval) throws YAPI_Exception
newval
- : a value among Y_PROXIMITYREPORTMODE_NUMERIC, Y_PROXIMITYREPORTMODE_PRESENCE and
Y_PROXIMITYREPORTMODE_PULSECOUNTYAPI_Exception
- on errorpublic static YProximity FindProximity(String func)
func
- : a string that uniquely characterizes the proximity sensorpublic static YProximity FindProximityInContext(YAPIContext yctx, String func)
yctx
- : a YAPI contextfunc
- : a string that uniquely characterizes the proximity sensorpublic int registerValueCallback(YProximity.UpdateCallback callback)
callback
- : the callback function to call, or a null pointer. The callback function should take two
arguments: the function object of which the value has changed, and the character string describing
the new advertised value.public int _invokeValueCallback(String value)
_invokeValueCallback
in class YSensor
public int registerTimedReportCallback(YProximity.TimedReportCallback callback)
callback
- : the callback function to call, or a null pointer. The callback function should take two
arguments: the function object of which the value has changed, and an YMeasure object describing
the new advertised value.public int _invokeTimedReportCallback(YMeasure value)
_invokeTimedReportCallback
in class YSensor
public int resetCounter() throws YAPI_Exception
YAPI_Exception
- on errorpublic YProximity nextProximity()
public static YProximity FirstProximity()
public static YProximity FirstProximityInContext(YAPIContext yctx)
yctx
- : a YAPI context.Copyright © 2017. All rights reserved.