Skip to content

Class eva::CountdownTimer

ClassList > eva > CountdownTimer

Timer that fires repeatedly at fixed intervals.

  • #include <evaCountdownTimer.h>

Inherits the following classes: eva::DelayTimer

Public Functions

Type Name
DelayTimer ()
DelayTimer (IHandler * listener)
unsigned char getRemaining ()
Returns the number of remaining timer ticks.
CountdownTimer * setListener (IHandler * listener)
Assigns or changes the event listener.
void start (unsigned short period, unsigned char count, IHandler * listener)
Starts or restarts the repeating timer.
void start (unsigned short period, unsigned char count)
Starts or restarts the countdown timer.

Public Functions inherited from eva::DelayTimer

See eva::DelayTimer

Type Name
DelayTimer ()
DelayTimer (IHandler * listener)
bool isRunning ()
Checks if the timer is currently active.
DelayTimer * setListener (IHandler * listener)
Assigns or changes the event listener.
void start (unsigned short delay, IHandler * listener)
Starts the timer.
void start (unsigned short delay)
Starts the timer.
void stop ()
Stops the timer.

Public Functions inherited from eva::Tickable

See eva::Tickable

Type Name
Tickable ()
Tickable (const Tickable &) = delete
Tickable (Tickable &&) = delete
Tickable & operator= (const Tickable &) = delete
Tickable & operator= (Tickable &&) = delete
virtual ~Tickable ()

Public Static Functions inherited from eva::Tickable

See eva::Tickable

Type Name
void tac ()
Triggers tick on this and all linked tickables.

Protected Attributes inherited from eva::DelayTimer

See eva::DelayTimer

Type Name
IHandler * listener
unsigned long nextFire

Protected Functions inherited from eva::DelayTimer

See eva::DelayTimer

Type Name
bool checkTimeElapsed ()
virtual void tick () override

Public Functions Documentation

function DelayTimer [1/2]

eva::CountdownTimer::DelayTimer () 

function DelayTimer [2/2]

eva::CountdownTimer::DelayTimer (
    IHandler * listener
) 

function getRemaining

Returns the number of remaining timer ticks.

unsigned char eva::CountdownTimer::getRemaining () 

Returns:

Number of pending executions (0 if timer is not running)


function setListener

Assigns or changes the event listener.

CountdownTimer * eva::CountdownTimer::setListener (
    IHandler * listener
) 

Parameters:

  • listener Pointer to IHandler implementation that will receive timer events

Returns:

Pointer to this CountdownTimer instance for method chaining


function start [1/2]

Starts or restarts the repeating timer.

void eva::CountdownTimer::start (
    unsigned short period,
    unsigned char count,
    IHandler * listener
) 

Parameters:

  • period Interval in milliseconds
  • count Number of iterations
  • listener Handler to invoke on each tick

function start [2/2]

Starts or restarts the countdown timer.

void eva::CountdownTimer::start (
    unsigned short period,
    unsigned char count
) 

Parameters:

  • period Interval in milliseconds
  • count Number of iterations

Listener must be assigned via constructor or setListener(). Use overloaded version with listener parameter if not pre-assigned.



The documentation for this class was generated from the following file src/evaCountdownTimer.h