diff options
author | James Prestwood <james.prestwood@linux.intel.com> | 2017-11-06 09:49:32 -0800 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2017-11-06 16:17:32 -0600 |
commit | b754949032f52817433fcfcb291baa007ad463e1 (patch) | |
tree | 104c2f1b47b6daa2e36e99353ea47f965ca0d54c /src/sim.c | |
parent | 9cdce0abccbc4ddd611bdfd68abbb16ffc9d1807 (diff) | |
download | ofono-b754949032f52817433fcfcb291baa007ad463e1.tar.gz |
sim: implement create ISIM context
API to create a sim context for the ISIM application, if found.
During AID discovery, if an ISIM AID is found, a new fs object is
initialized for the ISIM which will be used for any future
ISIM context creation.
Diffstat (limited to 'src/sim.c')
-rw-r--r-- | src/sim.c | 34 |
1 files changed, 34 insertions, 0 deletions
@@ -123,6 +123,7 @@ struct ofono_sim { unsigned int cphs_spn_short_watch; struct sim_fs *simfs; + struct sim_fs *simfs_isim; struct ofono_sim_context *context; struct ofono_sim_context *early_context; @@ -1483,6 +1484,14 @@ static void discover_apps_cb(const struct ofono_error *error, s->state = SESSION_STATE_INACTIVE; sim->aid_sessions = g_slist_prepend(sim->aid_sessions, s); + if (app->type == SIM_APP_TYPE_ISIM) { + /* + * If an ISIM application is found, we should init + * the FS structure so the ISIM EF's can be accessed. + */ + sim->simfs_isim = sim_fs_new(sim, sim->driver); + } + iter = g_slist_next(iter); } } @@ -2237,6 +2246,29 @@ struct ofono_sim_context *ofono_sim_context_create(struct ofono_sim *sim) return sim_fs_context_new(sim->simfs); } +struct ofono_sim_context *ofono_sim_context_create_isim( + struct ofono_sim *sim) +{ + GSList *iter = sim->aid_sessions; + + if (sim == NULL || sim->simfs_isim == NULL) + return NULL; + + /* Find the AID */ + while (iter) { + struct ofono_sim_aid_session *session = iter->data; + + if (session->record->type == SIM_APP_TYPE_ISIM) { + return sim_fs_context_new_with_aid(sim->simfs_isim, + session->record->aid); + } + + iter = g_slist_next(iter); + } + + return NULL; +} + void ofono_sim_context_free(struct ofono_sim_context *context) { return sim_fs_context_free(context); @@ -3067,6 +3099,8 @@ static void sim_remove(struct ofono_atom *atom) sim_fs_free(sim->simfs); sim->simfs = NULL; + sim_fs_free(sim->simfs_isim); + sim->simfs_isim = NULL; g_free(sim); } |