yocto_poweroutput.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * $Id: yocto_poweroutput.h 28748 2017-10-03 08:23:39Z seb $
4  *
5  * Declares yFindPowerOutput(), the high-level API for PowerOutput 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_POWEROUTPUT_H
42 #define YOCTO_POWEROUTPUT_H
43 
44 #include "yocto_api.h"
45 #include <cfloat>
46 #include <cmath>
47 #include <map>
48 
49 //--- (YPowerOutput return codes)
50 //--- (end of YPowerOutput return codes)
51 //--- (YPowerOutput definitions)
52 class YPowerOutput; // forward declaration
53 
54 typedef void (*YPowerOutputValueCallback)(YPowerOutput *func, const string& functionValue);
55 #ifndef _Y_VOLTAGE_ENUM
56 #define _Y_VOLTAGE_ENUM
57 typedef enum {
63 #endif
64 //--- (end of YPowerOutput definitions)
65 
66 //--- (YPowerOutput declaration)
74 #ifdef __BORLANDC__
75 #pragma option push -w-8022
76 #endif
77 //--- (end of YPowerOutput declaration)
78 protected:
79  //--- (YPowerOutput attributes)
80  // Attributes (function value cache)
83 
84  friend YPowerOutput *yFindPowerOutput(const string& func);
85  friend YPowerOutput *yFirstPowerOutput(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 yFindPowerOutput factory function to instantiate
91  YPowerOutput(const string& func);
92  //--- (end of YPowerOutput attributes)
93 
94 public:
95  ~YPowerOutput();
96  //--- (YPowerOutput accessors declaration)
97 
98  static const Y_VOLTAGE_enum VOLTAGE_OFF = Y_VOLTAGE_OFF;
99  static const Y_VOLTAGE_enum VOLTAGE_OUT3V3 = Y_VOLTAGE_OUT3V3;
100  static const Y_VOLTAGE_enum VOLTAGE_OUT5V = Y_VOLTAGE_OUT5V;
101  static const Y_VOLTAGE_enum VOLTAGE_INVALID = Y_VOLTAGE_INVALID;
102 
111  Y_VOLTAGE_enum get_voltage(void);
112 
113  inline Y_VOLTAGE_enum voltage(void)
114  { return this->get_voltage(); }
115 
129  int set_voltage(Y_VOLTAGE_enum newval);
130  inline int setVoltage(Y_VOLTAGE_enum newval)
131  { return this->set_voltage(newval); }
132 
160  static YPowerOutput* FindPowerOutput(string func);
161 
173  virtual int registerValueCallback(YPowerOutputValueCallback callback);
175 
176  virtual int _invokeValueCallback(string value);
177 
178 
179  inline static YPowerOutput* Find(string func)
180  { return YPowerOutput::FindPowerOutput(func); }
181 
189  YPowerOutput *nextPowerOutput(void);
190  inline YPowerOutput *next(void)
191  { return this->nextPowerOutput();}
192 
202  static YPowerOutput* FirstPowerOutput(void);
203  inline static YPowerOutput* First(void)
204  { return YPowerOutput::FirstPowerOutput();}
205 #ifdef __BORLANDC__
206 #pragma option pop
207 #endif
208  //--- (end of YPowerOutput accessors declaration)
209 };
210 
211 //--- (YPowerOutput functions declaration)
212 
240 inline YPowerOutput* yFindPowerOutput(const string& func)
241 { return YPowerOutput::FindPowerOutput(func);}
253 
254 //--- (end of YPowerOutput functions declaration)
255 
256 #endif
void(* YPowerOutputValueCallback)(YPowerOutput *func, const string &functionValue)
static YPowerOutput * Find(string func)
YPowerOutput * yFindPowerOutput(const string &func)
Y_VOLTAGE_enum _voltage
int setVoltage(Y_VOLTAGE_enum newval)
YPowerOutput * next(void)
Y_VOLTAGE_enum voltage(void)
virtual int _parseAttr(YJSONObject *json_val)
Definition: yocto_api.cpp:2367
static YPowerOutput * FindPowerOutput(string func)
Y_VOLTAGE_enum
virtual int registerValueCallback(YFunctionValueCallback callback)
Definition: yocto_api.cpp:2544
YPowerOutput * yFirstPowerOutput(void)
#define YOCTO_CLASS_EXPORT
Definition: yocto_api.h:61
static YPowerOutput * First(void)
YPowerOutputValueCallback _valueCallbackPowerOutput
static YPowerOutput * FirstPowerOutput(void)
virtual int _invokeValueCallback(string value)
Definition: yocto_api.cpp:2563


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