Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
YColorLedCluster Class Reference

#include <yocto_colorledcluster.h>

Inheritance diagram for YColorLedCluster:
Inheritance graph
[legend]

Public Member Functions

virtual int _invokeValueCallback (string value)
 
int activeLedCount (void)
 
virtual int addHslMoveToBlinkSeq (int seqIndex, int hslValue, int delay)
 
virtual int addJumpToBlinkSeq (int seqIndex, int linkSeqIndex)
 
virtual int addMirrorToBlinkSeq (int seqIndex)
 
virtual int addRgbMoveToBlinkSeq (int seqIndex, int rgbValue, int delay)
 
virtual int addUnlinkToBlinkSeq (int seqIndex)
 
int blinkSeqMaxCount (void)
 
int blinkSeqMaxSize (void)
 
string command (void)
 
int get_activeLedCount (void)
 
int get_blinkSeqMaxCount (void)
 
int get_blinkSeqMaxSize (void)
 
virtual vector< int > get_blinkSeqSignatures (int seqIndex, int count)
 
virtual vector< int > get_blinkSeqState (int seqIndex, int count)
 
virtual vector< int > get_blinkSeqStateAtPowerOn (int seqIndex, int count)
 
virtual vector< int > get_blinkSeqStateSpeed (int seqIndex, int count)
 
string get_command (void)
 
virtual vector< int > get_linkedSeqArray (int ledIndex, int count)
 
int get_maxLedCount (void)
 
virtual vector< int > get_rgbColorArray (int ledIndex, int count)
 
virtual vector< int > get_rgbColorArrayAtPowerOn (int ledIndex, int count)
 
virtual string get_rgbColorBuffer (int ledIndex, int count)
 
virtual int hsl_move (int ledIndex, int count, int hslValue, int delay)
 
virtual int hslArray_move (vector< int > hslList, int delay)
 
virtual int hslArrayOfs_move (int ledIndex, vector< int > hslList, int delay)
 
virtual int linkLedToBlinkSeq (int ledIndex, int count, int seqIndex, int offset)
 
virtual int linkLedToBlinkSeqAtPowerOn (int ledIndex, int count, int seqIndex, int offset)
 
virtual int linkLedToPeriodicBlinkSeq (int ledIndex, int count, int seqIndex, int periods)
 
int maxLedCount (void)
 
YColorLedClusternext (void)
 
YColorLedClusternextColorLedCluster (void)
 
virtual int registerValueCallback (YColorLedClusterValueCallback callback)
 
virtual int resetBlinkSeq (int seqIndex)
 
virtual int rgb_move (int ledIndex, int count, int rgbValue, int delay)
 
virtual int rgbArray_move (vector< int > rgbList, int delay)
 
virtual int rgbArrayOfs_move (int ledIndex, vector< int > rgbList, int delay)
 
virtual int saveBlinkSeq (int seqIndex)
 
virtual int saveLedsConfigAtPowerOn (void)
 
virtual int saveLedsState (void)
 
virtual int sendCommand (string command)
 
int set_activeLedCount (int newval)
 
virtual int set_blinkSeqSpeed (int seqIndex, int speed)
 
virtual int set_blinkSeqStateAtPowerOn (int seqIndex, int autostart)
 
int set_command (const string &newval)
 
virtual int set_hslColor (int ledIndex, int count, int hslValue)
 
virtual int set_hslColorArray (int ledIndex, vector< int > hslList)
 
virtual int set_hslColorBuffer (int ledIndex, string buff)
 
virtual int set_rgbColor (int ledIndex, int count, int rgbValue)
 
virtual int set_rgbColorArray (int ledIndex, vector< int > rgbList)
 
virtual int set_rgbColorAtPowerOn (int ledIndex, int count, int rgbValue)
 
virtual int set_rgbColorBuffer (int ledIndex, string buff)
 
int setActiveLedCount (int newval)
 
int setCommand (const string &newval)
 
virtual int startBlinkSeq (int seqIndex)
 
virtual int stopBlinkSeq (int seqIndex)
 
virtual int unlinkLedFromBlinkSeq (int ledIndex, int count)
 
 ~YColorLedCluster ()
 
- Public Member Functions inherited from YFunction
void _clearDataStreamCache ()
 
string _decode_json_string (const string &json)
 
string _download (const string &url)
 
YDataStream_findDataStream (YDataSet &dataset, const string &def)
 
string _get_json_path (const string &json, const string &path)
 
vector< string > _json_get_array (const string &json)
 
string _json_get_key (const string &json, const string &data)
 
string _json_get_string (const string &json)
 
int _parseEx (yJsonStateMachine &j)
 
virtual int _parserHelper (void)
 
string _parseString (yJsonStateMachine &j)
 
string _request (const string &request)
 
string _requestEx (int tcpchan, const string &request, yapiRequestProgressCallback callback, void *context)
 
