This is a rebase of Wim Taymans patch to support the HSP headset role that has somehow been forgotten. Original patch can be found at https://lists.freedesktop.org/archives/pulseaudio-discuss/2015-February/023242.html Rebase and minor changes by Georg Chini.
In addition to the HSP Audio Gateway, also add support for the headset role in the native bluetooth backend. In this role, pulseaudio is used as headset.
In the headset role, we create source and sink to receive and send the samples from the gateway, respectively. Module-bluetooth-policy will automatically load loopback modules to link these to a sink and source for playback. Because this makes the source the speaker and the sink the microphone, we need to reverse the roles of source and sink compared to the gateway role.
In the gateway role, adjusting the sink volume generates a +VGS command to set the volume on the headset. Likewise, receiving AT+VGS updates the sink volume.
In the headset role, receiving a +VGS should set the source volume and any source volume changes should be reported back to the gateway with AT+VGS.
e1dc75d backend-native: add support for the HSP Headset role
src/modules/bluetooth/backend-native.c | 273 ++++++++++++++++++++++-----
src/modules/bluetooth/module-bluez5-device.c | 34 +++-
2 files changed, 255 insertions(+), 52 deletions(-)