Try to fetch and parse proactive commands.
RFC PATCH 6/8 Try to fetch and parse proactive commands.
--- src/sim.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 38 insertions(+), 0 deletions(-)
src/sim.c +38 -0
@@ -1804,8 +1804,46 @@ void ofono_sim_removed(struct ofono_sim *sim) } } +static void sim_command_fetch_cb (const struct ofono_error *error, +const unsigned char *pdu,int length,void *data) +{ +struct stk_command *cmd; +char *buf; +int i; + +if (error->type !=OFONO_ERROR_TYPE_NO_ERROR ) { +ofono_error ("Proactive command pending but can't fetch it" ); +return ; + } + + buf =g_try_new (char, length *2 +1 ); +for (i =0 ; i < length; i ++) +sprintf (buf + i *2 ,"%hhx" , pdu[i]); +DBG ("Fetched PDU: %s" , buf); + + cmd =stk_command_new_from_pdu (pdu, length); +if (!cmd) { +ofono_error ("Can't parse proactive command: %s" , buf); +g_free (buf); + +/* TODO: return TERMINAL RESPONSE with permanent error */ +return ; + } + +/* TODO: execute */ + +g_free (buf); +stk_command_free (cmd); +} +void ofono_sim_proactive_command_notify (struct ofono_sim *sim,int length) { +DBG ("%p: %i bytes" , sim, length); + +if (!sim->driver->fetch) +return ; + + sim->driver->fetch (sim, length, sim_command_fetch_cb, sim); }static void sim_status_poll_schedule (struct ofono_sim *sim)
Signature · 1 line
1.6.1