diff options
author | jin0.kim <jin0.kim@samsung.com> | 2015-11-11 15:47:34 +0830 |
---|---|---|
committer | jin0.kim <jin0.kim@samsung.com> | 2015-11-13 11:19:30 +0830 |
commit | 1543e8c05cf943f166d68f00f6d6a656b79a9061 (patch) | |
tree | 2ee819a0dfb0336402bbea9d43a77be6a9edfcc0 /daemon/sim_controller.c | |
parent | 19a60f468528fc76cfd8ac0ecf5b852933fe1c0e (diff) | |
download | quickpanel-1543e8c05cf943f166d68f00f6d6a656b79a9061.tar.gz quickpanel-1543e8c05cf943f166d68f00f6d6a656b79a9061.tar.bz2 quickpanel-1543e8c05cf943f166d68f00f6d6a656b79a9061.zip |
[Tizen 3.0] 2.4 source code merge
Change-Id: Id543ba142712a6ab4be9e16d2fe7dffdc6e3bfad
Diffstat (limited to 'daemon/sim_controller.c')
-rwxr-xr-x[-rw-r--r--] | daemon/sim_controller.c | 433 |
1 files changed, 152 insertions, 281 deletions
diff --git a/daemon/sim_controller.c b/daemon/sim_controller.c index 8302b45..9f43f6a 100644..100755 --- a/daemon/sim_controller.c +++ b/daemon/sim_controller.c @@ -16,19 +16,23 @@ */ +#include <Elementary.h> #include <stdio.h> #include <stdlib.h> -#include <Evas.h> -#include <Elementary.h> -#include <Eina.h> -#include <dlog.h> -#include <vconf.h> +#include <E_DBus.h> #include <tapi_common.h> #include <ITapiSim.h> #include <TelCall.h> #include <ITapiCall.h> #include <TelNetwork.h> + +#include <dlog.h> +#include <vconf.h> +#include <tzsh.h> +#include <tzsh_quickpanel_service.h> +#include <E_DBus.h> + #include "setting_utils.h" #include "list_util.h" @@ -50,52 +54,18 @@ static struct } sim_state_info = { - .handle[0] = NULL, - .handle[1] = NULL, - .handle[2] = NULL, - .sim_card_ready[0] = EINA_FALSE, - .sim_card_ready[1] = EINA_FALSE, - .layout = NULL, - .call_state = 0, + .handle[0] = NULL, + .handle[1] = NULL, + .handle[2] = NULL, + .sim_card_ready[0] = EINA_FALSE, + .sim_card_ready[1] = EINA_FALSE, + .layout = NULL, + .call_state = 0, }; -static int _sim_controller_get_call_state(void); - static void register_sim_callbacks(); static void unregister_sim_callbacks(); -static void __sim_controller_call_state_changed_cb(keynode_t *key, void *data) -{ - int call_state = _sim_controller_get_call_state(); - - if (sim_state_info.call_state != call_state) - { - DBG("Call state changed[%d]", call_state); - sim_state_info.call_state = call_state; - } -} - -static int _sim_controller_get_call_state(void) -{ - int value = 0; - int ret = 0; - - ret = vconf_get_int(VCONFKEY_CALL_STATE, &value); - if (ret != 0) - { - ERR("Failed to get call state"); - return 0; - } - - if (value == VCONFKEY_CALL_OFF) - { - return 0; - } - - DBG("Call status[%d]", value); - return 1; -} - static char *get_sim_plmn(TapiHandle *handle) { int ret; @@ -106,13 +76,13 @@ static char *get_sim_plmn(TapiHandle *handle) TAPI_PROP_NETWORK_NETWORK_NAME, &network_name); if(ret == TAPI_API_SUCCESS) { - /* ‘network_name’ contains valid Network name based on Display condition */ + /* ‘network_name’ contains valid Network name based on Display condition */ return network_name; } else { ERR("Sim = %p PLMN = ERROR[%d]", handle, ret); - /* get property failed */ + /* get property failed */ } return NULL; @@ -129,13 +99,13 @@ static char *get_sim_spn(TapiHandle *handle) TAPI_PROP_NETWORK_SPN_NAME, &spn_name); if(ret == TAPI_API_SUCCESS) { - /* ‘spn_name’ contains valid Service provider name */ + /* ‘spn_name’ contains valid Service provider name */ return spn_name; } else { ERR("Sim = %p SPN = ERROR[%d]", handle, ret); - /* get property failed */ + /* get property failed */ return NULL; } } @@ -151,34 +121,28 @@ static char *get_plmn_spn_network(int handle_num, TapiHandle *handle) // get service type ret = tel_get_property_int(handle, TAPI_PROP_NETWORK_SERVICE_TYPE, &service_type); - if (ret != TAPI_API_SUCCESS) - { + if (ret != TAPI_API_SUCCESS) { ERR("Failed to get service type[%d]", ret); } - if (service_type >= TAPI_NETWORK_SERVICE_TYPE_2G) - { + if (service_type >= TAPI_NETWORK_SERVICE_TYPE_2G) { // get network name option ret = tel_get_property_int(handle, TAPI_PROP_NETWORK_NAME_OPTION, &name_option); - if (ret != TAPI_API_SUCCESS) - { + if (ret != TAPI_API_SUCCESS) { ERR("Failed to get name option[%d]", ret); } - switch (name_option) - { + switch (name_option) { case TAPI_NETWORK_DISP_SPN: spn = get_sim_spn(handle); - if (spn != NULL && spn[0] != 0) - { + if (spn != NULL && spn[0] != 0) { INFO("PLMN/SPN - Sim %p using SPN: %s", handle, spn); snprintf(buf, sizeof(buf), "%s", spn); } break; case TAPI_NETWORK_DISP_PLMN: plmn = get_sim_plmn(handle); - if (plmn != NULL && plmn[0] != 0) - { + if (plmn != NULL && plmn[0] != 0) { INFO("PLMN/SPN - Sim %p using PLMN: %s", handle, plmn); snprintf(buf, sizeof(buf), "%s", plmn); } @@ -186,18 +150,13 @@ static char *get_plmn_spn_network(int handle_num, TapiHandle *handle) case TAPI_NETWORK_DISP_SPN_PLMN: spn = get_sim_spn(handle); plmn = get_sim_plmn(handle); - if (spn != NULL && spn[0] != 0 && plmn != NULL && plmn[0] != 0) - { + if (spn != NULL && spn[0] != 0 && plmn != NULL && plmn[0] != 0) { INFO("PLMN/SPN - Sim %p using SPN: %s, PLMN: %s", handle, spn, plmn); snprintf(buf, sizeof(buf), "%s - %s", plmn, spn); - } - else if (spn != NULL && spn[0] != 0) - { + } else if (spn != NULL && spn[0] != 0) { INFO("PLMN/SPN - Sim %p using SPN: %s", handle, spn); snprintf(buf, sizeof(buf), "%s", spn); - } - else if (plmn != NULL && plmn[0] != 0) - { + } else if (plmn != NULL && plmn[0] != 0) { INFO("PLMN/SPN - Sim %p using PLMN: %s", handle, plmn); snprintf(buf, sizeof(buf), "%s", plmn); } @@ -205,18 +164,14 @@ static char *get_plmn_spn_network(int handle_num, TapiHandle *handle) default: ERR("Invalid name option[%d]", name_option); plmn = get_sim_plmn(handle); - if (plmn != NULL && plmn[0] != 0) - { + if (plmn != NULL && plmn[0] != 0) { INFO("PLMN/SPN - Sim %p using PLMN: %s", handle, plmn); snprintf(buf, sizeof(buf), "%s", plmn); } break; } - } - else - { - switch (service_type) - { + } else { + switch (service_type) { case TAPI_NETWORK_SERVICE_TYPE_NO_SERVICE: snprintf(buf, sizeof(buf), "%s", _("IDS_IDLE_BODY_NO_SERVICE")); break; @@ -229,8 +184,7 @@ static char *get_plmn_spn_network(int handle_num, TapiHandle *handle) default: ERR("invalid service type[%d]", service_type); plmn = get_sim_plmn(handle); - if (plmn != NULL && plmn[0] != 0) - { + if (plmn != NULL && plmn[0] != 0) { INFO("PLMN/SPN - Sim %p using PLMN: %s", handle, plmn); snprintf(buf, sizeof(buf), "%s", plmn); } @@ -240,33 +194,22 @@ static char *get_plmn_spn_network(int handle_num, TapiHandle *handle) DBG("handle[%d][%p] service_type[%d], name_option[%d] >> [%s]", handle_num, handle, service_type, name_option, buf); - if (strlen(buf) == 0) - { + if (strlen(buf) == 0) { ERR("Empty string"); snprintf(buf, sizeof(buf), "%s", _("IDS_IDLE_BODY_NO_SERVICE")); - } - else if (strncasecmp(buf, "No Service", strlen("No Service")) == 0) - { + } else if (strncasecmp(buf, "No Service", strlen("No Service")) == 0) { ERR("USING SPECIAL NETWORK NAME: %s in handle: %d", _("IDS_IDLE_BODY_NO_SERVICE"), handle_num); return strdup(_("IDS_IDLE_BODY_NO_SERVICE")); - } - else if (strncasecmp(buf, "EMERGENCY", strlen("EMERGENCY")) == 0) - { + } else if (strncasecmp(buf, "EMERGENCY", strlen("EMERGENCY")) == 0) { ERR("USING SPECIAL NETWORK NAME: %s in handle: %d", _("IDS_IDLE_MBODY_EMERGENCY_CALLS_ONLY"), handle_num); return strdup(_("IDS_IDLE_MBODY_EMERGENCY_CALLS_ONLY")); - } - else if (strncasecmp(buf, "Searching", strlen("Searching")) == 0) - { + } else if (strncasecmp(buf, "Searching", strlen("Searching")) == 0) { ERR("USING SPECIAL NETWORK NAME: %s in handle: %d", _("IDS_COM_BODY_SEARCHING"), handle_num); return strdup(_("IDS_COM_BODY_SEARCHING")); - } - else if (strncasecmp(buf, "SIM Error", strlen("SIM Error")) == 0) - { + } else if (strncasecmp(buf, "SIM Error", strlen("SIM Error")) == 0) { ERR("USING SPECIAL NETWORK NAME: %s in handle: %d", _("IDS_IDLE_BODY_INVALID_SIM_CARD"), handle_num); return strdup(_("IDS_IDLE_BODY_INVALID_SIM_CARD")); - } - else if (strncasecmp(buf, "NO SIM", strlen("NO SIM")) == 0) - { + } else if (strncasecmp(buf, "NO SIM", strlen("NO SIM")) == 0) { ERR("USING SPECIAL NETWORK NAME: %s in handle: %d", _("IDS_IDLE_MBODY_EMERGENCY_CALLS_ONLY"), handle_num); return strdup(_("IDS_IDLE_MBODY_EMERGENCY_CALLS_ONLY")); } @@ -277,70 +220,69 @@ static char *get_plmn_spn_network(int handle_num, TapiHandle *handle) // -------------------------------------------------------------------------------------------- static void print_sim_status(TelSimCardStatus_t sim_status, int card_changed) { - switch(sim_status) - { - case TAPI_SIM_STATUS_CARD_ERROR : - INFO("Sim card status: TAPI_SIM_STATUS_CARD_ERROR"); + switch(sim_status) { + case TAPI_SIM_STATUS_CARD_ERROR: + INFO("Sim card status: TAPI_SIM_STATUS_CARD_ERROR"); break; - case TAPI_SIM_STATUS_CARD_NOT_PRESENT : - INFO("Sim card status: TAPI_SIM_STATUS_CARD_NOT_PRESENT"); + case TAPI_SIM_STATUS_CARD_NOT_PRESENT: + INFO("Sim card status: TAPI_SIM_STATUS_CARD_NOT_PRESENT"); break; - case TAPI_SIM_STATUS_SIM_INITIALIZING : - INFO("Sim card status: TAPI_SIM_STATUS_SIM_INITIALIZING"); + case TAPI_SIM_STATUS_SIM_INITIALIZING: + INFO("Sim card status: TAPI_SIM_STATUS_SIM_INITIALIZING"); break; - case TAPI_SIM_STATUS_SIM_INIT_COMPLETED: - INFO("Sim card status: TAPI_SIM_STATUS_SIM_INIT_COMPLETED"); + case TAPI_SIM_STATUS_SIM_INIT_COMPLETED: + INFO("Sim card status: TAPI_SIM_STATUS_SIM_INIT_COMPLETED"); break; - case TAPI_SIM_STATUS_SIM_PIN_REQUIRED : - INFO("Sim card status: TAPI_SIM_STATUS_SIM_PIN_REQUIRED"); + case TAPI_SIM_STATUS_SIM_PIN_REQUIRED: + INFO("Sim card status: TAPI_SIM_STATUS_SIM_PIN_REQUIRED"); break; - case TAPI_SIM_STATUS_SIM_PUK_REQUIRED : - INFO("Sim card status: TAPI_SIM_STATUS_SIM_PUK_REQUIRED"); + case TAPI_SIM_STATUS_SIM_PUK_REQUIRED: + INFO("Sim card status: TAPI_SIM_STATUS_SIM_PUK_REQUIRED"); break; - case TAPI_SIM_STATUS_CARD_BLOCKED : - INFO("Sim card status: TAPI_SIM_STATUS_CARD_BLOCKED"); + case TAPI_SIM_STATUS_CARD_BLOCKED: + INFO("Sim card status: TAPI_SIM_STATUS_CARD_BLOCKED"); break; - case TAPI_SIM_STATUS_SIM_NCK_REQUIRED : - INFO("Sim card status: TAPI_SIM_STATUS_SIM_NCK_REQUIRED"); + case TAPI_SIM_STATUS_SIM_NCK_REQUIRED: + INFO("Sim card status: TAPI_SIM_STATUS_SIM_NCK_REQUIRED"); break; - case TAPI_SIM_STATUS_SIM_NSCK_REQUIRED : - INFO("Sim card status: TAPI_SIM_STATUS_SIM_NSCK_REQUIRED"); + case TAPI_SIM_STATUS_SIM_NSCK_REQUIRED: + INFO("Sim card status: TAPI_SIM_STATUS_SIM_NSCK_REQUIRED"); break; - case TAPI_SIM_STATUS_SIM_SPCK_REQUIRED : - INFO("Sim card status: TAPI_SIM_STATUS_SIM_SPCK_REQUIRED"); + case TAPI_SIM_STATUS_SIM_SPCK_REQUIRED: + INFO("Sim card status: TAPI_SIM_STATUS_SIM_SPCK_REQUIRED"); break; - case TAPI_SIM_STATUS_SIM_CCK_REQUIRED : - INFO("Sim card status: TAPI_SIM_STATUS_SIM_CCK_REQUIRED"); + case TAPI_SIM_STATUS_SIM_CCK_REQUIRED: + INFO("Sim card status: TAPI_SIM_STATUS_SIM_CCK_REQUIRED"); break; - case TAPI_SIM_STATUS_CARD_REMOVED : - INFO("Sim card status: TAPI_SIM_STATUS_CARD_REMOVED"); + case TAPI_SIM_STATUS_CARD_REMOVED: + INFO("Sim card status: TAPI_SIM_STATUS_CARD_REMOVED"); break; - case TAPI_SIM_STATUS_SIM_LOCK_REQUIRED : - INFO("Sim card status: TAPI_SIM_STATUS_SIM_LOCK_REQUIRED"); + case TAPI_SIM_STATUS_SIM_LOCK_REQUIRED: + INFO("Sim card status: TAPI_SIM_STATUS_SIM_LOCK_REQUIRED"); break; - case TAPI_SIM_STATUS_CARD_CRASHED : - INFO("Sim card status: TAPI_SIM_STATUS_CARD_CRASHED"); + case TAPI_SIM_STATUS_CARD_CRASHED: + INFO("Sim card status: TAPI_SIM_STATUS_CARD_CRASHED"); break; - case TAPI_SIM_STATUS_CARD_POWEROFF : - INFO("Sim card status: TAPI_SIM_STATUS_CARD_POWEROFF"); + case TAPI_SIM_STATUS_CARD_POWEROFF: + INFO("Sim card status: TAPI_SIM_STATUS_CARD_POWEROFF"); break; - case TAPI_SIM_STATUS_UNKNOWN : - INFO("Sim card status: TAPI_SIM_STATUS_UNKNOWN"); + case TAPI_SIM_STATUS_UNKNOWN: + INFO("Sim card status: TAPI_SIM_STATUS_UNKNOWN"); break; } @@ -354,70 +296,48 @@ static void get_sim_status() TelSimCardStatus_t sim_status; int card_changed; - for(i = 0; i < TAPI_HANDLE_MAX + 1; ++i) - { - if(sim_state_info.handle[i]) - { + for (i = 0; i < TAPI_HANDLE_MAX + 1; ++i) { + if (sim_state_info.handle[i]) { ret = tel_get_sim_init_info (sim_state_info.handle[i], &sim_status, &card_changed); - if(ret == 0) - { + if(ret == 0) { print_sim_status(sim_status, card_changed); - if(sim_status == TAPI_SIM_STATUS_SIM_INIT_COMPLETED || - sim_status == TAPI_SIM_STATUS_SIM_PIN_REQUIRED) - { - if (i < TAPI_HANDLE_MAX) - { + if(sim_status == TAPI_SIM_STATUS_SIM_INIT_COMPLETED || sim_status == TAPI_SIM_STATUS_SIM_PIN_REQUIRED) { + if (i < TAPI_HANDLE_MAX) { sim_state_info.sim_card_ready[i] = EINA_TRUE; } - } - else - { + } else { ERR("SIM[%d] is not completed initialization [%d]", i, sim_status); } - } - else - { + } else { ERR("Could not get sim[%d] status[%d]", i, ret); - } - } - } + } // if ret == 0 + } // if sim_state_info + } // for } static void sim_handler_text_set(Eina_Bool flight_mode) { - if (flight_mode) - { + if (flight_mode) { // if flight mode, No service quickpanel_handler_text_set(_("IDS_IDLE_BODY_NO_SERVICE")); - } - else if (sim_state_info.sim_card_ready[0] && sim_state_info.sim_card_ready[1]) - { + } else if (sim_state_info.sim_card_ready[0] && sim_state_info.sim_card_ready[1]) { quickpanel_handler_text_set(NULL); - } - else if(sim_state_info.sim_card_ready[0]) - { + } else if(sim_state_info.sim_card_ready[0]) { char *plmn_spn1 = get_plmn_spn_network(0, sim_state_info.handle[0]); quickpanel_handler_text_set(plmn_spn1); - if (plmn_spn1) - { + if (plmn_spn1) { free(plmn_spn1); } - } - else if(sim_state_info.sim_card_ready[1]) - { + } else if(sim_state_info.sim_card_ready[1]) { char *plmn_spn1 = get_plmn_spn_network(1, sim_state_info.handle[1]); quickpanel_handler_text_set(plmn_spn1); - if (plmn_spn1) - { + if (plmn_spn1) { free(plmn_spn1); } - } - else - { + } else { quickpanel_handler_text_set(_("IDS_IDLE_MBODY_EMERGENCY_CALLS_ONLY")); } - } static void init_view() @@ -425,16 +345,14 @@ static void init_view() struct appdata *ad = NULL; ad = quickpanel_get_app_data(); - if (ad == NULL) - { + if (ad == NULL) { ERR("invalid data"); return; } int flight_mode_state = EINA_FALSE; int ret = vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &flight_mode_state); - if(ret != 0) - { + if(ret != 0) { ERR("Could not get 'VCONFKEY_TELEPHONY_FLIGHT_MODE' value"); } @@ -450,20 +368,18 @@ static void _init_tel() /* Get CP name list – cp_list */ cp_list = tel_get_cp_name_list(); - if(cp_list == NULL) - { + if(cp_list == NULL) { ERR("Could not get the cp_name_list"); return; } - while (cp_list[modem_num]) - { + while (cp_list[modem_num]) { /* Initialize TAPI handle */ sim_state_info.handle[modem_num] = tel_init(cp_list[modem_num]); - if(cp_list[modem_num]) - ERR("sim_state_info.handle[%d] = %s; ptr = %p", modem_num, - cp_list[modem_num], sim_state_info.handle[modem_num]); + if (cp_list[modem_num]) { + ERR("sim_state_info.handle[%d] = %s; ptr = %p", modem_num, cp_list[modem_num], sim_state_info.handle[modem_num]); + } /* Move to next CP Name in cp_list */ modem_num++; @@ -479,8 +395,7 @@ static void _init_tel() static void _deinit_tel() { int i = 0; - while (sim_state_info.handle[i]) - { + while (sim_state_info.handle[i]) { /* De-initialize TAPI handle */ tel_deinit(sim_state_info.handle[i]); sim_state_info.handle[i] = NULL; @@ -497,17 +412,14 @@ void tel_ready_cb(keynode_t *key, void *data) status = vconf_keynode_get_bool(key); - if (status == TRUE) - { /* Telephony State - READY */ + if (status == TRUE) { /* Telephony State - READY */ DBG("tel status[%d]", status); _init_tel(); register_sim_callbacks(); get_sim_status(); init_view(); - } - else - { /* Telephony State – NOT READY */ + } else { /* Telephony State – NOT READY */ /* De-initialization is optional here (ONLY if required) */ ERR("tel status[%d]", status); _deinit_tel(); @@ -529,18 +441,21 @@ static void tel_flight_mode_cb(keynode_t *key, void *data) // -------------------------------------------------------------------------------------------- static void on_sim_card_status_changed(TapiHandle *handle, const char *noti_id, void *data, void *user_data) { - int handle_num = (int)user_data; + int handle_num; int *sim_status = data; + /** + * @note + * Casting the pointer to "long" first for 64 bits architecture. + * And then convert it to "int" + */ + handle_num = (int)((long)user_data); + ERR("SIM[%p][%d] status[%d], [%d][%d]", handle, handle_num, *sim_status, sim_state_info.sim_card_ready[0], sim_state_info.sim_card_ready[1]); - if(*sim_status == TAPI_SIM_STATUS_SIM_INIT_COMPLETED || - *sim_status == TAPI_SIM_STATUS_SIM_PIN_REQUIRED) - { + if(*sim_status == TAPI_SIM_STATUS_SIM_INIT_COMPLETED || *sim_status == TAPI_SIM_STATUS_SIM_PIN_REQUIRED) { sim_state_info.sim_card_ready[handle_num] = EINA_TRUE; - } - else - { + } else { sim_state_info.sim_card_ready[handle_num] = EINA_FALSE; } @@ -550,16 +465,14 @@ static void on_sim_card_status_changed(TapiHandle *handle, const char *noti_id, static void on_plmn_spn_changed(TapiHandle *handle, const char *noti_id, void *data, void *user_data) { - if(!handle) - { + if (!handle) { ERR("handle == NULL"); return; } - int flight_mode_state = EINA_FALSE; + int flight_mode_state = EINA_FALSE; int ret = vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &flight_mode_state); - if(ret != 0) - { + if (ret != 0) { ERR("Could not get the 'VCONFKEY_TELEPHONY_FLIGHT_MODE' value"); } sim_handler_text_set(flight_mode_state); @@ -567,52 +480,38 @@ static void on_plmn_spn_changed(TapiHandle *handle, const char *noti_id, static void register_sim_callbacks() { - int i; + long i; int ret; - for(i = 0; i < TAPI_HANDLE_MAX; ++i) - { - if(sim_state_info.handle[i]) - { - ret = tel_register_noti_event (sim_state_info.handle[i], - TAPI_NOTI_SIM_STATUS, on_sim_card_status_changed, (void*)i); - if (ret != TAPI_API_SUCCESS) - { + for (i = 0; i < TAPI_HANDLE_MAX; ++i) { + if (sim_state_info.handle[i]) { + ret = tel_register_noti_event(sim_state_info.handle[i], TAPI_NOTI_SIM_STATUS, on_sim_card_status_changed, (void *)i); + if (ret != TAPI_API_SUCCESS) { ERR("Failed to register 'on_sim_card_status_changed' callback to handle[%d][%d]", i, ret); - } - else - { + } else { ERR("SIM card status changed event registered"); } - ret = tel_register_noti_event(sim_state_info.handle[i], - TAPI_PROP_NETWORK_SPN_NAME, on_plmn_spn_changed, (void*)i); - if (ret != TAPI_API_SUCCESS) - { + ret = tel_register_noti_event(sim_state_info.handle[i], TAPI_PROP_NETWORK_SPN_NAME, on_plmn_spn_changed, (void *)i); + if (ret != TAPI_API_SUCCESS) { ERR("Failed to register 'on_plmn_spn_changed' callback to handle[%d][%d]", i, ret); } - ret = tel_register_noti_event(sim_state_info.handle[i], - TAPI_PROP_NETWORK_NETWORK_NAME, on_plmn_spn_changed, (void*)i); - if (ret != TAPI_API_SUCCESS) - { + ret = tel_register_noti_event(sim_state_info.handle[i], TAPI_PROP_NETWORK_NETWORK_NAME, on_plmn_spn_changed, (void *)i); + if (ret != TAPI_API_SUCCESS) { ERR("Failed to register 'on_plmn_spn_changed' callback to handle: %i", i); } - ret = tel_register_noti_event(sim_state_info.handle[i], TAPI_PROP_NETWORK_SERVICE_TYPE, on_plmn_spn_changed, (void*) i); - if (ret != TAPI_API_SUCCESS) - { + ret = tel_register_noti_event(sim_state_info.handle[i], TAPI_PROP_NETWORK_SERVICE_TYPE, on_plmn_spn_changed, (void *)i); + if (ret != TAPI_API_SUCCESS) { ERR("Failed to register network service type[%d][%d]", ret, i); } - ret = tel_register_noti_event(sim_state_info.handle[i], TAPI_PROP_NETWORK_NAME_OPTION, on_plmn_spn_changed, (void*) i); - if (ret != TAPI_API_SUCCESS) - { + ret = tel_register_noti_event(sim_state_info.handle[i], TAPI_PROP_NETWORK_NAME_OPTION, on_plmn_spn_changed, (void *)i); + if (ret != TAPI_API_SUCCESS) { ERR("Failed to register network name option[%d][%d]", ret, i); } - } - else - { + } else { ERR("No handle [%d]", i); } } @@ -622,57 +521,45 @@ static void unregister_sim_callbacks() { int i; int ret; - for(i = 0; i < TAPI_HANDLE_MAX; ++i) - { - if(sim_state_info.handle[i]) - { + for(i = 0; i < TAPI_HANDLE_MAX; ++i) { + if(sim_state_info.handle[i]) { ret = tel_deregister_noti_event(sim_state_info.handle[i], TAPI_NOTI_SIM_STATUS); - if (ret != TAPI_API_SUCCESS) - { + if (ret != TAPI_API_SUCCESS) { ERR("Failed to dereregister TAPI_NOTI_SIM_STATUS callback from handle: %i", i); - } - else - { + } else { DBG("SIM status changed event deregistered"); } ret = tel_deregister_noti_event(sim_state_info.handle[i], TAPI_PROP_NETWORK_NETWORK_NAME); - if (ret != TAPI_API_SUCCESS) - { + if (ret != TAPI_API_SUCCESS) { ERR("Failed to dereregister TAPI_PROP_NETWORK_PLMN callback from handle: %i", i); } ret = tel_deregister_noti_event(sim_state_info.handle[i], TAPI_PROP_NETWORK_SPN_NAME); - if (ret != TAPI_API_SUCCESS) - { + if (ret != TAPI_API_SUCCESS) { ERR("Failed to dereregister TAPI_PROP_NETWORK_SPN_NAME callback from handle: %i", i); } ret = tel_deregister_noti_event(sim_state_info.handle[i], TAPI_PROP_NETWORK_SERVICE_TYPE); - if (ret != TAPI_API_SUCCESS) - { + if (ret != TAPI_API_SUCCESS) { ERR("Failed to deregister network service type[%d][%d]", ret, i); } ret = tel_deregister_noti_event(sim_state_info.handle[i], TAPI_PROP_NETWORK_NAME_OPTION); - if (ret != TAPI_API_SUCCESS) - { + if (ret != TAPI_API_SUCCESS) { ERR("Failed to deregister network name option[%d][%d]", ret, i); } - if(i == 0) - { + if(i == 0) { ret = tel_deregister_noti_event(sim_state_info.handle[i], TAPI_NOTI_CALL_PREFERRED_VOICE_SUBSCRIPTION); - if (ret != TAPI_API_SUCCESS) - { + if (ret != TAPI_API_SUCCESS) { ERR("Failed to dereregister callback to handle: %d", i); } } } - } + } // for } - void sim_controller_init(Evas_Object *master_layout) { int state = EINA_FALSE; @@ -682,8 +569,8 @@ void sim_controller_init(Evas_Object *master_layout) DBG("VCONFKEY_TELEPHONY_READY == %d", state); - if (ret != -1 && state == TRUE) - { /* Telephony State - READY */ + if (ret != -1 && state == TRUE) { + /* Telephony State - READY */ /* Initialize TAPI handles */ _init_tel(); @@ -691,25 +578,19 @@ void sim_controller_init(Evas_Object *master_layout) get_sim_status(); init_view(); - } - else - { /* Telephony State – NOT READY, register for change in state */ + } else { /* Telephony State – NOT READY, register for change in state */ DBG("Telephony state: [NOT Ready]"); } /* Register for Telephony state change */ ret = vconf_notify_key_changed(VCONFKEY_TELEPHONY_READY, tel_ready_cb, master_layout); - if(ret != 0) + if(ret != 0) { ERR("Failed to register VCONFKEY_TELEPHONY_READY key changed callback"); + } ret = vconf_notify_key_changed(VCONFKEY_TELEPHONY_FLIGHT_MODE, tel_flight_mode_cb, master_layout); - if(ret != 0) + if(ret != 0) { ERR("Failed to register VCONFKEY_TELEPHONY_FLIGHT_MODE key changed callback"); - - ret = vconf_notify_key_changed(VCONFKEY_CALL_STATE, __sim_controller_call_state_changed_cb, NULL); - if (ret != 0) - { - ERR("Failed to notify call state[%d]", ret); } } @@ -722,29 +603,21 @@ void sim_controller_resume() int card_changed; ret = vconf_get_bool(VCONFKEY_TELEPHONY_READY, &state); - if (ret != 0 || state == FALSE) - { + if (ret != 0 || state == FALSE) { ERR("Failed to get telephony state[%d][%d]", state, ret); return; } - for (i = 0; i < TAPI_HANDLE_MAX; ++i) - { - if (sim_state_info.handle[i]) - { + for (i = 0; i < TAPI_HANDLE_MAX; ++i) { + if (sim_state_info.handle[i]) { ret = tel_get_sim_init_info(sim_state_info.handle[i], &sim_status, &card_changed); DBG("SIM[%d] info[%d][%d][%d]", i, ret, sim_status, card_changed); - if (sim_status == TAPI_SIM_STATUS_SIM_INIT_COMPLETED || - sim_status == TAPI_SIM_STATUS_SIM_PIN_REQUIRED) - { - if (sim_state_info.sim_card_ready[i] != EINA_TRUE) - { + if (sim_status == TAPI_SIM_STATUS_SIM_INIT_COMPLETED || sim_status == TAPI_SIM_STATUS_SIM_PIN_REQUIRED) { + if (sim_state_info.sim_card_ready[i] != EINA_TRUE) { ERR("SIM[%d] is init completed but local value is not ture", i); } } - } - else - { + } else { ERR("No handle[%d]", i); } } @@ -755,12 +628,10 @@ void sim_controller_on_language_change() on_plmn_spn_changed(sim_state_info.handle[0], "SELF", NULL, (void*) 0); on_plmn_spn_changed(sim_state_info.handle[1], "SELF", NULL, (void*) 1); - if (sim_state_info.handle[0] == NULL && sim_state_info.handle[1] == NULL) - { + if (sim_state_info.handle[0] == NULL && sim_state_info.handle[1] == NULL) { int flight_mode = EINA_FALSE; int ret = vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &flight_mode); - if (ret != 0) - { + if (ret != 0) { ERR("Failed to get flight mode[%d]", ret); } |