yocto_magnetometer.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * $Id: yocto_magnetometer.h 28748 2017-10-03 08:23:39Z seb $
4  *
5  * Declares yFindMagnetometer(), the high-level API for Magnetometer 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_MAGNETOMETER_H
42 #define YOCTO_MAGNETOMETER_H
43 
44 #include "yocto_api.h"
45 #include <cfloat>
46 #include <cmath>
47 #include <map>
48 
49 //--- (YMagnetometer return codes)
50 //--- (end of YMagnetometer return codes)
51 //--- (YMagnetometer definitions)
52 class YMagnetometer; // forward declaration
53 
54 typedef void (*YMagnetometerValueCallback)(YMagnetometer *func, const string& functionValue);
55 class YMeasure; // forward declaration
57 #define Y_BANDWIDTH_INVALID (YAPI_INVALID_INT)
58 #define Y_XVALUE_INVALID (YAPI_INVALID_DOUBLE)
59 #define Y_YVALUE_INVALID (YAPI_INVALID_DOUBLE)
60 #define Y_ZVALUE_INVALID (YAPI_INVALID_DOUBLE)
61 //--- (end of YMagnetometer definitions)
62 
63 //--- (YMagnetometer declaration)
78 #ifdef __BORLANDC__
79 #pragma option push -w-8022
80 #endif
81 //--- (end of YMagnetometer declaration)
82 protected:
83  //--- (YMagnetometer attributes)
84  // Attributes (function value cache)
86  double _xValue;
87  double _yValue;
88  double _zValue;
91 
92  friend YMagnetometer *yFindMagnetometer(const string& func);
93  friend YMagnetometer *yFirstMagnetometer(void);
94 
95  // Function-specific method for parsing of JSON output and caching result
96  virtual int _parseAttr(YJSONObject* json_val);
97 
98  // Constructor is protected, use yFindMagnetometer factory function to instantiate
99  YMagnetometer(const string& func);
100  //--- (end of YMagnetometer attributes)
101 
102 public:
103  ~YMagnetometer();
104  //--- (YMagnetometer accessors declaration)
105 
106  static const int BANDWIDTH_INVALID = YAPI_INVALID_INT;
107  static const double XVALUE_INVALID;
108  static const double YVALUE_INVALID;
109  static const double ZVALUE_INVALID;
110 
118  int get_bandwidth(void);
119 
120  inline int bandwidth(void)
121  { return this->get_bandwidth(); }
122 
133  int set_bandwidth(int newval);
134  inline int setBandwidth(int newval)
135  { return this->set_bandwidth(newval); }
136 
145  double get_xValue(void);
146 
147  inline double xValue(void)
148  { return this->get_xValue(); }
149 
158  double get_yValue(void);
159 
160  inline double yValue(void)
161  { return this->get_yValue(); }
162 
171  double get_zValue(void);
172 
173  inline double zValue(void)
174  { return this->get_zValue(); }
175 
203  static YMagnetometer* FindMagnetometer(string func);
204 
218 
219  virtual int _invokeValueCallback(string value);
220 
234 
235  virtual int _invokeTimedReportCallback(YMeasure value);
236 
237 
238  inline static YMagnetometer* Find(string func)
239  { return YMagnetometer::FindMagnetometer(func); }
240 
248  YMagnetometer *nextMagnetometer(void);
249  inline YMagnetometer *next(void)
250  { return this->nextMagnetometer();}
251 
261  static YMagnetometer* FirstMagnetometer(void);
262  inline static YMagnetometer* First(void)
264 #ifdef __BORLANDC__
265 #pragma option pop
266 #endif
267  //--- (end of YMagnetometer accessors declaration)
268 };
269 
270 //--- (YMagnetometer functions declaration)
271 
299 inline YMagnetometer* yFindMagnetometer(const string& func)
300 { return YMagnetometer::FindMagnetometer(func);}
312 
313 //--- (end of YMagnetometer functions declaration)
314 
315 #endif
YMagnetometer * yFirstMagnetometer(void)
static const double XVALUE_INVALID
int setBandwidth(int newval)
YMagnetometer * next(void)
static const double YVALUE_INVALID
void(* YMagnetometerTimedReportCallback)(YMagnetometer *func, YMeasure measure)
static const double ZVALUE_INVALID
double yValue(void)
void(* YMagnetometerValueCallback)(YMagnetometer *func, const string &functionValue)
virtual int registerTimedReportCallback(YSensorTimedReportCallback callback)
Definition: yocto_api.cpp:7923
YMagnetometerTimedReportCallback _timedReportCallbackMagnetometer
virtual int _invokeTimedReportCallback(YMeasure value)
Definition: yocto_api.cpp:7936
virtual int _invokeValueCallback(string value)
Definition: yocto_api.cpp:7645
static YMagnetometer * FindMagnetometer(string func)
static YMagnetometer * Find(string func)
virtual int _parseAttr(YJSONObject *json_val)
Definition: yocto_api.cpp:7015
virtual int registerValueCallback(YSensorValueCallback callback)
Definition: yocto_api.cpp:7626
YMagnetometer * yFindMagnetometer(const string &func)
#define YOCTO_CLASS_EXPORT
Definition: yocto_api.h:61
double xValue(void)
YMagnetometerValueCallback _valueCallbackMagnetometer
static YMagnetometer * First(void)
static YMagnetometer * FirstMagnetometer(void)
#define YAPI_INVALID_INT
Definition: yocto_api.h:70
double zValue(void)


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