yocto_colorled.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * $Id: yocto_colorled.h 28748 2017-10-03 08:23:39Z seb $
4  *
5  * Declares yFindColorLed(), the high-level API for ColorLed 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_COLORLED_H
42 #define YOCTO_COLORLED_H
43 
44 #include "yocto_api.h"
45 #include <cfloat>
46 #include <cmath>
47 #include <map>
48 
49 //--- (YColorLed return codes)
50 //--- (end of YColorLed return codes)
51 //--- (YColorLed definitions)
52 class YColorLed; // forward declaration
53 
54 typedef void (*YColorLedValueCallback)(YColorLed *func, const string& functionValue);
55 #ifndef _CLASS_YMOVE
56 #define _CLASS_YMOVE
58 public:
59  int target;
60  int ms;
61  int moving;
62 
65  {}
66 
67  bool operator==(const YMove& o) const {
68  return (target == o.target) && (ms == o.ms) && (moving == o.moving);
69  }
70 };
71 #endif
72 #define Y_RGBCOLOR_INVALID (YAPI_INVALID_UINT)
73 #define Y_HSLCOLOR_INVALID (YAPI_INVALID_UINT)
74 #define Y_RGBCOLORATPOWERON_INVALID (YAPI_INVALID_UINT)
75 #define Y_BLINKSEQSIZE_INVALID (YAPI_INVALID_UINT)
76 #define Y_BLINKSEQMAXSIZE_INVALID (YAPI_INVALID_UINT)
77 #define Y_BLINKSEQSIGNATURE_INVALID (YAPI_INVALID_UINT)
78 #define Y_COMMAND_INVALID (YAPI_INVALID_STRING)
79 //--- (end of YColorLed definitions)
80 
81 //--- (YColorLed declaration)
93 #ifdef __BORLANDC__
94 #pragma option push -w-8022
95 #endif
96 //--- (end of YColorLed declaration)
97 protected:
98  //--- (YColorLed attributes)
99  // Attributes (function value cache)
108  string _command;
110 
111  friend YColorLed *yFindColorLed(const string& func);
112  friend YColorLed *yFirstColorLed(void);
113 
114  // Function-specific method for parsing of JSON output and caching result
115  virtual int _parseAttr(YJSONObject* json_val);
116 
117  // Constructor is protected, use yFindColorLed factory function to instantiate
118  YColorLed(const string& func);
119  //--- (end of YColorLed attributes)
120 
121 public:
122  ~YColorLed();
123  //--- (YColorLed accessors declaration)
124 
125  static const int RGBCOLOR_INVALID = YAPI_INVALID_UINT;
126  static const int HSLCOLOR_INVALID = YAPI_INVALID_UINT;
127  static const YMove RGBMOVE_INVALID;
128  static const YMove HSLMOVE_INVALID;
129  static const int RGBCOLORATPOWERON_INVALID = YAPI_INVALID_UINT;
130  static const int BLINKSEQSIZE_INVALID = YAPI_INVALID_UINT;
131  static const int BLINKSEQMAXSIZE_INVALID = YAPI_INVALID_UINT;
132  static const int BLINKSEQSIGNATURE_INVALID = YAPI_INVALID_UINT;
133  static const string COMMAND_INVALID;
134 
142  int get_rgbColor(void);
143 
144  inline int rgbColor(void)
145  { return this->get_rgbColor(); }
146 
156  int set_rgbColor(int newval);
157  inline int setRgbColor(int newval)
158  { return this->set_rgbColor(newval); }
159 
167  int get_hslColor(void);
168 
169  inline int hslColor(void)
170  { return this->get_hslColor(); }
171 
181  int set_hslColor(int newval);
182  inline int setHslColor(int newval)
183  { return this->set_hslColor(newval); }
184 
185  YMove get_rgbMove(void);
186 
187  inline YMove rgbMove(void)
188  { return this->get_rgbMove(); }
189 
190  int set_rgbMove(YMove newval);
191  inline int setRgbMove(YMove newval)
192  { return this->set_rgbMove(newval); }
193 
204  int rgbMove(int rgb_target,int ms_duration);
205 
206  YMove get_hslMove(void);
207 
208  inline YMove hslMove(void)
209  { return this->get_hslMove(); }
210 
211  int set_hslMove(YMove newval);
212  inline int setHslMove(YMove newval)
213  { return this->set_hslMove(newval); }
214 
225  int hslMove(int hsl_target,int ms_duration);
226 
234  int get_rgbColorAtPowerOn(void);
235 
236  inline int rgbColorAtPowerOn(void)
237  { return this->get_rgbColorAtPowerOn(); }
238 
249  int set_rgbColorAtPowerOn(int newval);
250  inline int setRgbColorAtPowerOn(int newval)
251  { return this->set_rgbColorAtPowerOn(newval); }
252 
260  int get_blinkSeqSize(void);
261 
262  inline int blinkSeqSize(void)
263  { return this->get_blinkSeqSize(); }
264 
272  int get_blinkSeqMaxSize(void);
273 
274  inline int blinkSeqMaxSize(void)
275  { return this->get_blinkSeqMaxSize(); }
276 
287  int get_blinkSeqSignature(void);
288 
289  inline int blinkSeqSignature(void)
290  { return this->get_blinkSeqSignature(); }
291 
292  string get_command(void);
293 
294  inline string command(void)
295  { return this->get_command(); }
296 
297  int set_command(const string& newval);
298  inline int setCommand(const string& newval)
299  { return this->set_command(newval); }
300 
328  static YColorLed* FindColorLed(string func);
329 
341  virtual int registerValueCallback(YColorLedValueCallback callback);
343 
344  virtual int _invokeValueCallback(string value);
345 
346  virtual int sendCommand(string command);
347 
358  virtual int addHslMoveToBlinkSeq(int HSLcolor,int msDelay);
359 
370  virtual int addRgbMoveToBlinkSeq(int RGBcolor,int msDelay);
371 
380  virtual int startBlinkSeq(void);
381 
388  virtual int stopBlinkSeq(void);
389 
396  virtual int resetBlinkSeq(void);
397 
398 
399  inline static YColorLed* Find(string func)
400  { return YColorLed::FindColorLed(func); }
401 
409  YColorLed *nextColorLed(void);
410  inline YColorLed *next(void)
411  { return this->nextColorLed();}
412 
422  static YColorLed* FirstColorLed(void);
423  inline static YColorLed* First(void)
424  { return YColorLed::FirstColorLed();}
425 #ifdef __BORLANDC__
426 #pragma option pop
427 #endif
428  //--- (end of YColorLed accessors declaration)
429 };
430 
431 //--- (YColorLed functions declaration)
432 
460 inline YColorLed* yFindColorLed(const string& func)
461 { return YColorLed::FindColorLed(func);}
472 { return YColorLed::FirstColorLed();}
473 
474 //--- (end of YColorLed functions declaration)
475 
476 #endif
int setRgbColor(int newval)
YMove _hslMove
int setHslMove(YMove newval)
static const YMove HSLMOVE_INVALID
YColorLedValueCallback _valueCallbackColorLed
string command(void)
int setRgbColorAtPowerOn(int newval)
YColorLed * next(void)
int target
#define YAPI_INVALID_UINT
Definition: yocto_api.h:71
int rgbColorAtPowerOn(void)
int moving
YColorLed * yFirstColorLed(void)
static YColorLed * First(void)
static const YMove RGBMOVE_INVALID
virtual int _parseAttr(YJSONObject *json_val)
Definition: yocto_api.cpp:2367
int hslColor(void)
ROSLIB_DECL std::string command(const std::string &cmd)
int blinkSeqSize(void)
YMove hslMove(void)
int _blinkSeqSignature
int setCommand(const string &newval)
int _blinkSeqMaxSize
int blinkSeqMaxSize(void)
static YColorLed * FirstColorLed(void)
static YColorLed * Find(string func)
YMove rgbMove(void)
virtual int registerValueCallback(YFunctionValueCallback callback)
Definition: yocto_api.cpp:2544
YColorLed * yFindColorLed(const string &func)
static YColorLed * FindColorLed(string func)
#define YOCTO_CLASS_EXPORT
Definition: yocto_api.h:61
string _command
int blinkSeqSignature(void)
YMove _rgbMove
int setRgbMove(YMove newval)
#define YAPI_INVALID_INT
Definition: yocto_api.h:70
bool operator==(const YMove &o) const
int rgbColor(void)
int setHslColor(int newval)
static const string COMMAND_INVALID
void(* YColorLedValueCallback)(YColorLed *func, const string &functionValue)
virtual int _invokeValueCallback(string value)
Definition: yocto_api.cpp:2563
int _rgbColorAtPowerOn


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