yocto_temperature.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * $Id: yocto_temperature.h 28748 2017-10-03 08:23:39Z seb $
4  *
5  * Declares yFindTemperature(), the high-level API for Temperature 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_TEMPERATURE_H
42 #define YOCTO_TEMPERATURE_H
43 
44 #include "yocto_api.h"
45 #include <cfloat>
46 #include <cmath>
47 #include <map>
48 
49 //--- (YTemperature return codes)
50 //--- (end of YTemperature return codes)
51 //--- (YTemperature definitions)
52 class YTemperature; // forward declaration
53 
54 typedef void (*YTemperatureValueCallback)(YTemperature *func, const string& functionValue);
55 class YMeasure; // forward declaration
56 typedef void (*YTemperatureTimedReportCallback)(YTemperature *func, YMeasure measure);
57 #ifndef _Y_SENSORTYPE_ENUM
58 #define _Y_SENSORTYPE_ENUM
59 typedef enum {
77 #endif
78 #define Y_SIGNALVALUE_INVALID (YAPI_INVALID_DOUBLE)
79 #define Y_SIGNALUNIT_INVALID (YAPI_INVALID_STRING)
80 #define Y_COMMAND_INVALID (YAPI_INVALID_STRING)
81 //--- (end of YTemperature definitions)
82 
83 //--- (YTemperature declaration)
94 #ifdef __BORLANDC__
95 #pragma option push -w-8022
96 #endif
97 //--- (end of YTemperature declaration)
98 protected:
99  //--- (YTemperature attributes)
100  // Attributes (function value cache)
102  double _signalValue;
103  string _signalUnit;
104  string _command;
107 
108  friend YTemperature *yFindTemperature(const string& func);
109  friend YTemperature *yFirstTemperature(void);
110 
111  // Function-specific method for parsing of JSON output and caching result
112  virtual int _parseAttr(YJSONObject* json_val);
113 
114  // Constructor is protected, use yFindTemperature factory function to instantiate
115  YTemperature(const string& func);
116  //--- (end of YTemperature attributes)
117 
118 public:
119  ~YTemperature();
120  //--- (YTemperature accessors declaration)
121 
122  static const Y_SENSORTYPE_enum SENSORTYPE_DIGITAL = Y_SENSORTYPE_DIGITAL;
123  static const Y_SENSORTYPE_enum SENSORTYPE_TYPE_K = Y_SENSORTYPE_TYPE_K;
124  static const Y_SENSORTYPE_enum SENSORTYPE_TYPE_E = Y_SENSORTYPE_TYPE_E;
125  static const Y_SENSORTYPE_enum SENSORTYPE_TYPE_J = Y_SENSORTYPE_TYPE_J;
126  static const Y_SENSORTYPE_enum SENSORTYPE_TYPE_N = Y_SENSORTYPE_TYPE_N;
127  static const Y_SENSORTYPE_enum SENSORTYPE_TYPE_R = Y_SENSORTYPE_TYPE_R;
128  static const Y_SENSORTYPE_enum SENSORTYPE_TYPE_S = Y_SENSORTYPE_TYPE_S;
129  static const Y_SENSORTYPE_enum SENSORTYPE_TYPE_T = Y_SENSORTYPE_TYPE_T;
130  static const Y_SENSORTYPE_enum SENSORTYPE_PT100_4WIRES = Y_SENSORTYPE_PT100_4WIRES;
131  static const Y_SENSORTYPE_enum SENSORTYPE_PT100_3WIRES = Y_SENSORTYPE_PT100_3WIRES;
132  static const Y_SENSORTYPE_enum SENSORTYPE_PT100_2WIRES = Y_SENSORTYPE_PT100_2WIRES;
133  static const Y_SENSORTYPE_enum SENSORTYPE_RES_OHM = Y_SENSORTYPE_RES_OHM;
134  static const Y_SENSORTYPE_enum SENSORTYPE_RES_NTC = Y_SENSORTYPE_RES_NTC;
135  static const Y_SENSORTYPE_enum SENSORTYPE_RES_LINEAR = Y_SENSORTYPE_RES_LINEAR;
136  static const Y_SENSORTYPE_enum SENSORTYPE_RES_INTERNAL = Y_SENSORTYPE_RES_INTERNAL;
137  static const Y_SENSORTYPE_enum SENSORTYPE_INVALID = Y_SENSORTYPE_INVALID;
138  static const double SIGNALVALUE_INVALID;
139  static const string SIGNALUNIT_INVALID;
140  static const string COMMAND_INVALID;
141 
159  int set_unit(const string& newval);
160  inline int setUnit(const string& newval)
161  { return this->set_unit(newval); }
162 
174  Y_SENSORTYPE_enum get_sensorType(void);
175 
177  { return this->get_sensorType(); }
178 
196  int set_sensorType(Y_SENSORTYPE_enum newval);
197  inline int setSensorType(Y_SENSORTYPE_enum newval)
198  { return this->set_sensorType(newval); }
199 
208  double get_signalValue(void);
209 
210  inline double signalValue(void)
211  { return this->get_signalValue(); }
212 
220  string get_signalUnit(void);
221 
222  inline string signalUnit(void)
223  { return this->get_signalUnit(); }
224 
225  string get_command(void);
226 
227  inline string command(void)
228  { return this->get_command(); }
229 
230  int set_command(const string& newval);
231  inline int setCommand(const string& newval)
232  { return this->set_command(newval); }
233 
261  static YTemperature* FindTemperature(string func);
262 
274  virtual int registerValueCallback(YTemperatureValueCallback callback);
276 
277  virtual int _invokeValueCallback(string value);
278 
292 
293  virtual int _invokeTimedReportCallback(YMeasure value);
294 
308  virtual int set_ntcParameters(double res25,double beta);
309 
326  virtual int set_thermistorResponseTable(vector<double> tempValues,vector<double> resValues);
327 
344  virtual int loadThermistorResponseTable(vector<double>& tempValues,vector<double>& resValues);
345 
346 
347  inline static YTemperature* Find(string func)
348  { return YTemperature::FindTemperature(func); }
349 
357  YTemperature *nextTemperature(void);
358  inline YTemperature *next(void)
359  { return this->nextTemperature();}
360 
370  static YTemperature* FirstTemperature(void);
371  inline static YTemperature* First(void)
372  { return YTemperature::FirstTemperature();}
373 #ifdef __BORLANDC__
374 #pragma option pop
375 #endif
376  //--- (end of YTemperature accessors declaration)
377 };
378 
379 //--- (YTemperature functions declaration)
380 
408 inline YTemperature* yFindTemperature(const string& func)
409 { return YTemperature::FindTemperature(func);}
421 
422 //--- (end of YTemperature functions declaration)
423 
424 #endif
YTemperature * next(void)
string signalUnit(void)
int setCommand(const string &newval)
Y_SENSORTYPE_enum
YTemperature * yFindTemperature(const string &func)
int setUnit(const string &newval)
YTemperatureTimedReportCallback _timedReportCallbackTemperature
virtual int registerTimedReportCallback(YSensorTimedReportCallback callback)
Definition: yocto_api.cpp:7923
Y_SENSORTYPE_enum sensorType(void)
YTemperatureValueCallback _valueCallbackTemperature
virtual int _invokeTimedReportCallback(YMeasure value)
Definition: yocto_api.cpp:7936
int setSensorType(Y_SENSORTYPE_enum newval)
virtual int _invokeValueCallback(string value)
Definition: yocto_api.cpp:7645
static const double SIGNALVALUE_INVALID
static YTemperature * FindTemperature(string func)
void(* YTemperatureValueCallback)(YTemperature *func, const string &functionValue)
Y_SENSORTYPE_enum _sensorType
virtual int _parseAttr(YJSONObject *json_val)
Definition: yocto_api.cpp:7015
virtual int registerValueCallback(YSensorValueCallback callback)
Definition: yocto_api.cpp:7626
YTemperature * yFirstTemperature(void)
static YTemperature * First(void)
#define YOCTO_CLASS_EXPORT
Definition: yocto_api.h:61
static const string SIGNALUNIT_INVALID
string command(void)
static YTemperature * FirstTemperature(void)
double signalValue(void)
void(* YTemperatureTimedReportCallback)(YTemperature *func, YMeasure measure)
static const string COMMAND_INVALID
static YTemperature * Find(string func)


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