yocto_weighscale.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * $Id: yocto_weighscale.h 29661 2018-01-18 13:32:13Z mvuilleu $
4  *
5  * Declares yFindWeighScale(), the high-level API for WeighScale functions
6  *
7  * - - - - - - - - - License information: - - - - - - - - -
8  *
9  * Copyright (C) 2011 and beyond by Yoctopuce Sarl, Switzerland.
10  *
11  * Yoctopuce Sarl (hereafter Licensor) grants to you a perpetual
12  * non-exclusive license to use, modify, copy and integrate this
13  * file into your software for the sole purpose of interfacing
14  * with Yoctopuce products.
15  *
16  * You may reproduce and distribute copies of this file in
17  * source or object form, as long as the sole purpose of this
18  * code is to interface with Yoctopuce products. You must retain
19  * this notice in the distributed source file.
20  *
21  * You should refer to Yoctopuce General Terms and Conditions
22  * for additional information regarding your rights and
23  * obligations.
24  *
25  * THE SOFTWARE AND DOCUMENTATION ARE PROVIDED 'AS IS' WITHOUT
26  * WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
27  * WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, FITNESS
28  * FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO
29  * EVENT SHALL LICENSOR BE LIABLE FOR ANY INCIDENTAL, SPECIAL,
30  * INDIRECT OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA,
31  * COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR
32  * SERVICES, ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT
33  * LIMITED TO ANY DEFENSE THEREOF), ANY CLAIMS FOR INDEMNITY OR
34  * CONTRIBUTION, OR OTHER SIMILAR COSTS, WHETHER ASSERTED ON THE
35  * BASIS OF CONTRACT, TORT (INCLUDING NEGLIGENCE), BREACH OF
36  * WARRANTY, OR OTHERWISE.
37  *
38  *********************************************************************/
39 
40 
41 #ifndef YOCTO_WEIGHSCALE_H
42 #define YOCTO_WEIGHSCALE_H
43 
44 #include "yocto_api.h"
45 #include <cfloat>
46 #include <cmath>
47 #include <map>
48 
49 //--- (YWeighScale return codes)
50 //--- (end of YWeighScale return codes)
51 //--- (YWeighScale definitions)
52 class YWeighScale; // forward declaration
53 
54 typedef void (*YWeighScaleValueCallback)(YWeighScale *func, const string& functionValue);
55 class YMeasure; // forward declaration
56 typedef void (*YWeighScaleTimedReportCallback)(YWeighScale *func, YMeasure measure);
57 #ifndef _Y_EXCITATION_ENUM
58 #define _Y_EXCITATION_ENUM
59 typedef enum {
65 #endif
66 #define Y_COMPTEMPADAPTRATIO_INVALID (YAPI_INVALID_DOUBLE)
67 #define Y_COMPTEMPAVG_INVALID (YAPI_INVALID_DOUBLE)
68 #define Y_COMPTEMPCHG_INVALID (YAPI_INVALID_DOUBLE)
69 #define Y_COMPENSATION_INVALID (YAPI_INVALID_DOUBLE)
70 #define Y_ZEROTRACKING_INVALID (YAPI_INVALID_DOUBLE)
71 #define Y_COMMAND_INVALID (YAPI_INVALID_STRING)
72 //--- (end of YWeighScale definitions)
73 
74 //--- (YWeighScale declaration)
85 #ifdef __BORLANDC__
86 #pragma option push -w-8022
87 #endif
88 //--- (end of YWeighScale declaration)
89 protected:
90  //--- (YWeighScale attributes)
91  // Attributes (function value cache)
94  double _compTempAvg;
95  double _compTempChg;
96  double _compensation;
97  double _zeroTracking;
98  string _command;
101 
102  friend YWeighScale *yFindWeighScale(const string& func);
103  friend YWeighScale *yFirstWeighScale(void);
104 
105  // Function-specific method for parsing of JSON output and caching result
106  virtual int _parseAttr(YJSONObject* json_val);
107 
108  // Constructor is protected, use yFindWeighScale factory function to instantiate
109  YWeighScale(const string& func);
110  //--- (end of YWeighScale attributes)
111 
112 public:
113  ~YWeighScale();
114  //--- (YWeighScale accessors declaration)
115 
116  static const Y_EXCITATION_enum EXCITATION_OFF = Y_EXCITATION_OFF;
117  static const Y_EXCITATION_enum EXCITATION_DC = Y_EXCITATION_DC;
118  static const Y_EXCITATION_enum EXCITATION_AC = Y_EXCITATION_AC;
119  static const Y_EXCITATION_enum EXCITATION_INVALID = Y_EXCITATION_INVALID;
120  static const double COMPTEMPADAPTRATIO_INVALID;
121  static const double COMPTEMPAVG_INVALID;
122  static const double COMPTEMPCHG_INVALID;
123  static const double COMPENSATION_INVALID;
124  static const double ZEROTRACKING_INVALID;
125  static const string COMMAND_INVALID;
126 
138  int set_unit(const string& newval);
139  inline int setUnit(const string& newval)
140  { return this->set_unit(newval); }
141 
150  Y_EXCITATION_enum get_excitation(void);
151 
153  { return this->get_excitation(); }
154 
165  int set_excitation(Y_EXCITATION_enum newval);
166  inline int setExcitation(Y_EXCITATION_enum newval)
167  { return this->set_excitation(newval); }
168 
181  int set_compTempAdaptRatio(double newval);
182  inline int setCompTempAdaptRatio(double newval)
183  { return this->set_compTempAdaptRatio(newval); }
184 
195  double get_compTempAdaptRatio(void);
196 
197  inline double compTempAdaptRatio(void)
198  { return this->get_compTempAdaptRatio(); }
199 
207  double get_compTempAvg(void);
208 
209  inline double compTempAvg(void)
210  { return this->get_compTempAvg(); }
211 
220  double get_compTempChg(void);
221 
222  inline double compTempChg(void)
223  { return this->get_compTempChg(); }
224 
232  double get_compensation(void);
233 
234  inline double compensation(void)
235  { return this->get_compensation(); }
236 
246  int set_zeroTracking(double newval);
247  inline int setZeroTracking(double newval)
248  { return this->set_zeroTracking(newval); }
249 
259  double get_zeroTracking(void);
260 
261  inline double zeroTracking(void)
262  { return this->get_zeroTracking(); }
263 
264  string get_command(void);
265 
266  inline string command(void)
267  { return this->get_command(); }
268 
269  int set_command(const string& newval);
270  inline int setCommand(const string& newval)
271  { return this->set_command(newval); }
272 
300  static YWeighScale* FindWeighScale(string func);
301 
313  virtual int registerValueCallback(YWeighScaleValueCallback callback);
315 
316  virtual int _invokeValueCallback(string value);
317 
331 
332  virtual int _invokeTimedReportCallback(YMeasure value);
333 
342  virtual int tare(void);
343 
355  virtual int setupSpan(double currWeight,double maxWeight);
356 
357  virtual int setCompensationTable(int tableIndex,vector<double> tempValues,vector<double> compValues);
358 
359  virtual int loadCompensationTable(int tableIndex,vector<double>& tempValues,vector<double>& compValues);
360 
376  virtual int set_offsetAvgCompensationTable(vector<double> tempValues,vector<double> compValues);
377 
393  virtual int loadOffsetAvgCompensationTable(vector<double>& tempValues,vector<double>& compValues);
394 
410  virtual int set_offsetChgCompensationTable(vector<double> tempValues,vector<double> compValues);
411 
427  virtual int loadOffsetChgCompensationTable(vector<double>& tempValues,vector<double>& compValues);
428 
444  virtual int set_spanAvgCompensationTable(vector<double> tempValues,vector<double> compValues);
445 
461  virtual int loadSpanAvgCompensationTable(vector<double>& tempValues,vector<double>& compValues);
462 
478  virtual int set_spanChgCompensationTable(vector<double> tempValues,vector<double> compValues);
479 
495  virtual int loadSpanChgCompensationTable(vector<double>& tempValues,vector<double>& compValues);
496 
497 
498  inline static YWeighScale* Find(string func)
499  { return YWeighScale::FindWeighScale(func); }
500 
508  YWeighScale *nextWeighScale(void);
509  inline YWeighScale *next(void)
510  { return this->nextWeighScale();}
511 
521  static YWeighScale* FirstWeighScale(void);
522  inline static YWeighScale* First(void)
523  { return YWeighScale::FirstWeighScale();}
524 #ifdef __BORLANDC__
525 #pragma option pop
526 #endif
527  //--- (end of YWeighScale accessors declaration)
528 };
529 
530 //--- (YWeighScale functions declaration)
531 
559 inline YWeighScale* yFindWeighScale(const string& func)
560 { return YWeighScale::FindWeighScale(func);}
571 { return YWeighScale::FirstWeighScale();}
572 
573 //--- (end of YWeighScale functions declaration)
574 
575 #endif
YWeighScaleValueCallback _valueCallbackWeighScale
void(* YWeighScaleTimedReportCallback)(YWeighScale *func, YMeasure measure)
double compensation(void)
Y_EXCITATION_enum
static const double COMPTEMPADAPTRATIO_INVALID
YWeighScaleTimedReportCallback _timedReportCallbackWeighScale
static const string COMMAND_INVALID
Y_EXCITATION_enum excitation(void)
YWeighScale * next(void)
double compTempAvg(void)
string command(void)
static YWeighScale * First(void)
static const double ZEROTRACKING_INVALID
static const double COMPTEMPCHG_INVALID
double _compTempAvg
int setUnit(const string &newval)
static YWeighScale * FindWeighScale(string func)
double _compensation
static YWeighScale * Find(string func)
static YWeighScale * FirstWeighScale(void)
virtual int registerTimedReportCallback(YSensorTimedReportCallback callback)
Definition: yocto_api.cpp:7923
virtual int _invokeTimedReportCallback(YMeasure value)
Definition: yocto_api.cpp:7936
YWeighScale * yFirstWeighScale(void)
virtual int _invokeValueCallback(string value)
Definition: yocto_api.cpp:7645
static const double COMPENSATION_INVALID
double _compTempAdaptRatio
double compTempAdaptRatio(void)
virtual int _parseAttr(YJSONObject *json_val)
Definition: yocto_api.cpp:7015
void(* YWeighScaleValueCallback)(YWeighScale *func, const string &functionValue)
virtual int registerValueCallback(YSensorValueCallback callback)
Definition: yocto_api.cpp:7626
#define YOCTO_CLASS_EXPORT
Definition: yocto_api.h:61
double _zeroTracking
YWeighScale * yFindWeighScale(const string &func)
static const double COMPTEMPAVG_INVALID
Y_EXCITATION_enum _excitation
int setCommand(const string &newval)
int setCompTempAdaptRatio(double newval)
int setZeroTracking(double newval)
double _compTempChg
double compTempChg(void)
int setExcitation(Y_EXCITATION_enum newval)
double zeroTracking(void)


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