Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
YSensor Class Reference

#include <yocto_api.h>

Inheritance diagram for YSensor:
Inheritance graph
[legend]

Public Member Functions

virtual double _applyCalibration (double rawValue)
 
virtual double _decodeAvg (int dw)
 
virtual YMeasure _decodeTimedReport (double timestamp, vector< int > report)
 
virtual double _decodeVal (int w)
 
virtual string _encodeCalibrationPoints (vector< double > rawValues, vector< double > refValues)
 
virtual int _invokeTimedReportCallback (YMeasure value)
 
virtual int _invokeValueCallback (string value)
 
virtual int _parserHelper (void)
 
Y_ADVMODE_enum advMode (void)
 
virtual int calibrateFromPoints (vector< double > rawValues, vector< double > refValues)
 
string calibrationParam (void)
 
double currentRawValue (void)
 
double currentValue (void)
 
Y_ADVMODE_enum get_advMode (void)
 
string get_calibrationParam (void)
 
double get_currentRawValue (void)
 
double get_currentValue (void)
 
virtual YDataLoggerget_dataLogger (void)
 
double get_highestValue (void)
 
string get_logFrequency (void)
 
double get_lowestValue (void)
 
virtual YDataSet get_recordedData (s64 startTime, s64 endTime)
 
string get_reportFrequency (void)
 
double get_resolution (void)
 
int get_sensorState (void)
 
string get_unit (void)
 
double highestValue (void)
 
virtual bool isSensorReady (void)
 
virtual int loadCalibrationPoints (vector< double > &rawValues, vector< double > &refValues)
 
string logFrequency (void)
 
double lowestValue (void)
 
YSensornext (void)
 
YSensornextSensor (void)
 
virtual int registerTimedReportCallback (YSensorTimedReportCallback callback)
 
virtual int registerValueCallback (YSensorValueCallback callback)
 
string reportFrequency (void)
 
double resolution (void)
 
int sensorState (void)
 
int set_advMode (Y_ADVMODE_enum newval)
 
int set_calibrationParam (const string &newval)
 
int set_highestValue (double newval)
 
int set_logFrequency (const string &newval)
 
int set_lowestValue (double newval)
 
int set_reportFrequency (const string &newval)
 
int set_resolution (double newval)
 
int setAdvMode (Y_ADVMODE_enum newval)
 
int setCalibrationParam (const string &newval)
 
int setHighestValue (double newval)
 
int setLogFrequency (const string &newval)
 
int setLowestValue (double newval)
 
int setReportFrequency (const string &newval)
 
int setResolution (double newval)
 
virtual int startDataLogger (void)
 
virtual int stopDataLogger (void)
 
string unit (void)
 
 ~YSensor ()
 
- Public Member Functions inherited from YFunction
void _clearDataStreamCache ()
 
string _decode_json_string (const string &json)
 
string _download (const string &url)
 
YDataStream_findDataStream (YDataSet &dataset, const string &def)
 
string _get_json_path (const string &json, const string &path)
 
vector< string > _json_get_array (const string &json)
 
string _json_get_key (const string &json, const string &data)
 
string _json_get_string (const string &json)
 
int _parseEx (yJsonStateMachine &j)
 
string _parseString (yJsonStateMachine &j)
 
string _request (const string &request)
 
string _requestEx (int tcpchan, const string &request, yapiRequestProgressCallback callback, void *context)
 
void _throw (YRETCODE errType, string errMsg)
 
YRETCODE _upload (const string &path, const string &content)
 
YRETCODE _uploadWithProgress (const string &path, const string &content, yapiRequestProgressCallback callback, void *context)
 
string advertisedValue (void)
 
void clearCache ()
 
string describe (void)
 
string errMessage (void)
 
string errorMessage (void)
 
YRETCODE errorType (void)
 
YRETCODE errType (void)
 
YFUN_DESCR functionDescriptor (void)
 
string get_advertisedValue (void)
 
string get_errorMessage (void)
 
YRETCODE get_errorType (void)
 
virtual string get_friendlyName (void)
 
YFUN_DESCR get_functionDescriptor (void)
 
string get_functionId (void)
 
