All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
le_timer.h File Reference

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)
 

Functions

le_timer_Ref_t le_timer_Create (const char *nameStr)
 
void le_timer_Delete (le_timer_Ref_t timerRef)
 
le_result_t le_timer_SetHandler (le_timer_Ref_t timerRef, le_timer_ExpiryHandler_t handlerRef)
 
le_result_t le_timer_SetInterval (le_timer_Ref_t timerRef, le_clk_Time_t interval)
 
le_result_t le_timer_SetRepeat (le_timer_Ref_t timerRef, uint32_t repeatCount)
 
le_result_t le_timer_SetContextPtr (le_timer_Ref_t timerRef, void *contextPtr)
 
void * le_timer_GetContextPtr (le_timer_Ref_t timerRef)
 
uint32_t le_timer_GetExpiryCount (le_timer_Ref_t timerRef)
 
le_result_t le_timer_Start (le_timer_Ref_t timerRef)
 
le_result_t le_timer_Stop (le_timer_Ref_t timerRef)
 
void le_timer_Restart (le_timer_Ref_t timerRef)
 
bool le_timer_IsRunning (le_timer_Ref_t timerRef)
 

Detailed Description

Legato Timer API include file.

Copyright (C) Sierra Wireless, Inc. 2014. All rights reserved. Use of this work is subject to license.

Typedef Documentation

typedef void(* le_timer_ExpiryHandler_t)(le_timer_Ref_t timerRef)

Prototype for timer expiry handler function.

Parameters
timerRefTimer 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
Reference to the timer object.
Parameters
[in]nameStrName 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]timerRefDelete 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]timerRefSet interval 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]timerRefSet interval 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]timerRefIs 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_NOT_POSSIBLE if the timer is currently running
Note
If an invalid timer object is given, the process exits.
Parameters
[in]timerRefSet interval for this timer object.
[in]contextPtrContext Pointer.
le_result_t le_timer_SetHandler ( le_timer_Ref_t  timerRef,
le_timer_ExpiryHandler_t  handlerRef 
)

Set the timer expiry handler function.

If the handler is NULL, then the previous handler will be removed.

Returns
  • LE_OK on success
  • LE_NOT_POSSIBLE if the timer is currently running
Note
If an invalid timer object is given, the process exits.
Parameters
[in]timerRefSet expiry handler for this timer object.
[in]handlerRefHandler 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.

Returns
  • LE_OK on success
  • LE_NOT_POSSIBLE if the timer is currently running
Note
If an invalid timer object is given, the process exits.
Parameters
[in]timerRefSet interval for this timer object.
[in]intervalTimer interval.
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_NOT_POSSIBLE if the timer is currently running
Note
If an invalid timer object is given, the process exits.
Parameters
[in]timerRefSet interval for this timer object.
[in]repeatCountNumber of times the timer will repeat.
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_NOT_POSSIBLE if the timer is already running
Note
If an invalid timer object is given, the process exits.
Parameters
[in]timerRefStart 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_NOT_POSSIBLE if the timer is not currently running
Note
If an invalid timer object is given, the process exits.
Parameters
[in]timerRefStop this timer object.