Skip to contentSkip to conversation

voicecall: Improve transitions check

PATCH In review Frédéric Danis 2 participants 7 messages Mar 9, 2012 – Mar 14, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 voicecall: Improve transitions check

Indicators should not be updated if:
- multiple separate calls are active at same time
- a conf call and a call are active at same time
- multiple separate calls are held at same time
- a conf call and a call are held at same time
- a conf call has call in active and held state

---
 src/voicecall.c |   29 +++++++++++++++++------------
 1 files changed, 17 insertions(+), 12 deletions(-)
src/voicecall.c +17 -12
index c128227..dc4fdf5 100644
@@ -779,6 +779,8 @@ static void notify_emulator_call_status(struct ofono_voicecall *vc)
 	unsigned int non_mpty = 0;
 	gboolean multiparty = FALSE;
 	gboolean held = FALSE;
+	unsigned int non_mpty_held = 0;
+	gboolean multiparty_held = FALSE;
 	gboolean incoming = FALSE;
 	gboolean dialing = FALSE;
 	gboolean alerting = FALSE;
@@ -805,6 +807,12 @@ static void notify_emulator_call_status(struct ofono_voicecall *vc)
 
 		case CALL_STATUS_HELD:
 			held = TRUE;
+			if (g_slist_find_custom(vc->multiparty_list,
+						GINT_TO_POINTER(v->call->id),
+						call_compare_by_id))
+				multiparty_held = TRUE;
+			else
+				non_mpty_held++;
 			break;
 
 		case CALL_STATUS_DIALING:
@@ -838,6 +846,15 @@ static void notify_emulator_call_status(struct ofono_voicecall *vc)
 	if (waiting && (held == FALSE && call == FALSE))
 		return;
 
+	if (non_mpty > 1 || (non_mpty && multiparty))
+		return;
+
+	if (non_mpty_held > 1 || (non_mpty_held && multiparty_held))
+		return;
+
+	if (multiparty && multiparty_held)
+		return;
+
 	data.status = call || held ? OFONO_EMULATOR_CALL_ACTIVE :
 					OFONO_EMULATOR_CALL_INACTIVE;
 
@@ -864,18 +881,6 @@ static void notify_emulator_call_status(struct ofono_voicecall *vc)
 	if (held)
 		data.status = call ? OFONO_EMULATOR_CALLHELD_MULTIPLE :
 					OFONO_EMULATOR_CALLHELD_ON_HOLD;
-	else if (non_mpty > 1 || (non_mpty && multiparty))
-		/*
-		 * After call swap, it is possible that all calls move
-		 * temporarily to active state (depending on call state update
-		 * order), generating an update of callheld indicator to 0.
-		 * This will fail PTS test TP/TWC/BV-03-I.
-		 *
-		 * So, in case of multiple active calls, or an active call with
-		 * an active mutiparty call, force update of callheld indicator
-		 * to 2 (intermediate state allowed).
-		 */
-		data.status = OFONO_EMULATOR_CALLHELD_ON_HOLD;
 	else
 		data.status = OFONO_EMULATOR_CALLHELD_NONE;
 
Signature · 1 line
1.7.1
#1 lore raw

PATCH 2/4 emulator: Add API to force indicator event

For AT+CHLD=2, +CIEV unsollicited event for callheld should be sent even if it does not change

---
 include/emulator.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
include/emulator.h +3 -0
index 5cd894b..e6bfcbd 100644
@@ -105,6 +105,9 @@ enum ofono_emulator_request_type ofono_emulator_request_get_type(
 void ofono_emulator_set_indicator(struct ofono_emulator *em,
 					const char *name, int value);
 
+void ofono_emulator_indicator_set_forced(struct ofono_emulator *em,
+					const char *name);
+
 #ifdef __cplusplus
 }
 #endif
Signature · 1 line
1.7.1
#2 lore raw

Re: [PATCH 2/4] emulator: Add API to force indicator event

Hi Frédéric,

Quoted 11 lines · Frédéric Danis

For AT+CHLD=2, +CIEV unsollicited event for callheld should be sent even if it does not change

---
 include/emulator.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
include/emulator.h +0 -0
index 5cd894b..e6bfcbd 100644

include/emulator.h enum ofono_emulator_request_type ofono_emulator_request_get_type( · line 110

Quoted 6 lines
include/emulator.h +3 -0
@@ -105,6 +105,9 @@ enum ofono_emulator_request_type ofono_emulator_request_get_type(
 void ofono_emulator_set_indicator(struct ofono_emulator *em,
 					const char *name, int value);
 
+void ofono_emulator_indicator_set_forced(struct ofono_emulator *em,
+					const char *name);
+

Please name this ofono_emulator_set_indicator_forced for consistency.

include/emulator.h enum ofono_emulator_request_type ofono_emulator_request_get_type( · line 113

Quoted 3 lines
include/emulator.h +0 -0
 #ifdef __cplusplus
 }
 #endif

Regards,
-Denis

#3 lore raw

PATCH 3/4 emulator: Force indicator event implementation

In reply to Frédéric Danis
---
 src/emulator.c |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)
src/emulator.c +16 -2
index 0f1ceca..34329f0 100644
@@ -62,6 +62,7 @@ struct indicator {
 	gboolean deferred;
 	gboolean active;
 	gboolean mandatory;
+	gboolean forced;
 };
 
 static void emulator_debug(const char *str, void *data)
@@ -1181,11 +1182,12 @@ void ofono_emulator_set_indicator(struct ofono_emulator *em,
 
 	ind = find_indicator(em, name, &i);
 
-	if (ind == NULL || ind->value == value || value < ind->min
-			|| value > ind->max)
+	if (ind == NULL || (ind->value == value && !ind->forced)
+			|| value < ind->min || value > ind->max)
 		return;
 
 	ind->value = value;
+	ind->forced = FALSE;
 
 	call_ind = find_indicator(em, OFONO_EMULATOR_IND_CALL, NULL);
 	cs_ind = find_indicator(em, OFONO_EMULATOR_IND_CALLSETUP, NULL);
@@ -1245,3 +1247,15 @@ start_ring:
 	em->callsetup_source = g_timeout_add_seconds(RING_TIMEOUT,
 							notify_ring, em);
 }
+
+void ofono_emulator_indicator_set_forced(struct ofono_emulator *em,
+					const char *name)
+{
+	struct indicator *ind;
+
+	ind = find_indicator(em, name, NULL);
+	if (ind == NULL)
+		return;
+
+	ind->forced = TRUE;
+}
Signature · 1 line
1.7.1
#4 lore raw

Re: [PATCH 3/4] emulator: Force indicator event implementation

Hi Frédéric,

Quoted 32 lines · Frédéric Danis
---
 src/emulator.c |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)