string get_hardwareId (void)
 
string get_hubSerial ()
 
string get_logicalName (void)
 
YModuleget_module (void)
 
void * get_userData (void)
 
bool isOnline (void)
 
YRETCODE load (int msValidity)
 
virtual string loadAttribute (string attrName)
 
string logicalName (void)
 
YModulemodule (void)
 
virtual int muteValueCallbacks (void)
 
YFunctionnext (void)
 
YFunctionnextFunction (void)
 
virtual int registerValueCallback (YFunctionValueCallback callback)
 
int set_advertisedValue (const string &newval)
 
int set_logicalName (const string &newval)
 
void set_userData (void *data)
 
int setAdvertisedValue (const string &newval)
 
int setLogicalName (const string &newval)
 
void setUserData (void *data)
 
virtual int unmuteValueCallbacks (void)
 
void * userData (void)
 
virtual ~YFunction ()
 

Static Public Member Functions

static YSensorFind (string func)
 
static YSensorFindSensor (string func)
 
static YSensorFirst (void)
 
static YSensorFirstSensor (void)
 
- Static Public Member Functions inherited from YFunction
static void _ClearCache (void)
 
static YFunctionFind (string func)
 
static YFunctionFindFunction (string func)
 
static YFunctionFirst (void)
 
static YFunctionFirstFunction (void)
 

Static Public Attributes

static const Y_ADVMODE_enum ADVMODE_IMMEDIATE = Y_ADVMODE_IMMEDIATE
 
static const Y_ADVMODE_enum ADVMODE_INVALID = Y_ADVMODE_INVALID
 
static const Y_ADVMODE_enum ADVMODE_PERIOD_AVG = Y_ADVMODE_PERIOD_AVG
 
static const Y_ADVMODE_enum ADVMODE_PERIOD_MAX = Y_ADVMODE_PERIOD_MAX
 
static const Y_ADVMODE_enum ADVMODE_PERIOD_MIN = Y_ADVMODE_PERIOD_MIN
 
static const string CALIBRATIONPARAM_INVALID = YAPI_INVALID_STRING
 
static const double CURRENTRAWVALUE_INVALID = YAPI_INVALID_DOUBLE
 
static const double CURRENTVALUE_INVALID = YAPI_INVALID_DOUBLE
 
static const double HIGHESTVALUE_INVALID = YAPI_INVALID_DOUBLE
 
static const string LOGFREQUENCY_INVALID = YAPI_INVALID_STRING
 
static const double LOWESTVALUE_INVALID = YAPI_INVALID_DOUBLE
 
static const string REPORTFREQUENCY_INVALID = YAPI_INVALID_STRING
 
static const double RESOLUTION_INVALID = YAPI_INVALID_DOUBLE
 
static const int SENSORSTATE_INVALID = YAPI_INVALID_INT
 
static const string UNIT_INVALID = YAPI_INVALID_STRING
 
- Static Public Attributes inherited from YFunction
static const string ADVERTISEDVALUE_INVALID = YAPI_INVALID_STRING
 
static const string FRIENDLYNAME_INVALID = YAPI_INVALID_STRING
 
static const YFUN_DESCR FUNCTIONDESCRIPTOR_INVALID = Y_FUNCTIONDESCRIPTOR_INVALID
 
static const string FUNCTIONID_INVALID = YAPI_INVALID_STRING
 
static const string HARDWAREID_INVALID = YAPI_INVALID_STRING
 
static const string LOGICALNAME_INVALID = YAPI_INVALID_STRING
 

Protected Member Functions

virtual int _parseAttr (YJSONObject *json_val)
 
 YSensor (const string &func)
 
- Protected Member Functions inherited from YFunction
YRETCODE _buildSetRequest (const string &changeattr, const string *changeval, string &request, string &errmsg)
 
string _escapeAttr (const string &changeval)
 
YRETCODE _getDescriptor (YFUN_DESCR &fundescr, string &errMsg)
 
YRETCODE _getDevice (YDevice *&dev, string &errMsg)
 
YRETCODE _load_unsafe (int msValidity)
 
YRETCODE _nextFunction (string &hwId)
 
