All of lore.kernel.org
 help / color / mirror / Atom feed
* [RfC][PATCH 1/3] stk: API for SMS Point-to-Point download to UICC
@ 2010-11-07 17:42 Andrzej Zaborowski
  2010-11-07 17:42 ` [PATCH 2/3] sms: Handle "USIM Download" SMS type Andrzej Zaborowski
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Andrzej Zaborowski @ 2010-11-07 17:42 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2664 bytes --]

The callback returns the TP-User-Data element content of the RP-ACK or
RP-ERROR message, returned by the UICC.
---
 src/ofono.h |    8 ++++++++
 src/stk.c   |   39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/src/ofono.h b/src/ofono.h
index ab6ecd2..e5b4acb 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -283,9 +283,17 @@ unsigned short __ofono_sms_get_next_ref(struct ofono_sms *sms);
 #include <ofono/sim.h>
 #include <ofono/stk.h>
 
+typedef void (*__ofono_sms_sim_download_cb_t)(ofono_bool_t ok,
+						const unsigned char *tp_ud,
+						int len, void *data);
+
 struct cbs;
 void __ofono_cbs_sim_download(struct ofono_stk *stk, const struct cbs *msg);
 
+struct sms;
+int __ofono_sms_sim_download(struct ofono_stk *stk, const struct sms *msg,
+				__ofono_sms_sim_download_cb_t cb, void *data);
+
 #include <ofono/ssn.h>
 
 typedef void (*ofono_ssn_mo_notify_cb)(int index, void *user);
diff --git a/src/stk.c b/src/stk.c
index 230c923..18beee6 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -75,6 +75,9 @@ struct ofono_stk {
 	struct stk_icon_id idle_mode_icon;
 	struct timeval get_inkey_start_ts;
 	int dtmf_id;
+
+	__ofono_sms_sim_download_cb_t sms_pp_cb;
+	void *sms_pp_userdata;
 };
 
 struct envelope_op {
@@ -257,6 +260,42 @@ void __ofono_cbs_sim_download(struct ofono_stk *stk, const struct cbs *msg)
 		stk_cbs_download_cb(stk, FALSE, NULL, -1);
 }
 
+static void stk_sms_download_cb(struct ofono_stk *stk, gboolean ok,
+				const unsigned char *data, int len)
+{
+	DBG("SMS-PP download to UICC reported %s", ok ? "success" : "error");
+
+	if (stk->sms_pp_cb)
+		stk->sms_pp_cb(ok, data, len, stk->sms_pp_userdata);
+}
+
+int __ofono_sms_sim_download(struct ofono_stk *stk, const struct sms *msg,
+				__ofono_sms_sim_download_cb_t cb, void *data)
+{
+	struct stk_envelope e;
+
+	if (msg->type != SMS_TYPE_DELIVER)
+		return -EINVAL;
+
+	DBG("");
+
+	memset(&e, 0, sizeof(e));
+
+	e.type = STK_ENVELOPE_TYPE_SMS_PP_DOWNLOAD;
+	e.src = STK_DEVICE_IDENTITY_TYPE_NETWORK;
+
+	e.sms_pp_download.address.number = (char *) msg->sc_addr.address;
+	e.sms_pp_download.address.ton_npi = msg->sc_addr.numbering_plan |
+		(msg->sc_addr.number_type << 4);
+	memcpy(&e.sms_pp_download.message, &msg->deliver, sizeof(msg->deliver));
+
+	stk->sms_pp_cb = cb;
+	stk->sms_pp_userdata = data;
+
+	return stk_send_envelope(stk, &e, stk_sms_download_cb,
+					ENVELOPE_RETRIES_DEFAULT);
+}
+
 static char *dbus_apply_text_attributes(const char *text,
 					const struct stk_text_attribute *attr)
 {
-- 
1.7.1.86.g0e460.dirty


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-11-08 19:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-07 17:42 [RfC][PATCH 1/3] stk: API for SMS Point-to-Point download to UICC Andrzej Zaborowski
2010-11-07 17:42 ` [PATCH 2/3] sms: Handle "USIM Download" SMS type Andrzej Zaborowski
2010-11-08 19:47   ` Denis Kenzior
2010-11-07 17:42 ` [PATCH 3/3] Update TODO Andrzej Zaborowski
2010-11-08 19:49   ` Denis Kenzior
2010-11-08 19:47 ` [RfC][PATCH 1/3] stk: API for SMS Point-to-Point download to UICC Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.