void _throw (YRETCODE errType, string errMsg)
 
YRETCODE _upload (const string &path, const string &content)
 
YRETCODE _uploadWithProgress (const string &path, const string &content, yapiRequestProgressCallback callback, void *context)
 
string advertisedValue (void)
 
void clearCache ()
 
string describe (void)
 
string errMessage (void)
 
string errorMessage (void)
 
YRETCODE errorType (void)
 
YRETCODE errType (void)
 
YFUN_DESCR functionDescriptor (void)
 
string get_advertisedValue (void)
 
string get_errorMessage (void)
 
YRETCODE get_errorType (void)
 
virtual string get_friendlyName (void)
 
YFUN_DESCR get_functionDescriptor (void)
 
string get_functionId (void)
 
string get_hardwareId (void)
 
string get_hubSerial ()
 
string get_logicalName (void)
 
YModuleget_module (void)
 
void * get_userData (void)
 
bool isOnline (void)
 
YRETCODE load (int msValidity)
 
virtual string loadAttribute (string attrName)
 
string logicalName (void)
 
YModulemodule (void)
 
virtual int muteValueCallbacks (void)
 
YFunctionnext (void)
 
YFunctionnextFunction (void)
 
virtual int registerValueCallback (YFunctionValueCallback callback)
 
int set_advertisedValue (const string &newval)
 
int set_logicalName (const string &newval)
 
void set_userData (void *data)
 
int setAdvertisedValue (const string &newval)
 
int setLogicalName (const string &newval)
 
void setUserData (void *data)
 
virtual int unmuteValueCallbacks (void)
 
void * userData (void)
 
virtual ~YFunction ()
 

Static Public Member Functions

static YColorLedClusterFind (string func)
 
static YColorLedClusterFindColorLedCluster (string func)
 
static YColorLedClusterFirst (void)
 
static YColorLedClusterFirstColorLedCluster (void)
 
- Static Public Member Functions inherited from YFunction
static void _ClearCache (void)
 
static YFunctionFind (string func)
 
static YFunctionFindFunction (string func)
 
static YFunctionFirst (void)
 
static YFunctionFirstFunction (void)
 

Static Public Attributes

static const int ACTIVELEDCOUNT_INVALID = YAPI_INVALID_UINT
 
static const int BLINKSEQMAXCOUNT_INVALID = YAPI_INVALID_UINT
 
static const int BLINKSEQMAXSIZE_INVALID = YAPI_INVALID_UINT
 
static const string COMMAND_INVALID = YAPI_INVALID_STRING
 
static const int MAXLEDCOUNT_INVALID = YAPI_INVALID_UINT
 
- Static Public Attributes inherited from YFunction
static const string ADVERTISEDVALUE_INVALID = YAPI_INVALID_STRING
 
static const string FRIENDLYNAME_INVALID = YAPI_INVALID_STRING
 
static const YFUN_DESCR FUNCTIONDESCRIPTOR_INVALID = Y_FUNCTIONDESCRIPTOR_INVALID
 
static const string FUNCTIONID_INVALID = YAPI_INVALID_STRING
 
static const string HARDWAREID_INVALID = YAPI_INVALID_STRING
 
static const string LOGICALNAME_INVALID = YAPI_INVALID_STRING
 

Protected Member Functions

virtual int _parseAttr (YJSONObject *json_val)
 
 YColorLedCluster (const string &func)
 
- Protected Member Functions inherited from YFunction
YRETCODE _buildSetRequest (const string &changeattr, const string *changeval, string &request, string &errmsg)
 
string _escapeAttr (const string &changeval)
 
YRETCODE _getDescriptor (YFUN_DESCR &fundescr, string &errMsg)
 
YRETCODE _getDevice (YDevice *&dev, string &errMsg)
 
YRETCODE _load_unsafe (int msValidity)
 
YRETCODE _nextFunction (string &hwId)
 
int _parse (YJSONObject *j)
 
YRETCODE _setAttr (string attrname, string newvalue)
 
 YFunction (const string &func)
 

Protected Attributes

int _activeLedCount
 
int _blinkSeqMaxCount
 
int _blinkSeqMaxSize
 
string _command
 
int _maxLedCount
 
YColorLedClusterValueCallback _valueCallbackColorLedCluster
 
- Protected Attributes inherited from YFunction
string _advertisedValue
 
u64 _cacheExpiration
 
string _className
 
std::map< string, YDataStream * > _dataStreams
 
string _func
 
YFUN_DESCR _fundescr
 
string _funId
 
string _hwId
 
string _lastErrorMsg
 
YRETCODE _lastErrorType
 
string _logicalName
 
string _serial
 
yCRITICAL_SECTION _this_cs
 
void * _userData
 
YFunctionValueCallback _valueCallbackFunction
 

Friends

YColorLedClusteryFindColorLedCluster (const string &func)
 
YColorLedClusteryFirstColorLedCluster (void)
 

