All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Add additional information for mandatory general result
@ 2011-01-06 19:41 Jeevaka Badrappan
  2011-01-06 19:41 ` [PATCH 1/2] stk: add additional info for terminal busy result Jeevaka Badrappan
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jeevaka Badrappan @ 2011-01-06 19:41 UTC (permalink / raw)
  To: ofono

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

Hi,

 As per the ETSI TS 102 223 specification section 8.12.2,

For the general result "terminal currently unable to process command",
it is mandatory for the terminal to provide additional information.
Defined values for additional information can be found in the same
section. Coding '00' shall be used by the terminal if none of the defined
values apply.

 Following set of patches, introduce a macro for adding the additional
information and changes done to existing code to make use of added macro.

Regards,
Jeevaka

Jeevaka Badrappan (2):
  stk: add additional info for terminal busy result
  stk: make use of ADD_ERROR_RESULT macro

 src/stk.c |  114 ++++++++++++++++++++++++++++++++++++-------------------------
 1 files changed, 67 insertions(+), 47 deletions(-)


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

* [PATCH 1/2] stk: add additional info for terminal busy result
  2011-01-06 19:41 [PATCH 0/2] Add additional information for mandatory general result Jeevaka Badrappan
@ 2011-01-06 19:41 ` Jeevaka Badrappan
  2011-01-06 19:41 ` [PATCH 2/2] stk: make use of ADD_ERROR_RESULT macro Jeevaka Badrappan
  2011-01-12 22:06 ` [PATCH 0/2] Add additional information for mandatory general result Denis Kenzior
  2 siblings, 0 replies; 4+ messages in thread
From: Jeevaka Badrappan @ 2011-01-06 19:41 UTC (permalink / raw)
  To: ofono

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

As per the ETSI TS 102 223 specification 8.12.2, it is
mandatory to provide additional information for the
general result "ME currently unable to process command".
---
 src/stk.c |   45 +++++++++++++++++++++++++++++++++++++--------
 1 files changed, 37 insertions(+), 8 deletions(-)

