Open Source Telephony
 help / color / mirror / Atom feed
* [PATCH 0/7] Add CHLD support to HFP profile
@ 2011-05-02 15:48 =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
  2011-05-02 15:48 ` [PATCH 1/7] voicecall: Fix variable initialization =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau @ 2011-05-02 15:48 UTC (permalink / raw)
  To: ofono

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

This patch adds CHLD support to HFP profile.

AT+CHLD=0 uses release_all_held and set_udub
AT+CHLD=1 uses release_all_active
AT+CHLD=2 uses hold_all_active
AT+CHLD=3 uses create_multiparty
AT+CHLD=4 uses transfer
AT+CHLD=1X uses release_specific
AT+CHLD=2X uses private_chat

Best regards!


Frédéric Dalleau (7):
  voicecall: Fix variable initialization
  voicecall: add +CHLD support for HFP emulator
  voicecall: add +CHLD=0 support for HFP emulator
  voicecall: add +CHLD=3 support for HFP emulator
  voicecall: add +CHLD=4 support for HFP emulator
  voicecall: add +CHLD=1X support for HFP emulator
  voicecall: add +CHLD=2X support for HFP emulator

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


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

* [PATCH 1/7] voicecall: Fix variable initialization
  2011-05-02 15:48 [PATCH 0/7] Add CHLD support to HFP profile =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
@ 2011-05-02 15:48 ` =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
  2011-05-02 15:48 ` [PATCH 2/7] voicecall: add +CHLD support for HFP emulator =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau @ 2011-05-02 15:48 UTC (permalink / raw)
  To: ofono

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

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

diff --git a/src/voicecall.c b/src/voicecall.c
index 3e66004..4564a65 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -2600,6 +2600,7 @@ static void emulator_generic_cb(const struct ofono_error *error, void *data)
 	struct ofono_emulator *em = data;
 	struct ofono_error result;
 
+	result.error = error->error;
 	result.type = error->type;
 
 	ofono_emulator_send_final(em, &result);
-- 
1.7.1


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

* [PATCH 2/7] voicecall: add +CHLD support for HFP emulator
  2011-05-02 15:48 [PATCH 0/7] Add CHLD support to HFP profile =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
  2011-05-02 15:48 ` [PATCH 1/7] voicecall: Fix variable initialization =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
@ 2011-05-02 15:48 ` =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
  2011-05-02 15:48 ` [PATCH 3/7] voicecall: add +CHLD=0 " =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau @ 2011-05-02 15:48 UTC (permalink / raw)
  To: ofono

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

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

diff --git a/src/voicecall.c b/src/voicecall.c
index 4564a65..3507f33 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -2417,6 +2417,10 @@ static void emulator_hfp_unregister(struct ofono_atom *atom)
 						OFONO_ATOM_TYPE_EMULATOR_HFP,
 						emulator_remove_handler,
 						"+CLCC");
+	__ofono_modem_foreach_registered_atom(modem,
+						OFONO_ATOM_TYPE_EMULATOR_HFP,
+						emulator_remove_handler,
+						"+CHLD");
 
 	__ofono_modem_remove_atom_watch(modem, vc->hfp_watch);
 }
@@ -2737,6 +2741,71 @@ static void emulator_clcc_cb(struct ofono_emulator *em,
 	ofono_emulator_send_final(em, &result);
 }
 
+static void emulator_chld_cb(struct ofono_emulator *em,
+			struct ofono_emulator_request *req, void *userdata)
+{
+	struct ofono_voicecall *vc = userdata;
+	struct ofono_error result;
+	char buf[22];
+	char *info;
+	int chld;
+
+	result.error = 0;
+
+	switch (ofono_emulator_request_get_type(req)) {
+	case OFONO_EMULATOR_REQUEST_TYPE_SET:
+		if (!ofono_emulator_request_next_number(req, &chld))
+			goto fail;
+
+		switch (chld) {
+		case 1:
+			if (vc->driver->release_all_active == NULL)
+				goto fail;
+
+			vc->driver->release_all_active(vc,
+					emulator_generic_cb, em);
+			return;
+		case 2:
+			if (vc->driver->hold_all_active == NULL)
+				goto fail;
+
+			vc->driver->hold_all_active(vc,
+					emulator_generic_cb, em);
+			return;
+		default:
+			goto fail;
+		}
+		break;
+
+	case OFONO_EMULATOR_REQUEST_TYPE_SUPPORT:
+		memcpy(buf, "+CHLD=", 6);
+		info = buf + 6;
+
+		if (vc->driver->release_all_active)
+			*info++ = '1';
+
+		if (vc->driver->hold_all_active) {
+			if (info - buf > 6)
+				*info++ = ',';
+
+			*info++ = '2';
+		}
+
+		*info++ = '\0';
+
+		ofono_emulator_send_info(em, buf, TRUE);
+		result.type = OFONO_ERROR_TYPE_NO_ERROR;
+		break;
+
+	case OFONO_EMULATOR_REQUEST_TYPE_QUERY:
+	case OFONO_EMULATOR_REQUEST_TYPE_COMMAND_ONLY:
+fail:
+		result.type = OFONO_ERROR_TYPE_FAILURE;
+	}
+
+	ofono_emulator_send_final(em, &result);
+}
+
 static void emulator_hfp_watch(struct ofono_atom *atom,
 				enum ofono_atom_watch_condition cond,
 				void *data)
@@ -2751,6 +2820,7 @@ static void emulator_hfp_watch(struct ofono_atom *atom,
 	ofono_emulator_add_handler(em, "A", emulator_ata_cb, data, NULL);
 	ofono_emulator_add_handler(em, "+CHUP", emulator_chup_cb, data, NULL);
 	ofono_emulator_add_handler(em, "+CLCC", emulator_clcc_cb, data, NULL);
+	ofono_emulator_add_handler(em, "+CHLD", emulator_chld_cb, data, NULL);
 }
 
 void ofono_voicecall_register(struct ofono_voicecall *vc)
-- 
1.7.1


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

* [PATCH 3/7] voicecall: add +CHLD=0 support for HFP emulator
  2011-05-02 15:48 [PATCH 0/7] Add CHLD support to HFP profile =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
  2011-05-02 15:48 ` [PATCH 1/7] voicecall: Fix variable initialization =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
  2011-05-02 15:48 ` [PATCH 2/7] voicecall: add +CHLD support for HFP emulator =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
@ 2011-05-02 15:48 ` =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
  2011-05-02 15:48 ` [PATCH 4/7] voicecall: add +CHLD=3 " =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau @ 2011-05-02 15:48 UTC (permalink / raw)
  To: ofono

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

---
 src/voicecall.c |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/src/voicecall.c b/src/voicecall.c
