yocto_quadraturedecoder.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * $Id: yocto_quadraturedecoder.h 28748 2017-10-03 08:23:39Z seb $
4  *
5  * Declares yFindQuadratureDecoder(), the high-level API for QuadratureDecoder 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_QUADRATUREDECODER_H
42 #define YOCTO_QUADRATUREDECODER_H
43 
44 #include "yocto_api.h"
45 #include <cfloat>
46 #include <cmath>
47 #include <map>
48 
49 //--- (YQuadratureDecoder return codes)
50 //--- (end of YQuadratureDecoder return codes)
51 //--- (YQuadratureDecoder definitions)
52 class YQuadratureDecoder; // forward declaration
53 
54 typedef void (*YQuadratureDecoderValueCallback)(YQuadratureDecoder *func, const string& functionValue);
55 class YMeasure; // forward declaration
57 #ifndef _Y_DECODING_ENUM
58 #define _Y_DECODING_ENUM
59 typedef enum {
64 #endif
65 #define Y_SPEED_INVALID (YAPI_INVALID_DOUBLE)
66 //--- (end of YQuadratureDecoder definitions)
67 
68 //--- (YQuadratureDecoder declaration)
77 #ifdef __BORLANDC__
78 #pragma option push -w-8022
79 #endif
80 //--- (end of YQuadratureDecoder declaration)
81 protected:
82  //--- (YQuadratureDecoder attributes)
83  // Attributes (function value cache)
84  double _speed;
88 
89  friend YQuadratureDecoder *yFindQuadratureDecoder(const string& func);
91 
92  // Function-specific method for parsing of JSON output and caching result
93  virtual int _parseAttr(YJSONObject* json_val);
94 
95  // Constructor is protected, use yFindQuadratureDecoder factory function to instantiate
96  YQuadratureDecoder(const string& func);
97  //--- (end of YQuadratureDecoder attributes)
98 
99 public:
101  //--- (YQuadratureDecoder accessors declaration)
102 
103  static const double SPEED_INVALID;
104  static const Y_DECODING_enum DECODING_OFF = Y_DECODING_OFF;
105  static const Y_DECODING_enum DECODING_ON = Y_DECODING_ON;
106  static const Y_DECODING_enum DECODING_INVALID = Y_DECODING_INVALID;
107 
118  int set_currentValue(double newval);
119  inline int setCurrentValue(double newval)
120  { return this->set_currentValue(newval); }
121 
129  double get_speed(void);
130 
131  inline double speed(void)
132  { return this->get_speed(); }
133 
142  Y_DECODING_enum get_decoding(void);
143 
145  { return this->get_decoding(); }
146 
157  int set_decoding(Y_DECODING_enum newval);
158  inline int setDecoding(Y_DECODING_enum newval)
159  { return this->set_decoding(newval); }
160 
188  static YQuadratureDecoder* FindQuadratureDecoder(string func);
189 
203 
204  virtual int _invokeValueCallback(string value);
205 
219 
220  virtual int _invokeTimedReportCallback(YMeasure value);
221 
222 
223  inline static YQuadratureDecoder* Find(string func)
225 
233  YQuadratureDecoder *nextQuadratureDecoder(void);
234  inline YQuadratureDecoder *next(void)
235  { return this->nextQuadratureDecoder();}
236 
246  static YQuadratureDecoder* FirstQuadratureDecoder(void);
247  inline static YQuadratureDecoder* First(void)
249 #ifdef __BORLANDC__
250 #pragma option pop
251 #endif
252  //--- (end of YQuadratureDecoder accessors declaration)
253 };
254 
255 //--- (YQuadratureDecoder functions declaration)
256 
284 inline YQuadratureDecoder* yFindQuadratureDecoder(const string& func)
297 
298 //--- (end of YQuadratureDecoder functions declaration)
299 
300 #endif
static YQuadratureDecoder * Find(string func)
static YQuadratureDecoder * First(void)
YQuadratureDecoder * next(void)
YQuadratureDecoder * yFirstQuadratureDecoder(void)
static YQuadratureDecoder * FirstQuadratureDecoder(void)
YQuadratureDecoder * yFindQuadratureDecoder(const string &func)
Y_DECODING_enum decoding(void)
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
void(* YQuadratureDecoderValueCallback)(YQuadratureDecoder *func, const string &functionValue)
YQuadratureDecoderValueCallback _valueCallbackQuadratureDecoder
virtual int _parseAttr(YJSONObject *json_val)
Definition: yocto_api.cpp:7015
int setCurrentValue(double newval)
virtual int registerValueCallback(YSensorValueCallback callback)
Definition: yocto_api.cpp:7626
void(* YQuadratureDecoderTimedReportCallback)(YQuadratureDecoder *func, YMeasure measure)
#define YOCTO_CLASS_EXPORT
Definition: yocto_api.h:61
static const double SPEED_INVALID
static YQuadratureDecoder * FindQuadratureDecoder(string func)
int setDecoding(Y_DECODING_enum newval)
YQuadratureDecoderTimedReportCallback _timedReportCallbackQuadratureDecoder


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