79 d->callback = callback;
118 return d->timerId != -1;
124 return d->singleShot;
142 if (d->callback !=
nullptr)
std::atomic< int > timerId
The Timer class provides repetitive and single-shot timers.
int interval() const
Returns the timeout interval in milliseconds.
void setSingleShot(bool singleShot)
Set whether the timer is a single-shot timer.
void callOnTimeout(const std::function< void()> &callback)
void start()
Starts or restarts the timer with the timeout specified in interval.
static void singleShot(int msec, const std::function< void()> &callback)
This static function calls a the given function after a given time interval.
bool isActive() const
Returns true if the timer is running (pending); otherwise returns false.
int remainingTime() const
Returns the timer's remaining value in milliseconds left until the timeout. If the timer not exists,...
void setInterval(int msec)
Set the timeout interval in milliseconds.
void stop()
Stops the timer.
virtual void timeout()
This function is called when the timer times out.
bool isSingleShot() const
Returns whether the timer is a single-shot timer.
void rmTimer(int timer_id)
int addTimer(int ms, TCF *fp, void *ud)
int addPeriodicTimer(int ms, TCF *fp, void *ud)
int remainingTimer(int timer_id)
Public interface to INDI's eventloop mechanism.
Namespace to encapsulate INDI client, drivers, and mediator classes.