All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC 0/4] LaunchBrowser Proactive command Support
@ 2011-01-10  9:43 Jeevaka Badrappan
  2011-01-10  9:43 ` [RFC 1/4] network: __ofono_netreg_registration_status internal api Jeevaka Badrappan
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Jeevaka Badrappan @ 2011-01-10  9:43 UTC (permalink / raw)
  To: ofono

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

Hi,

  This is a proposal for adding LaunchBrowser proactive command support to ofono:

 When a LaunchBrowser proactive command is received, oFono will inform the
agent to LaunchBrowser with the specified URL. If confirmed by user, agent
should launch the browser with the specified URL. This patch doesn't handle
the qualifier, Network Access Name, User Name, password and bearer information
which can be part of the LaunchBrowser proactive command.

Regards,
Jeevaka

Jeevaka Badrappan (4):
  network: __ofono_netreg_registration_status internal api
  stk: Handle Launch Browser proactive command
  test: Add support for launch browser command
  doc: Describe LaunchBrowser method

 doc/stk-api.txt    |    8 +++
 src/network.c      |    8 +++
 src/ofono.h        |    2 +
 src/stk.c          |  122 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/stkagent.c     |   67 ++++++++++++++++++++++++++++
 src/stkagent.h     |    5 ++
 test/test-stk-menu |   13 ++++++
 7 files changed, 225 insertions(+), 0 deletions(-)


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [RFC 1/4] network: __ofono_netreg_registration_status internal api
  2011-01-10  9:43 [RFC 0/4] LaunchBrowser Proactive command Support Jeevaka Badrappan
@ 2011-01-10  9:43 ` 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
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: Jeevaka Badrappan @ 2011-01-10  9:43 UTC (permalink / raw)
  To: ofono

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

---
 src/network.c |    8 ++++++++
 src/ofono.h   |    2 ++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/network.c b/src/network.c
index eb0f797..640391d 100644
--- a/src/network.c
+++ b/src/network.c
@@ -1864,3 +1864,11 @@ void *ofono_netreg_get_data(struct ofono_netreg *netreg)
 {
 	return netreg->driver_data;
 }
