yocto_gps.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * $Id: yocto_gps.h 28748 2017-10-03 08:23:39Z seb $
4  *
5  * Declares yFindGps(), the high-level API for Gps 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_GPS_H
42 #define YOCTO_GPS_H
43 
44 #include "yocto_api.h"
45 #include <cfloat>
46 #include <cmath>
47 #include <map>
48 
49 //--- (YGps return codes)
50 //--- (end of YGps return codes)
51 //--- (YGps definitions)
52 class YGps; // forward declaration
53 
54 typedef void (*YGpsValueCallback)(YGps *func, const string& functionValue);
55 #ifndef _Y_ISFIXED_ENUM
56 #define _Y_ISFIXED_ENUM
57 typedef enum {
62 #endif
63 #ifndef _Y_COORDSYSTEM_ENUM
64 #define _Y_COORDSYSTEM_ENUM
65 typedef enum {
71 #endif
72 #define Y_SATCOUNT_INVALID (YAPI_INVALID_LONG)
73 #define Y_LATITUDE_INVALID (YAPI_INVALID_STRING)
74 #define Y_LONGITUDE_INVALID (YAPI_INVALID_STRING)
75 #define Y_DILUTION_INVALID (YAPI_INVALID_DOUBLE)
76 #define Y_ALTITUDE_INVALID (YAPI_INVALID_DOUBLE)
77 #define Y_GROUNDSPEED_INVALID (YAPI_INVALID_DOUBLE)
78 #define Y_DIRECTION_INVALID (YAPI_INVALID_DOUBLE)
79 #define Y_UNIXTIME_INVALID (YAPI_INVALID_LONG)
80 #define Y_DATETIME_INVALID (YAPI_INVALID_STRING)
81 #define Y_UTCOFFSET_INVALID (YAPI_INVALID_INT)
82 #define Y_COMMAND_INVALID (YAPI_INVALID_STRING)
83 //--- (end of YGps definitions)
84 
85 //--- (YGps declaration)
96 #ifdef __BORLANDC__
97 #pragma option push -w-8022
98 #endif
99 //--- (end of YGps declaration)
100 protected:
101  //--- (YGps attributes)
102  // Attributes (function value cache)
106  string _latitude;
107  string _longitude;
108  double _dilution;
109  double _altitude;
110  double _groundSpeed;
111  double _direction;
113  string _dateTime;
115  string _command;
117 
118  friend YGps *yFindGps(const string& func);
119  friend YGps *yFirstGps(void);
120 
121  // Function-specific method for parsing of JSON output and caching result
122  virtual int _parseAttr(YJSONObject* json_val);
123 
124  // Constructor is protected, use yFindGps factory function to instantiate
125  YGps(const string& func);
126  //--- (end of YGps attributes)
127 
128 public:
129  ~YGps();
130  //--- (YGps accessors declaration)
131 
132  static const Y_ISFIXED_enum ISFIXED_FALSE = Y_ISFIXED_FALSE;
133  static const Y_ISFIXED_enum ISFIXED_TRUE = Y_ISFIXED_TRUE;
134  static const Y_ISFIXED_enum ISFIXED_INVALID = Y_ISFIXED_INVALID;
135  static const s64 SATCOUNT_INVALID = YAPI_INVALID_LONG;
136  static const Y_COORDSYSTEM_enum COORDSYSTEM_GPS_DMS = Y_COORDSYSTEM_GPS_DMS;
137  static const Y_COORDSYSTEM_enum COORDSYSTEM_GPS_DM = Y_COORDSYSTEM_GPS_DM;
138  static const Y_COORDSYSTEM_enum COORDSYSTEM_GPS_D = Y_COORDSYSTEM_GPS_D;
139  static const Y_COORDSYSTEM_enum COORDSYSTEM_INVALID = Y_COORDSYSTEM_INVALID;
140  static const string LATITUDE_INVALID;
141  static const string LONGITUDE_INVALID;
142  static const double DILUTION_INVALID;
143  static const double ALTITUDE_INVALID;
144  static const double GROUNDSPEED_INVALID;
145  static const double DIRECTION_INVALID;
146  static const s64 UNIXTIME_INVALID = YAPI_INVALID_LONG;
147  static const string DATETIME_INVALID;
148  static const int UTCOFFSET_INVALID = YAPI_INVALID_INT;
149  static const string COMMAND_INVALID;
150 
159  Y_ISFIXED_enum get_isFixed(void);
160 
161  inline Y_ISFIXED_enum isFixed(void)
162  { return this->get_isFixed(); }
163 
171  s64 get_satCount(void);
172 
173  inline s64 satCount(void)
174  { return this->get_satCount(); }
175 
184  Y_COORDSYSTEM_enum get_coordSystem(void);
185 
187  { return this->get_coordSystem(); }
188 
199  int set_coordSystem(Y_COORDSYSTEM_enum newval);
201  { return this->set_coordSystem(newval); }
202 
210  string get_latitude(void);
211 
212  inline string latitude(void)
213  { return this->get_latitude(); }
214 
222  string get_longitude(void);
223 
224  inline string longitude(void)
225  { return this->get_longitude(); }
226 
236  double get_dilution(void);
237 
238  inline double dilution(void)
239  { return this->get_dilution(); }
240 
249  double get_altitude(void);
250 
251  inline double altitude(void)
252  { return this->get_altitude(); }
253 
261  double get_groundSpeed(void);
262 
263  inline double groundSpeed(void)
264  { return this->get_groundSpeed(); }
265 
275  double get_direction(void);
276 
277  inline double direction(void)
278  { return this->get_direction(); }
279 
289  s64 get_unixTime(void);
290 
291  inline s64 unixTime(void)
292  { return this->get_unixTime(); }
293 
301  string get_dateTime(void);
302 
303  inline string dateTime(void)
304  { return this->get_dateTime(); }
305 
313  int get_utcOffset(void);
314 
315  inline int utcOffset(void)
316  { return this->get_utcOffset(); }
317 
329  int set_utcOffset(int newval);
330  inline int setUtcOffset(int newval)
331  { return this->set_utcOffset(newval); }
332 
333  string get_command(void);
334 
335  inline string command(void)
336  { return this->get_command(); }
337 
338  int set_command(const string& newval);
339  inline int setCommand(const string& newval)
340  { return this->set_command(newval); }
341 
369  static YGps* FindGps(string func);
370 
382  virtual int registerValueCallback(YGpsValueCallback callback);
384 
385  virtual int _invokeValueCallback(string value);
386 
387 
388  inline static YGps* Find(string func)
389  { return YGps::FindGps(func); }
390 
398  YGps *nextGps(void);
399  inline YGps *next(void)
400  { return this->nextGps();}
401 
411  static YGps* FirstGps(void);
412  inline static YGps* First(void)
413  { return YGps::FirstGps();}
414 #ifdef __BORLANDC__
415 #pragma option pop
416 #endif
417  //--- (end of YGps accessors declaration)
418 };
419 
420 //--- (YGps functions declaration)
421 
449 inline YGps* yFindGps(const string& func)
450 { return YGps::FindGps(func);}
460 inline YGps* yFirstGps(void)
461 { return YGps::FirstGps();}
462 
463 //--- (end of YGps functions declaration)
464 
465 #endif
double _groundSpeed
Definition: yocto_gps.h:110
static const string COMMAND_INVALID
Definition: yocto_gps.h:149
static const double DIRECTION_INVALID
Definition: yocto_gps.h:145
static const string DATETIME_INVALID
Definition: yocto_gps.h:147
string _command
Definition: yocto_gps.h:115
static const string LATITUDE_INVALID
Definition: yocto_gps.h:140
Y_COORDSYSTEM_enum _coordSystem
Definition: yocto_gps.h:105
#define YAPI_INVALID_LONG
Definition: yocto_api.h:72
double groundSpeed(void)
Definition: yocto_gps.h:263
void(* YGpsValueCallback)(YGps *func, const string &functionValue)
Definition: yocto_gps.h:54
s64 satCount(void)
Definition: yocto_gps.h:173
YGpsValueCallback _valueCallbackGps
Definition: yocto_gps.h:116
int setUtcOffset(int newval)
Definition: yocto_gps.h:330
static YGps * FirstGps(void)
Definition: yocto_gps.cpp:679
string longitude(void)
Definition: yocto_gps.h:224
double _dilution
Definition: yocto_gps.h:108
YGps * yFirstGps(void)
Definition: yocto_gps.h:460
string latitude(void)
Definition: yocto_gps.h:212
double direction(void)
Definition: yocto_gps.h:277
string _longitude
Definition: yocto_gps.h:107
s64 _satCount
Definition: yocto_gps.h:104
double altitude(void)
Definition: yocto_gps.h:251
static const string LONGITUDE_INVALID
Definition: yocto_gps.h:141
s64 unixTime(void)
Definition: yocto_gps.h:291
virtual int _parseAttr(YJSONObject *json_val)
Definition: yocto_api.cpp:2367
int setCoordSystem(Y_COORDSYSTEM_enum newval)
Definition: yocto_gps.h:200
Y_ISFIXED_enum
Definition: yocto_gps.h:57
Y_COORDSYSTEM_enum
Definition: yocto_gps.h:65
int setCommand(const string &newval)
Definition: yocto_gps.h:339
double _altitude
Definition: yocto_gps.h:109
int utcOffset(void)
Definition: yocto_gps.h:315
double _direction
Definition: yocto_gps.h:111
s64 _unixTime
Definition: yocto_gps.h:112
double dilution(void)
Definition: yocto_gps.h:238
string dateTime(void)
Definition: yocto_gps.h:303
Y_COORDSYSTEM_enum coordSystem(void)
Definition: yocto_gps.h:186
static const double DILUTION_INVALID
Definition: yocto_gps.h:142
Y_ISFIXED_enum _isFixed
Definition: yocto_gps.h:103
virtual int registerValueCallback(YFunctionValueCallback callback)
Definition: yocto_api.cpp:2544
Definition: yocto_gps.h:95
static const double GROUNDSPEED_INVALID
Definition: yocto_gps.h:144
#define YOCTO_CLASS_EXPORT
Definition: yocto_api.h:61
string _dateTime
Definition: yocto_gps.h:113
static YGps * First(void)
Definition: yocto_gps.h:412
static const double ALTITUDE_INVALID
Definition: yocto_gps.h:143
static YGps * Find(string func)
Definition: yocto_gps.h:388
YGps * yFindGps(const string &func)
Definition: yocto_gps.h:449
static YGps * FindGps(string func)
Definition: yocto_gps.cpp:608
#define YAPI_INVALID_INT
Definition: yocto_api.h:70
string command(void)
Definition: yocto_gps.h:335
string _latitude
Definition: yocto_gps.h:106
int _utcOffset
Definition: yocto_gps.h:114
YGps * next(void)
Definition: yocto_gps.h:399
virtual int _invokeValueCallback(string value)
Definition: yocto_api.cpp:2563
Y_ISFIXED_enum isFixed(void)
Definition: yocto_gps.h:161


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