yocto_serialport.cpp
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * $Id: yocto_serialport.cpp 28753 2017-10-03 11:23:38Z seb $
4  *
5  * Implements yFindSerialPort(), the high-level API for SerialPort 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_serialport.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__ "serialport"
50 
51 
53 //--- (generated code: YSnoopingRecord initialization)
54  _tim(0)
55  ,_dir(0)
56 //--- (end of generated code: YSnoopingRecord initialization)
57 {
59  // Parse JSON data
60  j.src = json.c_str();
61  j.end = j.src + strlen(j.src);
62  j.st = YJSON_START;
64  return ;
65  }
66  while(yJsonParse(&j) == YJSON_PARSE_AVAIL && j.st == YJSON_PARSE_MEMBNAME) {
67  if (!strcmp(j.token, "m")) {
68  string tmp;
69  if (yJsonParse(&j) != YJSON_PARSE_AVAIL) {
70  return ;
71  }
72  tmp = (string)j.token;
74  tmp +=(string)j.token;
75  }
76  _dir = (tmp[0] == '<' ? 1 : 0);
77  _msg = tmp.substr(1);
78  } else if(!strcmp(j.token, "t")) {
79  if (yJsonParse(&j) != YJSON_PARSE_AVAIL) {
80  return;
81  }
82  _tim = atoi(j.token);;
83  } else {
84  yJsonSkip(&j, 1);
85  }
86  }
87 }
88 
89 //--- (generated code: YSnoopingRecord implementation)
90 // static attributes
91 
92 
94 {
95  return _tim;
96 }
97 
99 {
100  return _dir;
101 }
102 
104 {
105  return _msg;
106 }
107 //--- (end of generated code: YSnoopingRecord implementation)
108 
109 
110 YSerialPort::YSerialPort(const string& func): YFunction(func)
111 //--- (generated code: YSerialPort initialization)
112  ,_rxCount(RXCOUNT_INVALID)
113  ,_txCount(TXCOUNT_INVALID)
114  ,_errCount(ERRCOUNT_INVALID)
115  ,_rxMsgCount(RXMSGCOUNT_INVALID)
116  ,_txMsgCount(TXMSGCOUNT_INVALID)
117  ,_lastMsg(LASTMSG_INVALID)
118  ,_currentJob(CURRENTJOB_INVALID)
119  ,_startupJob(STARTUPJOB_INVALID)
120  ,_command(COMMAND_INVALID)
121  ,_voltageLevel(VOLTAGELEVEL_INVALID)
122  ,_protocol(PROTOCOL_INVALID)
123  ,_serialMode(SERIALMODE_INVALID)
124  ,_valueCallbackSerialPort(NULL)
125  ,_rxptr(0)
126  ,_rxbuffptr(0)
127 //--- (end of generated code: YSerialPort initialization)
128 {
129  _className="SerialPort";
130 }
131 
133 {
134 //--- (generated code: YSerialPort cleanup)
135 //--- (end of generated code: YSerialPort cleanup)
136 }
137 //--- (generated code: YSerialPort implementation)
138 // static attributes
145 
147 {
148  if(json_val->has("rxCount")) {
149  _rxCount = json_val->getInt("rxCount");
150  }
151  if(json_val->has("txCount")) {
152  _txCount = json_val->getInt("txCount");
153  }
154  if(json_val->has("errCount")) {
155  _errCount = json_val->getInt("errCount");
156  }
157  if(json_val->has("rxMsgCount")) {
158  _rxMsgCount = json_val->getInt("rxMsgCount");
159  }
160  if(json_val->has("txMsgCount")) {
161  _txMsgCount = json_val->getInt("txMsgCount");
162  }
163  if(json_val->has("lastMsg")) {
164  _lastMsg = json_val->getString("lastMsg");
165  }
166  if(json_val->has("currentJob")) {
167  _currentJob = json_val->getString("currentJob");
168  }
169  if(json_val->has("startupJob")) {
170  _startupJob = json_val->getString("startupJob");
171  }
172  if(json_val->has("command")) {
173  _command = json_val->getString("command");
174  }
175  if(json_val->has("voltageLevel")) {
176  _voltageLevel = (Y_VOLTAGELEVEL_enum)json_val->getInt("voltageLevel");
177  }
178  if(json_val->has("protocol")) {
179  _protocol = json_val->getString("protocol");
180  }
181  if(json_val->has("serialMode")) {
182  _serialMode = json_val->getString("serialMode");
183  }
184  return YFunction::_parseAttr(json_val);
185 }
186 
187 
196 {
197  int res = 0;
199  try {
202  {
205  }
206  }
207  }
208  res = _rxCount;
209  } catch (std::exception) {
211  throw;
212  }
214  return res;
215 }
216 
225 {
226  int res = 0;
228  try {
231  {
234  }
235  }
236  }
237  res = _txCount;
238  } catch (std::exception) {
240  throw;
241  }
243  return res;
244 }
245 
254 {
255  int res = 0;
257  try {
260  {
263  }
264  }
265  }
266  res = _errCount;
267  } catch (std::exception) {
269  throw;
270  }
272  return res;
273 }
274 
283 {
284  int res = 0;
286  try {
289  {
292  }
293  }
294  }
295  res = _rxMsgCount;
296  } catch (std::exception) {
298  throw;
299  }
301  return res;
302 }
303 
312 {
313  int res = 0;
315  try {
318  {
321  }
322  }
323  }
324  res = _txMsgCount;
325  } catch (std::exception) {
327  throw;
328  }
330  return res;
331 }
332 
341 {
342  string res;
344  try {
347  {
350  }
351  }
352  }
353  res = _lastMsg;
354  } catch (std::exception) {
356  throw;
357  }
359  return res;
360 }
361 
370 {
371  string res;
373  try {
376  {
379  }
380  }
381  }
382  res = _currentJob;
383  } catch (std::exception) {
385  throw;
386  }
388  return res;
389 }
390 
402 int YSerialPort::set_currentJob(const string& newval)
403 {
404  string rest_val;
405  int res;
407  try {
408  rest_val = newval;
409  res = _setAttr("currentJob", rest_val);
410  } catch (std::exception) {
412  throw;
413  }
415  return res;
416 }
417 
426 {
427  string res;
429  try {
432  {
435  }
436  }
437  }
438  res = _startupJob;
439  } catch (std::exception) {
441  throw;
442  }
444  return res;
445 }
446 
458 int YSerialPort::set_startupJob(const string& newval)
459 {
460  string rest_val;
461  int res;
463  try {
464  rest_val = newval;
465  res = _setAttr("startupJob", rest_val);
466  } catch (std::exception) {
468  throw;
469  }
471  return res;
472 }
473 
475 {
476  string res;
478  try {
481  {
484  }
485  }
486  }
487  res = _command;
488  } catch (std::exception) {
490  throw;
491  }
493  return res;
494 }
495 
496 int YSerialPort::set_command(const string& newval)
497 {
498  string rest_val;
499  int res;
501  try {
502  rest_val = newval;
503  res = _setAttr("command", rest_val);
504  } catch (std::exception) {
506  throw;
507  }
509  return res;
510 }
511 
522 {
525  try {
528  {
531  }
532  }
533  }
534  res = _voltageLevel;
535  } catch (std::exception) {
537  throw;
538  }
540  return res;
541 }
542 
559 {
560  string rest_val;
561  int res;
563  try {
564  char buf[32]; sprintf(buf, "%d", newval); rest_val = string(buf);
565  res = _setAttr("voltageLevel", rest_val);
566  } catch (std::exception) {
568  throw;
569  }
571  return res;
572 }
573 
590 {
591  string res;
593  try {
596  {
599  }
600  }
601  }
602  res = _protocol;
603  } catch (std::exception) {
605  throw;
606  }
608  return res;
609 }
610 
630 int YSerialPort::set_protocol(const string& newval)
631 {
632  string rest_val;
633  int res;
635  try {
636  rest_val = newval;
637  res = _setAttr("protocol", rest_val);
638  } catch (std::exception) {
640  throw;
641  }
643  return res;
644 }
645 
660 {
661  string res;
663  try {
666  {
669  }
670  }
671  }
672  res = _serialMode;
673  } catch (std::exception) {
675  throw;
676  }
678  return res;
679 }
680 
696 int YSerialPort::set_serialMode(const string& newval)
697 {
698  string rest_val;
699  int res;
701  try {
702  rest_val = newval;
703  res = _setAttr("serialMode", rest_val);
704  } catch (std::exception) {
706  throw;
707  }
709  return res;
710 }
711 
740 {
741  YSerialPort* obj = NULL;
742  int taken = 0;
743  if (YAPI::_apiInitialized) {
745  taken = 1;
746  }try {
747  obj = (YSerialPort*) YFunction::_FindFromCache("SerialPort", func);
748  if (obj == NULL) {
749  obj = new YSerialPort(func);
750  YFunction::_AddToCache("SerialPort", func, obj);
751  }
752  } catch (std::exception) {
754  throw;
755  }
757  return obj;
758 }
759 
772 {
773  string val;
774  if (callback != NULL) {
776  } else {
778  }
779  _valueCallbackSerialPort = callback;
780  // Immediately invoke value callback with current value
781  if (callback != NULL && this->isOnline()) {
782  val = _advertisedValue;
783  if (!(val == "")) {
784  this->_invokeValueCallback(val);
785  }
786  }
787  return 0;
788 }
789 
791 {
792  if (_valueCallbackSerialPort != NULL) {
793  _valueCallbackSerialPort(this, value);
794  } else {
796  }
797  return 0;
798 }
799 
800 int YSerialPort::sendCommand(string text)
801 {
802  return this->set_command(text);
803 }
804 
813 {
814  _rxptr = 0;
815  _rxbuffptr = 0;
816  _rxbuff = string(0, (char)0);
817 
818  return this->sendCommand("Z");
819 }
820 
831 {
832  return this->sendCommand(YapiWrapper::ysprintf("$%02x",code));
833 }
834 
844 int YSerialPort::writeStr(string text)
845 {
846  string buff;
847  int bufflen = 0;
848  int idx = 0;
849  int ch = 0;
850  buff = text;
851  bufflen = (int)(buff).size();
852  if (bufflen < 100) {
853  // if string is pure text, we can send it as a simple command (faster)
854  ch = 0x20;
855  idx = 0;
856  while ((idx < bufflen) && (ch != 0)) {
857  ch = ((u8)buff[idx]);
858  if ((ch >= 0x20) && (ch < 0x7f)) {
859  idx = idx + 1;
860  } else {
861  ch = 0;
862  }
863  }
864  if (idx >= bufflen) {
865  return this->sendCommand(YapiWrapper::ysprintf("+%s",text.c_str()));
866  }
867  }
868  // send string using file upload
869  return this->_upload("txdata", buff);
870 }
871 
881 int YSerialPort::writeBin(string buff)
882 {
883  return this->_upload("txdata", buff);
884 }
885 
895 int YSerialPort::writeArray(vector<int> byteList)
896 {
897  string buff;
898  int bufflen = 0;
899  int idx = 0;
900  int hexb = 0;
901  int res = 0;
902  bufflen = (int)byteList.size();
903  buff = string(bufflen, (char)0);
904  idx = 0;
905  while (idx < bufflen) {
906  hexb = byteList[idx];
907  buff[idx] = (char)(hexb);
908  idx = idx + 1;
909  }
910 
911  res = this->_upload("txdata", buff);
912  return res;
913 }
914 
924 int YSerialPort::writeHex(string hexString)
925 {
926  string buff;
927  int bufflen = 0;
928  int idx = 0;
929  int hexb = 0;
930  int res = 0;
931  bufflen = (int)(hexString).length();
932  if (bufflen < 100) {
933  return this->sendCommand(YapiWrapper::ysprintf("$%s",hexString.c_str()));
934  }
935  bufflen = ((bufflen) >> (1));
936  buff = string(bufflen, (char)0);
937  idx = 0;
938  while (idx < bufflen) {
939  hexb = (int)strtoul((hexString).substr( 2 * idx, 2).c_str(), NULL, 16);
940  buff[idx] = (char)(hexb);
941  idx = idx + 1;
942  }
943 
944  res = this->_upload("txdata", buff);
945  return res;
946 }
947 
957 int YSerialPort::writeLine(string text)
958 {
959  string buff;
960  int bufflen = 0;
961  int idx = 0;
962  int ch = 0;
963  buff = YapiWrapper::ysprintf("%s\r\n",text.c_str());
964  bufflen = (int)(buff).size()-2;
965  if (bufflen < 100) {
966  // if string is pure text, we can send it as a simple command (faster)
967  ch = 0x20;
968  idx = 0;
969  while ((idx < bufflen) && (ch != 0)) {
970  ch = ((u8)buff[idx]);
971  if ((ch >= 0x20) && (ch < 0x7f)) {
972  idx = idx + 1;
973  } else {
974  ch = 0;
975  }
976  }
977  if (idx >= bufflen) {
978  return this->sendCommand(YapiWrapper::ysprintf("!%s",text.c_str()));
979  }
980  }
981  // send string using file upload
982  return this->_upload("txdata", buff);
983 }
984 
995 {
996  int currpos = 0;
997  int reqlen = 0;
998  string buff;
999  int bufflen = 0;
1000  int mult = 0;
1001  int endpos = 0;
1002  int res = 0;
1003  // first check if we have the requested character in the look-ahead buffer
1004  bufflen = (int)(_rxbuff).size();
1005  if ((_rxptr >= _rxbuffptr) && (_rxptr < _rxbuffptr+bufflen)) {
1006  res = ((u8)_rxbuff[_rxptr-_rxbuffptr]);
1007  _rxptr = _rxptr + 1;
1008  return res;
1009  }
1010  // try to preload more than one byte to speed-up byte-per-byte access
1011  currpos = _rxptr;
1012  reqlen = 1024;
1013  buff = this->readBin(reqlen);
1014  bufflen = (int)(buff).size();
1015  if (_rxptr == currpos+bufflen) {
1016  res = ((u8)buff[0]);
1017  _rxptr = currpos+1;
1018  _rxbuffptr = currpos;
1019  _rxbuff = buff;
1020  return res;
1021  }
1022  // mixed bidirectional data, retry with a smaller block
1023  _rxptr = currpos;
1024  reqlen = 16;
1025  buff = this->readBin(reqlen);
1026  bufflen = (int)(buff).size();
1027  if (_rxptr == currpos+bufflen) {
1028  res = ((u8)buff[0]);
1029  _rxptr = currpos+1;
1030  _rxbuffptr = currpos;
1031  _rxbuff = buff;
1032  return res;
1033  }
1034  // still mixed, need to process character by character
1035  _rxptr = currpos;
1036 
1037  buff = this->_download(YapiWrapper::ysprintf("rxdata.bin?pos=%d&len=1",_rxptr));
1038  bufflen = (int)(buff).size() - 1;
1039  endpos = 0;
1040  mult = 1;
1041  while ((bufflen > 0) && (((u8)buff[bufflen]) != 64)) {
1042  endpos = endpos + mult * (((u8)buff[bufflen]) - 48);
1043  mult = mult * 10;
1044  bufflen = bufflen - 1;
1045  }
1046  _rxptr = endpos;
1047  if (bufflen == 0) {
1048  return YAPI_NO_MORE_DATA;
1049  }
1050  res = ((u8)buff[0]);
1051  return res;
1052 }
1053 
1065 string YSerialPort::readStr(int nChars)
1066 {
1067  string buff;
1068  int bufflen = 0;
1069  int mult = 0;
1070  int endpos = 0;
1071  string res;
1072  if (nChars > 65535) {
1073  nChars = 65535;
1074  }
1075 
1076  buff = this->_download(YapiWrapper::ysprintf("rxdata.bin?pos=%d&len=%d", _rxptr,nChars));
1077  bufflen = (int)(buff).size() - 1;
1078  endpos = 0;
1079  mult = 1;
1080  while ((bufflen > 0) && (((u8)buff[bufflen]) != 64)) {
1081  endpos = endpos + mult * (((u8)buff[bufflen]) - 48);
1082  mult = mult * 10;
1083  bufflen = bufflen - 1;
1084  }
1085  _rxptr = endpos;
1086  res = (buff).substr( 0, bufflen);
1087  return res;
1088 }
1089 
1101 string YSerialPort::readBin(int nChars)
1102 {
1103  string buff;
1104  int bufflen = 0;
1105  int mult = 0;
1106  int endpos = 0;
1107  int idx = 0;
1108  string res;
1109  if (nChars > 65535) {
1110  nChars = 65535;
1111  }
1112 
1113  buff = this->_download(YapiWrapper::ysprintf("rxdata.bin?pos=%d&len=%d", _rxptr,nChars));
1114  bufflen = (int)(buff).size() - 1;
1115  endpos = 0;
1116  mult = 1;
1117  while ((bufflen > 0) && (((u8)buff[bufflen]) != 64)) {
1118  endpos = endpos + mult * (((u8)buff[bufflen]) - 48);
1119  mult = mult * 10;
1120  bufflen = bufflen - 1;
1121  }
1122  _rxptr = endpos;
1123  res = string(bufflen, (char)0);
1124  idx = 0;
1125  while (idx < bufflen) {
1126  res[idx] = (char)(((u8)buff[idx]));
1127  idx = idx + 1;
1128  }
1129  return res;
1130 }
1131 
1143 vector<int> YSerialPort::readArray(int nChars)
1144 {
1145  string buff;
1146  int bufflen = 0;
1147  int mult = 0;
1148  int endpos = 0;
1149  int idx = 0;
1150  int b = 0;
1151  vector<int> res;
1152  if (nChars > 65535) {
1153  nChars = 65535;
1154  }
1155 
1156  buff = this->_download(YapiWrapper::ysprintf("rxdata.bin?pos=%d&len=%d", _rxptr,nChars));
1157  bufflen = (int)(buff).size() - 1;
1158  endpos = 0;
1159  mult = 1;
1160  while ((bufflen > 0) && (((u8)buff[bufflen]) != 64)) {
1161  endpos = endpos + mult * (((u8)buff[bufflen]) - 48);
1162  mult = mult * 10;
1163  bufflen = bufflen - 1;
1164  }
1165  _rxptr = endpos;
1166  res.clear();
1167  idx = 0;
1168  while (idx < bufflen) {
1169  b = ((u8)buff[idx]);
1170  res.push_back(b);
1171  idx = idx + 1;
1172  }
1173  return res;
1174 }
1175 
1187 string YSerialPort::readHex(int nBytes)
1188 {
1189  string buff;
1190  int bufflen = 0;
1191  int mult = 0;
1192  int endpos = 0;
1193  int ofs = 0;
1194  string res;
1195  if (nBytes > 65535) {
1196  nBytes = 65535;
1197  }
1198 
1199  buff = this->_download(YapiWrapper::ysprintf("rxdata.bin?pos=%d&len=%d", _rxptr,nBytes));
1200  bufflen = (int)(buff).size() - 1;
1201  endpos = 0;
1202  mult = 1;
1203  while ((bufflen > 0) && (((u8)buff[bufflen]) != 64)) {
1204  endpos = endpos + mult * (((u8)buff[bufflen]) - 48);
1205  mult = mult * 10;
1206  bufflen = bufflen - 1;
1207  }
1208  _rxptr = endpos;
1209  res = "";
1210  ofs = 0;
1211  while (ofs + 3 < bufflen) {
1212  res = YapiWrapper::ysprintf("%s%02x%02x%02x%02x", res.c_str(), ((u8)buff[ofs]), ((u8)buff[ofs + 1]), ((u8)buff[ofs + 2]),((u8)buff[ofs + 3]));
1213  ofs = ofs + 4;
1214  }
1215  while (ofs < bufflen) {
1216  res = YapiWrapper::ysprintf("%s%02x", res.c_str(),((u8)buff[ofs]));
1217  ofs = ofs + 1;
1218  }
1219  return res;
1220 }
1221 
1236 {
1237  string url;
1238  string msgbin;
1239  vector<string> msgarr;
1240  int msglen = 0;
1241  string res;
1242 
1243  url = YapiWrapper::ysprintf("rxmsg.json?pos=%d&len=1&maxw=1",_rxptr);
1244  msgbin = this->_download(url);
1245  msgarr = this->_json_get_array(msgbin);
1246  msglen = (int)msgarr.size();
1247  if (msglen == 0) {
1248  return "";
1249  }
1250  // last element of array is the new position
1251  msglen = msglen - 1;
1252  _rxptr = atoi((msgarr[msglen]).c_str());
1253  if (msglen == 0) {
1254  return "";
1255  }
1256  res = this->_json_get_string(msgarr[0]);
1257  return res;
1258 }
1259 
1281 vector<string> YSerialPort::readMessages(string pattern,int maxWait)
1282 {
1283  string url;
1284  string msgbin;
1285  vector<string> msgarr;
1286  int msglen = 0;
1287  vector<string> res;
1288  int idx = 0;
1289 
1290  url = YapiWrapper::ysprintf("rxmsg.json?pos=%d&maxw=%d&pat=%s", _rxptr, maxWait,pattern.c_str());
1291  msgbin = this->_download(url);
1292  msgarr = this->_json_get_array(msgbin);
1293  msglen = (int)msgarr.size();
1294  if (msglen == 0) {
1295  return res;
1296  }
1297  // last element of array is the new position
1298  msglen = msglen - 1;
1299  _rxptr = atoi((msgarr[msglen]).c_str());
1300  idx = 0;
1301  while (idx < msglen) {
1302  res.push_back(this->_json_get_string(msgarr[idx]));
1303  idx = idx + 1;
1304  }
1305  return res;
1306 }
1307 
1317 int YSerialPort::read_seek(int absPos)
1318 {
1319  _rxptr = absPos;
1320  return YAPI_SUCCESS;
1321 }
1322 
1329 {
1330  return _rxptr;
1331 }
1332 
1340 {
1341  string buff;
1342  int bufflen = 0;
1343  int res = 0;
1344 
1345  buff = this->_download(YapiWrapper::ysprintf("rxcnt.bin?pos=%d",_rxptr));
1346  bufflen = (int)(buff).size() - 1;
1347  while ((bufflen > 0) && (((u8)buff[bufflen]) != 64)) {
1348  bufflen = bufflen - 1;
1349  }
1350  res = atoi(((buff).substr( 0, bufflen)).c_str());
1351  return res;
1352 }
1353 
1366 string YSerialPort::queryLine(string query,int maxWait)
1367 {
1368  string url;
1369  string msgbin;
1370  vector<string> msgarr;
1371  int msglen = 0;
1372  string res;
1373 
1374  url = YapiWrapper::ysprintf("rxmsg.json?len=1&maxw=%d&cmd=!%s", maxWait,query.c_str());
1375  msgbin = this->_download(url);
1376  msgarr = this->_json_get_array(msgbin);
1377  msglen = (int)msgarr.size();
1378  if (msglen == 0) {
1379  return "";
1380  }
1381  // last element of array is the new position
1382  msglen = msglen - 1;
1383  _rxptr = atoi((msgarr[msglen]).c_str());
1384  if (msglen == 0) {
1385  return "";
1386  }
1387  res = this->_json_get_string(msgarr[0]);
1388  return res;
1389 }
1390 
1402 int YSerialPort::uploadJob(string jobfile,string jsonDef)
1403 {
1404  this->_upload(jobfile, jsonDef);
1405  return YAPI_SUCCESS;
1406 }
1407 
1419 int YSerialPort::selectJob(string jobfile)
1420 {
1421  return this->set_currentJob(jobfile);
1422 }
1423 
1435 {
1436  return this->sendCommand(YapiWrapper::ysprintf("R%d",val));
1437 }
1438 
1448 {
1449  string buff;
1450  int res = 0;
1451 
1452  buff = this->_download("cts.txt");
1453  if (!((int)(buff).size() == 1)) {
1454  _throw(YAPI_IO_ERROR,"invalid CTS reply");
1455  return YAPI_IO_ERROR;
1456  }
1457  res = ((u8)buff[0]) - 48;
1458  return res;
1459 }
1460 
1477 vector<YSnoopingRecord> YSerialPort::snoopMessages(int maxWait)
1478 {
1479  string url;
1480  string msgbin;
1481  vector<string> msgarr;
1482  int msglen = 0;
1483  vector<YSnoopingRecord> res;
1484  int idx = 0;
1485 
1486  url = YapiWrapper::ysprintf("rxmsg.json?pos=%d&maxw=%d&t=0", _rxptr,maxWait);
1487  msgbin = this->_download(url);
1488  msgarr = this->_json_get_array(msgbin);
1489  msglen = (int)msgarr.size();
1490  if (msglen == 0) {
1491  return res;
1492  }
1493  // last element of array is the new position
1494  msglen = msglen - 1;
1495  _rxptr = atoi((msgarr[msglen]).c_str());
1496  idx = 0;
1497  while (idx < msglen) {
1498  res.push_back(YSnoopingRecord(msgarr[idx]));
1499  idx = idx + 1;
1500  }
1501  return res;
1502 }
1503 
1515 int YSerialPort::writeMODBUS(string hexString)
1516 {
1517  return this->sendCommand(YapiWrapper::ysprintf(":%s",hexString.c_str()));
1518 }
1519 
1532 vector<int> YSerialPort::queryMODBUS(int slaveNo,vector<int> pduBytes)
1533 {
1534  int funCode = 0;
1535  int nib = 0;
1536  int i = 0;
1537  string cmd;
1538  string url;
1539  string pat;
1540  string msgs;
1541  vector<string> reps;
1542  string rep;
1543  vector<int> res;
1544  int replen = 0;
1545  int hexb = 0;
1546  funCode = pduBytes[0];
1547  nib = ((funCode) >> (4));
1548  pat = YapiWrapper::ysprintf("%02x[%x%x]%x.*", slaveNo, nib, (nib+8),((funCode) & (15)));
1549  cmd = YapiWrapper::ysprintf("%02x%02x", slaveNo,funCode);
1550  i = 1;
1551  while (i < (int)pduBytes.size()) {
1552  cmd = YapiWrapper::ysprintf("%s%02x", cmd.c_str(),((pduBytes[i]) & (0xff)));
1553  i = i + 1;
1554  }
1555 
1556  url = YapiWrapper::ysprintf("rxmsg.json?cmd=:%s&pat=:%s", cmd.c_str(),pat.c_str());
1557  msgs = this->_download(url);
1558  reps = this->_json_get_array(msgs);
1559  if (!((int)reps.size() > 1)) {
1560  _throw(YAPI_IO_ERROR,"no reply from slave");
1561  return res;
1562  }
1563  if ((int)reps.size() > 1) {
1564  rep = this->_json_get_string(reps[0]);
1565  replen = (((int)(rep).length() - 3) >> (1));
1566  i = 0;
1567  while (i < replen) {
1568  hexb = (int)strtoul((rep).substr(2 * i + 3, 2).c_str(), NULL, 16);
1569  res.push_back(hexb);
1570  i = i + 1;
1571  }
1572  if (res[0] != funCode) {
1573  i = res[1];
1574  if (!(i > 1)) {
1575  _throw(YAPI_NOT_SUPPORTED,"MODBUS error: unsupported function code");
1576  return res;
1577  }
1578  if (!(i > 2)) {
1579  _throw(YAPI_INVALID_ARGUMENT,"MODBUS error: illegal data address");
1580  return res;
1581  }
1582  if (!(i > 3)) {
1583  _throw(YAPI_INVALID_ARGUMENT,"MODBUS error: illegal data value");
1584  return res;
1585  }
1586  if (!(i > 4)) {
1587  _throw(YAPI_INVALID_ARGUMENT,"MODBUS error: failed to execute function");
1588  return res;
1589  }
1590  }
1591  }
1592  return res;
1593 }
1594 
1607 vector<int> YSerialPort::modbusReadBits(int slaveNo,int pduAddr,int nBits)
1608 {
1609  vector<int> pdu;
1610  vector<int> reply;
1611  vector<int> res;
1612  int bitpos = 0;
1613  int idx = 0;
1614  int val = 0;
1615  int mask = 0;
1616  pdu.push_back(0x01);
1617  pdu.push_back(((pduAddr) >> (8)));
1618  pdu.push_back(((pduAddr) & (0xff)));
1619  pdu.push_back(((nBits) >> (8)));
1620  pdu.push_back(((nBits) & (0xff)));
1621 
1622  reply = this->queryMODBUS(slaveNo, pdu);
1623  if ((int)reply.size() == 0) {
1624  return res;
1625  }
1626  if (reply[0] != pdu[0]) {
1627  return res;
1628  }
1629  bitpos = 0;
1630  idx = 2;
1631  val = reply[idx];
1632  mask = 1;
1633  while (bitpos < nBits) {
1634  if (((val) & (mask)) == 0) {
1635  res.push_back(0);
1636  } else {
1637  res.push_back(1);
1638  }
1639  bitpos = bitpos + 1;
1640  if (mask == 0x80) {
1641  idx = idx + 1;
1642  val = reply[idx];
1643  mask = 1;
1644  } else {
1645  mask = ((mask) << (1));
1646  }
1647  }
1648  return res;
1649 }
1650 
1663 vector<int> YSerialPort::modbusReadInputBits(int slaveNo,int pduAddr,int nBits)
1664 {
1665  vector<int> pdu;
1666  vector<int> reply;
1667  vector<int> res;
1668  int bitpos = 0;
1669  int idx = 0;
1670  int val = 0;
1671  int mask = 0;
1672  pdu.push_back(0x02);
1673  pdu.push_back(((pduAddr) >> (8)));
1674  pdu.push_back(((pduAddr) & (0xff)));
1675  pdu.push_back(((nBits) >> (8)));
1676  pdu.push_back(((nBits) & (0xff)));
1677 
1678  reply = this->queryMODBUS(slaveNo, pdu);
1679  if ((int)reply.size() == 0) {
1680  return res;
1681  }
1682  if (reply[0] != pdu[0]) {
1683  return res;
1684  }
1685  bitpos = 0;
1686  idx = 2;
1687  val = reply[idx];
1688  mask = 1;
1689  while (bitpos < nBits) {
1690  if (((val) & (mask)) == 0) {
1691  res.push_back(0);
1692  } else {
1693  res.push_back(1);
1694  }
1695  bitpos = bitpos + 1;
1696  if (mask == 0x80) {
1697  idx = idx + 1;
1698  val = reply[idx];
1699  mask = 1;
1700  } else {
1701  mask = ((mask) << (1));
1702  }
1703  }
1704  return res;
1705 }
1706 
1719 vector<int> YSerialPort::modbusReadRegisters(int slaveNo,int pduAddr,int nWords)
1720 {
1721  vector<int> pdu;
1722  vector<int> reply;
1723  vector<int> res;
1724  int regpos = 0;
1725  int idx = 0;
1726  int val = 0;
1727  pdu.push_back(0x03);
1728  pdu.push_back(((pduAddr) >> (8)));
1729  pdu.push_back(((pduAddr) & (0xff)));
1730  pdu.push_back(((nWords) >> (8)));
1731  pdu.push_back(((nWords) & (0xff)));
1732 
1733  reply = this->queryMODBUS(slaveNo, pdu);
1734  if ((int)reply.size() == 0) {
1735  return res;
1736  }
1737  if (reply[0] != pdu[0]) {
1738  return res;
1739  }
1740  regpos = 0;
1741  idx = 2;
1742  while (regpos < nWords) {
1743  val = ((reply[idx]) << (8));
1744  idx = idx + 1;
1745  val = val + reply[idx];
1746  idx = idx + 1;
1747  res.push_back(val);
1748  regpos = regpos + 1;
1749  }
1750  return res;
1751 }
1752 
1765 vector<int> YSerialPort::modbusReadInputRegisters(int slaveNo,int pduAddr,int nWords)
1766 {
1767  vector<int> pdu;
1768  vector<int> reply;
1769  vector<int> res;
1770  int regpos = 0;
1771  int idx = 0;
1772  int val = 0;
1773  pdu.push_back(0x04);
1774  pdu.push_back(((pduAddr) >> (8)));
1775  pdu.push_back(((pduAddr) & (0xff)));
1776  pdu.push_back(((nWords) >> (8)));
1777  pdu.push_back(((nWords) & (0xff)));
1778 
1779  reply = this->queryMODBUS(slaveNo, pdu);
1780  if ((int)reply.size() == 0) {
1781  return res;
1782  }
1783  if (reply[0] != pdu[0]) {
1784  return res;
1785  }
1786  regpos = 0;
1787  idx = 2;
1788  while (regpos < nWords) {
1789  val = ((reply[idx]) << (8));
1790  idx = idx + 1;
1791  val = val + reply[idx];
1792  idx = idx + 1;
1793  res.push_back(val);
1794  regpos = regpos + 1;
1795  }
1796  return res;
1797 }
1798 
1811 int YSerialPort::modbusWriteBit(int slaveNo,int pduAddr,int value)
1812 {
1813  vector<int> pdu;
1814  vector<int> reply;
1815  int res = 0;
1816  res = 0;
1817  if (value != 0) {
1818  value = 0xff;
1819  }
1820  pdu.push_back(0x05);
1821  pdu.push_back(((pduAddr) >> (8)));
1822  pdu.push_back(((pduAddr) & (0xff)));
1823  pdu.push_back(value);
1824  pdu.push_back(0x00);
1825 
1826  reply = this->queryMODBUS(slaveNo, pdu);
1827  if ((int)reply.size() == 0) {
1828  return res;
1829  }
1830  if (reply[0] != pdu[0]) {
1831  return res;
1832  }
1833  res = 1;
1834  return res;
1835 }
1836 
1849 int YSerialPort::modbusWriteBits(int slaveNo,int pduAddr,vector<int> bits)
1850 {
1851  int nBits = 0;
1852  int nBytes = 0;
1853  int bitpos = 0;
1854  int val = 0;
1855  int mask = 0;
1856  vector<int> pdu;
1857  vector<int> reply;
1858  int res = 0;
1859  res = 0;
1860  nBits = (int)bits.size();
1861  nBytes = (((nBits + 7)) >> (3));
1862  pdu.push_back(0x0f);
1863  pdu.push_back(((pduAddr) >> (8)));
1864  pdu.push_back(((pduAddr) & (0xff)));
1865  pdu.push_back(((nBits) >> (8)));
1866  pdu.push_back(((nBits) & (0xff)));
1867  pdu.push_back(nBytes);
1868  bitpos = 0;
1869  val = 0;
1870  mask = 1;
1871  while (bitpos < nBits) {
1872  if (bits[bitpos] != 0) {
1873  val = ((val) | (mask));
1874  }
1875  bitpos = bitpos + 1;
1876  if (mask == 0x80) {
1877  pdu.push_back(val);
1878  val = 0;
1879  mask = 1;
1880  } else {
1881  mask = ((mask) << (1));
1882  }
1883  }
1884  if (mask != 1) {
1885  pdu.push_back(val);
1886  }
1887 
1888  reply = this->queryMODBUS(slaveNo, pdu);
1889  if ((int)reply.size() == 0) {
1890  return res;
1891  }
1892  if (reply[0] != pdu[0]) {
1893  return res;
1894  }
1895  res = ((reply[3]) << (8));
1896  res = res + reply[4];
1897  return res;
1898 }
1899 
1912 int YSerialPort::modbusWriteRegister(int slaveNo,int pduAddr,int value)
1913 {
1914  vector<int> pdu;
1915  vector<int> reply;
1916  int res = 0;
1917  res = 0;
1918  pdu.push_back(0x06);
1919  pdu.push_back(((pduAddr) >> (8)));
1920  pdu.push_back(((pduAddr) & (0xff)));
1921  pdu.push_back(((value) >> (8)));
1922  pdu.push_back(((value) & (0xff)));
1923 
1924  reply = this->queryMODBUS(slaveNo, pdu);
1925  if ((int)reply.size() == 0) {
1926  return res;
1927  }
1928  if (reply[0] != pdu[0]) {
1929  return res;
1930  }
1931  res = 1;
1932  return res;
1933 }
1934 
1947 int YSerialPort::modbusWriteRegisters(int slaveNo,int pduAddr,vector<int> values)
1948 {
1949  int nWords = 0;
1950  int nBytes = 0;
1951  int regpos = 0;
1952  int val = 0;
1953  vector<int> pdu;
1954  vector<int> reply;
1955  int res = 0;
1956  res = 0;
1957  nWords = (int)values.size();
1958  nBytes = 2 * nWords;
1959  pdu.push_back(0x10);
1960  pdu.push_back(((pduAddr) >> (8)));
1961  pdu.push_back(((pduAddr) & (0xff)));
1962  pdu.push_back(((nWords) >> (8)));
1963  pdu.push_back(((nWords) & (0xff)));
1964  pdu.push_back(nBytes);
1965  regpos = 0;
1966  while (regpos < nWords) {
1967  val = values[regpos];
1968  pdu.push_back(((val) >> (8)));
1969  pdu.push_back(((val) & (0xff)));
1970  regpos = regpos + 1;
1971  }
1972 
1973  reply = this->queryMODBUS(slaveNo, pdu);
1974  if ((int)reply.size() == 0) {
1975  return res;
1976  }
1977  if (reply[0] != pdu[0]) {
1978  return res;
1979  }
1980  res = ((reply[3]) << (8));
1981  res = res + reply[4];
1982  return res;
1983 }
1984 
2000 vector<int> YSerialPort::modbusWriteAndReadRegisters(int slaveNo,int pduWriteAddr,vector<int> values,int pduReadAddr,int nReadWords)
2001 {
2002  int nWriteWords = 0;
2003  int nBytes = 0;
2004  int regpos = 0;
2005  int val = 0;
2006  int idx = 0;
2007  vector<int> pdu;
2008  vector<int> reply;
2009  vector<int> res;
2010  nWriteWords = (int)values.size();
2011  nBytes = 2 * nWriteWords;
2012  pdu.push_back(0x17);
2013  pdu.push_back(((pduReadAddr) >> (8)));
2014  pdu.push_back(((pduReadAddr) & (0xff)));
2015  pdu.push_back(((nReadWords) >> (8)));
2016  pdu.push_back(((nReadWords) & (0xff)));
2017  pdu.push_back(((pduWriteAddr) >> (8)));
2018  pdu.push_back(((pduWriteAddr) & (0xff)));
2019  pdu.push_back(((nWriteWords) >> (8)));
2020  pdu.push_back(((nWriteWords) & (0xff)));
2021  pdu.push_back(nBytes);
2022  regpos = 0;
2023  while (regpos < nWriteWords) {
2024  val = values[regpos];
2025  pdu.push_back(((val) >> (8)));
2026  pdu.push_back(((val) & (0xff)));
2027  regpos = regpos + 1;
2028  }
2029 
2030  reply = this->queryMODBUS(slaveNo, pdu);
2031  if ((int)reply.size() == 0) {
2032  return res;
2033  }
2034  if (reply[0] != pdu[0]) {
2035  return res;
2036  }
2037  regpos = 0;
2038  idx = 2;
2039  while (regpos < nReadWords) {
2040  val = ((reply[idx]) << (8));
2041  idx = idx + 1;
2042  val = val + reply[idx];
2043  idx = idx + 1;
2044  res.push_back(val);
2045  regpos = regpos + 1;
2046  }
2047  return res;
2048 }
2049 
2051 {
2052  string hwid;
2053 
2054  if(YISERR(_nextFunction(hwid)) || hwid=="") {
2055  return NULL;
2056  }
2057  return YSerialPort::FindSerialPort(hwid);
2058 }
2059 
2061 {
2062  vector<YFUN_DESCR> v_fundescr;
2063  YDEV_DESCR ydevice;
2064  string serial, funcId, funcName, funcVal, errmsg;
2065 
2066  if(YISERR(YapiWrapper::getFunctionsByClass("SerialPort", 0, v_fundescr, sizeof(YFUN_DESCR), errmsg)) ||
2067  v_fundescr.size() == 0 ||
2068  YISERR(YapiWrapper::getFunctionInfo(v_fundescr[0], ydevice, serial, funcId, funcName, funcVal, errmsg))) {
2069  return NULL;
2070  }
2071  return YSerialPort::FindSerialPort(serial+"."+funcId);
2072 }
2073 
2074 //--- (end of generated code: YSerialPort implementation)
2075 
2076 //--- (generated code: YSerialPort functions)
2077 //--- (end of generated code: YSerialPort functions)
string get_lastMsg(void)
static YSerialPort * FirstSerialPort(void)
string _advertisedValue
Definition: yocto_api.h:1569
virtual string readHex(int nBytes)
virtual int read_tell(void)
yCRITICAL_SECTION _this_cs
Definition: yocto_api.h:1563
void(* YSerialPortValueCallback)(YSerialPort *func, const string &functionValue)
static const string CURRENTJOB_INVALID
int set_protocol(const string &newval)
virtual vector< string > readMessages(string pattern, int maxWait)
string _json_get_string(const string &json)
Definition: yocto_api.cpp:2798
YRETCODE _load_unsafe(int msValidity)
Definition: yocto_api.cpp:3327
virtual int registerValueCallback(YSerialPortValueCallback callback)
static const string PROTOCOL_INVALID
int get_txMsgCount(void)
static const int TXMSGCOUNT_INVALID
virtual int get_direction(void)
virtual vector< int > modbusReadBits(int slaveNo, int pduAddr, int nBits)
int get_rxMsgCount(void)
YSnoopingRecord(const string &json)
virtual int sendCommand(string text)
string get_command(void)
char token[62]
Definition: yjson.h:88
Y_VOLTAGELEVEL_enum
virtual vector< int > modbusReadInputBits(int slaveNo, int pduAddr, int nBits)
YRETCODE _upload(const string &path, const string &content)
Definition: yocto_api.cpp:3098
virtual int writeBin(string buff)
static int DefaultCacheValidity
Definition: yocto_api.h:468
static const string LASTMSG_INVALID
virtual vector< int > modbusWriteAndReadRegisters(int slaveNo, int pduWriteAddr, vector< int > values, int pduReadAddr, int nReadWords)
string getString(const string &key)
Definition: yocto_api.cpp:773
int set_serialMode(const string &newval)
virtual vector< int > modbusReadRegisters(int slaveNo, int pduAddr, int nWords)
static const int RXCOUNT_INVALID
virtual int set_RTS(int val)
u64 _cacheExpiration
Definition: yocto_api.h:1571
void _throw(YRETCODE errType, string errMsg)
Definition: yocto_api.cpp:2656
yJsonState next
Definition: yjson.h:85
yJsonRetCode yJsonParse(yJsonStateMachine *j)
Definition: yjson.c:83
_FAR const char * src
Definition: yjson.h:82
virtual int read_avail(void)
void yLeaveCriticalSection(yCRITICAL_SECTION *cs)
Definition: ythread.c:672
virtual vector< int > queryMODBUS(int slaveNo, vector< int > pduBytes)
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
virtual string readStr(int nChars)
void yJsonSkip(yJsonStateMachine *j, int nitems)
Definition: yjson.c:367
int get_errCount(void)
#define YAPI_INVALID_STRING
Definition: yocto_api.h:69
string get_protocol(void)
virtual int _parseAttr(YJSONObject *json_val)
Definition: yocto_api.cpp:2367
virtual int modbusWriteBits(int slaveNo, int pduAddr, vector< int > bits)
virtual int read_seek(int absPos)
_FAR const char * end
Definition: yjson.h:83
virtual int get_CTS(void)
virtual int modbusWriteBit(int slaveNo, int pduAddr, int value)
static const string STARTUPJOB_INVALID
YAPI_FUNCTION YFUN_DESCR
Definition: yocto_api.h:230
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
int set_voltageLevel(Y_VOLTAGELEVEL_enum newval)
static const string COMMAND_INVALID
virtual int _invokeValueCallback(string value)
YSerialPortValueCallback _valueCallbackSerialPort
YAPI_DEVICE YDEV_DESCR
Definition: yocto_api.h:229
static YFunction * _FindFromCache(const string &classname, const string &func)
Definition: yocto_api.cpp:2338
int get_txCount(void)
yJsonState st
Definition: yjson.h:84
vector< string > _json_get_array(const string &json)
Definition: yocto_api.cpp:2811
virtual int readByte(void)
virtual int reset(void)
virtual int writeHex(string hexString)
static string ysprintf(const char *fmt,...)
Definition: yocto_api.cpp:4997
virtual int modbusWriteRegister(int slaveNo, int pduAddr, int value)
void yEnterCriticalSection(yCRITICAL_SECTION *cs)
Definition: ythread.c:647
static yCRITICAL_SECTION _global_cs
Definition: yocto_api.h:476
static const int TXCOUNT_INVALID
bool isOnline(void)
Definition: yocto_api.cpp:3291
virtual int writeLine(string text)
virtual int uploadJob(string jobfile, string jsonDef)
virtual int modbusWriteRegisters(int slaveNo, int pduAddr, vector< int > values)
int set_currentJob(const string &newval)
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_command(const string &newval)
static const int RXMSGCOUNT_INVALID
virtual string readBin(int nChars)
string _className
Definition: yocto_api.h:1558
string get_startupJob(void)
virtual string get_message(void)
virtual string queryLine(string query, int maxWait)
YSerialPort(const string &func)
Y_VOLTAGELEVEL_enum get_voltageLevel(void)
virtual vector< int > readArray(int nChars)
virtual int writeByte(int code)
virtual vector< YSnoopingRecord > snoopMessages(int maxWait)
static const Y_VOLTAGELEVEL_enum VOLTAGELEVEL_INVALID
virtual int selectJob(string jobfile)
static const string SERIALMODE_INVALID
static bool _apiInitialized
Definition: yocto_api.h:475
YRETCODE _nextFunction(string &hwId)
Definition: yocto_api.cpp:2709
string get_currentJob(void)
virtual int writeMODBUS(string hexString)
int set_startupJob(const string &newval)
virtual int get_time(void)
virtual string readLine(void)
int get_rxCount(void)
static void _UpdateValueCallbackList(YFunction *func, bool add)
Definition: yocto_api.cpp:3509
Y_VOLTAGELEVEL_enum _voltageLevel
#define YISERR(retcode)
Definition: ydef.h:394
static const int ERRCOUNT_INVALID
YSerialPort * nextSerialPort(void)
string get_serialMode(void)
static YSerialPort * FindSerialPort(string func)
virtual int writeStr(string text)
bool has(const string &key)
Definition: yocto_api.cpp:735
YRETCODE _setAttr(string attrname, string newvalue)
Definition: yocto_api.cpp:2968
virtual int _parseAttr(YJSONObject *json_val)
virtual vector< int > modbusReadInputRegisters(int slaveNo, int pduAddr, int nWords)
virtual int writeArray(vector< int > byteList)
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