Additional Inherited Members

- Static Protected Member Functions inherited from YFunction
static void _AddToCache (const string &classname, const string &func, YFunction *obj)
 
static YFunction_FindFromCache (const string &classname, const string &func)
 
static void _UpdateTimedReportCallbackList (YFunction *func, bool add)
 
static void _UpdateValueCallbackList (YFunction *func, bool add)
 
- Static Protected Attributes inherited from YFunction
static std::map< string, YFunction * > _cache
 

Detailed Description

YColorLedCluster Class: ColorLedCluster function interface

The Yoctopuce application programming interface allows you to drive a color LED cluster. Unlike the ColorLed class, the ColorLedCluster allows to handle several LEDs at one. Color changes can be done using RGB coordinates as well as HSL coordinates. The module performs all conversions form RGB to HSL automatically. It is then self-evident to turn on a LED with a given hue and to progressively vary its saturation or lightness. If needed, you can find more information on the difference between RGB and HSL in the section following this one.

Definition at line 75 of file yocto_colorledcluster.h.

Constructor & Destructor Documentation

YColorLedCluster::YColorLedCluster ( const string &  func)
protected

Definition at line 51 of file yocto_colorledcluster.cpp.

YColorLedCluster::~YColorLedCluster ( )

Definition at line 64 of file yocto_colorledcluster.cpp.

Member Function Documentation

int YColorLedCluster::_invokeValueCallback ( string  value)
virtual

Reimplemented from YFunction.

Definition at line 351 of file yocto_colorledcluster.cpp.

int YColorLedCluster::_parseAttr ( YJSONObject json_val)
protectedvirtual

Reimplemented from YFunction.

Definition at line 73 of file yocto_colorledcluster.cpp.

int YColorLedCluster::activeLedCount ( void  )
inline

Definition at line 119 of file yocto_colorledcluster.h.

int YColorLedCluster::addHslMoveToBlinkSeq ( int  seqIndex,
int  hslValue,
int  delay 
)
virtual

Adds an HSL transition to a sequence. A sequence is a transition list, which can be executed in loop by an group of LEDs. Sequences are persistant and are saved in the device flash memory as soon as the saveBlinkSeq() method is called.

Parameters
seqIndex: sequence index.
hslValue: target color (0xHHSSLL)
delay: transition duration in ms
Returns
YAPI_SUCCESS when the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 490 of file yocto_colorledcluster.cpp.

int YColorLedCluster::addJumpToBlinkSeq ( int  seqIndex,
int  linkSeqIndex 
)
virtual

Adds to a sequence a jump to another sequence. When a pixel will reach this jump, it will be automatically relinked to the new sequence, and will run it starting from the beginning.

Parameters
seqIndex: sequence index.
linkSeqIndex: index of the sequence to chain.
Returns
YAPI_SUCCESS when the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 525 of file yocto_colorledcluster.cpp.

int YColorLedCluster::addMirrorToBlinkSeq ( int  seqIndex)
virtual

Adds a mirror ending to a sequence. When the sequence will reach the end of the last transition, its running speed will automatically be reversed so that the sequence plays in the reverse direction, like in a mirror. After the first transition of the sequence is played at the end of the reverse execution, the sequence starts again in the initial direction.

Parameters
seqIndex: sequence index.
Returns
YAPI_SUCCESS when the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 508 of file yocto_colorledcluster.cpp.

int YColorLedCluster::addRgbMoveToBlinkSeq ( int  seqIndex,
int  rgbValue,
int  delay 
)
virtual

Adds an RGB transition to a sequence. A sequence is a transition list, which can be executed in loop by a group of LEDs. Sequences are persistent and are saved in the device flash memory as soon as the saveBlinkSeq() method is called.

Parameters
seqIndex: sequence index.
rgbValue: target color (0xRRGGBB)
delay: transition duration in ms
Returns
YAPI_SUCCESS when the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 472 of file yocto_colorledcluster.cpp.

int YColorLedCluster::addUnlinkToBlinkSeq ( int  seqIndex)
virtual

Adds a to a sequence a hard stop code. When a pixel will reach this stop code, instead of restarting the sequence in a loop it will automatically be unlinked from the sequence.

Parameters
seqIndex: sequence index.
Returns
YAPI_SUCCESS when the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 541 of file yocto_colorledcluster.cpp.

int YColorLedCluster::blinkSeqMaxCount ( void  )
inline

Definition at line 156 of file yocto_colorledcluster.h.

int YColorLedCluster::blinkSeqMaxSize ( void  )
inline

Definition at line 168 of file yocto_colorledcluster.h.

string YColorLedCluster::command ( void  )
inline

Definition at line 173 of file yocto_colorledcluster.h.

static YColorLedCluster* YColorLedCluster::Find ( string  func)
inlinestatic

Definition at line 752 of file yocto_colorledcluster.h.

