summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrzej Zaborowski <andrew.zaborowski@intel.com>2009-06-18 05:44:44 +0200
committerDenis Kenzior <denkenz@gmail.com>2009-06-18 04:02:05 -0500
commit2b451eaeab59c255a850afbcc354bacd186700ba (patch)
treeb45733e558ce55d5e59ca596eff12218c0f2ea64 /src
parent498759f2b6f68fd7c1326589a4c20176a266fa41 (diff)
downloadofono-2b451eaeab59c255a850afbcc354bacd186700ba.tar.bz2
Add record based file capability to sim_ops
Add capability to read / write / stat files on the SIM. This now supports cyclic, linear fixed and transparent SIM files. Parse GET RESPONSE result to find structure of the file (cyclic, linear fixed, or transparent), the file size and the record length. Add both read and update capability for binary and record-based files. Implement writing sim files through AT.
Diffstat (limited to 'src')
-rw-r--r--src/driver.h31
-rw-r--r--src/sim.c16
2 files changed, 34 insertions, 13 deletions
diff --git a/src/driver.h b/src/driver.h
index 3a690f0f..842bc107 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -102,6 +102,13 @@ struct ofono_own_number {
int itc;
};
+/* 51.011 Section 9.3 */
+enum ofono_simfile_struct {
+ OFONO_SIM_FILE_TRANSPARENT = 0,
+ OFONO_SIM_FILE_FIXED = 1,
+ OFONO_SIM_FILE_CYCLIC = 3
+};
+
/* Notification functions, the integer values here should map to
* values obtained from the modem. The enumerations are the same
* as the values for the fields found in 3GPP TS 27.007
@@ -160,8 +167,10 @@ typedef void (*ofono_call_meter_puct_query_cb_t)(const struct ofono_error *error
typedef void (*ofono_call_barring_cb_t)(const struct ofono_error *error,
int status, void *data);
-typedef void (*ofono_sim_file_len_cb_t)(const struct ofono_error *error,
- int length, void *data);
+typedef void (*ofono_sim_file_info_cb_t)(const struct ofono_error *error,
+ int filelength,
+ enum ofono_simfile_struct structure,
+ int recordlength, void *data);
typedef void (*ofono_sim_read_cb_t)(const struct ofono_error *error,
const unsigned char *sdata, int length,
@@ -367,10 +376,20 @@ int ofono_call_barring_register(struct ofono_modem *modem,
void ofono_call_barring_unregister(struct ofono_modem *modem);
struct ofono_sim_ops {
- void (*read_file_len)(struct ofono_modem *modem, int fileid,
- ofono_sim_file_len_cb_t cb, void *data);
- void (*read_file)(struct ofono_modem *modem, int fileid, int start,
- int length, ofono_sim_read_cb_t cb, void *data);
+ void (*read_file_info)(struct ofono_modem *modem, int fileid,
+ ofono_sim_file_info_cb_t cb, void *data);
+ void (*read_file_transparent)(struct ofono_modem *modem, int fileid,
+ int start, int length,
+ ofono_sim_read_cb_t cb, void *data);
+ void (*read_file_linear)(struct ofono_modem *modem, int fileid,
+ int record, int length,
+ ofono_sim_read_cb_t cb, void *data);
+ void (*write_file_transparent)(struct ofono_modem *modem, int fileid,
+ int start, int length, const unsigned char *value,
+ ofono_generic_cb_t cb, void *data);
+ void (*write_file_linear)(struct ofono_modem *modem, int fileid,
+ int record, int length, const unsigned char *value,
+ ofono_generic_cb_t cb, void *data);
void (*read_imsi)(struct ofono_modem *modem,
ofono_imsi_cb_t cb, void *data);
void (*read_own_numbers)(struct ofono_modem *modem,
diff --git a/src/sim.c b/src/sim.c
index acec7bb8..9c852929 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -237,16 +237,18 @@ static void sim_spn_read_cb(const struct ofono_error *error,
sim_spn_notify(modem, l->data);
}
-static void sim_spn_len_cb(const struct ofono_error *error,
- int length, void *data)
+static void sim_spn_info_cb(const struct ofono_error *error,
+ int length, enum ofono_simfile_struct structure, int dummy,
+ void *data)
{
struct ofono_modem *modem = data;
struct sim_manager_data *sim = modem->sim_manager;
- if (error->type != OFONO_ERROR_TYPE_NO_ERROR || length <= 1)
+ if (error->type != OFONO_ERROR_TYPE_NO_ERROR || length <= 1 ||
+ structure != OFONO_SIM_FILE_TRANSPARENT)
return;
- sim->ops->read_file(modem, SIM_EFSPN_FILEID, 0, length,
+ sim->ops->read_file_transparent(modem, SIM_EFSPN_FILEID, 0, length,
sim_spn_read_cb, modem);
}
@@ -255,8 +257,8 @@ static gboolean sim_retrieve_spn(void *user_data)
struct ofono_modem *modem = user_data;
struct sim_manager_data *sim = modem->sim_manager;
- sim->ops->read_file_len(modem, SIM_EFSPN_FILEID,
- sim_spn_len_cb, modem);
+ sim->ops->read_file_info(modem, SIM_EFSPN_FILEID,
+ sim_spn_info_cb, modem);
return FALSE;
}
@@ -341,7 +343,7 @@ static void initialize_sim_manager(struct ofono_modem *modem)
modem_add_interface(modem, SIM_MANAGER_INTERFACE);
- if (modem->sim_manager->ops->read_file)
+ if (modem->sim_manager->ops->read_file_transparent)
g_timeout_add(0, sim_retrieve_spn, modem);
if (modem->sim_manager->ops->read_imsi)