\hypertarget{group__Ecore__Poller__Group}{}\section{Ecore Poll functions}
\label{group__Ecore__Poller__Group}\index{Ecore Poll functions@{Ecore Poll functions}}


Ecore poller provides infrastructure for the creation of pollers.  


\begin{DoxyCompactItemize}
\item 
enum \mbox{\hyperlink{group__Ecore__Poller__Group_ga40d67f547376373ee34363b825874088}{Ecore\+\_\+\+Poller\+\_\+\+Type}} \{ \mbox{\hyperlink{group__Ecore__Poller__Group_gga40d67f547376373ee34363b825874088a022dfec751388e380cf01621bd0f797f}{E\+C\+O\+R\+E\+\_\+\+P\+O\+L\+L\+E\+R\+\_\+\+C\+O\+RE}} = 0
 \}
\item 
\mbox{\Hypertarget{group__Ecore__Poller__Group_ga0e967ed90714bea99df9ac0337b414bb}\label{group__Ecore__Poller__Group_ga0e967ed90714bea99df9ac0337b414bb}} 
typedef struct \+\_\+\+Ecore\+\_\+\+Poller {\bfseries Ecore\+\_\+\+Poller}
\item 
Ecore\+\_\+\+Poller $\ast$ \mbox{\hyperlink{group__Ecore__Poller__Group_gadd8ee7135864da4313bc88faa0a2d7c9}{ecore\+\_\+poller\+\_\+add}} (\mbox{\hyperlink{group__Ecore__Poller__Group_ga40d67f547376373ee34363b825874088}{Ecore\+\_\+\+Poller\+\_\+\+Type}} type, int interval, \mbox{\hyperlink{group__Ecore__Main__Loop__Group_ga8a36ef1ac24bfa317a7826617264e530}{Ecore\+\_\+\+Task\+\_\+\+Cb}} func, const void $\ast$data)
\begin{DoxyCompactList}\small\item\em Creates a poller to call the given function at a particular tick interval. \end{DoxyCompactList}\item 
void $\ast$ \mbox{\hyperlink{group__Ecore__Poller__Group_ga52e6245cfbceaed9b721a1addd29d311}{ecore\+\_\+poller\+\_\+del}} (Ecore\+\_\+\+Poller $\ast$poller)
\begin{DoxyCompactList}\small\item\em Deletes the specified poller from the timer list. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{group__Ecore__Poller__Group_ga466dff0c7fb7eb0f5b4e5a3825fa10ac}{ecore\+\_\+poller\+\_\+poll\+\_\+interval\+\_\+set}} (\mbox{\hyperlink{group__Ecore__Poller__Group_ga40d67f547376373ee34363b825874088}{Ecore\+\_\+\+Poller\+\_\+\+Type}} type, double poll\+\_\+time)
\begin{DoxyCompactList}\small\item\em Sets the time(in seconds) between ticks for the given poller type. \end{DoxyCompactList}\item 
double \mbox{\hyperlink{group__Ecore__Poller__Group_ga72031680ab8f5385639389ac0591e272}{ecore\+\_\+poller\+\_\+poll\+\_\+interval\+\_\+get}} (\mbox{\hyperlink{group__Ecore__Poller__Group_ga40d67f547376373ee34363b825874088}{Ecore\+\_\+\+Poller\+\_\+\+Type}} type)
\begin{DoxyCompactList}\small\item\em Gets the time(in seconds) between ticks for the given poller type. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} \mbox{\hyperlink{group__Ecore__Poller__Group_gae9acf938d0e3b3ee84509d0c04ed628a}{ecore\+\_\+poller\+\_\+poller\+\_\+interval\+\_\+set}} (Ecore\+\_\+\+Poller $\ast$obj, int interval)
\begin{DoxyCompactList}\small\item\em Polling interval rate of the poller. \end{DoxyCompactList}\item 
int \mbox{\hyperlink{group__Ecore__Poller__Group_ga1c80d050bf17021f26ed531cd53ca510}{ecore\+\_\+poller\+\_\+poller\+\_\+interval\+\_\+get}} (const Ecore\+\_\+\+Poller $\ast$obj)
\begin{DoxyCompactList}\small\item\em Polling interval rate of the poller. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
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\textquotesingle{}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 will save power as the C\+PU has more of a chance to go into a low power state the longer it is asleep for, so this should be used in situations where power usage is a concern.

