Timer Entity

group TimerEntity

TimerClass: The Timer Class provides access to a simple scheduler. The timer can set to fire only once, or to repeat at a certain interval. Additionally, a timer entity can execute custom Reflex routines upon firing.

void timer_getExpiration(unsigned int *id, struct Result *result, const int index)

Get the currently set expiration time in microseconds. This is not a “live” timer. That is, it shows the expiration time originally set with setExpiration; it does not “tick down” to show the time remaining before expiration.

Returns common entity return values

Parameters:
  • id – ID assigned through “module_createStem”

  • result – Object containing aErrNone and the requested value on success. Non-zero error code on failure. The timer expiration duration in microseconds.

  • index – The index of the entity in question.

void timer_setExpiration(unsigned int *id, struct Result *result, const int index, const unsigned int usecDuration)

Set the expiration time for the timer entity. When the timer expires, it will fire the associated timer[index]() reflex.

Returns common entity return values

Parameters:
  • id – ID assigned through “module_createStem”

  • result – Object containing aErrNone on success. Non-zero error code on failure.

  • index – The index of the entity in question.

  • usecDuration – The duration before timer expiration in microseconds.

void timer_getMode(unsigned int *id, struct Result *result, const int index)

Get the mode of the timer which is either single or repeat mode.

Returns common entity return values

Parameters:
  • id – ID assigned through “module_createStem”

  • result – Object containing aErrNone and the requested value on success. Non-zero error code on failure. The mode of the time. aTIMER_MODE_REPEAT or aTIMER_MODE_SINGLE.

  • index – The index of the entity in question.

void timer_setMode(unsigned int *id, struct Result *result, const int index, const unsigned char mode)

Set the mode of the timer which is either single or repeat mode.

Returns common entity return values

aErrNone Action completed successfully.

Parameters:
  • id – ID assigned through “module_createStem”

  • result – Object containing aErrNone on success. Non-zero error code on failure.

  • index – The index of the entity in question.

  • mode – The mode of the timer. aTIMER_MODE_REPEAT or aTIMER_MODE_SINGLE.