yocto_pwmpowersource.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * $Id: yocto_pwmpowersource.h 28748 2017-10-03 08:23:39Z seb $
4  *
5  * Declares yFindPwmPowerSource(), the high-level API for PwmPowerSource 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_PWMPOWERSOURCE_H
42 #define YOCTO_PWMPOWERSOURCE_H
43 
44 #include "yocto_api.h"
45 #include <cfloat>
46 #include <cmath>
47 #include <map>
48 
49 //--- (YPwmPowerSource return codes)
50 //--- (end of YPwmPowerSource return codes)
51 //--- (YPwmPowerSource definitions)
52 class YPwmPowerSource; // forward declaration
53 
54 typedef void (*YPwmPowerSourceValueCallback)(YPwmPowerSource *func, const string& functionValue);
55 #ifndef _Y_POWERMODE_ENUM
56 #define _Y_POWERMODE_ENUM
57 typedef enum {
64 #endif
65 //--- (end of YPwmPowerSource definitions)
66 
67 //--- (YPwmPowerSource declaration)
75 #ifdef __BORLANDC__
76 #pragma option push -w-8022
77 #endif
78 //--- (end of YPwmPowerSource declaration)
79 protected:
80  //--- (YPwmPowerSource attributes)
81  // Attributes (function value cache)
84 
85  friend YPwmPowerSource *yFindPwmPowerSource(const string& func);
87 
88  // Function-specific method for parsing of JSON output and caching result
89  virtual int _parseAttr(YJSONObject* json_val);
90 
91  // Constructor is protected, use yFindPwmPowerSource factory function to instantiate
92  YPwmPowerSource(const string& func);
93  //--- (end of YPwmPowerSource attributes)
94 
95 public:
96  ~YPwmPowerSource();
97  //--- (YPwmPowerSource accessors declaration)
98 
99  static const Y_POWERMODE_enum POWERMODE_USB_5V = Y_POWERMODE_USB_5V;
100  static const Y_POWERMODE_enum POWERMODE_USB_3V = Y_POWERMODE_USB_3V;
101  static const Y_POWERMODE_enum POWERMODE_EXT_V = Y_POWERMODE_EXT_V;
102  static const Y_POWERMODE_enum POWERMODE_OPNDRN = Y_POWERMODE_OPNDRN;
103  static const Y_POWERMODE_enum POWERMODE_INVALID = Y_POWERMODE_INVALID;
104 
113  Y_POWERMODE_enum get_powerMode(void);
114 
116  { return this->get_powerMode(); }
117 
134  int set_powerMode(Y_POWERMODE_enum newval);
135  inline int setPowerMode(Y_POWERMODE_enum newval)
136  { return this->set_powerMode(newval); }
137 
165  static YPwmPowerSource* FindPwmPowerSource(string func);
166 
180 
181  virtual int _invokeValueCallback(string value);
182 
183 
184  inline static YPwmPowerSource* Find(string func)
185  { return YPwmPowerSource::FindPwmPowerSource(func); }
186 
194  YPwmPowerSource *nextPwmPowerSource(void);
195  inline YPwmPowerSource *next(void)
196  { return this->nextPwmPowerSource();}
197 
207  static YPwmPowerSource* FirstPwmPowerSource(void);
208  inline static YPwmPowerSource* First(void)
210 #ifdef __BORLANDC__
211 #pragma option pop
212 #endif
213  //--- (end of YPwmPowerSource accessors declaration)
214 };
215 
216 //--- (YPwmPowerSource functions declaration)
217 
245 inline YPwmPowerSource* yFindPwmPowerSource(const string& func)
258 
259 //--- (end of YPwmPowerSource functions declaration)
260 
261 #endif
static YPwmPowerSource * Find(string func)
static YPwmPowerSource * First(void)
Y_POWERMODE_enum
static YPwmPowerSource * FindPwmPowerSource(string func)
int setPowerMode(Y_POWERMODE_enum newval)
Y_POWERMODE_enum powerMode(void)
virtual int _parseAttr(YJSONObject *json_val)
Definition: yocto_api.cpp:2367
YPwmPowerSource * yFindPwmPowerSource(const string &func)
YPwmPowerSource * yFirstPwmPowerSource(void)
Y_POWERMODE_enum _powerMode
virtual int registerValueCallback(YFunctionValueCallback callback)
Definition: yocto_api.cpp:2544
YPwmPowerSource * next(void)
#define YOCTO_CLASS_EXPORT
Definition: yocto_api.h:61
YPwmPowerSourceValueCallback _valueCallbackPwmPowerSource
void(* YPwmPowerSourceValueCallback)(YPwmPowerSource *func, const string &functionValue)
static YPwmPowerSource * FirstPwmPowerSource(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