* Re: [PATCH 1/4] include: Add driver api for user confirmation
2011-07-06 10:06 ` [PATCH 1/4] include: Add driver api for user confirmation Jeevaka Badrappan
@ 2011-07-06 6:28 ` Denis Kenzior
0 siblings, 0 replies; 15+ messages in thread
From: Denis Kenzior @ 2011-07-06 6:28 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 733 bytes --]
Hi Jeevaka,
On 07/06/2011 05:06 AM, Jeevaka Badrappan wrote:
> ---
> include/stk.h | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/include/stk.h b/include/stk.h
> index c276c84..9a63917 100644
> --- a/include/stk.h
> +++ b/include/stk.h
> @@ -47,6 +47,7 @@ struct ofono_stk_driver {
> void (*terminal_response)(struct ofono_stk *stk,
> int length, const unsigned char *resp,
> ofono_stk_generic_cb_t cb, void *data);
> + void (*user_confirmation)(struct ofono_stk *stk, gboolean confirm);
Please don't use glib types in public API. Use ofono_bool_t here instead.
> };
>
> int ofono_stk_driver_register(const struct ofono_stk_driver *d);
Regards,
-Denis
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/4] voicecall: api for set/clear alpha and icon id
2011-07-06 10:06 ` [PATCH 2/4] voicecall: api for set/clear alpha and icon id Jeevaka Badrappan
@ 2011-07-06 6:38 ` Denis Kenzior
0 siblings, 0 replies; 15+ messages in thread
From: Denis Kenzior @ 2011-07-06 6:38 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2686 bytes --]
Hi Jeevaka,
On 07/06/2011 05:06 AM, Jeevaka Badrappan wrote:
> ---
> src/ofono.h | 5 +++++
> src/voicecall.c | 21 +++++++++++++++++++++
> 2 files changed, 26 insertions(+), 0 deletions(-)
>
> diff --git a/src/ofono.h b/src/ofono.h
> index 6524806..118d762 100644
> --- a/src/ofono.h
> +++ b/src/ofono.h
> @@ -266,6 +266,11 @@ int __ofono_voicecall_dial(struct ofono_voicecall *vc,
> ofono_voicecall_dial_cb_t cb, void *user_data);
> void __ofono_voicecall_dial_cancel(struct ofono_voicecall *vc);
>
> +void __ofono_voicecall_set_alpha_and_icon_id(struct ofono_voicecall *vc,
> + const char *message,
> + unsigned char icon_id);
> +void __ofono_voicecall_clear_alpha_and_icon_id(struct ofono_voicecall *vc);
> +
It seems we might need more information here, in particular the phone
number being dialed by STK. I don't see how we would obtain this
information otherwise.
Also, since emergency numbers can be dialed by STK, we probably need
special logic for inc/dec of emergency counters as well.
> int __ofono_voicecall_tone_send(struct ofono_voicecall *vc,
> const char *tone_str,
> ofono_voicecall_tone_cb_t cb, void *user_data);
> diff --git a/src/voicecall.c b/src/voicecall.c
> index 9620838..b193d61 100644
> --- a/src/voicecall.c
> +++ b/src/voicecall.c
> @@ -74,6 +74,8 @@ struct ofono_voicecall {
> struct dial_request *dial_req;
> GQueue *toneq;
> guint tone_source;
> + char *message;
> + uint8_t icon_id;
I don't really like this, is there a way we can re-use the dial_req
structure, as that one already contains the message, icon_id and phone
number members we need.
> unsigned int hfp_watch;
> GKeyFile *settings;
> char *imsi;
> @@ -656,6 +658,11 @@ static struct voicecall *voicecall_create(struct ofono_voicecall *vc,
> v->call = call;
> v->vc = vc;
>
> + if (vc->message != NULL) {
> + v->message = g_strdup(vc->message);
> + v->icon_id = vc->icon_id;
> + }
> +
> return v;
> }
>
> @@ -3538,6 +3545,20 @@ void __ofono_voicecall_tone_cancel(struct ofono_voicecall *vc, int id)
> }
> }
>
> +void __ofono_voicecall_set_alpha_and_icon_id(struct ofono_voicecall *vc,
> + const char *message,
> + unsigned char icon_id)
> +{
> + vc->message = g_strdup(message);
> + vc->icon_id = icon_id;
> +}
> +
> +void __ofono_voicecall_clear_alpha_and_icon_id(struct ofono_voicecall *vc)
> +{
> + g_free(vc->message);
> + vc->icon_id = 0;
> +}
> +
> static void ssn_mt_forwarded_notify(struct ofono_voicecall *vc,
> unsigned int id, int code,
> const struct ofono_phone_number *ph)
Regards,
-Denis
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 3/4] stk: Handle set up call in handled_notify
2011-07-06 10:06 ` [PATCH 3/4] stk: Handle set up call in handled_notify Jeevaka Badrappan
@ 2011-07-06 6:43 ` Denis Kenzior
2011-07-06 16:51 ` Andrzej Zaborowski
1 sibling, 0 replies; 15+ messages in thread
From: Denis Kenzior @ 2011-07-06 6:43 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 4776 bytes --]
Hi Jeevaka,
On 07/06/2011 05:06 AM, Jeevaka Badrappan wrote:
> ---
> src/stk.c | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
> 1 files changed, 106 insertions(+), 2 deletions(-)
>
> diff --git a/src/stk.c b/src/stk.c
> index 9575f0e..26faa11 100644
> --- a/src/stk.c
> +++ b/src/stk.c
> @@ -77,6 +77,8 @@ struct ofono_stk {
> struct timeval get_inkey_start_ts;
> int dtmf_id;
>
> + gboolean modem_handled_cmd;
> +
> __ofono_sms_sim_download_cb_t sms_pp_cb;
> void *sms_pp_userdata;
> };
> @@ -1785,6 +1787,44 @@ static void confirm_call_cb(enum stk_agent_result result, gboolean confirm,
> stk_command_cb(&error, stk);
> }
>
> +static void confirm_handled_call_cb(enum stk_agent_result result,
> + gboolean confirm, void *user_data)
> +{
> + struct ofono_stk *stk = user_data;
> + const struct stk_command_setup_call *sc =
> + &stk->pending_cmd->setup_call;
> + struct ofono_voicecall *vc = NULL;
> + struct ofono_atom *vc_atom;
> +
> + if (stk->driver->user_confirmation == NULL)
> + goto out;
This situation is quite funny, I'd almost rather crash here, but fair
enough.
> +
> + if (result != STK_AGENT_RESULT_OK) {
> + stk->driver->user_confirmation(stk, FALSE);
> + goto out;
> + }
> +
> + stk->driver->user_confirmation(stk, confirm);
> +
> + vc_atom = __ofono_modem_find_atom(__ofono_atom_get_modem(stk->atom),
> + OFONO_ATOM_TYPE_VOICECALL);
> + if (vc_atom)
> + vc = __ofono_atom_get_data(vc_atom);
> +
> + if (vc == NULL)
> + goto out;
> +
> + __ofono_voicecall_set_alpha_and_icon_id(vc, sc->alpha_id_call_setup,
> + sc->icon_id_call_setup.id);
> +
> + stk->modem_handled_cmd = TRUE;
> +
> + return;
Please insert a newline here
> +out:
> + stk_command_free(stk->pending_cmd);
> + stk->pending_cmd = NULL;
> +}
> +
> static gboolean handle_command_set_up_call(const struct stk_command *cmd,
> struct stk_response *rsp,
> struct ofono_stk *stk)
> @@ -2601,6 +2641,40 @@ static gboolean handle_command_launch_browser(const struct stk_command *cmd,
> return FALSE;
> }
>
> +static void handle_setup_call_confirmation_req(struct stk_command *cmd,
> + struct ofono_stk *stk)
> +{
> + const struct stk_command_setup_call *sc = &cmd->setup_call;
> + int err;
> + char *alpha_id = dbus_apply_text_attributes(
> + sc->alpha_id_usr_cfm ?
> + sc->alpha_id_usr_cfm : "",
> + &sc->text_attr_usr_cfm);
> + if (alpha_id == NULL)
> + goto out;
> +
> + err = stk_agent_confirm_call(stk->current_agent, alpha_id,
> + &sc->icon_id_usr_cfm,
> + confirm_handled_call_cb,
> + stk, NULL,
> + stk->timeout * 1000);
> + g_free(alpha_id);
> +
> + if (err < 0)
> + goto out;
> +
> + stk->pending_cmd = cmd;
> + stk->cancel_cmd = stk_request_cancel;
> +
> + return;
> +
> +out:
> + if (stk->driver->user_confirmation)
> + stk->driver->user_confirmation(stk, FALSE);
> +
> + stk_command_free(cmd);
> +}
> +
> static void stk_proactive_command_cancel(struct ofono_stk *stk)
> {
> if (stk->immediate_response)
> @@ -2615,8 +2689,38 @@ static void stk_proactive_command_cancel(struct ofono_stk *stk)
> }
> }
>
> +static void proactive_session_end_handled_cmd(struct ofono_stk *stk)
> +{
> + stk->modem_handled_cmd = FALSE;
> +
> + switch(stk->pending_cmd->type) {
> + case STK_COMMAND_TYPE_SETUP_CALL:
> + {
> + struct ofono_voicecall *vc = NULL;
> + struct ofono_atom *vc_atom;
> +
> + vc_atom = __ofono_modem_find_atom(
> + __ofono_atom_get_modem(stk->atom),
> + OFONO_ATOM_TYPE_VOICECALL);
> + if (vc_atom)
> + vc = __ofono_atom_get_data(vc_atom);
> +
> + if (vc != NULL)
> + __ofono_voicecall_clear_alpha_and_icon_id(vc);
> +
> + break;
> + }
> +
> + default:
> + break;
> + }
> +}
> +
> void ofono_stk_proactive_session_end_notify(struct ofono_stk *stk)
> {
> + if (stk->modem_handled_cmd == TRUE)
> + proactive_session_end_handled_cmd(stk);
> +
Are we getting information on the terminal responses sent by the modem
for these? I'd rather handle this sort of stuff by parsing the terminal
response than relying on the session end notification. This might also
help alleviate the concerns Andrew has raised as well.
> /* Wait until we receive the next command */
> if (stk->immediate_response)
> return;
> @@ -2858,8 +2962,8 @@ void ofono_stk_proactive_command_handled_notify(struct ofono_stk *stk,
> break;
>
> case STK_COMMAND_TYPE_SETUP_CALL:
> - /* TODO */
> - break;
> + handle_setup_call_confirmation_req(cmd, stk);
> + return;
>
> case STK_COMMAND_TYPE_SEND_USSD:
> stk_alpha_id_set(stk, cmd->send_ussd.alpha_id,
Regards,
-Denis
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 0/4] Add support for modem handled setup call proactive command
@ 2011-07-06 10:06 Jeevaka Badrappan
2011-07-06 10:06 ` [PATCH 1/4] include: Add driver api for user confirmation Jeevaka Badrappan
` (3 more replies)
0 siblings, 4 replies; 15+ messages in thread
From: Jeevaka Badrappan @ 2011-07-06 10:06 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 643 bytes --]
Hi,
Following set of patches adds support for modem handled setup call proactive command.
Regards,
Jeevaka
Jeevaka Badrappan (4):
include: Add driver api for user confirmation
voicecall: api for set/clear alpha and icon id
stk: Handle set up call in handled_notify
ifxmodem: add support for user_confirmation in stk
drivers/ifxmodem/stk.c | 11 +++++
include/stk.h | 1 +
src/ofono.h | 5 ++
src/stk.c | 108 +++++++++++++++++++++++++++++++++++++++++++++++-
src/voicecall.c | 21 +++++++++
5 files changed, 144 insertions(+), 2 deletions(-)
--
1.7.4.1
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 1/4] include: Add driver api for user confirmation
2011-07-06 10:06 [PATCH 0/4] Add support for modem handled setup call proactive command Jeevaka Badrappan
@ 2011-07-06 10:06 ` Jeevaka Badrappan
2011-07-06 6:28 ` Denis Kenzior
2011-07-06 10:06 ` [PATCH 2/4] voicecall: api for set/clear alpha and icon id Jeevaka Badrappan
` (2 subsequent siblings)
3 siblings, 1 reply; 15+ messages in thread
From: Jeevaka Badrappan @ 2011-07-06 10:06 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 552 bytes --]
---
include/stk.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/include/stk.h b/include/stk.h
index c276c84..9a63917 100644
--- a/include/stk.h
+++ b/include/stk.h
@@ -47,6 +47,7 @@ struct ofono_stk_driver {
void (*terminal_response)(struct ofono_stk *stk,
int length, const unsigned char *resp,
ofono_stk_generic_cb_t cb, void *data);
+ void (*user_confirmation)(struct ofono_stk *stk, gboolean confirm);
};
int ofono_stk_driver_register(const struct ofono_stk_driver *d);
--
1.7.4.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 2/4] voicecall: api for set/clear alpha and icon id
2011-07-06 10:06 [PATCH 0/4] Add support for modem handled setup call proactive command Jeevaka Badrappan
2011-07-06 10:06 ` [PATCH 1/4] include: Add driver api for user confirmation Jeevaka Badrappan
@ 2011-07-06 10:06 ` Jeevaka Badrappan
2011-07-06 6:38 ` Denis Kenzior
2011-07-06 10:06 ` [PATCH 3/4] stk: Handle set up call in handled_notify Jeevaka Badrappan
2011-07-06 10:06 ` [PATCH 4/4] ifxmodem: add support for user_confirmation in stk Jeevaka Badrappan
3 siblings, 1 reply; 15+ messages in thread
From: Jeevaka Badrappan @ 2011-07-06 10:06 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2017 bytes --]
---
src/ofono.h | 5 +++++
src/voicecall.c | 21 +++++++++++++++++++++
2 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/src/ofono.h b/src/ofono.h
index 6524806..118d762 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -266,6 +266,11 @@ int __ofono_voicecall_dial(struct ofono_voicecall *vc,
ofono_voicecall_dial_cb_t cb, void *user_data);
void __ofono_voicecall_dial_cancel(struct ofono_voicecall *vc);
+void __ofono_voicecall_set_alpha_and_icon_id(struct ofono_voicecall *vc,
+ const char *message,
+ unsigned char icon_id);
+void __ofono_voicecall_clear_alpha_and_icon_id(struct ofono_voicecall *vc);
+
int __ofono_voicecall_tone_send(struct ofono_voicecall *vc,
const char *tone_str,
ofono_voicecall_tone_cb_t cb, void *user_data);
diff --git a/src/voicecall.c b/src/voicecall.c
index 9620838..b193d61 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -74,6 +74,8 @@ struct ofono_voicecall {
struct dial_request *dial_req;
GQueue *toneq;
guint tone_source;
+ char *message;
+ uint8_t icon_id;
unsigned int hfp_watch;
GKeyFile *settings;
char *imsi;
@@ -656,6 +658,11 @@ static struct voicecall *voicecall_create(struct ofono_voicecall *vc,
v->call = call;
v->vc = vc;
+ if (vc->message != NULL) {
+ v->message = g_strdup(vc->message);
+ v->icon_id = vc->icon_id;
+ }
+
return v;
}
@@ -3538,6 +3545,20 @@ void __ofono_voicecall_tone_cancel(struct ofono_voicecall *vc, int id)
}
}
+void __ofono_voicecall_set_alpha_and_icon_id(struct ofono_voicecall *vc,
+ const char *message,
+ unsigned char icon_id)
+{
+ vc->message = g_strdup(message);
+ vc->icon_id = icon_id;
+}
+
+void __ofono_voicecall_clear_alpha_and_icon_id(struct ofono_voicecall *vc)
+{
+ g_free(vc->message);
+ vc->icon_id = 0;
+}
+
static void ssn_mt_forwarded_notify(struct ofono_voicecall *vc,
unsigned int id, int code,
const struct ofono_phone_number *ph)
--
1.7.4.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 3/4] stk: Handle set up call in handled_notify
2011-07-06 10:06 [PATCH 0/4] Add support for modem handled setup call proactive command Jeevaka Badrappan
2011-07-06 10:06 ` [PATCH 1/4] include: Add driver api for user confirmation Jeevaka Badrappan
2011-07-06 10:06 ` [PATCH 2/4] voicecall: api for set/clear alpha and icon id Jeevaka Badrappan
@ 2011-07-06 10:06 ` Jeevaka Badrappan
2011-07-06 6:43 ` Denis Kenzior
2011-07-06 16:51 ` Andrzej Zaborowski
2011-07-06 10:06 ` [PATCH 4/4] ifxmodem: add support for user_confirmation in stk Jeevaka Badrappan
3 siblings, 2 replies; 15+ messages in thread
From: Jeevaka Badrappan @ 2011-07-06 10:06 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 4004 bytes --]
---
src/stk.c | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 106 insertions(+), 2 deletions(-)
diff --git a/src/stk.c b/src/stk.c
index 9575f0e..26faa11 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -77,6 +77,8 @@ struct ofono_stk {
struct timeval get_inkey_start_ts;
int dtmf_id;
+ gboolean modem_handled_cmd;
+
__ofono_sms_sim_download_cb_t sms_pp_cb;
void *sms_pp_userdata;
};
@@ -1785,6 +1787,44 @@ static void confirm_call_cb(enum stk_agent_result result, gboolean confirm,
stk_command_cb(&error, stk);
}
+static void confirm_handled_call_cb(enum stk_agent_result result,
+ gboolean confirm, void *user_data)
+{
+ struct ofono_stk *stk = user_data;
+ const struct stk_command_setup_call *sc =
+ &stk->pending_cmd->setup_call;
+ struct ofono_voicecall *vc = NULL;
+ struct ofono_atom *vc_atom;
+
+ if (stk->driver->user_confirmation == NULL)
+ goto out;
+
+ if (result != STK_AGENT_RESULT_OK) {
+ stk->driver->user_confirmation(stk, FALSE);
+ goto out;
+ }
+
+ stk->driver->user_confirmation(stk, confirm);
+
+ vc_atom = __ofono_modem_find_atom(__ofono_atom_get_modem(stk->atom),
+ OFONO_ATOM_TYPE_VOICECALL);
+ if (vc_atom)
+ vc = __ofono_atom_get_data(vc_atom);
+
+ if (vc == NULL)
+ goto out;
+
+ __ofono_voicecall_set_alpha_and_icon_id(vc, sc->alpha_id_call_setup,
+ sc->icon_id_call_setup.id);
+
+ stk->modem_handled_cmd = TRUE;
+
+ return;
+out:
+ stk_command_free(stk->pending_cmd);
+ stk->pending_cmd = NULL;
+}
+
static gboolean handle_command_set_up_call(const struct stk_command *cmd,
struct stk_response *rsp,
struct ofono_stk *stk)
@@ -2601,6 +2641,40 @@ static gboolean handle_command_launch_browser(const struct stk_command *cmd,
return FALSE;
}
+static void handle_setup_call_confirmation_req(struct stk_command *cmd,
+ struct ofono_stk *stk)
+{
+ const struct stk_command_setup_call *sc = &cmd->setup_call;
+ int err;
+ char *alpha_id = dbus_apply_text_attributes(
+ sc->alpha_id_usr_cfm ?
+ sc->alpha_id_usr_cfm : "",
+ &sc->text_attr_usr_cfm);
+ if (alpha_id == NULL)
+ goto out;
+
+ err = stk_agent_confirm_call(stk->current_agent, alpha_id,
+ &sc->icon_id_usr_cfm,
+ confirm_handled_call_cb,
+ stk, NULL,
+ stk->timeout * 1000);
+ g_free(alpha_id);
+
+ if (err < 0)
+ goto out;
+
+ stk->pending_cmd = cmd;
+ stk->cancel_cmd = stk_request_cancel;
+
+ return;
+
+out:
+ if (stk->driver->user_confirmation)
+ stk->driver->user_confirmation(stk, FALSE);
+
+ stk_command_free(cmd);
+}
+
static void stk_proactive_command_cancel(struct ofono_stk *stk)
{
if (stk->immediate_response)
@@ -2615,8 +2689,38 @@ static void stk_proactive_command_cancel(struct ofono_stk *stk)
}
}
+static void proactive_session_end_handled_cmd(struct ofono_stk *stk)
+{
+ stk->modem_handled_cmd = FALSE;
+
+ switch(stk->pending_cmd->type) {
+ case STK_COMMAND_TYPE_SETUP_CALL:
+ {
+ struct ofono_voicecall *vc = NULL;
+ struct ofono_atom *vc_atom;
+
+ vc_atom = __ofono_modem_find_atom(
+ __ofono_atom_get_modem(stk->atom),
+ OFONO_ATOM_TYPE_VOICECALL);
+ if (vc_atom)
+ vc = __ofono_atom_get_data(vc_atom);
+
+ if (vc != NULL)
+ __ofono_voicecall_clear_alpha_and_icon_id(vc);
+
+ break;
+ }
+
+ default:
+ break;
+ }
+}
+
void ofono_stk_proactive_session_end_notify(struct ofono_stk *stk)
{
+ if (stk->modem_handled_cmd == TRUE)
+ proactive_session_end_handled_cmd(stk);
+
/* Wait until we receive the next command */
if (stk->immediate_response)
return;
@@ -2858,8 +2962,8 @@ void ofono_stk_proactive_command_handled_notify(struct ofono_stk *stk,
break;
case STK_COMMAND_TYPE_SETUP_CALL:
- /* TODO */
- break;
+ handle_setup_call_confirmation_req(cmd, stk);
+ return;
case STK_COMMAND_TYPE_SEND_USSD:
stk_alpha_id_set(stk, cmd->send_ussd.alpha_id,
--
1.7.4.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 4/4] ifxmodem: add support for user_confirmation in stk
2011-07-06 10:06 [PATCH 0/4] Add support for modem handled setup call proactive command Jeevaka Badrappan
` (2 preceding siblings ...)
2011-07-06 10:06 ` [PATCH 3/4] stk: Handle set up call in handled_notify Jeevaka Badrappan
@ 2011-07-06 10:06 ` Jeevaka Badrappan
3 siblings, 0 replies; 15+ messages in thread
From: Jeevaka Badrappan @ 2011-07-06 10:06 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1007 bytes --]
---
drivers/ifxmodem/stk.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/drivers/ifxmodem/stk.c b/drivers/ifxmodem/stk.c
index f08cf47..d2082c4 100644
--- a/drivers/ifxmodem/stk.c
+++ b/drivers/ifxmodem/stk.c
@@ -173,6 +173,16 @@ error:
CALLBACK_WITH_FAILURE(cb, data);
}
+static void ifx_stk_user_confirmation(struct ofono_stk *stk, gboolean confirm)
+{
+ struct stk_data *sd = ofono_stk_get_data(stk);
+ char buf[20];
+
+ snprintf(buf, sizeof(buf), "AT+SATD=%i", confirm ? 1 : 0);
+
+ g_at_chat_send(sd->chat, buf, none_prefix, NULL, NULL, NULL);
+}
+
static void sati_notify(GAtResult *result, gpointer user_data)
{
struct ofono_stk *stk = user_data;
@@ -303,6 +313,7 @@ static struct ofono_stk_driver driver = {
.remove = ifx_stk_remove,
.envelope = ifx_stk_envelope,
.terminal_response = ifx_stk_terminal_response,
+ .user_confirmation = ifx_stk_user_confirmation,
};
void ifx_stk_init(void)
--
1.7.4.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 3/4] stk: Handle set up call in handled_notify
2011-07-06 10:06 ` [PATCH 3/4] stk: Handle set up call in handled_notify Jeevaka Badrappan
2011-07-06 6:43 ` Denis Kenzior
@ 2011-07-06 16:51 ` Andrzej Zaborowski
1 sibling, 0 replies; 15+ messages in thread
From: Andrzej Zaborowski @ 2011-07-06 16:51 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 5678 bytes --]
Hi Jeevaka,
On 6 July 2011 12:06, Jeevaka Badrappan
<jeevaka.badrappan@linux.intel.com> wrote:
> ---
> src/stk.c | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
> 1 files changed, 106 insertions(+), 2 deletions(-)
>
> diff --git a/src/stk.c b/src/stk.c
> index 9575f0e..26faa11 100644
> --- a/src/stk.c
> +++ b/src/stk.c
> @@ -77,6 +77,8 @@ struct ofono_stk {
> struct timeval get_inkey_start_ts;
> int dtmf_id;
>
> + gboolean modem_handled_cmd;
> +
> __ofono_sms_sim_download_cb_t sms_pp_cb;
> void *sms_pp_userdata;
> };
> @@ -1785,6 +1787,44 @@ static void confirm_call_cb(enum stk_agent_result result, gboolean confirm,
> stk_command_cb(&error, stk);
> }
>
> +static void confirm_handled_call_cb(enum stk_agent_result result,
> + gboolean confirm, void *user_data)
> +{
> + struct ofono_stk *stk = user_data;
> + const struct stk_command_setup_call *sc =
> + &stk->pending_cmd->setup_call;
> + struct ofono_voicecall *vc = NULL;
> + struct ofono_atom *vc_atom;
> +
> + if (stk->driver->user_confirmation == NULL)
> + goto out;
> +
> + if (result != STK_AGENT_RESULT_OK) {
> + stk->driver->user_confirmation(stk, FALSE);
> + goto out;
> + }
> +
> + stk->driver->user_confirmation(stk, confirm);
> +
> + vc_atom = __ofono_modem_find_atom(__ofono_atom_get_modem(stk->atom),
> + OFONO_ATOM_TYPE_VOICECALL);
> + if (vc_atom)
> + vc = __ofono_atom_get_data(vc_atom);
> +
> + if (vc == NULL)
> + goto out;
> +
> + __ofono_voicecall_set_alpha_and_icon_id(vc, sc->alpha_id_call_setup,
> + sc->icon_id_call_setup.id);
> +
> + stk->modem_handled_cmd = TRUE;
> +
> + return;
> +out:
> + stk_command_free(stk->pending_cmd);
> + stk->pending_cmd = NULL;
> +}
> +
> static gboolean handle_command_set_up_call(const struct stk_command *cmd,
> struct stk_response *rsp,
> struct ofono_stk *stk)
> @@ -2601,6 +2641,40 @@ static gboolean handle_command_launch_browser(const struct stk_command *cmd,
> return FALSE;
> }
>
> +static void handle_setup_call_confirmation_req(struct stk_command *cmd,
> + struct ofono_stk *stk)
> +{
> + const struct stk_command_setup_call *sc = &cmd->setup_call;
> + int err;
> + char *alpha_id = dbus_apply_text_attributes(
> + sc->alpha_id_usr_cfm ?
> + sc->alpha_id_usr_cfm : "",
> + &sc->text_attr_usr_cfm);
> + if (alpha_id == NULL)
> + goto out;
> +
> + err = stk_agent_confirm_call(stk->current_agent, alpha_id,
> + &sc->icon_id_usr_cfm,
> + confirm_handled_call_cb,
> + stk, NULL,
> + stk->timeout * 1000);
> + g_free(alpha_id);
> +
> + if (err < 0)
> + goto out;
> +
> + stk->pending_cmd = cmd;
> + stk->cancel_cmd = stk_request_cancel;
> +
> + return;
> +
> +out:
> + if (stk->driver->user_confirmation)
> + stk->driver->user_confirmation(stk, FALSE);
> +
> + stk_command_free(cmd);
> +}
> +
> static void stk_proactive_command_cancel(struct ofono_stk *stk)
> {
> if (stk->immediate_response)
> @@ -2615,8 +2689,38 @@ static void stk_proactive_command_cancel(struct ofono_stk *stk)
> }
> }
>
> +static void proactive_session_end_handled_cmd(struct ofono_stk *stk)
> +{
> + stk->modem_handled_cmd = FALSE;
> +
> + switch(stk->pending_cmd->type) {
> + case STK_COMMAND_TYPE_SETUP_CALL:
> + {
> + struct ofono_voicecall *vc = NULL;
> + struct ofono_atom *vc_atom;
> +
> + vc_atom = __ofono_modem_find_atom(
> + __ofono_atom_get_modem(stk->atom),
> + OFONO_ATOM_TYPE_VOICECALL);
> + if (vc_atom)
> + vc = __ofono_atom_get_data(vc_atom);
> +
> + if (vc != NULL)
> + __ofono_voicecall_clear_alpha_and_icon_id(vc);
> +
> + break;
This part seems fragile. A new command may arrive and the alpha id
and icon id won't be cleared. Additionally modem_handled_cmd is not
reset when the pending_cmd is cancelled so it may affect a future
command. Maybe voicecall.c should automatically clear the alpha &
icon id after the first new call?
Best regards
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 3/4] stk: Handle set up call in handled_notify
2011-07-15 12:42 [PATCH 0/4] Add support for modem handled setup call proactive command Jeevaka Badrappan
@ 2011-07-15 12:42 ` Jeevaka Badrappan
2011-07-15 12:46 ` jeevaka.badrappan
2011-07-15 16:34 ` Denis Kenzior
0 siblings, 2 replies; 15+ messages in thread
From: Jeevaka Badrappan @ 2011-07-15 12:42 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 4609 bytes --]
---
src/stk.c | 122 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 119 insertions(+), 3 deletions(-)
diff --git a/src/stk.c b/src/stk.c
index 4df23b5..6cc3be3 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -77,6 +77,8 @@ struct ofono_stk {
struct timeval get_inkey_start_ts;
int dtmf_id;
+ gboolean modem_handled_cmd;
+
__ofono_sms_sim_download_cb_t sms_pp_cb;
void *sms_pp_userdata;
};
@@ -529,7 +531,12 @@ static void stk_alpha_id_set(struct ofono_stk *stk,
static void stk_alpha_id_unset(struct ofono_stk *stk)
{
- stk_agent_request_cancel(stk->current_agent);
+ /*
+ * If there is no default agent, then current agent also will be NULL.
+ * So, call request cancel only when there is a valid current agent.
+ */
+ if (stk->current_agent)
+ stk_agent_request_cancel(stk->current_agent);
}
static int duration_to_msecs(const struct stk_duration *duration)
@@ -1785,6 +1792,47 @@ static void confirm_call_cb(enum stk_agent_result result, gboolean confirm,
stk_command_cb(&error, stk);
}
+static void confirm_handled_call_cb(enum stk_agent_result result,
+ gboolean confirm, void *user_data)
+{
+ struct ofono_stk *stk = user_data;
+ const struct stk_command_setup_call *sc =
+ &stk->pending_cmd->setup_call;
+ struct ofono_voicecall *vc = NULL;
+ struct ofono_atom *vc_atom;
+
+ if (stk->driver->user_confirmation == NULL)
+ goto out;
+
+ if (result != STK_AGENT_RESULT_OK) {
+ stk->driver->user_confirmation(stk, FALSE);
+ goto out;
+ }
+
+ stk->driver->user_confirmation(stk, confirm);
+
+ vc_atom = __ofono_modem_find_atom(__ofono_atom_get_modem(stk->atom),
+ OFONO_ATOM_TYPE_VOICECALL);
+ if (vc_atom)
+ vc = __ofono_atom_get_data(vc_atom);
+
+ if (vc == NULL)
+ goto out;
+
+ __ofono_voicecall_set_alpha_and_icon_id(vc, sc->addr.number,
+ sc->addr.ton_npi,
+ sc->alpha_id_call_setup,
+ sc->icon_id_call_setup.id);
+
+ stk->modem_handled_cmd = TRUE;
+
+ return;
+
+out:
+ stk_command_free(stk->pending_cmd);
+ stk->pending_cmd = NULL;
+}
+
static gboolean handle_command_set_up_call(const struct stk_command *cmd,
struct stk_response *rsp,
struct ofono_stk *stk)
@@ -2601,8 +2649,75 @@ static gboolean handle_command_launch_browser(const struct stk_command *cmd,
return FALSE;
}
+static void handle_setup_call_confirmation_req(struct stk_command *cmd,
+ struct ofono_stk *stk)
+{
+ const struct stk_command_setup_call *sc = &cmd->setup_call;
+ int err;
+ char *alpha_id = dbus_apply_text_attributes(
+ sc->alpha_id_usr_cfm ?
+ sc->alpha_id_usr_cfm : "",
+ &sc->text_attr_usr_cfm);
+ if (alpha_id == NULL)
+ goto out;
+
+ err = stk_agent_confirm_call(stk->current_agent, alpha_id,
+ &sc->icon_id_usr_cfm,
+ confirm_handled_call_cb,
+ stk, NULL,
+ stk->timeout * 1000);
+ g_free(alpha_id);
+
+ if (err < 0)
+ goto out;
+
+ stk->pending_cmd = cmd;
+ stk->cancel_cmd = stk_request_cancel;
+
+ return;
+
+out:
+ if (stk->driver->user_confirmation)
+ stk->driver->user_confirmation(stk, FALSE);
+
+ stk_command_free(cmd);
+}
+
+static void proactive_command_handled_end(struct ofono_stk *stk)
+{
+ stk->modem_handled_cmd = FALSE;
+
+ if (stk->pending_cmd == NULL)
+ return;
+
+ switch(stk->pending_cmd->type) {
+ case STK_COMMAND_TYPE_SETUP_CALL:
+ {
+ struct ofono_voicecall *vc = NULL;
+ struct ofono_atom *vc_atom;
+
+ vc_atom = __ofono_modem_find_atom(
+ __ofono_atom_get_modem(stk->atom),
+ OFONO_ATOM_TYPE_VOICECALL);
+ if (vc_atom)
+ vc = __ofono_atom_get_data(vc_atom);
+
+ if (vc != NULL)
+ __ofono_voicecall_clear_alpha_and_icon_id(vc);
+
+ break;
+ }
+
+ default:
+ break;
+ }
+}
+
static void stk_proactive_command_cancel(struct ofono_stk *stk)
{
+ if (stk->modem_handled_cmd == TRUE)
+ proactive_command_handled_end(stk);
+
if (stk->immediate_response)
stk_request_cancel(stk);
@@ -2821,6 +2936,7 @@ void ofono_stk_proactive_command_handled_notify(struct ofono_stk *stk,
* responses here
*/
if (length > 0 && pdu[0] == 0x81) {
+ proactive_command_handled_end(stk);
stk_alpha_id_unset(stk);
return;
}
@@ -2858,8 +2974,8 @@ void ofono_stk_proactive_command_handled_notify(struct ofono_stk *stk,
break;
case STK_COMMAND_TYPE_SETUP_CALL:
- /* TODO */
- break;
+ handle_setup_call_confirmation_req(cmd, stk);
+ return;
case STK_COMMAND_TYPE_SEND_USSD:
stk_alpha_id_set(stk, cmd->send_ussd.alpha_id,
--
1.7.4.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 3/4] stk: Handle set up call in handled_notify
2011-07-15 12:42 ` [PATCH 3/4] stk: Handle set up call in handled_notify Jeevaka Badrappan
@ 2011-07-15 12:46 ` jeevaka.badrappan
2011-07-15 16:11 ` Denis Kenzior
2011-07-15 16:34 ` Denis Kenzior
1 sibling, 1 reply; 15+ messages in thread
From: jeevaka.badrappan @ 2011-07-15 12:46 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 552 bytes --]
Hi,
> @@ -529,7 +531,12 @@ static void stk_alpha_id_set(struct ofono_stk *stk,
>
> static void stk_alpha_id_unset(struct ofono_stk *stk)
> {
> - stk_agent_request_cancel(stk->current_agent);
> + /*
> + * If there is no default agent, then current agent also will be NULL.
> + * So, call request cancel only when there is a valid current agent.
> + */
> + if (stk->current_agent)
> + stk_agent_request_cancel(stk->current_agent);
> }
>
If needed, I can send this code change alone in a separate fix patch.
Regards,
Jeevaka
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 3/4] stk: Handle set up call in handled_notify
2011-07-15 12:46 ` jeevaka.badrappan
@ 2011-07-15 16:11 ` Denis Kenzior
0 siblings, 0 replies; 15+ messages in thread
From: Denis Kenzior @ 2011-07-15 16:11 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 757 bytes --]
Hi Jeevaka,
On 07/15/2011 07:46 AM, jeevaka.badrappan(a)linux.intel.com wrote:
> Hi,
>
>> @@ -529,7 +531,12 @@ static void stk_alpha_id_set(struct ofono_stk *stk,
>>
>> static void stk_alpha_id_unset(struct ofono_stk *stk)
>> {
>> - stk_agent_request_cancel(stk->current_agent);
>> + /*
>> + * If there is no default agent, then current agent also will be NULL.
>> + * So, call request cancel only when there is a valid current agent.
>> + */
>> + if (stk->current_agent)
>> + stk_agent_request_cancel(stk->current_agent);
>> }
>>
>
> If needed, I can send this code change alone in a separate fix patch.
>
It sounds like you were getting a crash with this one, so please send it
as a separate patch.
Regards,
-Denis
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 3/4] stk: Handle set up call in handled_notify
2011-07-15 12:42 ` [PATCH 3/4] stk: Handle set up call in handled_notify Jeevaka Badrappan
2011-07-15 12:46 ` jeevaka.badrappan
@ 2011-07-15 16:34 ` Denis Kenzior
2011-07-15 16:45 ` jeevaka.badrappan
1 sibling, 1 reply; 15+ messages in thread
From: Denis Kenzior @ 2011-07-15 16:34 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1233 bytes --]
Hi Andrew, Jeevaka,
<snip>
> +static void proactive_command_handled_end(struct ofono_stk *stk)
> +{
> + stk->modem_handled_cmd = FALSE;
> +
> + if (stk->pending_cmd == NULL)
> + return;
> +
> + switch(stk->pending_cmd->type) {
> + case STK_COMMAND_TYPE_SETUP_CALL:
> + {
> + struct ofono_voicecall *vc = NULL;
> + struct ofono_atom *vc_atom;
> +
> + vc_atom = __ofono_modem_find_atom(
> + __ofono_atom_get_modem(stk->atom),
> + OFONO_ATOM_TYPE_VOICECALL);
> + if (vc_atom)
> + vc = __ofono_atom_get_data(vc_atom);
> +
> + if (vc != NULL)
> + __ofono_voicecall_clear_alpha_and_icon_id(vc);
> +
> + break;
> + }
> +
> + default:
> + break;
> + }
> +}
> +
So I'm still not sure this part is actually needed. Once the user has
acknowledged the call, there is no way for us to cancel it until the
call is notified to the voicecall driver. So unless the modem is drunk,
I don't really see the need to cover this case.
Once the call is notified to voicecall driver, then the need for
clearing alpha/icon id disappears. The voicecall driver will do this
automatically based on the ofono_voicecall_disconnected notification.
What do you guys think?
Regards,
-Denis
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 3/4] stk: Handle set up call in handled_notify
2011-07-15 16:34 ` Denis Kenzior
@ 2011-07-15 16:45 ` jeevaka.badrappan
2011-07-15 16:59 ` Denis Kenzior
0 siblings, 1 reply; 15+ messages in thread
From: jeevaka.badrappan @ 2011-07-15 16:45 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1964 bytes --]
Hi Denis,
>> +static void proactive_command_handled_end(struct ofono_stk *stk)
>> +{
>> + stk->modem_handled_cmd = FALSE;
>> +
>> + if (stk->pending_cmd == NULL)
>> + return;
>> +
>> + switch(stk->pending_cmd->type) {
>> + case STK_COMMAND_TYPE_SETUP_CALL:
>> + {
>> + struct ofono_voicecall *vc = NULL;
>> + struct ofono_atom *vc_atom;
>> +
>> + vc_atom = __ofono_modem_find_atom(
>> + __ofono_atom_get_modem(stk->atom),
>> + OFONO_ATOM_TYPE_VOICECALL);
>> + if (vc_atom)
>> + vc = __ofono_atom_get_data(vc_atom);
>> +
>> + if (vc != NULL)
>> + __ofono_voicecall_clear_alpha_and_icon_id(vc);
>> +
>> + break;
>> + }
>> +
>> + default:
>> + break;
>> + }
>> +}
>> +
>
> So I'm still not sure this part is actually needed. Once the user has
> acknowledged the call, there is no way for us to cancel it until the
> call is notified to the voicecall driver. So unless the modem is drunk,
> I don't really see the need to cover this case.
>
> Once the call is notified to voicecall driver, then the need for
> clearing alpha/icon id disappears. The voicecall driver will do this
> automatically based on the ofono_voicecall_disconnected notification.
>
> What do you guys think?
As pointed in other mail thred, trying to cover the following case:
1. oFono core is informed of the modem handled setup call and requests
user confirmation
2. User confirms the call
3. User confirmation sent to modem.
4. Due to some reason, modem is not able to setup the call. So, basically
oFono core is not notified of any call status notifications
5. Modem sends the terminal response to SAT and notifies oFono core of the
command/session completion
Basically, if the modem due to some reason fails to initiate/setup the
call and call status notifications not sent to the voice call driver side.
This case, we will be left with dial_req, message and icon id set but not
freed.
Regards,
Jeevaka
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 3/4] stk: Handle set up call in handled_notify
2011-07-15 16:45 ` jeevaka.badrappan
@ 2011-07-15 16:59 ` Denis Kenzior
0 siblings, 0 replies; 15+ messages in thread
From: Denis Kenzior @ 2011-07-15 16:59 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2580 bytes --]
Hi Jeevaka,
On 07/15/2011 11:45 AM, jeevaka.badrappan(a)linux.intel.com wrote:
> Hi Denis,
>
>>> +static void proactive_command_handled_end(struct ofono_stk *stk)
>>> +{
>>> + stk->modem_handled_cmd = FALSE;
>>> +
>>> + if (stk->pending_cmd == NULL)
>>> + return;
>>> +
>>> + switch(stk->pending_cmd->type) {
>>> + case STK_COMMAND_TYPE_SETUP_CALL:
>>> + {
>>> + struct ofono_voicecall *vc = NULL;
>>> + struct ofono_atom *vc_atom;
>>> +
>>> + vc_atom = __ofono_modem_find_atom(
>>> + __ofono_atom_get_modem(stk->atom),
>>> + OFONO_ATOM_TYPE_VOICECALL);
>>> + if (vc_atom)
>>> + vc = __ofono_atom_get_data(vc_atom);
>>> +
>>> + if (vc != NULL)
>>> + __ofono_voicecall_clear_alpha_and_icon_id(vc);
>>> +
>>> + break;
>>> + }
>>> +
>>> + default:
>>> + break;
>>> + }
>>> +}
>>> +
>>
>> So I'm still not sure this part is actually needed. Once the user has
>> acknowledged the call, there is no way for us to cancel it until the
>> call is notified to the voicecall driver. So unless the modem is drunk,
>> I don't really see the need to cover this case.
>>
>> Once the call is notified to voicecall driver, then the need for
>> clearing alpha/icon id disappears. The voicecall driver will do this
>> automatically based on the ofono_voicecall_disconnected notification.
>>
>> What do you guys think?
>
> As pointed in other mail thred, trying to cover the following case:
>
> 1. oFono core is informed of the modem handled setup call and requests
> user confirmation
> 2. User confirms the call
> 3. User confirmation sent to modem.
> 4. Due to some reason, modem is not able to setup the call. So, basically
> oFono core is not notified of any call status notifications
> 5. Modem sends the terminal response to SAT and notifies oFono core of the
> command/session completion
>
> Basically, if the modem due to some reason fails to initiate/setup the
> call and call status notifications not sent to the voice call driver side.
> This case, we will be left with dial_req, message and icon id set but not
> freed.
>
OK I see now. In theory we could do some basic sanity checks (e.g.
modem is online, etc) to alleviate this, but your proposal is probably
safer even if more complicated.
Also, you probably can formalize proactive_command_handled_end and not
call stk_unset_alpha_id unnecessarily in the case of modem-handled Set
Up Call.
And I'm still not sure about modem_handled_cmd variable. Can't you set
cancel_cmd to proactive_command_handled_end?
Regards,
-Denis
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2011-07-15 16:59 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-06 10:06 [PATCH 0/4] Add support for modem handled setup call proactive command Jeevaka Badrappan
2011-07-06 10:06 ` [PATCH 1/4] include: Add driver api for user confirmation Jeevaka Badrappan
2011-07-06 6:28 ` Denis Kenzior
2011-07-06 10:06 ` [PATCH 2/4] voicecall: api for set/clear alpha and icon id Jeevaka Badrappan
2011-07-06 6:38 ` Denis Kenzior
2011-07-06 10:06 ` [PATCH 3/4] stk: Handle set up call in handled_notify Jeevaka Badrappan
2011-07-06 6:43 ` Denis Kenzior
2011-07-06 16:51 ` Andrzej Zaborowski
2011-07-06 10:06 ` [PATCH 4/4] ifxmodem: add support for user_confirmation in stk Jeevaka Badrappan
-- strict thread matches above, loose matches on Subject: below --
2011-07-15 12:42 [PATCH 0/4] Add support for modem handled setup call proactive command Jeevaka Badrappan
2011-07-15 12:42 ` [PATCH 3/4] stk: Handle set up call in handled_notify Jeevaka Badrappan
2011-07-15 12:46 ` jeevaka.badrappan
2011-07-15 16:11 ` Denis Kenzior
2011-07-15 16:34 ` Denis Kenzior
2011-07-15 16:45 ` jeevaka.badrappan
2011-07-15 16:59 ` 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.