0.01.00
ot::TrickleTimer Class Reference

This class implements a trickle timer. More...

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

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

Public Types

enum  Mode {
  kModeNormal = 0,
  kModePlainTimer = 1,
  kModeMPL = 2
}
 Represents the modes of operation for the TrickleTimer. More...
 
typedef enum ot::TrickleTimer::Mode Mode
 Represents the modes of operation for the TrickleTimer.
 
typedef bool(* Handler) (TrickleTimer &aTimer)
 This function pointer is called when the timer expires. More...
 
- Public Types inherited from ot::Timer
enum  { kMaxDt = (1UL << 31) - 1 }
 
typedef void(* Handler) (Timer &aTimer)
 This function pointer is called when the timer expires. More...
 

Public Member Functions

 TrickleTimer (otInstance &aInstance, Handler aTransmitHandler, Handler aIntervalExpiredHandler, void *aContext)
 This constructor creates a trickle timer instance. More...
 
bool IsRunning (void) const
 This method indicates whether or not the trickle timer instance is running. More...
 
void Start (uint32_t aIntervalMin, uint32_t aIntervalMax, Mode aMode)
 This method start the trickle timer. More...
 
void StartAt (uint32_t aStartTime, uint32_t aIntervalMin, uint32_t aIntervalMax, Mode aMode)
 This method start the trickle timer. More...
 
void Stop (void)
 This method stops the trickle timer.
 
void IndicateInconsistent (void)
 This method indicates to the trickle timer an 'inconsistent' state.
 
- Public Member Functions inherited from ot::TimerMilli
 TimerMilli (otInstance &aInstance, Handler aHandler, void *aContext)
 This constructor creates a millisecond timer instance. More...
 
void Start (uint32_t aDt)
 This method schedules the timer to fire a dt milliseconds from now. More...
 
void StartAt (uint32_t aT0, uint32_t aDt)
 This method schedules the timer to fire at aDt milliseconds from aT0. More...
 
void Stop (void)
 This method stops the timer.
 
- Public Member Functions inherited from ot::Timer
 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...
 

Additional Inherited Members

- Static Public Member Functions inherited from ot::TimerMilli
static uint32_t GetNow (void)
 This static method returns the current time in milliseconds. More...
 
static uint32_t SecToMsec (uint32_t aSeconds)
 This static method returns the number of milliseconds given seconds. More...
 
static uint32_t MsecToSec (uint32_t aMilliseconds)
 This static method returns the number of seconds given milliseconds. More...
 
- Protected Member Functions inherited from ot::Timer
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 inherited from ot::Timer
Handler mHandler
 
uint32_t mFireTime
 
TimermNext
 

Detailed Description

This class implements a trickle timer.

Member Typedef Documentation

§ Handler

typedef bool(* ot::TrickleTimer::Handler) (TrickleTimer &aTimer)

This function pointer is called when the timer expires.

Parameters
[in]aTimerA reference to the expired timer.
Return values
TRUEIf the trickle timer should continue running.
FALSEIf the trickle timer should stop running.

Member Enumeration Documentation

§ Mode

Represents the modes of operation for the TrickleTimer.

Enumerator
kModeNormal 

Runs the normal trickle logic.

kModePlainTimer 

Runs a normal timer between Imin and Imax.

kModeMPL 

Runs the trickle logic modified for MPL.

Constructor & Destructor Documentation

§ TrickleTimer()

ot::TrickleTimer::TrickleTimer ( otInstance aInstance,
Handler  aTransmitHandler,
Handler  aIntervalExpiredHandler,
void *  aContext 
)

This constructor creates a trickle timer instance.

Parameters
[in]aInstanceA reference to the instance.
[in]aRedundancyConstantThe redundancy constant for the timer, k.
[in]aTransmitHandlerA pointer to a function that is called when transmission should occur.
[in]aIntervalExpiredHandlerAn optional pointer to a function that is called when the interval expires.
[in]aContextA pointer to arbitrary context information.

Member Function Documentation

§ IsRunning()

bool ot::TrickleTimer::IsRunning ( void  ) const

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

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

§ Start()

void ot::TrickleTimer::Start ( uint32_t  aIntervalMin,
uint32_t  aIntervalMax,
Mode  aMode 
)

This method start the trickle timer.

Parameters
[in]aIntervalMinThe minimum interval for the timer, Imin.
[in]aIntervalMaxThe maximum interval for the timer, Imax.
[in]aModeThe operating mode for the timer.

§ StartAt()

void ot::TrickleTimer::StartAt ( uint32_t  aStartTime,
uint32_t  aIntervalMin,
uint32_t  aIntervalMax,
Mode  aMode 
)

This method start the trickle timer.

Parameters
[in]aStartTimeThe start time.
[in]aIntervalMinThe minimum interval for the timer, Imin.
[in]aIntervalMaxThe maximum interval for the timer, Imax.
[in]aModeThe operating mode for the timer.

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