diff options
author | sunyeop.hwnag <sunyeop.hwang@samsung.com> | 2012-08-29 13:34:52 +0900 |
---|---|---|
committer | sunyeop.hwnag <sunyeop.hwang@samsung.com> | 2012-08-29 13:34:52 +0900 |
commit | f5a88e7ea93601ad3e91b36a632dbf0cf0c936e3 (patch) | |
tree | 31bfd295d5f2bca11d8405f3f23a3f25edc81b26 | |
parent | 50659a7e8fdd7819990e95c08795aa03f1f2dbf3 (diff) | |
download | pwlock-f5a88e7ea93601ad3e91b36a632dbf0cf0c936e3.tar.gz pwlock-f5a88e7ea93601ad3e91b36a632dbf0cf0c936e3.tar.bz2 pwlock-f5a88e7ea93601ad3e91b36a632dbf0cf0c936e3.zip |
Check telephony status before request telephony init
Change-Id: I145882478a892f8d674a71d3f8561c108c139ccf
-rwxr-xr-x | include/pwlock.h | 1 | ||||
-rwxr-xr-x | src/pwlock.c | 65 |
2 files changed, 49 insertions, 17 deletions
diff --git a/include/pwlock.h b/include/pwlock.h index 1f8b5eb..3e66259 100755 --- a/include/pwlock.h +++ b/include/pwlock.h @@ -105,7 +105,6 @@ struct appdata { Evas_Object *waiting_popup; int win_type; /* it is set if pwlock is set to ECORE_X_WINDOW_TYPE_NOTIFICATION */ int tapi_smc_sid; /* it is tapi resgistered sid for smc lab test */ - int tapi_init_retry_cnt; /* number of retry to tapi init */ UG_BUTTON_STATE ug_btn_evt_state; }; diff --git a/src/pwlock.c b/src/pwlock.c index ac662ed..c48551f 100755 --- a/src/pwlock.c +++ b/src/pwlock.c @@ -446,14 +446,61 @@ Eina_Bool vconf_tapi_ready_expire_cb(void *pData) return ECORE_CALLBACK_CANCEL; } +void vconf_tapi_init_ready_changed_cb(keynode_t * node, void *data) +{ + int api_ret = 0; + int isReady = 0; + struct appdata *ad = data; + + _DBG("vconf_tapi_init_ready_changed_cb..!!"); + + api_ret = vconf_get_bool(VCONFKEY_TELEPHONY_READY, &isReady); + if (api_ret != 0) { + _DBG("fail to get vconf key value"); + } else { + if (!isReady) { + _DBG("telephony init is not ready"); + } else { + _DBG("telephony init is ready"); + vconf_ignore_key_changed + (VCONFKEY_TELEPHONY_READY, vconf_tapi_init_ready_changed_cb); + + _trans(ad, _ST_TAPI_INIT); + do_state(ad); + } + } + return; +} + +void register_vconf_tapi_init_ready_changed(struct appdata *ad) +{ + _DBG("%s", __func__); + if (vconf_notify_key_changed + (VCONFKEY_TELEPHONY_READY, vconf_tapi_init_ready_changed_cb, + ad) != 0) { + _DBG("Fail to register"); + } +} static int do_ST_TAPI_INIT(struct appdata *ad) { int r; int is_emul; char *model = NULL; + int bReady = 0; _DBG("%s", __func__); + vconf_get_bool(VCONFKEY_TELEPHONY_READY, &bReady); + + if (!bReady) { + _DBG("telephony is not ready"); + register_vconf_tapi_init_ready_changed(ad); + + return ECORE_CALLBACK_CANCEL; + } + + _DBG("telephony is ready for init"); + system_info_get_value_string(SYSTEM_INFO_KEY_MODEL, &model); _DBG("SYSTEM_INFO_KEY_MODEL=%s\n", model); if (!strncmp("Emulator", model, sizeof(model))) @@ -466,21 +513,10 @@ static int do_ST_TAPI_INIT(struct appdata *ad) ad->t = pwlock_tapi_init(pwlock_tapi_cb, ad); if (ad->t == NULL) { _ERR("TAPI init error"); - - ad->tapi_init_retry_cnt++; - _DBG("Retry count of tapi init : %d\n", ad->tapi_init_retry_cnt); - if (ad->tapi_init_retry_cnt < 4) { - ecore_timer_add(1, timer_do, ad); - return ECORE_CALLBACK_CANCEL; - } else { - ad->tapi_init_retry_cnt = 0; - _trans(ad, _ST_EXIT); - return ECORE_CALLBACK_RENEW; - } + _trans(ad, _ST_EXIT); + return ECORE_CALLBACK_RENEW; } - ad->tapi_init_retry_cnt = 0; - r = pwlock_tapi_ready_check(); _DBG("tapi_ready_check : %d", r); @@ -1005,9 +1041,6 @@ static int app_create(void *data) ad->is_no_sim = 0; - // set 0 to retry count of tapi init - ad->tapi_init_retry_cnt = 0; - ad->state = _ST_FIRST; do_state(ad); |