public class YLightSensor extends YSensor
Modifier and Type | Class and Description |
---|---|
static interface |
YLightSensor.TimedReportCallback
TimedReportCallback for LightSensor
|
static interface |
YLightSensor.UpdateCallback
Deprecated UpdateCallback for LightSensor
|
Modifier and Type | Field and Description |
---|---|
protected int |
_measureType |
protected YLightSensor.TimedReportCallback |
_timedReportCallbackLightSensor |
protected YLightSensor.UpdateCallback |
_valueCallbackLightSensor |
static int |
MEASURETYPE_HIGH_ENERGY |
static int |
MEASURETYPE_HIGH_RATE |
static int |
MEASURETYPE_HUMAN_EYE
invalid measureType value
|
static int |
MEASURETYPE_INFRARED |
static int |
MEASURETYPE_INVALID |
static int |
MEASURETYPE_WIDE_SPECTRUM |
_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 |
YLightSensor(String func) |
protected |
YLightSensor(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 |
calibrate(double calibratedVal)
Changes the sensor-specific calibration parameter so that the current value
matches a desired target (linear scaling).
|
static YLightSensor |
FindLightSensor(String func)
Retrieves a light sensor for a given identifier.
|
static YLightSensor |
FindLightSensorInContext(YAPIContext yctx,
String func)
Retrieves a light sensor for a given identifier in a YAPI context.
|
static YLightSensor |
FirstLightSensor()
Starts the enumeration of light sensors currently accessible.
|
static YLightSensor |
FirstLightSensorInContext(YAPIContext yctx)
Starts the enumeration of light sensors currently accessible.
|
int |
get_measureType()
Returns the type of light measure.
|
int |
getMeasureType()
Returns the type of light measure.
|
YLightSensor |
nextLightSensor()
Continues the enumeration of light sensors started using yFirstLightSensor().
|
int |
registerTimedReportCallback(YLightSensor.TimedReportCallback callback)
Registers the callback function that is invoked on every periodic timed notification.
|
int |
registerValueCallback(YLightSensor.UpdateCallback callback)
Registers the callback function that is invoked on every change of advertised value.
|
int |
set_currentValue(double newval) |
int |
set_measureType(int newval)
Modifies the light sensor type used in the device.
|
int |
setMeasureType(int newval)
Modifies the light sensor type used in the device.
|
_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, 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, 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, setLogicalName, setUserData, toString, unmuteValueCallbacks, userData
public static final int MEASURETYPE_HUMAN_EYE
public static final int MEASURETYPE_WIDE_SPECTRUM
public static final int MEASURETYPE_INFRARED
public static final int MEASURETYPE_HIGH_RATE
public static final int MEASURETYPE_HIGH_ENERGY
public static final int MEASURETYPE_INVALID
protected int _measureType
protected YLightSensor.UpdateCallback _valueCallbackLightSensor
protected YLightSensor.TimedReportCallback _timedReportCallbackLightSensor
protected YLightSensor(YAPIContext ctx, String func)
func
- : functionidprotected YLightSensor(String func)
func
- : functionidprotected void _parseAttr(com.yoctopuce.YoctoAPI.YJSONObject json_val) throws Exception
_parseAttr
in class YSensor
Exception
public int set_currentValue(double newval) throws YAPI_Exception
YAPI_Exception
public int calibrate(double calibratedVal) throws YAPI_Exception
calibratedVal
- : the desired target value.
Remember to call the saveToFlash() method of the module if the
modification must be kept.YAPI_Exception
- on errorpublic int get_measureType() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getMeasureType() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_measureType(int newval) throws YAPI_Exception
newval
- : a value among YLightSensor.MEASURETYPE_HUMAN_EYE,
YLightSensor.MEASURETYPE_WIDE_SPECTRUM, YLightSensor.MEASURETYPE_INFRARED,
YLightSensor.MEASURETYPE_HIGH_RATE and YLightSensor.MEASURETYPE_HIGH_ENERGYYAPI_Exception
- on errorpublic int setMeasureType(int newval) throws YAPI_Exception
newval
- : a value among Y_MEASURETYPE_HUMAN_EYE, Y_MEASURETYPE_WIDE_SPECTRUM,
Y_MEASURETYPE_INFRARED, Y_MEASURETYPE_HIGH_RATE and Y_MEASURETYPE_HIGH_ENERGYYAPI_Exception
- on errorpublic static YLightSensor FindLightSensor(String func)
func
- : a string that uniquely characterizes the light sensorpublic static YLightSensor FindLightSensorInContext(YAPIContext yctx, String func)
yctx
- : a YAPI contextfunc
- : a string that uniquely characterizes the light sensorpublic int registerValueCallback(YLightSensor.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(YLightSensor.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 YLightSensor nextLightSensor()
public static YLightSensor FirstLightSensor()
public static YLightSensor FirstLightSensorInContext(YAPIContext yctx)
yctx
- : a YAPI context.Copyright © 2017. All rights reserved.