public class YVirtualSensor extends YSensor
| Modifier and Type | Class and Description |
|---|---|
static interface |
YVirtualSensor.TimedReportCallback
TimedReportCallback for VirtualSensor
|
static interface |
YVirtualSensor.UpdateCallback
Deprecated UpdateCallback for VirtualSensor
|
| Modifier and Type | Field and Description |
|---|---|
protected double |
_invalidValue |
protected YVirtualSensor.TimedReportCallback |
_timedReportCallbackVirtualSensor |
protected YVirtualSensor.UpdateCallback |
_valueCallbackVirtualSensor |
static double |
INVALIDVALUE_INVALID
invalid invalidValue value
|
_advMode, _cal, _calibrationParam, _currentRawValue, _currentValue, _highestValue, _iresol, _logFrequency, _lowestValue, _prevTR, _reportFrequency, _resolution, _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 |
YVirtualSensor(String func) |
protected |
YVirtualSensor(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 YVirtualSensor |
FindVirtualSensor(String func)
Retrieves a virtual sensor for a given identifier.
|
static YVirtualSensor |
FindVirtualSensorInContext(YAPIContext yctx,
String func)
Retrieves a virtual sensor for a given identifier in a YAPI context.
|
static YVirtualSensor |
FirstVirtualSensor()
Starts the enumeration of virtual sensors currently accessible.
|
static YVirtualSensor |
FirstVirtualSensorInContext(YAPIContext yctx)
Starts the enumeration of virtual sensors currently accessible.
|
double |
get_invalidValue()
Returns the invalid value of the sensor, returned if the sensor is read when in invalid state
(for instance before having been set).
|
double |
getInvalidValue()
Returns the invalid value of the sensor, returned if the sensor is read when in invalid state
(for instance before having been set).
|
YVirtualSensor |
nextVirtualSensor()
Continues the enumeration of virtual sensors started using yFirstVirtualSensor().
|
int |
registerTimedReportCallback(YVirtualSensor.TimedReportCallback callback)
Registers the callback function that is invoked on every periodic timed notification.
|
int |
registerValueCallback(YVirtualSensor.UpdateCallback callback)
Registers the callback function that is invoked on every change of advertised value.
|
int |
set_currentRawValue(double newval)
Changes the current value of the sensor (raw value, before calibration).
|
int |
set_invalidValue(double newval)
Changes the invalid value of the sensor, returned if the sensor is read when in invalid state
(for instance before having been set).
|
int |
set_sensorAsInvalid()
Changes the current sensor state to invalid (as if no value would have been ever set).
|
int |
set_sensorState(int newval) |
int |
set_unit(String newval)
Changes the measuring unit for the measured value.
|
int |
setCurrentRawValue(double newval)
Changes the current value of the sensor (raw value, before calibration).
|
int |
setInvalidValue(double newval)
Changes the invalid value of the sensor, returned if the sensor is read when in invalid state
(for instance before having been set).
|
int |
setUnit(String newval)
Changes the measuring unit for the measured value.
|
_applyCalibration, _decodeAvg, _decodeTimedReport, _decodeVal, _encodeCalibrationPoints, _parseCalibStr, _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, _decode_json_int, _decode_json_string, _download, _escapeAttr, _FindFromCache, _FindFromCacheInContext, _get_json_path_struct, _get_json_path, _is_valid_pass, _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, userDatapublic static final double INVALIDVALUE_INVALID
protected double _invalidValue
protected YVirtualSensor.UpdateCallback _valueCallbackVirtualSensor
protected YVirtualSensor.TimedReportCallback _timedReportCallbackVirtualSensor
protected YVirtualSensor(YAPIContext ctx, String func)
func - : functionidprotected YVirtualSensor(String func)
func - : functionidprotected void _parseAttr(com.yoctopuce.YoctoAPI.YJSONObject json_val)
throws Exception
_parseAttr in class YSensorExceptionpublic int set_unit(String newval) throws YAPI_Exception
newval - : a string corresponding to the measuring unit for the measured valueYAPI_Exception - on errorpublic int setUnit(String newval) throws YAPI_Exception
newval - : a string corresponding to the measuring unit for the measured valueYAPI_Exception - on errorpublic int set_currentRawValue(double newval)
throws YAPI_Exception
newval - : a floating point number corresponding to the current value of the sensor (raw
value, before calibration)YAPI_Exception - on errorpublic int setCurrentRawValue(double newval)
throws YAPI_Exception
newval - : a floating point number corresponding to the current value of the sensor (raw
value, before calibration)YAPI_Exception - on errorpublic int set_sensorState(int newval)
throws YAPI_Exception
YAPI_Exceptionpublic int set_invalidValue(double newval)
throws YAPI_Exception
newval - : a floating point number corresponding to the invalid value of the sensor, returned
if the sensor is read when in invalid state
(for instance before having been set)YAPI_Exception - on errorpublic int setInvalidValue(double newval)
throws YAPI_Exception
newval - : a floating point number corresponding to the invalid value of the sensor, returned
if the sensor is read when in invalid state
(for instance before having been set)YAPI_Exception - on errorpublic double get_invalidValue()
throws YAPI_Exception
YAPI_Exception - on errorpublic double getInvalidValue()
throws YAPI_Exception
YAPI_Exception - on errorpublic static YVirtualSensor FindVirtualSensor(String func)
func - : a string that uniquely characterizes the virtual sensor, for instance
MyDevice.virtualSensor1.public static YVirtualSensor FindVirtualSensorInContext(YAPIContext yctx, String func)
yctx - : a YAPI contextfunc - : a string that uniquely characterizes the virtual sensor, for instance
MyDevice.virtualSensor1.public int registerValueCallback(YVirtualSensor.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 YSensorpublic int registerTimedReportCallback(YVirtualSensor.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 YSensorpublic int set_sensorAsInvalid()
throws YAPI_Exception
YAPI_Exception - on errorpublic YVirtualSensor nextVirtualSensor()
public static YVirtualSensor FirstVirtualSensor()
public static YVirtualSensor FirstVirtualSensorInContext(YAPIContext yctx)
yctx - : a YAPI context.Copyright © 2026. All rights reserved.