summaryrefslogtreecommitdiff
path: root/src/handsfree-audio.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2017-05-04 11:22:36 +0300
committerDenis Kenzior <denkenz@gmail.com>2017-05-04 12:34:31 -0500
commit27afa421cfdafbfcf77df3a41e87d9eaca7952fd (patch)
tree485d323499d3b6488bfcd2a443ba125ed416f2ff /src/handsfree-audio.c
parenta192f22d3ea0f52cc942657beb5cf47450f7cb1b (diff)
downloadofono-27afa421cfdafbfcf77df3a41e87d9eaca7952fd.tar.gz
handsfree-audio: Add Acquire implementation
This adds Acquire method which can be used by agents that require pulling the fd directly instead of waiting a NewConnection.
Diffstat (limited to 'src/handsfree-audio.c')
-rw-r--r--src/handsfree-audio.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/handsfree-audio.c b/src/handsfree-audio.c
index dab16da2..5ca87021 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) },
{ }
};