YColorLedCluster * YColorLedCluster::FindColorLedCluster ( string  func)
static

Retrieves a RGB LED cluster for a given identifier. The identifier can be specified using several formats:

  • FunctionLogicalName
  • ModuleSerialNumber.FunctionIdentifier
  • ModuleSerialNumber.FunctionLogicalName
  • ModuleLogicalName.FunctionIdentifier
  • ModuleLogicalName.FunctionLogicalName

This function does not require that the RGB LED cluster is online at the time it is invoked. The returned object is nevertheless valid. Use the method YColorLedCluster.isOnline() to test if the RGB LED cluster is indeed online at a given time. In case of ambiguity when looking for a RGB LED cluster by logical name, no error is notified: the first instance found is returned. The search is performed first by hardware name, then by logical name.

If a call to this object's is_online() method returns FALSE although you are certain that the matching device is plugged, make sure that you did call registerHub() at application initialization time.

Parameters
func: a string that uniquely characterizes the RGB LED cluster
Returns
a YColorLedCluster object allowing you to drive the RGB LED cluster.

Definition at line 300 of file yocto_colorledcluster.cpp.

static YColorLedCluster* YColorLedCluster::First ( void  )
inlinestatic

Definition at line 776 of file yocto_colorledcluster.h.

YColorLedCluster * YColorLedCluster::FirstColorLedCluster ( void  )
static

Starts the enumeration of RGB LED clusters currently accessible. Use the method YColorLedCluster.nextColorLedCluster() to iterate on next RGB LED clusters.

Returns
a pointer to a YColorLedCluster object, corresponding to the first RGB LED cluster currently online, or a NULL pointer if there are none.

Definition at line 1195 of file yocto_colorledcluster.cpp.

int YColorLedCluster::get_activeLedCount ( void  )

Returns the number of LEDs currently handled by the device.

Returns
an integer corresponding to the number of LEDs currently handled by the device

On failure, throws an exception or returns Y_ACTIVELEDCOUNT_INVALID.

Definition at line 101 of file yocto_colorledcluster.cpp.

int YColorLedCluster::get_blinkSeqMaxCount ( void  )

Returns the maximum number of sequences that the device can handle.

Returns
an integer corresponding to the maximum number of sequences that the device can handle

On failure, throws an exception or returns Y_BLINKSEQMAXCOUNT_INVALID.

Definition at line 184 of file yocto_colorledcluster.cpp.

int YColorLedCluster::get_blinkSeqMaxSize ( void  )

Returns the maximum length of sequences.

Returns
an integer corresponding to the maximum length of sequences

On failure, throws an exception or returns Y_BLINKSEQMAXSIZE_INVALID.

Definition at line 213 of file yocto_colorledcluster.cpp.

vector< int > YColorLedCluster::get_blinkSeqSignatures ( int  seqIndex,
int  count 
)
virtual

Returns a list on 32 bit signatures for specified blinking sequences. Since blinking sequences cannot be read from the device, this can be used to detect if a specific blinking sequence is already programmed.

Parameters
seqIndex: index of the first blinking sequence which should be returned
count: number of blinking sequences which should be returned
Returns
a list of 32 bit integer signatures

On failure, throws an exception or returns an empty array.

Definition at line 1075 of file yocto_colorledcluster.cpp.

vector< int > YColorLedCluster::get_blinkSeqState ( int  seqIndex,
int  count 
)
virtual

Returns a list of integers with the started state for specified blinking sequences.

Parameters
seqIndex: index of the first blinking sequence which should be returned
count: number of blinking sequences which should be returned
Returns
a list of integers, 0 for sequences turned off and 1 for sequences running

On failure, throws an exception or returns an empty array.

Definition at line 1167 of file yocto_colorledcluster.cpp.

vector< int > YColorLedCluster::get_blinkSeqStateAtPowerOn ( int  seqIndex,
int  count 
)
virtual

Returns a list of integers with the "auto-start at power on" flag state for specified blinking sequences.

Parameters
seqIndex: index of the first blinking sequence which should be returned
count: number of blinking sequences which should be returned
Returns
a list of integers, 0 for sequences turned off and 1 for sequences running

On failure, throws an exception or returns an empty array.

Definition at line 1139 of file yocto_colorledcluster.cpp.

vector< int > YColorLedCluster::get_blinkSeqStateSpeed ( int  seqIndex,
int  count 
)
virtual

Returns a list of integers with the current speed for specified blinking sequences.

Parameters
seqIndex: index of the first sequence speed which should be returned
count: number of sequence speeds which should be returned
Returns
a list of integers, 0 for sequences turned off and 1 for sequences running

On failure, throws an exception or returns an empty array.

Definition at line 1109 of file yocto_colorledcluster.cpp.

string YColorLedCluster::get_command ( void  )

Definition at line 235 of file yocto_colorledcluster.cpp.

vector< int > YColorLedCluster::get_linkedSeqArray ( int  ledIndex,
int  count 
)
virtual

Returns a list on sequence index for each RGB LED. The first number represents the sequence index for the the first LED, the second number represents the sequence index for the second LED, etc.

Parameters
ledIndex: index of the first LED which should be returned
count: number of LEDs which should be returned
Returns
a list of integers with sequence index

On failure, throws an exception or returns an empty array.

Definition at line 1045 of file yocto_colorledcluster.cpp.

int YColorLedCluster::get_maxLedCount ( void  )

Returns the maximum number of LEDs that the device can handle.

Returns
an integer corresponding to the maximum number of LEDs that the device can handle

On failure, throws an exception or returns Y_MAXLEDCOUNT_INVALID.

Definition at line 155 of file yocto_colorledcluster.cpp.

vector< int > YColorLedCluster::get_rgbColorArray ( int  ledIndex,
int  count 
)
virtual

Returns a list on 24bit RGB color values with the current colors displayed on the RGB leds. The first number represents the RGB value of the first LED, the second number represents the RGB value of the second LED, etc.

Parameters
ledIndex: index of the first LED which should be returned
count: number of LEDs which should be returned
Returns
a list of 24bit color codes with RGB components of selected LEDs, as 0xRRGGBB.

On failure, throws an exception or returns an empty array.

Definition at line 977 of file yocto_colorledcluster.cpp.

vector< int > YColorLedCluster::get_rgbColorArrayAtPowerOn ( int  ledIndex,
int  count 
)
virtual

Returns a list on 24bit RGB color values with the RGB LEDs startup colors. The first number represents the startup RGB value of the first LED, the second number represents the RGB value of the second LED, etc.

Parameters
ledIndex: index of the first LED which should be returned
count: number of LEDs which should be returned
Returns
a list of 24bit color codes with RGB components of selected LEDs, as 0xRRGGBB.

On failure, throws an exception or returns an empty array.

Definition at line 1011 of file yocto_colorledcluster.cpp.

string YColorLedCluster::get_rgbColorBuffer ( int  ledIndex,
int  count 
)
virtual

Returns a binary buffer with content from the LED RGB buffer, as is. First three bytes are RGB components for the first LED in the interval, the next three bytes for the second LED in the interval, etc.

Parameters
ledIndex: index of the first LED which should be returned
count: number of LEDs which should be returned
Returns
a binary buffer with RGB components of selected LEDs.

On failure, throws an exception or returns an empty binary buffer.

Definition at line 960 of file yocto_colorledcluster.cpp.

int YColorLedCluster::hsl_move ( int  ledIndex,
int  count,
int  hslValue,
int  delay 
)
virtual

Allows you to modify the current color of a group of adjacent LEDs to another color, in a seamless and autonomous manner. The transition is performed in the HSL space. In HSL, hue is a circular value (0..360°). There are always two paths to perform the transition: by increasing or by decreasing the hue. The module selects the shortest transition. If the difference is exactly 180°, the module selects the transition which increases the hue.

Parameters
ledIndex: index of the fisrt affected LED.
count: affected LED count.
hslValue: new color (0xHHSSLL).
delay: transition duration in ms
Returns
YAPI_SUCCESS when the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 454 of file yocto_colorledcluster.cpp.

int YColorLedCluster::hslArray_move ( vector< int >  hslList,
int  delay 
)
virtual

Sets up a smooth HSL color transition to the specified pixel-by-pixel list of HSL color codes. The first color code represents the target HSL value of the first LED, the second color code represents the target value of the second LED, etc.

Parameters
hslList: a list of target 24bit HSL codes, in the form 0xHHSSLL
delay: transition duration in ms
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 905 of file yocto_colorledcluster.cpp.

int YColorLedCluster::hslArrayOfs_move ( int  ledIndex,
vector< int >  hslList,
int  delay 
)
virtual

Sets up a smooth HSL color transition to the specified pixel-by-pixel list of HSL color codes. The first color code represents the target HSL value of the first LED, the second color code represents the target value of the second LED, etc.

Parameters
ledIndex: index of the first LED which should be updated
hslList: a list of target 24bit HSL codes, in the form 0xHHSSLL
delay: transition duration in ms
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 926 of file yocto_colorledcluster.cpp.

int YColorLedCluster::linkLedToBlinkSeq ( int  ledIndex,
int  count,
int  seqIndex,
int  offset 
)
virtual

Links adjacent LEDs to a specific sequence. These LEDs start to execute the sequence as soon as startBlinkSeq is called. It is possible to add an offset in the execution: that way we can have several groups of LED executing the same sequence, with a temporal offset. A LED cannot be linked to more than one sequence.

Parameters
ledIndex: index of the first affected LED.
count: affected LED count.
seqIndex: sequence index.
offset: execution offset in ms.
Returns
YAPI_SUCCESS when the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 561 of file yocto_colorledcluster.cpp.

int YColorLedCluster::linkLedToBlinkSeqAtPowerOn ( int  ledIndex,
int  count,
int  seqIndex,
int  offset 
)
virtual

Links adjacent LEDs to a specific sequence at device poweron. Don't forget to configure the sequence auto start flag as well and call saveLedsConfigAtPowerOn(). It is possible to add an offset in the execution: that way we can have several groups of LEDs executing the same sequence, with a temporal offset. A LED cannot be linked to more than one sequence.

Parameters
ledIndex: index of the first affected LED.
count: affected LED count.
seqIndex: sequence index.
offset: execution offset in ms.
Returns
YAPI_SUCCESS when the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 581 of file yocto_colorledcluster.cpp.

int YColorLedCluster::linkLedToPeriodicBlinkSeq ( int  ledIndex,
int  count,
int  seqIndex,
int  periods 
)
virtual

Links adjacent LEDs to a specific sequence. These LED start to execute the sequence as soon as startBlinkSeq is called. This function automatically introduces a shift between LEDs so that the specified number of sequence periods appears on the group of LEDs (wave effect).

Parameters
ledIndex: index of the first affected LED.
count: affected LED count.
seqIndex: sequence index.
periods: number of periods to show on LEDs.
Returns
YAPI_SUCCESS when the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 601 of file yocto_colorledcluster.cpp.

int YColorLedCluster::maxLedCount ( void  )
inline

Definition at line 144 of file yocto_colorledcluster.h.

YColorLedCluster* YColorLedCluster::next ( void  )
inline

Definition at line 763 of file yocto_colorledcluster.h.

YColorLedCluster * YColorLedCluster::nextColorLedCluster ( void  )

Continues the enumeration of RGB LED clusters started using yFirstColorLedCluster().

Returns
a pointer to a YColorLedCluster object, corresponding to a RGB LED cluster currently online, or a NULL pointer if there are no more RGB LED clusters to enumerate.

Definition at line 1185 of file yocto_colorledcluster.cpp.

int YColorLedCluster::registerValueCallback ( YColorLedClusterValueCallback  callback)
virtual

Registers the callback function that is invoked on every change of advertised value. The callback is invoked only during the execution of ySleep or yHandleEvents. This provides control over the time when the callback is triggered. For good responsiveness, remember to call one of these two functions periodically. To unregister a callback, pass a NULL pointer as argument.

Parameters
callback: the callback function to call, or a NULL pointer. The callback function should take two arguments: the function object of which the value has changed, and the character string describing the new advertised value.

Definition at line 332 of file yocto_colorledcluster.cpp.

int YColorLedCluster::resetBlinkSeq ( int  seqIndex)
virtual

Stops a sequence execution and resets its contents. Leds linked to this sequence are not automatically updated anymore.

Parameters
seqIndex: index of the sequence to reset
Returns
YAPI_SUCCESS when the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 661 of file yocto_colorledcluster.cpp.

int YColorLedCluster::rgb_move ( int  ledIndex,
int  count,
int  rgbValue,
int  delay 
)
virtual

Allows you to modify the current color of a group of adjacent LEDs to another color, in a seamless and autonomous manner. The transition is performed in the RGB space.

Parameters
ledIndex: index of the first affected LED.
count: affected LED count.
rgbValue: new color (0xRRGGBB).
delay: transition duration in ms
Returns
YAPI_SUCCESS when the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 432 of file yocto_colorledcluster.cpp.

int YColorLedCluster::rgbArray_move ( vector< int >  rgbList,
int  delay 
)
virtual

Sets up a smooth RGB color transition to the specified pixel-by-pixel list of RGB color codes. The first color code represents the target RGB value of the first LED, the next color code represents the target value of the next LED, etc.

Parameters
rgbList: a list of target 24bit RGB codes, in the form 0xRRGGBB
delay: transition duration in ms
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 834 of file yocto_colorledcluster.cpp.

int YColorLedCluster::rgbArrayOfs_move ( int  ledIndex,
vector< int >  rgbList,
int  delay 
)
virtual

Sets up a smooth RGB color transition to the specified pixel-by-pixel list of RGB color codes. The first color code represents the target RGB value of the first LED, the next color code represents the target value of the next LED, etc.

Parameters
ledIndex: index of the first LED which should be updated
rgbList: a list of target 24bit RGB codes, in the form 0xRRGGBB
delay: transition duration in ms
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 800 of file yocto_colorledcluster.cpp.

int YColorLedCluster::saveBlinkSeq ( int  seqIndex)
virtual

Saves the definition of a sequence. Warning: only sequence steps and flags are saved. to save the LEDs startup bindings, the method saveLedsConfigAtPowerOn() must be called.

Parameters
seqIndex: index of the sequence to start.
Returns
YAPI_SUCCESS when the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 731 of file yocto_colorledcluster.cpp.

int YColorLedCluster::saveLedsConfigAtPowerOn ( void  )
virtual

