Timer interface definition for MQTT client.
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.
#include "AWS_SDK/aws_iot_src/protocol/mqtt/aws_iot_embedded_client_wrapper/platform/common/timer_platform.h"
Typedefs | |
typedef struct Timer | Timer |
Timer Type. More... | |
Functions | |
void | countdown (Timer *, unsigned int) |
Create a timer (seconds) More... | |
void | countdown_ms (Timer *, unsigned int) |
Create a timer (milliseconds) More... | |
char | expired (Timer *) |
Check if a timer is expired. More... | |
void | InitTimer (Timer *) |
Initialize a timer. More... | |
int | left_ms (Timer *) |
Check the time remaining on a give timer. More... | |
Timer Type.
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.
void countdown | ( | Timer * | timer, |
unsigned int | timeout | ||
) |
Create a timer (seconds)
Sets the timer to expire in a specified number of seconds.
Timer | - pointer to the timer to be set to expire in seconds |
unsigned | int - set the timer to expire in this number of seconds |
Create a timer (seconds)
[in] | timer | Timer to be started. |
[in] | timeout | timeout in seconds. |
References Timer::end_time, getTimeInMillis(), and Timer::offset.
Referenced by addToAckWaitList(), cycle(), keepalive(), MQTTConnect(), and subscribeToShadowActionAcks().
void countdown_ms | ( | Timer * | timer, |
unsigned int | timeout | ||
) |
Create a timer (milliseconds)
Sets the timer to expire in a specified number of milliseconds.
Timer | - pointer to the timer to be set to expire in milliseconds |
unsigned | int - set the timer to expire in this number of milliseconds |
Create a timer (milliseconds)
[in] | timer | Timer to be started. |
[in] | timeout | timeout in milliseconds. |
References Timer::end_time, getTimeInMillis(), and Timer::offset.
Referenced by handleReconnect(), keepalive(), MQTTConnect(), MQTTDisconnect(), MQTTPublish(), MQTTResubscribe(), MQTTSubscribe(), MQTTUnsubscribe(), and MQTTYield().
char expired | ( | Timer * | timer | ) |
Check if a timer is expired.
Call this function passing in a timer to check if that timer has expired.
Timer | - pointer to the timer to be checked for expiration |
Check if a timer is expired.
[in] | timer | Timer to be checked. |
References Timer::end_time, getTimeInMillis(), and Timer::offset.
Referenced by HandleExpiredResponseCallbacks(), handleReconnect(), keepalive(), MQTTYield(), sendPacket(), subscribeToShadowActionAcks(), and waitfor().
void InitTimer | ( | Timer * | timer | ) |
Initialize a timer.
Performs any initialization required to the timer passed in.
Timer | - pointer to the timer to be initialized |
Initialize a timer.
[in] | timer | Timer to be intialized. |
References Timer::end_time, and Timer::offset.
Referenced by addToAckWaitList(), keepalive(), MQTTClient(), MQTTConnect(), MQTTDisconnect(), MQTTPublish(), MQTTResubscribe(), MQTTSubscribe(), MQTTUnsubscribe(), MQTTYield(), and subscribeToShadowActionAcks().
int left_ms | ( | Timer * | timer | ) |
Check the time remaining on a give timer.
Checks the input timer and returns the number of milliseconds remaining on the timer.
Timer | - pointer to the timer to be set to checked |
Check the time remaining on a give timer.
[in] | timer | Timer to be started. |
References Timer::end_time, getTimeInMillis(), and Timer::offset.
Referenced by readPacket(), and sendPacket().