From 404e0838da1a12b54efa3f78cbc1c9df496962d2 Mon Sep 17 00:00:00 2001 From: Andrzej Zaborowski Date: Wed, 13 Oct 2010 15:54:16 +0200 Subject: 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. --- src/stk.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'src') 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); -- cgit v1.2.3