yocto_accelerometer.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * $Id: yocto_accelerometer.h 28748 2017-10-03 08:23:39Z seb $
4  *
5  * Declares yFindAccelerometer(), the high-level API for Accelerometer 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_ACCELEROMETER_H
42 #define YOCTO_ACCELEROMETER_H
43 
44 #include "yocto_api.h"
45 #include <cfloat>
46 #include <cmath>
47 #include <map>
48 
49 //--- (YAccelerometer return codes)
50 //--- (end of YAccelerometer return codes)
51 //--- (YAccelerometer definitions)
52 class YAccelerometer; // forward declaration
53 
54 typedef void (*YAccelerometerValueCallback)(YAccelerometer *func, const string& functionValue);
55 class YMeasure; // forward declaration
57 #ifndef _Y_GRAVITYCANCELLATION_ENUM
58 #define _Y_GRAVITYCANCELLATION_ENUM
59 typedef enum {
64 #endif
65 #define Y_BANDWIDTH_INVALID (YAPI_INVALID_INT)
66 #define Y_XVALUE_INVALID (YAPI_INVALID_DOUBLE)
67 #define Y_YVALUE_INVALID (YAPI_INVALID_DOUBLE)
68 #define Y_ZVALUE_INVALID (YAPI_INVALID_DOUBLE)
69 //--- (end of YAccelerometer definitions)
70 
71 //--- (YAccelerometer declaration)
86 #ifdef __BORLANDC__
87 #pragma option push -w-8022
88 #endif
89 //--- (end of YAccelerometer declaration)
90 protected:
91  //--- (YAccelerometer attributes)
92  // Attributes (function value cache)
94  double _xValue;
95  double _yValue;
96  double _zValue;
100 
101  friend YAccelerometer *yFindAccelerometer(const string& func);
102  friend YAccelerometer *yFirstAccelerometer(void);
103 
104  // Function-specific method for parsing of JSON output and caching result
105  virtual int _parseAttr(YJSONObject* json_val);
106 
107  // Constructor is protected, use yFindAccelerometer factory function to instantiate
108  YAccelerometer(const string& func);
109  //--- (end of YAccelerometer attributes)
110 
111 public:
112  ~YAccelerometer();
113  //--- (YAccelerometer accessors declaration)
114 
115  static const int BANDWIDTH_INVALID = YAPI_INVALID_INT;
116  static const double XVALUE_INVALID;
117  static const double YVALUE_INVALID;
118  static const double ZVALUE_INVALID;
119  static const Y_GRAVITYCANCELLATION_enum GRAVITYCANCELLATION_OFF = Y_GRAVITYCANCELLATION_OFF;
120  static const Y_GRAVITYCANCELLATION_enum GRAVITYCANCELLATION_ON = Y_GRAVITYCANCELLATION_ON;
121  static const Y_GRAVITYCANCELLATION_enum GRAVITYCANCELLATION_INVALID = Y_GRAVITYCANCELLATION_INVALID;
122 
130  int get_bandwidth(void);
131 
132  inline int bandwidth(void)
133  { return this->get_bandwidth(); }
134 
145  int set_bandwidth(int newval);
146  inline int setBandwidth(int newval)
147  { return this->set_bandwidth(newval); }
148 
156  double get_xValue(void);
157 
158  inline double xValue(void)
159  { return this->get_xValue(); }
160 
168  double get_yValue(void);
169 
170  inline double yValue(void)
171  { return this->get_yValue(); }
172 
180  double get_zValue(void);
181 
182  inline double zValue(void)
183  { return this->get_zValue(); }
184 
185  Y_GRAVITYCANCELLATION_enum get_gravityCancellation(void);
186 
188  { return this->get_gravityCancellation(); }
189 
190  int set_gravityCancellation(Y_GRAVITYCANCELLATION_enum newval);
192  { return this->set_gravityCancellation(newval); }
193 
221  static YAccelerometer* FindAccelerometer(string func);
222 
236 
237  virtual int _invokeValueCallback(string value);
238 
252 
253  virtual int _invokeTimedReportCallback(YMeasure value);
254 
255 
256  inline static YAccelerometer* Find(string func)
257  { return YAccelerometer::FindAccelerometer(func); }
258 
266  YAccelerometer *nextAccelerometer(void);
267  inline YAccelerometer *next(void)
268  { return this->nextAccelerometer();}
269 
279  static YAccelerometer* FirstAccelerometer(void);
280  inline static YAccelerometer* First(void)
282 #ifdef __BORLANDC__
283 #pragma option pop
284 #endif
285  //--- (end of YAccelerometer accessors declaration)
286 };
287 
288 //--- (YAccelerometer functions declaration)
289 
317 inline YAccelerometer* yFindAccelerometer(const string& func)
318 { return YAccelerometer::FindAccelerometer(func);}
330 
331 //--- (end of YAccelerometer functions declaration)
332 
333 #endif
YAccelerometer * yFindAccelerometer(const string &func)
YAccelerometerValueCallback _valueCallbackAccelerometer
int setBandwidth(int newval)
void(* YAccelerometerValueCallback)(YAccelerometer *func, const string &functionValue)
static const double ZVALUE_INVALID
YAccelerometer * yFirstAccelerometer(void)
YAccelerometerTimedReportCallback _timedReportCallbackAccelerometer
Y_GRAVITYCANCELLATION_enum _gravityCancellation
Y_GRAVITYCANCELLATION_enum gravityCancellation(void)
static const double XVALUE_INVALID
static YAccelerometer * Find(string func)
YAccelerometer * next(void)
void(* YAccelerometerTimedReportCallback)(YAccelerometer *func, YMeasure measure)
virtual int registerTimedReportCallback(YSensorTimedReportCallback callback)
Definition: yocto_api.cpp:7923
virtual int _invokeTimedReportCallback(YMeasure value)
Definition: yocto_api.cpp:7936
virtual int _invokeValueCallback(string value)
Definition: yocto_api.cpp:7645
static YAccelerometer * First(void)
virtual int _parseAttr(YJSONObject *json_val)
Definition: yocto_api.cpp:7015
Y_GRAVITYCANCELLATION_enum
virtual int registerValueCallback(YSensorValueCallback callback)
Definition: yocto_api.cpp:7626
#define YOCTO_CLASS_EXPORT
Definition: yocto_api.h:61
static YAccelerometer * FirstAccelerometer(void)
static const double YVALUE_INVALID
#define YAPI_INVALID_INT
Definition: yocto_api.h:70
static YAccelerometer * FindAccelerometer(string func)
int setGravityCancellation(Y_GRAVITYCANCELLATION_enum newval)


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