public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH 3/4] telephony-ofono: add support for Enhanced Call Control feature
Date: Mon, 10 Jan 2011 15:05:44 +0200	[thread overview]
Message-ID: <1294664745-16487-3-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1294664745-16487-1-git-send-email-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>

The Enhanced Call Control feature is simply an extension of the current
AT+CHLD command:

 - Release Specified Call: AT+CHLD=1<idex>
 - Private Consultation Mode: AT+CHLD=1<idex>

The new arguments for this command include an index of a specific call as
indicated in the +CLCC response.
---
 audio/telephony-ofono.c |   52 +++++++++++++++++++++++++++++++++-------------
 1 files changed, 37 insertions(+), 15 deletions(-)

diff --git a/audio/telephony-ofono.c b/audio/telephony-ofono.c
index 7687434..fb32ca9 100644
--- a/audio/telephony-ofono.c
+++ b/audio/telephony-ofono.c
@@ -267,21 +267,25 @@ static int release_answer_calls()
 						NULL, NULL, DBUS_TYPE_INVALID);
 }
 
-static int swap_calls(void)
+static int split_call(struct voice_call *call)
 {
-	DBG("");
+	DBG("%s", call->number);
 	return send_method_call(OFONO_BUS_NAME, modem_obj_path,
 						OFONO_VCMANAGER_INTERFACE,
-						"SwapCalls",
-						NULL, NULL, DBUS_TYPE_INVALID);
+						"PrivateChat",
+						NULL, NULL,
+						DBUS_TYPE_OBJECT_PATH,
+						call->obj_path,
+						DBUS_TYPE_INVALID);
+	return -1;
 }
 
-static int call_transfer(void)
+static int swap_calls(void)
 {
 	DBG("");
 	return send_method_call(OFONO_BUS_NAME, modem_obj_path,
 						OFONO_VCMANAGER_INTERFACE,
-						"Transfer",
+						"SwapCalls",
 						NULL, NULL, DBUS_TYPE_INVALID);
 }
 
@@ -466,11 +470,22 @@ static void foreach_vc_with_status(int status,
 
 void telephony_call_hold_req(void *telephony_device, const char *cmd)
 {
+	const char *idx;
 	struct voice_call *call;
 	int err = 0;
 
 	DBG("telephony-ofono: got call hold request %s", cmd);
 
+	if (strlen(cmd) > 1)
+		idx = &cmd[1];
+	else
+		idx = NULL;
+
+	if (idx)
+		call = g_slist_nth_data(calls, strtol(idx, NULL, 0) - 1);
+	else
+		call = NULL;
+
 	switch (cmd[0]) {
 	case '0':
 		if (find_vc_with_status(CALL_STATUS_WAITING))
@@ -480,18 +495,25 @@ void telephony_call_hold_req(void *telephony_device, const char *cmd)
 			foreach_vc_with_status(CALL_STATUS_HELD, release_call);
 		break;
 	case '1':
+		if (idx) {
+			if (call)
+				err = release_call(call);
+			break;
+		}
 		err = release_answer_calls();
 		break;
 	case '2':
-		call = find_vc_with_status(CALL_STATUS_WAITING);
+		if (idx) {
+			if (call)
+				err = split_call(call);
+		} else {
+			call = find_vc_with_status(CALL_STATUS_WAITING);
 
-		if (call)
-			err = answer_call(call);
-		else
-			err = swap_calls();
-		break;
-	case '4':
-		err = call_transfer();
+			if (call)
+				err = answer_call(call);
+			else
+				err = swap_calls();
+		}
 		break;
 	default:
 		DBG("Unknown call hold request");
-- 
1.7.1


  parent reply	other threads:[~2011-01-10 13:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-10 13:05 [PATCH 1/4] telephony-ofono: add support for inband ringtone feature Luiz Augusto von Dentz
2011-01-10 13:05 ` [PATCH 2/4] telephony-ofono: add proper support for AT+CHLD and AT+CKPD Luiz Augusto von Dentz
2011-01-10 13:05 ` Luiz Augusto von Dentz [this message]
2011-01-10 13:05 ` [PATCH 4/4] telephony-ofono: add support for Three Way Calling feature Luiz Augusto von Dentz
2011-01-10 19:43 ` [PATCH 1/4] telephony-ofono: add support for inband ringtone feature Johan Hedberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1294664745-16487-3-git-send-email-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox