AWS IoT Embedded C Device SDK
Typedefs | Functions
timer_interface.h File Reference

Timer interface definition for MQTT client. More...

#include "timer_platform.h"
#include <stdint.h>
#include <stdbool.h>

Go to the source code of this file.

Typedefs

typedef struct Timer Timer
 Timer Type. More...
 

Functions

bool has_timer_expired (Timer *)
 Check if a timer is expired. More...
 
void countdown_ms (Timer *, uint32_t)
 Create a timer (milliseconds) More...
 
void countdown_sec (Timer *, uint32_t)
 Create a timer (seconds) More...
 
uint32_t left_ms (Timer *)
 Check the time remaining on a given timer. More...
 
void init_timer (Timer *)
 Initialize a timer. More...
 

Detailed Description

Defines an interface to timers that can be used by other system components. MQTT client requires timers to handle timeouts and MQTT keep alive. Starting point for porting the SDK to the timer hardware layer of a new platform.

Typedef Documentation

typedef struct Timer Timer

The platform specific timer header that defines the Timer struct Forward declaration of a timer struct. The definition of this struct is platform dependent. When porting to a new platform add this definition in "timer_<platform>.h" and include that file above.

Function Documentation

void countdown_ms ( Timer ,
uint32_t   
)

Sets the timer to expire in a specified number of milliseconds.

Parameters
Timer- pointer to the timer to be set to expire in milliseconds
uint32_t- set the timer to expire in this number of milliseconds
void countdown_sec ( Timer ,
uint32_t   
)

Sets the timer to expire in a specified number of seconds.

Parameters
Timer- pointer to the timer to be set to expire in seconds
uint32_t- set the timer to expire in this number of seconds
bool has_timer_expired ( Timer )

Call this function passing in a timer to check if that timer has expired.

Parameters
Timer- pointer to the timer to be checked for expiration
Returns
bool - true = timer expired, false = timer not expired
void init_timer ( Timer )

Performs any initialization required to the timer passed in.

Parameters
Timer- pointer to the timer to be initialized
uint32_t left_ms ( Timer )

Checks the input timer and returns the number of milliseconds remaining on the timer.

Parameters
Timer- pointer to the timer to be set to checked
Returns
int - milliseconds left on the countdown timer