For now only 1 core poller type is supported\+: E\+C\+O\+R\+E\+\_\+\+P\+O\+L\+L\+E\+R\+\_\+\+C\+O\+RE, the default interval for E\+C\+O\+R\+E\+\_\+\+P\+O\+L\+L\+E\+R\+\_\+\+C\+O\+RE is 0.\+125(or 1/8th) second.

The creation of a poller is extremely simple and only requires one line\+: 
\begin{DoxyCode}
\mbox{\hyperlink{group__Ecore__Poller__Group_gadd8ee7135864da4313bc88faa0a2d7c9}{ecore\_poller\_add}}(\mbox{\hyperlink{group__Ecore__Poller__Group_gga40d67f547376373ee34363b825874088a022dfec751388e380cf01621bd0f797f}{ECORE\_POLLER\_CORE}}, 1, my\_poller\_function, NULL);
\end{DoxyCode}
 This sample creates a poller to call {\ttfamily my\+\_\+poller\+\_\+function} at every tick with {\ttfamily N\+U\+LL} as data.

Example\+: \begin{DoxyItemize}
\item \mbox{\hyperlink{ecore_poller_example_c}{ecore poller -\/ Repetitive polling tasks}} \end{DoxyItemize}


\subsection{Enumeration Type Documentation}
\mbox{\Hypertarget{group__Ecore__Poller__Group_ga40d67f547376373ee34363b825874088}\label{group__Ecore__Poller__Group_ga40d67f547376373ee34363b825874088}} 
\index{Ecore Poll functions@{Ecore Poll functions}!Ecore\+\_\+\+Poller\+\_\+\+Type@{Ecore\+\_\+\+Poller\+\_\+\+Type}}
\index{Ecore\+\_\+\+Poller\+\_\+\+Type@{Ecore\+\_\+\+Poller\+\_\+\+Type}!Ecore Poll functions@{Ecore Poll functions}}
\subsubsection{\texorpdfstring{Ecore\+\_\+\+Poller\+\_\+\+Type}{Ecore\_Poller\_Type}}
{\footnotesize\ttfamily enum \mbox{\hyperlink{group__Ecore__Poller__Group_ga40d67f547376373ee34363b825874088}{Ecore\+\_\+\+Poller\+\_\+\+Type}}}

\begin{DoxyEnumFields}{Enumerator}
\raisebox{\heightof{T}}[0pt][0pt]{\index{E\+C\+O\+R\+E\+\_\+\+P\+O\+L\+L\+E\+R\+\_\+\+C\+O\+RE@{E\+C\+O\+R\+E\+\_\+\+P\+O\+L\+L\+E\+R\+\_\+\+C\+O\+RE}!Ecore Poll functions@{Ecore Poll functions}}\index{Ecore Poll functions@{Ecore Poll functions}!E\+C\+O\+R\+E\+\_\+\+P\+O\+L\+L\+E\+R\+\_\+\+C\+O\+RE@{E\+C\+O\+R\+E\+\_\+\+P\+O\+L\+L\+E\+R\+\_\+\+C\+O\+RE}}}\mbox{\Hypertarget{group__Ecore__Poller__Group_gga40d67f547376373ee34363b825874088a022dfec751388e380cf01621bd0f797f}\label{group__Ecore__Poller__Group_gga40d67f547376373ee34363b825874088a022dfec751388e380cf01621bd0f797f}} 
E\+C\+O\+R\+E\+\_\+\+P\+O\+L\+L\+E\+R\+\_\+\+C\+O\+RE&The core poller interval. \\
\hline

\end{DoxyEnumFields}


\subsection{Function Documentation}
\mbox{\Hypertarget{group__Ecore__Poller__Group_gadd8ee7135864da4313bc88faa0a2d7c9}\label{group__Ecore__Poller__Group_gadd8ee7135864da4313bc88faa0a2d7c9}} 
\index{Ecore Poll functions@{Ecore Poll functions}!ecore\+\_\+poller\+\_\+add@{ecore\+\_\+poller\+\_\+add}}
\index{ecore\+\_\+poller\+\_\+add@{ecore\+\_\+poller\+\_\+add}!Ecore Poll functions@{Ecore Poll functions}}
\subsubsection{\texorpdfstring{ecore\+\_\+poller\+\_\+add()}{ecore\_poller\_add()}}
{\footnotesize\ttfamily Ecore\+\_\+\+Poller$\ast$ ecore\+\_\+poller\+\_\+add (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Ecore__Poller__Group_ga40d67f547376373ee34363b825874088}{Ecore\+\_\+\+Poller\+\_\+\+Type}}}]{type,  }\item[{int}]{interval,  }\item[{\mbox{\hyperlink{group__Ecore__Main__Loop__Group_ga8a36ef1ac24bfa317a7826617264e530}{Ecore\+\_\+\+Task\+\_\+\+Cb}}}]{func,  }\item[{const void $\ast$}]{data }\end{DoxyParamCaption})}



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


