yocto_dualpower.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * $Id: yocto_dualpower.h 28748 2017-10-03 08:23:39Z seb $
4  *
5  * Declares yFindDualPower(), the high-level API for DualPower 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_DUALPOWER_H
42 #define YOCTO_DUALPOWER_H
43 
44 #include "yocto_api.h"
45 #include <cfloat>
46 #include <cmath>
47 #include <map>
48 
49 //--- (YDualPower return codes)
50 //--- (end of YDualPower return codes)
51 //--- (YDualPower definitions)
52 class YDualPower; // forward declaration
53 
54 typedef void (*YDualPowerValueCallback)(YDualPower *func, const string& functionValue);
55 #ifndef _Y_POWERSTATE_ENUM
56 #define _Y_POWERSTATE_ENUM
57 typedef enum {
63 #endif
64 #ifndef _Y_POWERCONTROL_ENUM
65 #define _Y_POWERCONTROL_ENUM
66 typedef enum {
73 #endif
74 #define Y_EXTVOLTAGE_INVALID (YAPI_INVALID_UINT)
75 //--- (end of YDualPower definitions)
76 
77 //--- (YDualPower declaration)
88 #ifdef __BORLANDC__
89 #pragma option push -w-8022
90 #endif
91 //--- (end of YDualPower declaration)
92 protected:
93  //--- (YDualPower attributes)
94  // Attributes (function value cache)
99 
100  friend YDualPower *yFindDualPower(const string& func);
101  friend YDualPower *yFirstDualPower(void);
102 
103  // Function-specific method for parsing of JSON output and caching result
104  virtual int _parseAttr(YJSONObject* json_val);
105 
106  // Constructor is protected, use yFindDualPower factory function to instantiate
107  YDualPower(const string& func);
108  //--- (end of YDualPower attributes)
109 
110 public:
111  ~YDualPower();
112  //--- (YDualPower accessors declaration)
113 
114  static const Y_POWERSTATE_enum POWERSTATE_OFF = Y_POWERSTATE_OFF;
115  static const Y_POWERSTATE_enum POWERSTATE_FROM_USB = Y_POWERSTATE_FROM_USB;
116  static const Y_POWERSTATE_enum POWERSTATE_FROM_EXT = Y_POWERSTATE_FROM_EXT;
117  static const Y_POWERSTATE_enum POWERSTATE_INVALID = Y_POWERSTATE_INVALID;
118  static const Y_POWERCONTROL_enum POWERCONTROL_AUTO = Y_POWERCONTROL_AUTO;
119  static const Y_POWERCONTROL_enum POWERCONTROL_FROM_USB = Y_POWERCONTROL_FROM_USB;
120  static const Y_POWERCONTROL_enum POWERCONTROL_FROM_EXT = Y_POWERCONTROL_FROM_EXT;
121  static const Y_POWERCONTROL_enum POWERCONTROL_OFF = Y_POWERCONTROL_OFF;
122  static const Y_POWERCONTROL_enum POWERCONTROL_INVALID = Y_POWERCONTROL_INVALID;
123  static const int EXTVOLTAGE_INVALID = YAPI_INVALID_UINT;
124 
133  Y_POWERSTATE_enum get_powerState(void);
134 
136  { return this->get_powerState(); }
137 
146  Y_POWERCONTROL_enum get_powerControl(void);
147 
149  { return this->get_powerControl(); }
150 
162  int set_powerControl(Y_POWERCONTROL_enum newval);
164  { return this->set_powerControl(newval); }
165 
173  int get_extVoltage(void);
174 
175  inline int extVoltage(void)
176  { return this->get_extVoltage(); }
177 
205  static YDualPower* FindDualPower(string func);
206 
218  virtual int registerValueCallback(YDualPowerValueCallback callback);
220 
221  virtual int _invokeValueCallback(string value);
222 
223 
224  inline static YDualPower* Find(string func)
225  { return YDualPower::FindDualPower(func); }
226 
234  YDualPower *nextDualPower(void);
235  inline YDualPower *next(void)
236  { return this->nextDualPower();}
237 
247  static YDualPower* FirstDualPower(void);
248  inline static YDualPower* First(void)
249  { return YDualPower::FirstDualPower();}
250 #ifdef __BORLANDC__
251 #pragma option pop
252 #endif
253  //--- (end of YDualPower accessors declaration)
254 };
255 
256 //--- (YDualPower functions declaration)
257 
285 inline YDualPower* yFindDualPower(const string& func)
286 { return YDualPower::FindDualPower(func);}
297 { return YDualPower::FirstDualPower();}
298 
299 //--- (end of YDualPower functions declaration)
300 
301 #endif
YDualPower * next(void)
Y_POWERCONTROL_enum
Y_POWERSTATE_enum _powerState
Y_POWERSTATE_enum
int setPowerControl(Y_POWERCONTROL_enum newval)
int extVoltage(void)
static YDualPower * Find(string func)
#define YAPI_INVALID_UINT
Definition: yocto_api.h:71
Y_POWERCONTROL_enum _powerControl
Y_POWERSTATE_enum powerState(void)
void(* YDualPowerValueCallback)(YDualPower *func, const string &functionValue)
virtual int _parseAttr(YJSONObject *json_val)
Definition: yocto_api.cpp:2367
YDualPower * yFirstDualPower(void)
YDualPowerValueCallback _valueCallbackDualPower
virtual int registerValueCallback(YFunctionValueCallback callback)
Definition: yocto_api.cpp:2544
static YDualPower * FindDualPower(string func)
#define YOCTO_CLASS_EXPORT
Definition: yocto_api.h:61
static YDualPower * FirstDualPower(void)
static YDualPower * First(void)
Y_POWERCONTROL_enum powerControl(void)
virtual int _invokeValueCallback(string value)
Definition: yocto_api.cpp:2563
YDualPower * yFindDualPower(const string &func)


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