Open Source Telephony
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: ofono@ofono.org
Subject: [PATCH v6 3/3] handsfree-audio: Add Acquire implementation
Date: Thu, 04 May 2017 11:22:36 +0300	[thread overview]
Message-ID: <20170504082236.9977-3-luiz.dentz@gmail.com> (raw)
In-Reply-To: <20170504082236.9977-1-luiz.dentz@gmail.com>

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

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

This adds Acquire method which can be used by agents that require
pulling the fd directly instead of waiting a NewConnection.
---
 src/handsfree-audio.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/handsfree-audio.c b/src/handsfree-audio.c
index dab16da..5ca8702 100644
--- a/src/handsfree-audio.c
+++ b/src/handsfree-audio.c
@@ -326,6 +326,13 @@ static gboolean sco_connect_cb(GIOChannel *io, GIOCondition cond,
 
 	sk = g_io_channel_unix_get_fd(io);
 
+	if (card->msg && dbus_message_has_member(card->msg, "Acquire")) {
+		reply = g_dbus_create_reply(card->msg, DBUS_TYPE_UNIX_FD, &sk,
+					DBUS_TYPE_BYTE, &card->selected_codec,
+					DBUS_TYPE_INVALID);
+		goto done;
+	}
+
 	send_new_connection(card->path, sk, card->selected_codec);
 
 	close(sk);
@@ -403,6 +410,9 @@ static const GDBusMethodTable card_methods[] = {
 			NULL, GDBUS_ARGS({ "properties", "a{sv}" }),
 			card_get_properties) },
 	{ GDBUS_ASYNC_METHOD("Connect", NULL, NULL, card_connect) },
+	{ GDBUS_ASYNC_METHOD("Acquire", NULL,
+			GDBUS_ARGS({"sco", "h"}, {"codec", "y"}),
+			card_connect) },
 	{ }
 };
 
-- 
2.9.3


  parent reply	other threads:[~2017-05-04  8:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-04  8:22 [PATCH v6 1/3] hfp_hf_bluez5: Rework code handling device changes Luiz Augusto von Dentz
2017-05-04  8:22 ` [PATCH v6 2/3] doc/handsfree-audio-api: Add Acquire method Luiz Augusto von Dentz
2017-05-04  8:22 ` Luiz Augusto von Dentz [this message]
2017-05-04 17:35 ` [PATCH v6 1/3] hfp_hf_bluez5: Rework code handling device changes Denis Kenzior

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=20170504082236.9977-3-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=ofono@ofono.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