int _parse (YJSONObject *j)
 
YRETCODE _setAttr (string attrname, string newvalue)
 
 YFunction (const string &func)
 

Protected Attributes

Y_ADVMODE_enum _advMode
 
yCalibrationHandler _calhdl
 
string _calibrationParam
 
vector< int > _calpar
 
vector< double > _calraw
 
vector< double > _calref
 
int _caltyp
 
double _currentRawValue
 
double _currentValue
 
double _decexp
 
double _highestValue
 
double _iresol
 
bool _isScal
 
bool _isScal32
 
string _logFrequency
 
double _lowestValue
 
double _offset
 
double _prevTimedReport
 
string _reportFrequency
 
double _resolution
 
double _scale
 
int _sensorState
 
YSensorTimedReportCallback _timedReportCallbackSensor
 
string _unit
 
YSensorValueCallback _valueCallbackSensor
 
- Protected Attributes inherited from YFunction
string _advertisedValue
 
u64 _cacheExpiration
 
string _className
 
std::map< string, YDataStream * > _dataStreams
 
string _func
 
YFUN_DESCR _fundescr
 
string _funId
 
string _hwId
 
string _lastErrorMsg
 
YRETCODE _lastErrorType
 
string _logicalName
 
string _serial
 
yCRITICAL_SECTION _this_cs
 
void * _userData
 
YFunctionValueCallback _valueCallbackFunction
 

Friends

YSensoryFindSensor (const string &func)
 
YSensoryFirstSensor (void)
 

Additional Inherited Members

- Static Protected Member Functions inherited from YFunction
static void _AddToCache (const string &classname, const string &func, YFunction *obj)
 
static YFunction_FindFromCache (const string &classname, const string &func)
 
static void _UpdateTimedReportCallbackList (YFunction *func, bool add)
 
static void _UpdateValueCallbackList (YFunction *func, bool add)
 
- Static Protected Attributes inherited from YFunction
static std::map< string, YFunction * > _cache
 

Detailed Description

YSensor Class: Sensor function interface

The YSensor class is the parent class for all Yoctopuce sensors. It can be used to read the current value and unit of any sensor, read the min/max value, configure autonomous recording frequency and access recorded data. It also provide a function to register a callback invoked each time the observed value changes, or at a predefined interval. Using this class rather than a specific subclass makes it possible to create generic applications that work with any Yoctopuce sensor, even those that do not yet exist. Note: The YAnButton class is the only analog input which does not inherit from YSensor.

Definition at line 2665 of file yocto_api.h.

Constructor & Destructor Documentation

YSensor::YSensor ( const string &  func)
protected

Definition at line 6968 of file yocto_api.cpp.

YSensor::~YSensor ( )

Definition at line 6996 of file yocto_api.cpp.

Member Function Documentation

double YSensor::_applyCalibration ( double  rawValue)
virtual

Definition at line 8095 of file yocto_api.cpp.

double YSensor::_decodeAvg ( int  dw)
virtual

Definition at line 8268 of file yocto_api.cpp.

YMeasure YSensor::_decodeTimedReport ( double  timestamp,
vector< int >  report 
)
virtual

Definition at line 8112 of file yocto_api.cpp.

double YSensor::_decodeVal ( int  w)
virtual

Definition at line 8251 of file yocto_api.cpp.

string YSensor::_encodeCalibrationPoints ( vector< double >  rawValues,
vector< double >  refValues 
)
virtual

Definition at line 8034 of file yocto_api.cpp.

int YSensor::_invokeTimedReportCallback ( YMeasure  value)
virtual
int YSensor::_invokeValueCallback ( string  value)
virtual
int YSensor::_parseAttr ( YJSONObject json_val)
protectedvirtual
int YSensor::_parserHelper ( void  )
virtual

Reimplemented from YFunction.

Definition at line 7655 of file yocto_api.cpp.

Y_ADVMODE_enum YSensor::advMode ( void  )
inline

Definition at line 2899 of file yocto_api.h.

int YSensor::calibrateFromPoints ( vector< double >  rawValues,
vector< double >  refValues 
)
virtual

Configures error correction data points, in particular to compensate for a possible perturbation of the measure caused by an enclosure. It is possible to configure up to five correction points. Correction points must be provided in ascending order, and be in the range of the sensor. The device will automatically perform a linear interpolation of the error correction between specified points. Remember to call the saveToFlash() method of the module if the modification must be kept.

For more information on advanced capabilities to refine the calibration of sensors, please contact suppo.nosp@m.rt@y.nosp@m.octop.nosp@m.uce..nosp@m.com.

Parameters
rawValues: array of floating point numbers, corresponding to the raw values returned by the sensor for the correction points.
refValues: array of floating point numbers, corresponding to the corrected values for the correction points.
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 7966 of file yocto_api.cpp.

string YSensor::calibrationParam ( void  )
inline

Definition at line 2918 of file yocto_api.h.

double YSensor::currentRawValue ( void  )
inline

Definition at line 2824 of file yocto_api.h.

double YSensor::currentValue ( void  )
inline

Definition at line 2754 of file yocto_api.h.

static YSensor* YSensor::Find ( string  func)
inlinestatic

Definition at line 3141 of file yocto_api.h.

YSensor * YSensor::FindSensor ( string  func)
static

Retrieves a sensor for a given identifier. The identifier can be specified using several formats:

  • FunctionLogicalName
  • ModuleSerialNumber.FunctionIdentifier
  • ModuleSerialNumber.FunctionLogicalName
  • ModuleLogicalName.FunctionIdentifier
  • ModuleLogicalName.FunctionLogicalName

This function does not require that the sensor is online at the time it is invoked. The returned object is nevertheless valid. Use the method YSensor.isOnline() to test if the sensor is indeed online at a given time. In case of ambiguity when looking for a sensor by logical name, no error is notified: the first instance found is returned. The search is performed first by hardware name, then by logical name.

If a call to this object's is_online() method returns FALSE although you are certain that the matching device is plugged, make sure that you did call registerHub() at application initialization time.

Parameters
func: a string that uniquely characterizes the sensor
Returns
a YSensor object allowing you to drive the sensor.

Definition at line 7594 of file yocto_api.cpp.

static YSensor* YSensor::First ( void  )
inlinestatic

Definition at line 3165 of file yocto_api.h.

YSensor * YSensor::FirstSensor ( void  )
static

Starts the enumeration of sensors currently accessible. Use the method YSensor.nextSensor() to iterate on next sensors.

Returns
a pointer to a YSensor object, corresponding to the first sensor currently online, or a NULL pointer if there are none.

Definition at line 8295 of file yocto_api.cpp.

Y_ADVMODE_enum YSensor::get_advMode ( void  )

Returns the measuring mode used for the advertised value pushed to the parent hub.

Returns
a value among Y_ADVMODE_IMMEDIATE, Y_ADVMODE_PERIOD_AVG, Y_ADVMODE_PERIOD_MIN and Y_ADVMODE_PERIOD_MAX corresponding to the measuring mode used for the advertised value pushed to the parent hub

On failure, throws an exception or returns Y_ADVMODE_INVALID.

Definition at line 7393 of file yocto_api.cpp.

string YSensor::get_calibrationParam ( void  )

Definition at line 7441 of file yocto_api.cpp.

double YSensor::get_currentRawValue ( void  )

Returns the uncalibrated, unrounded raw value returned by the sensor, in the specified unit, as a floating point number.

Returns
a floating point number corresponding to the uncalibrated, unrounded raw value returned by the sensor, in the specified unit, as a floating point number

On failure, throws an exception or returns Y_CURRENTRAWVALUE_INVALID.

Definition at line 7243 of file yocto_api.cpp.

double YSensor::get_currentValue ( void  )

Returns the current value of the measure, in the specified unit, as a floating point number.

Returns
a floating point number corresponding to the current value of the measure, in the specified unit, as a floating point number

On failure, throws an exception or returns Y_CURRENTVALUE_INVALID.

Definition at line 7091 of file yocto_api.cpp.

YDataLogger * YSensor::get_dataLogger ( void  )
virtual

