From: Jo?o Paulo Rechi Vita <jprvita@xxxxxxxxx> This series implements support for the Bluetooth HFP profile implement as an external profile in oFono. The support has been implement as a separate transport backend and in a separate file, to allow for optional build of this support and to allow to substitute it for a different backend. This was a requirement when the arquitecture of this feature was discussed almost a year ago, and I'm not sure if this requirement still holds true. My personal opinion is that it's a bit of overengineering and I would rather add it later if another HFP backend appears, but since the code was already written I've left it as part of the series so others can comment on this matter. Another point that I'm specially interested in getting feedback is in the last two patches of the series, in which there is a notification from the I/O thread to the main thread of a HUP on the stream fd, so the main thread can suspend the source/sink. This is necessary because on the API used by oFono there is no notification of the transport state transition from playing to idle, only the connection is dropped and a HUP comes through the fd. In this point we need to suspend the source/sink and release the transport, otherwise we don't play well with module-bluetooth-policy/module-loopback and we don't configure the fd of a subsequent connection properly. Jo?o Paulo Rechi Vita (21): bluetooth: Fix lines going over collumn 128 bluetooth: Change BlueZ 5 card profile name from a2dp to a2dp_sink bluetooth: Add basic support for HEADSET profiles bluetooth: Add BlueZ 5 headset profile names in policy module bluetooth: Create Handsfree Audio Agent NULL backend bluetooth: Create Handsfree Audio Agent oFono backend bluetooth: Monitor D-Bus signals bluetooth: Create pa_bluetooth_dbus_send_and_add_to_pending() for oFono backend bluetooth: Register/Unregister Handsfree Audio Agent with oFono bluetooth: List HandsfreeAudioCard objects from oFono bluetooth: Parse HandsfreeAudioCard properties bluetooth: Implement transport acquire for hf_audio_agent transports bluetooth: Implement transport release for hf_audio_agent transports bluetooth: Track oFono service bluetooth: Handle CardAdded signal bluetooth: Handle CardRemoved signal bluetooth: Implement org.ofono.HandsfreeAudioAgent.Release() bluetooth: Implement org.ofono.HandsfreeAudioAgent.NewConnection() bluetooth: Rename variable to improve code readability bluetooth: Notify the main thread of a stream fd HUP bluetooth: Suspend the source/sink the HFP-oFono stream fd HUP configure.ac | 10 + src/Makefile.am | 4 +- src/modules/bluetooth/bluez5-util.c | 10 + src/modules/bluetooth/bluez5-util.h | 6 + src/modules/bluetooth/hfaudioagent-null.c | 37 ++ src/modules/bluetooth/hfaudioagent-ofono.c | 672 ++++++++++++++++++++++++ src/modules/bluetooth/hfaudioagent.h | 31 ++ src/modules/bluetooth/module-bluetooth-policy.c | 38 +- src/modules/bluetooth/module-bluez5-device.c | 459 ++++++++++++---- 9 files changed, 1140 insertions(+), 127 deletions(-) create mode 100644 src/modules/bluetooth/hfaudioagent-null.c create mode 100644 src/modules/bluetooth/hfaudioagent-ofono.c create mode 100644 src/modules/bluetooth/hfaudioagent.h -- 1.8.3.1