From b695a60bbd87200cad4354be53964c5de9b430f4 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Mon, 30 Nov 2015 13:44:04 -0600 Subject: gril: Remove g_ril_reply_parse_sim_status --- gril/grilreply.c | 130 ------------------------------------------------------- gril/grilreply.h | 28 ------------ 2 files changed, 158 deletions(-) diff --git a/gril/grilreply.c b/gril/grilreply.c index 6c72f0d6..88361a82 100644 --- a/gril/grilreply.c +++ b/gril/grilreply.c @@ -308,136 +308,6 @@ out: return reply; } -void g_ril_reply_free_sim_status(struct reply_sim_status *status) -{ - if (status) { - guint i; - - for (i = 0; i < status->num_apps; i++) { - if (status->apps[i] != NULL) { - g_free(status->apps[i]->aid_str); - g_free(status->apps[i]->app_str); - g_free(status->apps[i]); - } - } - - g_free(status); - } -} - -struct reply_sim_status *g_ril_reply_parse_sim_status(GRil *gril, - const struct ril_msg *message) -{ - struct parcel rilp; - unsigned int i; - struct reply_sim_status *status; - - g_ril_append_print_buf(gril, "[%d,%04d]< %s", - g_ril_get_slot(gril), message->serial_no, - ril_request_id_to_string(message->req)); - - g_ril_init_parcel(message, &rilp); - - status = g_new0(struct reply_sim_status, 1); - - status->card_state = parcel_r_int32(&rilp); - - /* - * NOTE: - * - * The global pin_status is used for multi-application - * UICC cards. For example, there are SIM cards that - * can be used in both GSM and CDMA phones. Instead - * of managed PINs for both applications, a global PIN - * is set instead. It's not clear at this point if - * such SIM cards are supported by ofono or RILD. - */ - - status->pin_state = parcel_r_int32(&rilp); - status->gsm_umts_index = parcel_r_int32(&rilp); - status->cdma_index = parcel_r_int32(&rilp); - status->ims_index = parcel_r_int32(&rilp); - status->num_apps = parcel_r_int32(&rilp); - - if (rilp.malformed) - goto error; - - g_ril_append_print_buf(gril, - "(card_state=%d,universal_pin_state=%d," - "gsm_umts_index=%d,cdma_index=%d," - "ims_index=%d, ", - status->card_state, - status->pin_state, - status->gsm_umts_index, - status->cdma_index, - status->ims_index); - - if (status->card_state != RIL_CARDSTATE_PRESENT) - goto done; - - if (status->num_apps > MAX_UICC_APPS) { - ofono_error("SIM error; too many apps: %d", status->num_apps); - status->num_apps = MAX_UICC_APPS; - } - - for (i = 0; i < status->num_apps; i++) { - struct reply_sim_app *app; - DBG("processing app[%d]", i); - status->apps[i] = g_try_new0(struct reply_sim_app, 1); - app = status->apps[i]; - if (app == NULL) { - ofono_error("Can't allocate app_data"); - goto error; - } - - app->app_type = parcel_r_int32(&rilp); - app->app_state = parcel_r_int32(&rilp); - app->perso_substate = parcel_r_int32(&rilp); - - /* - * TODO: we need a way to instruct parcel to skip - * a string, without allocating memory... - */ - /* application ID (AID) */ - app->aid_str = parcel_r_string(&rilp); - /* application label */ - app->app_str = parcel_r_string(&rilp); - - app->pin_replaced = parcel_r_int32(&rilp); - app->pin1_state = parcel_r_int32(&rilp); - app->pin2_state = parcel_r_int32(&rilp); - - g_ril_append_print_buf(gril, - "%s[app_type=%d,app_state=%d," - "perso_substate=%d,aid_ptr=%s," - "app_label_ptr=%s,pin1_replaced=%d," - "pin1=%d,pin2=%d],", - print_buf, - app->app_type, - app->app_state, - app->perso_substate, - app->aid_str ? app->aid_str : "NULL", - app->app_str ? app->app_str : "NULL", - app->pin_replaced, - app->pin1_state, - app->pin2_state); - } - - if (rilp.malformed) - goto error; - -done: - g_ril_append_print_buf(gril, "%s}", print_buf); - g_ril_print_response(gril, message); - - return status; - -error: - g_ril_reply_free_sim_status(status); - - return NULL; -} - static gint g_ril_call_compare(gconstpointer a, gconstpointer b) { const struct ofono_call *ca = a; diff --git a/gril/grilreply.h b/gril/grilreply.h index bb7ab147..ba9e030e 100644 --- a/gril/grilreply.h +++ b/gril/grilreply.h @@ -44,29 +44,6 @@ struct reply_data_reg_state { unsigned int max_cids; }; -#define MAX_UICC_APPS 16 - -struct reply_sim_app { - guint app_type; - guint app_state; - guint perso_substate; - char *aid_str; - char *app_str; - guint pin_replaced; - guint pin1_state; - guint pin2_state; -}; - -struct reply_sim_status { - guint card_state; - guint pin_state; - guint gsm_umts_index; - guint cdma_index; - guint ims_index; - guint num_apps; - struct reply_sim_app *apps[MAX_UICC_APPS]; -}; - struct reply_oem_hook { int length; void *data; @@ -77,11 +54,6 @@ struct reply_reg_state *g_ril_reply_parse_voice_reg_state(GRil *gril, struct reply_data_reg_state *g_ril_reply_parse_data_reg_state(GRil *gril, const struct ril_msg *message); -void g_ril_reply_free_sim_status(struct reply_sim_status *status); - -struct reply_sim_status *g_ril_reply_parse_sim_status(GRil *gril, - const struct ril_msg *message); - GSList *g_ril_reply_parse_get_calls(GRil *gril, const struct ril_msg *message); int *g_ril_reply_parse_retries(GRil *gril, const struct ril_msg *message, -- cgit v1.2.3