src/emulator.c +4 -2
index 0f1ceca..34329f0 100644
@@ -62,6 +62,7 @@ struct indicator {
 	gboolean deferred;
 	gboolean active;
 	gboolean mandatory;
+	gboolean forced;
 };
 
 static void emulator_debug(const char *str, void *data)
@@ -1181,11 +1182,12 @@ void ofono_emulator_set_indicator(struct ofono_emulator *em,
 
 	ind = find_indicator(em, name, &i);
 
-	if (ind == NULL || ind->value == value || value < ind->min
-			|| value > ind->max)
+	if (ind == NULL || (ind->value == value && !ind->forced)
+			|| value < ind->min || value > ind->max)
 		return;
 
 	ind->value = value;
+	ind->forced = FALSE;
 
 	call_ind = find_indicator(em, OFONO_EMULATOR_IND_CALL, NULL);
 	cs_ind = find_indicator(em, OFONO_EMULATOR_IND_CALLSETUP, NULL);

src/emulator.c start_ring: · line 1252

Quoted 6 lines
src/emulator.c +3 -0
@@ -1245,3 +1247,15 @@ start_ring:
 	em->callsetup_source = g_timeout_add_seconds(RING_TIMEOUT,
 							notify_ring, em);
 }
+
+void ofono_emulator_indicator_set_forced(struct ofono_emulator *em,
+					const char *name)

Why not just take the same arguments as ofono_emulator_set_indicator and...

src/emulator.c start_ring: · line 1261

Quoted 9 lines
src/emulator.c +9 -0
+{
+	struct indicator *ind;
+
+	ind = find_indicator(em, name, NULL);
+	if (ind == NULL)
+		return;
+
+	ind->forced = TRUE;
+}

just simply update the value and emit the CIEV. We only use it in a very specific circumstance anyway.

Regards,
-Denis

#5 lore raw

PATCH 4/4 voicecall: Force callheld update after calls swap

In reply to Frédéric Danis

In HFP spec, a callheld indicator update should be sent after swapping calls, even if callheld value has not changed.

---
 src/voicecall.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
src/voicecall.c +17 -0
index dc4fdf5..c3fbc7b 100644
@@ -746,6 +746,16 @@ static void voicecall_emit_multiparty(struct voicecall *call, gboolean mpty)
 						&val);
 }
 
+static void emulator_indicator_set_forced(struct ofono_voicecall *vc,
+							const char *name)
+{
+	struct ofono_modem *modem = __ofono_atom_get_modem(vc->atom);
+	struct ofono_emulator *em;
+
+	em = __ofono_atom_find(OFONO_ATOM_TYPE_EMULATOR_HFP, modem);
+	ofono_emulator_indicator_set_forced(em, name);
+}
+
 static void emulator_call_status_cb(struct ofono_atom *atom, void *data)
 {
 	struct ofono_emulator *em = __ofono_atom_get_data(atom);
@@ -1621,6 +1631,8 @@ static DBusMessage *manager_swap_without_accept(DBusConnection *conn,
 
 	vc->pending = dbus_message_ref(msg);
 
+	emulator_indicator_set_forced(vc, OFONO_EMULATOR_IND_CALLHELD);
+
 	vc->driver->swap_without_accept(vc, generic_callback, vc);
 
 	return NULL;
@@ -1646,6 +1658,8 @@ static DBusMessage *manager_swap_calls(DBusConnection *conn,
 
 	vc->pending = dbus_message_ref(msg);
 
+	emulator_indicator_set_forced(vc, OFONO_EMULATOR_IND_CALLHELD);
+
 	vc->driver->hold_all_active(vc, generic_callback, vc);
 
 	return NULL;
@@ -3080,6 +3094,9 @@ static void emulator_chld_cb(struct ofono_emulator *em,
 			if (vc->driver->hold_all_active == NULL)
 				goto fail;
 
+			ofono_emulator_indicator_set_forced(em,
+						OFONO_EMULATOR_IND_CALLHELD);
+
 			vc->pending_em = em;
 			vc->driver->hold_all_active(vc,
 					emulator_generic_cb, vc);
Signature · 1 line
1.7.1
#6 lore raw
In reply to Frédéric Danis

Hi Frédéric,

Quoted 10 lines · Frédéric Danis

Indicators should not be updated if:
- multiple separate calls are active at same time
- a conf call and a call are active at same time
- multiple separate calls are held at same time
- a conf call and a call are held at same time
- a conf call has call in active and held state

---
 src/voicecall.c |   29 +++++++++++++++++------------
 1 files changed, 17 insertions(+), 12 deletions(-)

Patch has been applied, thanks.

Regards,
-Denis