\begin{DoxyParams}{Parameters}
{\em type} & The ticker type to attach the poller to. Must be E\+C\+O\+R\+E\+\_\+\+P\+O\+L\+L\+E\+R\+\_\+\+C\+O\+RE. \\
\hline
{\em interval} & The poll interval. \\
\hline
{\em func} & The poller function. \\
\hline
{\em data} & Data to pass to {\itshape func} when it is called. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A poller object on success, {\ttfamily N\+U\+LL} otherwise.
\end{DoxyReturn}
This function adds {\itshape func} as a poller callback that will be called every {\itshape interval} ticks together with other pollers of type {\itshape type}. {\itshape func} will be passed the {\ttfamily data} pointer as a parameter.

The {\ttfamily 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 {\itshape func} will be called is undefined, as only the interval between calls can be defined. Ecore will endeavor to keep pollers synchronized and to call as many in 1 wakeup event as possible. If {\itshape interval} is not a power of two, the closest power of 2 greater than {\itshape interval} will be used.

When the poller {\ttfamily func} is called, it must return a value of either {\ttfamily E\+C\+O\+R\+E\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+R\+E\+N\+EW}(or {\ttfamily 1}) or {\ttfamily E\+C\+O\+R\+E\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+A\+N\+C\+EL}(or {\ttfamily 0}). If it returns {\ttfamily 1}, it will be called again at the next tick, or if it returns {\ttfamily 0} it will be deleted automatically making any references/handles for it invalid. \begin{Desc}
\item[Examples\+: ]\par
\mbox{\hyperlink{ecore_poller_example_8c-example}{ecore\+\_\+poller\+\_\+example.\+c}}.\end{Desc}


References E\+I\+N\+A\+\_\+\+I\+N\+L\+I\+S\+T\+\_\+\+G\+ET, eina\+\_\+inlist\+\_\+prepend(), E\+I\+N\+A\+\_\+\+M\+A\+I\+N\+\_\+\+L\+O\+O\+P\+\_\+\+C\+H\+E\+C\+K\+\_\+\+R\+E\+T\+U\+R\+N\+\_\+\+V\+AL, eina\+\_\+main\+\_\+loop\+\_\+is(), E\+I\+N\+A\+\_\+\+U\+N\+L\+I\+K\+E\+LY, and E\+RR.



Referenced by ecore\+\_\+init(), and elm\+\_\+prefs\+\_\+data\+\_\+autosave\+\_\+set().

\mbox{\Hypertarget{group__Ecore__Poller__Group_ga52e6245cfbceaed9b721a1addd29d311}\label{group__Ecore__Poller__Group_ga52e6245cfbceaed9b721a1addd29d311}} 
\index{Ecore Poll functions@{Ecore Poll functions}!ecore\+\_\+poller\+\_\+del@{ecore\+\_\+poller\+\_\+del}}
\index{ecore\+\_\+poller\+\_\+del@{ecore\+\_\+poller\+\_\+del}!Ecore Poll functions@{Ecore Poll functions}}
\subsubsection{\texorpdfstring{ecore\+\_\+poller\+\_\+del()}{ecore\_poller\_del()}}
{\footnotesize\ttfamily void$\ast$ ecore\+\_\+poller\+\_\+del (\begin{DoxyParamCaption}\item[{Ecore\+\_\+\+Poller $\ast$}]{poller }\end{DoxyParamCaption})}



Deletes the specified poller from the timer list. 


\begin{DoxyParams}{Parameters}
{\em poller} & The poller to delete. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The data pointer set for the timer when \mbox{\hyperlink{group__Ecore__Poller__Group_gadd8ee7135864da4313bc88faa0a2d7c9}{ecore\+\_\+poller\+\_\+add}} was called on success, {\ttfamily N\+U\+LL} otherwise.
\end{DoxyReturn}
\begin{DoxyNote}{Note}
{\itshape poller} must be a valid handle. If the poller function has already returned {\ttfamily 0}, the handle is no longer valid (and does not need to be deleted). 
\end{DoxyNote}
\begin{Desc}
\item[Examples\+: ]\par
\mbox{\hyperlink{ecore_poller_example_8c-example}{ecore\+\_\+poller\+\_\+example.\+c}}.\end{Desc}


References E\+I\+N\+A\+\_\+\+M\+A\+I\+N\+\_\+\+L\+O\+O\+P\+\_\+\+C\+H\+E\+C\+K\+\_\+\+R\+E\+T\+U\+R\+N\+\_\+\+V\+AL.



Referenced by elm\+\_\+prefs\+\_\+data\+\_\+autosave\+\_\+set(), and elm\+\_\+prefs\+\_\+data\+\_\+save().

\mbox{\Hypertarget{group__Ecore__Poller__Group_ga466dff0c7fb7eb0f5b4e5a3825fa10ac}\label{group__Ecore__Poller__Group_ga466dff0c7fb7eb0f5b4e5a3825fa10ac}} 
\index{Ecore Poll functions@{Ecore Poll functions}!ecore\+\_\+poller\+\_\+poll\+\_\+interval\+\_\+set@{ecore\+\_\+poller\+\_\+poll\+\_\+interval\+\_\+set}}
\index{ecore\+\_\+poller\+\_\+poll\+\_\+interval\+\_\+set@{ecore\+\_\+poller\+\_\+poll\+\_\+interval\+\_\+set}!Ecore Poll functions@{Ecore Poll functions}}
\subsubsection{\texorpdfstring{ecore\+\_\+poller\+\_\+poll\+\_\+interval\+\_\+set()}{ecore\_poller\_poll\_interval\_set()}}
{\footnotesize\ttfamily void ecore\+\_\+poller\+\_\+poll\+\_\+interval\+\_\+set (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Ecore__Poller__Group_ga40d67f547376373ee34363b825874088}{Ecore\+\_\+\+Poller\+\_\+\+Type}}}]{type,  }\item[{double}]{poll\+\_\+time }\end{DoxyParamCaption})}



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


