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.
This commit is contained in:
Andrzej Zaborowski 2010-10-13 15:54:16 +02:00 committed by Denis Kenzior
parent 526cf25dc8
commit 404e0838da
2 changed files with 45 additions and 0 deletions

View File

@ -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

View File

@ -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);