Add an atom for STK, move envelope command to stk driver.
PATCH 3/8 Add an atom for STK, move envelope command to stk driver.
--- Makefile.am | 4 +- drivers/atmodem/sim.c | 77 ------------------- include/sim.h | 3 - include/stk.h | 71 +++++++++++++++++ src/cbs.c | 10 ++- src/modem.c | 1 + src/ofono.h | 4 +- src/sim.c | 37 --------- src/stk.c | 201 +++++++++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 287 insertions(+), 121 deletions(-) create mode 100644 include/stk.h create mode 100644 src/stk.c
Makefile.am +2 -2
@@ -12,7 +12,7 @@ include_HEADERS = include/log.h include/plugin.h include/history.h \ include/netreg.h include/voicecall.h include/devinfo.h \ include/cbs.h include/call-volume.h \ include/gprs.h include/gprs-context.h \ - include/radio-settings.h + include/radio-settings.h include/stk.h nodist_include_HEADERS = include/version.h
@@ -231,7 +231,7 @@ src_ofonod_SOURCES = $(gdbus_sources) $(builtin_sources) \ src/network.c src/voicecall.c src/ussd.c src/sms.c \ src/call-settings.c src/call-forwarding.c \ src/call-meter.c src/smsutil.h src/smsutil.c \ - src/ssn.c src/call-barring.c src/sim.c \ + src/ssn.c src/call-barring.c src/sim.c src/stk.c \ src/phonebook.c src/history.c src/message-waiting.c \ src/simutil.h src/simutil.c src/storage.h \ src/storage.c src/cbs.c src/watch.c src/call-volume.c \
drivers/atmodem/sim.c +0 -77
89 lines not on this page · raw message
include/sim.h +0 -3
@@ -156,9 +156,6 @@ struct ofono_sim_driver {void (*query_locked)(struct ofono_sim *sim,enum ofono_sim_password_type type,ofono_sim_locked_cb_t cb,void *data); -void (*envelope)(struct ofono_sim *sim,int length, -const guint8 *command, -ofono_sim_read_cb_t cb,void *data); };int ofono_sim_driver_register (const struct ofono_sim_driver *d);
include/stk.h new file +71 -0
71 lines not on this page · raw message
src/cbs.c +9 -1
@@ -57,6 +57,7 @@ struct ofono_cbs {GSList *topics;GSList *new_topics;struct ofono_sim *sim; +struct ofono_stk *stk;struct ofono_netreg *netreg;unsigned int netreg_watch;unsigned int location_watch;
@@ -195,7 +196,7 @@ void ofono_cbs_notify(struct ofono_cbs *cbs, const unsigned char *pdu, }if (cbs_topic_in_range (c.message_identifier, cbs->efcbmid_contents)) { -__ofono_cbs_sim_download (cbs->sim, pdu, pdu_len); +__ofono_cbs_sim_download (cbs->stk, pdu, pdu_len);return ; }
@@ -590,6 +591,7 @@ static void cbs_unregister(struct ofono_atom *atom) } cbs->sim =NULL ; + cbs->stk =NULL ;if (cbs->reset_source) {g_source_remove (cbs->reset_source);
@@ -1027,6 +1029,7 @@ void ofono_cbs_register(struct ofono_cbs *cbs)struct ofono_modem *modem =__ofono_atom_get_modem (cbs->atom);const char *path =__ofono_atom_get_path (cbs->atom);struct ofono_atom *sim_atom; +struct ofono_atom *stk_atom;struct ofono_atom *netreg_atom; if (!g_dbus_register_interface(conn, path,
@@ -1050,6 +1053,11 @@ void ofono_cbs_register(struct ofono_cbs *cbs)cbs_got_imsi (cbs); } + stk_atom =__ofono_modem_find_atom (modem,OFONO_ATOM_TYPE_SIM ); + +if (stk_atom) + cbs->stk =__ofono_atom_get_data (stk_atom); + cbs->netreg_watch =__ofono_modem_add_atom_watch (modem,OFONO_ATOM_TYPE_NETREG , netreg_watch, cbs,NULL );
src/modem.c +1 -0
@@ -31,6 +31,7 @@#include <gdbus.h> #include "ofono.h" +#include "sim.h" #include "common.h"
src/ofono.h +3 -1
@@ -114,6 +114,7 @@ enum ofono_atom_type {OFONO_ATOM_TYPE_GPRS =16 ,OFONO_ATOM_TYPE_GPRS_CONTEXT =17 ,OFONO_ATOM_TYPE_RADIO_SETTINGS =18 , + OFONO_ATOM_TYPE_STK = 19, }; enum ofono_atom_watch_condition {
@@ -172,8 +173,9 @@ void __ofono_atom_free(struct ofono_atom *atom);#include <ofono/radio-settings.h> #include <ofono/sim.h> +#include <ofono/stk.h> -void __ofono_cbs_sim_download (struct ofono_sim *sim, +void __ofono_cbs_sim_download (struct ofono_stk *stk,const guint8 *pdu,int pdu_len);#include <ofono/ssn.h>
src/sim.c +0 -37
@@ -42,7 +42,6 @@#include "smsutil.h" #include "simutil.h" #include "storage.h" -#include "stkutil.h" #define SIM_CACHE_MODE 0600#define SIM_CACHE_PATH STORAGEDIR "/%s-%i/%04x"
@@ -1883,42 +1882,6 @@ static void sim_set_ready(struct ofono_sim *sim) } } -static void sim_cb_download_cb (const struct ofono_error *error, -const unsigned char *data,int len,void *user) -{ -if (error->type !=OFONO_ERROR_TYPE_NO_ERROR ) { -ofono_error ("CellBroadcast download to UICC failed" ); -return ; - } - -DBG ("CellBroadcast download to UICC reported no error" ); -} - -void __ofono_cbs_sim_download (struct ofono_sim *sim, -const guint8 *pdu,int pdu_len) -{ -guint8 tlv[pdu_len +8 ]; - -if (sim->state !=OFONO_SIM_STATE_READY ) -return ; - -if (sim->driver->envelope ==NULL ) -return ; - - tlv[0 ] =STK_ENVELOPE_TYPE_CBS_PP_DOWNLOAD ; - tlv[1 ] =6 + pdu_len; - tlv[2 ] =0x80 |STK_DATA_OBJECT_TYPE_DEVICE_IDENTITIES ; - tlv[3 ] =0x02 ;/* Device Identities length */ - tlv[4 ] =STK_DEVICE_IDENTITY_TYPE_NETWORK ; - tlv[5 ] =STK_DEVICE_IDENTITY_TYPE_UICC ; - tlv[6 ] =0x80 |STK_DATA_OBJECT_TYPE_CBS_PAGE ; - tlv[7 ] = pdu_len; - -memcpy (tlv +8 , pdu, pdu_len); - - sim->driver->envelope (sim, pdu_len +8 , tlv, sim_cb_download_cb, sim); -} -int ofono_sim_driver_register (const struct ofono_sim_driver *d) {DBG ("driver: %p, name: %s" , d, d->name);
src/stk.c new file +201 -0
201 lines not on this page · raw message
Signature · 1 line
1.6.1
Hi Andrew,
Quoted 6 lines
--- Makefile.am | 4 +- drivers/atmodem/sim.c | 77 ------------------- include/sim.h | 3 - include/stk.h | 71 +++++++++++++++++ src/cbs.c | 10 ++-
Quoted 9 lines
src/modem.c | 1 + src/ofono.h | 4 +- src/sim.c | 37 --------- src/stk.c | 201 +++++++++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 287 insertions(+), 121 deletions(-) create mode 100644 include/stk.h create mode 100644 src/stk.c
This patch has been applied, thanks.
Regards,
-Denis