Saves the LEDs power-on configuration. This includes the start-up color or sequence binding for all LEDs. Warning: if some LEDs are linked to a sequence, the method saveBlinkSeq() must also be called to save the sequence definition.

Returns
YAPI_SUCCESS when the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 710 of file yocto_colorledcluster.cpp.

int YColorLedCluster::saveLedsState ( void  )
virtual

Definition at line 715 of file yocto_colorledcluster.cpp.

int YColorLedCluster::sendCommand ( string  command)
virtual

Definition at line 361 of file yocto_colorledcluster.cpp.

int YColorLedCluster::set_activeLedCount ( int  newval)

Changes the number of LEDs currently handled by the device.

Parameters
newval: an integer corresponding to the number of LEDs currently handled by the device
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 132 of file yocto_colorledcluster.cpp.

int YColorLedCluster::set_blinkSeqSpeed ( int  seqIndex,
int  speed 
)
virtual

Changes the execution speed of a sequence. The natural execution speed is 1000 per thousand. If you configure a slower speed, you can play the sequence in slow-motion. If you set a negative speed, you can play the sequence in reverse direction.

Parameters
seqIndex: index of the sequence to start.
speed: sequence running speed (-1000...1000).
Returns
YAPI_SUCCESS when the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 696 of file yocto_colorledcluster.cpp.

int YColorLedCluster::set_blinkSeqStateAtPowerOn ( int  seqIndex,
int  autostart 
)
virtual

Configures a sequence to make it start automatically at device startup. Note that a sequence with a zero duration can't be started. Don't forget to call saveBlinkSeq() to make sure the modification is saved in the device flash memory.

Parameters
seqIndex: index of the sequence to reset.
autostart: 0 to keep the sequence turned off and 1 to start it automatically.
Returns
YAPI_SUCCESS when the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 679 of file yocto_colorledcluster.cpp.

int YColorLedCluster::set_command ( const string &  newval)

Definition at line 257 of file yocto_colorledcluster.cpp.

int YColorLedCluster::set_hslColor ( int  ledIndex,
int  count,
int  hslValue 
)
virtual

Changes the current color of consecutive LEDs in the cluster, using a HSL color. Encoding is done as follows: 0xHHSSLL.

Parameters
ledIndex: index of the first affected LED.
count: affected LED count.
hslValue: new color.
Returns
YAPI_SUCCESS when the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 414 of file yocto_colorledcluster.cpp.

int YColorLedCluster::set_hslColorArray ( int  ledIndex,
vector< int >  hslList 
)
virtual

Sends 24bit HSL colors (provided as a list of integers) to the LED HSL buffer, as is. The first number represents the HSL value of the LED specified as parameter, the second number represents the HSL value of the second LED, etc.

Parameters
ledIndex: index of the first LED which should be updated
hslList: a list of 24bit HSL codes, in the form 0xHHSSLL
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 871 of file yocto_colorledcluster.cpp.

int YColorLedCluster::set_hslColorBuffer ( int  ledIndex,
string  buff 
)
virtual

Sends a binary buffer to the LED HSL buffer, as is. First three bytes are HSL components for the LED specified as parameter, the next three bytes for the second LED, etc.

Parameters
ledIndex: index of the first LED which should be updated
buff: the binary buffer to send
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 854 of file yocto_colorledcluster.cpp.

int YColorLedCluster::set_rgbColor ( int  ledIndex,
int  count,
int  rgbValue 
)
virtual

Changes the current color of consecutve LEDs in the cluster, using a RGB color. Encoding is done as follows: 0xRRGGBB.

Parameters
ledIndex: index of the first affected LED.
count: affected LED count.
rgbValue: new color.
Returns
YAPI_SUCCESS when the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 378 of file yocto_colorledcluster.cpp.

int YColorLedCluster::set_rgbColorArray ( int  ledIndex,
vector< int >  rgbList 
)
virtual

Sends 24bit RGB colors (provided as a list of integers) to the LED RGB buffer, as is. The first number represents the RGB value of the LED specified as parameter, the second number represents the RGB value of the next LED, etc.

Parameters
ledIndex: index of the first LED which should be updated
rgbList: a list of 24bit RGB codes, in the form 0xRRGGBB
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 765 of file yocto_colorledcluster.cpp.

int YColorLedCluster::set_rgbColorAtPowerOn ( int  ledIndex,
int  count,
int  rgbValue 
)
virtual

Changes the color at device startup of consecutve LEDs in the cluster, using a RGB color. Encoding is done as follows: 0xRRGGBB. Don't forget to call saveLedsConfigAtPowerOn() to make sure the modification is saved in the device flash memory.

Parameters
ledIndex: index of the first affected LED.
count: affected LED count.
rgbValue: new color.
Returns
YAPI_SUCCESS when the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 397 of file yocto_colorledcluster.cpp.

