All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] stk: Check if terminal is busy before SIM Refresh.
@ 2011-03-31 13:40 Andrzej Zaborowski
  2011-03-31 13:40 ` [PATCH 2/2] doc: Mark SIM Refresh support as present Andrzej Zaborowski
  2011-04-05  5:26 ` [PATCH 1/2] stk: Check if terminal is busy before SIM Refresh Denis Kenzior
  0 siblings, 2 replies; 4+ messages in thread
From: Andrzej Zaborowski @ 2011-03-31 13:40 UTC (permalink / raw)
  To: ofono

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

---
 src/stk.c |   94 ++++++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 71 insertions(+), 23 deletions(-)

diff --git a/src/stk.c b/src/stk.c
index 780e0c2..01e14db 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -1924,51 +1924,52 @@ static void send_ussd_callback(int error, int dcs, const unsigned char *msg,
 	}
 }
 
-static gboolean handle_command_send_ussd(const struct stk_command *cmd,
-					struct stk_response *rsp,
-					struct ofono_stk *stk)
+static gboolean ss_is_busy(struct ofono_modem *modem)
 {
-	struct ofono_modem *modem = __ofono_atom_get_modem(stk->atom);
-	static unsigned char busy_on_ss_result[] = { 0x03 };
-	static unsigned char busy_on_ussd_result[] = { 0x08 };
 	struct ofono_atom *atom;
-	struct ofono_ussd *ussd;
-	int err;
 
 	atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_CALL_FORWARDING);
 	if (atom && __ofono_atom_get_registered(atom)) {
 		struct ofono_call_forwarding *cf = __ofono_atom_get_data(atom);
 
-		if (__ofono_call_forwarding_is_busy(cf)) {
-			ADD_ERROR_RESULT(rsp->result,
-						STK_RESULT_TYPE_TERMINAL_BUSY,
-						busy_on_ss_result);
+		if (__ofono_call_forwarding_is_busy(cf))
 			return TRUE;
-		}
 	}
 
 	atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_CALL_BARRING);
 	if (atom && __ofono_atom_get_registered(atom)) {
 		struct ofono_call_barring *cb = __ofono_atom_get_data(atom);
 
-		if (__ofono_call_barring_is_busy(cb)) {
-			ADD_ERROR_RESULT(rsp->result,
-						STK_RESULT_TYPE_TERMINAL_BUSY,
-						busy_on_ss_result);
+		if (__ofono_call_barring_is_busy(cb))
 			return TRUE;
-		}
 	}
 
 	atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_CALL_SETTINGS);
 	if (atom && __ofono_atom_get_registered(atom)) {
 		struct ofono_call_settings *cs = __ofono_atom_get_data(atom);
 
-		if (__ofono_call_settings_is_busy(cs)) {
-			ADD_ERROR_RESULT(rsp->result,
-						STK_RESULT_TYPE_TERMINAL_BUSY,
-						busy_on_ss_result);
+		if (__ofono_call_settings_is_busy(cs))
 			return TRUE;
-		}
+	}
+
+	return FALSE;
+}
+
+static gboolean handle_command_send_ussd(const struct stk_command *cmd,
+					struct stk_response *rsp,
+					struct ofono_stk *stk)
+{
+	struct ofono_modem *modem = __ofono_atom_get_modem(stk->atom);
+	static unsigned char busy_on_ss_result[] = { 0x03 };
+	static unsigned char busy_on_ussd_result[] = { 0x08 };
+	struct ofono_atom *atom;
+	struct ofono_ussd *ussd;
+	int err;
+
+	if (ss_is_busy(modem)) {
+		ADD_ERROR_RESULT(rsp->result, STK_RESULT_TYPE_TERMINAL_BUSY,
+					busy_on_ss_result);
+		return TRUE;
 	}
 
 	atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_USSD);
