summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2010-07-30 18:17:57 -0500
committerDenis Kenzior <denkenz@gmail.com>2010-07-30 18:17:57 -0500
commite2d6d5637454c9c28343b78dd0176b323be0bc13 (patch)
tree97d366e0c31ef24948fc5994905a24111e920a9b
parent5e46a73ed07128c1dae75806a75895fe29501269 (diff)
downloadofono-e2d6d5637454c9c28343b78dd0176b323be0bc13.tar.bz2
stk: Handle the case where no agent is registered
-rw-r--r--src/stk.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/stk.c b/src/stk.c
index 506944a9..e2714ff5 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -1206,6 +1206,25 @@ void ofono_stk_proactive_command_notify(struct ofono_stk *stk,
return;
}
+ /*
+ * In case no agent is registered, we should reject commands destined
+ * to the Agent with a NOT_CAPABLE error.
+ */
+ if (stk->current_agent == NULL) {
+ switch (stk->pending_cmd->type) {
+ case STK_COMMAND_TYPE_SELECT_ITEM:
+ case STK_COMMAND_TYPE_DISPLAY_TEXT:
+ case STK_COMMAND_TYPE_GET_INKEY:
+ case STK_COMMAND_TYPE_GET_INPUT:
+ case STK_COMMAND_TYPE_PLAY_TONE:
+ send_simple_response(stk, STK_RESULT_TYPE_NOT_CAPABLE);
+ return;
+
+ default:
+ break;
+ }
+ }
+
memset(&rsp, 0, sizeof(rsp));
switch (stk->pending_cmd->type) {