yocto_cellular.cpp
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * $Id: yocto_cellular.cpp 28753 2017-10-03 11:23:38Z seb $
4  *
5  * Implements 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 #define _CRT_SECURE_NO_DEPRECATE //do not use windows secure crt
42 #include "yocto_cellular.h"
43 #include "yapi/yjson.h"
44 #include "yapi/yapi.h"
45 #include <string.h>
46 #include <stdio.h>
47 #include <math.h>
48 #include <stdlib.h>
49 #define __FILE_ID__ "cellular"
50 
51 
52 
53 YCellRecord::YCellRecord(int mcc,int mnc,int lac,int cellId,int dbm,int tad,const string &oper):
54 //--- (generated code: YCellRecord initialization)
55  _mcc(0)
56  ,_mnc(0)
57  ,_lac(0)
58  ,_cid(0)
59  ,_dbm(0)
60  ,_tad(0)
61 //--- (end of generated code: YCellRecord initialization)
62 {
63  _oper = oper;
64  _mcc = mcc;
65  _mnc = mnc;
66  _lac = lac;
67  _cid = cellId;
68  _dbm = dbm;
69  _tad = tad;
70 
71 }
72 
73 //--- (generated code: YCellRecord implementation)
74 // static attributes
75 
76 
78 {
79  return _oper;
80 }
81 
83 {
84  return _mcc;
85 }
86 
88 {
89  return _mnc;
90 }
91 
93 {
94  return _lac;
95 }
96 
98 {
99  return _cid;
100 }
101 
103 {
104  return _dbm;
105 }
106 
108 {
109  return _tad;
110 }
111 //--- (end of generated code: YCellRecord implementation)
112 
113 
114 YCellular::YCellular(const string& func): YFunction(func)
115 //--- (generated code: YCellular initialization)
116  ,_linkQuality(LINKQUALITY_INVALID)
117  ,_cellOperator(CELLOPERATOR_INVALID)
118  ,_cellIdentifier(CELLIDENTIFIER_INVALID)
119  ,_cellType(CELLTYPE_INVALID)
120  ,_imsi(IMSI_INVALID)
121  ,_message(MESSAGE_INVALID)
122  ,_pin(PIN_INVALID)
123  ,_lockedOperator(LOCKEDOPERATOR_INVALID)
124  ,_airplaneMode(AIRPLANEMODE_INVALID)
125  ,_enableData(ENABLEDATA_INVALID)
126  ,_apn(APN_INVALID)
127  ,_apnSecret(APNSECRET_INVALID)
128  ,_pingInterval(PINGINTERVAL_INVALID)
129  ,_dataSent(DATASENT_INVALID)
130  ,_dataReceived(DATARECEIVED_INVALID)
131  ,_command(COMMAND_INVALID)
132  ,_valueCallbackCellular(NULL)
133 //--- (end of generated code: YCellular initialization)
134 {
135  _className="Cellular";
136 }
137 
139 {
140 //--- (generated code: YCellular cleanup)
141 //--- (end of generated code: YCellular cleanup)
142 }
143 //--- (generated code: YCellular implementation)
144 // static attributes
154 
156 {
157  if(json_val->has("linkQuality")) {
158  _linkQuality = json_val->getInt("linkQuality");
159  }
160  if(json_val->has("cellOperator")) {
161  _cellOperator = json_val->getString("cellOperator");
162  }
163  if(json_val->has("cellIdentifier")) {
164  _cellIdentifier = json_val->getString("cellIdentifier");
165  }
166  if(json_val->has("cellType")) {
167  _cellType = (Y_CELLTYPE_enum)json_val->getInt("cellType");
168  }
169  if(json_val->has("imsi")) {
170  _imsi = json_val->getString("imsi");
171  }
172  if(json_val->has("message")) {
173  _message = json_val->getString("message");
174  }
175  if(json_val->has("pin")) {
176  _pin = json_val->getString("pin");
177  }
178  if(json_val->has("lockedOperator")) {
179  _lockedOperator = json_val->getString("lockedOperator");
180  }
181  if(json_val->has("airplaneMode")) {
182  _airplaneMode = (Y_AIRPLANEMODE_enum)json_val->getInt("airplaneMode");
183  }
184  if(json_val->has("enableData")) {
185  _enableData = (Y_ENABLEDATA_enum)json_val->getInt("enableData");
186  }
187  if(json_val->has("apn")) {
188  _apn = json_val->getString("apn");
189  }
190  if(json_val->has("apnSecret")) {
191  _apnSecret = json_val->getString("apnSecret");
192  }
193  if(json_val->has("pingInterval")) {
194  _pingInterval = json_val->getInt("pingInterval");
195  }
196  if(json_val->has("dataSent")) {
197  _dataSent = json_val->getInt("dataSent");
198  }
199  if(json_val->has("dataReceived")) {
200  _dataReceived = json_val->getInt("dataReceived");
201  }
202  if(json_val->has("command")) {
203  _command = json_val->getString("command");
204  }
205  return YFunction::_parseAttr(json_val);
206 }
207 
208 
217 {
218  int res = 0;
220  try {
223  {
226  }
227  }
228  }
229  res = _linkQuality;
230  } catch (std::exception) {
232  throw;
233  }
235  return res;
236 }
237 
246 {
247  string res;
249  try {
252  {
255  }
256  }
257  }
258  res = _cellOperator;
259  } catch (std::exception) {
261  throw;
262  }
264  return res;
265 }
266 
276 {
277  string res;
279  try {
282  {
285  }
286  }
287  }
288  res = _cellIdentifier;
289  } catch (std::exception) {
291  throw;
292  }
294  return res;
295 }
296 
306 {
307  Y_CELLTYPE_enum res;
309  try {
312  {
315  }
316  }
317  }
318  res = _cellType;
319  } catch (std::exception) {
321  throw;
322  }
324  return res;
325 }
326 
339 {
340  string res;
342  try {
345  {
348  }
349  }
350  }
351  res = _imsi;
352  } catch (std::exception) {
354  throw;
355  }
357  return res;
358 }
359 
368 {
369  string res;
371  try {
374  {
377  }
378  }
379  }
380  res = _message;
381  } catch (std::exception) {
383  throw;
384  }
386  return res;
387 }
388 
400 string YCellular::get_pin(void)
401 {
402  string res;
404  try {
407  {
409  return YCellular::PIN_INVALID;
410  }
411  }
412  }
413  res = _pin;
414  } catch (std::exception) {
416  throw;
417  }
419  return res;
420 }
421 
441 int YCellular::set_pin(const string& newval)
442 {
443  string rest_val;
444  int res;
446  try {
447  rest_val = newval;
448  res = _setAttr("pin", rest_val);
449  } catch (std::exception) {
451  throw;
452  }
454  return res;
455 }
456 
469 {
470  string res;
472  try {
475  {
478  }
479  }
480  }
481  res = _lockedOperator;
482  } catch (std::exception) {
484  throw;
485  }
487  return res;
488 }
489 
501 int YCellular::set_lockedOperator(const string& newval)
502 {
503  string rest_val;
504  int res;
506  try {
507  rest_val = newval;
508  res = _setAttr("lockedOperator", rest_val);
509  } catch (std::exception) {
511  throw;
512  }
514  return res;
515 }
516 
526 {
529  try {
532  {
535  }
536  }
537  }
538  res = _airplaneMode;
539  } catch (std::exception) {
541  throw;
542  }
544  return res;
545 }
546 
558 {
559  string rest_val;
560  int res;
562  try {
563  rest_val = (newval>0 ? "1" : "0");
564  res = _setAttr("airplaneMode", rest_val);
565  } catch (std::exception) {
567  throw;
568  }
570  return res;
571 }
572 
583 {
584  Y_ENABLEDATA_enum res;
586  try {
589  {
592  }
593  }
594  }
595  res = _enableData;
596  } catch (std::exception) {
598  throw;
599  }
601  return res;
602 }
603 
620 {
621  string rest_val;
622  int res;
624  try {
625  char buf[32]; sprintf(buf, "%d", newval); rest_val = string(buf);
626  res = _setAttr("enableData", rest_val);
627  } catch (std::exception) {
629  throw;
630  }
632  return res;
633 }
634 
643 string YCellular::get_apn(void)
644 {
645  string res;
647  try {
650  {
652  return YCellular::APN_INVALID;
653  }
654  }
655  }
656  res = _apn;
657  } catch (std::exception) {
659  throw;
660  }
662  return res;
663 }
664 
675 int YCellular::set_apn(const string& newval)
676 {
677  string rest_val;
678  int res;
680  try {
681  rest_val = newval;
682  res = _setAttr("apn", rest_val);
683  } catch (std::exception) {
685  throw;
686  }
688  return res;
689 }
690 
702 {
703  string res;
705  try {
708  {
711  }
712  }
713  }
714  res = _apnSecret;
715  } catch (std::exception) {
717  throw;
718  }
720  return res;
721 }
722 
723 int YCellular::set_apnSecret(const string& newval)
724 {
725  string rest_val;
726  int res;
728  try {
729  rest_val = newval;
730  res = _setAttr("apnSecret", rest_val);
731  } catch (std::exception) {
733  throw;
734  }
736  return res;
737 }
738 
747 {
748  int res = 0;
750  try {
753  {
756  }
757  }
758  }
759  res = _pingInterval;
760  } catch (std::exception) {
762  throw;
763  }
765  return res;
766 }
767 
778 {
779  string rest_val;
780  int res;
782  try {
783  char buf[32]; sprintf(buf, "%d", newval); rest_val = string(buf);
784  res = _setAttr("pingInterval", rest_val);
785  } catch (std::exception) {
787  throw;
788  }
790  return res;
791 }
792 
801 {
802  int res = 0;
804  try {
807  {
810  }
811  }
812  }
813  res = _dataSent;
814  } catch (std::exception) {
816  throw;
817  }
819  return res;
820 }
821 
831 int YCellular::set_dataSent(int newval)
832 {
833  string rest_val;
834  int res;
836  try {
837  char buf[32]; sprintf(buf, "%d", newval); rest_val = string(buf);
838  res = _setAttr("dataSent", rest_val);
839  } catch (std::exception) {
841  throw;
842  }
844  return res;
845 }
846 
855 {
856  int res = 0;
858  try {
861  {
864  }
865  }
866  }
867  res = _dataReceived;
868  } catch (std::exception) {
870  throw;
871  }
873  return res;
874 }
875 
886 {
887  string rest_val;
888  int res;
890  try {
891  char buf[32]; sprintf(buf, "%d", newval); rest_val = string(buf);
892  res = _setAttr("dataReceived", rest_val);
893  } catch (std::exception) {
895  throw;
896  }
898  return res;
899 }
900 
902 {
903  string res;
905  try {
908  {
911  }
912  }
913  }
914  res = _command;
915  } catch (std::exception) {
917  throw;
918  }
920  return res;
921 }
922 
923 int YCellular::set_command(const string& newval)
924 {
925  string rest_val;
926  int res;
928  try {
929  rest_val = newval;
930  res = _setAttr("command", rest_val);
931  } catch (std::exception) {
933  throw;
934  }
936  return res;
937 }
938 
967 {
968  YCellular* obj = NULL;
969  int taken = 0;
970  if (YAPI::_apiInitialized) {
972  taken = 1;
973  }try {
974  obj = (YCellular*) YFunction::_FindFromCache("Cellular", func);
975  if (obj == NULL) {
976  obj = new YCellular(func);
977  YFunction::_AddToCache("Cellular", func, obj);
978  }
979  } catch (std::exception) {
981  throw;
982  }
984  return obj;
985 }
986 
999 {
1000  string val;
1001  if (callback != NULL) {
1003  } else {
1005  }
1006  _valueCallbackCellular = callback;
1007  // Immediately invoke value callback with current value
1008  if (callback != NULL && this->isOnline()) {
1009  val = _advertisedValue;
1010  if (!(val == "")) {
1011  this->_invokeValueCallback(val);
1012  }
1013  }
1014  return 0;
1015 }
1016 
1018 {
1019  if (_valueCallbackCellular != NULL) {
1020  _valueCallbackCellular(this, value);
1021  } else {
1023  }
1024  return 0;
1025 }
1026 
1041 int YCellular::sendPUK(string puk,string newPin)
1042 {
1043  string gsmMsg;
1044  gsmMsg = this->get_message();
1045  if (!((gsmMsg).substr(0, 13) == "Enter SIM PUK")) {
1046  _throw(YAPI_INVALID_ARGUMENT,"PUK not expected at this time");
1047  return YAPI_INVALID_ARGUMENT;
1048  }
1049  if (newPin == "") {
1050  return this->set_command(YapiWrapper::ysprintf("AT+CPIN=%s,0000;+CLCK=SC,0,0000",puk.c_str()));
1051  }
1052  return this->set_command(YapiWrapper::ysprintf("AT+CPIN=%s,%s",puk.c_str(),newPin.c_str()));
1053 }
1054 
1066 int YCellular::set_apnAuth(string username,string password)
1067 {
1068  return this->set_apnSecret(YapiWrapper::ysprintf("%s,%s",username.c_str(),password.c_str()));
1069 }
1070 
1079 {
1080  int retcode = 0;
1081 
1082  retcode = this->set_dataReceived(0);
1083  if (retcode != YAPI_SUCCESS) {
1084  return retcode;
1085  }
1086  retcode = this->set_dataSent(0);
1087  return retcode;
1088 }
1089 
1101 string YCellular::_AT(string cmd)
1102 {
1103  int chrPos = 0;
1104  int cmdLen = 0;
1105  int waitMore = 0;
1106  string res;
1107  string buff;
1108  int bufflen = 0;
1109  string buffstr;
1110  int buffstrlen = 0;
1111  int idx = 0;
1112  int suffixlen = 0;
1113  // quote dangerous characters used in AT commands
1114  cmdLen = (int)(cmd).length();
1115  chrPos = _ystrpos(cmd, "#");
1116  while (chrPos >= 0) {
1117  cmd = YapiWrapper::ysprintf("%s%c23%s", (cmd).substr( 0, chrPos).c_str(), 37,(cmd).substr( chrPos+1, cmdLen-chrPos-1).c_str());
1118  cmdLen = cmdLen + 2;
1119  chrPos = _ystrpos(cmd, "#");
1120  }
1121  chrPos = _ystrpos(cmd, "+");
1122  while (chrPos >= 0) {
1123  cmd = YapiWrapper::ysprintf("%s%c2B%s", (cmd).substr( 0, chrPos).c_str(), 37,(cmd).substr( chrPos+1, cmdLen-chrPos-1).c_str());
1124  cmdLen = cmdLen + 2;
1125  chrPos = _ystrpos(cmd, "+");
1126  }
1127  chrPos = _ystrpos(cmd, "=");
1128  while (chrPos >= 0) {
1129  cmd = YapiWrapper::ysprintf("%s%c3D%s", (cmd).substr( 0, chrPos).c_str(), 37,(cmd).substr( chrPos+1, cmdLen-chrPos-1).c_str());
1130  cmdLen = cmdLen + 2;
1131  chrPos = _ystrpos(cmd, "=");
1132  }
1133  cmd = YapiWrapper::ysprintf("at.txt?cmd=%s",cmd.c_str());
1134  res = YapiWrapper::ysprintf("");
1135  // max 2 minutes (each iteration may take up to 5 seconds if waiting)
1136  waitMore = 24;
1137  while (waitMore > 0) {
1138  buff = this->_download(cmd);
1139  bufflen = (int)(buff).size();
1140  buffstr = buff;
1141  buffstrlen = (int)(buffstr).length();
1142  idx = bufflen - 1;
1143  while ((idx > 0) && (((u8)buff[idx]) != 64) && (((u8)buff[idx]) != 10) && (((u8)buff[idx]) != 13)) {
1144  idx = idx - 1;
1145  }
1146  if (((u8)buff[idx]) == 64) {
1147  // continuation detected
1148  suffixlen = bufflen - idx;
1149  cmd = YapiWrapper::ysprintf("at.txt?cmd=%s",(buffstr).substr( buffstrlen - suffixlen, suffixlen).c_str());
1150  buffstr = (buffstr).substr( 0, buffstrlen - suffixlen);
1151  waitMore = waitMore - 1;
1152  } else {
1153  // request complete
1154  waitMore = 0;
1155  }
1156  res = YapiWrapper::ysprintf("%s%s", res.c_str(),buffstr.c_str());
1157  }
1158  return res;
1159 }
1160 
1171 {
1172  string cops;
1173  int idx = 0;
1174  int slen = 0;
1175  vector<string> res;
1176 
1177  cops = this->_AT("+COPS=?");
1178  slen = (int)(cops).length();
1179  res.clear();
1180  idx = _ystrpos(cops, "(");
1181  while (idx >= 0) {
1182  slen = slen - (idx+1);
1183  cops = (cops).substr( idx+1, slen);
1184  idx = _ystrpos(cops, "\"");
1185  if (idx > 0) {
1186  slen = slen - (idx+1);
1187  cops = (cops).substr( idx+1, slen);
1188  idx = _ystrpos(cops, "\"");
1189  if (idx > 0) {
1190  res.push_back((cops).substr( 0, idx));
1191  }
1192  }
1193  idx = _ystrpos(cops, "(");
1194  }
1195  return res;
1196 }
1197 
1206 vector<YCellRecord> YCellular::quickCellSurvey(void)
1207 {
1208  string moni;
1209  vector<string> recs;
1210  int llen = 0;
1211  string mccs;
1212  int mcc = 0;
1213  string mncs;
1214  int mnc = 0;
1215  int lac = 0;
1216  int cellId = 0;
1217  string dbms;
1218  int dbm = 0;
1219  string tads;
1220  int tad = 0;
1221  string oper;
1222  vector<YCellRecord> res;
1223 
1224  moni = this->_AT("+CCED=0;#MONI=7;#MONI");
1225  mccs = (moni).substr(7, 3);
1226  if ((mccs).substr(0, 1) == "0") {
1227  mccs = (mccs).substr(1, 2);
1228  }
1229  if ((mccs).substr(0, 1) == "0") {
1230  mccs = (mccs).substr(1, 1);
1231  }
1232  mcc = atoi((mccs).c_str());
1233  mncs = (moni).substr(11, 3);
1234  if ((mncs).substr(2, 1) == ",") {
1235  mncs = (mncs).substr(0, 2);
1236  }
1237  if ((mncs).substr(0, 1) == "0") {
1238  mncs = (mncs).substr(1, (int)(mncs).length()-1);
1239  }
1240  mnc = atoi((mncs).c_str());
1241  recs = _strsplit(moni,'#');
1242  // process each line in turn
1243  res.clear();
1244  for (unsigned ii = 0; ii < recs.size(); ii++) {
1245  llen = (int)(recs[ii]).length() - 2;
1246  if (llen >= 44) {
1247  if ((recs[ii]).substr(41, 3) == "dbm") {
1248  lac = (int)strtoul((recs[ii]).substr(16, 4).c_str(), NULL, 16);
1249  cellId = (int)strtoul((recs[ii]).substr(23, 4).c_str(), NULL, 16);
1250  dbms = (recs[ii]).substr(37, 4);
1251  if ((dbms).substr(0, 1) == " ") {
1252  dbms = (dbms).substr(1, 3);
1253  }
1254  dbm = atoi((dbms).c_str());
1255  if (llen > 66) {
1256  tads = (recs[ii]).substr(54, 2);
1257  if ((tads).substr(0, 1) == " ") {
1258  tads = (tads).substr(1, 3);
1259  }
1260  tad = atoi((tads).c_str());
1261  oper = (recs[ii]).substr(66, llen-66);
1262  } else {
1263  tad = -1;
1264  oper = "";
1265  }
1266  if (lac < 65535) {
1267  res.push_back(YCellRecord(mcc,mnc,lac,cellId,dbm,tad,oper));
1268  }
1269  }
1270  }
1271  }
1272  return res;
1273 }
1274 
1276 {
1277  string hwid;
1278 
1279  if(YISERR(_nextFunction(hwid)) || hwid=="") {
1280  return NULL;
1281  }
1282  return YCellular::FindCellular(hwid);
1283 }
1284 
1286 {
1287  vector<YFUN_DESCR> v_fundescr;
1288  YDEV_DESCR ydevice;
1289  string serial, funcId, funcName, funcVal, errmsg;
1290 
1291  if(YISERR(YapiWrapper::getFunctionsByClass("Cellular", 0, v_fundescr, sizeof(YFUN_DESCR), errmsg)) ||
1292  v_fundescr.size() == 0 ||
1293  YISERR(YapiWrapper::getFunctionInfo(v_fundescr[0], ydevice, serial, funcId, funcName, funcVal, errmsg))) {
1294  return NULL;
1295  }
1296  return YCellular::FindCellular(serial+"."+funcId);
1297 }
1298 
1299 //--- (end of generated code: YCellular implementation)
1300 
1301 //--- (generated code: YCellular functions)
1302 //--- (end of generated code: YCellular functions)
string get_pin(void)
string _advertisedValue
Definition: yocto_api.h:1569
int set_apn(const string &newval)
yCRITICAL_SECTION _this_cs
Definition: yocto_api.h:1563
virtual int _invokeValueCallback(string value)
int set_apnSecret(const string &newval)
int set_dataReceived(int newval)
string get_apnSecret(void)
static YCellular * FirstCellular(void)
YRETCODE _load_unsafe(int msValidity)
Definition: yocto_api.cpp:3327
static const Y_ENABLEDATA_enum ENABLEDATA_INVALID
string get_imsi(void)
YCellularValueCallback _valueCallbackCellular
Y_CELLTYPE_enum
static const string APNSECRET_INVALID
string get_cellOperator(void)
virtual int get_locationAreaCode(void)
string get_message(void)
virtual int get_cellId(void)
static int DefaultCacheValidity
Definition: yocto_api.h:468
string getString(const string &key)
Definition: yocto_api.cpp:773
string _message
string get_lockedOperator(void)
int set_pin(const string &newval)
int get_dataReceived(void)
int get_pingInterval(void)
string _cellOperator
u64 _cacheExpiration
Definition: yocto_api.h:1571
int _ystrpos(const string &haystack, const string &needle)
Definition: yocto_api.cpp:75
void _throw(YRETCODE errType, string errMsg)
Definition: yocto_api.cpp:2656
static const Y_CELLTYPE_enum CELLTYPE_INVALID
void yLeaveCriticalSection(yCRITICAL_SECTION *cs)
Definition: ythread.c:672
virtual int get_timingAdvance(void)
string _download(const string &url)
Definition: yocto_api.cpp:3053
static YRETCODE getFunctionInfo(YFUN_DESCR fundesc, YDEV_DESCR &devdescr, string &serial, string &funcId, string &funcName, string &funcVal, string &errmsg)
Definition: yocto_api.cpp:4930
int set_dataSent(int newval)
static YCellular * FindCellular(string func)
virtual string get_cellOperator(void)
#define YAPI_INVALID_STRING
Definition: yocto_api.h:69
int set_enableData(Y_ENABLEDATA_enum newval)
virtual int _parseAttr(YJSONObject *json_val)
Definition: yocto_api.cpp:2367
virtual int get_mobileNetworkCode(void)
virtual int get_mobileCountryCode(void)
string _command
void(* YCellularValueCallback)(YCellular *func, const string &functionValue)
YAPI_FUNCTION YFUN_DESCR
Definition: yocto_api.h:230
static const int DATARECEIVED_INVALID
int getInt(const string &key)
Definition: yocto_api.cpp:779
static const string LOCKEDOPERATOR_INVALID
static u64 GetTickCount(void)
Definition: yocto_api.cpp:4755
static void _AddToCache(const string &classname, const string &func, YFunction *obj)
Definition: yocto_api.cpp:2345
YCellular(const string &func)
virtual int clearDataCounters(void)
static const string MESSAGE_INVALID
string get_cellIdentifier(void)
vector< string > _strsplit(const string &str, char delimiter)
Definition: yocto_api.cpp:85
virtual int _parseAttr(YJSONObject *json_val)
static const string APN_INVALID
YCellular * nextCellular(void)
virtual string _AT(string cmd)
YAPI_DEVICE YDEV_DESCR
Definition: yocto_api.h:229
static YFunction * _FindFromCache(const string &classname, const string &func)
Definition: yocto_api.cpp:2338
static const int LINKQUALITY_INVALID
int set_command(const string &newval)
Y_AIRPLANEMODE_enum
static string ysprintf(const char *fmt,...)
Definition: yocto_api.cpp:4997
int set_pingInterval(int newval)
int get_linkQuality(void)
static const string CELLIDENTIFIER_INVALID
void yEnterCriticalSection(yCRITICAL_SECTION *cs)
Definition: ythread.c:647
YCellRecord(int mcc, int mnc, int lac, int cellId, int dbm, int tad, const string &oper)
static yCRITICAL_SECTION _global_cs
Definition: yocto_api.h:476
bool isOnline(void)
Definition: yocto_api.cpp:3291
string _apnSecret
static const string CELLOPERATOR_INVALID
Y_ENABLEDATA_enum get_enableData(void)
Y_ENABLEDATA_enum _enableData
static const string COMMAND_INVALID
Y_ENABLEDATA_enum
int get_dataSent(void)
static int getFunctionsByClass(const string &class_str, YFUN_DESCR prevfundesc, vector< YFUN_DESCR > &buffer, int maxsize, string &errmsg)
Definition: yocto_api.cpp:4852
Y_CELLTYPE_enum _cellType
string _className
Definition: yocto_api.h:1558
Y_AIRPLANEMODE_enum get_airplaneMode(void)
static const string IMSI_INVALID
static const Y_AIRPLANEMODE_enum AIRPLANEMODE_INVALID
string get_command(void)
virtual int sendPUK(string puk, string newPin)
string get_apn(void)
int set_lockedOperator(const string &newval)
virtual int set_apnAuth(string username, string password)
int set_airplaneMode(Y_AIRPLANEMODE_enum newval)
Y_CELLTYPE_enum get_cellType(void)
virtual int registerValueCallback(YCellularValueCallback callback)
string _cellIdentifier
static bool _apiInitialized
Definition: yocto_api.h:475
Y_AIRPLANEMODE_enum _airplaneMode
YRETCODE _nextFunction(string &hwId)
Definition: yocto_api.cpp:2709
virtual int get_signalStrength(void)
static const int DATASENT_INVALID
static void _UpdateValueCallbackList(YFunction *func, bool add)
Definition: yocto_api.cpp:3509
#define YISERR(retcode)
Definition: ydef.h:394
static const int PINGINTERVAL_INVALID
string _lockedOperator
bool has(const string &key)
Definition: yocto_api.cpp:735
YRETCODE _setAttr(string attrname, string newvalue)
Definition: yocto_api.cpp:2968
string _imsi
static const string PIN_INVALID
virtual vector< string > get_availableOperators(void)
virtual int _invokeValueCallback(string value)
Definition: yocto_api.cpp:2563
virtual vector< YCellRecord > quickCellSurvey(void)


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