nl::Weave::System::Timer

#include <src/system/SystemTimer.h>

This is an internal class to Weave System Layer, used to represent an in-progress one-shot timer.

Summary

There is no real public interface available for the application layer. The static public methods used to acquire current system time are intended for internal use.

Inheritance

Inherits from: nl::Weave::System::Object

Public types

Epoch typedef
uint64_t
Represents an epoch in the local system timescale, usually the POSIX timescale.
OnCompleteFunct)(Layer *aLayer, void *aAppState, Error aError) typedef
void(*

Public attributes

OnComplete
OnCompleteFunct

Public static functions

GetCurrentEpoch(void)
This method returns the current epoch, corrected by system sleep with the system timescale, in milliseconds.
GetStatistics(nl::Weave::System::Stats::count_t & aNumInUse, nl::Weave::System::Stats::count_t & aHighWatermark)
void
IsEarlierEpoch(const Epoch & first, const Epoch & second)
bool
Compares two Timer::Epoch values and returns true if the first value is earlier than the second value.

Public functions

Cancel(void)
Error
This method de-initializes the timer object, and prevents this timer from firing if it hasn't done so.
Start(uint32_t aDelayMilliseconds, OnCompleteFunct aOnComplete, void *aAppState)
Error
This method registers an one-shot timer with the underlying timer mechanism provided by the platform.

Public types

Epoch

uint64_t Epoch

Represents an epoch in the local system timescale, usually the POSIX timescale.

The units are dependent on the context. If used with values returned by GetCurrentEpoch, the units are milliseconds.

OnCompleteFunct

void(* OnCompleteFunct)(Layer *aLayer, void *aAppState, Error aError)

Public attributes

OnComplete

OnCompleteFunct OnComplete

Public static functions

GetCurrentEpoch

Epoch GetCurrentEpoch(
  void
)

This method returns the current epoch, corrected by system sleep with the system timescale, in milliseconds.

DEPRECATED Please use System::Layer::GetClock_MonotonicMS() instead.

Details
Returns
A timestamp in milliseconds.

GetStatistics

void GetStatistics(
  nl::Weave::System::Stats::count_t & aNumInUse,
  nl::Weave::System::Stats::count_t & aHighWatermark
)

IsEarlierEpoch

bool IsEarlierEpoch(
  const Epoch & first,
  const Epoch & second
)

Compares two Timer::Epoch values and returns true if the first value is earlier than the second value.

A static API that gets called to compare 2 time values. This API attempts to account for timer wrap by assuming that the difference between the 2 input values will only be more than half the Epoch scalar range if a timer wrap has occurred between the 2 samples.

Details
Returns
true if the first param is earlier than the second, false otherwise.

Public functions

Cancel

Error Cancel(
  void
)

This method de-initializes the timer object, and prevents this timer from firing if it hasn't done so.

Details
Return Values
WEAVE_SYSTEM_NO_ERROR
Unconditionally.

Start

Error Start(
  uint32_t aDelayMilliseconds,
  OnCompleteFunct aOnComplete,
  void *aAppState
)

This method registers an one-shot timer with the underlying timer mechanism provided by the platform.

Details
Parameters
[in] aDelayMilliseconds
The number of milliseconds before this timer fires
[in] aOnComplete
A pointer to the callback function when this timer fires
[in] aAppState
An arbitrary pointer to be passed into onComplete when this timer fires
Return Values
WEAVE_SYSTEM_NO_ERROR
Unconditionally.