index 3507f33..9225de9 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -2758,6 +2758,22 @@ static void emulator_chld_cb(struct ofono_emulator *em,
 			goto fail;
 
 		switch (chld) {
+		case 0:
+			if (vc->driver->set_udub == NULL)
+				goto fail;
+
+			if (vc->driver->release_all_held == NULL)
+				goto fail;
+
+			if (voicecalls_have_waiting(vc)) {
+				vc->driver->set_udub(vc,
+						emulator_generic_cb, em);
+				return;
+			}
+
+			vc->driver->release_all_held(vc,
+					emulator_generic_cb, em);
+			return;
 		case 1:
 			if (vc->driver->release_all_active == NULL)
 				goto fail;
@@ -2781,8 +2797,15 @@ static void emulator_chld_cb(struct ofono_emulator *em,
 		memcpy(buf, "+CHLD=", 6);
 		info = buf + 6;
 
-		if (vc->driver->release_all_active)
+		if (vc->driver->release_all_held && vc->driver->set_udub)
+			*info++ = '0';
+
+		if (vc->driver->release_all_active) {
+			if (info - buf > 6)
+				*info++ = ',';
+
 			*info++ = '1';
+		}
 
 		if (vc->driver->hold_all_active) {
 			if (info - buf > 6)
-- 
1.7.1


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

* [PATCH 4/7] voicecall: add +CHLD=3 support for HFP emulator
  2011-05-02 15:48 [PATCH 0/7] Add CHLD support to HFP profile =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
                   ` (2 preceding siblings ...)
  2011-05-02 15:48 ` [PATCH 3/7] voicecall: add +CHLD=0 " =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
@ 2011-05-02 15:48 ` =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
  2011-05-02 15:48 ` [PATCH 5/7] voicecall: add +CHLD=4 " =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau @ 2011-05-02 15:48 UTC (permalink / raw)
  To: ofono

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

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

diff --git a/src/voicecall.c b/src/voicecall.c
index 9225de9..b420071 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -2788,6 +2788,13 @@ static void emulator_chld_cb(struct ofono_emulator *em,
 			vc->driver->hold_all_active(vc,
 					emulator_generic_cb, em);
 			return;
+		case 3:
+			if (vc->driver->create_multiparty == NULL)
+				goto fail;
+
+			vc->driver->create_multiparty(vc,
+					emulator_generic_cb, em);
+			return;
 		default:
 			goto fail;
 		}
@@ -2814,6 +2821,13 @@ static void emulator_chld_cb(struct ofono_emulator *em,
 			*info++ = '2';
 		}
 
+		if (vc->driver->create_multiparty) {
+			if (info - buf > 6)
+				*info++ = ',';
+
+			*info++ = '3';
+		}
+
 		*info++ = '\0';
 
 		ofono_emulator_send_info(em, buf, TRUE);
-- 
1.7.1


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

* [PATCH 5/7] voicecall: add +CHLD=4 support for HFP emulator
  2011-05-02 15:48 [PATCH 0/7] Add CHLD support to HFP profile =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
                   ` (3 preceding siblings ...)
  2011-05-02 15:48 ` [PATCH 4/7] voicecall: add +CHLD=3 " =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
@ 2011-05-02 15:48 ` =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
  2011-05-02 15:48 ` [PATCH 6/7] voicecall: add +CHLD=1X " =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau @ 2011-05-02 15:48 UTC (permalink / raw)
  To: ofono

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

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

diff --git a/src/voicecall.c b/src/voicecall.c
index b420071..3fe590d 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -2795,6 +2795,13 @@ static void emulator_chld_cb(struct ofono_emulator *em,
 			vc->driver->create_multiparty(vc,
 					emulator_generic_cb, em);
 			return;
+		case 4:
+			if (vc->driver->transfer == NULL)
+				goto fail;
+
+			vc->driver->transfer(vc,
+					emulator_generic_cb, em);
+			return;
 		default:
 			goto fail;
 		}
@@ -2828,6 +2835,13 @@ static void emulator_chld_cb(struct ofono_emulator *em,
 			*info++ = '3';
 		}
 
+		if (vc->driver->transfer) {
+			if (info - buf > 6)
+				*info++ = ',';
+
+			*info++ = '4';
+		}
+
 		*info++ = '\0';
 
 		ofono_emulator_send_info(em, buf, TRUE);
-- 
1.7.1


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

* [PATCH 6/7] voicecall: add +CHLD=1X support for HFP emulator
  2011-05-02 15:48 [PATCH 0/7] Add CHLD support to HFP profile =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
                   ` (4 preceding siblings ...)
  2011-05-02 15:48 ` [PATCH 5/7] voicecall: add +CHLD=4 " =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
@ 2011-05-02 15:48 ` =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
  2011-05-02 15:48 ` [PATCH 7/7] voicecall: add +CHLD=2X " =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
  2011-05-05  3:37 ` [PATCH 0/7] Add CHLD support to HFP profile Denis Kenzior
  7 siblings, 0 replies; 9+ messages in thread
From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau @ 2011-05-02 15:48 UTC (permalink / raw)
  To: ofono

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

---
 src/voicecall.c |   22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/voicecall.c b/src/voicecall.c
index 3fe590d..432c739 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -2803,9 +2803,19 @@ static void emulator_chld_cb(struct ofono_emulator *em,
 					emulator_generic_cb, em);
 			return;
 		default:
-			goto fail;
+			break;
 		}
-		break;
+
+		if (chld >= 10 && chld <= 17) {
+			if (vc->driver->release_specific == NULL)
+				goto fail;
+
+			vc->driver->release_specific(vc, chld - 10,
+					emulator_generic_cb, em);
+			return;
+		}
+
+		goto fail;
 
 	case OFONO_EMULATOR_REQUEST_TYPE_SUPPORT:
 		memcpy(buf, "+CHLD=", 6);
@@ -2842,6 +2852,14 @@ static void emulator_chld_cb(struct ofono_emulator *em,
 			*info++ = '4';
 		}
 
+		if (vc->driver->release_specific) {
+			if (info - buf > 6)
+				*info++ = ',';
+
+			*info++ = '1';
+			*info++ = 'X';
+		}
+
 		*info++ = '\0';
 
 		ofono_emulator_send_info(em, buf, TRUE);
-- 
1.7.1


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

* [PATCH 7/7] voicecall: add +CHLD=2X support for HFP emulator
  2011-05-02 15:48 [PATCH 0/7] Add CHLD support to HFP profile =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
                   ` (5 preceding siblings ...)
  2011-05-02 15:48 ` [PATCH 6/7] voicecall: add +CHLD=1X " =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
@ 2011-05-02 15:48 ` =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
  2011-05-05  3:37 ` [PATCH 0/7] Add CHLD support to HFP profile Denis Kenzior
  7 siblings, 0 replies; 9+ messages in thread
From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau @ 2011-05-02 15:48 UTC (permalink / raw)
  To: ofono

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

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

diff --git a/src/voicecall.c b/src/voicecall.c
index 432c739..69cd238 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -2815,6 +2815,15 @@ static void emulator_chld_cb(struct ofono_emulator *em,
 			return;
 		}
 
+		if (chld >= 20 && chld <= 27) {
+			if (vc->driver->private_chat == NULL)
+				goto fail;
+
+			vc->driver->private_chat(vc, chld - 20,
+					emulator_generic_cb, em);
+			return;
+		}
+
 		goto fail;
 
 	case OFONO_EMULATOR_REQUEST_TYPE_SUPPORT:
@@ -2860,6 +2869,14 @@ static void emulator_chld_cb(struct ofono_emulator *em,
 			*info++ = 'X';
 		}
 
+		if (vc->driver->private_chat) {
+			if (info - buf > 6)
+				*info++ = ',';
+
+			*info++ = '2';
+			*info++ = 'X';
+		}
+
 		*info++ = '\0';
 
 		ofono_emulator_send_info(em, buf, TRUE);
-- 
1.7.1


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

* Re: [PATCH 0/7] Add CHLD support to HFP profile
  2011-05-02 15:48 [PATCH 0/7] Add CHLD support to HFP profile =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
                   ` (6 preceding siblings ...)
  2011-05-02 15:48 ` [PATCH 7/7] voicecall: add +CHLD=2X " =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
@ 2011-05-05  3:37 ` Denis Kenzior
  7 siblings, 0 replies; 9+ messages in thread
From: Denis Kenzior @ 2011-05-05  3:37 UTC (permalink / raw)
  To: ofono

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

Hi Frédéric,

On 05/02/2011 10:48 AM, Frédéric Dalleau wrote:
> This patch adds CHLD support to HFP profile.
> 
> AT+CHLD=0 uses release_all_held and set_udub
> AT+CHLD=1 uses release_all_active
> AT+CHLD=2 uses hold_all_active
> AT+CHLD=3 uses create_multiparty
> AT+CHLD=4 uses transfer
> AT+CHLD=1X uses release_specific
> AT+CHLD=2X uses private_chat
> 
> Best regards!
> 

I applied all patches in this series, however I did make a few refactor
commits afterwards.  Please check and make sure I didn't screw anything up.

Regards,
-Denis

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

end of thread, other threads:[~2011-05-05  3:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-02 15:48 [PATCH 0/7] Add CHLD support to HFP profile =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
2011-05-02 15:48 ` [PATCH 1/7] voicecall: Fix variable initialization =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
2011-05-02 15:48 ` [PATCH 2/7] voicecall: add +CHLD support for HFP emulator =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
2011-05-02 15:48 ` [PATCH 3/7] voicecall: add +CHLD=0 " =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
2011-05-02 15:48 ` [PATCH 4/7] voicecall: add +CHLD=3 " =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
2011-05-02 15:48 ` [PATCH 5/7] voicecall: add +CHLD=4 " =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
2011-05-02 15:48 ` [PATCH 6/7] voicecall: add +CHLD=1X " =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
2011-05-02 15:48 ` [PATCH 7/7] voicecall: add +CHLD=2X " =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
2011-05-05  3:37 ` [PATCH 0/7] Add CHLD support to HFP profile Denis Kenzior

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