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

* [PATCH 2/3] sms: Handle "USIM Download" SMS type.
  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 ` 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:47 ` [RfC][PATCH 1/3] stk: API for SMS Point-to-Point download to UICC Denis Kenzior
  2 siblings, 1 reply; 6+ messages in thread
From: Andrzej Zaborowski @ 2010-11-07 17:42 UTC (permalink / raw)
  To: ofono

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

---
 src/sms.c |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/sms.c b/src/sms.c
index 456dda9..eba4564 100644
--- a/src/sms.c
+++ b/src/sms.c
@@ -1415,6 +1415,8 @@ static inline gboolean handle_mwi(struct ofono_sms *sms, struct sms *s)
 void ofono_sms_deliver_notify(struct ofono_sms *sms, unsigned char *pdu,
 				int len, int tpdu_len)
 {
+	struct ofono_modem *modem = __ofono_atom_get_modem(sms->atom);
+	struct ofono_atom *stk_atom;
 	struct sms s;
 	enum sms_class cls;
 
@@ -1479,13 +1481,22 @@ void ofono_sms_deliver_notify(struct ofono_sms *sms, unsigned char *pdu,
 		break;
 	case SMS_PID_TYPE_USIM_DOWNLOAD:
 	case SMS_PID_TYPE_ANSI136:
-		if (cls == SMS_CLASS_2) {
-			ofono_error("(U)SIM Download messages not supported");
+		/* If not Class 2, handle in a "normal" way */
+		if (cls != SMS_CLASS_2)
+			break;
+
+		stk_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_STK);
+
+		if (!stk_atom)
 			return;
-		}
 
-		/* Otherwise handle in a "normal" way */
-		break;
+		__ofono_sms_sim_download(__ofono_atom_get_data(stk_atom),
+						&s, NULL, sms);
+
+		/* Passing the USIM response back to network is not
+		 * currently support */
+		/* TODO: store in EFsms if not handled */
+		return;
 	default:
 		break;
 	}
-- 
1.7.1.86.g0e460.dirty


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

* [PATCH 3/3] Update TODO.
  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-07 17:42 ` 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
  2 siblings, 1 reply; 6+ messages in thread
From: Andrzej Zaborowski @ 2010-11-07 17:42 UTC (permalink / raw)
  To: ofono

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

---
 TODO |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/TODO b/TODO
index 0d04208..c0dee09 100644
--- a/TODO
+++ b/TODO
@@ -76,6 +76,19 @@ SMS
   Complexity: C4
   Owner: Rajesh Kadhiravan Nagaiah <Rajesh.Nagaiah@elektrobit.com>
 
+- Asynchronously acknowledge SMS DELIVER messages sent by the SMS driver
+  to core using ofono_sms_deliver_notify().  This may require the struct
+  ofono_sms_driver to be extended with one more function pointer like:
+    void (*deliver_ack)(unsigned char *pdu, int len, cb_t cb, void *data)
+  because currently messages are automatically acknowledged by either the
+  modem (this is the case of some AT modems) or the driver right after
+  ofono_sms_deliver_notify() and a failure to deliver at an upper level is
+  ignored.  The PDU can be an RP-ACK or RP-ERROR message with optional
+  TP-User-Content element, for example if returned from USIM Data Download.
+
+  Priority: Low
+  Complexity: C2
+
 SIM / SIM File system
 =====================
 
@@ -339,15 +352,6 @@ Sim Toolkit
   Priority: High
   Complexity: C8
 
-- Support 'SMS-PP' Download Envelope.  Whenever a special type of SMS is
-  received indicating that this is an SMS-PP Download message, this message
-  will be sent to the SIM via an SMS-PP Download Envelope.  No user interaction
-  will be required.  If the modem hardware supports this transparently, then
-  no indication to oFono will be necessary.
-
-  Priority: High
-  Complexity: C2
-
 - Support Language Notification proactive command.
 
   Priority: Medium
-- 
1.7.1.86.g0e460.dirty


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

* Re: [RfC][PATCH 1/3] stk: API for SMS Point-to-Point download to UICC
  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-07 17:42 ` [PATCH 3/3] Update TODO Andrzej Zaborowski
@ 2010-11-08 19:47 ` Denis Kenzior
  2 siblings, 0 replies; 6+ messages in thread
From: Denis Kenzior @ 2010-11-08 19:47 UTC (permalink / raw)
  To: ofono

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

Hi Andrew,

On 11/07/2010 11:42 AM, Andrzej Zaborowski wrote:
> 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(-)
> 
> +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;

Please note that this has a possibility of overwriting the sms_pp_cb and
sms_pp_userdata if multiple SMS-PP sms messages are received (and
acknowledged) in short succession.

However, I assume you already thought of this and will take care of it
with the async ack task.

Patch has been applied, thanks.

Regards,
-Denis

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

* Re: [PATCH 2/3] sms: Handle "USIM Download" SMS type.
  2010-11-07 17:42 ` [PATCH 2/3] sms: Handle "USIM Download" SMS type Andrzej Zaborowski
@ 2010-11-08 19:47   ` Denis Kenzior
  0 siblings, 0 replies; 6+ messages in thread
From: Denis Kenzior @ 2010-11-08 19:47 UTC (permalink / raw)
  To: ofono

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

Hi Andrew,

On 11/07/2010 11:42 AM, Andrzej Zaborowski wrote:
> ---
>  src/sms.c |   21 ++++++++++++++++-----
>  1 files changed, 16 insertions(+), 5 deletions(-)

Patch has been applied, thanks.

Regards,
-Denis

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

* Re: [PATCH 3/3] Update TODO.
  2010-11-07 17:42 ` [PATCH 3/3] Update TODO Andrzej Zaborowski
@ 2010-11-08 19:49   ` Denis Kenzior
  0 siblings, 0 replies; 6+ messages in thread
From: Denis Kenzior @ 2010-11-08 19:49 UTC (permalink / raw)
  To: ofono

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

On 11/07/2010 11:42 AM, Andrzej Zaborowski wrote:
> ---
>  TODO |   22 +++++++++++++---------
>  1 files changed, 13 insertions(+), 9 deletions(-)

Patch has been applied.  I did break this patch up into two, one marking
the task as done and the other adding the new task.

Regards,
-Denis

^ permalink raw reply	[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.