diff --git a/src/stk.c b/src/stk.c
index bec46ea..a00190d 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -99,6 +99,11 @@ struct extern_req {
 static void envelope_queue_run(struct ofono_stk *stk);
 static void timers_update(struct ofono_stk *stk);
 
+#define ADD_ERROR_RESULT(result, error, addn_info)		\
+		result.type = error;				\
+		result.additional_len = sizeof(addn_info);	\
+		result.additional = addn_info;			\
+
 static int stk_respond(struct ofono_stk *stk, struct stk_response *rsp,
 			ofono_stk_generic_cb_t cb)
 {
@@ -857,7 +862,10 @@ static gboolean handle_command_send_sms(const struct stk_command *cmd,
 	msg_list.next = NULL;
 
 	if (__ofono_sms_txq_submit(sms, &msg_list, 0, &uuid, NULL, NULL) < 0) {
-		rsp->result.type = STK_RESULT_TYPE_TERMINAL_BUSY;
+		unsigned char no_cause_result[] = { 0x00 };
+
+		ADD_ERROR_RESULT(rsp->result, STK_RESULT_TYPE_TERMINAL_BUSY,
+					no_cause_result);
 		return TRUE;
 	}
 
@@ -1183,9 +1191,12 @@ static gboolean handle_command_select_item(const struct stk_command *cmd,
 					request_selection_cb, stk,
 					request_selection_destroy,
 					stk->timeout * 1000) < 0) {
+		unsigned char no_cause_result[] = { 0x00 };
+
 		request_selection_destroy(stk);
 
-		rsp->result.type = STK_RESULT_TYPE_TERMINAL_BUSY;
+		ADD_ERROR_RESULT(rsp->result, STK_RESULT_TYPE_TERMINAL_BUSY,
+					no_cause_result);
 		return TRUE;
 	}
 
@@ -1301,7 +1312,10 @@ static gboolean handle_command_display_text(const struct stk_command *cmd,
 
 	/* We most likely got an out of memory error, tell SIM to retry */
 	if (err < 0) {
-		rsp->result.type = STK_RESULT_TYPE_TERMINAL_BUSY;
+		unsigned char no_cause_result[] = { 0x00 };
+
+		ADD_ERROR_RESULT(rsp->result, STK_RESULT_TYPE_TERMINAL_BUSY,
+					no_cause_result);
 		return TRUE;
 	}
 
@@ -1475,11 +1489,14 @@ static gboolean handle_command_get_inkey(const struct stk_command *cmd,
 	g_free(text);
 
 	if (err < 0) {
+		unsigned char no_cause_result[] = { 0x00 };
+
 		/*
 		 * We most likely got an out of memory error, tell SIM
 		 * to retry
 		 */
-		rsp->result.type = STK_RESULT_TYPE_TERMINAL_BUSY;
+		ADD_ERROR_RESULT(rsp->result, STK_RESULT_TYPE_TERMINAL_BUSY,
+					no_cause_result);
 		return TRUE;
 	}
 
@@ -1564,11 +1581,14 @@ static gboolean handle_command_get_input(const struct stk_command *cmd,
 	g_free(text);
 
 	if (err < 0) {
+		unsigned char no_cause_result[] = { 0x00 };
+
 		/*
 		 * We most likely got an out of memory error, tell SIM
 		 * to retry
 		 */
-		rsp->result.type = STK_RESULT_TYPE_TERMINAL_BUSY;
+		ADD_ERROR_RESULT(rsp->result, STK_RESULT_TYPE_TERMINAL_BUSY,
+					no_cause_result);
 		return TRUE;
 	}
 
@@ -1772,11 +1792,14 @@ static gboolean handle_command_set_up_call(const struct stk_command *cmd,
 	g_free(alpha_id);
 
 	if (err < 0) {
+		unsigned char no_cause_result[] = { 0x00 };
+
 		/*
 		 * We most likely got an out of memory error, tell SIM
 		 * to retry
 		 */
-		rsp->result.type = STK_RESULT_TYPE_TERMINAL_BUSY;
+		ADD_ERROR_RESULT(rsp->result, STK_RESULT_TYPE_TERMINAL_BUSY,
+					no_cause_result);
 		return TRUE;
 	}
 
@@ -2193,11 +2216,14 @@ static gboolean handle_command_send_dtmf(const struct stk_command *cmd,
 	}
 
 	if (err < 0) {
+		unsigned char no_cause_result[] = { 0x00 };
+
 		/*
 		 * We most likely got an out of memory error, tell SIM
 		 * to retry
 		 */
-		rsp->result.type = STK_RESULT_TYPE_TERMINAL_BUSY;
+		ADD_ERROR_RESULT(rsp->result, STK_RESULT_TYPE_TERMINAL_BUSY,
+					no_cause_result);
 		return TRUE;
 	}
 
@@ -2329,11 +2355,14 @@ static gboolean handle_command_play_tone(const struct stk_command *cmd,
 	g_free(text);
 
 	if (err < 0) {
+		unsigned char no_cause_result[] = { 0x00 };
+
 		/*
 		 * We most likely got an out of memory error, tell SIM
 		 * to retry
 		 */
-		rsp->result.type = STK_RESULT_TYPE_TERMINAL_BUSY;
+		ADD_ERROR_RESULT(rsp->result, STK_RESULT_TYPE_TERMINAL_BUSY,
+					no_cause_result);
 		return TRUE;
 	}
 
-- 
1.7.0.4


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

* [PATCH 2/2] stk: make use of ADD_ERROR_RESULT macro
  2011-01-06 19:41 [PATCH 0/2] Add additional information for mandatory general result Jeevaka Badrappan
  2011-01-06 19:41 ` [PATCH 1/2] stk: add additional info for terminal busy result Jeevaka Badrappan
@ 2011-01-06 19:41 ` Jeevaka Badrappan
  2011-01-12 22:06 ` [PATCH 0/2] Add additional information for mandatory general result Denis Kenzior
  2 siblings, 0 replies; 4+ messages in thread
From: Jeevaka Badrappan @ 2011-01-06 19:41 UTC (permalink / raw)
  To: ofono

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

---
 src/stk.c |   69 ++++++++++++++++++++++++++----------------------------------
 1 files changed, 30 insertions(+), 39 deletions(-)

diff --git a/src/stk.c b/src/stk.c
index a00190d..b20ea1c 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -1269,9 +1269,8 @@ static void display_text_cb(enum stk_agent_result result, void *user_data)
 
 	case STK_AGENT_RESULT_BUSY:
 		memset(&rsp, 0, sizeof(rsp));
-		rsp.result.type = STK_RESULT_TYPE_TERMINAL_BUSY;
-		rsp.result.additional_len = sizeof(screen_busy_result);
-		rsp.result.additional = screen_busy_result;
+		ADD_ERROR_RESULT(rsp.result, STK_RESULT_TYPE_TERMINAL_BUSY,
+					screen_busy_result);
 		if (stk_respond(stk, &rsp, stk_command_cb))
 			stk_command_cb(&error, stk);
 		break;
@@ -1608,9 +1607,9 @@ static void call_setup_connected(struct ofono_call *call, void *data)
 	if (call == NULL || call->status == CALL_STATUS_DISCONNECTED) {
 		memset(&rsp, 0, sizeof(rsp));
 
-		rsp.result.type = STK_RESULT_TYPE_NETWORK_UNAVAILABLE;
-		rsp.result.additional_len = sizeof(facility_rejected_result);
-		rsp.result.additional = facility_rejected_result;
+		ADD_ERROR_RESULT(rsp.result,
+					STK_RESULT_TYPE_NETWORK_UNAVAILABLE,
+					facility_rejected_result);
 
 		if (stk_respond(stk, &rsp, stk_command_cb))
 			stk_command_cb(&error, stk);
@@ -1709,9 +1708,8 @@ static void confirm_call_cb(enum stk_agent_result result, gboolean confirm,
 	if (err == -EBUSY) {
 		memset(&rsp, 0, sizeof(rsp));
 
-		rsp.result.type = STK_RESULT_TYPE_TERMINAL_BUSY;
-		rsp.result.additional_len = sizeof(busy_on_call_result);
-		rsp.result.additional = busy_on_call_result;
+		ADD_ERROR_RESULT(rsp.result, STK_RESULT_TYPE_TERMINAL_BUSY,
+					busy_on_call_result);
 
 		if (stk_respond(stk, &rsp, stk_command_cb))
 			stk_command_cb(&error, stk);
@@ -1727,9 +1725,8 @@ static void confirm_call_cb(enum stk_agent_result result, gboolean confirm,
 
 	memset(&rsp, 0, sizeof(rsp));
 
-	rsp.result.type = STK_RESULT_TYPE_NETWORK_UNAVAILABLE;
-	rsp.result.additional_len = sizeof(no_cause_result);
-	rsp.result.additional = no_cause_result;
+	ADD_ERROR_RESULT(rsp.result, STK_RESULT_TYPE_NETWORK_UNAVAILABLE,
+				no_cause_result);
 
 	if (stk_respond(stk, &rsp, stk_command_cb))
 		stk_command_cb(&error, stk);
@@ -1772,9 +1769,8 @@ static gboolean handle_command_set_up_call(const struct stk_command *cmd,
 	}
 
 	if (__ofono_voicecall_is_busy(vc, qualifier >> 1)) {
-		rsp->result.type = STK_RESULT_TYPE_TERMINAL_BUSY;
-		rsp->result.additional_len = sizeof(busy_on_call_result);
-		rsp->result.additional = busy_on_call_result;
+		ADD_ERROR_RESULT(rsp->result, STK_RESULT_TYPE_TERMINAL_BUSY,
+					busy_on_call_result);
 		return TRUE;
 	}
 
@@ -1872,9 +1868,8 @@ static void send_ussd_callback(int error, int dcs, const unsigned char *msg,
 		break;
 
 	default:
-		rsp.result.type = STK_RESULT_TYPE_USSD_RETURN_ERROR;
-		rsp.result.additional_len = sizeof(no_cause);
-		rsp.result.additional = no_cause;
+		ADD_ERROR_RESULT(rsp.result, STK_RESULT_TYPE_USSD_RETURN_ERROR,
+					no_cause);
 
 		if (stk_respond(stk, &rsp, stk_command_cb))
 			stk_command_cb(&failure, stk);
@@ -1899,9 +1894,9 @@ static gboolean handle_command_send_ussd(const struct stk_command *cmd,
 		struct ofono_call_forwarding *cf = __ofono_atom_get_data(atom);
 
 		if (__ofono_call_forwarding_is_busy(cf)) {
-			rsp->result.type = STK_RESULT_TYPE_TERMINAL_BUSY;
-			rsp->result.additional_len = sizeof(busy_on_ss_result);
-			rsp->result.additional = busy_on_ss_result;
+			ADD_ERROR_RESULT(rsp->result,
+						STK_RESULT_TYPE_TERMINAL_BUSY,
+						busy_on_ss_result);
 			return TRUE;
 		}
 	}
@@ -1911,9 +1906,9 @@ static gboolean handle_command_send_ussd(const struct stk_command *cmd,
 		struct ofono_call_barring *cb = __ofono_atom_get_data(atom);
 
 		if (__ofono_call_barring_is_busy(cb)) {
-			rsp->result.type = STK_RESULT_TYPE_TERMINAL_BUSY;
-			rsp->result.additional_len = sizeof(busy_on_ss_result);
-			rsp->result.additional = busy_on_ss_result;
+			ADD_ERROR_RESULT(rsp->result,
+						STK_RESULT_TYPE_TERMINAL_BUSY,
+						busy_on_ss_result);
 			return TRUE;
 		}
 	}
@@ -1923,9 +1918,9 @@ static gboolean handle_command_send_ussd(const struct stk_command *cmd,
 		struct ofono_call_settings *cs = __ofono_atom_get_data(atom);
 
 		if (__ofono_call_settings_is_busy(cs)) {
-			rsp->result.type = STK_RESULT_TYPE_TERMINAL_BUSY;
-			rsp->result.additional_len = sizeof(busy_on_ss_result);
-			rsp->result.additional = busy_on_ss_result;
+			ADD_ERROR_RESULT(rsp->result,
+						STK_RESULT_TYPE_TERMINAL_BUSY,
+						busy_on_ss_result);
 			return TRUE;
 		}
 	}
@@ -1938,9 +1933,8 @@ static gboolean handle_command_send_ussd(const struct stk_command *cmd,
 
 	ussd = __ofono_atom_get_data(atom);
 	if (__ofono_ussd_is_busy(ussd)) {
-		rsp->result.type = STK_RESULT_TYPE_TERMINAL_BUSY;
-		rsp->result.additional_len = sizeof(busy_on_ussd_result);
-		rsp->result.additional = busy_on_ussd_result;
+		ADD_ERROR_RESULT(rsp->result, STK_RESULT_TYPE_TERMINAL_BUSY,
+					busy_on_ussd_result);
 		return TRUE;
 	}
 
@@ -1961,9 +1955,8 @@ static gboolean handle_command_send_ussd(const struct stk_command *cmd,
 	}
 
 	if (err == -EBUSY) {
-		rsp->result.type = STK_RESULT_TYPE_TERMINAL_BUSY;
-		rsp->result.additional_len = sizeof(busy_on_ussd_result);
-		rsp->result.additional = busy_on_ussd_result;
+		ADD_ERROR_RESULT(rsp->result, STK_RESULT_TYPE_TERMINAL_BUSY,
+					busy_on_ussd_result);
 		return TRUE;
 	}
 
@@ -2140,9 +2133,8 @@ static void dtmf_sent_cb(int error, void *user_data)
 
 		memset(&rsp, 0, sizeof(rsp));
 
-		rsp.result.type = STK_RESULT_TYPE_TERMINAL_BUSY;
-		rsp.result.additional_len = sizeof(not_in_speech_call_result);
-		rsp.result.additional = not_in_speech_call_result;
+		ADD_ERROR_RESULT(rsp.result, STK_RESULT_TYPE_TERMINAL_BUSY,
+					not_in_speech_call_result);
 
 		if (stk_respond(stk, &rsp, stk_command_cb))
 			stk_command_cb(&failure, stk);
@@ -2204,9 +2196,8 @@ static gboolean handle_command_send_dtmf(const struct stk_command *cmd,
 	}
 
 	if (err == -ENOENT) {
-		rsp->result.type = STK_RESULT_TYPE_TERMINAL_BUSY;
-		rsp->result.additional_len = sizeof(not_in_speech_call_result);
-		rsp->result.additional = not_in_speech_call_result;
+		ADD_ERROR_RESULT(rsp->result, STK_RESULT_TYPE_TERMINAL_BUSY,
+					not_in_speech_call_result);
 		return TRUE;
 	}
 
-- 
1.7.0.4


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

* Re: [PATCH 0/2] Add additional information for mandatory general result
  2011-01-06 19:41 [PATCH 0/2] Add additional information for mandatory general result Jeevaka Badrappan
  2011-01-06 19:41 ` [PATCH 1/2] stk: add additional info for terminal busy result Jeevaka Badrappan
  2011-01-06 19:41 ` [PATCH 2/2] stk: make use of ADD_ERROR_RESULT macro Jeevaka Badrappan
@ 2011-01-12 22:06 ` Denis Kenzior
  2 siblings, 0 replies; 4+ messages in thread
From: Denis Kenzior @ 2011-01-12 22:06 UTC (permalink / raw)
  To: ofono

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

Hi Jeevaka,

On 01/06/2011 01:41 PM, Jeevaka Badrappan wrote:
> Hi,
> 
>  As per the ETSI TS 102 223 specification section 8.12.2,
> 
> For the general result "terminal currently unable to process command",
> it is mandatory for the terminal to provide additional information.
> Defined values for additional information can be found in the same
> section. Coding '00' shall be used by the terminal if none of the defined
> values apply.
> 
>  Following set of patches, introduce a macro for adding the additional
> information and changes done to existing code to make use of added macro.
> 

Both patches have been applied, thanks.

Regards,
-Denis

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

end of thread, other threads:[~2011-01-12 22:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-06 19:41 [PATCH 0/2] Add additional information for mandatory general result Jeevaka Badrappan
2011-01-06 19:41 ` [PATCH 1/2] stk: add additional info for terminal busy result Jeevaka Badrappan
2011-01-06 19:41 ` [PATCH 2/2] stk: make use of ADD_ERROR_RESULT macro Jeevaka Badrappan
2011-01-12 22:06 ` [PATCH 0/2] Add additional information for mandatory general result 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.