Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/releases/release-notes-4.3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ New APIs and options
* :c:struct:`bt_bap_stream` now contains an ``iso`` field as a reference to the ISO channel
* :c:func:`bt_bap_unicast_group_get_info`
* :c:func:`bt_cap_unicast_group_get_info`
* :c:func:`bt_bap_unicast_client_unregister_cb`

* Host

Expand Down
15 changes: 11 additions & 4 deletions include/zephyr/bluetooth/audio/bap.h
Original file line number Diff line number Diff line change
Expand Up @@ -1967,17 +1967,24 @@ struct bt_bap_unicast_client_cb {
/**
* @brief Register unicast client callbacks.
*
* Only one callback structure can be registered, and attempting to
* registering more than one will result in an error.
*
* @param cb Unicast client callback structure.
* @param cb Unicast client callback structure to register.
*
* @retval 0 Success
* @retval -EINVAL @p cb is NULL.
* @retval -EEXIST @p cb is already registered.
*/
int bt_bap_unicast_client_register_cb(struct bt_bap_unicast_client_cb *cb);

/**
* @brief Unregister unicast client callbacks.
*
* @param cb Unicast client callback structure to unregister.
*
* @retval 0 Success
* @retval -EINVAL @p cb is NULL or @p cb was not registered
*/
int bt_bap_unicast_client_unregister_cb(struct bt_bap_unicast_client_cb *cb);

/**
* @brief Discover remote capabilities and endpoints
*
Expand Down
15 changes: 15 additions & 0 deletions subsys/bluetooth/audio/bap_unicast_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -4684,3 +4684,18 @@ int bt_bap_unicast_client_register_cb(struct bt_bap_unicast_client_cb *cb)

return 0;
}

int bt_bap_unicast_client_unregister_cb(struct bt_bap_unicast_client_cb *cb)
{
if (cb == NULL) {
LOG_DBG("cb was NULL");
return -EINVAL;
}

if (!sys_slist_find_and_remove(&unicast_client_cbs, &cb->_node)) {
LOG_DBG("cb was not registered");
return -EALREADY;
}

return 0;
}