mirror of git://git.sysmocom.de/ofono
sim: Revert adding special callback for EFmsisdn
This reverts commit c3124b66d9
.
This commit is contained in:
parent
bee063dd76
commit
a8247d17af
|
@ -94,10 +94,6 @@ typedef void (*ofono_sim_read_cb_t)(const struct ofono_error *error,
|
||||||
typedef void (*ofono_sim_write_cb_t)(const struct ofono_error *error,
|
typedef void (*ofono_sim_write_cb_t)(const struct ofono_error *error,
|
||||||
void *data);
|
void *data);
|
||||||
|
|
||||||
typedef void (*ofono_sim_msisdn_cb_t)(const struct ofono_error *error,
|
|
||||||
const struct ofono_phone_number *ph,
|
|
||||||
void *data);
|
|
||||||
|
|
||||||
typedef void (*ofono_sim_iccid_cb_t)(const struct ofono_error *error,
|
typedef void (*ofono_sim_iccid_cb_t)(const struct ofono_error *error,
|
||||||
const char *iccid, void *data);
|
const char *iccid, void *data);
|
||||||
|
|
||||||
|
@ -151,8 +147,6 @@ struct ofono_sim_driver {
|
||||||
void (*write_file_cyclic)(struct ofono_sim *sim, int fileid,
|
void (*write_file_cyclic)(struct ofono_sim *sim, int fileid,
|
||||||
int length, const unsigned char *value,
|
int length, const unsigned char *value,
|
||||||
ofono_sim_write_cb_t cb, void *data);
|
ofono_sim_write_cb_t cb, void *data);
|
||||||
void (*read_msisdn)(struct ofono_sim *sim,
|
|
||||||
ofono_sim_msisdn_cb_t cb, void *data);
|
|
||||||
void (*read_iccid)(struct ofono_sim *sim,
|
void (*read_iccid)(struct ofono_sim *sim,
|
||||||
ofono_sim_iccid_cb_t cb, void *data);
|
ofono_sim_iccid_cb_t cb, void *data);
|
||||||
void (*read_imsi)(struct ofono_sim *sim,
|
void (*read_imsi)(struct ofono_sim *sim,
|
||||||
|
|
85
src/sim.c
85
src/sim.c
|
@ -1126,8 +1126,37 @@ static gboolean numbers_list_equal(GSList *a, GSList *b)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sim_own_numbers_update_done(struct ofono_sim *sim)
|
static void sim_msisdn_read_cb(int ok, int length, int record,
|
||||||
|
const unsigned char *data,
|
||||||
|
int record_length, void *userdata)
|
||||||
{
|
{
|
||||||
|
struct ofono_sim *sim = userdata;
|
||||||
|
int total;
|
||||||
|
struct ofono_phone_number ph;
|
||||||
|
|
||||||
|
if (!ok)
|
||||||
|
goto check;
|
||||||
|
|
||||||
|
if (record_length < 14 || length < record_length)
|
||||||
|
return;
|
||||||
|
|
||||||
|
total = length / record_length;
|
||||||
|
|
||||||
|
sim->efmsisdn_length = record_length;
|
||||||
|
sim->efmsisdn_records = total;
|
||||||
|
|
||||||
|
if (sim_adn_parse(data, record_length, &ph, NULL) == TRUE) {
|
||||||
|
struct ofono_phone_number *own;
|
||||||
|
|
||||||
|
own = g_new(struct ofono_phone_number, 1);
|
||||||
|
memcpy(own, &ph, sizeof(struct ofono_phone_number));
|
||||||
|
sim->new_numbers = g_slist_prepend(sim->new_numbers, own);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (record != total)
|
||||||
|
return;
|
||||||
|
|
||||||
|
check:
|
||||||
/* All records retrieved */
|
/* All records retrieved */
|
||||||
if (sim->new_numbers)
|
if (sim->new_numbers)
|
||||||
sim->new_numbers = g_slist_reverse(sim->new_numbers);
|
sim->new_numbers = g_slist_reverse(sim->new_numbers);
|
||||||
|
@ -1157,60 +1186,6 @@ static void sim_own_numbers_update_done(struct ofono_sim *sim)
|
||||||
sim->new_numbers = NULL;
|
sim->new_numbers = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sim_msisdn_cb(const struct ofono_error *error,
|
|
||||||
const struct ofono_phone_number *ph, void *userdata)
|
|
||||||
{
|
|
||||||
struct ofono_sim *sim = userdata;
|
|
||||||
|
|
||||||
if (error->type == OFONO_ERROR_TYPE_NO_ERROR) {
|
|
||||||
struct ofono_phone_number *own;
|
|
||||||
|
|
||||||
own = g_new(struct ofono_phone_number, 1);
|
|
||||||
memcpy(own, ph, sizeof(struct ofono_phone_number));
|
|
||||||
sim->new_numbers = g_slist_prepend(sim->new_numbers, own);
|
|
||||||
}
|
|
||||||
|
|
||||||
sim_own_numbers_update_done(sim);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void sim_msisdn_read_cb(int ok, int length, int record,
|
|
||||||
const unsigned char *data,
|
|
||||||
int record_length, void *userdata)
|
|
||||||
{
|
|
||||||
struct ofono_sim *sim = userdata;
|
|
||||||
int total;
|
|
||||||
struct ofono_phone_number ph;
|
|
||||||
|
|
||||||
if (!ok) {
|
|
||||||
if (sim->driver->read_msisdn)
|
|
||||||
sim->driver->read_msisdn(sim, sim_msisdn_cb, sim);
|
|
||||||
else
|
|
||||||
sim_own_numbers_update_done(sim);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (record_length < 14 || length < record_length)
|
|
||||||
return;
|
|
||||||
|
|
||||||
total = length / record_length;
|
|
||||||
|
|
||||||
sim->efmsisdn_length = record_length;
|
|
||||||
sim->efmsisdn_records = total;
|
|
||||||
|
|
||||||
if (sim_adn_parse(data, record_length, &ph, NULL) == TRUE) {
|
|
||||||
struct ofono_phone_number *own;
|
|
||||||
|
|
||||||
own = g_new(struct ofono_phone_number, 1);
|
|
||||||
memcpy(own, &ph, sizeof(struct ofono_phone_number));
|
|
||||||
sim->new_numbers = g_slist_prepend(sim->new_numbers, own);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (record != total)
|
|
||||||
return;
|
|
||||||
|
|
||||||
sim_own_numbers_update_done(sim);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gint service_number_compare(gconstpointer a, gconstpointer b)
|
static gint service_number_compare(gconstpointer a, gconstpointer b)
|
||||||
{
|
{
|
||||||
const struct service_number *sdn = a;
|
const struct service_number *sdn = a;
|
||||||
|
|
Loading…
Reference in New Issue