summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPetteri Tikander <petteri.tikander@ixonos.com>2010-10-21 17:58:11 +0300
committerDenis Kenzior <denkenz@gmail.com>2010-10-22 11:21:23 -0500
commitd82600c8930aca8eb8b15722720bc140649eb6d0 (patch)
treea836eaa3e4213f8dfea3dc059d74b3ab5cbd8c4d /src
parentd74e0b5ece6435641e0f32feda65353415a1441b (diff)
downloadofono-d82600c8930aca8eb8b15722720bc140649eb6d0.tar.bz2
sim: check if Fixed Dial is enabled in SIM-card
If SIM-card is inserted, status is checked from EFsst (is FDN activated) and EFadn (is ADN invalidated). If USIM-card is inserted, status is checked from EFest (is FDN activated). If FD is enabled, halt SIM initialization procedure. New property (FixedDialing) is added. If FD is enabled, this has been signalled via DBUS.
Diffstat (limited to 'src')
-rw-r--r--src/sim.c68
1 files changed, 68 insertions, 0 deletions
diff --git a/src/sim.c b/src/sim.c
index d87c71f4..e5be8b69 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -72,6 +72,7 @@ struct ofono_sim {
unsigned char efest_length;
unsigned char *efsst;
unsigned char efsst_length;
+ gboolean fixed_dialing;
char *imsi;
@@ -310,6 +311,9 @@ static DBusMessage *sim_get_properties(DBusConnection *conn,
ofono_dbus_dict_append(&dict, "SubscriberIdentity",
DBUS_TYPE_STRING, &sim->imsi);
+ ofono_dbus_dict_append(&dict, "FixedDialing", DBUS_TYPE_BOOLEAN,
+ &sim->fixed_dialing);
+
if (sim->mnc_length) {
char mcc[OFONO_MAX_MCC_LENGTH + 1];
char mnc[OFONO_MAX_MNC_LENGTH + 1];
@@ -1241,6 +1245,33 @@ static void sim_retrieve_imsi(struct ofono_sim *sim)
sim->driver->read_imsi(sim, sim_imsi_cb, sim);
}
+static void sim_efadn_info_read_cb(int ok, unsigned char file_status,
+ int total_length, int record_length,
+ void *userdata)
+{
+ struct ofono_sim *sim = userdata;
+
+ if (!ok)
+ goto out;
+
+ if (file_status != SIM_FILE_STATUS_VALID) {
+ DBusConnection *conn = ofono_dbus_get_connection();
+ const char *path = __ofono_atom_get_path(sim->atom);
+
+ sim->fixed_dialing = TRUE;
+
+ ofono_dbus_signal_property_changed(conn, path,
+ OFONO_SIM_MANAGER_INTERFACE,
+ "FixedDialing",
+ DBUS_TYPE_BOOLEAN,
+ &sim->fixed_dialing);
+ return;
+ }
+
+out:
+ sim_retrieve_imsi(sim);
+}
+
static void sim_efsst_read_cb(int ok, int length, int record,
const unsigned char *data,
int record_length, void *userdata)
@@ -1258,6 +1289,21 @@ static void sim_efsst_read_cb(int ok, int length, int record,
sim->efsst = g_memdup(data, length);
sim->efsst_length = length;
+ /*
+ * Check if Fixed Dialing is enabled in the SIM-card
+ * (TS 11.11/TS 51.011, Section 11.5.1: FDN capability request).
+ * If FDN is activated and ADN is invalidated,
+ * don't continue initialization routine.
+ */
+ if (sim_sst_is_active(sim->efsst, sim->efsst_length,
+ SIM_SST_SERVICE_FDN)) {
+
+ sim_fs_read_info(sim->simfs, SIM_EFADN_FILEID,
+ OFONO_SIM_FILE_STRUCTURE_FIXED,
+ sim_efadn_info_read_cb, sim);
+ return;
+ }
+
out:
sim_retrieve_imsi(sim);
}
@@ -1279,6 +1325,26 @@ static void sim_efest_read_cb(int ok, int length, int record,
sim->efest = g_memdup(data, length);
sim->efest_length = length;
+ /*
+ * Check if Fixed Dialing is enabled in the USIM-card
+ * (TS 31.102, Section 5.3.2: FDN capability request).
+ * If FDN is activated, don't continue initialization routine.
+ */
+ if (sim_est_is_active(sim->efest, sim->efest_length,
+ SIM_EST_SERVICE_FDN)) {
+ DBusConnection *conn = ofono_dbus_get_connection();
+ const char *path = __ofono_atom_get_path(sim->atom);
+
+ sim->fixed_dialing = TRUE;
+
+ ofono_dbus_signal_property_changed(conn, path,
+ OFONO_SIM_MANAGER_INTERFACE,
+ "FixedDialing",
+ DBUS_TYPE_BOOLEAN,
+ &sim->fixed_dialing);
+ return;
+ }
+
out:
sim_retrieve_imsi(sim);
}
@@ -1857,6 +1923,8 @@ static void sim_free_state(struct ofono_sim *sim)
g_free(sim->iidf_image);
sim->iidf_image = NULL;
+
+ sim->fixed_dialing = FALSE;
}
void ofono_sim_inserted_notify(struct ofono_sim *sim, ofono_bool_t inserted)