yocto_humidity.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * $Id: yocto_humidity.h 28748 2017-10-03 08:23:39Z seb $
4  *
5  * Declares yFindHumidity(), the high-level API for Humidity 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_HUMIDITY_H
42 #define YOCTO_HUMIDITY_H
43 
44 #include "yocto_api.h"
45 #include <cfloat>
46 #include <cmath>
47 #include <map>
48 
49 //--- (YHumidity return codes)
50 //--- (end of YHumidity return codes)
51 //--- (YHumidity definitions)
52 class YHumidity; // forward declaration
53 
54 typedef void (*YHumidityValueCallback)(YHumidity *func, const string& functionValue);
55 class YMeasure; // forward declaration
56 typedef void (*YHumidityTimedReportCallback)(YHumidity *func, YMeasure measure);
57 #define Y_RELHUM_INVALID (YAPI_INVALID_DOUBLE)
58 #define Y_ABSHUM_INVALID (YAPI_INVALID_DOUBLE)
59 //--- (end of YHumidity definitions)
60 
61 //--- (YHumidity declaration)
70 #ifdef __BORLANDC__
71 #pragma option push -w-8022
72 #endif
73 //--- (end of YHumidity declaration)
74 protected:
75  //--- (YHumidity attributes)
76  // Attributes (function value cache)
77  double _relHum;
78  double _absHum;
81 
82  friend YHumidity *yFindHumidity(const string& func);
83  friend YHumidity *yFirstHumidity(void);
84 
85  // Function-specific method for parsing of JSON output and caching result
86  virtual int _parseAttr(YJSONObject* json_val);
87 
88  // Constructor is protected, use yFindHumidity factory function to instantiate
89  YHumidity(const string& func);
90  //--- (end of YHumidity attributes)
91 
92 public:
93  ~YHumidity();
94  //--- (YHumidity accessors declaration)
95 
96  static const double RELHUM_INVALID;
97  static const double ABSHUM_INVALID;
98 
114  int set_unit(const string& newval);
115  inline int setUnit(const string& newval)
116  { return this->set_unit(newval); }
117 
125  double get_relHum(void);
126 
127  inline double relHum(void)
128  { return this->get_relHum(); }
129 
137  double get_absHum(void);
138 
139  inline double absHum(void)
140  { return this->get_absHum(); }
141 
169  static YHumidity* FindHumidity(string func);
170 
182  virtual int registerValueCallback(YHumidityValueCallback callback);
184 
185  virtual int _invokeValueCallback(string value);
186 
200 
201  virtual int _invokeTimedReportCallback(YMeasure value);
202 
203 
204  inline static YHumidity* Find(string func)
205  { return YHumidity::FindHumidity(func); }
206 
214  YHumidity *nextHumidity(void);
215  inline YHumidity *next(void)
216  { return this->nextHumidity();}
217 
227  static YHumidity* FirstHumidity(void);
228  inline static YHumidity* First(void)
229  { return YHumidity::FirstHumidity();}
230 #ifdef __BORLANDC__
231 #pragma option pop
232 #endif
233  //--- (end of YHumidity accessors declaration)
234 };
235 
236 //--- (YHumidity functions declaration)
237 
265 inline YHumidity* yFindHumidity(const string& func)
266 { return YHumidity::FindHumidity(func);}
277 { return YHumidity::FirstHumidity();}
278 
279 //--- (end of YHumidity functions declaration)
280 
281 #endif
YHumidityValueCallback _valueCallbackHumidity
double _relHum
void(* YHumidityValueCallback)(YHumidity *func, const string &functionValue)
static YHumidity * Find(string func)
void(* YHumidityTimedReportCallback)(YHumidity *func, YMeasure measure)
static YHumidity * FindHumidity(string func)
double _absHum
static const double RELHUM_INVALID
YHumidity * yFindHumidity(const string &func)
YHumidity * next(void)
virtual int registerTimedReportCallback(YSensorTimedReportCallback callback)
Definition: yocto_api.cpp:7923
static YHumidity * FirstHumidity(void)
virtual int _invokeTimedReportCallback(YMeasure value)
Definition: yocto_api.cpp:7936
virtual int _invokeValueCallback(string value)
Definition: yocto_api.cpp:7645
double relHum(void)
static YHumidity * First(void)
YHumidity * yFirstHumidity(void)
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
double absHum(void)
YHumidityTimedReportCallback _timedReportCallbackHumidity
int setUnit(const string &newval)
static const double ABSHUM_INVALID


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