yocto_altitude.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * $Id: yocto_altitude.h 28748 2017-10-03 08:23:39Z seb $
4  *
5  * Declares yFindAltitude(), the high-level API for Altitude 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_ALTITUDE_H
42 #define YOCTO_ALTITUDE_H
43 
44 #include "yocto_api.h"
45 #include <cfloat>
46 #include <cmath>
47 #include <map>
48 
49 //--- (YAltitude return codes)
50 //--- (end of YAltitude return codes)
51 //--- (YAltitude definitions)
52 class YAltitude; // forward declaration
53 
54 typedef void (*YAltitudeValueCallback)(YAltitude *func, const string& functionValue);
55 class YMeasure; // forward declaration
56 typedef void (*YAltitudeTimedReportCallback)(YAltitude *func, YMeasure measure);
57 #define Y_QNH_INVALID (YAPI_INVALID_DOUBLE)
58 #define Y_TECHNOLOGY_INVALID (YAPI_INVALID_STRING)
59 //--- (end of YAltitude definitions)
60 
61 //--- (YAltitude declaration)
72 #ifdef __BORLANDC__
73 #pragma option push -w-8022
74 #endif
75 //--- (end of YAltitude declaration)
76 protected:
77  //--- (YAltitude attributes)
78  // Attributes (function value cache)
79  double _qnh;
80  string _technology;
83 
84  friend YAltitude *yFindAltitude(const string& func);
85  friend YAltitude *yFirstAltitude(void);
86 
87  // Function-specific method for parsing of JSON output and caching result
88  virtual int _parseAttr(YJSONObject* json_val);
89 
90  // Constructor is protected, use yFindAltitude factory function to instantiate
91  YAltitude(const string& func);
92  //--- (end of YAltitude attributes)
93 
94 public:
95  ~YAltitude();
96  //--- (YAltitude accessors declaration)
97 
98  static const double QNH_INVALID;
99  static const string TECHNOLOGY_INVALID;
100 
111  int set_currentValue(double newval);
112  inline int setCurrentValue(double newval)
113  { return this->set_currentValue(newval); }
114 
128  int set_qnh(double newval);
129  inline int setQnh(double newval)
130  { return this->set_qnh(newval); }
131 
141  double get_qnh(void);
142 
143  inline double qnh(void)
144  { return this->get_qnh(); }
145 
155  string get_technology(void);
156 
157  inline string technology(void)
158  { return this->get_technology(); }
159 
187  static YAltitude* FindAltitude(string func);
188 
200  virtual int registerValueCallback(YAltitudeValueCallback callback);
202 
203  virtual int _invokeValueCallback(string value);
204 
218 
219  virtual int _invokeTimedReportCallback(YMeasure value);
220 
221 
222  inline static YAltitude* Find(string func)
223  { return YAltitude::FindAltitude(func); }
224 
232  YAltitude *nextAltitude(void);
233  inline YAltitude *next(void)
234  { return this->nextAltitude();}
235 
245  static YAltitude* FirstAltitude(void);
246  inline static YAltitude* First(void)
247  { return YAltitude::FirstAltitude();}
248 #ifdef __BORLANDC__
249 #pragma option pop
250 #endif
251  //--- (end of YAltitude accessors declaration)
252 };
253 
254 //--- (YAltitude functions declaration)
255 
283 inline YAltitude* yFindAltitude(const string& func)
284 { return YAltitude::FindAltitude(func);}
295 { return YAltitude::FirstAltitude();}
296 
297 //--- (end of YAltitude functions declaration)
298 
299 #endif
YAltitude * yFirstAltitude(void)
YAltitude * next(void)
int setQnh(double newval)
static YAltitude * First(void)
string _technology
double qnh(void)
int setCurrentValue(double newval)
double _qnh
void(* YAltitudeTimedReportCallback)(YAltitude *func, YMeasure measure)
static YAltitude * FindAltitude(string func)
virtual int registerTimedReportCallback(YSensorTimedReportCallback callback)
Definition: yocto_api.cpp:7923
YAltitude * yFindAltitude(const string &func)
virtual int _invokeTimedReportCallback(YMeasure value)
Definition: yocto_api.cpp:7936
virtual int _invokeValueCallback(string value)
Definition: yocto_api.cpp:7645
static YAltitude * Find(string func)
virtual int _parseAttr(YJSONObject *json_val)
Definition: yocto_api.cpp:7015
virtual int registerValueCallback(YSensorValueCallback callback)
Definition: yocto_api.cpp:7626
static YAltitude * FirstAltitude(void)
#define YOCTO_CLASS_EXPORT
Definition: yocto_api.h:61
static const string TECHNOLOGY_INVALID
string technology(void)
void(* YAltitudeValueCallback)(YAltitude *func, const string &functionValue)
YAltitudeValueCallback _valueCallbackAltitude
static const double QNH_INVALID
YAltitudeTimedReportCallback _timedReportCallbackAltitude


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