diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/driver.h | 31 | ||||
-rw-r--r-- | src/sim.c | 16 |
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, @@ -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) |