yocto_anbutton.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * $Id: yocto_anbutton.h 28748 2017-10-03 08:23:39Z seb $
4  *
5  * Declares yFindAnButton(), the high-level API for AnButton 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_ANBUTTON_H
42 #define YOCTO_ANBUTTON_H
43 
44 #include "yocto_api.h"
45 #include <cfloat>
46 #include <cmath>
47 #include <map>
48 
49 //--- (YAnButton return codes)
50 //--- (end of YAnButton return codes)
51 //--- (YAnButton definitions)
52 class YAnButton; // forward declaration
53 
54 typedef void (*YAnButtonValueCallback)(YAnButton *func, const string& functionValue);
55 #ifndef _Y_ANALOGCALIBRATION_ENUM
56 #define _Y_ANALOGCALIBRATION_ENUM
57 typedef enum {
62 #endif
63 #ifndef _Y_ISPRESSED_ENUM
64 #define _Y_ISPRESSED_ENUM
65 typedef enum {
70 #endif
71 #define Y_CALIBRATEDVALUE_INVALID (YAPI_INVALID_UINT)
72 #define Y_RAWVALUE_INVALID (YAPI_INVALID_UINT)
73 #define Y_CALIBRATIONMAX_INVALID (YAPI_INVALID_UINT)
74 #define Y_CALIBRATIONMIN_INVALID (YAPI_INVALID_UINT)
75 #define Y_SENSITIVITY_INVALID (YAPI_INVALID_UINT)
76 #define Y_LASTTIMEPRESSED_INVALID (YAPI_INVALID_LONG)
77 #define Y_LASTTIMERELEASED_INVALID (YAPI_INVALID_LONG)
78 #define Y_PULSECOUNTER_INVALID (YAPI_INVALID_LONG)
79 #define Y_PULSETIMER_INVALID (YAPI_INVALID_LONG)
80 //--- (end of YAnButton definitions)
81 
82 //--- (YAnButton declaration)
94 #ifdef __BORLANDC__
95 #pragma option push -w-8022
96 #endif
97 //--- (end of YAnButton declaration)
98 protected:
99  //--- (YAnButton attributes)
100  // Attributes (function value cache)
113 
114  friend YAnButton *yFindAnButton(const string& func);
115  friend YAnButton *yFirstAnButton(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 yFindAnButton factory function to instantiate
121  YAnButton(const string& func);
122  //--- (end of YAnButton attributes)
123 
124 public:
125  ~YAnButton();
126  //--- (YAnButton accessors declaration)
127 
128  static const int CALIBRATEDVALUE_INVALID = YAPI_INVALID_UINT;
129  static const int RAWVALUE_INVALID = YAPI_INVALID_UINT;
130  static const Y_ANALOGCALIBRATION_enum ANALOGCALIBRATION_OFF = Y_ANALOGCALIBRATION_OFF;
131  static const Y_ANALOGCALIBRATION_enum ANALOGCALIBRATION_ON = Y_ANALOGCALIBRATION_ON;
132  static const Y_ANALOGCALIBRATION_enum ANALOGCALIBRATION_INVALID = Y_ANALOGCALIBRATION_INVALID;
133  static const int CALIBRATIONMAX_INVALID = YAPI_INVALID_UINT;
134  static const int CALIBRATIONMIN_INVALID = YAPI_INVALID_UINT;
135  static const int SENSITIVITY_INVALID = YAPI_INVALID_UINT;
136  static const Y_ISPRESSED_enum ISPRESSED_FALSE = Y_ISPRESSED_FALSE;
137  static const Y_ISPRESSED_enum ISPRESSED_TRUE = Y_ISPRESSED_TRUE;
138  static const Y_ISPRESSED_enum ISPRESSED_INVALID = Y_ISPRESSED_INVALID;
139  static const s64 LASTTIMEPRESSED_INVALID = YAPI_INVALID_LONG;
140  static const s64 LASTTIMERELEASED_INVALID = YAPI_INVALID_LONG;
141  static const s64 PULSECOUNTER_INVALID = YAPI_INVALID_LONG;
142  static const s64 PULSETIMER_INVALID = YAPI_INVALID_LONG;
143 
151  int get_calibratedValue(void);
152 
153  inline int calibratedValue(void)
154  { return this->get_calibratedValue(); }
155 
163  int get_rawValue(void);
164 
165  inline int rawValue(void)
166  { return this->get_rawValue(); }
167 
175  Y_ANALOGCALIBRATION_enum get_analogCalibration(void);
176 
178  { return this->get_analogCalibration(); }
179 
190  int set_analogCalibration(Y_ANALOGCALIBRATION_enum newval);
192  { return this->set_analogCalibration(newval); }
193 
202  int get_calibrationMax(void);
203 
204  inline int calibrationMax(void)
205  { return this->get_calibrationMax(); }
206 
220  int set_calibrationMax(int newval);
221  inline int setCalibrationMax(int newval)
222  { return this->set_calibrationMax(newval); }
223 
232  int get_calibrationMin(void);
233 
234  inline int calibrationMin(void)
235  { return this->get_calibrationMin(); }
236 
250  int set_calibrationMin(int newval);
251  inline int setCalibrationMin(int newval)
252  { return this->set_calibrationMin(newval); }
253 
262  int get_sensitivity(void);
263 
264  inline int sensitivity(void)
265  { return this->get_sensitivity(); }
266 
282  int set_sensitivity(int newval);
283  inline int setSensitivity(int newval)
284  { return this->set_sensitivity(newval); }
285 
294  Y_ISPRESSED_enum get_isPressed(void);
295 
297  { return this->get_isPressed(); }
298 
309  s64 get_lastTimePressed(void);
310 
311  inline s64 lastTimePressed(void)
312  { return this->get_lastTimePressed(); }
313 
324  s64 get_lastTimeReleased(void);
325 
326  inline s64 lastTimeReleased(void)
327  { return this->get_lastTimeReleased(); }
328 
338  s64 get_pulseCounter(void);
339 
340  inline s64 pulseCounter(void)
341  { return this->get_pulseCounter(); }
342 
343  int set_pulseCounter(s64 newval);
344  inline int setPulseCounter(s64 newval)
345  { return this->set_pulseCounter(newval); }
346 
354  s64 get_pulseTimer(void);
355 
356  inline s64 pulseTimer(void)
357  { return this->get_pulseTimer(); }
358 
386  static YAnButton* FindAnButton(string func);
387 
399  virtual int registerValueCallback(YAnButtonValueCallback callback);
401 
402  virtual int _invokeValueCallback(string value);
403 
411  virtual int resetCounter(void);
412 
413 
414  inline static YAnButton* Find(string func)
415  { return YAnButton::FindAnButton(func); }
416 
424  YAnButton *nextAnButton(void);
425  inline YAnButton *next(void)
426  { return this->nextAnButton();}
427 
437  static YAnButton* FirstAnButton(void);
438  inline static YAnButton* First(void)
439  { return YAnButton::FirstAnButton();}
440 #ifdef __BORLANDC__
441 #pragma option pop
442 #endif
443  //--- (end of YAnButton accessors declaration)
444 };
445 
446 //--- (YAnButton functions declaration)
447 
475 inline YAnButton* yFindAnButton(const string& func)
476 { return YAnButton::FindAnButton(func);}
487 { return YAnButton::FirstAnButton();}
488 
489 //--- (end of YAnButton functions declaration)
490 
491 #endif
s64 _lastTimeReleased
Y_ANALOGCALIBRATION_enum
Y_ISPRESSED_enum isPressed(void)
Y_ANALOGCALIBRATION_enum _analogCalibration
Y_ISPRESSED_enum _isPressed
YAnButton * yFirstAnButton(void)
static YAnButton * Find(string func)
#define YAPI_INVALID_LONG
Definition: yocto_api.h:72
int rawValue(void)
int _calibrationMax
YAnButton * yFindAnButton(const string &func)
int _calibratedValue
int setCalibrationMax(int newval)
int sensitivity(void)
#define YAPI_INVALID_UINT
Definition: yocto_api.h:71
int setSensitivity(int newval)
s64 pulseTimer(void)
s64 pulseCounter(void)
virtual int _parseAttr(YJSONObject *json_val)
Definition: yocto_api.cpp:2367
Y_ISPRESSED_enum
s64 lastTimeReleased(void)
static YAnButton * FirstAnButton(void)
int calibrationMax(void)
int setAnalogCalibration(Y_ANALOGCALIBRATION_enum newval)
YAnButtonValueCallback _valueCallbackAnButton
virtual int registerValueCallback(YFunctionValueCallback callback)
Definition: yocto_api.cpp:2544
int setCalibrationMin(int newval)
void(* YAnButtonValueCallback)(YAnButton *func, const string &functionValue)
#define YOCTO_CLASS_EXPORT
Definition: yocto_api.h:61
int calibratedValue(void)
int _calibrationMin
static YAnButton * FindAnButton(string func)
Y_ANALOGCALIBRATION_enum analogCalibration(void)
static YAnButton * First(void)
int calibrationMin(void)
s64 lastTimePressed(void)
int setPulseCounter(s64 newval)
YAnButton * next(void)
s64 _lastTimePressed
virtual int _invokeValueCallback(string value)
Definition: yocto_api.cpp:2563


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