summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrzej Zaborowski <andrew.zaborowski@intel.com>2010-10-13 15:54:16 +0200
committerDenis Kenzior <denkenz@gmail.com>2010-10-14 04:17:02 -0500
commit404e0838da1a12b54efa3f78cbc1c9df496962d2 (patch)
tree2f709aeee9b13e0136ee4d3ab3c9addf34cb4550
parent526cf25dc8759bca9cf6ca46f8af3d0d55dc9d4c (diff)
downloadofono-404e0838da1a12b54efa3f78cbc1c9df496962d2.tar.bz2
API for STK driver to signal executed commands
Some modems are able to handle some proactive commands in their firmware or otherwise, if the command doesn't require input from user. Nevertheles ofono may need to update internal state or notify the user where necessary. With this api the driver can notify core that a command is being executed in the modem or that a command is finished executing and the TERMINAL RESPONSE has been sent to SIM. It would also be possible for a driver to handle a command.
-rw-r--r--include/stk.h7
-rw-r--r--src/stk.c38
2 files changed, 45 insertions, 0 deletions
diff --git a/include/stk.h b/include/stk.h
index 638da9cb..8f548d39 100644
--- a/include/stk.h
+++ b/include/stk.h
@@ -67,6 +67,13 @@ void ofono_stk_proactive_command_notify(struct ofono_stk *stk,
void ofono_stk_proactive_session_end_notify(struct ofono_stk *stk);
+void ofono_stk_proactive_command_handled_notify(struct ofono_stk *stk,
+ int length,
+ const unsigned char *pdu);
+void ofono_stk_terminal_response_sent_notify(struct ofono_stk *stk,
+ int length,
+ const unsigned char *pdu);
+
#ifdef __cplusplus
}
#endif
diff --git a/src/stk.c b/src/stk.c
index bae5587f..b94689a4 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -2037,6 +2037,44 @@ void ofono_stk_proactive_command_notify(struct ofono_stk *stk,
stk_command_cb(&error, stk);
}
+void ofono_stk_proactive_command_handled_notify(struct ofono_stk *stk,
+ int length,
+ const unsigned char *pdu)
+{
+ struct stk_command *cmd;
+
+ stk_proactive_command_cancel(stk);
+
+ cmd = stk_command_new_from_pdu(pdu, length);
+
+ if (!cmd || cmd->status != STK_PARSE_RESULT_OK) {
+ ofono_error("Can't parse proactive command");
+
+ if (cmd)
+ stk_command_free(cmd);
+ return;
+ }
+
+ switch (cmd->type) {
+ case STK_COMMAND_TYPE_MORE_TIME:
+ break;
+
+ case STK_COMMAND_TYPE_SEND_SMS:
+ stk_alpha_id_set(stk, cmd->send_sms.alpha_id,
+ &cmd->send_sms.icon_id);
+ break;
+ }
+
+ stk_command_free(cmd);
+}
+
+void ofono_stk_terminal_response_sent_notify(struct ofono_stk *stk,
+ int length,
+ const unsigned char *pdu)
+{
+ stk_alpha_id_unset(stk);
+}
+
int ofono_stk_driver_register(const struct ofono_stk_driver *d)
{
DBG("driver: %p, name: %s", d, d->name);