From 1cfc22db0c3141ca75afe8fed3bfaaa83da4038e Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Fri, 10 Apr 2015 22:10:02 +0900 Subject: [PATCH] Update the provider state. previously there are only two states. PAUSED/RESUMED but for supporting the watch/widget core, their life-cycles, we need to add UNKNOWN state(created) [model] Redwood,Kiran,B3(Wearable) [binary_type] AP [customer] Docomo/Orange/ATT/Open [issue#] N/A [problem] [cause] [solution] [team] HomeTF [request] [horizontal_expansion] Change-Id: Ie017bebe882b662b57098ab2ae4ef82e10c37a8b --- widget_provider_app/src/client.c | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/widget_provider_app/src/client.c b/widget_provider_app/src/client.c index 2756f86..9ad0efd 100644 --- a/widget_provider_app/src/client.c +++ b/widget_provider_app/src/client.c @@ -52,11 +52,17 @@ int errno; +enum state { + STATE_UNKNOWN = 0, + STATE_RESUMED = 1, + STATE_PAUSED = 2 +}; + struct item { char *id; void *update_timer; struct widget_provider_event_callback *table; - int paused; + enum state state; void *data; Eina_List *handle_list; }; @@ -73,7 +79,7 @@ static struct info { char *hw_acceleration; Ecore_Timer *ping_timer; Eina_List *inst_list; - int paused; + enum state state; int initialized; Eina_List *internal_item_list; Eina_List *widget_pre_callback_list[WIDGET_PRE_CALLBACK_COUNT]; @@ -84,7 +90,7 @@ static struct info { .hw_acceleration = NULL, .ping_timer = NULL, .inst_list = NULL, - .paused = 1, + .state = STATE_UNKNOWN, .initialized = 0, .internal_item_list = NULL, .widget_pre_callback_list = { NULL, }, @@ -305,7 +311,7 @@ static struct item *instance_create(const char *id, double period, struct widget } } - item->paused = 1; + item->state = STATE_UNKNOWN; s_info.inst_list = eina_list_append(s_info.inst_list, item); return item; @@ -569,15 +575,15 @@ static int method_pause(struct widget_event_arg *arg, void *data) Eina_List *l; struct item *inst; - if (s_info.paused == 1) { + if (s_info.state == STATE_PAUSED) { DbgPrint("Already paused\n"); return WIDGET_ERROR_NONE; } - s_info.paused = 1; + s_info.state = STATE_PAUSED; EINA_LIST_FOREACH(s_info.inst_list, l, inst) { - if (inst->paused == 1) { + if (inst->state != STATE_RESUMED) { continue; } @@ -603,15 +609,15 @@ static int method_resume(struct widget_event_arg *arg, void *data) Eina_List *l; struct item *inst; - if (s_info.paused == 0) { + if (s_info.state == STATE_RESUMED) { DbgPrint("Already resumed\n"); return WIDGET_ERROR_NONE; } - s_info.paused = 0; + s_info.state = STATE_RESUMED; EINA_LIST_FOREACH(s_info.inst_list, l, inst) { - if (inst->paused == 1) { + if (inst->state != STATE_RESUMED) { continue; } @@ -818,14 +824,14 @@ static int method_widget_pause(struct widget_event_arg *arg, void *data) return WIDGET_ERROR_INVALID_PARAMETER; } - if (inst->paused == 1) { + if (inst->state == STATE_PAUSED) { DbgPrint("Already paused\n"); return WIDGET_ERROR_ALREADY_EXIST; } - inst->paused = 1; + inst->state = STATE_PAUSED; - if (s_info.paused == 1) { + if (s_info.state != STATE_RESUMED) { return WIDGET_ERROR_NONE; } @@ -852,13 +858,13 @@ static int method_widget_resume(struct widget_event_arg *arg, void *data) return WIDGET_ERROR_INVALID_PARAMETER; } - if (inst->paused == 0) { + if (inst->state == STATE_RESUMED) { return WIDGET_ERROR_ALREADY_EXIST; } - inst->paused = 0; + inst->state = STATE_RESUMED; - if (s_info.paused == 1) { + if (s_info.state != STATE_RESUMED) { return WIDGET_ERROR_NONE; } -- 2.7.4