Bluetooth: CAP: Implement bt_cap_initiator_unregister_cb

Implement function to unregisterd the CAP initiator callbacks.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
Emil Gydesen 2024-05-30 14:48:25 +02:00 committed by Anas Nashif
commit 92002b2dff
2 changed files with 27 additions and 0 deletions

View file

@ -296,6 +296,16 @@ struct bt_cap_unicast_audio_stop_param {
*/
int bt_cap_initiator_register_cb(const struct bt_cap_initiator_cb *cb);
/**
* @brief Unregister Common Audio Profile Initiator callbacks
*
* @param cb The callback structure that was previously registered.
*
* @retval 0 Success
* @retval -EINVAL @p cb is NULL or @p cb was not registered
*/
int bt_cap_initiator_unregister_cb(const struct bt_cap_initiator_cb *cb);
/**
* @brief Setup and start unicast audio streams for a set of devices.
*

View file

@ -53,6 +53,23 @@ int bt_cap_initiator_register_cb(const struct bt_cap_initiator_cb *cb)
return 0;
}
int bt_cap_initiator_unregister_cb(const struct bt_cap_initiator_cb *cb)
{
CHECKIF(cb == NULL) {
LOG_DBG("cb is NULL");
return -EINVAL;
}
CHECKIF(cap_cb != cb) {
LOG_DBG("cb is not registered");
return -EINVAL;
}
cap_cb = NULL;
return 0;
}
struct valid_metadata_param {
bool stream_context_found;
bool valid;