@@ -2029,6 +2030,11 @@ static gboolean handle_command_refresh(const struct stk_command *cmd,
 	struct ofono_error failure = { .type = OFONO_ERROR_TYPE_FAILURE };
 	struct ofono_sim *sim = NULL;
 	struct ofono_atom *sim_atom;
+	struct ofono_ussd *ussd = NULL;
+	struct ofono_atom *ussd_atom;
+	struct ofono_voicecall *vc = NULL;
+	struct ofono_atom *vc_atom;
+	uint8_t addnl_info[1];
 	int err;
 	GSList *l;
 
@@ -2098,6 +2104,48 @@ static gboolean handle_command_refresh(const struct stk_command *cmd,
 		return TRUE;
 	}
 
+	if (rsp != NULL) {
+		ussd_atom = __ofono_modem_find_atom(
+					__ofono_atom_get_modem(stk->atom),
+					OFONO_ATOM_TYPE_USSD);
+		if (ussd_atom)
+			ussd = __ofono_atom_get_data(ussd_atom);
+
+		if (ussd && __ofono_ussd_is_busy(ussd)) {
+			addnl_info[0] = STK_RESULT_ADDNL_ME_PB_USSD_BUSY;
+
+			ADD_ERROR_RESULT(rsp->result,
+					STK_RESULT_TYPE_TERMINAL_BUSY,
+					addnl_info);
+			return TRUE;
+		}
+
+		vc_atom = __ofono_modem_find_atom(
+					__ofono_atom_get_modem(stk->atom),
+					OFONO_ATOM_TYPE_VOICECALL);
+		if (vc_atom)
+			vc = __ofono_atom_get_data(vc_atom);
+
+		if (vc && __ofono_voicecall_is_busy(vc,
+					OFONO_VOICECALL_INTERACTION_NONE)) {
+			addnl_info[0] = STK_RESULT_ADDNL_ME_PB_BUSY_ON_CALL;
+
+			ADD_ERROR_RESULT(rsp->result,
+					STK_RESULT_TYPE_TERMINAL_BUSY,
+					addnl_info);
+			return TRUE;
+		}
+
+		if (ss_is_busy(__ofono_atom_get_modem(stk->atom))) {
+			addnl_info[0] = STK_RESULT_ADDNL_ME_PB_SS_BUSY;
+
+			ADD_ERROR_RESULT(rsp->result,
+					STK_RESULT_TYPE_TERMINAL_BUSY,
+					addnl_info);
+			return TRUE;
+		}
+	}
+
 	/*
 	 * For now we can handle the Refresh types that don't require
 	 * a SIM reset except if that part of the task has been already
-- 
1.7.1.86.g0e460.dirty


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

* [PATCH 2/2] doc: Mark SIM Refresh support as present.
  2011-03-31 13:40 [PATCH 1/2] stk: Check if terminal is busy before SIM Refresh Andrzej Zaborowski
@ 2011-03-31 13:40 ` Andrzej Zaborowski
  2011-04-05  5:26   ` Denis Kenzior
  2011-04-05  5:26 ` [PATCH 1/2] stk: Check if terminal is busy before SIM Refresh Denis Kenzior
  1 sibling, 1 reply; 4+ messages in thread
From: Andrzej Zaborowski @ 2011-03-31 13:40 UTC (permalink / raw)
  To: ofono

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

---
 TODO             |   35 -----------------------------------
 doc/features.txt |   34 ++++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 35 deletions(-)

diff --git a/TODO b/TODO
index e18c5e6..207adf7 100644
--- a/TODO
+++ b/TODO
@@ -261,41 +261,6 @@ Voicecall
 Sim Toolkit
 ===========
 
-- Support Refresh proactive command.  The specification defines 7 types
-  of Refresh types:
-	- NAA Initialization
-	- NAA File Change Notification
-	- NAA Initialization and File Change Notification
-	- NAA Initialization and Full File Change Notification
-	- UICC Reset
-	- NAA Application Reset (2G only)
-	- NAA Session Reset (3G only)
-
-  The 'NAA Initialization' type will be ignored by oFono, it is assumed
-  this is handled by the modem.
-
-  For 'UICC Reset', 'NAA Application Reset' and 'NAA Session Reset' oFono
-  will first check whether there are any calls or ussd operations active.
-  If there are, the appropriate response will be sent (e.g. busy on call
-  or screen busy terminal response.)  Otherwise a positive response will be
-  sent to the driver.  In the case of a 'UICC Reset' the driver / modem
-  can interpret this that it is safe to reset the UICC.
-
-  Alternatively, the driver / modem can notify the core of the SIM removal
-  / SIM insertion events without using the Refresh proactive command.  It
-  is up to the driver / modem to perform a warm reset.  In particular, 3GPP
-  31.111 mandates that any change to EFimsi is done by using 'UICC Reset',
-  'NAA Application Reset' or 'NAA Session Reset'.  Please see 3GPP 31.111
-  Section 6.4.7.1.
-
-  Other types will be handled by oFono flushing the EF cache of the files
-  affected (or the entire SIM cache in case of Full File Change Notifications)
-  and re-reading the affected files.  Any properties derived from these
-  Elementary Files will be updated and signaled using PropertyChanged.
-
-  Priority: High
-  Complexity: C8
-
 - Support of the BIP (Bearer Independent Protocol) proactive commands.
   The specification defines several bearer types. For now, only the packet data
   service bearer is considered.
diff --git a/doc/features.txt b/doc/features.txt
index b905ae7..98a9fed 100644
--- a/doc/features.txt
+++ b/doc/features.txt
@@ -126,6 +126,40 @@ Supported Proactive Commands:
 
   NOTE: This command can also be handled by the modem.
 
+- Refresh proactive command.  The specification defines 7 types
+  of Refresh requests:
+	- NAA Initialization
+	- NAA File Change Notification
+	- NAA Initialization and File Change Notification
+	- NAA Initialization and Full File Change Notification
+	- UICC Reset
+	- NAA Application Reset (2G only)
+	- NAA Session Reset (3G only)
+
+  oFono can fully perform the the first four types of Refresh.  The
+  remaining three must be handled by the modem or its driver with a
+  notification sent to ofono.  Regardless of whether the command is
+  handled by the modem or not, oFono will check whether there are any
+  calls or ussd operations active.  If there are, the appropriate
+  response will be sent (e.g. busy on call or screen busy terminal
+  response.)  Otherwise a positive response will be sent to the driver.
+  In the case of a 'UICC Reset' the driver / modem can interpret this
+  that it is safe to reset the UICC.
+
+  Alternatively, the driver / modem can notify the core of the SIM removal
+  / SIM insertion events without using the Refresh proactive command.  It
+  is up to the driver / modem to perform a warm reset.  In particular, 3GPP
+  31.111 mandates that any change to EFimsi is done by using 'UICC Reset',
+  'NAA Application Reset' or 'NAA Session Reset'.  Please see 3GPP 31.111
+  Section 6.4.7.1.
+
+  Other types are handled by oFono flushing the EF cache of the files
+  affected (or the entire SIM cache in case of Full File Change Notifications)
+  and re-reading the affected files.  Any properties derived from these
+  Elementary Files will be updated and signaled using PropertyChanged.
+
+  NOTE: This command can also be handled by the modem.
+
 - Sim icon support.  oFono supports icons that are stored on the SIM.  If the
   SIM notifies oFono that an icon is available for a particular proactive
   command, oFono passes this information to the UI.  The UI is able to obtain
-- 
1.7.1.86.g0e460.dirty


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

* Re: [PATCH 1/2] stk: Check if terminal is busy before SIM Refresh.
  2011-03-31 13:40 [PATCH 1/2] stk: Check if terminal is busy before SIM Refresh Andrzej Zaborowski
  2011-03-31 13:40 ` [PATCH 2/2] doc: Mark SIM Refresh support as present Andrzej Zaborowski
@ 2011-04-05  5:26 ` Denis Kenzior
  1 sibling, 0 replies; 4+ messages in thread
From: Denis Kenzior @ 2011-04-05  5:26 UTC (permalink / raw)
  To: ofono

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

Hi Andrew,

On 03/31/2011 08:40 AM, Andrzej Zaborowski wrote:
> ---
>  src/stk.c |   94 ++++++++++++++++++++++++++++++++++++++++++++++---------------
>  1 files changed, 71 insertions(+), 23 deletions(-)
> 

Patch has been applied, thanks.

Regards,
-Denis

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

* Re: [PATCH 2/2] doc: Mark SIM Refresh support as present.
  2011-03-31 13:40 ` [PATCH 2/2] doc: Mark SIM Refresh support as present Andrzej Zaborowski
@ 2011-04-05  5:26   ` Denis Kenzior
  0 siblings, 0 replies; 4+ messages in thread
From: Denis Kenzior @ 2011-04-05  5:26 UTC (permalink / raw)
  To: ofono

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

Hi Andrew,

On 03/31/2011 08:40 AM, Andrzej Zaborowski wrote:
> ---
>  TODO             |   35 -----------------------------------
>  doc/features.txt |   34 ++++++++++++++++++++++++++++++++++
>  2 files changed, 34 insertions(+), 35 deletions(-)
> 

Patch has been applied, thanks.

Regards,
-Denis

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

end of thread, other threads:[~2011-04-05  5:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-31 13:40 [PATCH 1/2] stk: Check if terminal is busy before SIM Refresh Andrzej Zaborowski
2011-03-31 13:40 ` [PATCH 2/2] doc: Mark SIM Refresh support as present Andrzej Zaborowski
2011-04-05  5:26   ` Denis Kenzior
2011-04-05  5:26 ` [PATCH 1/2] stk: Check if terminal is busy before SIM Refresh 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.