Skip to contentSkip to conversation

ussd: Recover idle state after a transaction error

PATCH In review Philippe Nunes 2 participants 6 messages Sep 5, 2012

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/4 ussd: Recover idle state after a transaction error

The "USSD terminated by network" notification is handled to recover the idle state in case of USSD transaction error.

---
 src/ussd.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)
src/ussd.c +12 -0
index 74888b2..a35f172 100644
@@ -414,6 +414,18 @@ void ofono_ussd_notify(struct ofono_ussd *ussd, int status, int dcs,
 		return;
 	}
 
+	if (status == OFONO_USSD_STATUS_TERMINATED &&
+			(ussd->state == USSD_STATE_IDLE ||
+			ussd->state == USSD_STATE_USER_ACTION)) {
+		ussd_change_state(ussd, USSD_STATE_IDLE);
+
+		if (ussd->pending == NULL)
+			return;
+
+		reply = __ofono_error_failed(ussd->pending);
+		goto out;
+	}
+
 	if (status == OFONO_USSD_STATUS_NOT_SUPPORTED) {
 		ussd_change_state(ussd, USSD_STATE_IDLE);
 
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v3 2/4 call-forwarding: SS query is done according the class given by SS code

GCF test cases 31.2.1.6.1/2 are asking to make a query according a specific class.
The default class is applied in the query form when no class is specified in the SS code.

---
 src/call-forwarding.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
src/call-forwarding.c +9 -1
index 91e34c6..2746771 100644
@@ -1012,7 +1012,15 @@ static void ss_set_query_cf_callback(const struct ofono_error *error, int total,
 
 static void ss_set_query_next_cf_cond(struct ofono_call_forwarding *cf)
 {
-	cf->driver->query(cf, cf->query_next, BEARER_CLASS_DEFAULT,
+	int cls;
+
+	cls = (cf->ss_req->ss_type == SS_CONTROL_TYPE_QUERY) ?
+			cf->ss_req->cls : BEARER_CLASS_DEFAULT;
+
+	if (cls == BEARER_CLASS_SS_DEFAULT)
+			cls = BEARER_CLASS_DEFAULT;
+
+	cf->driver->query(cf, cf->query_next, cls,
 			ss_set_query_cf_callback, cf);
 }
 
Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH v3 2/4] call-forwarding: SS query is done according the class given by SS code

Hi Philippe,

Quoted 8 lines · Philippe Nunes

GCF test cases 31.2.1.6.1/2 are asking to make a query according a specific class.
The default class is applied in the query form when no class is specified in the SS code.

---
  src/call-forwarding.c |   10 +++++++++-
  1 file changed, 9 insertions(+), 1 deletion(-)

Patches 2-4 have been applied, thanks.

Regards,
-Denis

#3 lore raw

PATCH v3 3/4 call-barring: SS query is done according the class given by SS code

In reply to Philippe Nunes

The default class is applied in the query form when no class is specified in the SS code.

---
 src/call-barring.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
src/call-barring.c +2 -1
index 68533c2..845cbc3 100644
@@ -310,7 +310,8 @@ static void cb_ss_query_next_lock(struct ofono_call_barring *cb)
 {
 	int cls;
 
-	cls = cb->ss_req_cls | BEARER_CLASS_DEFAULT;
+	cls = (cb->ss_req_type == SS_CONTROL_TYPE_QUERY) ?
+			cb->ss_req_cls : cb->ss_req_cls | BEARER_CLASS_DEFAULT;
 
 	cb->driver->query(cb, cb_locks[cb->query_next].fac, cls,
 			cb_ss_query_next_lock_callback, cb);
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH v3 4/4 atmodem: specify class for call barring query

In reply to Philippe Nunes

class is specified when querying the call barring status if the class is not the default (7 - voice, data and fax)

---
 drivers/atmodem/call-barring.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/atmodem/call-barring.c +4 -1
index 2efd4e9..a2417c7 100644
@@ -89,7 +89,10 @@ static void at_call_barring_query(struct ofono_call_barring *cb,
 	if (strlen(lock) != 2)
 		goto error;
 
-	snprintf(buf, sizeof(buf), "AT+CLCK=\"%s\",2", lock);
+	if (cls == 7)
+		snprintf(buf, sizeof(buf), "AT+CLCK=\"%s\",2", lock);
+	else
+		snprintf(buf, sizeof(buf), "AT+CLCK=\"%s\",2,,%d", lock, cls);
 
 	if (g_at_chat_send(chat, buf, clck_prefix,
 				clck_query_cb, cbd, g_free) > 0)
Signature · 1 line
1.7.9.5
#5 lore raw
In reply to Philippe Nunes

Hi Philippe,

Quoted 11 lines · Philippe Nunes

The "USSD terminated by network" notification is handled to recover the idle state in case of USSD transaction error.

---
  src/ussd.c |   12 ++++++++++++
  1 file changed, 12 insertions(+)
src/ussd.c +0 -0
index 74888b2..a35f172 100644

src/ussd.c void ofono_ussd_notify(struct ofono_ussd *ussd, int status, int dcs, · line 418

Quoted 5 lines
src/ussd.c +2 -0
@@ -414,6 +414,18 @@ void ofono_ussd_notify(struct ofono_ussd *ussd, int status, int dcs,
  		return;
  	}
 
+	if (status == OFONO_USSD_STATUS_TERMINATED&&
+			(ussd->state == USSD_STATE_IDLE ||

Why do you need this guard?

src/ussd.c void ofono_ussd_notify(struct ofono_ussd *ussd, int status, int dcs, · line 419

Quoted 1 line
src/ussd.c +1 -0
+			ussd->state == USSD_STATE_USER_ACTION)) {

Or this one for that matter. In theory the terminated notification can come at any time.

src/ussd.c void ofono_ussd_notify(struct ofono_ussd *ussd, int status, int dcs, · line 431

Quoted 12 lines
src/ussd.c +9 -0
+		ussd_change_state(ussd, USSD_STATE_IDLE);
+
+		if (ussd->pending == NULL)
+			return;
+
+		reply = __ofono_error_failed(ussd->pending);
+		goto out;
+	}
+
  	if (status == OFONO_USSD_STATUS_NOT_SUPPORTED) {
  		ussd_change_state(ussd, USSD_STATE_IDLE);
 

Can't we treat it exactly like 'NOT_SUPPORTED' or 'TIMED_OUT' but with a different error?

Regards,
-Denis