yocto_tilt.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * $Id: yocto_tilt.h 28748 2017-10-03 08:23:39Z seb $
4  *
5  * Declares yFindTilt(), the high-level API for Tilt 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_TILT_H
42 #define YOCTO_TILT_H
43 
44 #include "yocto_api.h"
45 #include <cfloat>
46 #include <cmath>
47 #include <map>
48 
49 //--- (YTilt return codes)
50 //--- (end of YTilt return codes)
51 //--- (YTilt definitions)
52 class YTilt; // forward declaration
53 
54 typedef void (*YTiltValueCallback)(YTilt *func, const string& functionValue);
55 class YMeasure; // forward declaration
56 typedef void (*YTiltTimedReportCallback)(YTilt *func, YMeasure measure);
57 #ifndef _Y_AXIS_ENUM
58 #define _Y_AXIS_ENUM
59 typedef enum {
60  Y_AXIS_X = 0,
61  Y_AXIS_Y = 1,
62  Y_AXIS_Z = 2,
64 } Y_AXIS_enum;
65 #endif
66 #define Y_BANDWIDTH_INVALID (YAPI_INVALID_INT)
67 //--- (end of YTilt definitions)
68 
69 //--- (YTilt declaration)
84 #ifdef __BORLANDC__
85 #pragma option push -w-8022
86 #endif
87 //--- (end of YTilt declaration)
88 protected:
89  //--- (YTilt attributes)
90  // Attributes (function value cache)
95 
96  friend YTilt *yFindTilt(const string& func);
97  friend YTilt *yFirstTilt(void);
98 
99  // Function-specific method for parsing of JSON output and caching result
100  virtual int _parseAttr(YJSONObject* json_val);
101 
102  // Constructor is protected, use yFindTilt factory function to instantiate
103  YTilt(const string& func);
104  //--- (end of YTilt attributes)
105 
106 public:
107  ~YTilt();
108  //--- (YTilt accessors declaration)
109 
110  static const int BANDWIDTH_INVALID = YAPI_INVALID_INT;
111  static const Y_AXIS_enum AXIS_X = Y_AXIS_X;
112  static const Y_AXIS_enum AXIS_Y = Y_AXIS_Y;
113  static const Y_AXIS_enum AXIS_Z = Y_AXIS_Z;
114  static const Y_AXIS_enum AXIS_INVALID = Y_AXIS_INVALID;
115 
123  int get_bandwidth(void);
124 
125  inline int bandwidth(void)
126  { return this->get_bandwidth(); }
127 
138  int set_bandwidth(int newval);
139  inline int setBandwidth(int newval)
140  { return this->set_bandwidth(newval); }
141 
142  Y_AXIS_enum get_axis(void);
143 
144  inline Y_AXIS_enum axis(void)
145  { return this->get_axis(); }
146 
174  static YTilt* FindTilt(string func);
175 
187  virtual int registerValueCallback(YTiltValueCallback callback);
189 
190  virtual int _invokeValueCallback(string value);
191 
205 
206  virtual int _invokeTimedReportCallback(YMeasure value);
207 
208 
209  inline static YTilt* Find(string func)
210  { return YTilt::FindTilt(func); }
211 
219  YTilt *nextTilt(void);
220  inline YTilt *next(void)
221  { return this->nextTilt();}
222 
232  static YTilt* FirstTilt(void);
233  inline static YTilt* First(void)
234  { return YTilt::FirstTilt();}
235 #ifdef __BORLANDC__
236 #pragma option pop
237 #endif
238  //--- (end of YTilt accessors declaration)
239 };
240 
241 //--- (YTilt functions declaration)
242 
270 inline YTilt* yFindTilt(const string& func)
271 { return YTilt::FindTilt(func);}
281 inline YTilt* yFirstTilt(void)
282 { return YTilt::FirstTilt();}
283 
284 //--- (end of YTilt functions declaration)
285 
286 #endif
YTilt * next(void)
Definition: yocto_tilt.h:220
YTiltValueCallback _valueCallbackTilt
Definition: yocto_tilt.h:93
int setBandwidth(int newval)
Definition: yocto_tilt.h:139
static YTilt * Find(string func)
Definition: yocto_tilt.h:209
Y_AXIS_enum axis(void)
Definition: yocto_tilt.h:144
int bandwidth(void)
Definition: yocto_tilt.h:125
Y_AXIS_enum _axis
Definition: yocto_tilt.h:92
void(* YTiltValueCallback)(YTilt *func, const string &functionValue)
Definition: yocto_tilt.h:54
virtual int registerTimedReportCallback(YSensorTimedReportCallback callback)
Definition: yocto_api.cpp:7923
static YTilt * FindTilt(string func)
Definition: yocto_tilt.cpp:186
static YTilt * First(void)
Definition: yocto_tilt.h:233
YTiltTimedReportCallback _timedReportCallbackTilt
Definition: yocto_tilt.h:94
virtual int _invokeTimedReportCallback(YMeasure value)
Definition: yocto_api.cpp:7936
virtual int _invokeValueCallback(string value)
Definition: yocto_api.cpp:7645
static YTilt * FirstTilt(void)
Definition: yocto_tilt.cpp:291
Y_AXIS_enum
Definition: yocto_tilt.h:59
void(* YTiltTimedReportCallback)(YTilt *func, YMeasure measure)
Definition: yocto_tilt.h:56
YTilt * yFindTilt(const string &func)
Definition: yocto_tilt.h:270
virtual int _parseAttr(YJSONObject *json_val)
Definition: yocto_api.cpp:7015
virtual int registerValueCallback(YSensorValueCallback callback)
Definition: yocto_api.cpp:7626
#define YOCTO_CLASS_EXPORT
Definition: yocto_api.h:61
int _bandwidth
Definition: yocto_tilt.h:91
#define YAPI_INVALID_INT
Definition: yocto_api.h:70
Y_AXIS_enum
Definition: yocto_compass.h:59
YTilt * yFirstTilt(void)
Definition: yocto_tilt.h:281


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