* [PATCH v2 0/2] LaunchBrowser Proactive command Support
@ 2011-01-20 12:52 Jeevaka Badrappan
2011-01-20 12:52 ` [PATCH v2 1/2] stkutil: add check for qualifier and browser id Jeevaka Badrappan
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jeevaka Badrappan @ 2011-01-20 12:52 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 893 bytes --]
Hi,
Following set of patches adds the basic support for LaunchBrowser
proactive command 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 (2):
stkutil: add check for qualifier and browser id
stk: Handle Launch Browser proactive command
src/stk.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/stkagent.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++
src/stkagent.h | 7 +++++
src/stkutil.c | 9 +++++-
4 files changed, 162 insertions(+), 1 deletions(-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 1/2] stkutil: add check for qualifier and browser id
2011-01-20 12:52 [PATCH v2 0/2] LaunchBrowser Proactive command Support Jeevaka Badrappan
@ 2011-01-20 12:52 ` Jeevaka Badrappan
2011-01-20 12:52 ` [PATCH v2 2/2] stk: Handle Launch Browser proactive command Jeevaka Badrappan
2011-01-20 16:07 ` [PATCH v2 0/2] LaunchBrowser Proactive command Support Denis Kenzior
2 siblings, 0 replies; 4+ messages in thread
From: Jeevaka Badrappan @ 2011-01-20 12:52 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1062 bytes --]
Checks the valid qualifier and browser id values
applicable for launch browser proactive command
---
src/stkutil.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/src/stkutil.c b/src/stkutil.c
index b7f03e2..abd1c99 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1187,7 +1187,11 @@ static gboolean parse_dataobj_browser_id(struct comprehension_tlv_iter *iter,
void *user)
{
unsigned char *byte = user;
- return parse_dataobj_common_byte(iter, byte);
+
+ if (parse_dataobj_common_byte(iter, byte) == FALSE || *byte > 4)
+ return FALSE;
+
+ return TRUE;
}
/* Defined in TS 102.223 Section 8.48 */
@@ -3229,6 +3233,9 @@ static enum stk_command_parse_result parse_launch_browser(
{
struct stk_command_launch_browser *obj = &command->launch_browser;
+ if (command->qualifier > 3 || command->qualifier == 1)
+ return STK_PARSE_RESULT_DATA_NOT_UNDERSTOOD;
+
if (command->src != STK_DEVICE_IDENTITY_TYPE_UICC)
return STK_PARSE_RESULT_DATA_NOT_UNDERSTOOD;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 2/2] stk: Handle Launch Browser proactive command
2011-01-20 12:52 [PATCH v2 0/2] LaunchBrowser Proactive command Support Jeevaka Badrappan
2011-01-20 12:52 ` [PATCH v2 1/2] stkutil: add check for qualifier and browser id Jeevaka Badrappan
@ 2011-01-20 12:52 ` Jeevaka Badrappan
2011-01-20 16:07 ` [PATCH v2 0/2] LaunchBrowser Proactive command Support Denis Kenzior
2 siblings, 0 replies; 4+ messages in thread
From: Jeevaka Badrappan @ 2011-01-20 12:52 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 5508 bytes --]
---
src/stk.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/stkagent.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++
src/stkagent.h | 7 +++++
3 files changed, 154 insertions(+), 0 deletions(-)
diff --git a/src/stk.c b/src/stk.c
index f151fc1..80edc25 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -2358,6 +2358,80 @@ 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;
+ /* Fall through */
+
+ 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;
+ char *alpha_id;
+ int err;
+
+ 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_confirm_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) {
+ unsigned char no_cause_result[] = { 0x00 };
+
+ /*
+ * 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_result);
+ 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)
@@ -2545,6 +2619,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..2395182 100644
--- a/src/stkagent.c
+++ b/src/stkagent.c
@@ -1013,3 +1013,71 @@ 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_confirm_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,
+ "ConfirmLaunchBrowser");
+ 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..1f0c4fa 100644
--- a/src/stkagent.h
+++ b/src/stkagent.h
@@ -140,3 +140,10 @@ 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_confirm_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] 4+ messages in thread
* Re: [PATCH v2 0/2] LaunchBrowser Proactive command Support
2011-01-20 12:52 [PATCH v2 0/2] LaunchBrowser Proactive command Support Jeevaka Badrappan
2011-01-20 12:52 ` [PATCH v2 1/2] stkutil: add check for qualifier and browser id Jeevaka Badrappan
2011-01-20 12:52 ` [PATCH v2 2/2] stk: Handle Launch Browser proactive command Jeevaka Badrappan
@ 2011-01-20 16:07 ` Denis Kenzior
2 siblings, 0 replies; 4+ messages in thread
From: Denis Kenzior @ 2011-01-20 16:07 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 654 bytes --]
Hi Jeevaka,
On 01/20/2011 06:52 AM, Jeevaka Badrappan wrote:
> Hi,
>
> Following set of patches adds the basic support for LaunchBrowser
> proactive command 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
>
Both patches have been applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-01-20 16:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-20 12:52 [PATCH v2 0/2] LaunchBrowser Proactive command Support Jeevaka Badrappan
2011-01-20 12:52 ` [PATCH v2 1/2] stkutil: add check for qualifier and browser id Jeevaka Badrappan
2011-01-20 12:52 ` [PATCH v2 2/2] stk: Handle Launch Browser proactive command Jeevaka Badrappan
2011-01-20 16:07 ` [PATCH v2 0/2] LaunchBrowser Proactive command Support 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.