Returns the YDatalogger object of the device hosting the sensor. This method returns an object of class YDatalogger that can control global parameters of the data logger. The returned object should not be freed.

Returns
an YDataLogger object or NULL on error.

Definition at line 7823 of file yocto_api.cpp.

double YSensor::get_highestValue ( void  )

Returns the maximal value observed for the measure since the device was started. Can be reset to an arbitrary value thanks to set_highestValue().

Returns
a floating point number corresponding to the maximal value observed for the measure since the device was started

On failure, throws an exception or returns Y_HIGHESTVALUE_INVALID.

Definition at line 7211 of file yocto_api.cpp.

string YSensor::get_logFrequency ( void  )

Returns the datalogger recording frequency for this function, or "OFF" when measures are not stored in the data logger flash memory.

Returns
a string corresponding to the datalogger recording frequency for this function, or "OFF" when measures are not stored in the data logger flash memory

On failure, throws an exception or returns Y_LOGFREQUENCY_INVALID.

Definition at line 7274 of file yocto_api.cpp.

double YSensor::get_lowestValue ( void  )

Returns the minimal value observed for the measure since the device was started. Can be reset to an arbitrary value thanks to set_lowestValue().

Returns
a floating point number corresponding to the minimal value observed for the measure since the device was started

On failure, throws an exception or returns Y_LOWESTVALUE_INVALID.

Definition at line 7153 of file yocto_api.cpp.

YDataSet YSensor::get_recordedData ( s64  startTime,
s64  endTime 
)
virtual

Retrieves a DataSet object holding historical data for this sensor, for a specified time interval. The measures will be retrieved from the data logger, which must have been turned on at the desired time. See the documentation of the DataSet class for information on how to get an overview of the recorded data, and how to load progressively a large set of measures from the data logger.

This function only works if the device uses a recent firmware, as DataSet objects are not supported by firmwares older than version 13000.

Parameters
startTime: the start of the desired measure time interval, as a Unix timestamp, i.e. the number of seconds since January 1, 1970 UTC. The special value 0 can be used to include any meaasure, without initial limit.
endTime: the end of the desired measure time interval, as a Unix timestamp, i.e. the number of seconds since January 1, 1970 UTC. The special value 0 can be used to include any meaasure, without ending limit.
Returns
an instance of YDataSet, providing access to historical data. Past measures can be loaded progressively using methods from the YDataSet object.

Definition at line 7902 of file yocto_api.cpp.

string YSensor::get_reportFrequency ( void  )

Returns the timed value notification frequency, or "OFF" if timed value notifications are disabled for this function.

Returns
a string corresponding to the timed value notification frequency, or "OFF" if timed value notifications are disabled for this function

On failure, throws an exception or returns Y_REPORTFREQUENCY_INVALID.

Definition at line 7334 of file yocto_api.cpp.

double YSensor::get_resolution ( void  )

Returns the resolution of the measured values. The resolution corresponds to the numerical precision of the measures, which is not always the same as the actual precision of the sensor.

Returns
a floating point number corresponding to the resolution of the measured values

On failure, throws an exception or returns Y_RESOLUTION_INVALID.

Definition at line 7513 of file yocto_api.cpp.

int YSensor::get_sensorState ( void  )

Returns the sensor health state code, which is zero when there is an up-to-date measure available or a positive code if the sensor is not able to provide a measure right now.

Returns
an integer corresponding to the sensor health state code, which is zero when there is an up-to-date measure available or a positive code if the sensor is not able to provide a measure right now

On failure, throws an exception or returns Y_SENSORSTATE_INVALID.

Definition at line 7545 of file yocto_api.cpp.

string YSensor::get_unit ( void  )

Returns the measuring unit for the measure.

Returns
a string corresponding to the measuring unit for the measure

On failure, throws an exception or returns Y_UNIT_INVALID.

Definition at line 7061 of file yocto_api.cpp.

double YSensor::highestValue ( void  )
inline

Definition at line 2810 of file yocto_api.h.

bool YSensor::isSensorReady ( void  )
virtual

Checks if the sensor is currently able to provide an up-to-date measure. Returns false if the device is unreachable, or if the sensor does not have a current measure to transmit. No exception is raised if there is an error while trying to contact the device hosting $THEFUNCTION$.

Returns
true if the sensor can provide an up-to-date measure, and false otherwise

Definition at line 7805 of file yocto_api.cpp.

int YSensor::loadCalibrationPoints ( vector< double > &  rawValues,
vector< double > &  refValues 
)
virtual

Retrieves error correction data points previously entered using the method calibrateFromPoints.

Parameters
rawValues: array of floating point numbers, that will be filled by the function with the raw sensor values for the correction points.
refValues: array of floating point numbers, that will be filled by the function with the desired values for the correction points.
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 7996 of file yocto_api.cpp.

string YSensor::logFrequency ( void  )
inline

Definition at line 2838 of file yocto_api.h.

double YSensor::lowestValue ( void  )
inline

Definition at line 2782 of file yocto_api.h.

YSensor* YSensor::next ( void  )
inline

Definition at line 3152 of file yocto_api.h.

YSensor * YSensor::nextSensor ( void  )

Continues the enumeration of sensors started using yFirstSensor().

Returns
a pointer to a YSensor object, corresponding to a sensor currently online, or a NULL pointer if there are no more sensors to enumerate.

Definition at line 8285 of file yocto_api.cpp.

int YSensor::registerTimedReportCallback ( YSensorTimedReportCallback  callback)
virtual

Registers the callback function that is invoked on every periodic timed notification. The callback is invoked only during the execution of ySleep or yHandleEvents. This provides control over the time when the callback is triggered. For good responsiveness, remember to call one of these two functions periodically. To unregister a callback, pass a NULL pointer as argument.

Parameters
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.

Definition at line 7923 of file yocto_api.cpp.

int YSensor::registerValueCallback ( YSensorValueCallback  callback)
virtual

Registers the callback function that is invoked on every change of advertised value. The callback is invoked only during the execution of ySleep or yHandleEvents. This provides control over the time when the callback is triggered. For good responsiveness, remember to call one of these two functions periodically. To unregister a callback, pass a NULL pointer as argument.

Parameters
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.

Definition at line 7626 of file yocto_api.cpp.

string YSensor::reportFrequency ( void  )
inline

Definition at line 2869 of file yocto_api.h.

double YSensor::resolution ( void  )
inline

Definition at line 2949 of file yocto_api.h.

int YSensor::sensorState ( void  )
inline

Definition at line 2964 of file yocto_api.h.

int YSensor::set_advMode ( Y_ADVMODE_enum  newval)

Changes the measuring mode used for the advertised value pushed to the parent hub.

Parameters
newval: a value among Y_ADVMODE_IMMEDIATE, Y_ADVMODE_PERIOD_AVG, Y_ADVMODE_PERIOD_MIN and Y_ADVMODE_PERIOD_MAX corresponding to the measuring mode used for the advertised value pushed to the parent hub
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 7425 of file yocto_api.cpp.

int YSensor::set_calibrationParam ( const string &  newval)

Definition at line 7463 of file yocto_api.cpp.

int YSensor::set_highestValue ( double  newval)

Changes the recorded maximal value observed. Can be used to reset the value returned by get_lowestValue().

Parameters
newval: a floating point number corresponding to the recorded maximal value observed
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 7186 of file yocto_api.cpp.

int YSensor::set_logFrequency ( const string &  newval)

Changes the datalogger recording frequency for this function. The frequency can be specified as samples per second, as sample per minute (for instance "15/m") or in samples per hour (eg. "4/h"). To disable recording for this function, use the value "OFF".

Parameters
newval: a string corresponding to the datalogger recording frequency for this function
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 7309 of file yocto_api.cpp.

int YSensor::set_lowestValue ( double  newval)

Changes the recorded minimal value observed. Can be used to reset the value returned by get_lowestValue().

Parameters
newval: a floating point number corresponding to the recorded minimal value observed
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 7128 of file yocto_api.cpp.

int YSensor::set_reportFrequency ( const string &  newval)

Changes the timed value notification frequency for this function. The frequency can be specified as samples per second, as sample per minute (for instance "15/m") or in samples per hour (eg. "4/h"). To disable timed value notifications for this function, use the value "OFF".