int YColorLedCluster::set_rgbColorBuffer ( int  ledIndex,
string  buff 
)
virtual

Sends a binary buffer to the LED RGB buffer, as is. First three bytes are RGB components for LED specified as parameter, the next three bytes for the next LED, etc.

Parameters
ledIndex: index of the first LED which should be updated
buff: the binary buffer to send
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 748 of file yocto_colorledcluster.cpp.

int YColorLedCluster::setActiveLedCount ( int  newval)
inline

Definition at line 132 of file yocto_colorledcluster.h.

int YColorLedCluster::setCommand ( const string &  newval)
inline

Definition at line 177 of file yocto_colorledcluster.h.

int YColorLedCluster::startBlinkSeq ( int  seqIndex)
virtual

Starts a sequence execution: every LED linked to that sequence starts to run it in a loop. Note that a sequence with a zero duration can't be started.

Parameters
seqIndex: index of the sequence to start.
Returns
YAPI_SUCCESS when the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 631 of file yocto_colorledcluster.cpp.

int YColorLedCluster::stopBlinkSeq ( int  seqIndex)
virtual

Stops a sequence execution. If started again, the execution restarts from the beginning.

Parameters
seqIndex: index of the sequence to stop.
Returns
YAPI_SUCCESS when the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 646 of file yocto_colorledcluster.cpp.

int YColorLedCluster::unlinkLedFromBlinkSeq ( int  ledIndex,
int  count 
)
virtual

Unlinks adjacent LEDs from a sequence.

Parameters
ledIndex: index of the first affected LED.
count: affected LED count.
Returns
YAPI_SUCCESS when the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 616 of file yocto_colorledcluster.cpp.

Friends And Related Function Documentation

YColorLedCluster* yFindColorLedCluster ( const string &  func)
friend

Retrieves a RGB LED cluster for a given identifier. The identifier can be specified using several formats:

  • FunctionLogicalName
  • ModuleSerialNumber.FunctionIdentifier
  • ModuleSerialNumber.FunctionLogicalName
  • ModuleLogicalName.FunctionIdentifier
  • ModuleLogicalName.FunctionLogicalName

This function does not require that the RGB LED cluster is online at the time it is invoked. The returned object is nevertheless valid. Use the method YColorLedCluster.isOnline() to test if the RGB LED cluster is indeed online at a given time. In case of ambiguity when looking for a RGB LED cluster by logical name, no error is notified: the first instance found is returned. The search is performed first by hardware name, then by logical name.

If a call to this object's is_online() method returns FALSE although you are certain that the matching device is plugged, make sure that you did call registerHub() at application initialization time.

Parameters
func: a string that uniquely characterizes the RGB LED cluster
Returns
a YColorLedCluster object allowing you to drive the RGB LED cluster.

Definition at line 813 of file yocto_colorledcluster.h.

YColorLedCluster* yFirstColorLedCluster ( void  )
friend

Starts the enumeration of RGB LED clusters currently accessible. Use the method YColorLedCluster.nextColorLedCluster() to iterate on next RGB LED clusters.

Returns
a pointer to a YColorLedCluster object, corresponding to the first RGB LED cluster currently online, or a NULL pointer if there are none.

Definition at line 824 of file yocto_colorledcluster.h.

Member Data Documentation

int YColorLedCluster::_activeLedCount
protected

Definition at line 83 of file yocto_colorledcluster.h.

int YColorLedCluster::_blinkSeqMaxCount
protected

Definition at line 85 of file yocto_colorledcluster.h.

int YColorLedCluster::_blinkSeqMaxSize
protected

Definition at line 86 of file yocto_colorledcluster.h.

string YColorLedCluster::_command
protected

Definition at line 87 of file yocto_colorledcluster.h.

int YColorLedCluster::_maxLedCount
protected

Definition at line 84 of file yocto_colorledcluster.h.

YColorLedClusterValueCallback YColorLedCluster::_valueCallbackColorLedCluster
protected

Definition at line 88 of file yocto_colorledcluster.h.

const int YColorLedCluster::ACTIVELEDCOUNT_INVALID = YAPI_INVALID_UINT
static

Definition at line 104 of file yocto_colorledcluster.h.

const int YColorLedCluster::BLINKSEQMAXCOUNT_INVALID = YAPI_INVALID_UINT
static

Definition at line 106 of file yocto_colorledcluster.h.

const int YColorLedCluster::BLINKSEQMAXSIZE_INVALID = YAPI_INVALID_UINT
static

Definition at line 107 of file yocto_colorledcluster.h.

const string YColorLedCluster::COMMAND_INVALID = YAPI_INVALID_STRING
static

Definition at line 108 of file yocto_colorledcluster.h.

const int YColorLedCluster::MAXLEDCOUNT_INVALID = YAPI_INVALID_UINT
static

Definition at line 105 of file yocto_colorledcluster.h.


The documentation for this class was generated from the following files:


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