summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2009-07-14 13:47:22 -0500
committerDenis Kenzior <denkenz@gmail.com>2009-07-14 15:45:06 -0500
commitbda598b93a531da9d38123297b4619a7e09012f2 (patch)
tree31a0ea5d680de338271b79f8f27579eb536c4e00
parent8129119d615d2c7b8f06d95798df0377450781fb (diff)
downloadofono-bda598b93a531da9d38123297b4619a7e09012f2.tar.bz2
Refactor EONS to have lac / non-lac versions
PNN/OPL database has fields which provide global operator naming, or specific to a cell range. The cell range can only be obtained if the operator is the current one.
-rw-r--r--src/simutil.c25
-rw-r--r--src/simutil.h6
2 files changed, 27 insertions, 4 deletions
diff --git a/src/simutil.c b/src/simutil.c
index 2b22c329..3f00b1b4 100644
--- a/src/simutil.c
+++ b/src/simutil.c
@@ -328,9 +328,10 @@ static gint opl_operator_compare(gconstpointer a, gconstpointer b)
{
}
-struct sim_eons_operator_info *sim_eons_lookup(struct sim_eons *eons,
- const char *mcc,
- const char *mnc, guint16 lac)
+static struct sim_eons_operator_info *
+ sim_eons_lookup_common(struct sim_eons *eons,
+ const char *mcc, const char *mnc,
+ gboolean have_lac, guint16 lac)
{
GSList *l;
const struct opl_operator *opl;
@@ -352,6 +353,9 @@ struct sim_eons_operator_info *sim_eons_lookup(struct sim_eons *eons,
if (opl->lac_tac_low == 0 && opl->lac_tac_high == 0xfffe)
break;
+ if (have_lac == FALSE)
+ continue;
+
if ((lac >= opl->lac_tac_low) && (lac <= opl->lac_tac_high))
break;
}
@@ -367,3 +371,18 @@ struct sim_eons_operator_info *sim_eons_lookup(struct sim_eons *eons,
return &eons->pnn_list[opl->id - 1];
}
+
+struct sim_eons_operator_info *sim_eons_lookup(struct sim_eons *eons,
+ const char *mcc,
+ const char *mnc)
+{
+ return sim_eons_lookup_common(eons, mcc, mnc, FALSE, 0);
+}
+
+struct sim_eons_operator_info *sim_eons_lookup_with_lac(struct sim_eons *eons,
+ const char *mcc,
+ const char *mnc,
+ guint16 lac)
+{
+ return sim_eons_lookup_common(eons, mcc, mnc, TRUE, lac);
+}
diff --git a/src/simutil.h b/src/simutil.h
index dcabc37f..fb0a1b8e 100644
--- a/src/simutil.h
+++ b/src/simutil.h
@@ -56,9 +56,13 @@ gboolean sim_eons_pnn_is_empty(struct sim_eons *eons);
void sim_eons_add_opl_record(struct sim_eons *eons,
const guint8 *tlv, int length);
void sim_eons_optimize(struct sim_eons *eons);
+struct sim_eons_operator_info *sim_eons_lookup_with_lac(struct sim_eons *eons,
+ const char *mcc,
+ const char *mnc,
+ guint16 lac);
struct sim_eons_operator_info *sim_eons_lookup(struct sim_eons *eons,
const char *mcc,
- const char *mnc, guint16 lac);
+ const char *mnc);
void sim_eons_free(struct sim_eons *eons);
struct sim_spdi *sim_spdi_new(const guint8 *tlv, int length);