All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [RFC 2/4] stk: Handle Launch Browser proactive command
Date: Wed, 12 Jan 2011 16:31:48 -0600	[thread overview]
Message-ID: <4D2E2BD4.9050303@gmail.com> (raw)
In-Reply-To: <1294652623-17287-3-git-send-email-jeevaka.badrappan@elektrobit.com>

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

Hi Jeevaka,

> +static gboolean handle_command_launch_browser(const struct stk_command *cmd,
> +						struct stk_response *rsp,
> +						struct ofono_stk *stk)
> +{
> +	const struct stk_command_launch_browser *lb = &cmd->launch_browser;
> +	struct ofono_modem *modem = __ofono_atom_get_modem(stk->atom);
> +	static unsigned char no_cause[] = { 0x00 };
> +	static unsigned char no_service[] = { 0x04 };
> +	struct ofono_atom *netreg_atom;
> +	struct ofono_netreg *netreg;
> +	int qualifier = cmd->qualifier;
> +	char *alpha_id;
> +	int err;
> +	int status;
> +
> +	if (qualifier > 3 || qualifier == 1) {
> +		rsp->result.type = STK_RESULT_TYPE_COMMAND_NOT_UNDERSTOOD;
> +		return TRUE;
> +	}
> +
> +	if ( lb->browser_id > 4) {
> +		rsp->result.type = STK_RESULT_TYPE_DATA_NOT_UNDERSTOOD;
> +		return TRUE;
> +	}
> +
> +	if (ofono_modem_get_online(modem) == FALSE) {
> +		ADD_ERROR_RESULT(rsp->result, STK_RESULT_TYPE_TERMINAL_BUSY,
> +					no_service);
> +		return TRUE;
> +	}
> +
> +	netreg_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_NETREG);
> +	if (netreg_atom == NULL) {
> +		rsp->result.type = STK_RESULT_TYPE_NOT_CAPABLE;
> +		return TRUE;
> +	}
> +
> +	netreg = __ofono_atom_get_data(netreg_atom);
> +	status = __ofono_netreg_registration_status(netreg);
> +
> +	if (status != NETWORK_REGISTRATION_STATUS_REGISTERED &&
> +			status != NETWORK_REGISTRATION_STATUS_ROAMING) {
> +		ADD_ERROR_RESULT(rsp->result, STK_RESULT_TYPE_TERMINAL_BUSY,
> +					no_service);
> +		return TRUE;
> +	}
> +

So a question about this.  Why are we checking the netreg atom?
Shouldn't we be checking the gprs atom's attached property?  But this
brings up an even more interesting question, do we even need to assume
that we have to be attached to the cellular network to perform these
operations?  We could in theory go over wifi.

Thoughts?

> +	alpha_id = dbus_apply_text_attributes(lb->alpha_id ? lb->alpha_id : "",
> +							&lb->text_attr);
> +	if (alpha_id == NULL) {
> +		rsp->result.type = STK_RESULT_TYPE_DATA_NOT_UNDERSTOOD;
> +		return TRUE;
> +	}
> +
> +	err = stk_agent_launch_browser(stk->current_agent, alpha_id,
> +					lb->icon_id.id, lb->url,
> +					confirm_launch_browser_cb,
> +					stk, NULL, stk->timeout * 1000);
> +	g_free(alpha_id);
> +
> +	if (err < 0) {
> +		/*
> +		 * We most likely got an out of memory error, tell SIM
> +		 * to retry
> +		 */
> +		ADD_ERROR_RESULT(rsp->result, STK_RESULT_TYPE_TERMINAL_BUSY,
> +					no_cause);
> +		return TRUE;
> +	}
> +
> +	stk->respond_on_exit = TRUE;
> +	stk->cancel_cmd = stk_request_cancel;
> +
> +	return FALSE;
> +}
> +

Rest seems reasonable to me.

Regards,
-Denis

  reply	other threads:[~2011-01-12 22:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-10  9:43 [RFC 0/4] LaunchBrowser Proactive command Support Jeevaka Badrappan
2011-01-10  9:43 ` [RFC 1/4] network: __ofono_netreg_registration_status internal api Jeevaka Badrappan
2011-01-12 22:20   ` Denis Kenzior
2011-01-10  9:43 ` [RFC 2/4] stk: Handle Launch Browser proactive command Jeevaka Badrappan
2011-01-12 22:31   ` Denis Kenzior [this message]
2011-01-12 22:45     ` andrzej zaborowski
2011-01-13 14:56       ` Jeevaka.Badrappan
2011-01-13 16:35         ` Denis Kenzior
2011-01-10  9:43 ` [RFC 3/4] test: Add support for launch browser command Jeevaka Badrappan
2011-01-10  9:43 ` [RFC 4/4] doc: Describe LaunchBrowser method Jeevaka Badrappan
2011-01-12 22:26   ` 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=4D2E2BD4.9050303@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.