yocto_lightsensor.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * $Id: yocto_lightsensor.h 28748 2017-10-03 08:23:39Z seb $
4  *
5  * Declares yFindLightSensor(), the high-level API for LightSensor functions
6  *
7  * - - - - - - - - - License information: - - - - - - - - -
8  *
9  * Copyright (C) 2011 and beyond by Yoctopuce Sarl, Switzerland.
10  *
11  * Yoctopuce Sarl (hereafter Licensor) grants to you a perpetual
12  * non-exclusive license to use, modify, copy and integrate this
13  * file into your software for the sole purpose of interfacing
14  * with Yoctopuce products.
15  *
16  * You may reproduce and distribute copies of this file in
17  * source or object form, as long as the sole purpose of this
18  * code is to interface with Yoctopuce products. You must retain
19  * this notice in the distributed source file.
20  *
21  * You should refer to Yoctopuce General Terms and Conditions
22  * for additional information regarding your rights and
23  * obligations.
24  *
25  * THE SOFTWARE AND DOCUMENTATION ARE PROVIDED 'AS IS' WITHOUT
26  * WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
27  * WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, FITNESS
28  * FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO
29  * EVENT SHALL LICENSOR BE LIABLE FOR ANY INCIDENTAL, SPECIAL,
30  * INDIRECT OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA,
31  * COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR
32  * SERVICES, ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT
33  * LIMITED TO ANY DEFENSE THEREOF), ANY CLAIMS FOR INDEMNITY OR
34  * CONTRIBUTION, OR OTHER SIMILAR COSTS, WHETHER ASSERTED ON THE
35  * BASIS OF CONTRACT, TORT (INCLUDING NEGLIGENCE), BREACH OF
36  * WARRANTY, OR OTHERWISE.
37  *
38  *********************************************************************/
39 
40 
41 #ifndef YOCTO_LIGHTSENSOR_H
42 #define YOCTO_LIGHTSENSOR_H
43 
44 #include "yocto_api.h"
45 #include <cfloat>
46 #include <cmath>
47 #include <map>
48 
49 //--- (YLightSensor return codes)
50 //--- (end of YLightSensor return codes)
51 //--- (YLightSensor definitions)
52 class YLightSensor; // forward declaration
53 
54 typedef void (*YLightSensorValueCallback)(YLightSensor *func, const string& functionValue);
55 class YMeasure; // forward declaration
56 typedef void (*YLightSensorTimedReportCallback)(YLightSensor *func, YMeasure measure);
57 #ifndef _Y_MEASURETYPE_ENUM
58 #define _Y_MEASURETYPE_ENUM
59 typedef enum {
67 #endif
68 //--- (end of YLightSensor definitions)
69 
70 //--- (YLightSensor declaration)
83 #ifdef __BORLANDC__
84 #pragma option push -w-8022
85 #endif
86 //--- (end of YLightSensor declaration)
87 protected:
88  //--- (YLightSensor attributes)
89  // Attributes (function value cache)
93 
94  friend YLightSensor *yFindLightSensor(const string& func);
95  friend YLightSensor *yFirstLightSensor(void);
96 
97  // Function-specific method for parsing of JSON output and caching result
98  virtual int _parseAttr(YJSONObject* json_val);
99 
100  // Constructor is protected, use yFindLightSensor factory function to instantiate
101  YLightSensor(const string& func);
102  //--- (end of YLightSensor attributes)
103 
104 public:
105  ~YLightSensor();
106  //--- (YLightSensor accessors declaration)
107 
108  static const Y_MEASURETYPE_enum MEASURETYPE_HUMAN_EYE = Y_MEASURETYPE_HUMAN_EYE;
109  static const Y_MEASURETYPE_enum MEASURETYPE_WIDE_SPECTRUM = Y_MEASURETYPE_WIDE_SPECTRUM;
110  static const Y_MEASURETYPE_enum MEASURETYPE_INFRARED = Y_MEASURETYPE_INFRARED;
111  static const Y_MEASURETYPE_enum MEASURETYPE_HIGH_RATE = Y_MEASURETYPE_HIGH_RATE;
112  static const Y_MEASURETYPE_enum MEASURETYPE_HIGH_ENERGY = Y_MEASURETYPE_HIGH_ENERGY;
113  static const Y_MEASURETYPE_enum MEASURETYPE_INVALID = Y_MEASURETYPE_INVALID;
114 
115  int set_currentValue(double newval);
116  inline int setCurrentValue(double newval)
117  { return this->set_currentValue(newval); }
118 
132  int calibrate(double calibratedVal);
133 
142  Y_MEASURETYPE_enum get_measureType(void);
143 
145  { return this->get_measureType(); }
146 
162  int set_measureType(Y_MEASURETYPE_enum newval);
164  { return this->set_measureType(newval); }
165 
193  static YLightSensor* FindLightSensor(string func);
194 
206  virtual int registerValueCallback(YLightSensorValueCallback callback);
208 
209  virtual int _invokeValueCallback(string value);
210 
224 
225  virtual int _invokeTimedReportCallback(YMeasure value);
226 
227 
228  inline static YLightSensor* Find(string func)
229  { return YLightSensor::FindLightSensor(func); }
230 
238  YLightSensor *nextLightSensor(void);
239  inline YLightSensor *next(void)
240  { return this->nextLightSensor();}
241 
251  static YLightSensor* FirstLightSensor(void);
252  inline static YLightSensor* First(void)
253  { return YLightSensor::FirstLightSensor();}
254 #ifdef __BORLANDC__
255 #pragma option pop
256 #endif
257  //--- (end of YLightSensor accessors declaration)
258 };
259 
260 //--- (YLightSensor functions declaration)
261 
289 inline YLightSensor* yFindLightSensor(const string& func)
290 { return YLightSensor::FindLightSensor(func);}
302 
303 //--- (end of YLightSensor functions declaration)
304 
305 #endif
YLightSensor * yFirstLightSensor(void)
Y_MEASURETYPE_enum
Y_MEASURETYPE_enum _measureType
static YLightSensor * First(void)
Y_MEASURETYPE_enum measureType(void)
YLightSensor * yFindLightSensor(const string &func)
int setCurrentValue(double newval)
void(* YLightSensorValueCallback)(YLightSensor *func, const string &functionValue)
YLightSensorTimedReportCallback _timedReportCallbackLightSensor
YLightSensor * next(void)
static YLightSensor * FindLightSensor(string func)
int setMeasureType(Y_MEASURETYPE_enum newval)
YLightSensorValueCallback _valueCallbackLightSensor
virtual int registerTimedReportCallback(YSensorTimedReportCallback callback)
Definition: yocto_api.cpp:7923
virtual int _invokeTimedReportCallback(YMeasure value)
Definition: yocto_api.cpp:7936
virtual int _invokeValueCallback(string value)
Definition: yocto_api.cpp:7645
static YLightSensor * Find(string func)
virtual int _parseAttr(YJSONObject *json_val)
Definition: yocto_api.cpp:7015
virtual int registerValueCallback(YSensorValueCallback callback)
Definition: yocto_api.cpp:7626
#define YOCTO_CLASS_EXPORT
Definition: yocto_api.h:61
static YLightSensor * FirstLightSensor(void)
void(* YLightSensorTimedReportCallback)(YLightSensor *func, YMeasure measure)


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