Parameters
newval: a string corresponding to the timed value notification frequency for this function
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 7369 of file yocto_api.cpp.

int YSensor::set_resolution ( double  newval)

Changes the resolution of the measured physical values. The resolution corresponds to the numerical precision when displaying value. It does not change the precision of the measure itself.

Parameters
newval: a floating point number corresponding to the resolution of the measured physical values
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 7489 of file yocto_api.cpp.

int YSensor::setAdvMode ( Y_ADVMODE_enum  newval)
inline

Definition at line 2913 of file yocto_api.h.

int YSensor::setCalibrationParam ( const string &  newval)
inline

Definition at line 2922 of file yocto_api.h.

int YSensor::setHighestValue ( double  newval)
inline

Definition at line 2796 of file yocto_api.h.

int YSensor::setLogFrequency ( const string &  newval)
inline

Definition at line 2855 of file yocto_api.h.

int YSensor::setLowestValue ( double  newval)
inline

Definition at line 2768 of file yocto_api.h.

int YSensor::setReportFrequency ( const string &  newval)
inline

Definition at line 2886 of file yocto_api.h.

int YSensor::setResolution ( double  newval)
inline

Definition at line 2936 of file yocto_api.h.

int YSensor::startDataLogger ( void  )
virtual

Starts the data logger on the device. Note that the data logger will only save the measures on this sensor if the logFrequency is not set to "OFF".

Returns
YAPI_SUCCESS if the call succeeds.

Definition at line 7847 of file yocto_api.cpp.

int YSensor::stopDataLogger ( void  )
virtual

Stops the datalogger on the device.

Returns
YAPI_SUCCESS if the call succeeds.

Definition at line 7864 of file yocto_api.cpp.

string YSensor::unit ( void  )
inline

Definition at line 2741 of file yocto_api.h.

Friends And Related Function Documentation

YSensor* yFindSensor ( const string &  func)
friend

Retrieves a sensor for a given identifier. The identifier can be specified using several formats:

  • FunctionLogicalName
  • ModuleSerialNumber.FunctionIdentifier
  • ModuleSerialNumber.FunctionLogicalName
  • ModuleLogicalName.FunctionIdentifier
  • ModuleLogicalName.FunctionLogicalName

This function does not require that the sensor is online at the time it is invoked. The returned object is nevertheless valid. Use the method YSensor.isOnline() to test if the sensor is indeed online at a given time. In case of ambiguity when looking for a sensor by logical name, no error is notified: the first instance found is returned. The search is performed first by hardware name, then by logical name.

If a call to this object's is_online() method returns FALSE although you are certain that the matching device is plugged, make sure that you did call registerHub() at application initialization time.

Parameters
func: a string that uniquely characterizes the sensor
Returns
a YSensor object allowing you to drive the sensor.

Definition at line 3202 of file yocto_api.h.

YSensor* yFirstSensor ( void  )
friend

Starts the enumeration of sensors currently accessible. Use the method YSensor.nextSensor() to iterate on next sensors.

Returns
a pointer to a YSensor object, corresponding to the first sensor currently online, or a NULL pointer if there are none.

Definition at line 3213 of file yocto_api.h.

Member Data Documentation

Y_ADVMODE_enum YSensor::_advMode
protected

Definition at line 2680 of file yocto_api.h.

yCalibrationHandler YSensor::_calhdl
protected

Definition at line 2697 of file yocto_api.h.

string YSensor::_calibrationParam
protected

Definition at line 2681 of file yocto_api.h.

vector<int> YSensor::_calpar
protected

Definition at line 2694 of file yocto_api.h.

vector<double> YSensor::_calraw
protected

Definition at line 2695 of file yocto_api.h.

vector<double> YSensor::_calref
protected

Definition at line 2696 of file yocto_api.h.

int YSensor::_caltyp
protected

Definition at line 2693 of file yocto_api.h.

double YSensor::_currentRawValue
protected

Definition at line 2677 of file yocto_api.h.

double YSensor::_currentValue
protected

Definition at line 2674 of file yocto_api.h.

