![]() |
0.01.00
|
This class implements a trickle timer. More...
#include <src/core/common/trickle_timer.hpp>
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... | |
![]() | |
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. | |
![]() | |
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. | |
![]() | |
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... | |
![]() | |
otInstance & | GetInstance (void) const |
This method returns a reference to the parent otInstance structure. More... | |
Ip6::Ip6 & | GetIp6 (void) const |
This method returns a reference to the Ip6. More... | |
ThreadNetif & | GetNetif (void) const |
This method returns a reference to the thread network interface. More... | |
Additional Inherited Members | |
![]() | |
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... | |
![]() | |
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) |
![]() | |
InstanceLocator (otInstance &aInstance) | |
This constructor initializes the object. More... | |
![]() | |
Context (void *aContext) | |
This constructor initializes the context object. More... | |
![]() | |
Handler | mHandler |
uint32_t | mFireTime |
Timer * | mNext |
This class implements a trickle timer.
typedef bool(* ot::TrickleTimer::Handler) (TrickleTimer &aTimer) |
This function pointer is called when the timer expires.
[in] | aTimer | A reference to the expired timer. |
TRUE | If the trickle timer should continue running. |
FALSE | If the trickle timer should stop running. |
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. |
ot::TrickleTimer::TrickleTimer | ( | otInstance & | aInstance, |
Handler | aTransmitHandler, | ||
Handler | aIntervalExpiredHandler, | ||
void * | aContext | ||
) |
This constructor creates a trickle timer instance.
[in] | aInstance | A reference to the instance. |
[in] | aRedundancyConstant | The redundancy constant for the timer, k. |
[in] | aTransmitHandler | A pointer to a function that is called when transmission should occur. |
[in] | aIntervalExpiredHandler | An optional pointer to a function that is called when the interval expires. |
[in] | aContext | A pointer to arbitrary context information. |
bool ot::TrickleTimer::IsRunning | ( | void | ) | const |
This method indicates whether or not the trickle timer instance is running.
TRUE | If the trickle timer is running. |
FALSE | If the trickle timer is not running. |
void ot::TrickleTimer::Start | ( | uint32_t | aIntervalMin, |
uint32_t | aIntervalMax, | ||
Mode | aMode | ||
) |
This method start the trickle timer.
[in] | aIntervalMin | The minimum interval for the timer, Imin. |
[in] | aIntervalMax | The maximum interval for the timer, Imax. |
[in] | aMode | The operating mode for the timer. |
void ot::TrickleTimer::StartAt | ( | uint32_t | aStartTime, |
uint32_t | aIntervalMin, | ||
uint32_t | aIntervalMax, | ||
Mode | aMode | ||
) |
This method start the trickle timer.
[in] | aStartTime | The start time. |
[in] | aIntervalMin | The minimum interval for the timer, Imin. |
[in] | aIntervalMax | The maximum interval for the timer, Imax. |
[in] | aMode | The operating mode for the timer. |