From acc65afceed3e5abdad3fe8a560161f67c28f7de Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Thu, 9 Jul 2009 17:06:59 -0500 Subject: [PATCH] Add get/set sim readiness functions --- src/sim.c | 28 ++++++++++++++++++++++++++++ src/sim.h | 2 ++ 2 files changed, 30 insertions(+) diff --git a/src/sim.c b/src/sim.c index c3829da..9f388dc 100644 --- a/src/sim.c +++ b/src/sim.c @@ -49,6 +49,7 @@ struct sim_manager_data { char *imsi; GSList *own_numbers; GSList *ready_notify; + gboolean ready; int dcbyte; @@ -819,9 +820,36 @@ void ofono_sim_ready_notify_unregister(struct ofono_modem *modem, g_slist_remove(modem->sim_manager->ready_notify, cb); } +int ofono_sim_get_ready(struct ofono_modem *modem) +{ + if (modem->sim_manager == NULL) + return 0; + + if (modem->sim_manager->ready == TRUE) + return 1; + return 0; } +void ofono_sim_set_ready(struct ofono_modem *modem) +{ + GSList *l; + + if (modem->sim_manager == NULL) + return; + + if (modem->sim_manager->ready == TRUE) + return; + + modem->sim_manager->ready = TRUE; + + for (l = modem->sim_manager->ready_notify; l; l = l->next) { + ofono_sim_ready_notify_cb_t cb = l->data; + + cb(modem); + } +} + int ofono_sim_manager_register(struct ofono_modem *modem, struct ofono_sim_ops *ops) { diff --git a/src/sim.h b/src/sim.h index 8f1707b..ec69070 100644 --- a/src/sim.h +++ b/src/sim.h @@ -39,3 +39,5 @@ void ofono_sim_ready_notify_unregister(struct ofono_modem *modem, const char *ofono_operator_name_sim_override(struct ofono_modem *modem, const char *mcc, const char *mnc); +int ofono_sim_get_ready(struct ofono_modem *modem); +void ofono_sim_set_ready(struct ofono_modem *modem); -- 2.7.4