\begin{DoxyParams}{Parameters}
{\em type} & The poller type to adjust. \\
\hline
{\em poll\+\_\+time} & The time(in seconds) between ticks of the timer.\\
\hline
\end{DoxyParams}
This will adjust the time between ticks of the given timer type defined by {\ttfamily type} to the time period defined by {\ttfamily poll\+\_\+time}. \begin{Desc}
\item[Examples\+: ]\par
\mbox{\hyperlink{ecore_poller_example_8c-example}{ecore\+\_\+poller\+\_\+example.\+c}}.\end{Desc}


References E\+I\+N\+A\+\_\+\+M\+A\+I\+N\+\_\+\+L\+O\+O\+P\+\_\+\+C\+H\+E\+C\+K\+\_\+\+R\+E\+T\+U\+RN, and E\+RR.

\mbox{\Hypertarget{group__Ecore__Poller__Group_ga72031680ab8f5385639389ac0591e272}\label{group__Ecore__Poller__Group_ga72031680ab8f5385639389ac0591e272}} 
\index{Ecore Poll functions@{Ecore Poll functions}!ecore\+\_\+poller\+\_\+poll\+\_\+interval\+\_\+get@{ecore\+\_\+poller\+\_\+poll\+\_\+interval\+\_\+get}}
\index{ecore\+\_\+poller\+\_\+poll\+\_\+interval\+\_\+get@{ecore\+\_\+poller\+\_\+poll\+\_\+interval\+\_\+get}!Ecore Poll functions@{Ecore Poll functions}}
\subsubsection{\texorpdfstring{ecore\+\_\+poller\+\_\+poll\+\_\+interval\+\_\+get()}{ecore\_poller\_poll\_interval\_get()}}
{\footnotesize\ttfamily double ecore\+\_\+poller\+\_\+poll\+\_\+interval\+\_\+get (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Ecore__Poller__Group_ga40d67f547376373ee34363b825874088}{Ecore\+\_\+\+Poller\+\_\+\+Type}}}]{type }\end{DoxyParamCaption})}



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


