summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrzej Zaborowski <andrew.zaborowski@intel.com>2011-02-19 04:54:27 +0100
committerDenis Kenzior <denkenz@gmail.com>2011-03-15 20:20:25 -0500
commitf2a82b8e8d74bc4d398397e5b41bd088eb8031fd (patch)
tree257f604d921fc7255acdc9dc56e5ff836c0d4007
parent0550553c87a4b747665bcdc8f6de7518dfe7d430 (diff)
downloadofono-f2a82b8e8d74bc4d398397e5b41bd088eb8031fd.tar.bz2
sim: Watch for changes to EFmsisdn and EFsdn
-rw-r--r--src/sim.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/sim.c b/src/sim.c
index 0e607fbe..4bd7c5c5 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -1198,10 +1198,12 @@ out:
check:
/* All records retrieved */
if (sim->service_numbers) {
- char **service_numbers;
-
sim->service_numbers = g_slist_reverse(sim->service_numbers);
sim->sdn_ready = TRUE;
+ }
+
+ if (sim->sdn_ready) {
+ char **service_numbers;
service_numbers = get_service_numbers(sim->service_numbers);
@@ -1214,6 +1216,21 @@ check:
}
}
+static void sim_service_numbers_changed(int id, void *userdata)
+{
+ struct ofono_sim *sim = userdata;
+
+ if (sim->service_numbers) {
+ g_slist_foreach(sim->service_numbers,
+ (GFunc)service_number_free, NULL);
+ g_slist_free(sim->service_numbers);
+ sim->service_numbers = NULL;
+ }
+
+ ofono_sim_read(sim->context, SIM_EFSDN_FILEID,
+ OFONO_SIM_FILE_STRUCTURE_FIXED, sim_sdn_read_cb, sim);
+}
+
static void sim_own_numbers_update(struct ofono_sim *sim)
{
ofono_sim_read(sim->context, SIM_EFMSISDN_FILEID,
@@ -1221,6 +1238,13 @@ static void sim_own_numbers_update(struct ofono_sim *sim)
sim);
}
+static void sim_own_numbers_changed(int id, void *userdata)
+{
+ struct ofono_sim *sim = userdata;
+
+ sim_own_numbers_update(sim);
+}
+
static void sim_efimg_read_cb(int ok, int length, int record,
const unsigned char *data,
int record_length, void *userdata)
@@ -1270,9 +1294,14 @@ static void sim_ready(enum ofono_sim_state new_state, void *user)
return;
sim_own_numbers_update(sim);
+ ofono_sim_add_file_watch(sim->context, SIM_EFMSISDN_FILEID,
+ sim_own_numbers_changed, sim, NULL);
ofono_sim_read(sim->context, SIM_EFSDN_FILEID,
OFONO_SIM_FILE_STRUCTURE_FIXED, sim_sdn_read_cb, sim);
+ ofono_sim_add_file_watch(sim->context, SIM_EFSDN_FILEID,
+ sim_service_numbers_changed, sim, NULL);
+
ofono_sim_read(sim->context, SIM_EFIMG_FILEID,
OFONO_SIM_FILE_STRUCTURE_FIXED, sim_efimg_read_cb, sim);
}
@@ -2153,6 +2182,7 @@ static void sim_free_main_state(struct ofono_sim *sim)
(GFunc)service_number_free, NULL);
g_slist_free(sim->service_numbers);
sim->service_numbers = NULL;
+ sim->sdn_ready = FALSE;
}
if (sim->efust) {