Open Source Telephony
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH] Add init phonesim stk support
Date: Thu, 08 Jul 2010 14:52:17 -0500	[thread overview]
Message-ID: <4C362C71.7050703@gmail.com> (raw)
In-Reply-To: <1278586608-6246-1-git-send-email-yang.gu@intel.com>

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

Hi Yang,

> +static void phonesim_csim_envelope_cb(gboolean ok, GAtResult *result,
> +				gpointer user_data)
> +{
> +	struct cb_data *cbd = user_data;
> +	GAtResultIter iter;
> +	ofono_stk_envelope_cb_t cb = cbd->cb;
> +	struct ofono_error error;
> +	const guint8 *response;
> +	gint rlen, len;
> +
> +	decode_at_error(&error, g_at_result_final_response(result));
> +
> +	if (!ok)
> +		goto error;
> +
> +	g_at_result_iter_init(&iter, result);
> +
> +	if (!g_at_result_iter_next(&iter, "+CSIM:"))
> +		goto error;
> +
> +	if (!g_at_result_iter_next_number(&iter, &rlen))
> +		goto error;
> +
> +	if (!g_at_result_iter_next_hexstring(&iter, &response, &len))
> +		goto error;
> +
> +	if (rlen != len * 2 || len < 2)
> +		goto error;
> +
> +	if (response[len - 2] != 0x90 && response[len - 2] != 0x91)
> +		goto error;
> +
> +	if (response[len - 2] == 0x90 && response[len - 1] != 0)
> +		goto error;
> +
> +	DBG("csim_envelope_cb: %i", len);
> +
> +	cb(&error, response, len - 2, cbd->data);
> +	return;
> +
> +error:
> +	CALLBACK_WITH_FAILURE(cb, NULL, 0, cbd->data);
> +}

Please note that Andrew recently introduced OFONO_ERROR_TYPE_SIM, so you
might want to follow the same conventions.  See drivers/atmodem/stk.c.

Regards,
-Denis

  reply	other threads:[~2010-07-08 19:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-08 10:56 [PATCH] Add init phonesim stk support Yang Gu
2010-07-08 19:52 ` Denis Kenzior [this message]
2010-07-08 20:10 ` Denis Kenzior

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=4C362C71.7050703@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