All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/3] emulator: Add API to force indicator event
@ 2012-03-14 16:00 =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
  2012-03-14 16:00 ` [PATCH v2 2/3] emulator: Force indicator event implementation =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
  2012-03-14 16:00 ` [PATCH v2 3/3] voicecall: Force callheld update after calls swap =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
  0 siblings, 2 replies; 5+ messages in thread
From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis @ 2012-03-14 16:00 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 672 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..39f4ad7 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_set_indicator_forced(struct ofono_emulator *em,
+					const char *name, int value);
+
 #ifdef __cplusplus
 }
 #endif
-- 
1.7.1


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

* [PATCH v2 2/3] emulator: Force indicator event implementation
  2012-03-14 16:00 [PATCH v2 1/3] emulator: Add API to force indicator event =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
@ 2012-03-14 16:00 ` =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
  2012-03-21  0:22   ` Denis Kenzior
  2012-03-14 16:00 ` [PATCH v2 3/3] voicecall: Force callheld update after calls swap =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
  1 sibling, 1 reply; 5+ messages in thread
From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis @ 2012-03-14 16:00 UTC (permalink / raw)
  To: ofono

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

---
 src/emulator.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/src/emulator.c b/src/emulator.c
index 0f1ceca..8df721c 100644
--- a/src/emulator.c
+++ b/src/emulator.c
@@ -1245,3 +1245,26 @@ start_ring:
 	em->callsetup_source = g_timeout_add_seconds(RING_TIMEOUT,
 							notify_ring, em);
 }
+
+void ofono_emulator_set_indicator_forced(struct ofono_emulator *em,
+						const char *name, int value)
+{
+	int i;
+	struct indicator *ind;
+	char buf[20];
+
+	ind = find_indicator(em, name, &i);
+
+	if (ind == NULL || value < ind->min || value > ind->max)
+		return;
+
+	ind->value = value;
+
+	if (em->events_mode == 3 && em->events_ind && em->slc && ind->active) {
+		if (!g_at_server_command_pending(em->server)) {
+			sprintf(buf, "+CIEV: %d,%d", i, ind->value);
+			g_at_server_send_unsolicited(em->server, buf);
+		} else
+			ind->deferred = TRUE;
+	}
+}
-- 
1.7.1


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

* [PATCH v2 3/3] voicecall: Force callheld update after calls swap
  2012-03-14 16:00 [PATCH v2 1/3] emulator: Add API to force indicator event =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
  2012-03-14 16:00 ` [PATCH v2 2/3] emulator: Force indicator event implementation =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
@ 2012-03-14 16:00 ` =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
  2012-03-21  0:27   ` Denis Kenzior
  1 sibling, 1 reply; 5+ messages in thread
From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis @ 2012-03-14 16:00 UTC (permalink / raw)
  To: ofono

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

In HFP spec, a callheld indicator update should be sent after swapping
calls, even if it stays to 1 (AG has both active and held calls).
---
 src/voicecall.c |   78 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 74 insertions(+), 4 deletions(-)

diff --git a/src/voicecall.c b/src/voicecall.c
index dc4fdf5..c8c51f1 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -119,6 +119,8 @@ static const char *default_en_list[] = { "911", "112", NULL };
 static const char *default_en_list_no_sim[] = { "119", "118", "999", "110",
 						"08", "000", NULL };
 
+static void send_ciev_after_swap_callback(const struct ofono_error *error,
+								void *data);
 static void generic_callback(const struct ofono_error *error, void *data);
 static void hangup_all_active(const struct ofono_error *error, void *data);
 static void multirelease_callback(const struct ofono_error *err, void *data);
@@ -746,6 +748,17 @@ static void voicecall_emit_multiparty(struct voicecall *call, gboolean mpty)
 						&val);
 }
 
+static void emulator_set_indicator_forced(struct ofono_voicecall *vc,
+						const char *name, int value)
+{
+	struct ofono_modem *modem = __ofono_atom_get_modem(vc->atom);
+	struct ofono_emulator *em;
+
+	em = __ofono_atom_find(OFONO_ATOM_TYPE_EMULATOR_HFP, modem);
+	if (em)
+		ofono_emulator_set_indicator_forced(em, name, value);
+}
+
 static void emulator_call_status_cb(struct ofono_atom *atom, void *data)
 {
 	struct ofono_emulator *em = __ofono_atom_get_data(atom);
@@ -1615,13 +1628,19 @@ static DBusMessage *manager_swap_without_accept(DBusConnection *conn,
 						DBusMessage *msg, void *data)
 {
 	struct ofono_voicecall *vc = data;
+	ofono_voicecall_cb_t cb;
 
 	if (vc->pending || vc->dial_req || vc->pending_em)
 		return __ofono_error_busy(msg);
 
 	vc->pending = dbus_message_ref(msg);
 
-	vc->driver->swap_without_accept(vc, generic_callback, vc);
+	if (voicecalls_have_active(vc) && voicecalls_have_held(vc))
+		cb = send_ciev_after_swap_callback;
+	else
+		cb = generic_callback;
+
+	vc->driver->swap_without_accept(vc, cb, vc);
 
 	return NULL;
 }
@@ -1631,6 +1650,7 @@ static DBusMessage *manager_swap_calls(DBusConnection *conn,
 					DBusMessage *msg, void *data)
 {
 	struct ofono_voicecall *vc = data;
+	ofono_voicecall_cb_t cb;
 
 	if (vc->driver->swap_without_accept)
 		return manager_swap_without_accept(conn, msg, data);
@@ -1646,7 +1666,12 @@ static DBusMessage *manager_swap_calls(DBusConnection *conn,
 
 	vc->pending = dbus_message_ref(msg);
 
-	vc->driver->hold_all_active(vc, generic_callback, vc);
+	if (voicecalls_have_active(vc) && voicecalls_have_held(vc))
+		cb = send_ciev_after_swap_callback;
+	else
+		cb = generic_callback;
+
+	vc->driver->hold_all_active(vc, cb, vc);
 
 	return NULL;
 }
@@ -2300,6 +2325,28 @@ error:
 		g_free(v);
 }
 
+static void send_ciev_after_swap_callback(const struct ofono_error *error,
+								void *data)
+{
+	struct ofono_voicecall *vc = data;
+	DBusMessage *reply;
+
+	if (error->type != OFONO_ERROR_TYPE_NO_ERROR)
+		DBG("command failed with error: %s",
+				telephony_error_to_str(error));
+
+	if (error->type == OFONO_ERROR_TYPE_NO_ERROR) {
+		reply = dbus_message_new_method_return(vc->pending);
+		emulator_set_indicator_forced(vc, OFONO_EMULATOR_IND_CALLHELD,
+					OFONO_EMULATOR_CALLHELD_MULTIPLE);
+	} else
+		reply = __ofono_error_failed(vc->pending);
+
+	__ofono_dbus_pending_reply(&vc->pending, reply);
+}
+
+
+
 static void generic_callback(const struct ofono_error *error, void *data)
 {
 	struct ofono_voicecall *vc = data;
@@ -2801,6 +2848,23 @@ static void sim_watch(struct ofono_atom *atom,
 	sim_state_watch(ofono_sim_get_state(sim), vc);
 }
 
+static void emulator_send_ciev_after_swap_cb(const struct ofono_error *error,
+								void *data)
+{
+	struct ofono_voicecall *vc = data;
+
+	if (vc->pending_em == NULL)
+		return;
+
+	ofono_emulator_send_final(vc->pending_em, error);
+
+	if (error->type == OFONO_ERROR_TYPE_NO_ERROR)
+		emulator_set_indicator_forced(vc, OFONO_EMULATOR_IND_CALLHELD,
+					OFONO_EMULATOR_CALLHELD_MULTIPLE);
+
+	vc->pending_em = NULL;
+}
+
 static void emulator_generic_cb(const struct ofono_error *error, void *data)
 {
 	struct ofono_voicecall *vc = data;
@@ -3039,6 +3103,7 @@ static void emulator_chld_cb(struct ofono_emulator *em,
 	char buf[64];
 	char *info;
 	int chld;
+	ofono_voicecall_cb_t cb;
 
 	result.error = 0;
 
@@ -3080,9 +3145,14 @@ static void emulator_chld_cb(struct ofono_emulator *em,
 			if (vc->driver->hold_all_active == NULL)
 				goto fail;
 
+			if (voicecalls_have_active(vc) &&
+					voicecalls_have_held(vc))
+				cb = emulator_send_ciev_after_swap_cb;
+			else
+				cb = emulator_generic_cb;
+
 			vc->pending_em = em;
-			vc->driver->hold_all_active(vc,
-					emulator_generic_cb, vc);
+			vc->driver->hold_all_active(vc, cb, vc);
 			return;
 		case 3:
 			if (vc->driver->create_multiparty == NULL)
-- 
1.7.1


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

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

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

Hi Frédéric,

On 03/14/2012 11:00 AM, Frédéric Danis wrote:
> ---
>  src/emulator.c |   23 +++++++++++++++++++++++
>  1 files changed, 23 insertions(+), 0 deletions(-)
> 

I applied both patch 1 & 2, but refactored it to make
ofono_emulator_set_indicator_forced into private API.  Just to be on the
safe side.  So you will see a single commit with your name on it.

Regards,
-Denis

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

* Re: [PATCH v2 3/3] voicecall: Force callheld update after calls swap
  2012-03-14 16:00 ` [PATCH v2 3/3] voicecall: Force callheld update after calls swap =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
@ 2012-03-21  0:27   ` Denis Kenzior
  0 siblings, 0 replies; 5+ messages in thread
From: Denis Kenzior @ 2012-03-21  0:27 UTC (permalink / raw)
  To: ofono

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

Hi Frédéric,

On 03/14/2012 11:00 AM, Frédéric Danis wrote:
> In HFP spec, a callheld indicator update should be sent after swapping
> calls, even if it stays to 1 (AG has both active and held calls).
> ---
>  src/voicecall.c |   78 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
>  1 files changed, 74 insertions(+), 4 deletions(-)
> 

Patch has been applied, just had to fix a minor whitespace violation.

Regards,
-Denis

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

end of thread, other threads:[~2012-03-21  0:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-14 16:00 [PATCH v2 1/3] emulator: Add API to force indicator event =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2012-03-14 16:00 ` [PATCH v2 2/3] emulator: Force indicator event implementation =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2012-03-21  0:22   ` Denis Kenzior
2012-03-14 16:00 ` [PATCH v2 3/3] voicecall: Force callheld update after calls swap =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2012-03-21  0:27   ` 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.