yocto_powersupply.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * $Id: yocto_powersupply.h 28748 2017-10-03 08:23:39Z seb $
4  *
5  * Declares yFindPowerSupply(), the high-level API for PowerSupply 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_POWERSUPPLY_H
42 #define YOCTO_POWERSUPPLY_H
43 
44 #include "yocto_api.h"
45 #include <cfloat>
46 #include <cmath>
47 #include <map>
48 
49 //--- (YPowerSupply return codes)
50 //--- (end of YPowerSupply return codes)
51 //--- (YPowerSupply definitions)
52 class YPowerSupply; // forward declaration
53 
54 typedef void (*YPowerSupplyValueCallback)(YPowerSupply *func, const string& functionValue);
55 #ifndef _Y_POWEROUTPUT_ENUM
56 #define _Y_POWEROUTPUT_ENUM
57 typedef enum {
62 #endif
63 #ifndef _Y_VOLTAGESENSE_ENUM
64 #define _Y_VOLTAGESENSE_ENUM
65 typedef enum {
70 #endif
71 #define Y_VOLTAGESETPOINT_INVALID (YAPI_INVALID_DOUBLE)
72 #define Y_CURRENTLIMIT_INVALID (YAPI_INVALID_DOUBLE)
73 #define Y_MEASUREDVOLTAGE_INVALID (YAPI_INVALID_DOUBLE)
74 #define Y_MEASUREDCURRENT_INVALID (YAPI_INVALID_DOUBLE)
75 #define Y_INPUTVOLTAGE_INVALID (YAPI_INVALID_DOUBLE)
76 #define Y_VINT_INVALID (YAPI_INVALID_DOUBLE)
77 #define Y_LDOTEMPERATURE_INVALID (YAPI_INVALID_DOUBLE)
78 #define Y_VOLTAGETRANSITION_INVALID (YAPI_INVALID_STRING)
79 #define Y_VOLTAGEATSTARTUP_INVALID (YAPI_INVALID_DOUBLE)
80 #define Y_CURRENTATSTARTUP_INVALID (YAPI_INVALID_DOUBLE)
81 #define Y_COMMAND_INVALID (YAPI_INVALID_STRING)
82 //--- (end of YPowerSupply definitions)
83 
84 //--- (YPowerSupply declaration)
92 #ifdef __BORLANDC__
93 #pragma option push -w-8022
94 #endif
95 //--- (end of YPowerSupply declaration)
96 protected:
97  //--- (YPowerSupply attributes)
98  // Attributes (function value cache)
106  double _vInt;
111  string _command;
113 
114  friend YPowerSupply *yFindPowerSupply(const string& func);
115  friend YPowerSupply *yFirstPowerSupply(void);
116 
117  // Function-specific method for parsing of JSON output and caching result
118  virtual int _parseAttr(YJSONObject* json_val);
119 
120  // Constructor is protected, use yFindPowerSupply factory function to instantiate
121  YPowerSupply(const string& func);
122  //--- (end of YPowerSupply attributes)
123 
124 public:
125  ~YPowerSupply();
126  //--- (YPowerSupply accessors declaration)
127 
128  static const double VOLTAGESETPOINT_INVALID;
129  static const double CURRENTLIMIT_INVALID;
130  static const Y_POWEROUTPUT_enum POWEROUTPUT_OFF = Y_POWEROUTPUT_OFF;
131  static const Y_POWEROUTPUT_enum POWEROUTPUT_ON = Y_POWEROUTPUT_ON;
132  static const Y_POWEROUTPUT_enum POWEROUTPUT_INVALID = Y_POWEROUTPUT_INVALID;
133  static const Y_VOLTAGESENSE_enum VOLTAGESENSE_INT = Y_VOLTAGESENSE_INT;
134  static const Y_VOLTAGESENSE_enum VOLTAGESENSE_EXT = Y_VOLTAGESENSE_EXT;
135  static const Y_VOLTAGESENSE_enum VOLTAGESENSE_INVALID = Y_VOLTAGESENSE_INVALID;
136  static const double MEASUREDVOLTAGE_INVALID;
137  static const double MEASUREDCURRENT_INVALID;
138  static const double INPUTVOLTAGE_INVALID;
139  static const double VINT_INVALID;
140  static const double LDOTEMPERATURE_INVALID;
141  static const string VOLTAGETRANSITION_INVALID;
142  static const double VOLTAGEATSTARTUP_INVALID;
143  static const double CURRENTATSTARTUP_INVALID;
144  static const string COMMAND_INVALID;
145 
155  int set_voltageSetPoint(double newval);
156  inline int setVoltageSetPoint(double newval)
157  { return this->set_voltageSetPoint(newval); }
158 
166  double get_voltageSetPoint(void);
167 
168  inline double voltageSetPoint(void)
169  { return this->get_voltageSetPoint(); }
170 
180  int set_currentLimit(double newval);
181  inline int setCurrentLimit(double newval)
182  { return this->set_currentLimit(newval); }
183 
191  double get_currentLimit(void);
192 
193  inline double currentLimit(void)
194  { return this->get_currentLimit(); }
195 
203  Y_POWEROUTPUT_enum get_powerOutput(void);
204 
206  { return this->get_powerOutput(); }
207 
217  int set_powerOutput(Y_POWEROUTPUT_enum newval);
219  { return this->set_powerOutput(newval); }
220 
228  Y_VOLTAGESENSE_enum get_voltageSense(void);
229 
231  { return this->get_voltageSense(); }
232 
242  int set_voltageSense(Y_VOLTAGESENSE_enum newval);
244  { return this->set_voltageSense(newval); }
245 
253  double get_measuredVoltage(void);
254 
255  inline double measuredVoltage(void)
256  { return this->get_measuredVoltage(); }
257 
265  double get_measuredCurrent(void);
266 
267  inline double measuredCurrent(void)
268  { return this->get_measuredCurrent(); }
269 
277  double get_inputVoltage(void);
278 
279  inline double inputVoltage(void)
280  { return this->get_inputVoltage(); }
281 
289  double get_vInt(void);
290 
291  inline double vInt(void)
292  { return this->get_vInt(); }
293 
301  double get_ldoTemperature(void);
302 
303  inline double ldoTemperature(void)
304  { return this->get_ldoTemperature(); }
305 
306  string get_voltageTransition(void);
307 
308  inline string voltageTransition(void)
309  { return this->get_voltageTransition(); }
310 
311  int set_voltageTransition(const string& newval);
312  inline int setVoltageTransition(const string& newval)
313  { return this->set_voltageTransition(newval); }
314 
325  int set_voltageAtStartUp(double newval);
326  inline int setVoltageAtStartUp(double newval)
327  { return this->set_voltageAtStartUp(newval); }
328 
336  double get_voltageAtStartUp(void);
337 
338  inline double voltageAtStartUp(void)
339  { return this->get_voltageAtStartUp(); }
340 
351  int set_currentAtStartUp(double newval);
352  inline int setCurrentAtStartUp(double newval)
353  { return this->set_currentAtStartUp(newval); }
354 
362  double get_currentAtStartUp(void);
363 
364  inline double currentAtStartUp(void)
365  { return this->get_currentAtStartUp(); }
366 
367  string get_command(void);
368 
369  inline string command(void)
370  { return this->get_command(); }
371 
372  int set_command(const string& newval);
373  inline int setCommand(const string& newval)
374  { return this->set_command(newval); }
375 
403  static YPowerSupply* FindPowerSupply(string func);
404 
416  virtual int registerValueCallback(YPowerSupplyValueCallback callback);
418 
419  virtual int _invokeValueCallback(string value);
420 
431  virtual int voltageMove(double V_target,int ms_duration);
432 
433 
434  inline static YPowerSupply* Find(string func)
435  { return YPowerSupply::FindPowerSupply(func); }
436 
444  YPowerSupply *nextPowerSupply(void);
445  inline YPowerSupply *next(void)
446  { return this->nextPowerSupply();}
447 
457  static YPowerSupply* FirstPowerSupply(void);
458  inline static YPowerSupply* First(void)
459  { return YPowerSupply::FirstPowerSupply();}
460 #ifdef __BORLANDC__
461 #pragma option pop
462 #endif
463  //--- (end of YPowerSupply accessors declaration)
464 };
465 
466 //--- (YPowerSupply functions declaration)
467 
495 inline YPowerSupply* yFindPowerSupply(const string& func)
496 { return YPowerSupply::FindPowerSupply(func);}
508 
509 //--- (end of YPowerSupply functions declaration)
510 
511 #endif
YPowerSupplyValueCallback _valueCallbackPowerSupply
int setCommand(const string &newval)
static const double CURRENTLIMIT_INVALID
double _currentAtStartUp
double vInt(void)
static const double CURRENTATSTARTUP_INVALID
void(* YPowerSupplyValueCallback)(YPowerSupply *func, const string &functionValue)
YPowerSupply * yFindPowerSupply(const string &func)
Y_POWEROUTPUT_enum powerOutput(void)
Y_VOLTAGESENSE_enum
static const double INPUTVOLTAGE_INVALID
static const string VOLTAGETRANSITION_INVALID
YPowerSupply * next(void)
static const double LDOTEMPERATURE_INVALID
string command(void)
static const double VINT_INVALID
static YPowerSupply * FirstPowerSupply(void)
double currentAtStartUp(void)
static YPowerSupply * First(void)
double _voltageSetPoint
static const double MEASUREDVOLTAGE_INVALID
double measuredCurrent(void)
int setPowerOutput(Y_POWEROUTPUT_enum newval)
double _voltageAtStartUp
int setVoltageSetPoint(double newval)
virtual int _parseAttr(YJSONObject *json_val)
Definition: yocto_api.cpp:2367
static const double VOLTAGESETPOINT_INVALID
int setCurrentLimit(double newval)
string _voltageTransition
int setCurrentAtStartUp(double newval)
Y_POWEROUTPUT_enum _powerOutput
int setVoltageTransition(const string &newval)
YPowerSupply * yFirstPowerSupply(void)
static const string COMMAND_INVALID
virtual int registerValueCallback(YFunctionValueCallback callback)
Definition: yocto_api.cpp:2544
int setVoltageAtStartUp(double newval)
static YPowerSupply * FindPowerSupply(string func)
static const double MEASUREDCURRENT_INVALID
#define YOCTO_CLASS_EXPORT
Definition: yocto_api.h:61
double currentLimit(void)
Y_VOLTAGESENSE_enum _voltageSense
double voltageAtStartUp(void)
double voltageSetPoint(void)
string voltageTransition(void)
double inputVoltage(void)
Y_VOLTAGESENSE_enum voltageSense(void)
static YPowerSupply * Find(string func)
Y_POWEROUTPUT_enum
int setVoltageSense(Y_VOLTAGESENSE_enum newval)
double ldoTemperature(void)
static const double VOLTAGEATSTARTUP_INVALID
virtual int _invokeValueCallback(string value)
Definition: yocto_api.cpp:2563
double measuredVoltage(void)


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