This class provides an implementation of AsyncProvider that acts as a timer. More...
#include <AsyncTimer.h>
Inherits atscppapi::AsyncProvider.

| Public Types | |
| enum | Type { TYPE_ONE_OFF = 0, TYPE_PERIODIC } | 
| Public Member Functions | |
| AsyncTimer (Type type, int period_in_ms, int initial_period_in_ms=0) | |
| Constructor. | |
| virtual | ~AsyncTimer () | 
| void | run () | 
| Starts the timer. | |
| void | cancel () | 
| Base implementation just breaks communication channel with receiver. | |
This class provides an implementation of AsyncProvider that acts as a timer.
It sends events at the set frequency. Calling the destructor will stop the events. A one-off timer just sends one event. Calling the destructor before this event will cancel the timer.
For either type, user must delete the timer.
See example async_timer for sample usage.
Definition at line 48 of file AsyncTimer.h.
Definition at line 51 of file AsyncTimer.h.
| atscppapi::AsyncTimer::AsyncTimer | ( | Type | type, | |
| int | period_in_ms, | |||
| int | initial_period_in_ms = 0 | |||
| ) | 
Constructor.
| type | A one-off timer fires only once and a periodic timer fires periodically. | |
| period_in_ms | The receiver will receive an event every this many milliseconds. | |
| initial_period_in_ms | The first event will arrive after this many milliseconds. Subsequent events will have "regular" cadence. This is useful if the timer is set for a long period of time (1hr etc.), but an initial event is required. Value of 0 (default) indicates no initial event is desired. | 
| virtual atscppapi::AsyncTimer::~AsyncTimer | ( | ) |  [virtual] | 
| void atscppapi::AsyncTimer::cancel | ( | void | ) |  [virtual] | 
Base implementation just breaks communication channel with receiver.
Implementations should add business logic here.
Reimplemented from atscppapi::AsyncProvider.
| void atscppapi::AsyncTimer::run | ( | ) |  [virtual] | 
Starts the timer.
Implements atscppapi::AsyncProvider.
 1.7.1
 1.7.1