yocto_voltage.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * $Id: yocto_voltage.h 28748 2017-10-03 08:23:39Z seb $
4  *
5  * Declares yFindVoltage(), the high-level API for Voltage 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_VOLTAGE_H
42 #define YOCTO_VOLTAGE_H
43 
44 #include "yocto_api.h"
45 #include <cfloat>
46 #include <cmath>
47 #include <map>
48 
49 //--- (YVoltage return codes)
50 //--- (end of YVoltage return codes)
51 //--- (YVoltage definitions)
52 class YVoltage; // forward declaration
53 
54 typedef void (*YVoltageValueCallback)(YVoltage *func, const string& functionValue);
55 class YMeasure; // forward declaration
56 typedef void (*YVoltageTimedReportCallback)(YVoltage *func, YMeasure measure);
57 #ifndef _Y_ENABLED_ENUM
58 #define _Y_ENABLED_ENUM
59 typedef enum {
64 #endif
65 //--- (end of YVoltage definitions)
66 
67 //--- (YVoltage declaration)
76 #ifdef __BORLANDC__
77 #pragma option push -w-8022
78 #endif
79 //--- (end of YVoltage declaration)
80 protected:
81  //--- (YVoltage attributes)
82  // Attributes (function value cache)
86 
87  friend YVoltage *yFindVoltage(const string& func);
88  friend YVoltage *yFirstVoltage(void);
89 
90  // Function-specific method for parsing of JSON output and caching result
91  virtual int _parseAttr(YJSONObject* json_val);
92 
93  // Constructor is protected, use yFindVoltage factory function to instantiate
94  YVoltage(const string& func);
95  //--- (end of YVoltage attributes)
96 
97 public:
98  ~YVoltage();
99  //--- (YVoltage accessors declaration)
100 
101  static const Y_ENABLED_enum ENABLED_FALSE = Y_ENABLED_FALSE;
102  static const Y_ENABLED_enum ENABLED_TRUE = Y_ENABLED_TRUE;
103  static const Y_ENABLED_enum ENABLED_INVALID = Y_ENABLED_INVALID;
104 
105  Y_ENABLED_enum get_enabled(void);
106 
107  inline Y_ENABLED_enum enabled(void)
108  { return this->get_enabled(); }
109 
110  int set_enabled(Y_ENABLED_enum newval);
111  inline int setEnabled(Y_ENABLED_enum newval)
112  { return this->set_enabled(newval); }
113 
141  static YVoltage* FindVoltage(string func);
142 
154  virtual int registerValueCallback(YVoltageValueCallback callback);
156 
157  virtual int _invokeValueCallback(string value);
158 
172 
173  virtual int _invokeTimedReportCallback(YMeasure value);
174 
175 
176  inline static YVoltage* Find(string func)
177  { return YVoltage::FindVoltage(func); }
178 
186  YVoltage *nextVoltage(void);
187  inline YVoltage *next(void)
188  { return this->nextVoltage();}
189 
199  static YVoltage* FirstVoltage(void);
200  inline static YVoltage* First(void)
201  { return YVoltage::FirstVoltage();}
202 #ifdef __BORLANDC__
203 #pragma option pop
204 #endif
205  //--- (end of YVoltage accessors declaration)
206 };
207 
208 //--- (YVoltage functions declaration)
209 
237 inline YVoltage* yFindVoltage(const string& func)
238 { return YVoltage::FindVoltage(func);}
248 inline YVoltage* yFirstVoltage(void)
249 { return YVoltage::FirstVoltage();}
250 
251 //--- (end of YVoltage functions declaration)
252 
253 #endif
int setEnabled(Y_ENABLED_enum newval)
static YVoltage * First(void)
Y_ENABLED_enum
Definition: yocto_current.h:59
Y_ENABLED_enum enabled(void)
static YVoltage * Find(string func)
Y_ENABLED_enum
Definition: yocto_voltage.h:59
virtual int registerTimedReportCallback(YSensorTimedReportCallback callback)
Definition: yocto_api.cpp:7923
Y_ENABLED_enum _enabled
Definition: yocto_voltage.h:83
virtual int _invokeTimedReportCallback(YMeasure value)
Definition: yocto_api.cpp:7936
virtual int _invokeValueCallback(string value)
Definition: yocto_api.cpp:7645
virtual int _parseAttr(YJSONObject *json_val)
Definition: yocto_api.cpp:7015
static YVoltage * FirstVoltage(void)
virtual int registerValueCallback(YSensorValueCallback callback)
Definition: yocto_api.cpp:7626
void(* YVoltageTimedReportCallback)(YVoltage *func, YMeasure measure)
Definition: yocto_voltage.h:56
#define YOCTO_CLASS_EXPORT
Definition: yocto_api.h:61
YVoltage * next(void)
static YVoltage * FindVoltage(string func)
YVoltageTimedReportCallback _timedReportCallbackVoltage
Definition: yocto_voltage.h:85
YVoltageValueCallback _valueCallbackVoltage
Definition: yocto_voltage.h:84
void(* YVoltageValueCallback)(YVoltage *func, const string &functionValue)
Definition: yocto_voltage.h:54
YVoltage * yFirstVoltage(void)
YVoltage * yFindVoltage(const string &func)


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