Open Source Telephony
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [RFC PATCH 3/8] simutil: response-handler returns now also file-status
Date: Thu, 14 Oct 2010 05:41:17 -0500	[thread overview]
Message-ID: <4CB6DE4D.1030107@gmail.com> (raw)
In-Reply-To: <1286896694-3054-4-git-send-email-petteri.tikander@ixonos.com>

[-- Attachment #1: Type: text/plain, Size: 2462 bytes --]

Hi Petteri,

On 10/12/2010 10:18 AM, Petteri Tikander wrote:
> ---
>  src/simutil.c |    5 ++++-
>  src/simutil.h |   11 ++++++++++-
>  2 files changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/src/simutil.c b/src/simutil.c
> index 65ce1ac..04ba975 100644
> --- a/src/simutil.c
> +++ b/src/simutil.c
> @@ -1405,7 +1405,8 @@ gboolean sim_parse_3g_get_response(const unsigned char *data, int len,
>  
>  gboolean sim_parse_2g_get_response(const unsigned char *response, int len,
>  					int *file_len, int *record_len,
> -					int *structure, unsigned char *access)
> +					int *structure, unsigned char *access,
> +					unsigned char *file_status)
>  {
>  	if (len < 14 || response[6] != 0x04)
>  		return FALSE;
> @@ -1420,6 +1421,8 @@ gboolean sim_parse_2g_get_response(const unsigned char *response, int len,
>  	access[1] = response[9];
>  	access[2] = response[10];
>  
> +	*file_status = response[11];
> +
>  	if (response[13] == 0x01 || response[13] == 0x03)
>  		*record_len = response[14];
>  	else

This looks fine.

> diff --git a/src/simutil.h b/src/simutil.h
> index 54b99a0..bd8e4ac 100644
> --- a/src/simutil.h
> +++ b/src/simutil.h
> @@ -57,6 +57,14 @@ enum sim_file_access {
>  	SIM_FILE_ACCESS_NEVER = 15,
>  };
>  
> +/* 51.011 Section 9.3 */
> +enum sim_file_status {
> +	SIM_FILE_STATUS_INVALID			= 0x00,
> +	SIM_FILE_STATUS_NOT_INVALID		= 0x01,
> +	SIM_FILE_STATUS_INVALID_BUT_ACCESS	= 0x04,
> +	SIM_FILE_STATUS_NOT_AVAILABLE		= 0xFF,
> +};
> +

I don't like this, you should structure this enum as a set of status flags.

E.g. SIM_FILE_STATUS_VALID = 0x01, SIM_FILE_STATUS_RW_WHEN_INVALID = 0x04

I don't see the need for the NOT_AVAILABLE enum since you will never
check this status in the 3G case.  Passing 0 here is fine.  But feel
free to correct me if I'm wrong.

>  /* 131.102 Section 4.2.8 */
>  enum sim_ust_service {
>  	SIM_UST_SERVICE_LOCAL_PHONE_BOOK		= 0,
> @@ -425,7 +433,8 @@ gboolean sim_parse_3g_get_response(const unsigned char *data, int len,
>  
>  gboolean sim_parse_2g_get_response(const unsigned char *response, int len,
>  					int *file_len, int *record_len,
> -					int *structure, unsigned char *access);
> +					int *structure, unsigned char *access,
> +					unsigned char *file_status);
>  
>  gboolean sim_ust_is_available(unsigned char *service_ust, unsigned char len,
>  						enum sim_ust_service index);

Regards,
-Denis

  parent reply	other threads:[~2010-10-14 10:41 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-12 15:18 Handling of Fixed Dialing v3 Petteri Tikander
2010-10-12 15:18 ` [RFC PATCH 1/8] sim: add function to read general info from SIM EF-file Petteri Tikander
2010-10-12 15:18   ` [RFC PATCH 2/8] simfs: add logic to retrieve only only EF-info, but no EF-contents Petteri Tikander
2010-10-12 15:18     ` [RFC PATCH 3/8] simutil: response-handler returns now also file-status Petteri Tikander
2010-10-12 15:18       ` [RFC PATCH 4/8] atmodem: returns file-status of SIM EF-file Petteri Tikander
2010-10-12 15:18         ` [RFC PATCH 5/8] isimodem: " Petteri Tikander
2010-10-12 15:18           ` [RFC PATCH 6/8] simutil: add ID of EFadn Petteri Tikander
2010-10-12 15:18             ` [RFC PATCH 7/8] sim: check if Fixed Dialing is enabled in the SIM-card Petteri Tikander
2010-10-12 15:18               ` [RFC PATCH 8/8] doc: update sim-api Petteri Tikander
2010-10-14  5:56                 ` Marcel Holtmann
2010-10-14 11:22               ` [RFC PATCH 7/8] sim: check if Fixed Dialing is enabled in the SIM-card Denis Kenzior
2010-10-14 11:24               ` Denis Kenzior
2010-10-14 10:43             ` [RFC PATCH 6/8] simutil: add ID of EFadn Denis Kenzior
2010-10-14 10:58           ` [RFC PATCH 5/8] isimodem: returns file-status of SIM EF-file Denis Kenzior
2010-10-14 10:57         ` [RFC PATCH 4/8] atmodem: " Denis Kenzior
2010-10-14 16:54           ` Petteri Tikander
2010-10-14 11:03         ` Denis Kenzior
2010-10-14 10:41       ` Denis Kenzior [this message]
2010-10-14 16:12         ` [RFC PATCH 3/8] simutil: response-handler returns now also file-status Petteri Tikander
2010-10-14 11:10     ` [RFC PATCH 2/8] simfs: add logic to retrieve only only EF-info, but no EF-contents Denis Kenzior
2010-10-14 11:07   ` [RFC PATCH 1/8] sim: add function to read general info from SIM EF-file Denis Kenzior
2010-10-14 15:14     ` Petteri Tikander

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CB6DE4D.1030107@gmail.com \
    --to=denkenz@gmail.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox