Open Source Telephony
 help / color / mirror / Atom feed
* [PATCH 1/4] voicecall: Improve transitions check
@ 2012-03-09 15:26 =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
  2012-03-09 15:26 ` [PATCH 2/4] emulator: Add API to force indicator event =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis @ 2012-03-09 15:26 UTC (permalink / raw)
  To: ofono

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

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(-)

diff --git a/src/voicecall.c b/src/voicecall.c
index c128227..dc4fdf5 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -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;
 
-- 
1.7.1


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

* [PATCH 2/4] emulator: Add API to force indicator event
  2012-03-09 15:26 [PATCH 1/4] voicecall: Improve transitions check =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
@ 2012-03-09 15:26 ` =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
  2012-03-14  2:45   ` Denis Kenzior
  2012-03-09 15:26 ` [PATCH 3/4] emulator: Force indicator event implementation =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis @ 2012-03-09 15:26 UTC (permalink / raw)
  To: ofono

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

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(-)

diff --git a/include/emulator.h b/include/emulator.h
index 5cd894b..e6bfcbd 100644
--- a/include/emulator.h
+++ b/include/emulator.h
@@ -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
-- 
1.7.1


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

* [PATCH 3/4] emulator: Force indicator event implementation
  2012-03-09 15:26 [PATCH 1/4] voicecall: Improve transitions check =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
  2012-03-09 15:26 ` [PATCH 2/4] emulator: Add API to force indicator event =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
@ 2012-03-09 15:26 ` =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
  2012-03-14  2:47   ` Denis Kenzior
  2012-03-09 15:26 ` [PATCH 4/4] voicecall: Force callheld update after calls swap =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
  2012-03-14  2:44 ` [PATCH 1/4] voicecall: Improve transitions check Denis Kenzior
  3 siblings, 1 reply; 7+ messages in thread
From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis @ 2012-03-09 15:26 UTC (permalink / raw)
  To: ofono

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

---
 src/emulator.c |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/emulator.c b/src/emulator.c
index 0f1ceca..34329f0 100644
--- a/src/emulator.c
+++ b/src/emulator.c
@@ -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;
+}
-- 
1.7.1


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

* [PATCH 4/4] voicecall: Force callheld update after calls swap
  2012-03-09 15:26 [PATCH 1/4] voicecall: Improve transitions check =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
  2012-03-09 15:26 ` [PATCH 2/4] emulator: Add API to force indicator event =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
  2012-03-09 15:26 ` [PATCH 3/4] emulator: Force indicator event implementation =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
@ 2012-03-09 15:26 ` =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
  2012-03-14  2:44 ` [PATCH 1/4] voicecall: Improve transitions check Denis Kenzior
  3 siblings, 0 replies; 7+ messages in thread
From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis @ 2012-03-09 15:26 UTC (permalink / raw)
  To: ofono

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

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(-)

diff --git a/src/voicecall.c b/src/voicecall.c
index dc4fdf5..c3fbc7b 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -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);
-- 
1.7.1


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

* Re: [PATCH 1/4] voicecall: Improve transitions check
  2012-03-09 15:26 [PATCH 1/4] voicecall: Improve transitions check =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
                   ` (2 preceding siblings ...)
  2012-03-09 15:26 ` [PATCH 4/4] voicecall: Force callheld update after calls swap =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
@ 2012-03-14  2:44 ` Denis Kenzior
  3 siblings, 0 replies; 7+ messages in thread
From: Denis Kenzior @ 2012-03-14  2:44 UTC (permalink / raw)
  To: ofono

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

Hi Frédéric,

On 03/09/2012 09:26 AM, Frédéric Danis wrote:
> 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

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

* Re: [PATCH 2/4] emulator: Add API to force indicator event
  2012-03-09 15:26 ` [PATCH 2/4] emulator: Add API to force indicator event =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
@ 2012-03-14  2:45   ` Denis Kenzior
  0 siblings, 0 replies; 7+ messages in thread
From: Denis Kenzior @ 2012-03-14  2:45 UTC (permalink / raw)
  To: ofono

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

Hi Frédéric,

On 03/09/2012 09:26 AM, Frédéric Danis wrote:
> 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(-)
> 
> diff --git a/include/emulator.h b/include/emulator.h
> index 5cd894b..e6bfcbd 100644
> --- a/include/emulator.h
> +++ b/include/emulator.h
> @@ -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.

>  #ifdef __cplusplus
>  }
>  #endif

Regards,
-Denis

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

* Re: [PATCH 3/4] emulator: Force indicator event implementation
  2012-03-09 15:26 ` [PATCH 3/4] emulator: Force indicator event implementation =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
@ 2012-03-14  2:47   ` Denis Kenzior
  0 siblings, 0 replies; 7+ messages in thread
From: Denis Kenzior @ 2012-03-14  2:47 UTC (permalink / raw)
  To: ofono

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

Hi Frédéric,

On 03/09/2012 09:26 AM, Frédéric Danis wrote:
> ---
>  src/emulator.c |   18 ++++++++++++++++--
>  1 files changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/src/emulator.c b/src/emulator.c
> index 0f1ceca..34329f0 100644
> --- a/src/emulator.c
> +++ b/src/emulator.c
> @@ -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)

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

> +{
> +	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

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

end of thread, other threads:[~2012-03-14  2:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-09 15:26 [PATCH 1/4] voicecall: Improve transitions check =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2012-03-09 15:26 ` [PATCH 2/4] emulator: Add API to force indicator event =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2012-03-14  2:45   ` Denis Kenzior
2012-03-09 15:26 ` [PATCH 3/4] emulator: Force indicator event implementation =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2012-03-14  2:47   ` Denis Kenzior
2012-03-09 15:26 ` [PATCH 4/4] voicecall: Force callheld update after calls swap =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2012-03-14  2:44 ` [PATCH 1/4] voicecall: Improve transitions check Denis Kenzior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox