When the user has requested a disconnection it doesn't make sense to
have the AVDTP state machine waiting before closing the signalling
channel. This is particularly important for Device.Disconnect since only
two seconds are available for a clean disconnect before a forced
HCI_Disconnect command is sent.
In order to forward and create avdtp error properly for setconf command
we need to have the category, to fix this avdtp_error_t now carries the
category as define in avdtp and a new category is used for errno
(AVDTP_ERRNO).
Headsets for proper disconnecting need to disconnect profiles in specified
order(by ex. disconnect a2dp, then sink and hfp at the end). Instead of
adding separate callbacks for disconnecting each profile, now adding only
one callback in audio/device.c for calling audio disconnect functions in
correct order. New disconnect callback works similarly to dev_disconnect
from audio/device.c
Modify a2dp_source_* functions to more generic a2dp_record(), a2dp_get(),
a2dp_config(), a2dp_resume(), a2dp_suspend(), and a2dp_cancel() which can
handle both the Sink and Source roles.
This should make watches aware of a force disconnection for permanent device
removal making possible to remove any persistent data associate with the
device.
The original org.bluez.Audio patch forgot to make sure that the disconnection
timers for Headset and AudioSink get disabled when org.bluez.Audio.Connect is
used. This patch fixes it.
This patch adds logic for automatically connecting both A2DP and HFP profiles
if the headset only connects the other. The feature can be switched off using
the AutoConnect audio.conf parameter.
This patch adds a new string State property to the AudioSink interface. It
makes use of the recently added AVDTP connection state tracking support to
create a "connecting" state.
Some headsets when acting as initiators of an AVDTP connection create
the AVDTP signaling channel but don't do anything else over it (i.e.
they expect us to set up a stream when needed). This patch makes
bluetoothd do the same as AudioSink.Connect() if no AVDTP commands have
been received from the sink within one second after it has created the
AVDTP signaling channel to us.
Setting up a stream is also important because the AudioSink Connected
property is bound to the existence of a configured stream (which makes
sense since an AVDTP connection as such tells us nothing about what
sinks and sources there are or even if audio or video will be used).
This patch makes sure that explicitly created connections (remotely
initiated or using AudioSink.Connect()) stay up until explictly
disconnected. The control for this needs to be in the stream timer and
not the disconnect timer since our AVDTP state machine always tries to
keep one stream in configured state (i.e. it should be ok to always
disconnect if we stay too long in IDLE state).