yocto_api.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * $Id: yocto_api.h 29669 2018-01-19 08:25:56Z seb $
4  *
5  * High-level programming interface, common to all modules
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 #ifndef YOCTO_API_H
41 #define YOCTO_API_H
42 
43 #include "yapi/ydef.h"
44 #include "yapi/yjson.h"
45 #include <string>
46 #include <vector>
47 #include <queue>
48 #include <map>
49 #include <stdexcept>
50 #include <cfloat>
51 #include <cmath>
52 
53 #if defined(WINDOWS_API)
54 #if defined(GENERATE_DLL) || defined(YOCTOPUCEDLL_EXPORTS)
55 #define YOCTO_CLASS_EXPORT __declspec(dllexport)
56 #pragma warning(disable: 4251)
57 #else
58 #define YOCTO_CLASS_EXPORT
59 #endif
60 #else
61 #define YOCTO_CLASS_EXPORT
62 #endif
63 
64 using std::string;
65 using std::vector;
66 using std::queue;
67 using std::map;
68 
69 #define YAPI_INVALID_STRING "!INVALID!"
70 #define YAPI_INVALID_INT (0x7FFFFFFF)
71 #define YAPI_INVALID_UINT (-1)
72 #define YAPI_INVALID_LONG (0x7FFFFFFFFFFFFFFFLL)
73 #define YAPI_INVALID_DOUBLE (-DBL_MAX)
74 
75 
76 //--- (generated code: YFunction definitions)
77 class YFunction; // forward declaration
78 
79 typedef void (*YFunctionValueCallback)(YFunction *func, const string& functionValue);
80 #define Y_LOGICALNAME_INVALID (YAPI_INVALID_STRING)
81 #define Y_ADVERTISEDVALUE_INVALID (YAPI_INVALID_STRING)
82 //--- (end of generated code: YFunction definitions)
83 
84 
85 //--- (generated code: YModule definitions)
86 class YModule; // forward declaration
87 
88 typedef void (*YModuleLogCallback)(YModule *module, const string& logline);
89 typedef void (*YModuleValueCallback)(YModule *func, const string& functionValue);
90 #ifndef _Y_PERSISTENTSETTINGS_ENUM
91 #define _Y_PERSISTENTSETTINGS_ENUM
92 typedef enum {
98 #endif
99 #ifndef _Y_BEACON_ENUM
100 #define _Y_BEACON_ENUM
101 typedef enum {
105 } Y_BEACON_enum;
106 #endif
107 #define Y_PRODUCTNAME_INVALID (YAPI_INVALID_STRING)
108 #define Y_SERIALNUMBER_INVALID (YAPI_INVALID_STRING)
109 #define Y_PRODUCTID_INVALID (YAPI_INVALID_UINT)
110 #define Y_PRODUCTRELEASE_INVALID (YAPI_INVALID_UINT)
111 #define Y_FIRMWARERELEASE_INVALID (YAPI_INVALID_STRING)
112 #define Y_LUMINOSITY_INVALID (YAPI_INVALID_UINT)
113 #define Y_UPTIME_INVALID (YAPI_INVALID_LONG)
114 #define Y_USBCURRENT_INVALID (YAPI_INVALID_UINT)
115 #define Y_REBOOTCOUNTDOWN_INVALID (YAPI_INVALID_INT)
116 #define Y_USERVAR_INVALID (YAPI_INVALID_INT)
117 //--- (end of generated code: YModule definitions)
118 
119 class YMeasure; // forward declaration
120 //--- (generated code: YSensor definitions)
121 class YSensor; // forward declaration
122 
123 typedef void (*YSensorValueCallback)(YSensor *func, const string& functionValue);
124 class YMeasure; // forward declaration
125 typedef void (*YSensorTimedReportCallback)(YSensor *func, YMeasure measure);
126 #ifndef _Y_ADVMODE_ENUM
127 #define _Y_ADVMODE_ENUM
128 typedef enum {
135 #endif
136 #define Y_UNIT_INVALID (YAPI_INVALID_STRING)
137 #define Y_CURRENTVALUE_INVALID (YAPI_INVALID_DOUBLE)
138 #define Y_LOWESTVALUE_INVALID (YAPI_INVALID_DOUBLE)
139 #define Y_HIGHESTVALUE_INVALID (YAPI_INVALID_DOUBLE)
140 #define Y_CURRENTRAWVALUE_INVALID (YAPI_INVALID_DOUBLE)
141 #define Y_LOGFREQUENCY_INVALID (YAPI_INVALID_STRING)
142 #define Y_REPORTFREQUENCY_INVALID (YAPI_INVALID_STRING)
143 #define Y_CALIBRATIONPARAM_INVALID (YAPI_INVALID_STRING)
144 #define Y_RESOLUTION_INVALID (YAPI_INVALID_DOUBLE)
145 #define Y_SENSORSTATE_INVALID (YAPI_INVALID_INT)
146 //--- (end of generated code: YSensor definitions)
147 
148 
149 //--- (generated code: YDataStream definitions)
150 //--- (end of generated code: YDataStream definitions)
151 
152 //--- (generated code: YFirmwareUpdate definitions)
153 //--- (end of generated code: YFirmwareUpdate definitions)
154 
155 
156 //--- (generated code: YMeasure definitions)
157 //--- (end of generated code: YMeasure definitions)
158 
159 
160 //--- (generated code: YDataLogger definitions)
161 class YDataLogger; // forward declaration
162 
163 typedef void (*YDataLoggerValueCallback)(YDataLogger *func, const string& functionValue);
164 #ifndef _Y_RECORDING_ENUM
165 #define _Y_RECORDING_ENUM
166 typedef enum {
172 #endif
173 #ifndef _Y_AUTOSTART_ENUM
174 #define _Y_AUTOSTART_ENUM
175 typedef enum {
180 #endif
181 #ifndef _Y_BEACONDRIVEN_ENUM
182 #define _Y_BEACONDRIVEN_ENUM
183 typedef enum {
188 #endif
189 #ifndef _Y_CLEARHISTORY_ENUM
190 #define _Y_CLEARHISTORY_ENUM
191 typedef enum {
196 #endif
197 #define Y_CURRENTRUNINDEX_INVALID (YAPI_INVALID_UINT)
198 #define Y_TIMEUTC_INVALID (YAPI_INVALID_LONG)
199 //--- (end of generated code: YDataLogger definitions)
200 
201 
202 // yInitAPI argument
203 const int Y_DETECT_NONE = 0;
204 const int Y_DETECT_USB = 1;
205 const int Y_DETECT_NET = 2;
206 const int Y_RESEND_MISSING_PKT = 4;
208 
209 // Forward-declaration
210 class YDataSet;
211 class YFunction;
212 
214 typedef void (*yLogFunction)(const string& msg);
215 
218 
220 typedef void (*YHubDiscoveryCallback)(const string& serial, const string& url);
221 
222 
223 
225 typedef vector<double> floatArr;
226 typedef vector<int> intArr;
227 typedef double (*yCalibrationHandler)(double rawValue, int calibType, vector<int> params, vector<double> rawValues, vector<double> refValues);
228 
231 #define Y_FUNCTIONDESCRIPTOR_INVALID (-1)
232 #define Y_HARDWAREID_INVALID (YAPI_INVALID_STRING)
233 #define Y_FUNCTIONID_INVALID (YAPI_INVALID_STRING)
234 #define Y_FRIENDLYNAME_INVALID (YAPI_INVALID_STRING)
235 
236 #define Y_DATA_INVALID (-DBL_MAX)
237 #define Y_DURATION_INVALID (-1)
238 
239 //
240 // Class used to report exceptions within Yocto-API
241 // Do not instantiate directly
242 //
243 class YAPI_Exception : public std::runtime_error {
244 public:
246  explicit YAPI_Exception(YRETCODE errType, string errMsg) : std::runtime_error(errMsg), errorType(errType) { }
247 };
248 
249 typedef enum {
256 
257 typedef struct{
259  union{
261  struct {
262  char serial[YOCTO_SERIAL_LEN];
263  char url[64];
264  };
265  };
267 
268 
269 
270 typedef enum {
276 
277 typedef struct{
279  union{
280  struct {
282  char value[YOCTO_PUBVAL_LEN];
283  };
284  struct {
286  double timestamp;
287  int len;
288  int report[18];
289  };
290  };
292 
293 
294 // internal helper function
295 s64 yatoi(const char *c);
296 int _ystrpos(const string& haystack, const string& needle);
297 vector<string> _strsplit(const string& str, char delimiter);
298 
299 typedef enum {
304 } YJSONType;
305 
306 typedef enum {
318 } Tjstate;
319 
320 class YJSONObject;
321 
323 {
324  public:
325  string _data;
330  static YJSONContent* ParseJson(const string& data, int start, int stop);
331  YJSONContent(const string& data, int start, int stop, YJSONType type);
333  YJSONContent(YJSONType type);
334  virtual ~YJSONContent();
335  YJSONType getJSONType();
336  virtual int parse()=0;
337  static int SkipGarbage(const string& data, int start, int stop);
338  string FormatError(const string& errmsg, int cur_pos);
339  virtual string toJSON()=0;
340  virtual string toString()=0;
341 };
342 
343 class YJSONArray : public YJSONContent
344 {
345  vector<YJSONContent*> _arrayValue;
346  public:
347  YJSONArray(const string& data, int start, int stop);
348  YJSONArray(const string& data);
349  YJSONArray(YJSONArray *ref);
350  YJSONArray();
351  virtual ~YJSONArray();
352  int length();
353  virtual int parse();
354  YJSONObject* getYJSONObject(int i);
355  string getString(int i);
356  YJSONContent* get(int i);
357  YJSONArray* getYJSONArray(int i);
358  int getInt(int i);
359  s64 getLong(int i);
360  void put(const string& flatAttr);
361  virtual string toJSON();
362  virtual string toString();
363 };
364 
365 class YJSONString : public YJSONContent
366 {
367  string _stringValue;
368  public:
369  YJSONString(const string& data, int start, int stop);
370  YJSONString(YJSONString *ref);
371  YJSONString();
372 
373  virtual ~YJSONString() { }
374 
375  virtual int parse();
376  virtual string toJSON();
377  string getString();
378  virtual string toString();
379  void setContent(const string& value);
380 };
381 
382 
383 class YJSONNumber : public YJSONContent
384 {
386  double _doubleValue;
387  bool _isFloat;
388  public:
389  YJSONNumber(const string& data, int start, int stop);
390  YJSONNumber(YJSONNumber *ref);
391 
392  virtual ~YJSONNumber() { }
393 
394  virtual int parse();
395  virtual string toJSON();
396  s64 getLong();
397  int getInt();
398  double getDouble();
399  virtual string toString();
400 };
401 
402 
403 class YJSONObject : public YJSONContent
404 {
405  map<string, YJSONContent*> _parsed;
406  vector<string> _keys;
407  void convert(YJSONObject* reference, YJSONArray* newArray);
408 public:
409  YJSONObject(const string& data);
410  YJSONObject(const string& data, int start, int len);
411  YJSONObject(YJSONObject *ref);
412  virtual ~YJSONObject();
413 
414  virtual int parse();
415  bool has(const string& key);
416  YJSONObject* getYJSONObject(const string& key);
417  YJSONString* getYJSONString(const string& key);
418  YJSONArray* getYJSONArray(const string& key);
419  vector<string> keys();
420  YJSONNumber* getYJSONNumber(const string& key);
421  string getString(const string& key);
422  int getInt(const string& key);
423  YJSONContent* get(const string& key);
424  s64 getLong(const string& key);
425  double getDouble(const string& key);
426  virtual string toJSON();
427  virtual string toString();
428  void parseWithRef(YJSONObject* reference);
429  string getKeyFromIdx(int i);
430 };
431 
432 
433 
434 //
435 // YAPI Context
436 //
437 // This class provides C++-style entry points to lowlevcel functions defined to yapi.h
438 // Could be implemented by a singleton, we use static methods insead
439 //
441 private:
442  static queue<yapiGlobalEvent> _plug_events;
443  static queue<yapiDataEvent> _data_events;
445  static u64 _nextEnum;
446 
447  static map<int,yCalibrationHandler> _calibHandlers;
448  static void _yapiLogFunctionFwd(const char *log, u32 loglen);
449  static void _yapiDeviceArrivalCallbackFwd(YDEV_DESCR devdesc);
450  static void _yapiDeviceRemovalCallbackFwd(YDEV_DESCR devdesc);
451  static void _yapiDeviceChangeCallbackFwd(YDEV_DESCR devdesc);
452  static void _yapiDeviceLogCallbackFwd(YDEV_DESCR devdesc, const char* line);
453  static void _yapiFunctionTimedReportCallbackFwd(YAPI_FUNCTION fundesc, double timestamp, const u8 *bytes, u32 len);
454  static void _yapiHubDiscoveryCallbackFwd(const char *serial, const char *url);
455 
456 public:
457  static void _yapiFunctionUpdateCallbackFwd(YFUN_DESCR fundesc, const char *value);
458  static double _decimalToDouble(s16 val);
459  static s16 _doubleToDecimal(double val);
460  static yCalibrationHandler _getCalibrationHandler(int calibType);
461  static vector<int> _decodeWords(string s);
462  static vector<int> _decodeFloats(string sdat);
463  static string _bin2HexStr(const string& data);
464  static string _hexStr2Bin(const string& str);
465  static string _flattenJsonStruct(string jsonbuffer);
466  static string _checkFirmware(const string& serial, const string& rev, const string& path);
467 
469  static bool ExceptionsDisabled;
470  static const string INVALID_STRING;
471  static const int INVALID_INT = YAPI_INVALID_INT;
472  static const int INVALID_UINT = YAPI_INVALID_UINT;
473  static const double INVALID_DOUBLE;
474  static const s64 INVALID_LONG = YAPI_INVALID_LONG;
475  static bool _apiInitialized;
477 
478  // Callback functions
483 
484  static const u32 DETECT_NONE = 0;
485  static const u32 DETECT_USB = 1;
486  static const u32 DETECT_NET = 2;
487  static const u32 RESEND_MISSING_PKT = 4;
488  static const u32 DETECT_ALL = (Y_DETECT_USB | Y_DETECT_NET);
489 
490 //--- (generated code: YFunction return codes)
491  static const int SUCCESS = 0; // everything worked all right
492  static const int NOT_INITIALIZED = -1; // call yInitAPI() first !
493  static const int INVALID_ARGUMENT = -2; // one of the arguments passed to the function is invalid
494  static const int NOT_SUPPORTED = -3; // the operation attempted is (currently) not supported
495  static const int DEVICE_NOT_FOUND = -4; // the requested device is not reachable
496  static const int VERSION_MISMATCH = -5; // the device firmware is incompatible with this API version
497  static const int DEVICE_BUSY = -6; // the device is busy with another task and cannot answer
498  static const int TIMEOUT = -7; // the device took too long to provide an answer
499  static const int IO_ERROR = -8; // there was an I/O problem while talking to the device
500  static const int NO_MORE_DATA = -9; // there is no more data to read from
501  static const int EXHAUSTED = -10; // you have run out of a limited resource, check the documentation
502  static const int DOUBLE_ACCES = -11; // you have two process that try to access to the same device
503  static const int UNAUTHORIZED = -12; // unauthorized access to password-protected device
504  static const int RTC_NOT_READY = -13; // real-time clock has not been initialized (or time was lost)
505  static const int FILE_NOT_FOUND = -14; // the file is not found
506 //--- (end of generated code: YFunction return codes)
507 
508 
525  static string GetAPIVersion(void);
526 
527 
548  static YRETCODE InitAPI(int mode, string& errmsg);
549 
558  static void FreeAPI(void);
559 
566  static void DisableExceptions(void);
567 
575  static void EnableExceptions(void);
576 
584  static void RegisterLogFunction(yLogFunction logfun);
585 
594  static void RegisterDeviceArrivalCallback(yDeviceUpdateCallback arrivalCallback);
595 
604  static void RegisterDeviceRemovalCallback(yDeviceUpdateCallback removalCallback);
605 
616  static void RegisterHubDiscoveryCallback(YHubDiscoveryCallback hubDiscoveryCallback);
617 
627  static YRETCODE TriggerHubDiscovery(string& errmsg);
628 
629 
630  static void RegisterDeviceChangeCallback(yDeviceUpdateCallback changeCallback);
631 
632  // Register a new value calibration handler for a given calibration type
633  //
634  static void RegisterCalibrationHandler(int calibrationType, yCalibrationHandler calibrationHandler);
635 
636  // Standard value calibration handler (n-point linear error correction)
637  //
638  static double LinearCalibrationHandler(double rawValue, int calibType, intArr params, floatArr rawValues, floatArr refValues);
639 
655  static YRETCODE TestHub(const string& url, int mstimeout, string& errmsg);
700  static YRETCODE RegisterHub(const string& url, string& errmsg);
701 
717  static YRETCODE PreregisterHub(const string& url, string& errmsg);
718 
726  static void UnregisterHub(const string& url);
727 
743  static YRETCODE UpdateDeviceList(string& errmsg);
761  static YRETCODE HandleEvents(string& errmsg);
781  static YRETCODE Sleep(unsigned ms_duration, string& errmsg);
789  static u64 GetTickCount(void);
801  static bool CheckLogicalName(const string& name);
802 };
803 
804 
805 // Wrappers to yapi low-level API
806 class YapiWrapper {
807 public:
808  static u16 getAPIVersion(string& version, string& date);
809  static YDEV_DESCR getDevice(const string& device_str, string& errmsg);
810  static int getAllDevices(vector<YDEV_DESCR>& buffer, string& errmsg);
811  static YRETCODE getDeviceInfo(YDEV_DESCR devdesc, yDeviceSt& infos, string& errmsg);
812  static YFUN_DESCR getFunction(const string& class_str, const string& function_str, string& errmsg);
813  static int getFunctionsByClass(const string& class_str, YFUN_DESCR prevfundesc, vector<YFUN_DESCR>& buffer, int maxsize, string& errmsg);
814  static int getFunctionsByDevice(YDEV_DESCR devdesc, YFUN_DESCR prevfundesc, vector<YFUN_DESCR>& buffer, int maxsize, string& errmsg);
815  static YDEV_DESCR getDeviceByFunction(YFUN_DESCR fundesc, string& errmsg);
816  static YRETCODE getFunctionInfo(YFUN_DESCR fundesc, YDEV_DESCR& devdescr, string& serial, string& funcId, string& funcName, string& funcVal, string& errmsg);
817  static YRETCODE getFunctionInfoEx(YFUN_DESCR fundesc, YDEV_DESCR& devdescr, string& serial, string& funcId, string& baseType, string& funcName, string& funcVal, string& errmsg);
818  // pure yapi mapper
819  static YRETCODE updateDeviceList(bool forceupdate, string& errmsg);
820  static YRETCODE handleEvents(string& errmsg);
821  static string ysprintf(const char *fmt, ...);
822 };
823 
824 
825 //--- (generated code: YFirmwareUpdate declaration)
834 #ifdef __BORLANDC__
835 #pragma option push -w-8022
836 #endif
837 //--- (end of generated code: YFirmwareUpdate declaration)
838 protected:
839  //--- (generated code: YFirmwareUpdate attributes)
840  // Attributes (function value cache)
841  string _serial;
842  string _settings;
848  bool _force;
849  //--- (end of generated code: YFirmwareUpdate attributes)
850 
851 
852 public:
853  YFirmwareUpdate(string serialNumber, string path, string settings);
854  YFirmwareUpdate(string serialNumber, string path, string settings, bool force);
855  YFirmwareUpdate();
856 
857  //--- (generated code: YFirmwareUpdate accessors declaration)
858 
859 
860  virtual int _processMore(int newupdate);
861 
869  static vector<string> GetAllBootLoaders(void);
870 
884  static string CheckFirmware(string serial,string path,int minrelease);
885 
896  virtual int get_progress(void);
897 
904  virtual string get_progressMessage(void);
905 
916  virtual int startUpdate(void);
917 
918 #ifdef __BORLANDC__
919 #pragma option pop
920 #endif
921  //--- (end of generated code: YFirmwareUpdate accessors declaration)
922 };
923 
924 
925 
926 //--- (generated code: YDataStream declaration)
941 #ifdef __BORLANDC__
942 #pragma option push -w-8022
943 #endif
944 //--- (end of generated code: YDataStream declaration)
945 protected:
946  //--- (generated code: YDataStream attributes)
947  // Attributes (function value cache)
949  int _runNo;
951  int _nCols;
952  int _nRows;
954  vector<string> _columnNames;
955  string _functionId;
956  bool _isClosed;
957  bool _isAvg;
958  bool _isScal;
959  bool _isScal32;
961  double _offset;
962  double _scale;
964  double _minVal;
965  double _avgVal;
966  double _maxVal;
967  double _decexp;
968  int _caltyp;
969  vector<int> _calpar;
970  vector<double> _calraw;
971  vector<double> _calref;
972  vector< vector<double> > _values;
973  //--- (end of generated code: YDataStream attributes)
974 
976 
977 public:
978  YDataStream(YFunction *parent);
979  YDataStream(YFunction *parent, YDataSet &dataset, const vector<int>& encoded);
980 
981  virtual ~YDataStream();
982 
983  static const double DATA_INVALID;
984  static const int DURATION_INVALID = -1;
985 
986  //--- (generated code: YDataStream accessors declaration)
987 
988 
989  virtual int _initFromDataSet(YDataSet* dataset,vector<int> encoded);
990 
991  virtual int _parseStream(string sdata);
992 
993  virtual string _get_url(void);
994 
995  virtual int loadStream(void);
996 
997  virtual double _decodeVal(int w);
998 
999  virtual double _decodeAvg(int dw,int count);
1000 
1001  virtual bool isClosed(void);
1002 
1009  virtual int get_runIndex(void);
1010 
1024  virtual int get_startTime(void);
1025 
1035  virtual s64 get_startTimeUTC(void);
1036 
1045  virtual int get_dataSamplesIntervalMs(void);
1046 
1047  virtual double get_dataSamplesInterval(void);
1048 
1060  virtual int get_rowCount(void);
1061 
1075  virtual int get_columnCount(void);
1076 
1094  virtual vector<string> get_columnNames(void);
1095 
1106  virtual double get_minValue(void);
1107 
1118  virtual double get_averageValue(void);
1119 
1130  virtual double get_maxValue(void);
1131 
1139  virtual int get_duration(void);
1140 
1156  virtual vector< vector<double> > get_dataRows(void);
1157 
1174  virtual double get_data(int row,int col);
1175 
1176 #ifdef __BORLANDC__
1177 #pragma option pop
1178 #endif
1179  //--- (end of generated code: YDataStream accessors declaration)
1180 };
1181 
1182 //--- (generated code: YMeasure declaration)
1191 #ifdef __BORLANDC__
1192 #pragma option push -w-8022
1193 #endif
1194 //--- (end of generated code: YMeasure declaration)
1195 protected:
1196  //--- (generated code: YMeasure attributes)
1197  // Attributes (function value cache)
1198  double _start;
1199  double _end;
1200  double _minVal;
1201  double _avgVal;
1202  double _maxVal;
1203  //--- (end of generated code: YMeasure attributes)
1204 
1205 
1207  time_t _stopTime_t;
1208 public:
1209  YMeasure(double start, double end, double minVal, double avgVal, double maxVal);
1210  YMeasure();
1211 
1212  time_t* get_startTimeUTC_asTime_t(time_t *time);
1213  time_t* get_endTimeUTC_asTime_t(time_t *time);
1214 
1215  //--- (generated code: YMeasure accessors declaration)
1216 
1217 
1226  virtual double get_startTimeUTC(void);
1227 
1236  virtual double get_endTimeUTC(void);
1237 
1244  virtual double get_minValue(void);
1245 
1252  virtual double get_averageValue(void);
1253 
1260  virtual double get_maxValue(void);
1261 
1262 #ifdef __BORLANDC__
1263 #pragma option pop
1264 #endif
1265  //--- (end of generated code: YMeasure accessors declaration)
1266 };
1267 
1268 
1269 
1270 //--- (generated code: YDataSet declaration)
1291 #ifdef __BORLANDC__
1292 #pragma option push -w-8022
1293 #endif
1294 //--- (end of generated code: YDataSet declaration)
1295 protected:
1296  //--- (generated code: YDataSet attributes)
1297  // Attributes (function value cache)
1299  string _hardwareId;
1300  string _functionId;
1301  string _unit;
1305  vector<int> _calib;
1306  vector<YDataStream*> _streams;
1308  vector<YMeasure> _preview;
1309  vector<YMeasure> _measures;
1310  //--- (end of generated code: YDataSet attributes)
1311 
1312 public:
1313  YDataSet(YFunction *parent, const string& functionId, const string& unit, s64 startTime, s64 endTime);
1314  YDataSet(YFunction *parent);
1315  int _parse(const string& json);
1316 
1317  //--- (generated code: YDataSet accessors declaration)
1318 
1319 
1320  virtual vector<int> _get_calibration(void);
1321 
1322  virtual int processMore(int progress,string data);
1323 
1324  virtual vector<YDataStream*> get_privateDataStreams(void);
1325 
1336  virtual string get_hardwareId(void);
1337 
1344  virtual string get_functionId(void);
1345 
1353  virtual string get_unit(void);
1354 
1367  virtual s64 get_startTimeUTC(void);
1368 
1381  virtual s64 get_endTimeUTC(void);
1382 
1391  virtual int get_progress(void);
1392 
1402  virtual int loadMore(void);
1403 
1418  virtual YMeasure get_summary(void);
1419 
1438  virtual vector<YMeasure> get_preview(void);
1439 
1453  virtual vector<YMeasure> get_measuresAt(YMeasure measure);
1454 
1480  virtual vector<YMeasure> get_measures(void);
1481 
1482 #ifdef __BORLANDC__
1483 #pragma option pop
1484 #endif
1485  //--- (end of generated code: YDataSet accessors declaration)
1486 };
1487 
1488 //
1489 // YDevice Class (used internally)
1490 //
1491 // This class is used to cache device-level information
1492 //
1493 // In order to regroup multiple function queries on the same physical device,
1494 // this class implements a device-wide API string cache (agnostic of API content).
1495 // This is in addition to the function-specific cache implemented in YFunction.
1496 //
1497 
1498 class YDevice;
1499 
1500 typedef void (*HTTPRequestCallback)(YDevice *device,void *context,YRETCODE returnval, const string& result,string& errmsg);
1501 
1502 class YDevice
1503 {
1504 private:
1505  // Static device-based JSON string cache
1506  static vector<YDevice*> _devCache;
1507 
1508  // Device cache entries
1510  u64 _cacheStamp; // used only by requestAPI method
1511  YJSONObject* _cacheJson; // used only by requestAPI method
1512  vector<YFUN_DESCR> _functions;
1513  char _rootdevice[YOCTO_SERIAL_LEN];
1514  char *_subpath;
1516  // Constructor is private, use getDevice factory method
1517  YDevice(YDEV_DESCR devdesc);
1518  ~YDevice();
1519  YRETCODE HTTPRequestPrepare(const string& request, string& fullrequest, char *errbuff);
1520  YRETCODE HTTPRequest_unsafe(int channel, const string& request, string& buffer, yapiRequestProgressCallback progress_cb, void *progress_ctx, string& errmsg);
1521 
1522 public:
1523  static void ClearCache();
1524  static YDevice *getDevice(YDEV_DESCR devdescr);
1525  YRETCODE HTTPRequestAsync(int channel, const string& request, HTTPRequestCallback callback, void *context, string& errmsg);
1526  YRETCODE HTTPRequest(int channel, const string& request, string& buffer, yapiRequestProgressCallback progress_cb, void *progress_ctx, string& errmsg);
1527  YRETCODE requestAPI(YJSONObject*& apires, string& errmsg);
1528  void clearCache(bool clearSubpath);
1529  YRETCODE getFunctions(vector<YFUN_DESCR> **functions, string& errmsg);
1530  string getHubSerial(void);
1531 
1532 };
1533 
1534 //--- (generated code: YFunction declaration)
1552 #ifdef __BORLANDC__
1553 #pragma option push -w-8022
1554 #endif
1555 //--- (end of generated code: YFunction declaration)
1556 protected:
1557  // Protected attributes
1558  string _className;
1559  string _func;
1564  std::map<string,YDataStream*> _dataStreams;
1565  void* _userData;
1566  //--- (generated code: YFunction attributes)
1567  // Attributes (function value cache)
1572  string _serial;
1573  string _funId;
1574  string _hwId;
1575 
1576  friend YFunction *yFindFunction(const string& func);
1577  friend YFunction *yFirstFunction(void);
1578 
1579  // Function-specific method for parsing of JSON output and caching result
1580  virtual int _parseAttr(YJSONObject* json_val);
1581 
1582  // Constructor is protected, use yFindFunction factory function to instantiate
1583  YFunction(const string& func);
1584  //--- (end of generated code: YFunction attributes)
1585  static std::map<string,YFunction*> _cache;
1586 
1587 
1588  // Method used to retrieve our unique function descriptor (may trigger a hub scan)
1589  YRETCODE _getDescriptor(YFUN_DESCR& fundescr, string& errMsg);
1590 
1591  // Method used to retrieve our device object (may trigger a hub scan)
1592  YRETCODE _getDevice(YDevice*& dev, string& errMsg);
1593 
1594  // Method used to find the next instance of our function
1595  YRETCODE _nextFunction(string &hwId);
1596 
1597  int _parse(YJSONObject* j);
1598 
1599  string _escapeAttr(const string& changeval);
1600  YRETCODE _buildSetRequest(const string& changeattr, const string *changeval, string& request, string& errmsg);
1601 
1602  // Method used to change attributes
1603  YRETCODE _setAttr(string attrname, string newvalue);
1604  YRETCODE _load_unsafe(int msValidity);
1605 
1606  static void _UpdateValueCallbackList(YFunction* func, bool add);
1607  static void _UpdateTimedReportCallbackList(YFunction* func, bool add);
1608 
1609  // function cache methods
1610  static YFunction* _FindFromCache(const string& classname, const string& func);
1611  static void _AddToCache(const string& classname, const string& func, YFunction *obj);
1612 
1613 public:
1614  virtual ~YFunction();
1615 
1616  // clear cache of all YFunction object (use only on YAPI::FreeAPI)
1617  static void _ClearCache(void);
1618 
1619  // Method used to throw exceptions or save error type/message
1620  void _throw(YRETCODE errType, string errMsg);
1621 
1622  // Method used to send http request to the device (not the function)
1623  string _request(const string& request);
1624  string _requestEx(int tcpchan, const string& request, yapiRequestProgressCallback callback, void *context);
1625  string _download(const string& url);
1626 
1627  // Method used to upload a file to the device
1628  YRETCODE _uploadWithProgress(const string& path, const string& content, yapiRequestProgressCallback callback, void *context);
1629  YRETCODE _upload(const string& path, const string& content);
1630 
1631  // Method used to parse a string in JSON data (low-level)
1632  string _json_get_key(const string& json, const string& data);
1633  string _json_get_string(const string& json);
1634  vector<string> _json_get_array(const string& json);
1635  string _get_json_path(const string& json, const string& path);
1636  string _decode_json_string(const string& json);
1637  string _parseString(yJsonStateMachine& j);
1638  int _parseEx(yJsonStateMachine& j);
1639 
1640 
1641 
1642  // Method used to cache DataStream objects (new DataLogger)
1643  YDataStream *_findDataStream(YDataSet& dataset, const string& def);
1644  // Method used to clear cache of DataStream object (undocumented)
1645  void _clearDataStreamCache();
1646 
1647 
1648 
1649  static const YFUN_DESCR FUNCTIONDESCRIPTOR_INVALID = Y_FUNCTIONDESCRIPTOR_INVALID;
1650  static const string HARDWAREID_INVALID;
1651  static const string FUNCTIONID_INVALID;
1652  static const string FRIENDLYNAME_INVALID;
1653 
1654 
1655 
1656  string get_hubSerial();
1657 
1658 
1659  //--- (generated code: YFunction accessors declaration)
1660 
1661  static const string LOGICALNAME_INVALID;
1662  static const string ADVERTISEDVALUE_INVALID;
1663 
1671  string get_logicalName(void);
1672 
1673  inline string logicalName(void)
1674  { return this->get_logicalName(); }
1675 
1688  int set_logicalName(const string& newval);
1689  inline int setLogicalName(const string& newval)
1690  { return this->set_logicalName(newval); }
1691 
1699  string get_advertisedValue(void);
1700 
1701  inline string advertisedValue(void)
1702  { return this->get_advertisedValue(); }
1703 
1704  int set_advertisedValue(const string& newval);
1705  inline int setAdvertisedValue(const string& newval)
1706  { return this->set_advertisedValue(newval); }
1707 
1735  static YFunction* FindFunction(string func);
1736 
1748  virtual int registerValueCallback(YFunctionValueCallback callback);
1749 
1750  virtual int _invokeValueCallback(string value);
1751 
1763  virtual int muteValueCallbacks(void);
1764 
1775  virtual int unmuteValueCallbacks(void);
1776 
1787  virtual string loadAttribute(string attrName);
1788 
1789  virtual int _parserHelper(void);
1790 
1791 
1792  inline static YFunction* Find(string func)
1793  { return YFunction::FindFunction(func); }
1794 
1798  YFunction *nextFunction(void);
1799  inline YFunction *next(void)
1800  { return this->nextFunction();}
1801 
1805  static YFunction* FirstFunction(void);
1806  inline static YFunction* First(void)
1807  { return YFunction::FirstFunction();}
1808 #ifdef __BORLANDC__
1809 #pragma option pop
1810 #endif
1811  //--- (end of generated code: YFunction accessors declaration)
1812 
1813 
1814 
1831  string describe(void);
1832 
1844  virtual string get_friendlyName(void);
1845 
1855  string get_hardwareId(void);
1856 
1865  string get_functionId(void);
1866 
1867 
1876  YRETCODE get_errorType(void);
1877  inline YRETCODE errorType(void)
1878  {return this->get_errorType();}
1879  inline YRETCODE errType(void)
1880  {return this->get_errorType();}
1881 
1890  string get_errorMessage(void);
1891  inline string errorMessage(void)
1892  {return this->get_errorMessage();}
1893  inline string errMessage(void)
1894  {return this->get_errorMessage();}
1895 
1905  bool isOnline(void);
1906 
1921  YRETCODE load(int msValidity);
1922 
1929  void clearCache();
1930 
1938  YModule *get_module(void);
1939  inline YModule *module(void)
1940  {return this->get_module();}
1941 
1951  YFUN_DESCR get_functionDescriptor(void);
1953  {return this->get_functionDescriptor();}
1954 
1963  void *get_userData(void);
1964  inline void *userData(void)
1965  {return this->get_userData();}
1966 
1974  void set_userData(void* data);
1975  inline void setUserData(void* data)
1976  { this->set_userData(data);}
1977 
1978 };
1979 
1980 
1981 typedef void(*YModuleLogCallback)(YModule *module, const string& log);
1982 
1983 //--- (generated code: YModule declaration)
1992 #ifdef __BORLANDC__
1993 #pragma option push -w-8022
1994 #endif
1995 //--- (end of generated code: YModule declaration)
1996 protected:
1997  //--- (generated code: YModule attributes)
1998  // Attributes (function value cache)
2007  s64 _upTime;
2013 
2014  friend YModule *yFindModule(const string& func);
2015  friend YModule *yFirstModule(void);
2016 
2017  // Function-specific method for parsing of JSON output and caching result
2018  virtual int _parseAttr(YJSONObject* json_val);
2019 
2020  // Constructor is protected, use yFindModule factory function to instantiate
2021  YModule(const string& func);
2022  //--- (end of generated code: YModule attributes)
2023  //--- (generated code: YModule initialization)
2024  //--- (end of generated code: YModule initialization)
2025 
2026  // Method used to retrieve details of the nth function of our device
2027  YRETCODE _getFunction(int idx, string& serial, string& funcId, string& baseType, string& funcName, string& funcVal, string& errMsg);
2028 
2029 public:
2030  ~YModule();
2031 
2043  virtual string get_friendlyName(void);
2044 
2045 
2053  int functionCount();
2054 
2065  string functionId(int functionIndex);
2066 
2077  string functionName(int functionIndex);
2078 
2090  string functionValue(int functionIndex);
2091 
2102  string functionType(int functionIndex);
2103 
2104 
2116  string functionBaseType(int functionIndex);
2117 
2118 
2119  void setImmutableAttributes(yDeviceSt *infos);
2120 
2129  void registerLogCallback(YModuleLogCallback callback);
2130 
2131 
2132  YModuleLogCallback get_logCallback();
2133 
2134 
2135 
2136  //--- (generated code: YModule accessors declaration)
2137 
2138  static const string PRODUCTNAME_INVALID;
2139  static const string SERIALNUMBER_INVALID;
2140  static const int PRODUCTID_INVALID = YAPI_INVALID_UINT;
2141  static const int PRODUCTRELEASE_INVALID = YAPI_INVALID_UINT;
2142  static const string FIRMWARERELEASE_INVALID;
2143  static const Y_PERSISTENTSETTINGS_enum PERSISTENTSETTINGS_LOADED = Y_PERSISTENTSETTINGS_LOADED;
2144  static const Y_PERSISTENTSETTINGS_enum PERSISTENTSETTINGS_SAVED = Y_PERSISTENTSETTINGS_SAVED;
2145  static const Y_PERSISTENTSETTINGS_enum PERSISTENTSETTINGS_MODIFIED = Y_PERSISTENTSETTINGS_MODIFIED;
2146  static const Y_PERSISTENTSETTINGS_enum PERSISTENTSETTINGS_INVALID = Y_PERSISTENTSETTINGS_INVALID;
2147  static const int LUMINOSITY_INVALID = YAPI_INVALID_UINT;
2148  static const Y_BEACON_enum BEACON_OFF = Y_BEACON_OFF;
2149  static const Y_BEACON_enum BEACON_ON = Y_BEACON_ON;
2150  static const Y_BEACON_enum BEACON_INVALID = Y_BEACON_INVALID;
2151  static const s64 UPTIME_INVALID = YAPI_INVALID_LONG;
2152  static const int USBCURRENT_INVALID = YAPI_INVALID_UINT;
2153  static const int REBOOTCOUNTDOWN_INVALID = YAPI_INVALID_INT;
2154  static const int USERVAR_INVALID = YAPI_INVALID_INT;
2155 
2163  string get_productName(void);
2164 
2165  inline string productName(void)
2166  { return this->get_productName(); }
2167 
2175  string get_serialNumber(void);
2176 
2177  inline string serialNumber(void)
2178  { return this->get_serialNumber(); }
2179 
2187  int get_productId(void);
2188 
2189  inline int productId(void)
2190  { return this->get_productId(); }
2191 
2199  int get_productRelease(void);
2200 
2201  inline int productRelease(void)
2202  { return this->get_productRelease(); }
2203 
2211  string get_firmwareRelease(void);
2212 
2213  inline string firmwareRelease(void)
2214  { return this->get_firmwareRelease(); }
2215 
2224  Y_PERSISTENTSETTINGS_enum get_persistentSettings(void);
2225 
2227  { return this->get_persistentSettings(); }
2228 
2229  int set_persistentSettings(Y_PERSISTENTSETTINGS_enum newval);
2231  { return this->set_persistentSettings(newval); }
2232 
2240  int get_luminosity(void);
2241 
2242  inline int luminosity(void)
2243  { return this->get_luminosity(); }
2244 
2257  int set_luminosity(int newval);
2258  inline int setLuminosity(int newval)
2259  { return this->set_luminosity(newval); }
2260 
2268  Y_BEACON_enum get_beacon(void);
2269 
2270  inline Y_BEACON_enum beacon(void)
2271  { return this->get_beacon(); }
2272 
2282  int set_beacon(Y_BEACON_enum newval);
2283  inline int setBeacon(Y_BEACON_enum newval)
2284  { return this->set_beacon(newval); }
2285 
2293  s64 get_upTime(void);
2294 
2295  inline s64 upTime(void)
2296  { return this->get_upTime(); }
2297 
2305  int get_usbCurrent(void);
2306 
2307  inline int usbCurrent(void)
2308  { return this->get_usbCurrent(); }
2309 
2319  int get_rebootCountdown(void);
2320 
2321  inline int rebootCountdown(void)
2322  { return this->get_rebootCountdown(); }
2323 
2324  int set_rebootCountdown(int newval);
2325  inline int setRebootCountdown(int newval)
2326  { return this->set_rebootCountdown(newval); }
2327 
2336  int get_userVar(void);
2337 
2338  inline int userVar(void)
2339  { return this->get_userVar(); }
2340 
2352  int set_userVar(int newval);
2353  inline int setUserVar(int newval)
2354  { return this->set_userVar(newval); }
2355 
2377  static YModule* FindModule(string func);
2378 
2390  virtual int registerValueCallback(YModuleValueCallback callback);
2392 
2393  virtual int _invokeValueCallback(string value);
2394 
2404  virtual int saveToFlash(void);
2405 
2414  virtual int revertFromFlash(void);
2415 
2425  virtual int reboot(int secBeforeReboot);
2426 
2436  virtual int triggerFirmwareUpdate(int secBeforeReboot);
2437 
2453  virtual string checkFirmware(string path,bool onlynew);
2454 
2464  virtual YFirmwareUpdate updateFirmwareEx(string path,bool force);
2465 
2474  virtual YFirmwareUpdate updateFirmware(string path);
2475 
2484  virtual string get_allSettings(void);
2485 
2486  virtual int loadThermistorExtra(string funcId,string jsonExtra);
2487 
2488  virtual int set_extraSettings(string jsonExtra);
2489 
2503  virtual int set_allSettingsAndFiles(string settings);
2504 
2513  virtual bool hasFunction(string funcId);
2514 
2522  virtual vector<string> get_functionIds(string funType);
2523 
2524  virtual string _flattenJsonStruct(string jsoncomplex);
2525 
2526  virtual int calibVersion(string cparams);
2527 
2528  virtual int calibScale(string unit_name,string sensorType);
2529 
2530  virtual int calibOffset(string unit_name);
2531 
2532  virtual string calibConvert(string param,string currentFuncValue,string unit_name,string sensorType);
2533 
2545  virtual int set_allSettings(string settings);
2546 
2556  virtual string download(string pathname);
2557 
2565  virtual string get_icon2d(void);
2566 
2574  virtual string get_lastLogs(void);
2575 
2587  virtual int log(string text);
2588 
2596  virtual vector<string> get_subDevices(void);
2597 
2605  virtual string get_parentHub(void);
2606 
2613  virtual string get_url(void);
2614 
2615 
2616  inline static YModule* Find(string func)
2617  { return YModule::FindModule(func); }
2618 
2626  YModule *nextModule(void);
2627  inline YModule *next(void)
2628  { return this->nextModule();}
2629 
2639  static YModule* FirstModule(void);
2640  inline static YModule* First(void)
2641  { return YModule::FirstModule();}
2642 #ifdef __BORLANDC__
2643 #pragma option pop
2644 #endif
2645  //--- (end of generated code: YModule accessors declaration)
2646 };
2647 
2648 
2649 
2650 
2651 //--- (generated code: YSensor declaration)
2666 #ifdef __BORLANDC__
2667 #pragma option push -w-8022
2668 #endif
2669 //--- (end of generated code: YSensor declaration)
2670 protected:
2671  //--- (generated code: YSensor attributes)
2672  // Attributes (function value cache)
2673  string _unit;
2682  double _resolution;
2687  double _iresol;
2688  double _offset;
2689  double _scale;
2690  double _decexp;
2691  bool _isScal;
2693  int _caltyp;
2694  vector<int> _calpar;
2695  vector<double> _calraw;
2696  vector<double> _calref;
2698 
2699  friend YSensor *yFindSensor(const string& func);
2700  friend YSensor *yFirstSensor(void);
2701 
2702  // Function-specific method for parsing of JSON output and caching result
2703  virtual int _parseAttr(YJSONObject* json_val);
2704 
2705  // Constructor is protected, use yFindSensor factory function to instantiate
2706  YSensor(const string& func);
2707  //--- (end of generated code: YSensor attributes)
2708 
2709  //--- (generated code: YSensor initialization)
2710  //--- (end of generated code: YSensor initialization)
2711 
2712 public:
2713  ~YSensor();
2714  //--- (generated code: YSensor accessors declaration)
2715 
2716  static const string UNIT_INVALID;
2717  static const double CURRENTVALUE_INVALID;
2718  static const double LOWESTVALUE_INVALID;
2719  static const double HIGHESTVALUE_INVALID;
2720  static const double CURRENTRAWVALUE_INVALID;
2721  static const string LOGFREQUENCY_INVALID;
2722  static const string REPORTFREQUENCY_INVALID;
2723  static const Y_ADVMODE_enum ADVMODE_IMMEDIATE = Y_ADVMODE_IMMEDIATE;
2724  static const Y_ADVMODE_enum ADVMODE_PERIOD_AVG = Y_ADVMODE_PERIOD_AVG;
2725  static const Y_ADVMODE_enum ADVMODE_PERIOD_MIN = Y_ADVMODE_PERIOD_MIN;
2726  static const Y_ADVMODE_enum ADVMODE_PERIOD_MAX = Y_ADVMODE_PERIOD_MAX;
2727  static const Y_ADVMODE_enum ADVMODE_INVALID = Y_ADVMODE_INVALID;
2728  static const string CALIBRATIONPARAM_INVALID;
2729  static const double RESOLUTION_INVALID;
2730  static const int SENSORSTATE_INVALID = YAPI_INVALID_INT;
2731 
2739  string get_unit(void);
2740 
2741  inline string unit(void)
2742  { return this->get_unit(); }
2743 
2752  double get_currentValue(void);
2753 
2754  inline double currentValue(void)
2755  { return this->get_currentValue(); }
2756 
2767  int set_lowestValue(double newval);
2768  inline int setLowestValue(double newval)
2769  { return this->set_lowestValue(newval); }
2770 
2780  double get_lowestValue(void);
2781 
2782  inline double lowestValue(void)
2783  { return this->get_lowestValue(); }
2784 
2795  int set_highestValue(double newval);
2796  inline int setHighestValue(double newval)
2797  { return this->set_highestValue(newval); }
2798 
2808  double get_highestValue(void);
2809 
2810  inline double highestValue(void)
2811  { return this->get_highestValue(); }
2812 
2822  double get_currentRawValue(void);
2823 
2824  inline double currentRawValue(void)
2825  { return this->get_currentRawValue(); }
2826 
2836  string get_logFrequency(void);
2837 
2838  inline string logFrequency(void)
2839  { return this->get_logFrequency(); }
2840 
2854  int set_logFrequency(const string& newval);
2855  inline int setLogFrequency(const string& newval)
2856  { return this->set_logFrequency(newval); }
2857 
2867  string get_reportFrequency(void);
2868 
2869  inline string reportFrequency(void)
2870  { return this->get_reportFrequency(); }
2871 
2885  int set_reportFrequency(const string& newval);
2886  inline int setReportFrequency(const string& newval)
2887  { return this->set_reportFrequency(newval); }
2888 
2897  Y_ADVMODE_enum get_advMode(void);
2898 
2900  { return this->get_advMode(); }
2901 
2912  int set_advMode(Y_ADVMODE_enum newval);
2913  inline int setAdvMode(Y_ADVMODE_enum newval)
2914  { return this->set_advMode(newval); }
2915 
2916  string get_calibrationParam(void);
2917 
2918  inline string calibrationParam(void)
2919  { return this->get_calibrationParam(); }
2920 
2921  int set_calibrationParam(const string& newval);
2922  inline int setCalibrationParam(const string& newval)
2923  { return this->set_calibrationParam(newval); }
2924 
2935  int set_resolution(double newval);
2936  inline int setResolution(double newval)
2937  { return this->set_resolution(newval); }
2938 
2947  double get_resolution(void);
2948 
2949  inline double resolution(void)
2950  { return this->get_resolution(); }
2951 
2962  int get_sensorState(void);
2963 
2964  inline int sensorState(void)
2965  { return this->get_sensorState(); }
2966 
2994  static YSensor* FindSensor(string func);
2995 
3007  virtual int registerValueCallback(YSensorValueCallback callback);
3009 
3010  virtual int _invokeValueCallback(string value);
3011 
3012  virtual int _parserHelper(void);
3013 
3022  virtual bool isSensorReady(void);
3023 
3031  virtual YDataLogger* get_dataLogger(void);
3032 
3040  virtual int startDataLogger(void);
3041 
3047  virtual int stopDataLogger(void);
3048 
3075  virtual YDataSet get_recordedData(s64 startTime,s64 endTime);
3076 
3088  virtual int registerTimedReportCallback(YSensorTimedReportCallback callback);
3089 
3090  virtual int _invokeTimedReportCallback(YMeasure value);
3091 
3113  virtual int calibrateFromPoints(vector<double> rawValues,vector<double> refValues);
3114 
3128  virtual int loadCalibrationPoints(vector<double>& rawValues,vector<double>& refValues);
3129 
3130  virtual string _encodeCalibrationPoints(vector<double> rawValues,vector<double> refValues);
3131 
3132  virtual double _applyCalibration(double rawValue);
3133 
3134  virtual YMeasure _decodeTimedReport(double timestamp,vector<int> report);
3135 
3136  virtual double _decodeVal(int w);
3137 
3138  virtual double _decodeAvg(int dw);
3139 
3140 
3141  inline static YSensor* Find(string func)
3142  { return YSensor::FindSensor(func); }
3143 
3151  YSensor *nextSensor(void);
3152  inline YSensor *next(void)
3153  { return this->nextSensor();}
3154 
3164  static YSensor* FirstSensor(void);
3165  inline static YSensor* First(void)
3166  { return YSensor::FirstSensor();}
3167 #ifdef __BORLANDC__
3168 #pragma option pop
3169 #endif
3170  //--- (end of generated code: YSensor accessors declaration)
3171 };
3172 
3173 //--- (generated code: YSensor functions declaration)
3174 
3202 inline YSensor* yFindSensor(const string& func)
3203 { return YSensor::FindSensor(func);}
3213 inline YSensor* yFirstSensor(void)
3214 { return YSensor::FirstSensor();}
3215 
3216 //--- (end of generated code: YSensor functions declaration)
3217 
3218 
3219 inline string yGetAPIVersion()
3220 { return YAPI::GetAPIVersion(); }
3221 
3222 
3223 
3244 inline YRETCODE yInitAPI(int mode, string& errmsg)
3245 { return YAPI::InitAPI(mode,errmsg); }
3246 
3255 inline void yFreeAPI()
3256 { YAPI::FreeAPI(); }
3257 
3264 inline void yDisableExceptions(void)
3266 
3274 inline void yEnableExceptions(void)
3276 
3285 { YAPI::RegisterLogFunction(logfun); }
3286 
3296 { YAPI::RegisterDeviceArrivalCallback(arrivalCallback); }
3297 
3307 { YAPI::RegisterDeviceRemovalCallback(removalCallback); }
3308 
3310 { YAPI::RegisterDeviceChangeCallback(removalCallback); }
3311 
3312 
3323 inline void yRegisterHubDiscoveryCallback(YHubDiscoveryCallback hubDiscoveryCallback)
3324 {
3325  YAPI::RegisterHubDiscoveryCallback(hubDiscoveryCallback);
3326 }
3327 
3337 inline YRETCODE yTriggerHubDiscovery(string& errmsg)
3338 {
3339  return YAPI::TriggerHubDiscovery(errmsg);
3340 }
3341 
3342 
3343 // Register a new value calibration handler for a given calibration type
3344 //
3345 inline void yRegisterCalibrationHandler(int calibrationType, yCalibrationHandler calibrationHandler)
3346 { YAPI::RegisterCalibrationHandler(calibrationType, calibrationHandler); }
3347 
3392 inline YRETCODE yRegisterHub(const string& url, string& errmsg)
3393 { return YAPI::RegisterHub(url,errmsg); }
3394 
3410 inline YRETCODE yPreregisterHub(const string& url, string& errmsg)
3411 { return YAPI::PreregisterHub(url,errmsg); }
3412 
3420 inline void yUnregisterHub(const string& url)
3421 { YAPI::UnregisterHub(url); }
3422 
3438 inline YRETCODE yTestHub(const string& url, int mstimeout, string& errmsg)
3439 { return YAPI::TestHub(url, mstimeout, errmsg); }
3440 
3456 inline YRETCODE yUpdateDeviceList(string& errmsg)
3457 { return YAPI::UpdateDeviceList(errmsg); }
3458 
3476 inline YRETCODE yHandleEvents(string& errmsg)
3477 { return YAPI::HandleEvents(errmsg); }
3478 
3498 inline YRETCODE ySleep(unsigned ms_duration, string& errmsg)
3499 { return YAPI::Sleep(ms_duration, errmsg); }
3500 
3508 inline u64 yGetTickCount(void)
3509 { return YAPI::GetTickCount(); }
3510 
3522 inline bool yCheckLogicalName(const string& name)
3523 { return YAPI::CheckLogicalName(name); }
3524 
3525 //--- (generated code: YModule functions declaration)
3526 
3548 inline YModule* yFindModule(const string& func)
3549 { return YModule::FindModule(func);}
3559 inline YModule* yFirstModule(void)
3560 { return YModule::FirstModule();}
3561 
3562 //--- (end of generated code: YModule functions declaration)
3563 
3564 
3565 
3578 protected:
3579  // Data preloaded on object instantiation
3581  unsigned _timeStamp;
3582  unsigned _interval;
3583 
3584 public:
3585  YOldDataStream(YDataLogger *parent, unsigned run,
3586  unsigned stamp, unsigned utc, unsigned itv);
3587 
3588  // override new version with backward-compatible code
3589  int loadStream(void);
3590 
3604  int get_startTime(void);
3605  inline int startTime(void)
3606  { return this->get_startTime(); }
3607 
3619  double get_dataSamplesInterval(void);
3620  inline double dataSamplesInterval(void)
3621  { return this->get_dataSamplesInterval(); }
3622 };
3623 
3624 //--- (generated code: YDataLogger declaration)
3634 #ifdef __BORLANDC__
3635 #pragma option push -w-8022
3636 #endif
3637 //--- (end of generated code: YDataLogger declaration)
3638  //--- (generated code: YDataLogger attributes)
3639  // Attributes (function value cache)
3647 
3648  friend YDataLogger *yFindDataLogger(const string& func);
3649  friend YDataLogger *yFirstDataLogger(void);
3650 
3651  // Function-specific method for parsing of JSON output and caching result
3652  virtual int _parseAttr(YJSONObject* json_val);
3653 
3654  // Constructor is protected, use yFindDataLogger factory function to instantiate
3655  YDataLogger(const string& func);
3656  //--- (end of generated code: YDataLogger attributes)
3657  //--- (generated code: YDataLogger initialization)
3658  //--- (end of generated code: YDataLogger initialization)
3659 
3660  // device-specific URL to access the datalogger
3662 
3663  // DataLogger-specific method to retrieve and pre-parse recorded data
3664  int getData(unsigned runIdx, unsigned timeIdx, string &buffer, yJsonStateMachine &j);
3665 
3666  // YOldDataStream loadStream() will use our method getData()
3667  friend int YOldDataStream::loadStream(void);
3668 
3669 public:
3670  ~YDataLogger();
3671 
3689  int get_dataStreams(vector<YDataStream *>& v);
3690  inline int dataStreams(vector<YDataStream *>& v)
3691  { return this->get_dataStreams(v);}
3692 
3693 
3694  //--- (generated code: YDataLogger accessors declaration)
3695 
3696  static const int CURRENTRUNINDEX_INVALID = YAPI_INVALID_UINT;
3697  static const s64 TIMEUTC_INVALID = YAPI_INVALID_LONG;
3698  static const Y_RECORDING_enum RECORDING_OFF = Y_RECORDING_OFF;
3699  static const Y_RECORDING_enum RECORDING_ON = Y_RECORDING_ON;
3700  static const Y_RECORDING_enum RECORDING_PENDING = Y_RECORDING_PENDING;
3701  static const Y_RECORDING_enum RECORDING_INVALID = Y_RECORDING_INVALID;
3702  static const Y_AUTOSTART_enum AUTOSTART_OFF = Y_AUTOSTART_OFF;
3703  static const Y_AUTOSTART_enum AUTOSTART_ON = Y_AUTOSTART_ON;
3704  static const Y_AUTOSTART_enum AUTOSTART_INVALID = Y_AUTOSTART_INVALID;
3705  static const Y_BEACONDRIVEN_enum BEACONDRIVEN_OFF = Y_BEACONDRIVEN_OFF;
3706  static const Y_BEACONDRIVEN_enum BEACONDRIVEN_ON = Y_BEACONDRIVEN_ON;
3707  static const Y_BEACONDRIVEN_enum BEACONDRIVEN_INVALID = Y_BEACONDRIVEN_INVALID;
3708  static const Y_CLEARHISTORY_enum CLEARHISTORY_FALSE = Y_CLEARHISTORY_FALSE;
3709  static const Y_CLEARHISTORY_enum CLEARHISTORY_TRUE = Y_CLEARHISTORY_TRUE;
3710  static const Y_CLEARHISTORY_enum CLEARHISTORY_INVALID = Y_CLEARHISTORY_INVALID;
3711 
3721  int get_currentRunIndex(void);
3722 
3723  inline int currentRunIndex(void)
3724  { return this->get_currentRunIndex(); }
3725 
3733  s64 get_timeUTC(void);
3734 
3735  inline s64 timeUTC(void)
3736  { return this->get_timeUTC(); }
3737 
3747  int set_timeUTC(s64 newval);
3748  inline int setTimeUTC(s64 newval)
3749  { return this->set_timeUTC(newval); }
3750 
3759  Y_RECORDING_enum get_recording(void);
3760 
3762  { return this->get_recording(); }
3763 
3774  int set_recording(Y_RECORDING_enum newval);
3775  inline int setRecording(Y_RECORDING_enum newval)
3776  { return this->set_recording(newval); }
3777 
3786  Y_AUTOSTART_enum get_autoStart(void);
3787 
3789  { return this->get_autoStart(); }
3790 
3803  int set_autoStart(Y_AUTOSTART_enum newval);
3804  inline int setAutoStart(Y_AUTOSTART_enum newval)
3805  { return this->set_autoStart(newval); }
3806 
3815  Y_BEACONDRIVEN_enum get_beaconDriven(void);
3816 
3818  { return this->get_beaconDriven(); }
3819 
3832  int set_beaconDriven(Y_BEACONDRIVEN_enum newval);
3834  { return this->set_beaconDriven(newval); }
3835 
3836  Y_CLEARHISTORY_enum get_clearHistory(void);
3837 
3839  { return this->get_clearHistory(); }
3840 
3841  int set_clearHistory(Y_CLEARHISTORY_enum newval);
3843  { return this->set_clearHistory(newval); }
3844 
3872  static YDataLogger* FindDataLogger(string func);
3873 
3885  virtual int registerValueCallback(YDataLoggerValueCallback callback);
3887 
3888  virtual int _invokeValueCallback(string value);
3889 
3898  virtual int forgetAllDataStreams(void);
3899 
3912  virtual vector<YDataSet> get_dataSets(void);
3913 
3914  virtual vector<YDataSet> parse_dataSets(string json);
3915 
3916 
3917  inline static YDataLogger* Find(string func)
3918  { return YDataLogger::FindDataLogger(func); }
3919 
3927  YDataLogger *nextDataLogger(void);
3928  inline YDataLogger *next(void)
3929  { return this->nextDataLogger();}
3930 
3940  static YDataLogger* FirstDataLogger(void);
3941  inline static YDataLogger* First(void)
3942  { return YDataLogger::FirstDataLogger();}
3943 #ifdef __BORLANDC__
3944 #pragma option pop
3945 #endif
3946  //--- (end of generated code: YDataLogger accessors declaration)
3947 };
3948 
3949 
3950 //--- (generated code: YDataLogger functions declaration)
3951 
3979 inline YDataLogger* yFindDataLogger(const string& func)
3980 { return YDataLogger::FindDataLogger(func);}
3991 { return YDataLogger::FirstDataLogger();}
3992 
3993 //--- (end of generated code: YDataLogger functions declaration)
3994 
3995 
3996 #endif
int setReportFrequency(const string &newval)
Definition: yocto_api.h:2886
string _advertisedValue
Definition: yocto_api.h:1569
static YDataLogger * Find(string func)
Definition: yocto_api.h:3917
void(* YHubDiscoveryCallback)(const string &serial, const string &url)
prototype of the Hub discoverycallback
Definition: yocto_api.h:220
static YHubDiscoveryCallback _HubDiscoveryCallback
Definition: yocto_api.h:444
string errorMessage(void)
Definition: yocto_api.h:1891
YFUN_DESCR _fundescr
Definition: yocto_api.h:1562
YFunction * fun
Definition: yocto_api.h:281
static void FreeAPI(void)
Definition: yocto_api.cpp:4262
string serialNumber(void)
Definition: yocto_api.h:2177
yCRITICAL_SECTION _this_cs
Definition: yocto_api.h:1563
YDataLoggerValueCallback _valueCallbackDataLogger
Definition: yocto_api.h:3646
int setRecording(Y_RECORDING_enum newval)
Definition: yocto_api.h:3775
int setTimeUTC(s64 newval)
Definition: yocto_api.h:3748
int setBeaconDriven(Y_BEACONDRIVEN_enum newval)
Definition: yocto_api.h:3833
bool param(const std::string &param_name, T &param_val, const T &default_val)
vector< YDataStream * > _streams
Definition: yocto_api.h:1306
static YSensor * FindSensor(string func)
Definition: yocto_api.cpp:7594
double _scale
Definition: yocto_api.h:962
static const double DATA_INVALID
Definition: yocto_api.h:983
static const double LOWESTVALUE_INVALID
Definition: yocto_api.h:2718
YRETCODE errorType
Definition: yocto_api.h:245
double _highestValue
Definition: yocto_api.h:2676
double lowestValue(void)
Definition: yocto_api.h:2782
const int Y_DETECT_ALL
Definition: yocto_api.h:207
static void RegisterHubDiscoveryCallback(YHubDiscoveryCallback hubDiscoveryCallback)
Definition: yocto_api.cpp:4365
double _currentRawValue
Definition: yocto_api.h:2677
void * yCRITICAL_SECTION
Definition: ydef.h:366
yapiGlobalEventType type
Definition: yocto_api.h:258
void yDisableExceptions(void)
Definition: yocto_api.h:3264
YModule * module
Definition: yocto_api.h:260
int _ystrpos(const string &haystack, const string &needle)
Definition: yocto_api.cpp:75
yCRITICAL_SECTION _lock
Definition: yocto_api.h:1515
string _serial
Definition: yocto_api.h:841
string _productName
Definition: yocto_api.h:1999
string yGetAPIVersion()
Definition: yocto_api.h:3219
int userVar(void)
Definition: yocto_api.h:2338
char * _subpath
Definition: yocto_api.h:1514
string errMessage(void)
Definition: yocto_api.h:1893
s32 YAPI_FUNCTION
Definition: ydef.h:217
int usbCurrent(void)
Definition: yocto_api.h:2307
void yRegisterHubDiscoveryCallback(YHubDiscoveryCallback hubDiscoveryCallback)
Definition: yocto_api.h:3323
yapiDataEventType type
Definition: yocto_api.h:278
string dataLoggerURL
Definition: yocto_api.h:3661
YRETCODE errorType(void)
Definition: yocto_api.h:1877
YRETCODE errType(void)
Definition: yocto_api.h:1879
int setHighestValue(double newval)
Definition: yocto_api.h:2796
Y_BEACONDRIVEN_enum
Definition: yocto_api.h:183
static const string ADVERTISEDVALUE_INVALID
Definition: yocto_api.h:1662
string _unit
Definition: yocto_api.h:1301
int _progress
Definition: yocto_api.h:1304
int _currentRunIndex
Definition: yocto_api.h:3640
#define YAPI_INVALID_LONG
Definition: yocto_api.h:72
Y_RECORDING_enum
Definition: yocto_api.h:166
void * userData(void)
Definition: yocto_api.h:1964
int luminosity(void)
Definition: yocto_api.h:2242
Y_BEACON_enum
Definition: yocto_api.h:101
int currentRunIndex(void)
Definition: yocto_api.h:3723
std::map< string, YDataStream * > _dataStreams
Definition: yocto_api.h:1564
int _productId
Definition: yocto_api.h:2001
static const string REPORTFREQUENCY_INVALID
Definition: yocto_api.h:2722
double _end
Definition: yocto_api.h:1199
double _maxVal
Definition: yocto_api.h:966
static void UnregisterHub(const string &url)
Definition: yocto_api.cpp:4560
vector< YFUN_DESCR > _functions
Definition: yocto_api.h:1512
static YModule * FindModule(string func)
Definition: yocto_api.cpp:5600
YRETCODE yInitAPI(int mode, string &errmsg)
Definition: yocto_api.h:3244
static const string FRIENDLYNAME_INVALID
Definition: yocto_api.h:1652
Y_CLEARHISTORY_enum clearHistory(void)
Definition: yocto_api.h:3838
double timestamp
Definition: yocto_api.h:286
static void EnableExceptions(void)
Definition: yocto_api.cpp:4298
Y_PERSISTENTSETTINGS_enum persistentSettings(void)
Definition: yocto_api.h:2226
static const string CALIBRATIONPARAM_INVALID
Definition: yocto_api.h:2728
static const string LOGFREQUENCY_INVALID
Definition: yocto_api.h:2721
static YDataLogger * First(void)
Definition: yocto_api.h:3941
static YRETCODE PreregisterHub(const string &url, string &errmsg)
Definition: yocto_api.cpp:4539
vector< double > _calraw
Definition: yocto_api.h:970
void(* yapiRequestProgressCallback)(void *context, u32 acked, u32 totalbytes)
Definition: ydef.h:866
bool _isScal32
Definition: yocto_api.h:959
static int DefaultCacheValidity
Definition: yocto_api.h:468
const int Y_DETECT_USB
Definition: yocto_api.h:204
void(* YSensorValueCallback)(YSensor *func, const string &functionValue)
Definition: yocto_api.h:123
static std::map< string, YFunction * > _cache
Definition: yocto_api.h:1585
static YFunction * First(void)
Definition: yocto_api.h:1806
double _prevTimedReport
Definition: yocto_api.h:2686
static const string HARDWAREID_INVALID
Definition: yocto_api.h:1650
void(* HTTPRequestCallback)(YDevice *device, void *context, YRETCODE returnval, const string &result, string &errmsg)
Definition: yocto_api.h:1500
double _resolution
Definition: yocto_api.h:2682
vector< double > floatArr
prototype of the value calibration handlers
Definition: yocto_api.h:225
YFunction * next(void)
Definition: yocto_api.h:1799
int _samplesPerHour
Definition: yocto_api.h:963
static YSensor * Find(string func)
Definition: yocto_api.h:3141
YAPI_Exception(YRETCODE errType, string errMsg)
Definition: yocto_api.h:246
virtual ~YJSONNumber()
Definition: yocto_api.h:392
yapiDataEventType
Definition: yocto_api.h:270
double _decexp
Definition: yocto_api.h:2690
static const string LOGICALNAME_INVALID
Definition: yocto_api.h:1661
YModule * module(void)
Definition: yocto_api.h:1939
YRETCODE yPreregisterHub(const string &url, string &errmsg)
Definition: yocto_api.h:3410
string advertisedValue(void)
Definition: yocto_api.h:1701
double _currentValue
Definition: yocto_api.h:2674
static const string FIRMWARERELEASE_INVALID
Definition: yocto_api.h:2142
double currentValue(void)
Definition: yocto_api.h:2754
u64 _cacheExpiration
Definition: yocto_api.h:1571
string _serial
Definition: yocto_api.h:1572
bool _isAvg
Definition: yocto_api.h:957
YSensor * yFirstSensor(void)
Definition: yocto_api.h:3213
string reportFrequency(void)
Definition: yocto_api.h:2869
static const string FUNCTIONID_INVALID
Definition: yocto_api.h:1651
bool _isScal32
Definition: yocto_api.h:2692
static void RegisterDeviceArrivalCallback(yDeviceUpdateCallback arrivalCallback)
Definition: yocto_api.cpp:4321
#define YAPI_INVALID_UINT
Definition: yocto_api.h:71
#define YOCTO_SERIAL_LEN
Definition: ydef.h:420
static string GetAPIVersion(void)
Definition: yocto_api.cpp:4192
vector< double > _calraw
Definition: yocto_api.h:2695
int setLowestValue(double newval)
Definition: yocto_api.h:2768
string _logicalName
Definition: yocto_api.h:1568
int setBeacon(Y_BEACON_enum newval)
Definition: yocto_api.h:2283
static YRETCODE RegisterHub(const string &url, string &errmsg)
Definition: yocto_api.cpp:4509
static yDeviceUpdateCallback DeviceRemovalCallback
Definition: yocto_api.h:481
double _decexp
Definition: yocto_api.h:967
static YRETCODE TestHub(const string &url, int mstimeout, string &errmsg)
Definition: yocto_api.cpp:4453
YDataLogger * _dataLogger
Definition: yocto_api.h:3580
static const double INVALID_DOUBLE
Definition: yocto_api.h:473
s64 _startTime
Definition: yocto_api.h:1302
int _duration
Definition: yocto_api.h:953
static queue< yapiGlobalEvent > _plug_events
Definition: yocto_api.h:442
Y_ADVMODE_enum _advMode
Definition: yocto_api.h:2680
string _data
Definition: yocto_api.h:325
#define YOCTO_PUBVAL_LEN
Definition: ydef.h:428
static void RegisterDeviceChangeCallback(yDeviceUpdateCallback changeCallback)
Definition: yocto_api.cpp:4350
int setLogicalName(const string &newval)
Definition: yocto_api.h:1689
double _minVal
Definition: yocto_api.h:964
string _serialNumber
Definition: yocto_api.h:2000
YFUN_DESCR functionDescriptor(void)
Definition: yocto_api.h:1952
YRETCODE
Definition: ydef.h:376
double _avgVal
Definition: yocto_api.h:1201
Y_BEACON_enum _beacon
Definition: yocto_api.h:2006
Y_BEACON_enum beacon(void)
Definition: yocto_api.h:2270
static void RegisterDeviceRemovalCallback(yDeviceUpdateCallback removalCallback)
Definition: yocto_api.cpp:4345
YDEV_DESCR _devdescr
Definition: yocto_api.h:1509
int sensorState(void)
Definition: yocto_api.h:2964
Y_CLEARHISTORY_enum
Definition: yocto_api.h:191
static YSensor * First(void)
Definition: yocto_api.h:3165
YModule * next(void)
Definition: yocto_api.h:2627
YRETCODE ySleep(unsigned ms_duration, string &errmsg)
Definition: yocto_api.h:3498
Y_RECORDING_enum recording(void)
Definition: yocto_api.h:3761
YAPI_FUNCTION YFUN_DESCR
Definition: yocto_api.h:230
Tjstate
Definition: yocto_api.h:306
yapiGlobalEventType
Definition: yocto_api.h:249
int dataStreams(vector< YDataStream * > &v)
Definition: yocto_api.h:3690
int setUserVar(int newval)
Definition: yocto_api.h:2353
static u64 GetTickCount(void)
Definition: yocto_api.cpp:4755
static void DisableExceptions(void)
Definition: yocto_api.cpp:4288
YFunction * _parent
Definition: yocto_api.h:948
int setAdvertisedValue(const string &newval)
Definition: yocto_api.h:1705
string _logFrequency
Definition: yocto_api.h:2678
double resolution(void)
Definition: yocto_api.h:2949
unsigned _interval
Definition: yocto_api.h:3582
string _funId
Definition: yocto_api.h:1573
void * _userData
Definition: yocto_api.h:1565
int setAutoStart(Y_AUTOSTART_enum newval)
Definition: yocto_api.h:3804
s64 timeUTC(void)
Definition: yocto_api.h:3735
string _stringValue
Definition: yocto_api.h:367
YMeasure _summary
Definition: yocto_api.h:1307
vector< YJSONContent * > _arrayValue
Definition: yocto_api.h:345
Y_AUTOSTART_enum _autoStart
Definition: yocto_api.h:3643
string firmwareRelease(void)
Definition: yocto_api.h:2213
YRETCODE yRegisterHub(const string &url, string &errmsg)
Definition: yocto_api.h:3392
string _functionId
Definition: yocto_api.h:955
double dataSamplesInterval(void)
Definition: yocto_api.h:3620
YSensor * sensor
Definition: yocto_api.h:285
static void RegisterLogFunction(yLogFunction logfun)
Definition: yocto_api.cpp:4308
YAPI_DEVICE YDEV_DESCR
Definition: yocto_api.h:229
s64 _utcStamp
Definition: yocto_api.h:950
static const string SERIALNUMBER_INVALID
Definition: yocto_api.h:2139
string _hwId
Definition: yocto_api.h:1574
vector< vector< double > > _values
Definition: yocto_api.h:972
void yRegisterDeviceRemovalCallback(yDeviceUpdateCallback removalCallback)
Definition: yocto_api.h:3306
int setResolution(double newval)
Definition: yocto_api.h:2936
Y_BEACONDRIVEN_enum beaconDriven(void)
Definition: yocto_api.h:3817
static YModule * FirstModule(void)
Definition: yocto_api.cpp:6715
vector< YMeasure > _preview
Definition: yocto_api.h:1308
vector< int > _calpar
Definition: yocto_api.h:2694
int _userVar
Definition: yocto_api.h:2010
s64 _intValue
Definition: yocto_api.h:385
static void RegisterCalibrationHandler(int calibrationType, yCalibrationHandler calibrationHandler)
Definition: yocto_api.cpp:4401
int setLuminosity(int newval)
Definition: yocto_api.h:2258
static const string PRODUCTNAME_INVALID
Definition: yocto_api.h:2138
void yFreeAPI()
Definition: yocto_api.h:3255
static YModule * Find(string func)
Definition: yocto_api.h:2616
ROSCPP_DECL bool has(const std::string &key)
void(* YFunctionValueCallback)(YFunction *func, const string &functionValue)
Definition: yocto_api.h:79
int _decimals
Definition: yocto_api.h:960
static YFunction * Find(string func)
Definition: yocto_api.h:1792
YSensor * next(void)
Definition: yocto_api.h:3152
string productName(void)
Definition: yocto_api.h:2165
s64 yatoi(const char *c)
Definition: yocto_api.cpp:4156
vector< string > _strsplit(const string &str, char delimiter)
Definition: yocto_api.cpp:85
Y_ADVMODE_enum advMode(void)
Definition: yocto_api.h:2899
YSensorTimedReportCallback _timedReportCallbackSensor
Definition: yocto_api.h:2685
string _func
Definition: yocto_api.h:1559
static yCRITICAL_SECTION _global_cs
Definition: yocto_api.h:476
static yDeviceUpdateCallback DeviceChangeCallback
Definition: yocto_api.h:482
const int Y_DETECT_NET
Definition: yocto_api.h:205
int productId(void)
Definition: yocto_api.h:2189
Y_AUTOSTART_enum
Definition: yocto_api.h:175
int setRebootCountdown(int newval)
Definition: yocto_api.h:2325
void(* YModuleValueCallback)(YModule *func, const string &functionValue)
Definition: yocto_api.h:89
void yEnableExceptions(void)
Definition: yocto_api.h:3274
static const string UNIT_INVALID
Definition: yocto_api.h:2716
string logicalName(void)
Definition: yocto_api.h:1673
static queue< yapiDataEvent > _data_events
Definition: yocto_api.h:443
void(* YDataLoggerValueCallback)(YDataLogger *func, const string &functionValue)
Definition: yocto_api.h:163
string _firmwarepath
Definition: yocto_api.h:843
static YRETCODE Sleep(unsigned ms_duration, string &errmsg)
Definition: yocto_api.cpp:4725
static YRETCODE InitAPI(int mode, string &errmsg)
Definition: yocto_api.cpp:4221
virtual int registerValueCallback(YFunctionValueCallback callback)
Definition: yocto_api.cpp:2544
static bool ExceptionsDisabled
Definition: yocto_api.h:469
YFunctionValueCallback _valueCallbackFunction
Definition: yocto_api.h:1570
Y_PERSISTENTSETTINGS_enum
Definition: yocto_api.h:92
double _offset
Definition: yocto_api.h:2688
YSensor * yFindSensor(const string &func)
Definition: yocto_api.h:3202
YRETCODE yUpdateDeviceList(string &errmsg)
Definition: yocto_api.h:3456
YDataLogger * yFirstDataLogger(void)
Definition: yocto_api.h:3990
virtual ~YJSONString()
Definition: yocto_api.h:373
double _avgVal
Definition: yocto_api.h:965
string _reportFrequency
Definition: yocto_api.h:2679
vector< int > _calpar
Definition: yocto_api.h:969
double _lowestValue
Definition: yocto_api.h:2675
string _lastErrorMsg
Definition: yocto_api.h:1561
YRETCODE _lastErrorType
Definition: yocto_api.h:1560
static YDataLogger * FirstDataLogger(void)
Definition: yocto_api.cpp:9164
static YDataLogger * FindDataLogger(string func)
Definition: yocto_api.cpp:9047
int _luminosity
Definition: yocto_api.h:2005
YJSONType
Definition: yocto_api.h:299
string calibrationParam(void)
Definition: yocto_api.h:2918
static const double CURRENTVALUE_INVALID
Definition: yocto_api.h:2717
double currentRawValue(void)
Definition: yocto_api.h:2824
vector< string > _keys
Definition: yocto_api.h:406
const int Y_RESEND_MISSING_PKT
Definition: yocto_api.h:206
time_t _stopTime_t
Definition: yocto_api.h:1207
double _minVal
Definition: yocto_api.h:1200
#define YOCTO_CLASS_EXPORT
Definition: yocto_api.h:61
Y_BEACONDRIVEN_enum _beaconDriven
Definition: yocto_api.h:3644
string _className
Definition: yocto_api.h:1558
string unit(void)
Definition: yocto_api.h:2741
string logFrequency(void)
Definition: yocto_api.h:2838
static YSensor * FirstSensor(void)
Definition: yocto_api.cpp:8295
void(* yLogFunction)(const string &msg)
prototype of the log callback
Definition: yocto_api.h:214
double _iresol
Definition: yocto_api.h:2687
static yDeviceUpdateCallback DeviceArrivalCallback
Definition: yocto_api.h:480
vector< double > _calref
Definition: yocto_api.h:971
int setLogFrequency(const string &newval)
Definition: yocto_api.h:2855
YJSONObject * _cacheJson
Definition: yocto_api.h:1511
int startTime(void)
Definition: yocto_api.h:3605
string _calibrationParam
Definition: yocto_api.h:2681
int _productRelease
Definition: yocto_api.h:2002
Y_RECORDING_enum _recording
Definition: yocto_api.h:3642
Y_ADVMODE_enum
Definition: yocto_api.h:128
vector< int > _calib
Definition: yocto_api.h:1305
bool yCheckLogicalName(const string &name)
Definition: yocto_api.h:3522
Y_AUTOSTART_enum autoStart(void)
Definition: yocto_api.h:3788
static YRETCODE HandleEvents(string &errmsg)
Definition: yocto_api.cpp:4658
void(* YSensorTimedReportCallback)(YSensor *func, YMeasure measure)
Definition: yocto_api.h:125
u64 _cacheStamp
Definition: yocto_api.h:1510
#define Y_FUNCTIONDESCRIPTOR_INVALID
Definition: yocto_api.h:231
static YModule * First(void)
Definition: yocto_api.h:2640
string _progress_msg
Definition: yocto_api.h:844
double _maxVal
Definition: yocto_api.h:1202
int setAdvMode(Y_ADVMODE_enum newval)
Definition: yocto_api.h:2913
int _sensorState
Definition: yocto_api.h:2683
int _usbCurrent
Definition: yocto_api.h:2008
yCalibrationHandler _calhdl
Definition: yocto_api.h:2697
static const double RESOLUTION_INVALID
Definition: yocto_api.h:2729
u64 yGetTickCount(void)
Definition: yocto_api.h:3508
vector< double > _calref
Definition: yocto_api.h:2696
YModule * yFirstModule(void)
Definition: yocto_api.h:3559
time_t _startTime_t
Definition: yocto_api.h:1206
string _settings
Definition: yocto_api.h:842
YDataLogger * next(void)
Definition: yocto_api.h:3928
int _caltyp
Definition: yocto_api.h:2693
YJSONType _type
Definition: yocto_api.h:329
vector< YMeasure > _measures
Definition: yocto_api.h:1309
void yUnregisterHub(const string &url)
Definition: yocto_api.h:3420
int _data_start
Definition: yocto_api.h:326
static const string INVALID_STRING
Definition: yocto_api.h:470
static vector< YDevice * > _devCache
Definition: yocto_api.h:1506
YRETCODE yTriggerHubDiscovery(string &errmsg)
Definition: yocto_api.h:3337
s64 _endTime
Definition: yocto_api.h:1303
YFunction * _parent
Definition: yocto_api.h:1298
string _firmwareRelease
Definition: yocto_api.h:2003
double _doubleValue
Definition: yocto_api.h:386
int _data_boundary
Definition: yocto_api.h:328
int productRelease(void)
Definition: yocto_api.h:2201
static bool _apiInitialized
Definition: yocto_api.h:475
YDataLogger * yFindDataLogger(const string &func)
Definition: yocto_api.h:3979
static const double CURRENTRAWVALUE_INVALID
Definition: yocto_api.h:2720
double highestValue(void)
Definition: yocto_api.h:2810
string functionValue(int functionIndex)
Definition: yocto_api.cpp:6865
int _rebootCountdown
Definition: yocto_api.h:2009
void yRegisterDeviceArrivalCallback(yDeviceUpdateCallback arrivalCallback)
Definition: yocto_api.h:3295
static const double HIGHESTVALUE_INVALID
Definition: yocto_api.h:2719
YModuleValueCallback _valueCallbackModule
Definition: yocto_api.h:2011
bool _isClosed
Definition: yocto_api.h:956
void yRegisterLogFunction(yLogFunction logfun)
Definition: yocto_api.h:3284
#define YAPI_INVALID_INT
Definition: yocto_api.h:70
yCalibrationHandler _calhdl
Definition: yocto_api.h:975
Y_PERSISTENTSETTINGS_enum _persistentSettings
Definition: yocto_api.h:2004
string _unit
Definition: yocto_api.h:2673
string _hardwareId
Definition: yocto_api.h:1299
void(* YModuleLogCallback)(YModule *module, const string &logline)
Definition: yocto_api.h:88
s32 YAPI_DEVICE
Definition: ydef.h:216
void(* yDeviceUpdateCallback)(YModule *module)
prototype of the device arrival/update/removal callback
Definition: yocto_api.h:217
static bool CheckLogicalName(const string &name)
Definition: yocto_api.cpp:4771
vector< string > _columnNames
Definition: yocto_api.h:954
int setPersistentSettings(Y_PERSISTENTSETTINGS_enum newval)
Definition: yocto_api.h:2230
static YFunction * FirstFunction(void)
Definition: yocto_api.cpp:2637
void yRegisterCalibrationHandler(int calibrationType, yCalibrationHandler calibrationHandler)
Definition: yocto_api.h:3345
map< string, YJSONContent * > _parsed
Definition: yocto_api.h:405
bool _isFloat
Definition: yocto_api.h:387
double _start
Definition: yocto_api.h:1198
YModuleLogCallback _logCallback
Definition: yocto_api.h:2012
int setClearHistory(Y_CLEARHISTORY_enum newval)
Definition: yocto_api.h:3842
double _offset
Definition: yocto_api.h:961
YModule * yFindModule(const string &func)
Definition: yocto_api.h:3548
static YRETCODE TriggerHubDiscovery(string &errmsg)
Definition: yocto_api.cpp:4381
static yLogFunction LogFunction
Definition: yocto_api.h:479
s64 upTime(void)
Definition: yocto_api.h:2295
int loadStream(void)
Definition: yocto_api.cpp:8333
void yRegisterDeviceChangeCallback(yDeviceUpdateCallback removalCallback)
Definition: yocto_api.h:3309
YRETCODE yHandleEvents(string &errmsg)
Definition: yocto_api.h:3476
int setCalibrationParam(const string &newval)
Definition: yocto_api.h:2922
bool _isScal
Definition: yocto_api.h:2691
YSensorValueCallback _valueCallbackSensor
Definition: yocto_api.h:2684
int rebootCountdown(void)
Definition: yocto_api.h:2321
double(* yCalibrationHandler)(double rawValue, int calibType, vector< int > params, vector< double > rawValues, vector< double > refValues)
Definition: yocto_api.h:227
s64 _upTime
Definition: yocto_api.h:2007
const int Y_DETECT_NONE
Definition: yocto_api.h:203
vector< int > intArr
Definition: yocto_api.h:226
Y_CLEARHISTORY_enum _clearHistory
Definition: yocto_api.h:3645
void setUserData(void *data)
Definition: yocto_api.h:1975
static u64 _nextEnum
Definition: yocto_api.h:445
YRETCODE yTestHub(const string &url, int mstimeout, string &errmsg)
Definition: yocto_api.h:3438
string _functionId
Definition: yocto_api.h:1300
unsigned _timeStamp
Definition: yocto_api.h:3581
bool _isScal
Definition: yocto_api.h:958
double _scale
Definition: yocto_api.h:2689
static YFunction * FindFunction(string func)
Definition: yocto_api.cpp:2512
static map< int, yCalibrationHandler > _calibHandlers
Definition: yocto_api.h:447
static YRETCODE UpdateDeviceList(string &errmsg)
Definition: yocto_api.cpp:4584


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