Content-Type: multipart/mixed; boundary="===============5183277237839821084==" MIME-Version: 1.0 From: Luiz Augusto von Dentz Subject: [PATCH v5 5/5] handsfree-audio: Add Acquire implementation Date: Wed, 03 May 2017 16:19:49 +0300 Message-ID: <20170503131949.11322-5-luiz.dentz@gmail.com> In-Reply-To: <20170503131949.11322-1-luiz.dentz@gmail.com> List-Id: To: ofono@ofono.org --===============5183277237839821084== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Luiz Augusto von Dentz 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, GIOCond= ition cond, = sk =3D g_io_channel_unix_get_fd(io); = + if (card->msg && dbus_message_has_member(card->msg, "Acquire")) { + reply =3D 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[] =3D { 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 --===============5183277237839821084==--