Tizen Native API

Ecore poller provides infrastructure for the creation of pollers.

Pollers are, in essence, callbacks that share a single timer per type. Because not all pollers need to be called at the same frequency the user may specify the frequency in ticks(each expiration of the shared timer is called a tick, in ecore poller parlance) for each added poller. Ecore pollers should only be used when the poller doesn't have specific requirements on the exact times to poll.

This architecture means that the main loop is only woken up once to handle all pollers of that type, this saves power as the CPU has more of a chance to go into a low power state the longer it is asleep, so this should be used in situations where power usage is a concern.

For now only 1 core poller type is supported: ECORE_POLLER_CORE. The default interval for ECORE_POLLER_CORE is 0.125(or 1/8th) second.

The creation of a poller is extremely simple and only requires one line:

 ecore_poller_add(ECORE_POLLER_CORE, 1, my_poller_function, NULL);

This sample creates a poller to call my_poller_function at every tick with NULL as data.

Functions

void ecore_poller_poll_interval_set (Ecore_Poller_Type type, double poll_time)
 Sets the time(in seconds) between ticks for the given poller type.
double ecore_poller_poll_interval_get (Ecore_Poller_Type type)
 Gets the time(in seconds) between ticks for the given poller type.
Eina_Bool ecore_poller_poller_interval_set (Ecore_Poller *poller, int interval)
 Changes the polling interval rate of poller.
int ecore_poller_poller_interval_get (Ecore_Poller *poller)
 Gets the polling interval rate of poller.
Ecore_Pollerecore_poller_add (Ecore_Poller_Type type, int interval, Ecore_Task_Cb func, const void *data)
 Creates a poller to call the given function at a particular tick interval.
void * ecore_poller_del (Ecore_Poller *poller)
 Deletes the specified poller from the timer list.

Typedefs

typedef enum _Ecore_Poller_Type Ecore_Poller_Type
 typedef to enum _Ecore_Poller_Type
typedef struct _Ecore_Poller Ecore_Poller
 A handle for pollers.

Enumeration Type Documentation

Enumeration that defines the frequency of ticks for the poller.

Enumerator:
ECORE_POLLER_CORE 

The core poller interval


Function Documentation

Ecore_Poller* ecore_poller_add ( Ecore_Poller_Type  type,
int  interval,
Ecore_Task_Cb  func,
const void *  data 
)

Creates a poller to call the given function at a particular tick interval.

This function adds func as a poller callback that is called every interval ticks together with other pollers of type type. func is passed the data pointer as a parameter.

Since :
2.3.1
Remarks:
The interval must be between 1 and 32768 inclusive, and must be a power of 2 (i.e. 1, 2, 4, 8, 16, ... 16384, 32768). The exact tick in which func is called is undefined, as only the interval between calls can be defined. Ecore endeavors to keep pollers synchronized and calls as many in 1 wakeup event as possible. If interval is not a power of 2, the closest power of 2 greater than interval is used.
When the poller func is called, it must return a value of either ECORE_CALLBACK_RENEW(or 1) or ECORE_CALLBACK_CANCEL(or 0). If it returns 1, it is called again at the next tick, or if it returns 0 it is deleted automatically making any references/handles for it invalid.
Parameters:
[in]typeThe ticker type to attach the poller to
Must be ECORE_POLLER_CORE.
[in]intervalThe poll interval
[in]funcThe poller function
[in]dataThe data to pass to func when it is called
Returns:
A poller object on success, otherwise NULL on failure
void* ecore_poller_del ( Ecore_Poller poller)

Deletes the specified poller from the timer list.

Since :
2.3.1
Remarks:
poller must be a valid handle. If the poller function has already returned 0, the handle is no longer valid (and does not need to be deleted).
Parameters:
[in]pollerThe poller to delete
Returns:
The data pointer set for the timer when ecore_poller_add is called on success, otherwise NULL on failure

Gets the time(in seconds) between ticks for the given poller type.

This gets the time between ticks of the specified poller timer.

Since :
2.3.1
Parameters:
[in]typeThe poller type to query
Returns:
The time in seconds between ticks of the poller timer
void ecore_poller_poll_interval_set ( Ecore_Poller_Type  type,
double  poll_time 
)

Sets the time(in seconds) between ticks for the given poller type.

This adjusts the time between ticks of the given timer type defined by type to the time period defined by poll_time.

Since :
2.3.1
Parameters:
[in]typeThe poller type to adjust
[in]poll_timeThe time(in seconds) between ticks of the timer

Gets the polling interval rate of poller.

This returns a poller's polling interval, otherwise 0 on error.

Since :
2.3.1
Parameters:
[in]pollerThe Ecore_Poller to change the interval of
Returns:
The interval, in ticks, that poller polls at
Eina_Bool ecore_poller_poller_interval_set ( Ecore_Poller poller,
int  interval 
)

Changes the polling interval rate of poller.

This allows the changing of a poller's polling interval. It is useful when you want to alter a poll rate without deleting and re-creating a poller.

Since :
2.3.1
Parameters:
[in]pollerThe Ecore_Poller to change the interval of
[in]intervalThe tick interval to set, must be a power of 2 and <= 32768
Returns:
true on success, otherwise false on failure