public class YArithmeticSensor extends YSensor
Modifier and Type | Class and Description |
---|---|
static interface |
YArithmeticSensor.TimedReportCallback
TimedReportCallback for ArithmeticSensor
|
static interface |
YArithmeticSensor.UpdateCallback
Deprecated UpdateCallback for ArithmeticSensor
|
Modifier and Type | Field and Description |
---|---|
protected String |
_command |
protected String |
_description |
protected YArithmeticSensor.TimedReportCallback |
_timedReportCallbackArithmeticSensor |
protected YArithmeticSensor.UpdateCallback |
_valueCallbackArithmeticSensor |
static String |
COMMAND_INVALID
invalid command value
|
static String |
DESCRIPTION_INVALID
invalid description 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 |
YArithmeticSensor(String func) |
protected |
YArithmeticSensor(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) |
int |
defineAuxiliaryFunction(String name,
ArrayList<Double> inputValues,
ArrayList<Double> outputValues)
Defines a auxiliary function by means of a table of reference points.
|
double |
defineExpression(String expr,
String descr)
Defines the arithmetic function by means of an algebraic expression.
|
static YArithmeticSensor |
FindArithmeticSensor(String func)
Retrieves an arithmetic sensor for a given identifier.
|
static YArithmeticSensor |
FindArithmeticSensorInContext(YAPIContext yctx,
String func)
Retrieves an arithmetic sensor for a given identifier in a YAPI context.
|
static YArithmeticSensor |
FirstArithmeticSensor()
Starts the enumeration of arithmetic sensors currently accessible.
|
static YArithmeticSensor |
FirstArithmeticSensorInContext(YAPIContext yctx)
Starts the enumeration of arithmetic sensors currently accessible.
|
String |
get_command() |
String |
get_description()
Returns a short informative description of the formula.
|
String |
getDescription()
Returns a short informative description of the formula.
|
int |
loadAuxiliaryFunction(String name,
ArrayList<Double> inputValues,
ArrayList<Double> outputValues)
Retrieves the reference points table defining an auxiliary function previously
configured using the defineAuxiliaryFunction function.
|
String |
loadExpression()
Retrieves the algebraic expression defining the arithmetic function, as previously
configured using the defineExpression function.
|
YArithmeticSensor |
nextArithmeticSensor()
Continues the enumeration of arithmetic sensors started using yFirstArithmeticSensor().
|
int |
registerTimedReportCallback(YArithmeticSensor.TimedReportCallback callback)
Registers the callback function that is invoked on every periodic timed notification.
|
int |
registerValueCallback(YArithmeticSensor.UpdateCallback callback)
Registers the callback function that is invoked on every change of advertised value.
|
int |
set_command(String newval) |
int |
set_unit(String newval)
Changes the measuring unit for the arithmetic sensor.
|
int |
setUnit(String newval)
Changes the measuring unit for the arithmetic sensor.
|
_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 String DESCRIPTION_INVALID
public static final String COMMAND_INVALID
protected String _description
protected String _command
protected YArithmeticSensor.UpdateCallback _valueCallbackArithmeticSensor
protected YArithmeticSensor.TimedReportCallback _timedReportCallbackArithmeticSensor
protected YArithmeticSensor(YAPIContext ctx, String func)
func
- : functionidprotected YArithmeticSensor(String func)
func
- : functionidprotected void _parseAttr(com.yoctopuce.YoctoAPI.YJSONObject json_val) throws Exception
_parseAttr
in class YSensor
Exception
public int set_unit(String newval) throws YAPI_Exception
newval
- : a string corresponding to the measuring unit for the arithmetic sensorYAPI_Exception
- on errorpublic int setUnit(String newval) throws YAPI_Exception
newval
- : a string corresponding to the measuring unit for the arithmetic sensorYAPI_Exception
- on errorpublic String get_description() throws YAPI_Exception
YAPI_Exception
- on errorpublic String getDescription() throws YAPI_Exception
YAPI_Exception
- on errorpublic String get_command() throws YAPI_Exception
YAPI_Exception
public int set_command(String newval) throws YAPI_Exception
YAPI_Exception
public static YArithmeticSensor FindArithmeticSensor(String func)
func
- : a string that uniquely characterizes the arithmetic sensor, for instance
RXUVOLT1.arithmeticSensor1.public static YArithmeticSensor FindArithmeticSensorInContext(YAPIContext yctx, String func)
yctx
- : a YAPI contextfunc
- : a string that uniquely characterizes the arithmetic sensor, for instance
RXUVOLT1.arithmeticSensor1.public int registerValueCallback(YArithmeticSensor.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(YArithmeticSensor.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 double defineExpression(String expr, String descr) throws YAPI_Exception
expr
- : the algebraic expression defining the function.descr
- : short informative description of the expression.YAPI_Exception
- on errorpublic String loadExpression() throws YAPI_Exception
YAPI_Exception
- on errorpublic int defineAuxiliaryFunction(String name, ArrayList<Double> inputValues, ArrayList<Double> outputValues) throws YAPI_Exception
name
- : auxiliary function name, up to 16 characters.inputValues
- : array of floating point numbers, corresponding to the function input value.outputValues
- : array of floating point numbers, corresponding to the output value
desired for each of the input value, index by index.YAPI_Exception
- on errorpublic int loadAuxiliaryFunction(String name, ArrayList<Double> inputValues, ArrayList<Double> outputValues) throws YAPI_Exception
name
- : auxiliary function name, up to 16 characters.inputValues
- : array of floating point numbers, that is filled by the function
with all the function reference input value.outputValues
- : array of floating point numbers, that is filled by the function
output value for each of the input value, index by index.YAPI_Exception
- on errorpublic YArithmeticSensor nextArithmeticSensor()
public static YArithmeticSensor FirstArithmeticSensor()
public static YArithmeticSensor FirstArithmeticSensorInContext(YAPIContext yctx)
yctx
- : a YAPI context.Copyright © 2022. All rights reserved.