Go to the source code of this file.
Typedefs | |
typedef struct le_timer * | le_timer_Ref_t |
typedef void(* | le_timer_ExpiryHandler_t) (le_timer_Ref_t timerRef) |
Detailed Description
Legato Timer API include file.
Copyright (C) Sierra Wireless Inc.
Typedef Documentation
typedef void(* le_timer_ExpiryHandler_t) (le_timer_Ref_t timerRef) |
Prototype for timer expiry handler function.
- Parameters
-
timerRef Timer that has expired
typedef struct le_timer* le_timer_Ref_t |
Timer object. Created by le_timer_Create().
Function Documentation
le_timer_Ref_t le_timer_Create | ( | const char * | nameStr | ) |
Create the timer object.
- Returns
- A reference to the timer object.
- Parameters
-
[in] nameStr Name of the timer.
void le_timer_Delete | ( | le_timer_Ref_t | timerRef | ) |
Delete the timer object.
- Note
- If an invalid timer object is given, the process exits.
- Parameters
-
[in] timerRef Delete this timer object
void* le_timer_GetContextPtr | ( | le_timer_Ref_t | timerRef | ) |
Get context pointer for the timer.
This can be used when the timer expires to retrieve data that was previously set.
- Returns
- Context pointer, which could be NULL if it was not set.
- Note
- If an invalid timer object is given, the process exits.
- Parameters
-
[in] timerRef Get context pointer for this timer object
uint32_t le_timer_GetExpiryCount | ( | le_timer_Ref_t | timerRef | ) |
Get the expiry count of a timer.
The count is returned for currently running and idle timers. The expiry count is reset every time the timer is (re)started.
- Returns
- Expiry count, or zero if the timer has never expired.
- Note
- If an invalid timer object is given, the process exits.
- Parameters
-
[in] timerRef Get expiry count for this timer object
le_clk_Time_t le_timer_GetInterval | ( | le_timer_Ref_t | timerRef | ) |
Get the timer interval.
- Returns
- The timer interval. If it hasn't been set yet, {0, 0} will be returned.
- Note
- If an invalid timer object is given, the process exits.
- Parameters
-
[in] timerRef Timer object.
uint32_t le_timer_GetMsInterval | ( | le_timer_Ref_t | timerRef | ) |
Get the timer interval in milliseconds.
- Returns
- The timer interval (ms). If it hasn't been set yet, 0 will be returned.
- Note
- If an invalid timer object is given, the process exits.
- Parameters
-
[in] timerRef Timer object.
uint32_t le_timer_GetMsTimeRemaining | ( | le_timer_Ref_t | timerRef | ) |
Get the time remaining (in milliseconds) until the next scheduled expiry.
- Returns
- Time remaining (in milliseconds). 0 if the timer is stopped or if it has reached its expiry time.
- Note
- If an invalid timer object is given, the process exits.
- Parameters
-
[in] timerRef Get expiry count for this timer object
le_clk_Time_t le_timer_GetTimeRemaining | ( | le_timer_Ref_t | timerRef | ) |
Get the time remaining until the next scheduled expiry.
- Returns
- Time remaining. {0, 0} if the timer is stopped or if it has reached its expiry time.
- Note
- If an invalid timer object is given, the process exits.
- Parameters
-
[in] timerRef Get expiry count for this timer object
bool le_timer_IsRunning | ( | le_timer_Ref_t | timerRef | ) |
Is the timer currently running?
- Note
- If an invalid timer object is given, the process exits.
- Parameters
-
[in] timerRef Is this timer object currently running?
void le_timer_Restart | ( | le_timer_Ref_t | timerRef | ) |
Re-start the timer.
Start the given timer. If the timer is currently running, it will be stopped and then started. If the timer is not currently running, it will be started.
- Note
- If an invalid timer object is given, the process exits.
- Parameters
-
[in] timerRef (Re)start this timer object.
le_result_t le_timer_SetContextPtr | ( | le_timer_Ref_t | timerRef, |
void * | contextPtr | ||
) |
Set context pointer for the timer.
This can be used to pass data to the timer when it expires.
- Returns
- LE_OK on success
- LE_BUSY if the timer is currently running
- Note
- If an invalid timer object is given, the process exits.
- Parameters
-
[in] timerRef Set context pointer for this timer object [in] contextPtr Context Pointer.
le_result_t le_timer_SetHandler | ( | le_timer_Ref_t | timerRef, |
le_timer_ExpiryHandler_t | handlerFunc | ||
) |
Set the timer expiry handler function.
If the handler is NULL, then the previous handler will be removed.
- Returns
- LE_OK on success
- LE_BUSY if the timer is currently running
- Note
- If an invalid timer object is given, the process exits.
- Parameters
-
[in] timerRef Set expiry handler for this timer object. [in] handlerFunc Handler function to call on expiry.
le_result_t le_timer_SetInterval | ( | le_timer_Ref_t | timerRef, |
le_clk_Time_t | interval | ||
) |
Set the timer interval.
Timer will expire after the interval has elapsed since it was last started or restarted.
If the timer is running when the interval is changed and the new interval is shorter than the period of time since the timer last (re)started, the timer will expire immediately.
- Returns
- LE_OK on success
- Note
- If an invalid timer object is given, the process exits.
- Parameters
-
[in] timerRef Set interval for this timer object. [in] interval Timer interval.
le_result_t le_timer_SetMsInterval | ( | le_timer_Ref_t | timerRef, |
uint32_t | interval | ||
) |
Set the timer interval using milliseconds.
Timer will expire after the interval has elapsed since it was last started or restarted.
If the timer is running when the interval is changed and the new interval is shorter than the period of time since the timer last (re)started, the timer will expire immediately.
- Returns
- LE_OK on success
- Note
- If an invalid timer object is given, the process exits.
- Parameters
-
[in] timerRef Set interval for this timer object. [in] interval Timer interval in milliseconds.
le_result_t le_timer_SetRepeat | ( | le_timer_Ref_t | timerRef, |
uint32_t | repeatCount | ||
) |
Set how many times the timer will repeat.
Timer will repeat the given number of times. A value of 0 means repeat indefinitely. The default is 1, so that a one-shot timer is the default.
- Returns
- LE_OK on success
- LE_BUSY if the timer is currently running
- Note
- If an invalid timer object is given, the process exits.
- Parameters
-
[in] timerRef Set repeat count for this timer object [in] repeatCount Number of times the timer will repeat (0 = forever).
le_result_t le_timer_SetWakeup | ( | le_timer_Ref_t | timerRef, |
bool | wakeupEnabled | ||
) |
Configure if timer expiry will wake up a suspended system.
- Returns
- LE_OK on success
- LE_BUSY if the timer is currently running
- Note
- The default timer expiry behaviour will wake up the system. If an invalid timer object is given, the process exits.
- Parameters
-
[in] timerRef Disable system wake up for this timer object [in] wakeupEnabled Flag to determine timer will wakeup or not
le_result_t le_timer_Start | ( | le_timer_Ref_t | timerRef | ) |
Start the timer.
Start the given timer. The timer must not be currently running.
- Returns
- LE_OK on success
- LE_BUSY if the timer is already running
- Note
- If an invalid timer object is given, the process exits.
- Parameters
-
[in] timerRef Start this timer object.
le_result_t le_timer_Stop | ( | le_timer_Ref_t | timerRef | ) |
Stop the timer.
Stop the given timer. The timer must be running.
- Returns
- LE_OK on success
- LE_FAULT if the timer is not currently running
- Note
- If an invalid timer object is given, the process exits.
- Parameters
-
[in] timerRef Stop this timer object.