\begin{DoxyParams}{Parameters}
{\em type} & The poller type to query. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The time in seconds between ticks of the poller timer.
\end{DoxyReturn}
This will get the time between ticks of the specified poller timer. 

References E\+I\+N\+A\+\_\+\+M\+A\+I\+N\+\_\+\+L\+O\+O\+P\+\_\+\+C\+H\+E\+C\+K\+\_\+\+R\+E\+T\+U\+R\+N\+\_\+\+V\+AL.

\mbox{\Hypertarget{group__Ecore__Poller__Group_gae9acf938d0e3b3ee84509d0c04ed628a}\label{group__Ecore__Poller__Group_gae9acf938d0e3b3ee84509d0c04ed628a}} 
\index{Ecore Poll functions@{Ecore Poll functions}!ecore\+\_\+poller\+\_\+poller\+\_\+interval\+\_\+set@{ecore\+\_\+poller\+\_\+poller\+\_\+interval\+\_\+set}}
\index{ecore\+\_\+poller\+\_\+poller\+\_\+interval\+\_\+set@{ecore\+\_\+poller\+\_\+poller\+\_\+interval\+\_\+set}!Ecore Poll functions@{Ecore Poll functions}}
\subsubsection{\texorpdfstring{ecore\+\_\+poller\+\_\+poller\+\_\+interval\+\_\+set()}{ecore\_poller\_poller\_interval\_set()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} ecore\+\_\+poller\+\_\+poller\+\_\+interval\+\_\+set (\begin{DoxyParamCaption}\item[{Ecore\+\_\+\+Poller $\ast$}]{obj,  }\item[{int}]{interval }\end{DoxyParamCaption})}



Polling interval rate of the poller. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em interval} & The tick interval; must be a power of 2 and $<$= 32768.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
{\ttfamily true} on success, {\ttfamily false} on failure. 
\end{DoxyReturn}
\begin{Desc}
\item[Examples\+: ]\par
\mbox{\hyperlink{ecore_poller_example_8c-example}{ecore\+\_\+poller\+\_\+example.\+c}}.\end{Desc}


References E\+I\+N\+A\+\_\+\+F\+A\+L\+SE, E\+I\+N\+A\+\_\+\+I\+N\+L\+I\+S\+T\+\_\+\+G\+ET, eina\+\_\+inlist\+\_\+prepend(), eina\+\_\+inlist\+\_\+remove(), E\+I\+N\+A\+\_\+\+M\+A\+I\+N\+\_\+\+L\+O\+O\+P\+\_\+\+C\+H\+E\+C\+K\+\_\+\+R\+E\+T\+U\+R\+N\+\_\+\+V\+AL, and E\+I\+N\+A\+\_\+\+T\+R\+UE.

\mbox{\Hypertarget{group__Ecore__Poller__Group_ga1c80d050bf17021f26ed531cd53ca510}\label{group__Ecore__Poller__Group_ga1c80d050bf17021f26ed531cd53ca510}} 
\index{Ecore Poll functions@{Ecore Poll functions}!ecore\+\_\+poller\+\_\+poller\+\_\+interval\+\_\+get@{ecore\+\_\+poller\+\_\+poller\+\_\+interval\+\_\+get}}
\index{ecore\+\_\+poller\+\_\+poller\+\_\+interval\+\_\+get@{ecore\+\_\+poller\+\_\+poller\+\_\+interval\+\_\+get}!Ecore Poll functions@{Ecore Poll functions}}
\subsubsection{\texorpdfstring{ecore\+\_\+poller\+\_\+poller\+\_\+interval\+\_\+get()}{ecore\_poller\_poller\_interval\_get()}}
{\footnotesize\ttfamily int ecore\+\_\+poller\+\_\+poller\+\_\+interval\+\_\+get (\begin{DoxyParamCaption}\item[{const Ecore\+\_\+\+Poller $\ast$}]{obj }\end{DoxyParamCaption})}



Polling interval rate of the poller. 

\begin{DoxyReturn}{Returns}
The tick interval; must be a power of 2 and $<$= 32768. 
\end{DoxyReturn}


References E\+I\+N\+A\+\_\+\+M\+A\+I\+N\+\_\+\+L\+O\+O\+P\+\_\+\+C\+H\+E\+C\+K\+\_\+\+R\+E\+T\+U\+R\+N\+\_\+\+V\+AL.

