3.3.1.1 Effect Adding

int IndoorTouch.LedsAddEffect(String effectName, int continuity, String transitions, int effectLedMask, int usedLedMask);
  • 1. The argument specifies the effect name. If the effect exists, RC_ERR_EXIST is returned.
  • 2. The argument can have the following values: LED_EFFECT_CONTINUITY_SINGLE, LED_EFFECT_CONTINUITY_REPEATING, LED_EFFECT_CONTINUITY_KEEP. These values define what happens when the transition vector ends. With SINGLE, the effect is terminated and removed from the active effect database. With REPEATING, the effect starts from the beginning again. With KEEP, the effect remains active displaying the last final transition value.
  • 3. Transitions means a string of transitions in the following format: <initial brightness>,<target brightness>,<transition time in ms>, … . The count of numbers in the string must be divisible by 3 and contain one transition at least.
  • 4. Mask of used LEDs for the effect itself. These LEDs are affected by the transition defined.
  • 5. Mask of used LEDs. It contains all bits from the argument 4 mask plus others in which the brightness value is 0. The other LEDs are not affected by the effect and can use other effects that use a set of LEDs disjunctive with this effect. The following LEDs are available for effects at present:
    • LED_RED = 0x01;
    • LED_GREEN = 0x02
    • LED_BLUE = 0x04;
    • LED_NFC = 0x08;

Example of effect definition for red LED blinking:

IndoorTouch.LedsAddEffect("test-r", LED_EFFECT_CONTINUITY_REPEATING,"0,255,1000,255,0,1000", LED_RED, LED_RED | LED_GREEN | LED_BLUE));

The library includes a pre-defined effect "red-blink-missedcalls“ for red blinking.

The return value is as follows:

  • IndoorTouch.RC_OK = 0;
  • IndoorTouch.RC_ERR_CONN = -1; API daemon connection error
  • IndoorTouch.RC_ERR_EXIST = -3; the effect name already exists
  • IndoorTouch.RC_ERR_INVALID = -5; invalid function arguments
  • IndoorTouch.RC_ERR_MAXREACHED = -10; maximum count of defined effects exceeded