0.01.00
ot::Timer Class Reference

This class implements a timer. More...

#include <src/core/common/timer.hpp>

Inheritance diagram for ot::Timer:
ot::InstanceLocator ot::Context ot::TimerMilli ot::TrickleTimer

Public Types

enum  { kMaxDt = (1UL << 31) - 1 }
 
typedef void(* Handler) (Timer &aTimer)
 This function pointer is called when the timer expires. More...
 

Public Member Functions

 Timer (otInstance &aInstance, Handler aHandler, void *aContext)
 This constructor creates a timer instance. More...
 
uint32_t GetFireTime (void) const
 This method returns the fire time of the timer. More...
 
bool IsRunning (void) const
 This method indicates whether or not the timer instance is running. More...
 
- Public Member Functions inherited from ot::InstanceLocator
otInstanceGetInstance (void) const
 This method returns a reference to the parent otInstance structure. More...
 
Ip6::Ip6GetIp6 (void) const
 This method returns a reference to the Ip6. More...
 
ThreadNetifGetNetif (void) const
 This method returns a reference to the thread network interface. More...
 

Protected Member Functions

bool DoesFireBefore (const Timer &aTimer, uint32_t aNow)
 This method indicates if the fire time of this timer is strictly before the fire time of a second given timer. More...
 
void Fired (void)
 
- Protected Member Functions inherited from ot::InstanceLocator
 InstanceLocator (otInstance &aInstance)
 This constructor initializes the object. More...
 
- Protected Member Functions inherited from ot::Context
 Context (void *aContext)
 This constructor initializes the context object. More...
 

Protected Attributes

Handler mHandler
 
uint32_t mFireTime
 
TimermNext
 

Friends

class TimerScheduler
 

Detailed Description

This class implements a timer.

Member Typedef Documentation

§ Handler

typedef void(* ot::Timer::Handler) (Timer &aTimer)

This function pointer is called when the timer expires.

Parameters
[in]aTimerA reference to the expired timer instance.

Constructor & Destructor Documentation

§ Timer()

ot::Timer::Timer ( otInstance aInstance,
Handler  aHandler,
void *  aContext 
)
inline

This constructor creates a timer instance.

Parameters
[in]aInstanceA reference to the instance.
[in]aHandlerA pointer to a function that is called when the timer expires.
[in]aContextA pointer to arbitrary context information.

Member Function Documentation

§ DoesFireBefore()

bool ot::Timer::DoesFireBefore ( const Timer aTimer,
uint32_t  aNow 
)
protected

This method indicates if the fire time of this timer is strictly before the fire time of a second given timer.

Parameters
[in]aTimerA reference to the second timer object.
[in]aNowThe current time (may in milliseconds or microsecond, which depends on the timer type).
Return values
TRUEIf the fire time of this timer object is strictly before aTimer's fire time
FALSEIf the fire time of this timer object is the same or after aTimer's fire time.

§ GetFireTime()

uint32_t ot::Timer::GetFireTime ( void  ) const
inline

This method returns the fire time of the timer.

Returns
The fire time in milliseconds.

§ IsRunning()

bool ot::Timer::IsRunning ( void  ) const
inline

This method indicates whether or not the timer instance is running.

Return values
TRUEIf the timer is running.
FALSEIf the timer is not running.

The documentation for this class was generated from the following files: