yocto_daisychain.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * $Id: yocto_daisychain.h 28748 2017-10-03 08:23:39Z seb $
4  *
5  * Declares yFindDaisyChain(), the high-level API for DaisyChain 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_DAISYCHAIN_H
42 #define YOCTO_DAISYCHAIN_H
43 
44 #include "yocto_api.h"
45 #include <cfloat>
46 #include <cmath>
47 #include <map>
48 
49 //--- (YDaisyChain return codes)
50 //--- (end of YDaisyChain return codes)
51 //--- (YDaisyChain definitions)
52 class YDaisyChain; // forward declaration
53 
54 typedef void (*YDaisyChainValueCallback)(YDaisyChain *func, const string& functionValue);
55 #ifndef _Y_DAISYSTATE_ENUM
56 #define _Y_DAISYSTATE_ENUM
57 typedef enum {
65 #endif
66 #define Y_CHILDCOUNT_INVALID (YAPI_INVALID_UINT)
67 #define Y_REQUIREDCHILDCOUNT_INVALID (YAPI_INVALID_UINT)
68 //--- (end of YDaisyChain definitions)
69 
70 //--- (YDaisyChain declaration)
79 #ifdef __BORLANDC__
80 #pragma option push -w-8022
81 #endif
82 //--- (end of YDaisyChain declaration)
83 protected:
84  //--- (YDaisyChain attributes)
85  // Attributes (function value cache)
90 
91  friend YDaisyChain *yFindDaisyChain(const string& func);
92  friend YDaisyChain *yFirstDaisyChain(void);
93 
94  // Function-specific method for parsing of JSON output and caching result
95  virtual int _parseAttr(YJSONObject* json_val);
96 
97  // Constructor is protected, use yFindDaisyChain factory function to instantiate
98  YDaisyChain(const string& func);
99  //--- (end of YDaisyChain attributes)
100 
101 public:
102  ~YDaisyChain();
103  //--- (YDaisyChain accessors declaration)
104 
105  static const Y_DAISYSTATE_enum DAISYSTATE_READY = Y_DAISYSTATE_READY;
106  static const Y_DAISYSTATE_enum DAISYSTATE_IS_CHILD = Y_DAISYSTATE_IS_CHILD;
107  static const Y_DAISYSTATE_enum DAISYSTATE_FIRMWARE_MISMATCH = Y_DAISYSTATE_FIRMWARE_MISMATCH;
108  static const Y_DAISYSTATE_enum DAISYSTATE_CHILD_MISSING = Y_DAISYSTATE_CHILD_MISSING;
109  static const Y_DAISYSTATE_enum DAISYSTATE_CHILD_LOST = Y_DAISYSTATE_CHILD_LOST;
110  static const Y_DAISYSTATE_enum DAISYSTATE_INVALID = Y_DAISYSTATE_INVALID;
111  static const int CHILDCOUNT_INVALID = YAPI_INVALID_UINT;
112  static const int REQUIREDCHILDCOUNT_INVALID = YAPI_INVALID_UINT;
113 
123  Y_DAISYSTATE_enum get_daisyState(void);
124 
126  { return this->get_daisyState(); }
127 
135  int get_childCount(void);
136 
137  inline int childCount(void)
138  { return this->get_childCount(); }
139 
147  int get_requiredChildCount(void);
148 
149  inline int requiredChildCount(void)
150  { return this->get_requiredChildCount(); }
151 
164  int set_requiredChildCount(int newval);
165  inline int setRequiredChildCount(int newval)
166  { return this->set_requiredChildCount(newval); }
167 
195  static YDaisyChain* FindDaisyChain(string func);
196 
208  virtual int registerValueCallback(YDaisyChainValueCallback callback);
210 
211  virtual int _invokeValueCallback(string value);
212 
213 
214  inline static YDaisyChain* Find(string func)
215  { return YDaisyChain::FindDaisyChain(func); }
216 
224  YDaisyChain *nextDaisyChain(void);
225  inline YDaisyChain *next(void)
226  { return this->nextDaisyChain();}
227 
237  static YDaisyChain* FirstDaisyChain(void);
238  inline static YDaisyChain* First(void)
239  { return YDaisyChain::FirstDaisyChain();}
240 #ifdef __BORLANDC__
241 #pragma option pop
242 #endif
243  //--- (end of YDaisyChain accessors declaration)
244 };
245 
246 //--- (YDaisyChain functions declaration)
247 
275 inline YDaisyChain* yFindDaisyChain(const string& func)
276 { return YDaisyChain::FindDaisyChain(func);}
287 { return YDaisyChain::FirstDaisyChain();}
288 
289 //--- (end of YDaisyChain functions declaration)
290 
291 #endif
Y_DAISYSTATE_enum _daisyState
static YDaisyChain * FindDaisyChain(string func)
YDaisyChain * next(void)
int childCount(void)
static YDaisyChain * FirstDaisyChain(void)
static YDaisyChain * First(void)
#define YAPI_INVALID_UINT
Definition: yocto_api.h:71
virtual int _parseAttr(YJSONObject *json_val)
Definition: yocto_api.cpp:2367
int requiredChildCount(void)
YDaisyChain * yFirstDaisyChain(void)
void(* YDaisyChainValueCallback)(YDaisyChain *func, const string &functionValue)
YDaisyChain * yFindDaisyChain(const string &func)
virtual int registerValueCallback(YFunctionValueCallback callback)
Definition: yocto_api.cpp:2544
YDaisyChainValueCallback _valueCallbackDaisyChain
#define YOCTO_CLASS_EXPORT
Definition: yocto_api.h:61
Y_DAISYSTATE_enum daisyState(void)
int setRequiredChildCount(int newval)
static YDaisyChain * Find(string func)
Y_DAISYSTATE_enum
virtual int _invokeValueCallback(string value)
Definition: yocto_api.cpp:2563


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