contentLister/inc/pincodeIdleTime.h File Reference

content lister - accumulate time of being idle More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _accumulateIdleTime_t

Defines

#define TIMEOUT_INTERNAL   100

Typedefs

typedef void on_threshold_t ()
typedef struct
_accumulateIdleTime_t 
accumulateIdleTime_t

Functions

void accumulate_idle_time_begin ()
void accumulate_idle_time_end ()
void accumulate_idle_time_set_threshold (gint threshold)
void accumulate_idle_time_set_callback (on_threshold_t *func)
void accumulate_idle_time_reset ()
gint accumulate_idle_time_get ()


Detailed Description

content lister - accumulate time of being idle

accumulate time of being idle, when being idle for a long time, reach the threshold, call callback function of "accumulateIdleTime_t" to do something special, then end the accumulate idle time

if no threshold, just accumulating idle time, don't call callback function

in some case, e.g updateMgr and download Mgr, if user sets threshold to be 5 mins, but downloading process needs more time which can not be forecasted, in this case, we need no threshold temporily

in pincode's case, "accumulatedIdleTime_t" is based on window application. when create widget, begin to accumulate idle time at the same time. when received key or button event, reset 'accumulate idle time' to zero

Copyright (C) 2006-2008 iRex Technologies B.V.

Definition in file pincodeIdleTime.h.


Define Documentation

#define TIMEOUT_INTERNAL   100

Definition at line 47 of file pincodeIdleTime.h.


Typedef Documentation

Definition at line 51 of file pincodeIdleTime.h.

typedef void on_threshold_t()

Definition at line 49 of file pincodeIdleTime.h.


Function Documentation

void accumulate_idle_time_begin (  ) 

begin to accumulate idle time

Parameters:
- 
Returns:

Definition at line 53 of file pincodeIdleTime.c.

00054 {
00055     CL_LOGPRINTF("ACCUMULATE_IDLE_TIME_BEGIN");
00056     accumulateIdleTime_t *idle_time = NULL;
00057 
00058     if (NULL != g_accumulate_idle_time)
00059     {
00060         accumulate_idle_time_end();
00061     }
00062 
00063     idle_time = g_new0(accumulateIdleTime_t, 1);
00064     g_return_if_fail(NULL != idle_time);
00065 
00066 // set the default value
00067     idle_time->milliseconds = 0;
00068     idle_time->threshold = 0;   // default no threshold
00069     idle_time->callback_on_threshold = NULL;
00070     idle_time->internal = TIMEOUT_INTERNAL;
00071 //    idle_time->timeout_handler_id = g_timeout_add( idle_time->internal,
00072 //                                                   accumulate_idle_time_increase,
00073 //                                                   (gpointer) idle_time->internal );
00074 
00075     g_accumulate_idle_time = idle_time;
00076 }

Here is the call graph for this function:

void accumulate_idle_time_end (  ) 

stop accumulating idle time

Parameters:
- 
Returns:

Definition at line 78 of file pincodeIdleTime.c.

00079 {
00080     CL_LOGPRINTF("ACCUMULATE_IDLE_TIME_END");
00081 
00082     if (g_accumulate_idle_time)
00083     {
00084         if (g_accumulate_idle_time->timeout_handler_id)
00085         {
00086             g_source_remove(g_accumulate_idle_time->timeout_handler_id);
00087         }
00088         g_free(g_accumulate_idle_time);
00089         g_accumulate_idle_time = NULL;
00090     }
00091 }

gint accumulate_idle_time_get (  ) 

get the milliseconds for being idle

Parameters:
- 
Returns:
the milliseconds for being idle

Definition at line 165 of file pincodeIdleTime.c.

00166 {
00167     gint ms = 0;
00168     accumulateIdleTime_t *idle_time = g_accumulate_idle_time;
00169 
00170     if (idle_time)
00171     {
00172         ms = idle_time->milliseconds;
00173     }
00174     return ms;
00175 }

void accumulate_idle_time_reset (  ) 

reset 'accumulate idle time' to zero

Parameters:
- 
Returns:

Definition at line 117 of file pincodeIdleTime.c.

00118 {
00119     CL_LOGPRINTF("ACCUMULATE_IDLE_TIME_SET");
00120 
00121     accumulate_idle_time_set(0);
00122 }

Here is the call graph for this function:

void accumulate_idle_time_set_callback ( on_threshold_t func  ) 

set callback function on threshold of 'accumulateIdleTime_t" when idle time reachs the threshold, call it to do something sepcial

Parameters:
- func callback function address
Returns:

Definition at line 106 of file pincodeIdleTime.c.

00107 {
00108     accumulateIdleTime_t *idle_time = g_accumulate_idle_time;
00109 
00110     if (idle_time)
00111     {
00112         idle_time->callback_on_threshold = func;
00113     }
00114 }

void accumulate_idle_time_set_threshold ( gint  threshold  ) 

set threshold of 'accumulateIdleTime_t'

Parameters:
- threshold- after being idle for 'threshold' milliseconds, call callback function on threshold if threshold set zero, that means no threshold
Returns:

Definition at line 95 of file pincodeIdleTime.c.

00096 {
00097     accumulateIdleTime_t *idle_time = g_accumulate_idle_time;
00098 
00099     if (idle_time)
00100     {
00101         idle_time->threshold = threshold;
00102     }
00103 }


Generated on Sun Dec 14 17:12:58 2008 by  doxygen 1.5.6