Hi Daniel,
> Read out Intergrated Cicruit Card Identifier from SIM.
> ---
> v0: initial version
>
> doc/sim-api.txt | 5 +++++
> include/types.h | 2 ++
> src/sim.c | 29 +++++++++++++++++++++++++++++
> src/simutil.h | 1 +
> 4 files changed, 37 insertions(+), 0 deletions(-)
>
> diff --git a/doc/sim-api.txt b/doc/sim-api.txt
> index fd02396..d608205 100644
> --- a/doc/sim-api.txt
> +++ b/doc/sim-api.txt
> @@ -115,3 +115,8 @@ Properties string SubscriberIdentity [readonly,
> optional]
>
> The list contains elements of the same format as the
> PinRequired property.
> +
> + string IntegratedCircuitCardIdentifier [readonly]
I'd like to name this CardIdentifier, ICCID is too ugly and the full name is
just too long.
> +static void sim_iccid_read_cb(const struct ofono_error *error,
> + const unsigned char *data, int len, void *user)
> +{
> + struct ofono_sim *sim = user;
> + char number[OFONO_MAX_ICCID_LENGTH+ 1];
> +
> + if (!error || error->type != OFONO_ERROR_TYPE_NO_ERROR || len != 10)
> + return;
No need to check for error being NULL, we don't allow that.
> +
> + extract_bcd_number(data, len, number);
> + number[OFONO_MAX_ICCID_LENGTH] = '\0';
> + sim->iccid = g_strdup(number);
> +
> + DBG("ICCID %s", sim->iccid);
> +}
> +
You might want to emit the property changed signal with the new ICCID value
here.
> static void sim_efphase_read_cb(const struct ofono_error *error,
> const unsigned char *data, int len, void *user)
> {
> @@ -1320,6 +1341,9 @@ static void sim_determine_phase(struct ofono_sim
> *sim)
>
> static void sim_initialize(struct ofono_sim *sim)
> {
> + sim->driver->read_file_transparent(sim, SIM_EF_ICCID_FILEID, 0, 10,
> + sim_iccid_read_cb, sim);
> +
Please use the sim file queue like EFpl does, no need to invent your own
solution. The phase check is a very specific case because we cache SIM files
by
phase of the SIM, so it needs to be known / guessed before the rest of sim file
queue runs.
Regards,
-Denis
_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono