yocto_cellular.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * $Id: yocto_cellular.h 28748 2017-10-03 08:23:39Z seb $
4  *
5  * Declares yFindCellular(), the high-level API for Cellular 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_CELLULAR_H
42 #define YOCTO_CELLULAR_H
43 
44 #include "yocto_api.h"
45 #include <cfloat>
46 #include <cmath>
47 #include <map>
48 
49 //--- (generated code: YCellular return codes)
50 //--- (end of generated code: YCellular return codes)
51 //--- (generated code: YCellular definitions)
52 class YCellular; // forward declaration
53 
54 typedef void (*YCellularValueCallback)(YCellular *func, const string& functionValue);
55 #ifndef _Y_CELLTYPE_ENUM
56 #define _Y_CELLTYPE_ENUM
57 typedef enum {
66 #endif
67 #ifndef _Y_AIRPLANEMODE_ENUM
68 #define _Y_AIRPLANEMODE_ENUM
69 typedef enum {
74 #endif
75 #ifndef _Y_ENABLEDATA_ENUM
76 #define _Y_ENABLEDATA_ENUM
77 typedef enum {
84 #endif
85 #define Y_LINKQUALITY_INVALID (YAPI_INVALID_UINT)
86 #define Y_CELLOPERATOR_INVALID (YAPI_INVALID_STRING)
87 #define Y_CELLIDENTIFIER_INVALID (YAPI_INVALID_STRING)
88 #define Y_IMSI_INVALID (YAPI_INVALID_STRING)
89 #define Y_MESSAGE_INVALID (YAPI_INVALID_STRING)
90 #define Y_PIN_INVALID (YAPI_INVALID_STRING)
91 #define Y_LOCKEDOPERATOR_INVALID (YAPI_INVALID_STRING)
92 #define Y_APN_INVALID (YAPI_INVALID_STRING)
93 #define Y_APNSECRET_INVALID (YAPI_INVALID_STRING)
94 #define Y_PINGINTERVAL_INVALID (YAPI_INVALID_UINT)
95 #define Y_DATASENT_INVALID (YAPI_INVALID_UINT)
96 #define Y_DATARECEIVED_INVALID (YAPI_INVALID_UINT)
97 #define Y_COMMAND_INVALID (YAPI_INVALID_STRING)
98 //--- (end of generated code: YCellular definitions)
99 
100 //--- (generated code: YCellRecord definitions)
101 //--- (end of generated code: YCellRecord definitions)
102 
103 //--- (generated code: YCellRecord declaration)
110 #ifdef __BORLANDC__
111 #pragma option push -w-8022
112 #endif
113 //--- (end of generated code: YCellRecord declaration)
114  //--- (generated code: YCellRecord attributes)
115  // Attributes (function value cache)
116  string _oper;
117  int _mcc;
118  int _mnc;
119  int _lac;
120  int _cid;
121  int _dbm;
122  int _tad;
123  //--- (end of generated code: YCellRecord attributes)
124  //--- (generated code: YCellRecord constructor)
125 
126  //--- (end of generated code: YCellRecord constructor)
127  //--- (generated code: YCellRecord initialization)
128  //--- (end of generated code: YCellRecord initialization)
129 
130 public:
131  YCellRecord(int mcc,int mnc,int lac,int cellId,int dbm,int tad,const string &oper);
132  //--- (generated code: YCellRecord accessors declaration)
133 
134 
135  virtual string get_cellOperator(void);
136 
137  virtual int get_mobileCountryCode(void);
138 
139  virtual int get_mobileNetworkCode(void);
140 
141  virtual int get_locationAreaCode(void);
142 
143  virtual int get_cellId(void);
144 
145  virtual int get_signalStrength(void);
146 
147  virtual int get_timingAdvance(void);
148 
149 #ifdef __BORLANDC__
150 #pragma option pop
151 #endif
152  //--- (end of generated code: YCellRecord accessors declaration)
153 };
154 
155 
156 //--- (generated code: YCellular declaration)
164 #ifdef __BORLANDC__
165 #pragma option push -w-8022
166 #endif
167 //--- (end of generated code: YCellular declaration)
168 protected:
169  //--- (generated code: YCellular attributes)
170  // Attributes (function value cache)
175  string _imsi;
176  string _message;
177  string _pin;
181  string _apn;
182  string _apnSecret;
186  string _command;
188 
189  friend YCellular *yFindCellular(const string& func);
190  friend YCellular *yFirstCellular(void);
191 
192  // Function-specific method for parsing of JSON output and caching result
193  virtual int _parseAttr(YJSONObject* json_val);
194 
195  // Constructor is protected, use yFindCellular factory function to instantiate
196  YCellular(const string& func);
197  //--- (end of generated code: YCellular attributes)
198 
199 public:
200  ~YCellular();
201  //--- (generated code: YCellular accessors declaration)
202 
203  static const int LINKQUALITY_INVALID = YAPI_INVALID_UINT;
204  static const string CELLOPERATOR_INVALID;
205  static const string CELLIDENTIFIER_INVALID;
206  static const Y_CELLTYPE_enum CELLTYPE_GPRS = Y_CELLTYPE_GPRS;
207  static const Y_CELLTYPE_enum CELLTYPE_EGPRS = Y_CELLTYPE_EGPRS;
208  static const Y_CELLTYPE_enum CELLTYPE_WCDMA = Y_CELLTYPE_WCDMA;
209  static const Y_CELLTYPE_enum CELLTYPE_HSDPA = Y_CELLTYPE_HSDPA;
210  static const Y_CELLTYPE_enum CELLTYPE_NONE = Y_CELLTYPE_NONE;
211  static const Y_CELLTYPE_enum CELLTYPE_CDMA = Y_CELLTYPE_CDMA;
212  static const Y_CELLTYPE_enum CELLTYPE_INVALID = Y_CELLTYPE_INVALID;
213  static const string IMSI_INVALID;
214  static const string MESSAGE_INVALID;
215  static const string PIN_INVALID;
216  static const string LOCKEDOPERATOR_INVALID;
217  static const Y_AIRPLANEMODE_enum AIRPLANEMODE_OFF = Y_AIRPLANEMODE_OFF;
218  static const Y_AIRPLANEMODE_enum AIRPLANEMODE_ON = Y_AIRPLANEMODE_ON;
219  static const Y_AIRPLANEMODE_enum AIRPLANEMODE_INVALID = Y_AIRPLANEMODE_INVALID;
220  static const Y_ENABLEDATA_enum ENABLEDATA_HOMENETWORK = Y_ENABLEDATA_HOMENETWORK;
221  static const Y_ENABLEDATA_enum ENABLEDATA_ROAMING = Y_ENABLEDATA_ROAMING;
222  static const Y_ENABLEDATA_enum ENABLEDATA_NEVER = Y_ENABLEDATA_NEVER;
223  static const Y_ENABLEDATA_enum ENABLEDATA_NEUTRALITY = Y_ENABLEDATA_NEUTRALITY;
224  static const Y_ENABLEDATA_enum ENABLEDATA_INVALID = Y_ENABLEDATA_INVALID;
225  static const string APN_INVALID;
226  static const string APNSECRET_INVALID;
227  static const int PINGINTERVAL_INVALID = YAPI_INVALID_UINT;
228  static const int DATASENT_INVALID = YAPI_INVALID_UINT;
229  static const int DATARECEIVED_INVALID = YAPI_INVALID_UINT;
230  static const string COMMAND_INVALID;
231 
239  int get_linkQuality(void);
240 
241  inline int linkQuality(void)
242  { return this->get_linkQuality(); }
243 
251  string get_cellOperator(void);
252 
253  inline string cellOperator(void)
254  { return this->get_cellOperator(); }
255 
264  string get_cellIdentifier(void);
265 
266  inline string cellIdentifier(void)
267  { return this->get_cellIdentifier(); }
268 
277  Y_CELLTYPE_enum get_cellType(void);
278 
280  { return this->get_cellType(); }
281 
293  string get_imsi(void);
294 
295  inline string imsi(void)
296  { return this->get_imsi(); }
297 
305  string get_message(void);
306 
307  inline string message(void)
308  { return this->get_message(); }
309 
321  string get_pin(void);
322 
323  inline string pin(void)
324  { return this->get_pin(); }
325 
345  int set_pin(const string& newval);
346  inline int setPin(const string& newval)
347  { return this->set_pin(newval); }
348 
360  string get_lockedOperator(void);
361 
362  inline string lockedOperator(void)
363  { return this->get_lockedOperator(); }
364 
376  int set_lockedOperator(const string& newval);
377  inline int setLockedOperator(const string& newval)
378  { return this->set_lockedOperator(newval); }
379 
388  Y_AIRPLANEMODE_enum get_airplaneMode(void);
389 
391  { return this->get_airplaneMode(); }
392 
403  int set_airplaneMode(Y_AIRPLANEMODE_enum newval);
405  { return this->set_airplaneMode(newval); }
406 
416  Y_ENABLEDATA_enum get_enableData(void);
417 
419  { return this->get_enableData(); }
420 
436  int set_enableData(Y_ENABLEDATA_enum newval);
437  inline int setEnableData(Y_ENABLEDATA_enum newval)
438  { return this->set_enableData(newval); }
439 
448  string get_apn(void);
449 
450  inline string apn(void)
451  { return this->get_apn(); }
452 
463  int set_apn(const string& newval);
464  inline int setApn(const string& newval)
465  { return this->set_apn(newval); }
466 
477  string get_apnSecret(void);
478 
479  inline string apnSecret(void)
480  { return this->get_apnSecret(); }
481 
482  int set_apnSecret(const string& newval);
483  inline int setApnSecret(const string& newval)
484  { return this->set_apnSecret(newval); }
485 
493  int get_pingInterval(void);
494 
495  inline int pingInterval(void)
496  { return this->get_pingInterval(); }
497 
507  int set_pingInterval(int newval);
508  inline int setPingInterval(int newval)
509  { return this->set_pingInterval(newval); }
510 
518  int get_dataSent(void);
519 
520  inline int dataSent(void)
521  { return this->get_dataSent(); }
522 
532  int set_dataSent(int newval);
533  inline int setDataSent(int newval)
534  { return this->set_dataSent(newval); }
535 
543  int get_dataReceived(void);
544 
545  inline int dataReceived(void)
546  { return this->get_dataReceived(); }
547 
557  int set_dataReceived(int newval);
558  inline int setDataReceived(int newval)
559  { return this->set_dataReceived(newval); }
560 
561  string get_command(void);
562 
563  inline string command(void)
564  { return this->get_command(); }
565 
566  int set_command(const string& newval);
567  inline int setCommand(const string& newval)
568  { return this->set_command(newval); }
569 
597  static YCellular* FindCellular(string func);
598 
610  virtual int registerValueCallback(YCellularValueCallback callback);
612 
613  virtual int _invokeValueCallback(string value);
614 
629  virtual int sendPUK(string puk,string newPin);
630 
642  virtual int set_apnAuth(string username,string password);
643 
651  virtual int clearDataCounters(void);
652 
664  virtual string _AT(string cmd);
665 
675  virtual vector<string> get_availableOperators(void);
676 
685  virtual vector<YCellRecord> quickCellSurvey(void);
686 
687 
688  inline static YCellular* Find(string func)
689  { return YCellular::FindCellular(func); }
690 
698  YCellular *nextCellular(void);
699  inline YCellular *next(void)
700  { return this->nextCellular();}
701 
711  static YCellular* FirstCellular(void);
712  inline static YCellular* First(void)
713  { return YCellular::FirstCellular();}
714 #ifdef __BORLANDC__
715 #pragma option pop
716 #endif
717  //--- (end of generated code: YCellular accessors declaration)
718 };
719 
720 //--- (generated code: YCellular functions declaration)
721 
749 inline YCellular* yFindCellular(const string& func)
750 { return YCellular::FindCellular(func);}
761 { return YCellular::FirstCellular();}
762 
763 //--- (end of generated code: YCellular functions declaration)
764 
765 #endif
int setApn(const string &newval)
Y_CELLTYPE_enum cellType(void)
int setPingInterval(int newval)
YCellular * yFirstCellular(void)
string pin(void)
static YCellular * FirstCellular(void)
int setDataSent(int newval)
YCellular * next(void)
YCellularValueCallback _valueCallbackCellular
Y_CELLTYPE_enum
string apnSecret(void)
static const string APNSECRET_INVALID
Y_ENABLEDATA_enum enableData(void)
int setDataReceived(int newval)
string cellIdentifier(void)
string _message
string _cellOperator
int setApnSecret(const string &newval)
#define YAPI_INVALID_UINT
Definition: yocto_api.h:71
string command(void)
int pingInterval(void)
string lockedOperator(void)
string cellOperator(void)
static YCellular * FindCellular(string func)
virtual int _parseAttr(YJSONObject *json_val)
Definition: yocto_api.cpp:2367
int dataSent(void)
string _command
void(* YCellularValueCallback)(YCellular *func, const string &functionValue)
static const string LOCKEDOPERATOR_INVALID
static const string MESSAGE_INVALID
static const string APN_INVALID
Y_AIRPLANEMODE_enum airplaneMode(void)
int setCommand(const string &newval)
Y_AIRPLANEMODE_enum
static const string CELLIDENTIFIER_INVALID
static YCellular * First(void)
string message(void)
string _apnSecret
static const string CELLOPERATOR_INVALID
virtual int registerValueCallback(YFunctionValueCallback callback)
Definition: yocto_api.cpp:2544
Y_ENABLEDATA_enum _enableData
static const string COMMAND_INVALID
string imsi(void)
Y_ENABLEDATA_enum
string apn(void)
int linkQuality(void)
int dataReceived(void)
int setAirplaneMode(Y_AIRPLANEMODE_enum newval)
Y_CELLTYPE_enum _cellType
int setPin(const string &newval)
static YCellular * Find(string func)
int setEnableData(Y_ENABLEDATA_enum newval)
#define YOCTO_CLASS_EXPORT
Definition: yocto_api.h:61
static const string IMSI_INVALID
YCellular * yFindCellular(const string &func)
int setLockedOperator(const string &newval)
string _cellIdentifier
Y_AIRPLANEMODE_enum _airplaneMode
string _lockedOperator
string _imsi
static const string PIN_INVALID
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