+
+int __ofono_netreg_registration_status(struct ofono_netreg *netreg)
+{
+	if (netreg == NULL)
+		return NETWORK_REGISTRATION_STATUS_UNKNOWN;
+
+	return netreg->status;
+}
diff --git a/src/ofono.h b/src/ofono.h
index cab70cd..91f737f 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -375,6 +375,8 @@ gboolean __ofono_netreg_remove_status_watch(struct ofono_netreg *netreg,
 void __ofono_netreg_set_base_station_name(struct ofono_netreg *netreg,
 						const char *name);
 
+int __ofono_netreg_registration_status(struct ofono_netreg *netreg);
+
 #include <ofono/history.h>
 
 void __ofono_history_probe_drivers(struct ofono_modem *modem);
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [RFC 2/4] stk: Handle Launch Browser proactive command
  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-10  9:43 ` Jeevaka Badrappan
  2011-01-12 22:31   ` 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
  3 siblings, 1 reply; 11+ messages in thread
From: Jeevaka Badrappan @ 2011-01-10  9:43 UTC (permalink / raw)
  To: ofono

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

---
 src/stk.c      |  122 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/stkagent.c |   67 +++++++++++++++++++++++++++++++
 src/stkagent.h |    5 ++
 3 files changed, 194 insertions(+), 0 deletions(-)

diff --git a/src/stk.c b/src/stk.c
index 932e49a..0511b68 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -99,6 +99,11 @@ struct extern_req {
 static void envelope_queue_run(struct ofono_stk *stk);
 static void timers_update(struct ofono_stk *stk);
 
+#define ADD_ERROR_RESULT(result, error, addn_info)		\
+		result.type = error;				\
+		result.additional_len = sizeof(addn_info);	\
+		result.additional = addn_info;			\
+
 static int stk_respond(struct ofono_stk *stk, struct stk_response *rsp,
 			ofono_stk_generic_cb_t cb)
 {
@@ -2338,6 +2343,118 @@ static gboolean handle_command_play_tone(const struct stk_command *cmd,
 	return FALSE;
 }
 
+static void confirm_launch_browser_cb(enum stk_agent_result result,
+					gboolean confirm,
+					void *user_data)
+{
+	struct ofono_stk *stk = user_data;
+	unsigned char no_cause[] = { 0x00 };
+	struct ofono_error failure = { .type = OFONO_ERROR_TYPE_FAILURE };
+	struct stk_response rsp;
+
+	stk->respond_on_exit = FALSE;
+
+	switch (result) {
+	case STK_AGENT_RESULT_TIMEOUT:
+		confirm = FALSE;
+		/* Fall through */
+
+	case STK_AGENT_RESULT_OK:
+		if (confirm)
+			break;
+
+		send_simple_response(stk, STK_RESULT_TYPE_USER_REJECT);
+		return;
+	default:
+		memset(&rsp, 0, sizeof(rsp));
+		ADD_ERROR_RESULT(rsp.result, STK_RESULT_TYPE_TERMINAL_BUSY,
+					no_cause);
+
+		if (stk_respond(stk, &rsp, stk_command_cb))
+			stk_command_cb(&failure, stk);
+
+		return;
+	}
+
+	send_simple_response(stk, STK_RESULT_TYPE_SUCCESS);
+}
+
+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;
+	}
+
+	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;
+}
+
 static void stk_proactive_command_cancel(struct ofono_stk *stk)
 {
 	if (stk->immediate_response)
@@ -2525,6 +2642,11 @@ void ofono_stk_proactive_command_notify(struct ofono_stk *stk,
 							&rsp, stk);
 		break;
 
+	case STK_COMMAND_TYPE_LAUNCH_BROWSER:
+		respond = handle_command_launch_browser(stk->pending_cmd,
+							&rsp, stk);
+		break;
+
 	default:
 		rsp.result.type = STK_RESULT_TYPE_COMMAND_NOT_UNDERSTOOD;
 		break;
diff --git a/src/stkagent.c b/src/stkagent.c
index 2cdc6e1..03b7c87 100644
--- a/src/stkagent.c
+++ b/src/stkagent.c
@@ -1013,3 +1013,70 @@ int stk_agent_display_action_info(struct stk_agent *agent, const char *text,
 
 	return 0;
 }
+
+static void confirm_launch_browser_cb(DBusPendingCall *call, void *data)
+{
+	struct stk_agent *agent = data;
+	stk_agent_confirmation_cb cb = agent->user_cb;
+	DBusMessage *reply = dbus_pending_call_steal_reply(call);
+	enum stk_agent_result result;
+	gboolean remove_agent;
+	dbus_bool_t confirm;
+
+	if (check_error(agent, reply, 0, &result) == -EINVAL) {
+		remove_agent = TRUE;
+		cb(STK_AGENT_RESULT_TERMINATE, FALSE, agent->user_data);
+		goto error;
+	}
+
+	if (result != STK_AGENT_RESULT_OK) {
+		cb(result, FALSE, agent->user_data);
+		goto done;
+	}
+
+	if (dbus_message_get_args(reply, NULL,
+					DBUS_TYPE_BOOLEAN, &confirm,
+					DBUS_TYPE_INVALID) == FALSE) {
+		ofono_error("Can't parse the reply to ConfirmLaunchBrowser()");
+		remove_agent = TRUE;
+		goto error;
+	}
+
+	cb(result, confirm, agent->user_data);
+
+	CALLBACK_END();
+}
+
+int stk_agent_launch_browser(struct stk_agent *agent, const char *text,
+				unsigned char icon_id, const char *url,
+				stk_agent_confirmation_cb cb, void *user_data,
+				ofono_destroy_func destroy, int timeout)
+{
+	DBusConnection *conn = ofono_dbus_get_connection();
+
+	agent->msg = dbus_message_new_method_call(agent->bus, agent->path,
+							OFONO_SIM_APP_INTERFACE,
+							"LaunchBrowser");
+	if (agent->msg == NULL)
+		return -ENOMEM;
+
+	dbus_message_append_args(agent->msg,
+					DBUS_TYPE_STRING, &text,
+					DBUS_TYPE_BYTE, &icon_id,
+					DBUS_TYPE_STRING, &url,
+					DBUS_TYPE_INVALID);
+
+	if (dbus_connection_send_with_reply(conn, agent->msg, &agent->call,
+						timeout) == FALSE ||
+						agent->call == NULL)
+		return -EIO;
+
+	agent->user_cb = cb;
+	agent->user_data = user_data;
+	agent->user_destroy = destroy;
+
+	dbus_pending_call_set_notify(agent->call, confirm_launch_browser_cb,
+					agent, NULL);
+
+	return 0;
+}
diff --git a/src/stkagent.h b/src/stkagent.h
index 6477dbf..c6a2b74 100644
--- a/src/stkagent.h
+++ b/src/stkagent.h
@@ -140,3 +140,8 @@ void append_menu_items_variant(DBusMessageIter *iter,
 
 int stk_agent_display_action_info(struct stk_agent *agent, const char *text,
 					const struct stk_icon_id *icon);
+
+int stk_agent_launch_browser(struct stk_agent *agent, const char *text,
+				unsigned char icon_id, const char *url,
+				stk_agent_confirmation_cb cb, void *user_data,
+				ofono_destroy_func destroy, int timeout);
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [RFC 3/4] test: Add support for launch browser command
  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-10  9:43 ` [RFC 2/4] stk: Handle Launch Browser proactive command Jeevaka Badrappan
@ 2011-01-10  9:43 ` Jeevaka Badrappan
  2011-01-10  9:43 ` [RFC 4/4] doc: Describe LaunchBrowser method Jeevaka Badrappan
  3 siblings, 0 replies; 11+ messages in thread
From: Jeevaka Badrappan @ 2011-01-10  9:43 UTC (permalink / raw)
  To: ofono

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

---
 src/stkagent.c     |    2 +-
 test/test-stk-menu |   13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/src/stkagent.c b/src/stkagent.c
index 03b7c87..f3d22ab 100644
--- a/src/stkagent.c
+++ b/src/stkagent.c
@@ -1037,7 +1037,7 @@ static void confirm_launch_browser_cb(DBusPendingCall *call, void *data)
 	if (dbus_message_get_args(reply, NULL,
 					DBUS_TYPE_BOOLEAN, &confirm,
 					DBUS_TYPE_INVALID) == FALSE) {
-		ofono_error("Can't parse the reply to ConfirmLaunchBrowser()");
+		ofono_error("Can't parse the reply to LaunchBrowser()");
 		remove_agent = TRUE;
 		goto error;
 	}
diff --git a/test/test-stk-menu b/test/test-stk-menu
index 673b5bc..995cfef 100755
--- a/test/test-stk-menu
+++ b/test/test-stk-menu
@@ -157,6 +157,19 @@ class StkAgent(dbus.service.Object):
 			return False
 
 	@dbus.service.method("org.ofono.SimToolkitAgent",
+				in_signature="sys", out_signature="b")
+	def LaunchBrowser(self, info, icon, url):
+		print "Information: (%s)" % (info)
+		print "Icon: (%d)" % (icon)
+		print "URL (%s)" % (url)
+		key = raw_input("Enter Confirmation (y, n):")
+
+		if key == 'y':
+			return True
+		else:
+			return False
+
+	@dbus.service.method("org.ofono.SimToolkitAgent",
 					in_signature="", out_signature="")
 	def Cancel(self):
 		print "Cancel"
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [RFC 4/4] doc: Describe LaunchBrowser method
  2011-01-10  9:43 [RFC 0/4] LaunchBrowser Proactive command Support Jeevaka Badrappan
                   ` (2 preceding siblings ...)
  2011-01-10  9:43 ` [RFC 3/4] test: Add support for launch browser command Jeevaka Badrappan
@ 2011-01-10  9:43 ` Jeevaka Badrappan
  2011-01-12 22:26   ` Denis Kenzior
  3 siblings, 1 reply; 11+ messages in thread
From: Jeevaka Badrappan @ 2011-01-10  9:43 UTC (permalink / raw)
  To: ofono

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

---
 doc/stk-api.txt |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/doc/stk-api.txt b/doc/stk-api.txt
index 425ee23..347e39d 100644
--- a/doc/stk-api.txt
+++ b/doc/stk-api.txt
@@ -257,6 +257,14 @@ Methods		byte RequestSelection(string title, byte icon_id,
 			until the call is canceled using Cancel().  This
 			method should not return.
 
+		boolean LaunchBrowser() (string information, byte icon_id,
+						string url)
+
+			Asks the agent to request user to confirm launch
+			browser. If confirmed, then the agent should send
+			confirmation message to oFono and then should open
+			the launch browser with the given url.
+
 		void Cancel() [noreply]
 
 			Asks the agent to cancel any ongoing operation in
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [RFC 1/4] network: __ofono_netreg_registration_status internal api
  2011-01-10  9:43 ` [RFC 1/4] network: __ofono_netreg_registration_status internal api Jeevaka Badrappan
@ 2011-01-12 22:20   ` Denis Kenzior
  0 siblings, 0 replies; 11+ messages in thread
From: Denis Kenzior @ 2011-01-12 22:20 UTC (permalink / raw)
  To: ofono

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

Hi Jeevaka,

On 01/10/2011 03:43 AM, Jeevaka Badrappan wrote:
> ---
>  src/network.c |    8 ++++++++
>  src/ofono.h   |    2 ++
>  2 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/src/network.c b/src/network.c
> index eb0f797..640391d 100644
> --- a/src/network.c
> +++ b/src/network.c
> @@ -1864,3 +1864,11 @@ void *ofono_netreg_get_data(struct ofono_netreg *netreg)
>  {
>  	return netreg->driver_data;
>  }
> +
> +int __ofono_netreg_registration_status(struct ofono_netreg *netreg)
> +{
> +	if (netreg == NULL)
> +		return NETWORK_REGISTRATION_STATUS_UNKNOWN;
> +

For internal API I suggest skipping the NULL check.  I'd rather see us
crash early.

> +	return netreg->status;
> +}
> diff --git a/src/ofono.h b/src/ofono.h
> index cab70cd..91f737f 100644
> --- a/src/ofono.h
> +++ b/src/ofono.h
> @@ -375,6 +375,8 @@ gboolean __ofono_netreg_remove_status_watch(struct ofono_netreg *netreg,
>  void __ofono_netreg_set_base_station_name(struct ofono_netreg *netreg,
>  						const char *name);
>  
> +int __ofono_netreg_registration_status(struct ofono_netreg *netreg);
> +

Please name this __ofono_netreg_get_registration_status

>  #include <ofono/history.h>
>  
>  void __ofono_history_probe_drivers(struct ofono_modem *modem);

Regards,
-Denis

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RFC 4/4] doc: Describe LaunchBrowser method
  2011-01-10  9:43 ` [RFC 4/4] doc: Describe LaunchBrowser method Jeevaka Badrappan
@ 2011-01-12 22:26   ` Denis Kenzior
  0 siblings, 0 replies; 11+ messages in thread
From: Denis Kenzior @ 2011-01-12 22:26 UTC (permalink / raw)
  To: ofono

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

Hi Jeevaka,

On 01/10/2011 03:43 AM, Jeevaka Badrappan wrote:
> ---
>  doc/stk-api.txt |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/doc/stk-api.txt b/doc/stk-api.txt
> index 425ee23..347e39d 100644
> --- a/doc/stk-api.txt
> +++ b/doc/stk-api.txt
> @@ -257,6 +257,14 @@ Methods		byte RequestSelection(string title, byte icon_id,
>  			until the call is canceled using Cancel().  This
>  			method should not return.
>  
> +		boolean LaunchBrowser() (string information, byte icon_id,
> +						string url)
> +
> +			Asks the agent to request user to confirm launch
> +			browser. If confirmed, then the agent should send
> +			confirmation message to oFono and then should open
> +			the launch browser with the given url.
> +

Let us call this ConfirmLaunchBrowser

>  		void Cancel() [noreply]
>  
>  			Asks the agent to cancel any ongoing operation in

Regards,
-Denis

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RFC 2/4] stk: Handle Launch Browser proactive command
  2011-01-10  9:43 ` [RFC 2/4] stk: Handle Launch Browser proactive command Jeevaka Badrappan
@ 2011-01-12 22:31   ` Denis Kenzior
  2011-01-12 22:45     ` andrzej zaborowski
  0 siblings, 1 reply; 11+ messages in thread
From: Denis Kenzior @ 2011-01-12 22:31 UTC (permalink / raw)
  To: ofono

[-- 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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RFC 2/4] stk: Handle Launch Browser proactive command
  2011-01-12 22:31   ` Denis Kenzior
@ 2011-01-12 22:45     ` andrzej zaborowski
  2011-01-13 14:56       ` Jeevaka.Badrappan
  0 siblings, 1 reply; 11+ messages in thread
From: andrzej zaborowski @ 2011-01-12 22:45 UTC (permalink / raw)
  To: ofono

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

Hi,

On 12 January 2011 23:31, Denis Kenzior <denkenz@gmail.com> wrote:
>> +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.

I agree that the modem online property is unrelated to this.  Also the
card may in theory specify a URL that designates a local file or
something on a local network, not the internet.

Best regards

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [RFC 2/4] stk: Handle Launch Browser proactive command
  2011-01-12 22:45     ` andrzej zaborowski
@ 2011-01-13 14:56       ` Jeevaka.Badrappan
  2011-01-13 16:35         ` Denis Kenzior
  0 siblings, 1 reply; 11+ messages in thread
From: Jeevaka.Badrappan @ 2011-01-13 14:56 UTC (permalink / raw)
  To: ofono

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

Hi,

>> 
>> 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.
> 
> I agree that the modem online property is unrelated to this.
> Also the card may in theory specify a URL that designates a
> local file or something on a local network, not the internet.
> 

Agree. It can be anything not only cellular network. Do we need
to check the bearer parameters in that case or can I just remove the
current check code?

Regards,
Jeevaka

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RFC 2/4] stk: Handle Launch Browser proactive command
  2011-01-13 14:56       ` Jeevaka.Badrappan
@ 2011-01-13 16:35         ` Denis Kenzior
  0 siblings, 0 replies; 11+ messages in thread
From: Denis Kenzior @ 2011-01-13 16:35 UTC (permalink / raw)
  To: ofono

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

Hi Jeevaka,

On 01/13/2011 08:56 AM, Jeevaka.Badrappan(a)elektrobit.com wrote:
> Hi,
> 
>>>
>>> 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.
>>
>> I agree that the modem online property is unrelated to this.
>> Also the card may in theory specify a URL that designates a
>> local file or something on a local network, not the internet.
>>
> 
> Agree. It can be anything not only cellular network. Do we need
> to check the bearer parameters in that case or can I just remove the
> current check code?

Good point on the bearer parameters.  My take is that we should either
ignore the bearer parameters or return not-capable if they're set.
Otherwise removing the current checks in the code seems reasonable to me.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-01-13 16:35 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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.