yocto_network.cpp
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * $Id: yocto_network.cpp 29064 2017-11-02 16:13:37Z seb $
4  *
5  * Implements yFindNetwork(), the high-level API for Network 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_network.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__ "network"
50 
51 YNetwork::YNetwork(const string& func): YFunction(func)
52 //--- (YNetwork initialization)
53  ,_readiness(READINESS_INVALID)
54  ,_macAddress(MACADDRESS_INVALID)
55  ,_ipAddress(IPADDRESS_INVALID)
56  ,_subnetMask(SUBNETMASK_INVALID)
57  ,_router(ROUTER_INVALID)
58  ,_ipConfig(IPCONFIG_INVALID)
59  ,_primaryDNS(PRIMARYDNS_INVALID)
60  ,_secondaryDNS(SECONDARYDNS_INVALID)
61  ,_ntpServer(NTPSERVER_INVALID)
62  ,_userPassword(USERPASSWORD_INVALID)
63  ,_adminPassword(ADMINPASSWORD_INVALID)
64  ,_httpPort(HTTPPORT_INVALID)
65  ,_defaultPage(DEFAULTPAGE_INVALID)
66  ,_discoverable(DISCOVERABLE_INVALID)
67  ,_wwwWatchdogDelay(WWWWATCHDOGDELAY_INVALID)
68  ,_callbackUrl(CALLBACKURL_INVALID)
69  ,_callbackMethod(CALLBACKMETHOD_INVALID)
70  ,_callbackEncoding(CALLBACKENCODING_INVALID)
71  ,_callbackCredentials(CALLBACKCREDENTIALS_INVALID)
72  ,_callbackInitialDelay(CALLBACKINITIALDELAY_INVALID)
73  ,_callbackSchedule(CALLBACKSCHEDULE_INVALID)
74  ,_callbackMinDelay(CALLBACKMINDELAY_INVALID)
75  ,_callbackMaxDelay(CALLBACKMAXDELAY_INVALID)
76  ,_poeCurrent(POECURRENT_INVALID)
77  ,_valueCallbackNetwork(NULL)
78 //--- (end of YNetwork initialization)
79 {
80  _className="Network";
81 }
82 
84 {
85 //--- (YNetwork cleanup)
86 //--- (end of YNetwork cleanup)
87 }
88 //--- (YNetwork implementation)
89 // static attributes
104 
106 {
107  if(json_val->has("readiness")) {
108  _readiness = (Y_READINESS_enum)json_val->getInt("readiness");
109  }
110  if(json_val->has("macAddress")) {
111  _macAddress = json_val->getString("macAddress");
112  }
113  if(json_val->has("ipAddress")) {
114  _ipAddress = json_val->getString("ipAddress");
115  }
116  if(json_val->has("subnetMask")) {
117  _subnetMask = json_val->getString("subnetMask");
118  }
119  if(json_val->has("router")) {
120  _router = json_val->getString("router");
121  }
122  if(json_val->has("ipConfig")) {
123  _ipConfig = json_val->getString("ipConfig");
124  }
125  if(json_val->has("primaryDNS")) {
126  _primaryDNS = json_val->getString("primaryDNS");
127  }
128  if(json_val->has("secondaryDNS")) {
129  _secondaryDNS = json_val->getString("secondaryDNS");
130  }
131  if(json_val->has("ntpServer")) {
132  _ntpServer = json_val->getString("ntpServer");
133  }
134  if(json_val->has("userPassword")) {
135  _userPassword = json_val->getString("userPassword");
136  }
137  if(json_val->has("adminPassword")) {
138  _adminPassword = json_val->getString("adminPassword");
139  }
140  if(json_val->has("httpPort")) {
141  _httpPort = json_val->getInt("httpPort");
142  }
143  if(json_val->has("defaultPage")) {
144  _defaultPage = json_val->getString("defaultPage");
145  }
146  if(json_val->has("discoverable")) {
147  _discoverable = (Y_DISCOVERABLE_enum)json_val->getInt("discoverable");
148  }
149  if(json_val->has("wwwWatchdogDelay")) {
150  _wwwWatchdogDelay = json_val->getInt("wwwWatchdogDelay");
151  }
152  if(json_val->has("callbackUrl")) {
153  _callbackUrl = json_val->getString("callbackUrl");
154  }
155  if(json_val->has("callbackMethod")) {
156  _callbackMethod = (Y_CALLBACKMETHOD_enum)json_val->getInt("callbackMethod");
157  }
158  if(json_val->has("callbackEncoding")) {
159  _callbackEncoding = (Y_CALLBACKENCODING_enum)json_val->getInt("callbackEncoding");
160  }
161  if(json_val->has("callbackCredentials")) {
162  _callbackCredentials = json_val->getString("callbackCredentials");
163  }
164  if(json_val->has("callbackInitialDelay")) {
165  _callbackInitialDelay = json_val->getInt("callbackInitialDelay");
166  }
167  if(json_val->has("callbackSchedule")) {
168  _callbackSchedule = json_val->getString("callbackSchedule");
169  }
170  if(json_val->has("callbackMinDelay")) {
171  _callbackMinDelay = json_val->getInt("callbackMinDelay");
172  }
173  if(json_val->has("callbackMaxDelay")) {
174  _callbackMaxDelay = json_val->getInt("callbackMaxDelay");
175  }
176  if(json_val->has("poeCurrent")) {
177  _poeCurrent = json_val->getInt("poeCurrent");
178  }
179  return YFunction::_parseAttr(json_val);
180 }
181 
182 
205 {
206  Y_READINESS_enum res;
208  try {
211  {
214  }
215  }
216  }
217  res = _readiness;
218  } catch (std::exception) {
220  throw;
221  }
223  return res;
224 }
225 
235 {
236  string res;
238  try {
239  if (_cacheExpiration == 0) {
241  {
244  }
245  }
246  }
247  res = _macAddress;
248  } catch (std::exception) {
250  throw;
251  }
253  return res;
254 }
255 
265 {
266  string res;
268  try {
271  {
274  }
275  }
276  }
277  res = _ipAddress;
278  } catch (std::exception) {
280  throw;
281  }
283  return res;
284 }
285 
294 {
295  string res;
297  try {
300  {
303  }
304  }
305  }
306  res = _subnetMask;
307  } catch (std::exception) {
309  throw;
310  }
312  return res;
313 }
314 
323 {
324  string res;
326  try {
329  {
332  }
333  }
334  }
335  res = _router;
336  } catch (std::exception) {
338  throw;
339  }
341  return res;
342 }
343 
364 {
365  string res;
367  try {
370  {
373  }
374  }
375  }
376  res = _ipConfig;
377  } catch (std::exception) {
379  throw;
380  }
382  return res;
383 }
384 
385 int YNetwork::set_ipConfig(const string& newval)
386 {
387  string rest_val;
388  int res;
390  try {
391  rest_val = newval;
392  res = _setAttr("ipConfig", rest_val);
393  } catch (std::exception) {
395  throw;
396  }
398  return res;
399 }
400 
409 {
410  string res;
412  try {
415  {
418  }
419  }
420  }
421  res = _primaryDNS;
422  } catch (std::exception) {
424  throw;
425  }
427  return res;
428 }
429 
441 int YNetwork::set_primaryDNS(const string& newval)
442 {
443  string rest_val;
444  int res;
446  try {
447  rest_val = newval;
448  res = _setAttr("primaryDNS", rest_val);
449  } catch (std::exception) {
451  throw;
452  }
454  return res;
455 }
456 
465 {
466  string res;
468  try {
471  {
474  }
475  }
476  }
477  res = _secondaryDNS;
478  } catch (std::exception) {
480  throw;
481  }
483  return res;
484 }
485 
497 int YNetwork::set_secondaryDNS(const string& newval)
498 {
499  string rest_val;
500  int res;
502  try {
503  rest_val = newval;
504  res = _setAttr("secondaryDNS", rest_val);
505  } catch (std::exception) {
507  throw;
508  }
510  return res;
511 }
512 
521 {
522  string res;
524  try {
527  {
530  }
531  }
532  }
533  res = _ntpServer;
534  } catch (std::exception) {
536  throw;
537  }
539  return res;
540 }
541 
552 int YNetwork::set_ntpServer(const string& newval)
553 {
554  string rest_val;
555  int res;
557  try {
558  rest_val = newval;
559  res = _setAttr("ntpServer", rest_val);
560  } catch (std::exception) {
562  throw;
563  }
565  return res;
566 }
567 
578 {
579  string res;
581  try {
584  {
587  }
588  }
589  }
590  res = _userPassword;
591  } catch (std::exception) {
593  throw;
594  }
596  return res;
597 }
598 
612 int YNetwork::set_userPassword(const string& newval)
613 {
614  string rest_val;
615  int res;
616  if (newval.length() > YAPI_HASH_BUF_SIZE) {
617  _throw(YAPI_INVALID_ARGUMENT, "Password too long :" + newval);
618  return YAPI_INVALID_ARGUMENT;
619  }
621  try {
622  rest_val = newval;
623  res = _setAttr("userPassword", rest_val);
624  } catch (std::exception) {
626  throw;
627  }
629  return res;
630 }
631 
642 {
643  string res;
645  try {
648  {
651  }
652  }
653  }
654  res = _adminPassword;
655  } catch (std::exception) {
657  throw;
658  }
660  return res;
661 }
662 
676 int YNetwork::set_adminPassword(const string& newval)
677 {
678  string rest_val;
679  int res;
680  if (newval.length() > YAPI_HASH_BUF_SIZE) {
681  _throw(YAPI_INVALID_ARGUMENT, "Password too long :" + newval);
682  return YAPI_INVALID_ARGUMENT;
683  }
685  try {
686  rest_val = newval;
687  res = _setAttr("adminPassword", rest_val);
688  } catch (std::exception) {
690  throw;
691  }
693  return res;
694 }
695 
704 {
705  int res = 0;
707  try {
710  {
713  }
714  }
715  }
716  res = _httpPort;
717  } catch (std::exception) {
719  throw;
720  }
722  return res;
723 }
724 
736 int YNetwork::set_httpPort(int newval)
737 {
738  string rest_val;
739  int res;
741  try {
742  char buf[32]; sprintf(buf, "%d", newval); rest_val = string(buf);
743  res = _setAttr("httpPort", rest_val);
744  } catch (std::exception) {
746  throw;
747  }
749  return res;
750 }
751 
760 {
761  string res;
763  try {
766  {
769  }
770  }
771  }
772  res = _defaultPage;
773  } catch (std::exception) {
775  throw;
776  }
778  return res;
779 }
780 
792 int YNetwork::set_defaultPage(const string& newval)
793 {
794  string rest_val;
795  int res;
797  try {
798  rest_val = newval;
799  res = _setAttr("defaultPage", rest_val);
800  } catch (std::exception) {
802  throw;
803  }
805  return res;
806 }
807 
819 {
822  try {
825  {
828  }
829  }
830  }
831  res = _discoverable;
832  } catch (std::exception) {
834  throw;
835  }
837  return res;
838 }
839 
853 {
854  string rest_val;
855  int res;
857  try {
858  rest_val = (newval>0 ? "1" : "0");
859  res = _setAttr("discoverable", rest_val);
860  } catch (std::exception) {
862  throw;
863  }
865  return res;
866 }
867 
880 {
881  int res = 0;
883  try {
886  {
889  }
890  }
891  }
892  res = _wwwWatchdogDelay;
893  } catch (std::exception) {
895  throw;
896  }
898  return res;
899 }
900 
916 {
917  string rest_val;
918  int res;
920  try {
921  char buf[32]; sprintf(buf, "%d", newval); rest_val = string(buf);
922  res = _setAttr("wwwWatchdogDelay", rest_val);
923  } catch (std::exception) {
925  throw;
926  }
928  return res;
929 }
930 
939 {
940  string res;
942  try {
945  {
948  }
949  }
950  }
951  res = _callbackUrl;
952  } catch (std::exception) {
954  throw;
955  }
957  return res;
958 }
959 
970 int YNetwork::set_callbackUrl(const string& newval)
971 {
972  string rest_val;
973  int res;
975  try {
976  rest_val = newval;
977  res = _setAttr("callbackUrl", rest_val);
978  } catch (std::exception) {
980  throw;
981  }
983  return res;
984 }
985 
995 {
998  try {
1001  {
1004  }
1005  }
1006  }
1007  res = _callbackMethod;
1008  } catch (std::exception) {
1010  throw;
1011  }
1013  return res;
1014 }
1015 
1027 {
1028  string rest_val;
1029  int res;
1031  try {
1032  char buf[32]; sprintf(buf, "%d", newval); rest_val = string(buf);
1033  res = _setAttr("callbackMethod", rest_val);
1034  } catch (std::exception) {
1036  throw;
1037  }
1039  return res;
1040 }
1041 
1054 {
1057  try {
1060  {
1063  }
1064  }
1065  }
1066  res = _callbackEncoding;
1067  } catch (std::exception) {
1069  throw;
1070  }
1072  return res;
1073 }
1074 
1089 {
1090  string rest_val;
1091  int res;
1093  try {
1094  char buf[32]; sprintf(buf, "%d", newval); rest_val = string(buf);
1095  res = _setAttr("callbackEncoding", rest_val);
1096  } catch (std::exception) {
1098  throw;
1099  }
1101  return res;
1102 }
1103 
1114 {
1115  string res;
1117  try {
1120  {
1123  }
1124  }
1125  }
1126  res = _callbackCredentials;
1127  } catch (std::exception) {
1129  throw;
1130  }
1132  return res;
1133 }
1134 
1152 int YNetwork::set_callbackCredentials(const string& newval)
1153 {
1154  string rest_val;
1155  int res;
1157  try {
1158  rest_val = newval;
1159  res = _setAttr("callbackCredentials", rest_val);
1160  } catch (std::exception) {
1162  throw;
1163  }
1165  return res;
1166 }
1167 
1181 int YNetwork::callbackLogin(string username,string password)
1182 {
1183  string rest_val;
1184  rest_val = string(username)+string(":")+string(password);
1185  return _setAttr("callbackCredentials", rest_val);
1186 }
1187 
1196 {
1197  int res = 0;
1199  try {
1202  {
1205  }
1206  }
1207  }
1208  res = _callbackInitialDelay;
1209  } catch (std::exception) {
1211  throw;
1212  }
1214  return res;
1215 }
1216 
1228 {
1229  string rest_val;
1230  int res;
1232  try {
1233  char buf[32]; sprintf(buf, "%d", newval); rest_val = string(buf);
1234  res = _setAttr("callbackInitialDelay", rest_val);
1235  } catch (std::exception) {
1237  throw;
1238  }
1240  return res;
1241 }
1242 
1251 {
1252  string res;
1254  try {
1257  {
1260  }
1261  }
1262  }
1263  res = _callbackSchedule;
1264  } catch (std::exception) {
1266  throw;
1267  }
1269  return res;
1270 }
1271 
1281 int YNetwork::set_callbackSchedule(const string& newval)
1282 {
1283  string rest_val;
1284  int res;
1286  try {
1287  rest_val = newval;
1288  res = _setAttr("callbackSchedule", rest_val);
1289  } catch (std::exception) {
1291  throw;
1292  }
1294  return res;
1295 }
1296 
1305 {
1306  int res = 0;
1308  try {
1311  {
1314  }
1315  }
1316  }
1317  res = _callbackMinDelay;
1318  } catch (std::exception) {
1320  throw;
1321  }
1323  return res;
1324 }
1325 
1336 {
1337  string rest_val;
1338  int res;
1340  try {
1341  char buf[32]; sprintf(buf, "%d", newval); rest_val = string(buf);
1342  res = _setAttr("callbackMinDelay", rest_val);
1343  } catch (std::exception) {
1345  throw;
1346  }
1348  return res;
1349 }
1350 
1359 {
1360  int res = 0;
1362  try {
1365  {
1368  }
1369  }
1370  }
1371  res = _callbackMaxDelay;
1372  } catch (std::exception) {
1374  throw;
1375  }
1377  return res;
1378 }
1379 
1391 {
1392  string rest_val;
1393  int res;
1395  try {
1396  char buf[32]; sprintf(buf, "%d", newval); rest_val = string(buf);
1397  res = _setAttr("callbackMaxDelay", rest_val);
1398  } catch (std::exception) {
1400  throw;
1401  }
1403  return res;
1404 }
1405 
1417 {
1418  int res = 0;
1420  try {
1423  {
1426  }
1427  }
1428  }
1429  res = _poeCurrent;
1430  } catch (std::exception) {
1432  throw;
1433  }
1435  return res;
1436 }
1437 
1466 {
1467  YNetwork* obj = NULL;
1468  int taken = 0;
1469  if (YAPI::_apiInitialized) {
1471  taken = 1;
1472  }try {
1473  obj = (YNetwork*) YFunction::_FindFromCache("Network", func);
1474  if (obj == NULL) {
1475  obj = new YNetwork(func);
1476  YFunction::_AddToCache("Network", func, obj);
1477  }
1478  } catch (std::exception) {
1480  throw;
1481  }
1483  return obj;
1484 }
1485 
1498 {
1499  string val;
1500  if (callback != NULL) {
1502  } else {
1504  }
1505  _valueCallbackNetwork = callback;
1506  // Immediately invoke value callback with current value
1507  if (callback != NULL && this->isOnline()) {
1508  val = _advertisedValue;
1509  if (!(val == "")) {
1510  this->_invokeValueCallback(val);
1511  }
1512  }
1513  return 0;
1514 }
1515 
1517 {
1518  if (_valueCallbackNetwork != NULL) {
1519  _valueCallbackNetwork(this, value);
1520  } else {
1522  }
1523  return 0;
1524 }
1525 
1541 int YNetwork::useDHCP(string fallbackIpAddr,int fallbackSubnetMaskLen,string fallbackRouter)
1542 {
1543  return this->set_ipConfig(YapiWrapper::ysprintf("DHCP:%s/%d/%s", fallbackIpAddr.c_str(), fallbackSubnetMaskLen,fallbackRouter.c_str()));
1544 }
1545 
1557 {
1558  return this->set_ipConfig("DHCP:");
1559 }
1560 
1573 int YNetwork::useStaticIP(string ipAddress,int subnetMaskLen,string router)
1574 {
1575  return this->set_ipConfig(YapiWrapper::ysprintf("STATIC:%s/%d/%s", ipAddress.c_str(), subnetMaskLen,router.c_str()));
1576 }
1577 
1587 string YNetwork::ping(string host)
1588 {
1589  string content;
1590 
1591  content = this->_download(YapiWrapper::ysprintf("ping.txt?host=%s",host.c_str()));
1592  return content;
1593 }
1594 
1606 {
1607  return this->set_callbackMethod(this->get_callbackMethod());
1608 }
1609 
1623 int YNetwork::set_periodicCallbackSchedule(string interval,int offset)
1624 {
1625  return this->set_callbackSchedule(YapiWrapper::ysprintf("every %s+%d",interval.c_str(),offset));
1626 }
1627 
1629 {
1630  string hwid;
1631 
1632  if(YISERR(_nextFunction(hwid)) || hwid=="") {
1633  return NULL;
1634  }
1635  return YNetwork::FindNetwork(hwid);
1636 }
1637 
1639 {
1640  vector<YFUN_DESCR> v_fundescr;
1641  YDEV_DESCR ydevice;
1642  string serial, funcId, funcName, funcVal, errmsg;
1643 
1644  if(YISERR(YapiWrapper::getFunctionsByClass("Network", 0, v_fundescr, sizeof(YFUN_DESCR), errmsg)) ||
1645  v_fundescr.size() == 0 ||
1646  YISERR(YapiWrapper::getFunctionInfo(v_fundescr[0], ydevice, serial, funcId, funcName, funcVal, errmsg))) {
1647  return NULL;
1648  }
1649  return YNetwork::FindNetwork(serial+"."+funcId);
1650 }
1651 
1652 //--- (end of YNetwork implementation)
1653 
1654 //--- (YNetwork functions)
1655 //--- (end of YNetwork functions)
Y_CALLBACKMETHOD_enum
Definition: yocto_network.h:76
string _advertisedValue
Definition: yocto_api.h:1569
string _callbackSchedule
string _userPassword
string get_adminPassword(void)
int set_callbackMethod(Y_CALLBACKMETHOD_enum newval)
static const string SUBNETMASK_INVALID
yCRITICAL_SECTION _this_cs
Definition: yocto_api.h:1563
int _callbackInitialDelay
static const int CALLBACKMAXDELAY_INVALID
Y_DISCOVERABLE_enum get_discoverable(void)
int set_callbackInitialDelay(int newval)
string _macAddress
Y_DISCOVERABLE_enum _discoverable
string get_primaryDNS(void)
YRETCODE _load_unsafe(int msValidity)
Definition: yocto_api.cpp:3327
int _wwwWatchdogDelay
static const int POECURRENT_INVALID
int _callbackMaxDelay
Y_DISCOVERABLE_enum
Definition: yocto_network.h:68
string get_subnetMask(void)
static const string CALLBACKCREDENTIALS_INVALID
static const string DEFAULTPAGE_INVALID
string get_userPassword(void)
int set_callbackMinDelay(int newval)
int set_userPassword(const string &newval)
int set_primaryDNS(const string &newval)
YNetwork * nextNetwork(void)
string _ntpServer
static int DefaultCacheValidity
Definition: yocto_api.h:468
int set_callbackUrl(const string &newval)
string getString(const string &key)
Definition: yocto_api.cpp:773
virtual int registerValueCallback(YNetworkValueCallback callback)
int set_callbackSchedule(const string &newval)
virtual int triggerCallback(void)
int set_ipConfig(const string &newval)
u64 _cacheExpiration
Definition: yocto_api.h:1571
void _throw(YRETCODE errType, string errMsg)
Definition: yocto_api.cpp:2656
Y_CALLBACKENCODING_enum
Definition: yocto_network.h:85
void yLeaveCriticalSection(yCRITICAL_SECTION *cs)
Definition: ythread.c:672
string _download(const string &url)
Definition: yocto_api.cpp:3053
string _adminPassword
static YRETCODE getFunctionInfo(YFUN_DESCR fundesc, YDEV_DESCR &devdescr, string &serial, string &funcId, string &funcName, string &funcVal, string &errmsg)
Definition: yocto_api.cpp:4930
static const string PRIMARYDNS_INVALID
static YNetwork * FindNetwork(string func)
int get_httpPort(void)
static const Y_READINESS_enum READINESS_INVALID
int get_callbackMinDelay(void)
string _router
string get_callbackUrl(void)
#define YAPI_INVALID_STRING
Definition: yocto_api.h:69
static const string MACADDRESS_INVALID
virtual int _parseAttr(YJSONObject *json_val)
Definition: yocto_api.cpp:2367
virtual int _invokeValueCallback(string value)
virtual int useDHCPauto(void)
string router(void)
string get_ipAddress(void)
YAPI_FUNCTION YFUN_DESCR
Definition: yocto_api.h:230
int set_defaultPage(const string &newval)
static const string CALLBACKSCHEDULE_INVALID
int getInt(const string &key)
Definition: yocto_api.cpp:779
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
YNetwork(const string &func)
Y_READINESS_enum get_readiness(void)
int set_adminPassword(const string &newval)
int _poeCurrent
int get_callbackInitialDelay(void)
string _ipAddress
static YNetwork * FirstNetwork(void)
string get_macAddress(void)
Y_CALLBACKMETHOD_enum get_callbackMethod(void)
static const string IPCONFIG_INVALID
string get_secondaryDNS(void)
static const string ROUTER_INVALID
static const int HTTPPORT_INVALID
string get_ipConfig(void)
static const string IPADDRESS_INVALID
YNetworkValueCallback _valueCallbackNetwork
string ipAddress(void)
YAPI_DEVICE YDEV_DESCR
Definition: yocto_api.h:229
static YFunction * _FindFromCache(const string &classname, const string &func)
Definition: yocto_api.cpp:2338
static string ysprintf(const char *fmt,...)
Definition: yocto_api.cpp:4997
int set_secondaryDNS(const string &newval)
virtual int useStaticIP(string ipAddress, int subnetMaskLen, string router)
string _callbackUrl
static const int CALLBACKMINDELAY_INVALID
void yEnterCriticalSection(yCRITICAL_SECTION *cs)
Definition: ythread.c:647
static yCRITICAL_SECTION _global_cs
Definition: yocto_api.h:476
string _defaultPage
bool isOnline(void)
Definition: yocto_api.cpp:3291
virtual int _parseAttr(YJSONObject *json_val)
int get_wwwWatchdogDelay(void)
Y_CALLBACKENCODING_enum _callbackEncoding
string get_ntpServer(void)
static const Y_DISCOVERABLE_enum DISCOVERABLE_INVALID
void(* YNetworkValueCallback)(YNetwork *func, const string &functionValue)
Definition: yocto_network.h:54
#define YAPI_HASH_BUF_SIZE
Definition: ydef.h:406
static int getFunctionsByClass(const string &class_str, YFUN_DESCR prevfundesc, vector< YFUN_DESCR > &buffer, int maxsize, string &errmsg)
Definition: yocto_api.cpp:4852
int set_callbackMaxDelay(int newval)
static const string USERPASSWORD_INVALID
virtual int useDHCP(string fallbackIpAddr, int fallbackSubnetMaskLen, string fallbackRouter)
static const string SECONDARYDNS_INVALID
string _subnetMask
string get_callbackSchedule(void)
int set_callbackCredentials(const string &newval)
int _callbackMinDelay
static const Y_CALLBACKMETHOD_enum CALLBACKMETHOD_INVALID
virtual string ping(string host)
static const string CALLBACKURL_INVALID
string _className
Definition: yocto_api.h:1558
int callbackLogin(string username, string password)
int set_callbackEncoding(Y_CALLBACKENCODING_enum newval)
virtual int set_periodicCallbackSchedule(string interval, int offset)
static const string ADMINPASSWORD_INVALID
string get_callbackCredentials(void)
int get_callbackMaxDelay(void)
Y_READINESS_enum
Definition: yocto_network.h:57
static bool _apiInitialized
Definition: yocto_api.h:475
Y_READINESS_enum _readiness
int set_wwwWatchdogDelay(int newval)
YRETCODE _nextFunction(string &hwId)
Definition: yocto_api.cpp:2709
static void _UpdateValueCallbackList(YFunction *func, bool add)
Definition: yocto_api.cpp:3509
#define YISERR(retcode)
Definition: ydef.h:394
int get_poeCurrent(void)
string _ipConfig
static const int CALLBACKINITIALDELAY_INVALID
static const int WWWWATCHDOGDELAY_INVALID
string _primaryDNS
static const Y_CALLBACKENCODING_enum CALLBACKENCODING_INVALID
string get_defaultPage(void)
string _secondaryDNS
static const string NTPSERVER_INVALID
bool has(const string &key)
Definition: yocto_api.cpp:735
Y_CALLBACKMETHOD_enum _callbackMethod
int set_discoverable(Y_DISCOVERABLE_enum newval)
YRETCODE _setAttr(string attrname, string newvalue)
Definition: yocto_api.cpp:2968
Y_CALLBACKENCODING_enum get_callbackEncoding(void)
int set_httpPort(int newval)
string get_router(void)
string _callbackCredentials
virtual int _invokeValueCallback(string value)
Definition: yocto_api.cpp:2563
int set_ntpServer(const string &newval)


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