double YSensor::_decexp
protected

Definition at line 2690 of file yocto_api.h.

double YSensor::_highestValue
protected

Definition at line 2676 of file yocto_api.h.

double YSensor::_iresol
protected

Definition at line 2687 of file yocto_api.h.

bool YSensor::_isScal
protected

Definition at line 2691 of file yocto_api.h.

bool YSensor::_isScal32
protected

Definition at line 2692 of file yocto_api.h.

string YSensor::_logFrequency
protected

Definition at line 2678 of file yocto_api.h.

double YSensor::_lowestValue
protected

Definition at line 2675 of file yocto_api.h.

double YSensor::_offset
protected

Definition at line 2688 of file yocto_api.h.

double YSensor::_prevTimedReport
protected

Definition at line 2686 of file yocto_api.h.

string YSensor::_reportFrequency
protected

Definition at line 2679 of file yocto_api.h.

double YSensor::_resolution
protected

Definition at line 2682 of file yocto_api.h.

double YSensor::_scale
protected

Definition at line 2689 of file yocto_api.h.

int YSensor::_sensorState
protected

Definition at line 2683 of file yocto_api.h.

YSensorTimedReportCallback YSensor::_timedReportCallbackSensor
protected

Definition at line 2685 of file yocto_api.h.

string YSensor::_unit
protected

Definition at line 2673 of file yocto_api.h.

YSensorValueCallback YSensor::_valueCallbackSensor
protected

Definition at line 2684 of file yocto_api.h.

const Y_ADVMODE_enum YSensor::ADVMODE_IMMEDIATE = Y_ADVMODE_IMMEDIATE
static

Definition at line 2723 of file yocto_api.h.

const Y_ADVMODE_enum YSensor::ADVMODE_INVALID = Y_ADVMODE_INVALID
static

Definition at line 2727 of file yocto_api.h.

const Y_ADVMODE_enum YSensor::ADVMODE_PERIOD_AVG = Y_ADVMODE_PERIOD_AVG
static

Definition at line 2724 of file yocto_api.h.

const Y_ADVMODE_enum YSensor::ADVMODE_PERIOD_MAX = Y_ADVMODE_PERIOD_MAX
static

Definition at line 2726 of file yocto_api.h.

const Y_ADVMODE_enum YSensor::ADVMODE_PERIOD_MIN = Y_ADVMODE_PERIOD_MIN
static

Definition at line 2725 of file yocto_api.h.

const string YSensor::CALIBRATIONPARAM_INVALID = YAPI_INVALID_STRING
static

Definition at line 2728 of file yocto_api.h.

const double YSensor::CURRENTRAWVALUE_INVALID = YAPI_INVALID_DOUBLE
static

Definition at line 2720 of file yocto_api.h.

const double YSensor::CURRENTVALUE_INVALID = YAPI_INVALID_DOUBLE
static

Definition at line 2717 of file yocto_api.h.

const double YSensor::HIGHESTVALUE_INVALID = YAPI_INVALID_DOUBLE
static

Definition at line 2719 of file yocto_api.h.

const string YSensor::LOGFREQUENCY_INVALID = YAPI_INVALID_STRING
static

Definition at line 2721 of file yocto_api.h.

const double YSensor::LOWESTVALUE_INVALID = YAPI_INVALID_DOUBLE
static

Definition at line 2718 of file yocto_api.h.

const string YSensor::REPORTFREQUENCY_INVALID = YAPI_INVALID_STRING
static

Definition at line 2722 of file yocto_api.h.

const double YSensor::RESOLUTION_INVALID = YAPI_INVALID_DOUBLE
static

Definition at line 2729 of file yocto_api.h.

const int YSensor::SENSORSTATE_INVALID = YAPI_INVALID_INT
static

Definition at line 2730 of file yocto_api.h.

const string YSensor::UNIT_INVALID = YAPI_INVALID_STRING
static

Definition at line 2716 of file yocto_api.h.


The documentation for this class was generated from the following files:


yoctopuce_altimeter
Author(s): Anja Sheppard
autogenerated on Mon Jun 10 2019 15:49:14