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 |
_detectionHysteresis |
protected int |
_detectionThreshold |
protected int |
_isPresent |
protected long |
_lastTimeApproached |
protected long |
_lastTimeRemoved |
protected int |
_presenceMinTime |
protected int |
_proximityReportMode |
protected long |
_pulseCounter |
protected long |
_pulseTimer |
protected int |
_removalMinTime |
protected double |
_signalValue |
protected YProximity.TimedReportCallback |
_timedReportCallbackProximity |
protected YProximity.UpdateCallback |
_valueCallbackProximity |
static int |
DETECTIONHYSTERESIS_INVALID
invalid detectionHysteresis value
|
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 |
PRESENCEMINTIME_INVALID
invalid presenceMinTime 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 int |
REMOVALMINTIME_INVALID
invalid removalMinTime value
|
static double |
SIGNALVALUE_INVALID
invalid signalValue value
|
_advMode, _calhdl, _calibrationParam, _calpar, _calraw, _calref, _caltyp, _currentRawValue, _currentValue, _decexp, _highestValue, _iresol, _logFrequency, _lowestValue, _offset, _prevTimedReport, _reportFrequency, _resolution, _scale, _sensorState, _timedReportCallbackSensor, _unit, _valueCallbackSensor, ADVMODE_IMMEDIATE, ADVMODE_INVALID, ADVMODE_PERIOD_AVG, ADVMODE_PERIOD_MAX, ADVMODE_PERIOD_MIN, 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(com.yoctopuce.YoctoAPI.YJSONObject 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_detectionHysteresis()
Returns the hysteresis used to determine the logical state of the proximity sensor, when considered
as a binary input (on/off).
|
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_presenceMinTime()
Returns the minimal detection duration before signalling a presence event.
|
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).
|
int |
get_removalMinTime()
Returns the minimal detection duration before signalling a removal event.
|
double |
get_signalValue()
Returns the current value of signal measured by the proximity sensor.
|
int |
getDetectionHysteresis()
Returns the hysteresis used to determine the logical state of the proximity sensor, when considered
as a binary input (on/off).
|
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 |
getPresenceMinTime()
Returns the minimal detection duration before signalling a presence event.
|
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).
|
int |
getRemovalMinTime()
Returns the minimal detection duration before signalling a removal event.
|
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_detectionHysteresis(int newval)
Changes the hysteresis used to determine the logical state of the proximity sensor, when considered
as a binary input (on/off).
|
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_presenceMinTime(int newval)
Changes the minimal detection duration before signalling a presence event.
|
int |
set_proximityReportMode(int newval)
Changes the parameter type (sensor value, presence or pulse count) returned by the
get_currentValue function and callbacks.
|
int |
set_pulseCounter(long newval) |
int |
set_removalMinTime(int newval)
Changes the minimal detection duration before signalling a removal event.
|
int |
setDetectionHysteresis(int newval)
Changes the hysteresis used to determine the logical state of the proximity sensor, when considered
as a binary input (on/off).
|
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 |
setPresenceMinTime(int newval)
Changes the minimal detection duration before signalling a presence event.
|
int |
setProximityReportMode(int newval)
Changes the parameter type (sensor value, presence or pulse count) returned by the
get_currentValue function and callbacks.
|
int |
setRemovalMinTime(int newval)
Changes the minimal detection duration before signalling a removal event.
|
_applyCalibration, _decodeAvg, _decodeTimedReport, _decodeVal, _encodeCalibrationPoints, _parserHelper, calibrateFromPoints, FindSensor, FindSensorInContext, FirstSensor, FirstSensorInContext, get_advMode, get_calibrationParam, get_currentRawValue, get_currentValue, get_dataLogger, get_highestValue, get_logFrequency, get_lowestValue, get_recordedData, get_reportFrequency, get_resolution, get_sensorState, get_unit, getAdvMode, getCurrentRawValue, getCurrentValue, getHighestValue, getLogFrequency, getLowestValue, getReportFrequency, getResolution, getSensorState, getUnit, isSensorReady, loadCalibrationPoints, nextSensor, registerTimedReportCallback, registerValueCallback, set_advMode, set_calibrationParam, set_highestValue, set_logFrequency, set_lowestValue, set_reportFrequency, set_resolution, setAdvMode, setHighestValue, setLogFrequency, setLowestValue, setReportFrequency, setResolution, startDataLogger, stopDataLogger
_AddToCache, _clearDataStreamCache, _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, _uploadEx, 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_serialNumber, get_userData, getAdvertisedValue, getErrorMessage, getErrorType, getFriendlyName, getFunctionDescriptor, getFunctionId, getHardwareId, getLogicalName, getModule, getUserData, isOnline, isReadOnly, load, loadAttribute, module, muteValueCallbacks, nextFunction, registerValueCallback, set_advertisedValue, set_logicalName, set_userData, setLogicalName, setUserData, toString, unmuteValueCallbacks, userData
public static final double SIGNALVALUE_INVALID
public static final int DETECTIONTHRESHOLD_INVALID
public static final int DETECTIONHYSTERESIS_INVALID
public static final int PRESENCEMINTIME_INVALID
public static final int REMOVALMINTIME_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 _detectionHysteresis
protected int _presenceMinTime
protected int _removalMinTime
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(com.yoctopuce.YoctoAPI.YJSONObject json_val) throws Exception
_parseAttr
in class YSensor
Exception
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_detectionHysteresis() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getDetectionHysteresis() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_detectionHysteresis(int newval) throws YAPI_Exception
newval
- : an integer corresponding to the hysteresis used to determine the logical state of
the proximity sensor, when considered
as a binary input (on/off)YAPI_Exception
- on errorpublic int setDetectionHysteresis(int newval) throws YAPI_Exception
newval
- : an integer corresponding to the hysteresis used to determine the logical state of
the proximity sensor, when considered
as a binary input (on/off)YAPI_Exception
- on errorpublic int get_presenceMinTime() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getPresenceMinTime() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_presenceMinTime(int newval) throws YAPI_Exception
newval
- : an integer corresponding to the minimal detection duration before signalling a presence eventYAPI_Exception
- on errorpublic int setPresenceMinTime(int newval) throws YAPI_Exception
newval
- : an integer corresponding to the minimal detection duration before signalling a presence eventYAPI_Exception
- on errorpublic int get_removalMinTime() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getRemovalMinTime() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_removalMinTime(int newval) throws YAPI_Exception
newval
- : an integer corresponding to the minimal detection duration before signalling a removal eventYAPI_Exception
- on errorpublic int setRemovalMinTime(int newval) throws YAPI_Exception
newval
- : an integer corresponding to the minimal detection duration before signalling a removal eventYAPI_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 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_PULSECOUNT corresponding
to the parameter type (sensor value, presence or pulse count) returned by the get_currentValue
function and callbacksYAPI_Exception
- on errorpublic int setProximityReportMode(int newval) throws YAPI_Exception
newval
- : a value among YProximity.PROXIMITYREPORTMODE_NUMERIC,
YProximity.PROXIMITYREPORTMODE_PRESENCE and YProximity.PROXIMITYREPORTMODE_PULSECOUNT corresponding
to the parameter type (sensor value, presence or pulse count) returned by the get_currentValue
function and callbacksYAPI_Exception
- on errorpublic static YProximity FindProximity(String func)
func
- : a string that uniquely characterizes the proximity sensor, for instance
YPROXIM1.proximity1.public static YProximity FindProximityInContext(YAPIContext yctx, String func)
yctx
- : a YAPI contextfunc
- : a string that uniquely characterizes the proximity sensor, for instance
YPROXIM1.proximity1.public 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 © 2021. All rights reserved.