Bluetooth: ISO: Fix cleanup connection

This fixes bt_iso_cleanup when there are still channels bound to the
ACL connection.

On top of it introduce bt_iso_chan_unbind which can be used to unbind
channels and thus release the reference to the ACL connection if that
has not been disconnected in which case the channels are unbind
automatically.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Luiz Augusto von Dentz 2021-01-29 15:57:47 -08:00 committed by Anas Nashif
commit af0fc963d8
2 changed files with 76 additions and 29 deletions

View file

@ -305,6 +305,20 @@ int bt_iso_server_register(struct bt_iso_server *server);
int bt_iso_chan_bind(struct bt_conn **conns, uint8_t num_conns,
struct bt_iso_chan **chans);
/** @brief Unbind ISO channel
*
* Unbind ISO channel from ACL connection, channel must be in BT_ISO_BOUND
* state.
*
* Note: Channels which the ACL connection has been disconnected are unbind
* automatically.
*
* @param chan Channel object.
*
* @return 0 in case of success or negative value in case of error.
*/
int bt_iso_chan_unbind(struct bt_iso_chan *chan);
/** @brief Connect ISO channels
*
* Connect ISO channels, once the connection is completed each channel