Skip to contentSkip to conversation

sim: Add sim_service_available() for querying EFsst or EFust.

PATCH In review Andrzej Zaborowski 2 participants 6 messages Nov 10, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 sim: Add sim_service_available() for querying EFsst or EFust.

The function is not public api because the service constants are in src/simutil.h.

---
 src/ofono.h |    5 +++++
 src/sim.c   |   15 +++++++++++++++
 2 files changed, 20 insertions(+), 0 deletions(-)
src/ofono.h +5 -0
index e5b4acb..4d76d20 100644
@@ -281,6 +281,11 @@ gboolean __ofono_sms_datagram_watch_remove(struct ofono_sms *sms,
 unsigned short __ofono_sms_get_next_ref(struct ofono_sms *sms);
 
 #include <ofono/sim.h>
+
+ofono_bool_t __ofono_sim_service_available(struct ofono_sim *sim,
+						int ust_service,
+						int sst_service);
+
 #include <ofono/stk.h>
 
 typedef void (*__ofono_sms_sim_download_cb_t)(ofono_bool_t ok,
src/sim.c +15 -0
index e5e304c..f362565 100644
@@ -1928,6 +1928,21 @@ const unsigned char *ofono_sim_get_cphs_service_table(struct ofono_sim *sim)
 	return sim->cphs_service_table;
 }
 
+ofono_bool_t __ofono_sim_service_available(struct ofono_sim *sim,
+						int ust_service,
+						int sst_service)
+{
+	if (sim->efust)
+		return sim_ust_is_available(sim->efust, sim->efust_length,
+						ust_service);
+
+	if (sim->efsst)
+		return sim_sst_is_active(sim->efsst, sim->efsst_length,
+						sst_service);
+
+	return FALSE;
+}
+
 static void sim_inserted_update(struct ofono_sim *sim)
 {
 	DBusConnection *conn = ofono_dbus_get_connection();
Signature · 1 line
1.7.1.86.g0e460.dirty
#1 lore raw

PATCH 2/3 sms: SMS-PP download must be enabled in SIM service tables.

---
 src/sms.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
src/sms.c +13 -0
index eba4564..fe45ef3 100644
@@ -37,6 +37,7 @@
 #include "util.h"
 #include "smsutil.h"
 #include "storage.h"
+#include "simutil.h"
 
 #define uninitialized_var(x) x = x
 
@@ -1417,6 +1418,7 @@ void ofono_sms_deliver_notify(struct ofono_sms *sms, unsigned char *pdu,
 {
 	struct ofono_modem *modem = __ofono_atom_get_modem(sms->atom);
 	struct ofono_atom *stk_atom;
+	struct ofono_atom *sim_atom;
 	struct sms s;
 	enum sms_class cls;
 
@@ -1485,6 +1487,17 @@ void ofono_sms_deliver_notify(struct ofono_sms *sms, unsigned char *pdu,
 		if (cls != SMS_CLASS_2)
 			break;
 
+		sim_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_SIM);
+
+		if (!sim_atom)
+			return;
+
+		if (!__ofono_sim_service_available(
+					__ofono_atom_get_data(sim_atom),
+					SIM_UST_SERVICE_DATA_DOWNLOAD_SMS_PP,
+					SIM_SST_SERVICE_DATA_DOWNLOAD_SMS_PP))
+			return;
+
 		stk_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_STK);
 
 		if (!stk_atom)
Signature · 1 line
1.7.1.86.g0e460.dirty
#3 lore raw

PATCH 3/3 cbs: CB download must be enabled in SIM service tables.

In reply to Andrzej Zaborowski
---
 src/cbs.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
src/cbs.c +13 -0
index 6bd2f69..821985b 100644
@@ -173,6 +173,7 @@ static void cbs_dispatch_text(struct ofono_cbs *cbs, enum sms_class cls,
 void ofono_cbs_notify(struct ofono_cbs *cbs, const unsigned char *pdu,
 				int pdu_len)
 {
+	struct ofono_modem *modem = __ofono_atom_get_modem(cbs->atom);
 	struct cbs c;
 	enum sms_class cls;
 	gboolean udhi;
@@ -181,6 +182,7 @@ void ofono_cbs_notify(struct ofono_cbs *cbs, const unsigned char *pdu,
 	enum sms_charset charset;
 	char *message;
 	char iso639_lang[3];
+	struct ofono_atom *sim_atom;
 
 	if (cbs->assembly == NULL)
 		return;
@@ -191,6 +193,17 @@ void ofono_cbs_notify(struct ofono_cbs *cbs, const unsigned char *pdu,
 	}
 
 	if (cbs_topic_in_range(c.message_identifier, cbs->efcbmid_contents)) {
+		sim_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_SIM);
+
+		if (!sim_atom)
+			return;
+
+		if (!__ofono_sim_service_available(
+					__ofono_atom_get_data(sim_atom),
+					SIM_UST_SERVICE_DATA_DOWNLOAD_SMS_CB,
+					SIM_SST_SERVICE_DATA_DOWNLOAD_SMS_CB))
+			return;
+
 		if (cbs->stk)
 			__ofono_cbs_sim_download(cbs->stk, &c);
 		return;
Signature · 1 line
1.7.1.86.g0e460.dirty
#2 lore raw

Re: [PATCH 2/3] sms: SMS-PP download must be enabled in SIM service tables.

In reply to Andrzej Zaborowski

Hi Andrew,

Quoted 4 lines · Andrzej Zaborowski
---
 src/sms.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

Patch has been applied, thanks.

Regards,
-Denis

#4 lore raw

Re: [PATCH 3/3] cbs: CB download must be enabled in SIM service tables.

In reply to Andrzej Zaborowski

Hi Andrew,

Quoted 4 lines · Andrzej Zaborowski
---
 src/cbs.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

Patch has been applied, thanks.

Regards,
-Denis