yocto_hubport.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * $Id: yocto_hubport.h 28748 2017-10-03 08:23:39Z seb $
4  *
5  * Declares yFindHubPort(), the high-level API for HubPort 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_HUBPORT_H
42 #define YOCTO_HUBPORT_H
43 
44 #include "yocto_api.h"
45 #include <cfloat>
46 #include <cmath>
47 #include <map>
48 
49 //--- (YHubPort return codes)
50 //--- (end of YHubPort return codes)
51 //--- (YHubPort definitions)
52 class YHubPort; // forward declaration
53 
54 typedef void (*YHubPortValueCallback)(YHubPort *func, const string& functionValue);
55 #ifndef _Y_ENABLED_ENUM
56 #define _Y_ENABLED_ENUM
57 typedef enum {
62 #endif
63 #ifndef _Y_PORTSTATE_ENUM
64 #define _Y_PORTSTATE_ENUM
65 #ifdef Y_PORTSTATE_INVALID
66 #undef Y_PORTSTATE_INVALID
67 #endif
68 typedef enum {
76 #endif
77 #define Y_BAUDRATE_INVALID (YAPI_INVALID_UINT)
78 //--- (end of YHubPort definitions)
79 
80 //--- (YHubPort declaration)
90 #ifdef __BORLANDC__
91 #pragma option push -w-8022
92 #endif
93 //--- (end of YHubPort declaration)
94 protected:
95  //--- (YHubPort attributes)
96  // Attributes (function value cache)
99  int _baudRate;
101 
102  friend YHubPort *yFindHubPort(const string& func);
103  friend YHubPort *yFirstHubPort(void);
104 
105  // Function-specific method for parsing of JSON output and caching result
106  virtual int _parseAttr(YJSONObject* json_val);
107 
108  // Constructor is protected, use yFindHubPort factory function to instantiate
109  YHubPort(const string& func);
110  //--- (end of YHubPort attributes)
111 
112 public:
113  ~YHubPort();
114  //--- (YHubPort accessors declaration)
115 
116  static const Y_ENABLED_enum ENABLED_FALSE = Y_ENABLED_FALSE;
117  static const Y_ENABLED_enum ENABLED_TRUE = Y_ENABLED_TRUE;
118  static const Y_ENABLED_enum ENABLED_INVALID = Y_ENABLED_INVALID;
119  static const Y_PORTSTATE_enum PORTSTATE_OFF = Y_PORTSTATE_OFF;
120  static const Y_PORTSTATE_enum PORTSTATE_OVRLD = Y_PORTSTATE_OVRLD;
121  static const Y_PORTSTATE_enum PORTSTATE_ON = Y_PORTSTATE_ON;
122  static const Y_PORTSTATE_enum PORTSTATE_RUN = Y_PORTSTATE_RUN;
123  static const Y_PORTSTATE_enum PORTSTATE_PROG = Y_PORTSTATE_PROG;
124  static const Y_PORTSTATE_enum PORTSTATE_INVALID = Y_PORTSTATE_INVALID;
125  static const int BAUDRATE_INVALID = YAPI_INVALID_UINT;
126 
135  Y_ENABLED_enum get_enabled(void);
136 
137  inline Y_ENABLED_enum enabled(void)
138  { return this->get_enabled(); }
139 
150  int set_enabled(Y_ENABLED_enum newval);
151  inline int setEnabled(Y_ENABLED_enum newval)
152  { return this->set_enabled(newval); }
153 
162  Y_PORTSTATE_enum get_portState(void);
163 
165  { return this->get_portState(); }
166 
176  int get_baudRate(void);
177 
178  inline int baudRate(void)
179  { return this->get_baudRate(); }
180 
208  static YHubPort* FindHubPort(string func);
209 
221  virtual int registerValueCallback(YHubPortValueCallback callback);
223 
224  virtual int _invokeValueCallback(string value);
225 
226 
227  inline static YHubPort* Find(string func)
228  { return YHubPort::FindHubPort(func); }
229 
237  YHubPort *nextHubPort(void);
238  inline YHubPort *next(void)
239  { return this->nextHubPort();}
240 
250  static YHubPort* FirstHubPort(void);
251  inline static YHubPort* First(void)
252  { return YHubPort::FirstHubPort();}
253 #ifdef __BORLANDC__
254 #pragma option pop
255 #endif
256  //--- (end of YHubPort accessors declaration)
257 };
258 
259 //--- (YHubPort functions declaration)
260 
288 inline YHubPort* yFindHubPort(const string& func)
289 { return YHubPort::FindHubPort(func);}
299 inline YHubPort* yFirstHubPort(void)
300 { return YHubPort::FirstHubPort();}
301 
302 //--- (end of YHubPort functions declaration)
303 
304 #endif
static YHubPort * First(void)
Y_ENABLED_enum
Definition: yocto_current.h:59
Y_ENABLED_enum enabled(void)
YHubPort * yFindHubPort(const string &func)
static YHubPort * Find(string func)
#define YAPI_INVALID_UINT
Definition: yocto_api.h:71
YHubPortValueCallback _valueCallbackHubPort
Y_ENABLED_enum _enabled
Definition: yocto_hubport.h:97
virtual int _parseAttr(YJSONObject *json_val)
Definition: yocto_api.cpp:2367
void(* YHubPortValueCallback)(YHubPort *func, const string &functionValue)
Definition: yocto_hubport.h:54
static YHubPort * FindHubPort(string func)
int setEnabled(Y_ENABLED_enum newval)
YHubPort * yFirstHubPort(void)
Y_ENABLED_enum
Definition: yocto_hubport.h:57
virtual int registerValueCallback(YFunctionValueCallback callback)
Definition: yocto_api.cpp:2544
Y_PORTSTATE_enum portState(void)
YHubPort * next(void)
Y_PORTSTATE_enum
Definition: yocto_hubport.h:68
#define YOCTO_CLASS_EXPORT
Definition: yocto_api.h:61
int _baudRate
Definition: yocto_hubport.h:99
static YHubPort * FirstHubPort(void)
int baudRate(void)
Y_PORTSTATE_enum _portState
Definition: yocto_hubport.h:98
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