From 73bac20eeef6bfb7e9ad78db96092efcfef35f37 Mon Sep 17 00:00:00 2001 From: Liu Linyan Date: Thu, 3 Sep 2026 10:27:44 +0800 Subject: [PATCH] feat(ble_audio): Miscellaneous update for BLE ISO & BLE Audio safe calling --- .../api/esp_ble_audio_aics_api.c | 157 ++++++-- .../esp_ble_audio/api/esp_ble_audio_bap_api.c | 353 ++++++++++++++---- .../esp_ble_audio/api/esp_ble_audio_cap_api.c | 245 ++++++++++-- .../esp_ble_audio/api/esp_ble_audio_ccp_api.c | 70 +++- .../api/esp_ble_audio_common_api.c | 26 +- .../api/esp_ble_audio_csip_api.c | 107 +++++- .../api/esp_ble_audio_gmap_api.c | 23 +- .../esp_ble_audio/api/esp_ble_audio_has_api.c | 105 +++++- .../esp_ble_audio/api/esp_ble_audio_mcc_api.c | 79 ++-- .../api/esp_ble_audio_media_proxy_api.c | 231 ++++++++++-- .../api/esp_ble_audio_micp_api.c | 76 +++- .../api/esp_ble_audio_pacs_api.c | 70 +++- .../esp_ble_audio/api/esp_ble_audio_tbs_api.c | 216 ++++++++--- .../api/esp_ble_audio_tmap_api.c | 14 +- .../esp_ble_audio/api/esp_ble_audio_vcp_api.c | 174 +++++++-- .../api/esp_ble_audio_vocs_api.c | 87 ++++- .../api/include/esp_ble_audio_tbs_api.h | 4 +- .../api/include/esp_ble_audio_tmap_api.h | 4 +- .../host/adapter/bluedroid/init.c | 4 +- .../host/adapter/bluedroid/profiles/cas.c | 2 +- .../esp_ble_audio/host/adapter/nimble/init.c | 4 +- .../host/adapter/nimble/profiles/cas.c | 2 +- .../bt/esp_ble_audio/host/common/init.c | 2 +- .../bt/esp_ble_audio/host/services/ots/ots.c | 4 +- .../host/services/ots/ots_client.c | 4 +- .../include/zephyr/bluetooth/audio/aics.h | 44 ++- .../include/zephyr/bluetooth/audio/bap.h | 160 ++++---- .../include/zephyr/bluetooth/audio/cap.h | 106 +++--- .../include/zephyr/bluetooth/audio/ccp.h | 28 +- .../include/zephyr/bluetooth/audio/csip.h | 55 ++- .../include/zephyr/bluetooth/audio/gmap.h | 7 +- .../include/zephyr/bluetooth/audio/has.h | 38 +- .../include/zephyr/bluetooth/audio/mcc.h | 38 +- .../zephyr/bluetooth/audio/media_proxy.h | 188 +++++----- .../include/zephyr/bluetooth/audio/micp.h | 29 +- .../include/zephyr/bluetooth/audio/pacs.h | 32 +- .../include/zephyr/bluetooth/audio/tbs.h | 98 ++--- .../include/zephyr/bluetooth/audio/tmap.h | 4 +- .../include/zephyr/bluetooth/audio/vcp.h | 61 ++- .../include/zephyr/bluetooth/audio/vocs.h | 28 +- components/bt/esp_ble_audio/lib/lib | 2 +- .../esp_ble_iso/api/esp_ble_iso_common_api.c | 120 +++++- components/bt/esp_ble_iso/host/common/adv.c | 35 +- components/bt/esp_ble_iso/host/common/conn.c | 41 -- components/bt/esp_ble_iso/host/common/gatt.c | 30 +- components/bt/esp_ble_iso/host/common/host.c | 63 +++- .../host/common/include/common/adv.h | 6 +- .../host/common/include/common/conn.h | 2 - .../host/common/include/common/gatt.h | 2 +- .../host/common/include/common/host.h | 15 + .../host/common/include/common/iso.h | 4 +- .../host/common/include/common/scan.h | 10 - components/bt/esp_ble_iso/host/common/iso.c | 27 +- components/bt/esp_ble_iso/host/common/scan.c | 29 -- components/bt/esp_ble_iso/host/common/task.c | 37 +- components/bt/esp_ble_iso/host/iso/iso.c | 180 --------- components/bt/esp_ble_iso/host/utils/timer.c | 9 - .../include/zephyr/bluetooth/conn.h | 2 - .../include/zephyr/bluetooth/gatt.h | 2 - .../include/zephyr/bluetooth/iso.h | 37 +- .../tmap/central/main/ccp_server.c | 6 +- .../tmap/central/main/vcp_vol_ctlr.c | 6 +- 62 files changed, 2339 insertions(+), 1305 deletions(-) diff --git a/components/bt/esp_ble_audio/api/esp_ble_audio_aics_api.c b/components/bt/esp_ble_audio/api/esp_ble_audio_aics_api.c index 4105ffc1a9f..c81c66dee6e 100644 --- a/components/bt/esp_ble_audio/api/esp_ble_audio_aics_api.c +++ b/components/bt/esp_ble_audio/api/esp_ble_audio_aics_api.c @@ -10,16 +10,32 @@ #if CONFIG_BT_AICS esp_ble_audio_aics_t *esp_ble_audio_aics_free_instance_get(void) { - return bt_aics_free_instance_get_safe(); + esp_ble_audio_aics_t *inst; + + BT_LE_HOST_LOCK_OR_RETURN(NULL); + + inst = bt_aics_free_instance_get(); + + bt_le_host_unlock(); + + return inst; } void *esp_ble_audio_aics_svc_decl_get(esp_ble_audio_aics_t *aics) { + void *decl; + if (aics == NULL) { return NULL; } - return bt_aics_svc_decl_get_safe(aics); + BT_LE_HOST_LOCK_OR_RETURN(NULL); + + decl = bt_aics_svc_decl_get(aics); + + bt_le_host_unlock(); + + return decl; } esp_err_t esp_ble_audio_aics_register(esp_ble_audio_aics_t *aics, @@ -41,7 +57,12 @@ esp_err_t esp_ble_audio_aics_register(esp_ble_audio_aics_t *aics, return ESP_ERR_INVALID_ARG; } - err = bt_aics_register_safe(aics, param); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_aics_register(aics, param); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -57,7 +78,12 @@ esp_err_t esp_ble_audio_aics_activate(esp_ble_audio_aics_t *inst) return ESP_ERR_INVALID_ARG; } - err = bt_aics_activate_safe(inst); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_aics_activate(inst); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -73,7 +99,12 @@ esp_err_t esp_ble_audio_aics_deactivate(esp_ble_audio_aics_t *inst) return ESP_ERR_INVALID_ARG; } - err = bt_aics_deactivate_safe(inst); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_aics_deactivate(inst); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -91,7 +122,12 @@ esp_err_t esp_ble_audio_aics_state_get(esp_ble_audio_aics_t *inst) return ESP_ERR_INVALID_ARG; } - err = bt_aics_state_get_safe(inst); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_aics_state_get(inst); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -107,7 +143,12 @@ esp_err_t esp_ble_audio_aics_gain_setting_get(esp_ble_audio_aics_t *inst) return ESP_ERR_INVALID_ARG; } - err = bt_aics_gain_setting_get_safe(inst); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_aics_gain_setting_get(inst); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -123,7 +164,12 @@ esp_err_t esp_ble_audio_aics_type_get(esp_ble_audio_aics_t *inst) return ESP_ERR_INVALID_ARG; } - err = bt_aics_type_get_safe(inst); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_aics_type_get(inst); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -139,7 +185,12 @@ esp_err_t esp_ble_audio_aics_status_get(esp_ble_audio_aics_t *inst) return ESP_ERR_INVALID_ARG; } - err = bt_aics_status_get_safe(inst); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_aics_status_get(inst); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -155,7 +206,12 @@ esp_err_t esp_ble_audio_aics_disable_mute(esp_ble_audio_aics_t *inst) return ESP_ERR_INVALID_ARG; } - err = bt_aics_disable_mute_safe(inst); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_aics_disable_mute(inst); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -171,7 +227,12 @@ esp_err_t esp_ble_audio_aics_unmute(esp_ble_audio_aics_t *inst) return ESP_ERR_INVALID_ARG; } - err = bt_aics_unmute_safe(inst); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_aics_unmute(inst); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -187,7 +248,12 @@ esp_err_t esp_ble_audio_aics_mute(esp_ble_audio_aics_t *inst) return ESP_ERR_INVALID_ARG; } - err = bt_aics_mute_safe(inst); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_aics_mute(inst); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -203,7 +269,12 @@ esp_err_t esp_ble_audio_aics_gain_set_manual_only(esp_ble_audio_aics_t *inst) return ESP_ERR_INVALID_ARG; } - err = bt_aics_gain_set_manual_only_safe(inst); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_aics_gain_set_manual_only(inst); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -219,7 +290,12 @@ esp_err_t esp_ble_audio_aics_gain_set_auto_only(esp_ble_audio_aics_t *inst) return ESP_ERR_INVALID_ARG; } - err = bt_aics_gain_set_auto_only_safe(inst); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_aics_gain_set_auto_only(inst); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -235,7 +311,12 @@ esp_err_t esp_ble_audio_aics_manual_gain_set(esp_ble_audio_aics_t *inst) return ESP_ERR_INVALID_ARG; } - err = bt_aics_manual_gain_set_safe(inst); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_aics_manual_gain_set(inst); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -251,7 +332,12 @@ esp_err_t esp_ble_audio_aics_automatic_gain_set(esp_ble_audio_aics_t *inst) return ESP_ERR_INVALID_ARG; } - err = bt_aics_automatic_gain_set_safe(inst); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_aics_automatic_gain_set(inst); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -267,7 +353,12 @@ esp_err_t esp_ble_audio_aics_gain_set(esp_ble_audio_aics_t *inst, int8_t gain) return ESP_ERR_INVALID_ARG; } - err = bt_aics_gain_set_safe(inst, gain); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_aics_gain_set(inst, gain); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -283,7 +374,12 @@ esp_err_t esp_ble_audio_aics_description_get(esp_ble_audio_aics_t *inst) return ESP_ERR_INVALID_ARG; } - err = bt_aics_description_get_safe(inst); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_aics_description_get(inst); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -300,7 +396,12 @@ esp_err_t esp_ble_audio_aics_description_set(esp_ble_audio_aics_t *inst, return ESP_ERR_INVALID_ARG; } - err = bt_aics_description_set_safe(inst, description); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_aics_description_set(inst, description); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -322,7 +423,7 @@ esp_err_t esp_ble_audio_aics_discover(uint16_t conn_handle, esp_ble_audio_aics_t return ESP_ERR_INVALID_ARG; } - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -342,7 +443,15 @@ unlock: esp_ble_audio_aics_t *esp_ble_audio_aics_client_free_instance_get(void) { - return bt_aics_client_free_instance_get_safe(); + esp_ble_audio_aics_t *inst; + + BT_LE_HOST_LOCK_OR_RETURN(NULL); + + inst = bt_aics_client_free_instance_get(); + + bt_le_host_unlock(); + + return inst; } esp_err_t esp_ble_audio_aics_client_cb_register(esp_ble_audio_aics_t *inst, @@ -352,7 +461,11 @@ esp_err_t esp_ble_audio_aics_client_cb_register(esp_ble_audio_aics_t *inst, return ESP_ERR_INVALID_ARG; } - bt_aics_client_cb_register_safe(inst, cb); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + bt_aics_client_cb_register(inst, cb); + + bt_le_host_unlock(); return ESP_OK; } diff --git a/components/bt/esp_ble_audio/api/esp_ble_audio_bap_api.c b/components/bt/esp_ble_audio/api/esp_ble_audio_bap_api.c index c8653f3e2d7..29350b1339f 100644 --- a/components/bt/esp_ble_audio/api/esp_ble_audio_bap_api.c +++ b/components/bt/esp_ble_audio/api/esp_ble_audio_bap_api.c @@ -23,7 +23,7 @@ esp_err_t esp_ble_audio_bap_unicast_server_register(const esp_ble_audio_bap_unic return ESP_ERR_INVALID_ARG; } - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); err = bt_bap_unicast_server_register(param); if (err) { @@ -47,20 +47,26 @@ end: esp_err_t esp_ble_audio_bap_unicast_server_unregister(void) { + esp_err_t ret = ESP_OK; int err; - err = bt_bap_unicast_server_unregister_safe(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_unicast_server_unregister(); if (err) { - return ESP_FAIL; + ret = ESP_FAIL; + goto end; } #if BLE_AUDIO_SVC_DEFERRED_ADD if (bt_le_ascs_deinit()) { - return ESP_FAIL; + ret = ESP_FAIL; } #endif /* BLE_AUDIO_SVC_DEFERRED_ADD */ - return ESP_OK; +end: + bt_le_host_unlock(); + return ret; } esp_err_t esp_ble_audio_bap_unicast_server_register_cb(const esp_ble_audio_bap_unicast_server_cb_t *cb) @@ -71,7 +77,12 @@ esp_err_t esp_ble_audio_bap_unicast_server_register_cb(const esp_ble_audio_bap_u return ESP_ERR_INVALID_ARG; } - err = bt_bap_unicast_server_register_cb_safe(cb); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_unicast_server_register_cb(cb); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -87,7 +98,12 @@ esp_err_t esp_ble_audio_bap_unicast_server_unregister_cb(const esp_ble_audio_bap return ESP_ERR_INVALID_ARG; } - err = bt_bap_unicast_server_unregister_cb_safe(cb); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_unicast_server_unregister_cb(cb); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -109,7 +125,7 @@ esp_err_t esp_ble_audio_bap_unicast_server_config_ase_with_dir(uint16_t conn_han return ESP_ERR_INVALID_ARG; } - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -151,7 +167,12 @@ esp_err_t esp_ble_audio_bap_unicast_group_create(esp_ble_audio_bap_unicast_group return ESP_ERR_INVALID_ARG; } - err = bt_bap_unicast_group_create_safe(param, unicast_group); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_unicast_group_create(param, unicast_group); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -171,7 +192,12 @@ esp_err_t esp_ble_audio_bap_unicast_group_reconfig(esp_ble_audio_bap_unicast_gro return ESP_ERR_INVALID_ARG; } - err = bt_bap_unicast_group_reconfig_safe(unicast_group, param); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_unicast_group_reconfig(unicast_group, param); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -189,7 +215,12 @@ esp_err_t esp_ble_audio_bap_unicast_group_add_streams(esp_ble_audio_bap_unicast_ return ESP_ERR_INVALID_ARG; } - err = bt_bap_unicast_group_add_streams_safe(unicast_group, params, num_param); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_unicast_group_add_streams(unicast_group, params, num_param); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -205,7 +236,12 @@ esp_err_t esp_ble_audio_bap_unicast_group_delete(esp_ble_audio_bap_unicast_group return ESP_ERR_INVALID_ARG; } - err = bt_bap_unicast_group_delete_safe(unicast_group); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_unicast_group_delete(unicast_group); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -221,7 +257,12 @@ esp_err_t esp_ble_audio_bap_unicast_client_register_cb(esp_ble_audio_bap_unicast return ESP_ERR_INVALID_ARG; } - err = bt_bap_unicast_client_register_cb_safe(cb); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = lib_bap_unicast_client_register_cb(cb); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -237,7 +278,12 @@ esp_err_t esp_ble_audio_bap_unicast_client_unregister_cb(esp_ble_audio_bap_unica return ESP_ERR_INVALID_ARG; } - err = bt_bap_unicast_client_unregister_cb_safe(cb); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_unicast_client_unregister_cb(cb); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -251,7 +297,7 @@ esp_err_t esp_ble_audio_bap_unicast_client_discover(uint16_t conn_handle, esp_bl void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -282,7 +328,7 @@ esp_err_t esp_ble_audio_bap_stream_config(uint16_t conn_handle, return ESP_ERR_INVALID_ARG; } - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -311,7 +357,7 @@ esp_err_t esp_ble_audio_bap_stream_qos(uint16_t conn_handle, return ESP_ERR_INVALID_ARG; } - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -339,7 +385,12 @@ esp_err_t esp_ble_audio_bap_stream_enable(esp_ble_audio_bap_stream_t *stream, return ESP_ERR_INVALID_ARG; } - err = bt_bap_stream_enable_safe(stream, meta, meta_len); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_stream_enable(stream, meta, meta_len); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -355,7 +406,12 @@ esp_err_t esp_ble_audio_bap_stream_connect(esp_ble_audio_bap_stream_t *stream) return ESP_ERR_INVALID_ARG; } - err = bt_bap_stream_connect_safe(stream); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_stream_connect(stream); + + bt_le_host_unlock(); + if (err) { return (err == -EALREADY) ? ESP_OK : ESP_FAIL; } @@ -371,7 +427,12 @@ esp_err_t esp_ble_audio_bap_stream_stop(esp_ble_audio_bap_stream_t *stream) return ESP_ERR_INVALID_ARG; } - err = bt_bap_stream_stop_safe(stream); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_stream_stop(stream); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -391,7 +452,12 @@ esp_err_t esp_ble_audio_bap_stream_reconfig(esp_ble_audio_bap_stream_t *stream, return ESP_ERR_INVALID_ARG; } - err = bt_bap_stream_reconfig_safe(stream, codec_cfg); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_stream_reconfig(stream, codec_cfg); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -409,7 +475,12 @@ esp_err_t esp_ble_audio_bap_stream_metadata(esp_ble_audio_bap_stream_t *stream, return ESP_ERR_INVALID_ARG; } - err = bt_bap_stream_metadata_safe(stream, meta, meta_len); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_stream_metadata(stream, meta, meta_len); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -425,7 +496,12 @@ esp_err_t esp_ble_audio_bap_stream_disable(esp_ble_audio_bap_stream_t *stream) return ESP_ERR_INVALID_ARG; } - err = bt_bap_stream_disable_safe(stream); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_stream_disable(stream); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -441,7 +517,12 @@ esp_err_t esp_ble_audio_bap_stream_start(esp_ble_audio_bap_stream_t *stream) return ESP_ERR_INVALID_ARG; } - err = bt_bap_stream_start_safe(stream); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_stream_start(stream); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -457,7 +538,12 @@ esp_err_t esp_ble_audio_bap_stream_release(esp_ble_audio_bap_stream_t *stream) return ESP_ERR_INVALID_ARG; } - err = bt_bap_stream_release_safe(stream); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_stream_release(stream); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -475,7 +561,12 @@ esp_err_t esp_ble_audio_bap_broadcast_source_register_cb(esp_ble_audio_bap_broad return ESP_ERR_INVALID_ARG; } - err = bt_bap_broadcast_source_register_cb_safe(cb); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_broadcast_source_register_cb(cb); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -491,7 +582,12 @@ esp_err_t esp_ble_audio_bap_broadcast_source_unregister_cb(esp_ble_audio_bap_bro return ESP_ERR_INVALID_ARG; } - err = bt_bap_broadcast_source_unregister_cb_safe(cb); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_broadcast_source_unregister_cb(cb); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -508,7 +604,12 @@ esp_err_t esp_ble_audio_bap_broadcast_source_create(esp_ble_audio_bap_broadcast_ return ESP_ERR_INVALID_ARG; } - err = bt_bap_broadcast_source_create_safe(param, source); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_broadcast_source_create(param, source); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -525,7 +626,12 @@ esp_err_t esp_ble_audio_bap_broadcast_source_reconfig(esp_ble_audio_bap_broadcas return ESP_ERR_INVALID_ARG; } - err = bt_bap_broadcast_source_reconfig_safe(source, param); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_broadcast_source_reconfig(source, param); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -542,7 +648,12 @@ esp_err_t esp_ble_audio_bap_broadcast_source_update_metadata(esp_ble_audio_bap_b return ESP_ERR_INVALID_ARG; } - err = bt_bap_broadcast_source_update_metadata_safe(source, meta, meta_len); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_broadcast_source_update_metadata(source, meta, meta_len); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -579,7 +690,7 @@ esp_err_t esp_ble_audio_bap_broadcast_source_start(esp_ble_audio_bap_broadcast_s return ESP_ERR_INVALID_ARG; } - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); adv = bt_le_ext_adv_find(adv_handle); if (adv == NULL) { @@ -605,7 +716,12 @@ esp_err_t esp_ble_audio_bap_broadcast_source_stop(esp_ble_audio_bap_broadcast_so return ESP_ERR_INVALID_ARG; } - err = bt_bap_broadcast_source_stop_safe(source); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_broadcast_source_stop(source); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -621,7 +737,12 @@ esp_err_t esp_ble_audio_bap_broadcast_source_delete(esp_ble_audio_bap_broadcast_ return ESP_ERR_INVALID_ARG; } - err = bt_bap_broadcast_source_delete_safe(source); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_broadcast_source_delete(source); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -638,7 +759,12 @@ esp_err_t esp_ble_audio_bap_broadcast_source_get_base(esp_ble_audio_bap_broadcas return ESP_ERR_INVALID_ARG; } - err = bt_bap_broadcast_source_get_base_safe(source, base_buf); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_broadcast_source_get_base(source, base_buf); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -656,7 +782,12 @@ esp_err_t esp_ble_audio_bap_broadcast_sink_register_cb(esp_ble_audio_bap_broadca return ESP_ERR_INVALID_ARG; } - err = bt_bap_broadcast_sink_register_cb_safe(cb); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_broadcast_sink_register_cb(cb); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -668,6 +799,7 @@ esp_err_t esp_ble_audio_bap_broadcast_sink_create(uint16_t sync_handle, uint32_t broadcast_id, esp_ble_audio_bap_broadcast_sink_t **sink) { + esp_err_t ret = ESP_OK; void *per_adv_sync; int err; @@ -675,17 +807,22 @@ esp_err_t esp_ble_audio_bap_broadcast_sink_create(uint16_t sync_handle, return ESP_ERR_INVALID_ARG; } - per_adv_sync = bt_le_per_adv_sync_find_safe(sync_handle); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + per_adv_sync = bt_le_per_adv_sync_find(sync_handle); if (per_adv_sync == NULL) { - return ESP_ERR_NOT_FOUND; + ret = ESP_ERR_NOT_FOUND; + goto unlock; } - err = bt_bap_broadcast_sink_create_safe(per_adv_sync, broadcast_id, sink); + err = bt_bap_broadcast_sink_create(per_adv_sync, broadcast_id, sink); if (err) { - return ESP_FAIL; + ret = ESP_FAIL; } - return ESP_OK; +unlock: + bt_le_host_unlock(); + return ret; } esp_err_t esp_ble_audio_bap_broadcast_sink_sync(esp_ble_audio_bap_broadcast_sink_t *sink, @@ -700,7 +837,12 @@ esp_err_t esp_ble_audio_bap_broadcast_sink_sync(esp_ble_audio_bap_broadcast_sink return ESP_ERR_INVALID_ARG; } - err = bt_bap_broadcast_sink_sync_safe(sink, indexes_bitfield, streams, broadcast_code); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_broadcast_sink_sync(sink, indexes_bitfield, streams, broadcast_code); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -716,7 +858,12 @@ esp_err_t esp_ble_audio_bap_broadcast_sink_stop(esp_ble_audio_bap_broadcast_sink return ESP_ERR_INVALID_ARG; } - err = bt_bap_broadcast_sink_stop_safe(sink); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_broadcast_sink_stop(sink); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -732,7 +879,12 @@ esp_err_t esp_ble_audio_bap_broadcast_sink_delete(esp_ble_audio_bap_broadcast_si return ESP_ERR_INVALID_ARG; } - err = bt_bap_broadcast_sink_delete_safe(sink); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_broadcast_sink_delete(sink); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -747,7 +899,7 @@ esp_err_t esp_ble_audio_bap_scan_delegator_register(esp_ble_audio_bap_scan_deleg esp_err_t ret = ESP_OK; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); err = bt_bap_scan_delegator_register(cb); if (err) { @@ -771,20 +923,26 @@ end: esp_err_t esp_ble_audio_bap_scan_delegator_unregister(void) { + esp_err_t ret = ESP_OK; int err; - err = bt_bap_scan_delegator_unregister_safe(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_scan_delegator_unregister(); if (err) { - return ESP_FAIL; + ret = ESP_FAIL; + goto end; } #if BLE_AUDIO_SVC_DEFERRED_ADD if (bt_le_bass_deinit()) { - return ESP_FAIL; + ret = ESP_FAIL; } #endif /* BLE_AUDIO_SVC_DEFERRED_ADD */ - return ESP_OK; +end: + bt_le_host_unlock(); + return ret; } esp_err_t esp_ble_audio_bap_scan_delegator_set_pa_state(uint8_t src_id, @@ -792,7 +950,12 @@ esp_err_t esp_ble_audio_bap_scan_delegator_set_pa_state(uint8_t src_id, { int err; - err = bt_bap_scan_delegator_set_pa_state_safe(src_id, pa_state); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_scan_delegator_set_pa_state(src_id, pa_state); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -809,7 +972,12 @@ esp_err_t esp_ble_audio_bap_scan_delegator_set_bis_sync_state(uint8_t src_id, return ESP_ERR_INVALID_ARG; } - err = bt_bap_scan_delegator_set_bis_sync_state_safe(src_id, bis_synced); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_scan_delegator_set_bis_sync_state(src_id, bis_synced); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -833,7 +1001,12 @@ esp_err_t esp_ble_audio_bap_scan_delegator_add_src(const esp_ble_audio_bap_scan_ return ESP_ERR_INVALID_ARG; } - ret = bt_bap_scan_delegator_add_src_safe(param); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + ret = bt_bap_scan_delegator_add_src(param); + + bt_le_host_unlock(); + if (ret < 0) { return ESP_FAIL; } @@ -854,7 +1027,12 @@ esp_err_t esp_ble_audio_bap_scan_delegator_mod_src(const esp_ble_audio_bap_scan_ return ESP_ERR_INVALID_ARG; } - err = bt_bap_scan_delegator_mod_src_safe(param); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_scan_delegator_mod_src(param); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -866,7 +1044,12 @@ esp_err_t esp_ble_audio_bap_scan_delegator_rem_src(uint8_t src_id) { int err; - err = bt_bap_scan_delegator_rem_src_safe(src_id); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_scan_delegator_rem_src(src_id); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -882,7 +1065,7 @@ esp_err_t esp_ble_audio_bap_broadcast_assistant_discover(uint16_t conn_handle) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -906,7 +1089,7 @@ esp_err_t esp_ble_audio_bap_broadcast_assistant_scan_start(uint16_t conn_handle, void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -930,7 +1113,7 @@ esp_err_t esp_ble_audio_bap_broadcast_assistant_scan_stop(uint16_t conn_handle) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -956,7 +1139,12 @@ esp_err_t esp_ble_audio_bap_broadcast_assistant_register_cb(esp_ble_audio_bap_br return ESP_ERR_INVALID_ARG; } - err = bt_bap_broadcast_assistant_register_cb_safe(cb); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_broadcast_assistant_register_cb(cb); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -972,7 +1160,12 @@ esp_err_t esp_ble_audio_bap_broadcast_assistant_unregister_cb(esp_ble_audio_bap_ return ESP_ERR_INVALID_ARG; } - err = bt_bap_broadcast_assistant_unregister_cb_safe(cb); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_broadcast_assistant_unregister_cb(cb); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -996,7 +1189,7 @@ esp_err_t esp_ble_audio_bap_broadcast_assistant_add_src(uint16_t conn_handle, return ESP_ERR_INVALID_ARG; } - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -1027,7 +1220,7 @@ esp_err_t esp_ble_audio_bap_broadcast_assistant_mod_src(uint16_t conn_handle, return ESP_ERR_INVALID_ARG; } - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -1056,7 +1249,7 @@ esp_err_t esp_ble_audio_bap_broadcast_assistant_set_broadcast_code(uint16_t conn return ESP_ERR_INVALID_ARG; } - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -1080,7 +1273,7 @@ esp_err_t esp_ble_audio_bap_broadcast_assistant_rem_src(uint16_t conn_handle, ui void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -1104,7 +1297,7 @@ esp_err_t esp_ble_audio_bap_broadcast_assistant_read_recv_state(uint16_t conn_ha void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -1133,7 +1326,12 @@ esp_err_t esp_ble_audio_bap_ep_get_info(const esp_ble_audio_bap_ep_t *ep, return ESP_ERR_INVALID_ARG; } - err = bt_bap_ep_get_info_safe(ep, info); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_ep_get_info(ep, info); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -1148,7 +1346,11 @@ esp_err_t esp_ble_audio_bap_stream_cb_register(esp_ble_audio_bap_stream_t *strea return ESP_ERR_INVALID_ARG; } - bt_bap_stream_cb_register_safe(stream, ops); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + bt_bap_stream_cb_register(stream, ops); + + bt_le_host_unlock(); return ESP_OK; } @@ -1170,7 +1372,12 @@ esp_err_t esp_ble_audio_bap_stream_send(esp_ble_audio_bap_stream_t *stream, return ESP_ERR_INVALID_ARG; } - err = bt_bap_stream_send_safe(stream, &buf, seq_num); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_stream_send(stream, &buf, seq_num); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -1193,7 +1400,12 @@ esp_err_t esp_ble_audio_bap_stream_send_ts(esp_ble_audio_bap_stream_t *stream, return ESP_ERR_INVALID_ARG; } - err = bt_bap_stream_send_ts_safe(stream, &buf, seq_num, ts); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_stream_send_ts(stream, &buf, seq_num, ts); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -1210,7 +1422,12 @@ esp_err_t esp_ble_audio_bap_stream_get_tx_sync(esp_ble_audio_bap_stream_t *strea return ESP_ERR_INVALID_ARG; } - err = bt_bap_stream_get_tx_sync_safe(stream, info); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_bap_stream_get_tx_sync(stream, info); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } diff --git a/components/bt/esp_ble_audio/api/esp_ble_audio_cap_api.c b/components/bt/esp_ble_audio/api/esp_ble_audio_cap_api.c index 7d8647efd10..9c04216b4e7 100644 --- a/components/bt/esp_ble_audio/api/esp_ble_audio_cap_api.c +++ b/components/bt/esp_ble_audio/api/esp_ble_audio_cap_api.c @@ -34,7 +34,12 @@ esp_err_t esp_ble_audio_cap_acceptor_register(const esp_ble_audio_csip_set_membe } #endif /* CONFIG_BT_CSIP_SET_MEMBER_MAX_INSTANCE_COUNT > 1 */ - err = bt_cap_acceptor_register_safe(param, svc_inst); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_cap_acceptor_register(param, svc_inst); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -51,7 +56,11 @@ esp_err_t esp_ble_audio_cap_stream_ops_register(esp_ble_audio_cap_stream_t *stre return ESP_ERR_INVALID_ARG; } - bt_cap_stream_ops_register_safe(stream, ops); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + bt_cap_stream_ops_register(stream, ops); + + bt_le_host_unlock(); return ESP_OK; } @@ -72,7 +81,12 @@ esp_err_t esp_ble_audio_cap_stream_send(esp_ble_audio_cap_stream_t *stream, return ESP_ERR_INVALID_ARG; } - err = bt_cap_stream_send_safe(stream, &buf, seq_num); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_cap_stream_send(stream, &buf, seq_num); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -95,7 +109,12 @@ esp_err_t esp_ble_audio_cap_stream_send_ts(esp_ble_audio_cap_stream_t *stream, return ESP_ERR_INVALID_ARG; } - err = bt_cap_stream_send_ts_safe(stream, &buf, seq_num, ts); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_cap_stream_send_ts(stream, &buf, seq_num, ts); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -112,7 +131,12 @@ esp_err_t esp_ble_audio_cap_stream_get_tx_sync(esp_ble_audio_cap_stream_t *strea return ESP_ERR_INVALID_ARG; } - err = bt_cap_stream_get_tx_sync_safe(stream, info); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_cap_stream_get_tx_sync(stream, info); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -135,7 +159,12 @@ esp_err_t esp_ble_audio_cap_unicast_group_create(const esp_ble_audio_cap_unicast return ESP_ERR_INVALID_ARG; } - err = bt_cap_unicast_group_create_safe(param, unicast_group); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_cap_unicast_group_create(param, unicast_group); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -155,7 +184,12 @@ esp_err_t esp_ble_audio_cap_unicast_group_reconfig(esp_ble_audio_cap_unicast_gro return ESP_ERR_INVALID_ARG; } - err = bt_cap_unicast_group_reconfig_safe(unicast_group, param); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_cap_unicast_group_reconfig(unicast_group, param); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -173,7 +207,12 @@ esp_err_t esp_ble_audio_cap_unicast_group_add_streams(esp_ble_audio_cap_unicast_ return ESP_ERR_INVALID_ARG; } - err = bt_cap_unicast_group_add_streams_safe(unicast_group, params, num_param); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_cap_unicast_group_add_streams(unicast_group, params, num_param); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -189,7 +228,12 @@ esp_err_t esp_ble_audio_cap_unicast_group_delete(esp_ble_audio_cap_unicast_group return ESP_ERR_INVALID_ARG; } - err = bt_cap_unicast_group_delete_safe(unicast_group); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_cap_unicast_group_delete(unicast_group); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -207,7 +251,12 @@ esp_err_t esp_ble_audio_cap_initiator_register_cb(const esp_ble_audio_cap_initia return ESP_ERR_INVALID_ARG; } - err = bt_cap_initiator_register_cb_safe(cb); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_cap_initiator_register_cb(cb); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -223,7 +272,12 @@ esp_err_t esp_ble_audio_cap_initiator_unregister_cb(const esp_ble_audio_cap_init return ESP_ERR_INVALID_ARG; } - err = bt_cap_initiator_unregister_cb_safe(cb); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_cap_initiator_unregister_cb(cb); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -238,7 +292,7 @@ esp_err_t esp_ble_audio_cap_initiator_unicast_discover(uint16_t conn_handle) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -265,7 +319,12 @@ esp_err_t esp_ble_audio_cap_initiator_unicast_audio_start(const esp_ble_audio_ca return ESP_ERR_INVALID_ARG; } - err = bt_cap_initiator_unicast_audio_start_safe(param); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_cap_initiator_unicast_audio_start(param); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -282,7 +341,12 @@ esp_err_t esp_ble_audio_cap_initiator_unicast_audio_update(const esp_ble_audio_c return ESP_ERR_INVALID_ARG; } - err = bt_cap_initiator_unicast_audio_update_safe(param); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_cap_initiator_unicast_audio_update(param); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -299,7 +363,12 @@ esp_err_t esp_ble_audio_cap_initiator_unicast_audio_stop(const esp_ble_audio_cap return ESP_ERR_INVALID_ARG; } - err = bt_cap_initiator_unicast_audio_stop_safe(param); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_cap_initiator_unicast_audio_stop(param); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -311,7 +380,12 @@ esp_err_t esp_ble_audio_cap_initiator_unicast_audio_cancel(void) { int err; - err = bt_cap_initiator_unicast_audio_cancel_safe(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_cap_initiator_unicast_audio_cancel(); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -330,7 +404,12 @@ esp_err_t esp_ble_audio_cap_initiator_broadcast_audio_create(const esp_ble_audio return ESP_ERR_INVALID_ARG; } - err = bt_cap_initiator_broadcast_audio_create_safe(param, broadcast_source); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_cap_initiator_broadcast_audio_create(param, broadcast_source); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -349,7 +428,7 @@ esp_err_t esp_ble_audio_cap_initiator_broadcast_audio_start(esp_ble_audio_cap_br return ESP_ERR_INVALID_ARG; } - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); adv = bt_le_ext_adv_find(adv_handle); if (adv == NULL) { @@ -376,7 +455,12 @@ esp_err_t esp_ble_audio_cap_initiator_broadcast_audio_update(esp_ble_audio_cap_b return ESP_ERR_INVALID_ARG; } - err = bt_cap_initiator_broadcast_audio_update_safe(broadcast_source, meta, meta_len); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_cap_initiator_broadcast_audio_update(broadcast_source, meta, meta_len); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -392,7 +476,12 @@ esp_err_t esp_ble_audio_cap_initiator_broadcast_audio_stop(esp_ble_audio_cap_bro return ESP_ERR_INVALID_ARG; } - err = bt_cap_initiator_broadcast_audio_stop_safe(broadcast_source); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_cap_initiator_broadcast_audio_stop(broadcast_source); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -408,7 +497,12 @@ esp_err_t esp_ble_audio_cap_initiator_broadcast_audio_delete(esp_ble_audio_cap_b return ESP_ERR_INVALID_ARG; } - err = bt_cap_initiator_broadcast_audio_delete_safe(broadcast_source); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_cap_initiator_broadcast_audio_delete(broadcast_source); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -425,7 +519,12 @@ esp_err_t esp_ble_audio_cap_initiator_broadcast_get_base(esp_ble_audio_cap_broad return ESP_ERR_INVALID_ARG; } - err = bt_cap_initiator_broadcast_get_base_safe(broadcast_source, base_buf); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_cap_initiator_broadcast_get_base(broadcast_source, base_buf); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -444,7 +543,12 @@ esp_err_t esp_ble_audio_cap_handover_register_cb(const esp_ble_audio_cap_handove return ESP_ERR_INVALID_ARG; } - err = bt_cap_handover_register_cb_safe(cb); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_cap_handover_register_cb(cb); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -460,7 +564,12 @@ esp_err_t esp_ble_audio_cap_handover_unregister_cb(const esp_ble_audio_cap_hando return ESP_ERR_INVALID_ARG; } - err = bt_cap_handover_unregister_cb_safe(cb); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_cap_handover_unregister_cb(cb); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -481,7 +590,7 @@ esp_err_t esp_ble_audio_cap_handover_unicast_to_broadcast( p = *param; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); p.ext_adv = bt_le_ext_adv_find(p.adv_handle); if (p.ext_adv == NULL) { @@ -508,7 +617,12 @@ esp_err_t esp_ble_audio_cap_handover_broadcast_to_unicast( return ESP_ERR_INVALID_ARG; } - err = bt_cap_handover_broadcast_to_unicast_safe(param); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_cap_handover_broadcast_to_unicast(param); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -526,7 +640,12 @@ esp_err_t esp_ble_audio_cap_commander_register_cb(const esp_ble_audio_cap_comman return ESP_ERR_INVALID_ARG; } - err = bt_cap_commander_register_cb_safe(cb); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_cap_commander_register_cb(cb); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -542,7 +661,12 @@ esp_err_t esp_ble_audio_cap_commander_unregister_cb(const esp_ble_audio_cap_comm return ESP_ERR_INVALID_ARG; } - err = bt_cap_commander_unregister_cb_safe(cb); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_cap_commander_unregister_cb(cb); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -556,7 +680,7 @@ esp_err_t esp_ble_audio_cap_commander_discover(uint16_t conn_handle) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -578,7 +702,12 @@ esp_err_t esp_ble_audio_cap_commander_cancel(void) { int err; - err = bt_cap_commander_cancel_safe(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_cap_commander_cancel(); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -597,7 +726,12 @@ esp_err_t esp_ble_audio_cap_commander_broadcast_reception_start( return ESP_ERR_INVALID_ARG; } - err = bt_cap_commander_broadcast_reception_start_safe(param); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_cap_commander_broadcast_reception_start(param); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -615,7 +749,12 @@ esp_err_t esp_ble_audio_cap_commander_broadcast_reception_stop( return ESP_ERR_INVALID_ARG; } - err = bt_cap_commander_broadcast_reception_stop_safe(param); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_cap_commander_broadcast_reception_stop(param); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -633,7 +772,12 @@ esp_err_t esp_ble_audio_cap_commander_distribute_broadcast_code( return ESP_ERR_INVALID_ARG; } - err = bt_cap_commander_distribute_broadcast_code_safe(param); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_cap_commander_distribute_broadcast_code(param); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -653,7 +797,12 @@ esp_err_t esp_ble_audio_cap_commander_change_volume( return ESP_ERR_INVALID_ARG; } - err = bt_cap_commander_change_volume_safe(param); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_cap_commander_change_volume(param); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -672,7 +821,12 @@ esp_err_t esp_ble_audio_cap_commander_change_volume_offset( return ESP_ERR_INVALID_ARG; } - err = bt_cap_commander_change_volume_offset_safe(param); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_cap_commander_change_volume_offset(param); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -691,7 +845,12 @@ esp_err_t esp_ble_audio_cap_commander_change_volume_mute_state( return ESP_ERR_INVALID_ARG; } - err = bt_cap_commander_change_volume_mute_state_safe(param); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_cap_commander_change_volume_mute_state(param); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -711,7 +870,12 @@ esp_err_t esp_ble_audio_cap_commander_change_microphone_mute_state( return ESP_ERR_INVALID_ARG; } - err = bt_cap_commander_change_microphone_mute_state_safe(param); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_cap_commander_change_microphone_mute_state(param); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -730,7 +894,12 @@ esp_err_t esp_ble_audio_cap_commander_change_microphone_gain_setting( return ESP_ERR_INVALID_ARG; } - err = bt_cap_commander_change_microphone_gain_setting_safe(param); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_cap_commander_change_microphone_gain_setting(param); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } diff --git a/components/bt/esp_ble_audio/api/esp_ble_audio_ccp_api.c b/components/bt/esp_ble_audio/api/esp_ble_audio_ccp_api.c index e527c273283..302a0ce1ffd 100644 --- a/components/bt/esp_ble_audio/api/esp_ble_audio_ccp_api.c +++ b/components/bt/esp_ble_audio/api/esp_ble_audio_ccp_api.c @@ -18,7 +18,12 @@ esp_err_t esp_ble_audio_ccp_call_control_server_register_bearer( return ESP_ERR_INVALID_ARG; } - err = bt_ccp_call_control_server_register_bearer_safe(param, bearer); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_ccp_call_control_server_register_bearer(param, bearer); + + bt_le_host_unlock(); + if (err) { /* Map Zephyr error codes to ESP-IDF error codes */ switch (err) { @@ -47,7 +52,12 @@ esp_err_t esp_ble_audio_ccp_call_control_server_unregister_bearer( return ESP_ERR_INVALID_ARG; } - err = bt_ccp_call_control_server_unregister_bearer_safe(bearer); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_ccp_call_control_server_unregister_bearer(bearer); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -64,7 +74,12 @@ esp_err_t esp_ble_audio_ccp_call_control_server_set_bearer_provider_name( return ESP_ERR_INVALID_ARG; } - err = bt_ccp_call_control_server_set_bearer_provider_name_safe(bearer, name); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_ccp_call_control_server_set_bearer_provider_name(bearer, name); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -81,7 +96,12 @@ esp_err_t esp_ble_audio_ccp_call_control_server_get_bearer_provider_name( return ESP_ERR_INVALID_ARG; } - err = bt_ccp_call_control_server_get_bearer_provider_name_safe(bearer, name, name_size); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_ccp_call_control_server_get_bearer_provider_name(bearer, name, name_size); + + bt_le_host_unlock(); + if (err) { switch (err) { case -EFAULT: @@ -105,7 +125,12 @@ esp_err_t esp_ble_audio_ccp_call_control_server_get_bearer_uci( return ESP_ERR_INVALID_ARG; } - err = bt_ccp_call_control_server_get_bearer_uci_safe(bearer, uci); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_ccp_call_control_server_get_bearer_uci(bearer, uci); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -124,7 +149,12 @@ esp_err_t esp_ble_audio_ccp_call_control_client_discover( return ESP_ERR_INVALID_ARG; } - err = bt_ccp_call_control_client_discover_safe(conn, out_client); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_ccp_call_control_client_discover(conn, out_client); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -141,7 +171,12 @@ esp_err_t esp_ble_audio_ccp_call_control_client_register_cb( return ESP_ERR_INVALID_ARG; } - err = bt_ccp_call_control_client_register_cb_safe(cb); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_ccp_call_control_client_register_cb(cb); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -158,7 +193,12 @@ esp_err_t esp_ble_audio_ccp_call_control_client_unregister_cb( return ESP_ERR_INVALID_ARG; } - err = bt_ccp_call_control_client_unregister_cb_safe(cb); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_ccp_call_control_client_unregister_cb(cb); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -176,7 +216,12 @@ esp_err_t esp_ble_audio_ccp_call_control_client_get_bearers( return ESP_ERR_INVALID_ARG; } - err = bt_ccp_call_control_client_get_bearers_safe(client, bearers); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_ccp_call_control_client_get_bearers(client, bearers); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -195,7 +240,12 @@ esp_err_t esp_ble_audio_ccp_call_control_client_read_bearer_provider_name( return ESP_ERR_INVALID_ARG; } - err = bt_ccp_call_control_client_read_bearer_provider_name_safe(bearer); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_ccp_call_control_client_read_bearer_provider_name(bearer); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } diff --git a/components/bt/esp_ble_audio/api/esp_ble_audio_common_api.c b/components/bt/esp_ble_audio/api/esp_ble_audio_common_api.c index 5551a89b798..324fff1981c 100644 --- a/components/bt/esp_ble_audio/api/esp_ble_audio_common_api.c +++ b/components/bt/esp_ble_audio/api/esp_ble_audio_common_api.c @@ -57,7 +57,12 @@ esp_err_t esp_ble_audio_gattc_disc_start(uint16_t conn_handle) { int err; - err = bt_gattc_disc_start_safe(conn_handle); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_gattc_disc_start(conn_handle); + + bt_le_host_unlock(); + /* -EALREADY means disc already in progress for this conn (e.g. peer sent * MTU exchange twice triggering two gatt_mtu_change events). The * caller's goal is already true, treat as success. @@ -112,7 +117,19 @@ esp_err_t esp_ble_audio_common_init(esp_ble_audio_init_info_t *info) goto unregister_gatt; } + /* bt_le_host_init() creates iso_task last, so it runs unlocked; audio_init + * runs with the task already alive, appending to conn_cbs and filling the + * lib's ext_cfgs/ext_funcs - both read under this mutex. One lock for the + * whole sequence so the task never sees a half-registered service table. */ + if (bt_le_host_lock_timeout() != 0) { + bt_le_host_deinit(); + goto unregister_gatt; + } + err = bt_le_audio_init(); + + bt_le_host_unlock(); + if (err) { bt_le_host_deinit(); goto unregister_gatt; @@ -201,7 +218,14 @@ esp_err_t esp_ble_audio_common_start(esp_ble_audio_start_info_t *info) #endif /* CONFIG_BT_CSIP_SET_MEMBER */ } + /* One lock for the whole start rather than one per service registration: + * iso_task must not see a half-registered GATT table. See common_init. */ + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + err = bt_le_audio_start(info); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } diff --git a/components/bt/esp_ble_audio/api/esp_ble_audio_csip_api.c b/components/bt/esp_ble_audio/api/esp_ble_audio_csip_api.c index 5113de49269..e3a236fa8a4 100644 --- a/components/bt/esp_ble_audio/api/esp_ble_audio_csip_api.c +++ b/components/bt/esp_ble_audio/api/esp_ble_audio_csip_api.c @@ -10,11 +10,19 @@ #if CONFIG_BT_CSIP_SET_MEMBER void *esp_ble_audio_csip_set_member_svc_decl_get(const esp_ble_audio_csip_set_member_svc_inst_t *svc_inst) { + void *decl; + if (svc_inst == NULL) { return NULL; } - return bt_csip_set_member_svc_decl_get_safe(svc_inst); + BT_LE_HOST_LOCK_OR_RETURN(NULL); + + decl = bt_csip_set_member_svc_decl_get(svc_inst); + + bt_le_host_unlock(); + + return decl; } esp_err_t esp_ble_audio_csip_set_member_register(const esp_ble_audio_csip_set_member_register_param_t *param, @@ -43,7 +51,12 @@ esp_err_t esp_ble_audio_csip_set_member_register(const esp_ble_audio_csip_set_me } #endif /* CONFIG_BT_CSIP_SET_MEMBER_MAX_INSTANCE_COUNT > 1 */ - err = bt_csip_set_member_register_safe(param, svc_inst); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_csip_set_member_register(param, svc_inst); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -63,7 +76,12 @@ esp_err_t esp_ble_audio_csip_set_member_unregister(esp_ble_audio_csip_set_member return ESP_FAIL; } - err = bt_csip_set_member_unregister_safe(svc_inst); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_csip_set_member_unregister(svc_inst); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -80,7 +98,12 @@ esp_err_t esp_ble_audio_csip_set_member_sirk(esp_ble_audio_csip_set_member_svc_i return ESP_ERR_INVALID_ARG; } - err = bt_csip_set_member_sirk_safe(svc_inst, sirk); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_csip_set_member_sirk(svc_inst, sirk); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -97,7 +120,12 @@ esp_err_t esp_ble_audio_csip_set_member_set_size_and_rank(esp_ble_audio_csip_set return ESP_ERR_INVALID_ARG; } - err = bt_csip_set_member_set_size_and_rank_safe(svc_inst, size, rank); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_csip_set_member_set_size_and_rank(svc_inst, size, rank); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -115,7 +143,12 @@ esp_err_t esp_ble_audio_csip_set_member_set_name(esp_ble_audio_csip_set_member_s return ESP_ERR_INVALID_ARG; } - err = bt_csip_set_member_set_name_safe(svc_inst, name, len); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_csip_set_member_set_name(svc_inst, name, len); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -132,7 +165,12 @@ esp_err_t esp_ble_audio_csip_set_member_get_info(const esp_ble_audio_csip_set_me return ESP_ERR_INVALID_ARG; } - err = bt_csip_set_member_get_info_safe(svc_inst, info); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_csip_set_member_get_info(svc_inst, info); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -149,7 +187,12 @@ esp_err_t esp_ble_audio_csip_set_member_generate_rsi(const esp_ble_audio_csip_se return ESP_ERR_INVALID_ARG; } - err = bt_csip_set_member_generate_rsi_safe(svc_inst, rsi); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_csip_set_member_generate_rsi(svc_inst, rsi); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -166,7 +209,12 @@ esp_err_t esp_ble_audio_csip_set_member_lock(esp_ble_audio_csip_set_member_svc_i return ESP_ERR_INVALID_ARG; } - err = bt_csip_set_member_lock_safe(svc_inst, lock, force); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_csip_set_member_lock(svc_inst, lock, force); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -182,7 +230,7 @@ esp_err_t esp_ble_audio_csip_set_coordinator_discover(uint16_t conn_handle) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -206,7 +254,7 @@ esp_ble_audio_csip_set_coordinator_set_member_by_conn(uint16_t conn_handle) esp_ble_audio_csip_set_coordinator_set_member_t *ret = NULL; void *conn; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(NULL); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -228,13 +276,20 @@ bool esp_ble_audio_csip_set_coordinator_is_set_member(const uint8_t sirk[ESP_BLE .data = data, .data_len = data_len, }; + bool is_member; if (sirk == NULL || data_type != BT_DATA_CSIS_RSI || data == NULL || data_len != ESP_BLE_AUDIO_CSIP_RSI_SIZE) { return false; } - return bt_csip_set_coordinator_is_set_member_safe(sirk, &ad); + BT_LE_HOST_LOCK_OR_RETURN(false); + + is_member = bt_csip_set_coordinator_is_set_member(sirk, &ad); + + bt_le_host_unlock(); + + return is_member; } esp_err_t esp_ble_audio_csip_set_coordinator_register_cb(esp_ble_audio_csip_set_coordinator_cb_t *cb) @@ -245,7 +300,12 @@ esp_err_t esp_ble_audio_csip_set_coordinator_register_cb(esp_ble_audio_csip_set_ return ESP_ERR_INVALID_ARG; } - err = bt_csip_set_coordinator_register_cb_safe(cb); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_csip_set_coordinator_register_cb(cb); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -266,7 +326,12 @@ esp_err_t esp_ble_audio_csip_set_coordinator_ordered_access(const esp_ble_audio_ return ESP_ERR_INVALID_ARG; } - err = bt_csip_set_coordinator_ordered_access_safe(members, count, set_info, cb); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_csip_set_coordinator_ordered_access(members, count, set_info, cb); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -284,7 +349,12 @@ esp_err_t esp_ble_audio_csip_set_coordinator_lock(const esp_ble_audio_csip_set_c return ESP_ERR_INVALID_ARG; } - err = bt_csip_set_coordinator_lock_safe(members, count, set_info); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_csip_set_coordinator_lock(members, count, set_info); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -302,7 +372,12 @@ esp_err_t esp_ble_audio_csip_set_coordinator_release(const esp_ble_audio_csip_se return ESP_ERR_INVALID_ARG; } - err = bt_csip_set_coordinator_release_safe(members, count, set_info); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_csip_set_coordinator_release(members, count, set_info); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } diff --git a/components/bt/esp_ble_audio/api/esp_ble_audio_gmap_api.c b/components/bt/esp_ble_audio/api/esp_ble_audio_gmap_api.c index 2fc423fb131..fb7475e12a1 100644 --- a/components/bt/esp_ble_audio/api/esp_ble_audio_gmap_api.c +++ b/components/bt/esp_ble_audio/api/esp_ble_audio_gmap_api.c @@ -16,7 +16,12 @@ esp_err_t esp_ble_audio_gmap_cb_register(const esp_ble_audio_gmap_cb_t *cb) return ESP_ERR_INVALID_ARG; } - err = bt_gmap_cb_register_safe(cb); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_gmap_cb_register(cb); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -30,7 +35,7 @@ esp_err_t esp_ble_audio_gmap_discover(uint16_t conn_handle) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -243,7 +248,12 @@ esp_err_t esp_ble_audio_gmap_register(esp_ble_audio_gmap_role_t role, return ESP_ERR_INVALID_ARG; } - err = bt_gmap_register_safe(role, features); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_gmap_register(role, features); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -261,7 +271,12 @@ esp_err_t esp_ble_audio_gmap_set_role(esp_ble_audio_gmap_role_t role, return ESP_ERR_INVALID_ARG; } - err = bt_gmap_set_role_safe(role, features); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_gmap_set_role(role, features); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } diff --git a/components/bt/esp_ble_audio/api/esp_ble_audio_has_api.c b/components/bt/esp_ble_audio/api/esp_ble_audio_has_api.c index 331be5b9703..f84decbd8ac 100644 --- a/components/bt/esp_ble_audio/api/esp_ble_audio_has_api.c +++ b/components/bt/esp_ble_audio/api/esp_ble_audio_has_api.c @@ -17,7 +17,12 @@ esp_err_t esp_ble_audio_has_client_cb_register(const esp_ble_audio_has_client_cb return ESP_ERR_INVALID_ARG; } - err = bt_has_client_cb_register_safe(cb); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_has_client_cb_register(cb); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -31,7 +36,7 @@ esp_err_t esp_ble_audio_has_client_discover(uint16_t conn_handle) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -61,7 +66,12 @@ esp_err_t esp_ble_audio_has_client_presets_read(esp_ble_audio_has_t *has, return ESP_ERR_INVALID_ARG; } - err = bt_has_client_presets_read_safe(has, index, max_count); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_has_client_presets_read(has, index, max_count); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -78,7 +88,12 @@ esp_err_t esp_ble_audio_has_client_preset_set(esp_ble_audio_has_t *has, return ESP_ERR_INVALID_ARG; } - err = bt_has_client_preset_set_safe(has, index, sync); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_has_client_preset_set(has, index, sync); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -100,7 +115,12 @@ esp_err_t esp_ble_audio_has_client_preset_name_write(esp_ble_audio_has_t *has, return ESP_ERR_INVALID_ARG; } - err = bt_has_client_preset_name_write_safe(has, index, name); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_has_client_preset_name_write(has, index, name); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -116,7 +136,12 @@ esp_err_t esp_ble_audio_has_client_preset_next(esp_ble_audio_has_t *has, bool sy return ESP_ERR_INVALID_ARG; } - err = bt_has_client_preset_next_safe(has, sync); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_has_client_preset_next(has, sync); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -132,7 +157,12 @@ esp_err_t esp_ble_audio_has_client_preset_prev(esp_ble_audio_has_t *has, bool sy return ESP_ERR_INVALID_ARG; } - err = bt_has_client_preset_prev_safe(has, sync); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_has_client_preset_prev(has, sync); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -151,7 +181,7 @@ esp_err_t esp_ble_audio_has_register(const esp_ble_audio_has_features_param_t *f return ESP_ERR_INVALID_ARG; } - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); err = bt_has_register(features); if (err) { @@ -197,7 +227,12 @@ esp_err_t esp_ble_audio_has_preset_register(const esp_ble_audio_has_preset_regis return ESP_ERR_INVALID_ARG; } - err = bt_has_preset_register_safe(param); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_has_preset_register(param); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -213,7 +248,12 @@ esp_err_t esp_ble_audio_has_preset_unregister(uint8_t index) return ESP_ERR_INVALID_ARG; } - err = bt_has_preset_unregister_safe(index); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_has_preset_unregister(index); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -229,7 +269,12 @@ esp_err_t esp_ble_audio_has_preset_available(uint8_t index) return ESP_ERR_INVALID_ARG; } - err = bt_has_preset_available_safe(index); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_has_preset_available(index); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -245,7 +290,12 @@ esp_err_t esp_ble_audio_has_preset_unavailable(uint8_t index) return ESP_ERR_INVALID_ARG; } - err = bt_has_preset_unavailable_safe(index); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_has_preset_unavailable(index); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -257,7 +307,12 @@ esp_err_t esp_ble_audio_has_preset_active_set(uint8_t index) { int err; - err = bt_has_preset_active_set_safe(index); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_has_preset_active_set(index); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -267,7 +322,15 @@ esp_err_t esp_ble_audio_has_preset_active_set(uint8_t index) uint8_t esp_ble_audio_has_preset_active_get(void) { - return bt_has_preset_active_get_safe(); + uint8_t index; + + BT_LE_HOST_LOCK_OR_RETURN(ESP_BLE_AUDIO_HAS_PRESET_INDEX_NONE); + + index = bt_has_preset_active_get(); + + bt_le_host_unlock(); + + return index; } esp_err_t esp_ble_audio_has_preset_name_change(uint8_t index, const char *name) @@ -283,7 +346,12 @@ esp_err_t esp_ble_audio_has_preset_name_change(uint8_t index, const char *name) return ESP_ERR_INVALID_ARG; } - err = bt_has_preset_name_change_safe(index, name); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_has_preset_name_change(index, name); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -299,7 +367,12 @@ esp_err_t esp_ble_audio_has_features_set(const esp_ble_audio_has_features_param_ return ESP_ERR_INVALID_ARG; } - err = bt_has_features_set_safe(features); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_has_features_set(features); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } diff --git a/components/bt/esp_ble_audio/api/esp_ble_audio_mcc_api.c b/components/bt/esp_ble_audio/api/esp_ble_audio_mcc_api.c index 7a743374115..94352389331 100644 --- a/components/bt/esp_ble_audio/api/esp_ble_audio_mcc_api.c +++ b/components/bt/esp_ble_audio/api/esp_ble_audio_mcc_api.c @@ -13,7 +13,12 @@ esp_err_t esp_ble_audio_mcc_init(esp_ble_audio_mcc_cb_t *cb) { int err; - err = bt_mcc_init_safe(cb); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_mcc_init(cb); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -27,7 +32,7 @@ esp_err_t esp_ble_audio_mcc_discover_mcs(uint16_t conn_handle, bool subscribe) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -51,7 +56,7 @@ esp_err_t esp_ble_audio_mcc_read_player_name(uint16_t conn_handle) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -76,7 +81,7 @@ esp_err_t esp_ble_audio_mcc_read_icon_url(uint16_t conn_handle) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -102,7 +107,7 @@ esp_err_t esp_ble_audio_mcc_read_track_title(uint16_t conn_handle) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -128,7 +133,7 @@ esp_err_t esp_ble_audio_mcc_read_track_duration(uint16_t conn_handle) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -154,7 +159,7 @@ esp_err_t esp_ble_audio_mcc_read_track_position(uint16_t conn_handle) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -180,7 +185,7 @@ esp_err_t esp_ble_audio_mcc_set_track_position(uint16_t conn_handle, int32_t pos void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -206,7 +211,7 @@ esp_err_t esp_ble_audio_mcc_read_playback_speed(uint16_t conn_handle) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -232,7 +237,7 @@ esp_err_t esp_ble_audio_mcc_set_playback_speed(uint16_t conn_handle, int8_t spee void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -258,7 +263,7 @@ esp_err_t esp_ble_audio_mcc_read_seeking_speed(uint16_t conn_handle) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -284,7 +289,7 @@ esp_err_t esp_ble_audio_mcc_read_playing_order(uint16_t conn_handle) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -310,7 +315,7 @@ esp_err_t esp_ble_audio_mcc_set_playing_order(uint16_t conn_handle, uint8_t orde void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -336,7 +341,7 @@ esp_err_t esp_ble_audio_mcc_read_playing_orders_supported(uint16_t conn_handle) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -362,7 +367,7 @@ esp_err_t esp_ble_audio_mcc_read_media_state(uint16_t conn_handle) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -400,7 +405,7 @@ esp_err_t esp_ble_audio_mcc_send_cmd(uint16_t conn_handle, return ESP_ERR_INVALID_ARG; } - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -426,7 +431,7 @@ esp_err_t esp_ble_audio_mcc_read_opcodes_supported(uint16_t conn_handle) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -452,7 +457,7 @@ esp_err_t esp_ble_audio_mcc_read_content_control_id(uint16_t conn_handle) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -478,7 +483,7 @@ esp_err_t esp_ble_audio_mcc_read_icon_obj_id(uint16_t conn_handle) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -502,7 +507,7 @@ esp_err_t esp_ble_audio_mcc_read_segments_obj_id(uint16_t conn_handle) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -526,7 +531,7 @@ esp_err_t esp_ble_audio_mcc_read_current_track_obj_id(uint16_t conn_handle) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -554,7 +559,7 @@ esp_err_t esp_ble_audio_mcc_set_current_track_obj_id(uint16_t conn_handle, uint6 return ESP_ERR_INVALID_ARG; } - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -578,7 +583,7 @@ esp_err_t esp_ble_audio_mcc_read_next_track_obj_id(uint16_t conn_handle) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -606,7 +611,7 @@ esp_err_t esp_ble_audio_mcc_set_next_track_obj_id(uint16_t conn_handle, uint64_t return ESP_ERR_INVALID_ARG; } - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -630,7 +635,7 @@ esp_err_t esp_ble_audio_mcc_read_current_group_obj_id(uint16_t conn_handle) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -658,7 +663,7 @@ esp_err_t esp_ble_audio_mcc_set_current_group_obj_id(uint16_t conn_handle, uint6 return ESP_ERR_INVALID_ARG; } - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -682,7 +687,7 @@ esp_err_t esp_ble_audio_mcc_read_parent_group_obj_id(uint16_t conn_handle) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -713,7 +718,7 @@ esp_err_t esp_ble_audio_mcc_send_search(uint16_t conn_handle, return ESP_ERR_INVALID_ARG; } - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -737,7 +742,7 @@ esp_err_t esp_ble_audio_mcc_read_search_results_obj_id(uint16_t conn_handle) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -761,7 +766,7 @@ esp_err_t esp_ble_audio_mcc_otc_read_object_metadata(uint16_t conn_handle) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -785,7 +790,7 @@ esp_err_t esp_ble_audio_mcc_otc_read_icon_object(uint16_t conn_handle) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -809,7 +814,7 @@ esp_err_t esp_ble_audio_mcc_otc_read_track_segments_object(uint16_t conn_handle) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -833,7 +838,7 @@ esp_err_t esp_ble_audio_mcc_otc_read_current_track_object(uint16_t conn_handle) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -857,7 +862,7 @@ esp_err_t esp_ble_audio_mcc_otc_read_next_track_object(uint16_t conn_handle) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -881,7 +886,7 @@ esp_err_t esp_ble_audio_mcc_otc_read_current_group_object(uint16_t conn_handle) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -905,7 +910,7 @@ esp_err_t esp_ble_audio_mcc_otc_read_parent_group_object(uint16_t conn_handle) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -929,7 +934,7 @@ struct bt_ots_client *esp_ble_audio_mcc_otc_inst(uint16_t conn_handle) struct bt_ots_client *ret = NULL; void *conn; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(NULL); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { diff --git a/components/bt/esp_ble_audio/api/esp_ble_audio_media_proxy_api.c b/components/bt/esp_ble_audio/api/esp_ble_audio_media_proxy_api.c index c1629079fa0..9e3fd66f004 100644 --- a/components/bt/esp_ble_audio/api/esp_ble_audio_media_proxy_api.c +++ b/components/bt/esp_ble_audio/api/esp_ble_audio_media_proxy_api.c @@ -19,7 +19,12 @@ esp_err_t esp_ble_audio_media_proxy_ctrl_register(esp_ble_audio_media_proxy_ctrl return ESP_ERR_INVALID_ARG; } - err = bt_media_proxy_ctrl_register_safe(ctrl_cbs); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_media_proxy_ctrl_register(ctrl_cbs); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -35,7 +40,7 @@ esp_err_t esp_ble_audio_media_proxy_ctrl_discover_player(uint16_t conn_handle) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -63,7 +68,12 @@ esp_err_t esp_ble_audio_media_proxy_ctrl_get_player_name(esp_ble_audio_media_pla return ESP_ERR_INVALID_ARG; } - err = bt_media_proxy_ctrl_get_player_name_safe(player); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_media_proxy_ctrl_get_player_name(player); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -79,7 +89,12 @@ esp_err_t esp_ble_audio_media_proxy_ctrl_get_icon_id(esp_ble_audio_media_player_ return ESP_ERR_INVALID_ARG; } - err = bt_media_proxy_ctrl_get_icon_id_safe(player); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_media_proxy_ctrl_get_icon_id(player); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -95,7 +110,12 @@ esp_err_t esp_ble_audio_media_proxy_ctrl_get_icon_url(esp_ble_audio_media_player return ESP_ERR_INVALID_ARG; } - err = bt_media_proxy_ctrl_get_icon_url_safe(player); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_media_proxy_ctrl_get_icon_url(player); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -111,7 +131,12 @@ esp_err_t esp_ble_audio_media_proxy_ctrl_get_track_title(esp_ble_audio_media_pla return ESP_ERR_INVALID_ARG; } - err = bt_media_proxy_ctrl_get_track_title_safe(player); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_media_proxy_ctrl_get_track_title(player); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -127,7 +152,12 @@ esp_err_t esp_ble_audio_media_proxy_ctrl_get_track_duration(esp_ble_audio_media_ return ESP_ERR_INVALID_ARG; } - err = bt_media_proxy_ctrl_get_track_duration_safe(player); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_media_proxy_ctrl_get_track_duration(player); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -143,7 +173,12 @@ esp_err_t esp_ble_audio_media_proxy_ctrl_get_track_position(esp_ble_audio_media_ return ESP_ERR_INVALID_ARG; } - err = bt_media_proxy_ctrl_get_track_position_safe(player); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_media_proxy_ctrl_get_track_position(player); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -160,7 +195,12 @@ esp_err_t esp_ble_audio_media_proxy_ctrl_set_track_position(esp_ble_audio_media_ return ESP_ERR_INVALID_ARG; } - err = bt_media_proxy_ctrl_set_track_position_safe(player, position); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_media_proxy_ctrl_set_track_position(player, position); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -176,7 +216,12 @@ esp_err_t esp_ble_audio_media_proxy_ctrl_get_playback_speed(esp_ble_audio_media_ return ESP_ERR_INVALID_ARG; } - err = bt_media_proxy_ctrl_get_playback_speed_safe(player); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_media_proxy_ctrl_get_playback_speed(player); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -193,7 +238,12 @@ esp_err_t esp_ble_audio_media_proxy_ctrl_set_playback_speed(esp_ble_audio_media_ return ESP_ERR_INVALID_ARG; } - err = bt_media_proxy_ctrl_set_playback_speed_safe(player, speed); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_media_proxy_ctrl_set_playback_speed(player, speed); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -209,7 +259,12 @@ esp_err_t esp_ble_audio_media_proxy_ctrl_get_seeking_speed(esp_ble_audio_media_p return ESP_ERR_INVALID_ARG; } - err = bt_media_proxy_ctrl_get_seeking_speed_safe(player); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_media_proxy_ctrl_get_seeking_speed(player); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -225,7 +280,12 @@ esp_err_t esp_ble_audio_media_proxy_ctrl_get_track_segments_id(esp_ble_audio_med return ESP_ERR_INVALID_ARG; } - err = bt_media_proxy_ctrl_get_track_segments_id_safe(player); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_media_proxy_ctrl_get_track_segments_id(player); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -241,7 +301,12 @@ esp_err_t esp_ble_audio_media_proxy_ctrl_get_current_track_id(esp_ble_audio_medi return ESP_ERR_INVALID_ARG; } - err = bt_media_proxy_ctrl_get_current_track_id_safe(player); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_media_proxy_ctrl_get_current_track_id(player); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -259,7 +324,12 @@ esp_err_t esp_ble_audio_media_proxy_ctrl_set_current_track_id(esp_ble_audio_medi return ESP_ERR_INVALID_ARG; } - err = bt_media_proxy_ctrl_set_current_track_id_safe(player, id); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_media_proxy_ctrl_set_current_track_id(player, id); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -275,7 +345,12 @@ esp_err_t esp_ble_audio_media_proxy_ctrl_get_next_track_id(esp_ble_audio_media_p return ESP_ERR_INVALID_ARG; } - err = bt_media_proxy_ctrl_get_next_track_id_safe(player); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_media_proxy_ctrl_get_next_track_id(player); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -293,7 +368,12 @@ esp_err_t esp_ble_audio_media_proxy_ctrl_set_next_track_id(esp_ble_audio_media_p return ESP_ERR_INVALID_ARG; } - err = bt_media_proxy_ctrl_set_next_track_id_safe(player, id); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_media_proxy_ctrl_set_next_track_id(player, id); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -309,7 +389,12 @@ esp_err_t esp_ble_audio_media_proxy_ctrl_get_parent_group_id(esp_ble_audio_media return ESP_ERR_INVALID_ARG; } - err = bt_media_proxy_ctrl_get_parent_group_id_safe(player); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_media_proxy_ctrl_get_parent_group_id(player); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -325,7 +410,12 @@ esp_err_t esp_ble_audio_media_proxy_ctrl_get_current_group_id(esp_ble_audio_medi return ESP_ERR_INVALID_ARG; } - err = bt_media_proxy_ctrl_get_current_group_id_safe(player); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_media_proxy_ctrl_get_current_group_id(player); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -343,7 +433,12 @@ esp_err_t esp_ble_audio_media_proxy_ctrl_set_current_group_id(esp_ble_audio_medi return ESP_ERR_INVALID_ARG; } - err = bt_media_proxy_ctrl_set_current_group_id_safe(player, id); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_media_proxy_ctrl_set_current_group_id(player, id); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -359,7 +454,12 @@ esp_err_t esp_ble_audio_media_proxy_ctrl_get_playing_order(esp_ble_audio_media_p return ESP_ERR_INVALID_ARG; } - err = bt_media_proxy_ctrl_get_playing_order_safe(player); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_media_proxy_ctrl_get_playing_order(player); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -376,7 +476,12 @@ esp_err_t esp_ble_audio_media_proxy_ctrl_set_playing_order(esp_ble_audio_media_p return ESP_ERR_INVALID_ARG; } - err = bt_media_proxy_ctrl_set_playing_order_safe(player, order); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_media_proxy_ctrl_set_playing_order(player, order); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -392,7 +497,12 @@ esp_err_t esp_ble_audio_media_proxy_ctrl_get_playing_orders_supported(esp_ble_au return ESP_ERR_INVALID_ARG; } - err = bt_media_proxy_ctrl_get_playing_orders_supported_safe(player); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_media_proxy_ctrl_get_playing_orders_supported(player); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -408,7 +518,12 @@ esp_err_t esp_ble_audio_media_proxy_ctrl_get_media_state(esp_ble_audio_media_pla return ESP_ERR_INVALID_ARG; } - err = bt_media_proxy_ctrl_get_media_state_safe(player); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_media_proxy_ctrl_get_media_state(player); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -432,7 +547,12 @@ esp_err_t esp_ble_audio_media_proxy_ctrl_send_command(esp_ble_audio_media_player return ESP_ERR_INVALID_ARG; } - err = bt_media_proxy_ctrl_send_command_safe(player, command); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_media_proxy_ctrl_send_command(player, command); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -448,7 +568,12 @@ esp_err_t esp_ble_audio_media_proxy_ctrl_get_commands_supported(esp_ble_audio_me return ESP_ERR_INVALID_ARG; } - err = bt_media_proxy_ctrl_get_commands_supported_safe(player); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_media_proxy_ctrl_get_commands_supported(player); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -467,7 +592,12 @@ esp_err_t esp_ble_audio_media_proxy_ctrl_send_search(esp_ble_audio_media_player_ return ESP_ERR_INVALID_ARG; } - err = bt_media_proxy_ctrl_send_search_safe(player, search); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_media_proxy_ctrl_send_search(player, search); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -483,7 +613,12 @@ esp_err_t esp_ble_audio_media_proxy_ctrl_get_search_results_id(esp_ble_audio_med return ESP_ERR_INVALID_ARG; } - err = bt_media_proxy_ctrl_get_search_results_id_safe(player); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_media_proxy_ctrl_get_search_results_id(player); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -499,7 +634,12 @@ esp_err_t esp_ble_audio_media_proxy_ctrl_get_content_ctrl_id(esp_ble_audio_media return ESP_ERR_INVALID_ARG; } - err = bt_media_proxy_ctrl_get_content_ctrl_id_safe(player); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_media_proxy_ctrl_get_content_ctrl_id(player); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -561,7 +701,12 @@ esp_err_t esp_ble_audio_media_proxy_pl_register(esp_ble_audio_media_proxy_pl_cal return ESP_ERR_INVALID_ARG; } - err = bt_media_proxy_pl_register_safe(pl_calls); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_media_proxy_pl_register(pl_calls); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -574,7 +719,7 @@ esp_err_t esp_ble_audio_media_proxy_pl_init(void) esp_err_t ret = ESP_OK; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); err = bt_media_proxy_pl_init(); if (err) { @@ -606,7 +751,12 @@ esp_err_t esp_ble_audio_media_proxy_pl_set_player_name(char *name) return ESP_ERR_INVALID_ARG; } - err = bt_media_proxy_pl_set_player_name_safe(name); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_media_proxy_pl_set_player_name(name); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -622,7 +772,12 @@ esp_err_t esp_ble_audio_media_proxy_pl_set_track_title(char *title) return ESP_ERR_INVALID_ARG; } - err = bt_media_proxy_pl_set_track_title_safe(title); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_media_proxy_pl_set_track_title(title); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -634,6 +789,14 @@ esp_err_t esp_ble_audio_media_proxy_pl_set_track_title(char *title) #if CONFIG_BT_MCS && CONFIG_BT_OTS struct bt_ots *esp_ble_audio_mcs_get_ots(void) { - return bt_mcs_get_ots_safe(); + struct bt_ots *ots; + + BT_LE_HOST_LOCK_OR_RETURN(NULL); + + ots = lib_mcs_get_ots(); + + bt_le_host_unlock(); + + return ots; } #endif /* CONFIG_BT_MCS && CONFIG_BT_OTS */ diff --git a/components/bt/esp_ble_audio/api/esp_ble_audio_micp_api.c b/components/bt/esp_ble_audio/api/esp_ble_audio_micp_api.c index b7b26162037..ddab082a39b 100644 --- a/components/bt/esp_ble_audio/api/esp_ble_audio_micp_api.c +++ b/components/bt/esp_ble_audio/api/esp_ble_audio_micp_api.c @@ -18,7 +18,7 @@ esp_err_t esp_ble_audio_micp_mic_dev_register(esp_ble_audio_micp_mic_dev_registe return ESP_ERR_INVALID_ARG; } - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); err = bt_micp_mic_dev_register(param); if (err) { @@ -50,7 +50,12 @@ esp_err_t esp_ble_audio_micp_mic_dev_included_get(esp_ble_audio_micp_included_t return ESP_ERR_INVALID_ARG; } - err = bt_micp_mic_dev_included_get_safe(included); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_micp_mic_dev_included_get(included); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -62,7 +67,12 @@ esp_err_t esp_ble_audio_micp_mic_dev_unmute(void) { int err; - err = bt_micp_mic_dev_unmute_safe(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_micp_mic_dev_unmute(); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -74,7 +84,12 @@ esp_err_t esp_ble_audio_micp_mic_dev_mute(void) { int err; - err = bt_micp_mic_dev_mute_safe(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_micp_mic_dev_mute(); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -86,7 +101,12 @@ esp_err_t esp_ble_audio_micp_mic_dev_mute_disable(void) { int err; - err = bt_micp_mic_dev_mute_disable_safe(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_micp_mic_dev_mute_disable(); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -98,7 +118,12 @@ esp_err_t esp_ble_audio_micp_mic_dev_mute_get(void) { int err; - err = bt_micp_mic_dev_mute_get_safe(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_micp_mic_dev_mute_get(); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -118,7 +143,12 @@ esp_err_t esp_ble_audio_micp_mic_ctlr_included_get(esp_ble_audio_micp_mic_ctlr_t return ESP_ERR_INVALID_ARG; } - err = bt_micp_mic_ctlr_included_get_safe(mic_ctlr, included); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_micp_mic_ctlr_included_get(mic_ctlr, included); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -132,7 +162,7 @@ esp_ble_audio_micp_mic_ctlr_t *esp_ble_audio_micp_mic_ctlr_get_by_conn(uint16_t esp_ble_audio_micp_mic_ctlr_t *ret = NULL; void *conn; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(NULL); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -157,7 +187,7 @@ esp_err_t esp_ble_audio_micp_mic_ctlr_discover(uint16_t conn_handle, return ESP_ERR_INVALID_ARG; } - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -183,7 +213,12 @@ esp_err_t esp_ble_audio_micp_mic_ctlr_unmute(esp_ble_audio_micp_mic_ctlr_t *mic_ return ESP_ERR_INVALID_ARG; } - err = bt_micp_mic_ctlr_unmute_safe(mic_ctlr); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_micp_mic_ctlr_unmute(mic_ctlr); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -199,7 +234,12 @@ esp_err_t esp_ble_audio_micp_mic_ctlr_mute(esp_ble_audio_micp_mic_ctlr_t *mic_ct return ESP_ERR_INVALID_ARG; } - err = bt_micp_mic_ctlr_mute_safe(mic_ctlr); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_micp_mic_ctlr_mute(mic_ctlr); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -215,7 +255,12 @@ esp_err_t esp_ble_audio_micp_mic_ctlr_mute_get(esp_ble_audio_micp_mic_ctlr_t *mi return ESP_ERR_INVALID_ARG; } - err = bt_micp_mic_ctlr_mute_get_safe(mic_ctlr); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_micp_mic_ctlr_mute_get(mic_ctlr); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -231,7 +276,12 @@ esp_err_t esp_ble_audio_micp_mic_ctlr_cb_register(esp_ble_audio_micp_mic_ctlr_cb return ESP_ERR_INVALID_ARG; } - err = bt_micp_mic_ctlr_cb_register_safe(cb); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_micp_mic_ctlr_cb_register(cb); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } diff --git a/components/bt/esp_ble_audio/api/esp_ble_audio_pacs_api.c b/components/bt/esp_ble_audio/api/esp_ble_audio_pacs_api.c index 83efc238e96..68425997934 100644 --- a/components/bt/esp_ble_audio/api/esp_ble_audio_pacs_api.c +++ b/components/bt/esp_ble_audio/api/esp_ble_audio_pacs_api.c @@ -17,7 +17,12 @@ esp_err_t esp_ble_audio_pacs_register(const esp_ble_audio_pacs_register_param_t return ESP_ERR_INVALID_ARG; } - err = bt_pacs_register_safe(param); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_pacs_register(param); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -27,18 +32,24 @@ esp_err_t esp_ble_audio_pacs_register(const esp_ble_audio_pacs_register_param_t esp_err_t esp_ble_audio_pacs_unregister(void) { + esp_err_t ret = ESP_OK; int err; - err = bt_pacs_unregister_safe(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_pacs_unregister(); if (err) { - return ESP_FAIL; + ret = ESP_FAIL; + goto end; } if (bt_le_pacs_deinit()) { - return ESP_FAIL; + ret = ESP_FAIL; } - return ESP_OK; +end: + bt_le_host_unlock(); + return ret; } static bool dir_is_valid(esp_ble_audio_dir_t dir) @@ -61,7 +72,12 @@ esp_err_t esp_ble_audio_pacs_cap_register(esp_ble_audio_dir_t dir, return ESP_ERR_INVALID_ARG; } - err = bt_pacs_cap_register_safe(dir, cap); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_pacs_cap_register(dir, cap); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -78,7 +94,12 @@ esp_err_t esp_ble_audio_pacs_cap_unregister(esp_ble_audio_dir_t dir, return ESP_ERR_INVALID_ARG; } - err = bt_pacs_cap_unregister_safe(dir, cap); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_pacs_cap_unregister(dir, cap); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -95,7 +116,12 @@ esp_err_t esp_ble_audio_pacs_set_location(esp_ble_audio_dir_t dir, return ESP_ERR_INVALID_ARG; } - err = bt_pacs_set_location_safe(dir, location); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_pacs_set_location(dir, location); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -112,7 +138,12 @@ esp_err_t esp_ble_audio_pacs_set_available_contexts(esp_ble_audio_dir_t dir, return ESP_ERR_INVALID_ARG; } - err = bt_pacs_set_available_contexts_safe(dir, contexts); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_pacs_set_available_contexts(dir, contexts); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -122,11 +153,19 @@ esp_err_t esp_ble_audio_pacs_set_available_contexts(esp_ble_audio_dir_t dir, esp_ble_audio_context_t esp_ble_audio_pacs_get_available_contexts(esp_ble_audio_dir_t dir) { + esp_ble_audio_context_t contexts; + if (dir_is_valid(dir) == false) { return ESP_BLE_AUDIO_CONTEXT_TYPE_NONE; } - return bt_pacs_get_available_contexts_safe(dir); + BT_LE_HOST_LOCK_OR_RETURN(ESP_BLE_AUDIO_CONTEXT_TYPE_NONE); + + contexts = bt_pacs_get_available_contexts(dir); + + bt_le_host_unlock(); + + return contexts; } esp_err_t esp_ble_audio_pacs_conn_set_available_contexts_for_conn(uint16_t conn_handle, @@ -143,7 +182,7 @@ esp_err_t esp_ble_audio_pacs_conn_set_available_contexts_for_conn(uint16_t conn_ return ESP_ERR_INVALID_ARG; } - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -171,7 +210,7 @@ esp_ble_audio_context_t esp_ble_audio_pacs_get_available_contexts_for_conn(uint1 return ESP_BLE_AUDIO_CONTEXT_TYPE_NONE; } - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_BLE_AUDIO_CONTEXT_TYPE_NONE); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -194,7 +233,12 @@ esp_err_t esp_ble_audio_pacs_set_supported_contexts(esp_ble_audio_dir_t dir, return ESP_ERR_INVALID_ARG; } - err = bt_pacs_set_supported_contexts_safe(dir, contexts); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_pacs_set_supported_contexts(dir, contexts); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } diff --git a/components/bt/esp_ble_audio/api/esp_ble_audio_tbs_api.c b/components/bt/esp_ble_audio/api/esp_ble_audio_tbs_api.c index 94ef680d2c7..156cfedc678 100644 --- a/components/bt/esp_ble_audio/api/esp_ble_audio_tbs_api.c +++ b/components/bt/esp_ble_audio/api/esp_ble_audio_tbs_api.c @@ -13,7 +13,12 @@ esp_err_t esp_ble_audio_tbs_accept(uint8_t call_index) { int err; - err = bt_tbs_accept_safe(call_index); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_tbs_accept(call_index); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -25,7 +30,12 @@ esp_err_t esp_ble_audio_tbs_hold(uint8_t call_index) { int err; - err = bt_tbs_hold_safe(call_index); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_tbs_hold(call_index); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -37,7 +47,12 @@ esp_err_t esp_ble_audio_tbs_retrieve(uint8_t call_index) { int err; - err = bt_tbs_retrieve_safe(call_index); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_tbs_retrieve(call_index); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -49,7 +64,12 @@ esp_err_t esp_ble_audio_tbs_terminate(uint8_t call_index) { int err; - err = bt_tbs_terminate_safe(call_index); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_tbs_terminate(call_index); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -67,7 +87,12 @@ esp_err_t esp_ble_audio_tbs_originate(uint8_t bearer_index, return ESP_ERR_INVALID_ARG; } - err = bt_tbs_originate_safe(bearer_index, uri, call_index); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_tbs_originate(bearer_index, uri, call_index); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -83,7 +108,12 @@ esp_err_t esp_ble_audio_tbs_join(uint8_t call_index_cnt, uint8_t *call_indexes) return ESP_ERR_INVALID_ARG; } - err = bt_tbs_join_safe(call_index_cnt, call_indexes); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_tbs_join(call_index_cnt, call_indexes); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -95,7 +125,12 @@ esp_err_t esp_ble_audio_tbs_remote_answer(uint8_t call_index) { int err; - err = bt_tbs_remote_answer_safe(call_index); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_tbs_remote_answer(call_index); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -107,7 +142,12 @@ esp_err_t esp_ble_audio_tbs_remote_hold(uint8_t call_index) { int err; - err = bt_tbs_remote_hold_safe(call_index); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_tbs_remote_hold(call_index); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -119,7 +159,12 @@ esp_err_t esp_ble_audio_tbs_remote_retrieve(uint8_t call_index) { int err; - err = bt_tbs_remote_retrieve_safe(call_index); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_tbs_remote_retrieve(call_index); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -131,7 +176,12 @@ esp_err_t esp_ble_audio_tbs_remote_terminate(uint8_t call_index) { int err; - err = bt_tbs_remote_terminate_safe(call_index); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_tbs_remote_terminate(call_index); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -152,7 +202,12 @@ esp_err_t esp_ble_audio_tbs_remote_incoming(uint8_t bearer_index, return ESP_ERR_INVALID_ARG; } - ret = bt_tbs_remote_incoming_safe(bearer_index, to, from, friendly_name); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + ret = bt_tbs_remote_incoming(bearer_index, to, from, friendly_name); + + bt_le_host_unlock(); + if (ret < 0) { return ESP_FAIL; } @@ -171,7 +226,12 @@ esp_err_t esp_ble_audio_tbs_add_call(uint8_t bearer_index, uint8_t state, return ESP_ERR_INVALID_ARG; } - ret = bt_tbs_add_call_safe(bearer_index, state, uri, call_index); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + ret = bt_tbs_add_call(bearer_index, state, uri, call_index); + + bt_le_host_unlock(); + if (ret < 0) { return ESP_FAIL; } @@ -183,7 +243,12 @@ esp_err_t esp_ble_audio_tbs_set_auto_alerting(uint8_t bearer_index, bool enable) { int err; - err = bt_tbs_set_auto_alerting_safe(bearer_index, enable); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_tbs_set_auto_alerting(bearer_index, enable); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -195,7 +260,12 @@ esp_err_t esp_ble_audio_tbs_set_call_alerting(uint8_t call_index) { int err; - err = bt_tbs_set_call_alerting_safe(call_index); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_tbs_set_call_alerting(call_index); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -212,7 +282,12 @@ esp_err_t esp_ble_audio_tbs_set_bearer_provider_name(uint8_t bearer_index, const return ESP_ERR_INVALID_ARG; } - err = bt_tbs_set_bearer_provider_name_safe(bearer_index, name); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_tbs_set_bearer_provider_name(bearer_index, name); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -229,7 +304,12 @@ esp_err_t esp_ble_audio_tbs_set_bearer_technology(uint8_t bearer_index, uint8_t return ESP_ERR_INVALID_ARG; } - err = bt_tbs_set_bearer_technology_safe(bearer_index, new_technology); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_tbs_set_bearer_technology(bearer_index, new_technology); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -246,7 +326,12 @@ esp_err_t esp_ble_audio_tbs_set_signal_strength(uint8_t bearer_index, uint8_t ne return ESP_ERR_INVALID_ARG; } - err = bt_tbs_set_signal_strength_safe(bearer_index, new_signal_strength); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_tbs_set_signal_strength(bearer_index, new_signal_strength); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -264,7 +349,12 @@ esp_err_t esp_ble_audio_tbs_set_status_flags(uint8_t bearer_index, uint16_t stat return ESP_ERR_INVALID_ARG; } - err = bt_tbs_set_status_flags_safe(bearer_index, status_flags); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_tbs_set_status_flags(bearer_index, status_flags); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -280,7 +370,12 @@ esp_err_t esp_ble_audio_tbs_set_uri_scheme_list(uint8_t bearer_index, const char return ESP_ERR_INVALID_ARG; } - err = bt_tbs_set_uri_scheme_list_safe(bearer_index, uri_scheme_list); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_tbs_set_uri_scheme_list(bearer_index, uri_scheme_list); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -288,9 +383,15 @@ esp_err_t esp_ble_audio_tbs_set_uri_scheme_list(uint8_t bearer_index, const char return ESP_OK; } -void esp_ble_audio_tbs_register_cb(esp_ble_audio_tbs_cb_t *cbs) +esp_err_t esp_ble_audio_tbs_register_cb(esp_ble_audio_tbs_cb_t *cbs) { - bt_tbs_register_cb_safe(cbs); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + bt_tbs_register_cb(cbs); + + bt_le_host_unlock(); + + return ESP_OK; } static bool valid_register_param(const esp_ble_audio_tbs_register_param_t *param) @@ -344,7 +445,7 @@ esp_err_t esp_ble_audio_tbs_register_bearer(const esp_ble_audio_tbs_register_par return ESP_ERR_INVALID_ARG; } - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); err = bt_tbs_register_bearer(param); if (err < 0) { @@ -369,24 +470,30 @@ end: esp_err_t esp_ble_audio_tbs_unregister_bearer(uint8_t bearer_index) { + esp_err_t ret = ESP_OK; int err; - err = bt_tbs_unregister_bearer_safe(bearer_index); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_tbs_unregister_bearer(bearer_index); if (err) { - return ESP_FAIL; + ret = ESP_FAIL; + goto end; } #if BLE_AUDIO_SVC_DEFERRED_ADD if (bearer_index == ESP_BLE_AUDIO_TBS_GTBS_INDEX) { if (bt_le_gtbs_deinit()) { - return ESP_FAIL; + ret = ESP_FAIL; } } else if (bt_le_tbs_deinit(bearer_index)) { - return ESP_FAIL; + ret = ESP_FAIL; } #endif /* BLE_AUDIO_SVC_DEFERRED_ADD */ - return ESP_OK; +end: + bt_le_host_unlock(); + return ret; } #endif /* CONFIG_BT_TBS */ @@ -397,7 +504,7 @@ esp_err_t esp_ble_audio_tbs_client_discover(uint16_t conn_handle) void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -424,7 +531,7 @@ esp_err_t esp_ble_audio_tbs_client_set_signal_strength_interval(uint16_t conn_ha void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -480,7 +587,7 @@ esp_err_t esp_ble_audio_tbs_client_originate_call(uint16_t conn_handle, return ESP_ERR_INVALID_ARG; } - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -508,7 +615,7 @@ esp_err_t esp_ble_audio_tbs_client_terminate_call(uint16_t conn_handle, void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -536,7 +643,7 @@ esp_err_t esp_ble_audio_tbs_client_hold_call(uint16_t conn_handle, void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -564,7 +671,7 @@ esp_err_t esp_ble_audio_tbs_client_accept_call(uint16_t conn_handle, void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -592,7 +699,7 @@ esp_err_t esp_ble_audio_tbs_client_retrieve_call(uint16_t conn_handle, void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -626,7 +733,7 @@ esp_err_t esp_ble_audio_tbs_client_join_calls(uint16_t conn_handle, return ESP_ERR_INVALID_ARG; } - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -652,7 +759,7 @@ esp_err_t esp_ble_audio_tbs_client_read_bearer_provider_name(uint16_t conn_handl void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -678,7 +785,7 @@ esp_err_t esp_ble_audio_tbs_client_read_bearer_uci(uint16_t conn_handle, uint8_t void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -704,7 +811,7 @@ esp_err_t esp_ble_audio_tbs_client_read_technology(uint16_t conn_handle, uint8_t void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -730,7 +837,7 @@ esp_err_t esp_ble_audio_tbs_client_read_uri_list(uint16_t conn_handle, uint8_t i void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -756,7 +863,7 @@ esp_err_t esp_ble_audio_tbs_client_read_signal_strength(uint16_t conn_handle, ui void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -782,7 +889,7 @@ esp_err_t esp_ble_audio_tbs_client_read_signal_interval(uint16_t conn_handle, ui void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -808,7 +915,7 @@ esp_err_t esp_ble_audio_tbs_client_read_current_calls(uint16_t conn_handle, uint void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -834,7 +941,7 @@ esp_err_t esp_ble_audio_tbs_client_read_ccid(uint16_t conn_handle, uint8_t inst_ void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -860,7 +967,7 @@ esp_err_t esp_ble_audio_tbs_client_read_call_uri(uint16_t conn_handle, uint8_t i void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -886,7 +993,7 @@ esp_err_t esp_ble_audio_tbs_client_read_status_flags(uint16_t conn_handle, uint8 void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -911,7 +1018,7 @@ esp_err_t esp_ble_audio_tbs_client_read_call_state(uint16_t conn_handle, uint8_t void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -936,7 +1043,7 @@ esp_err_t esp_ble_audio_tbs_client_read_remote_uri(uint16_t conn_handle, uint8_t void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -962,7 +1069,7 @@ esp_err_t esp_ble_audio_tbs_client_read_friendly_name(uint16_t conn_handle, uint void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -988,7 +1095,7 @@ esp_err_t esp_ble_audio_tbs_client_read_optional_opcodes(uint16_t conn_handle, u void *conn; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -1015,7 +1122,12 @@ esp_err_t esp_ble_audio_tbs_client_register_cb(esp_ble_audio_tbs_client_cb_t *cb return ESP_ERR_INVALID_ARG; } - err = bt_tbs_client_register_cb_safe(cbs); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_tbs_client_register_cb(cbs); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -1029,7 +1141,7 @@ esp_ble_audio_tbs_instance_t *esp_ble_audio_tbs_client_get_by_ccid(uint16_t conn esp_ble_audio_tbs_instance_t *ret = NULL; void *conn; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(NULL); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -1049,7 +1161,7 @@ esp_ble_audio_tbs_instance_t *esp_ble_audio_tbs_client_get_by_index(uint16_t con esp_ble_audio_tbs_instance_t *ret = NULL; void *conn; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(NULL); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { diff --git a/components/bt/esp_ble_audio/api/esp_ble_audio_tmap_api.c b/components/bt/esp_ble_audio/api/esp_ble_audio_tmap_api.c index e2330ea0743..c05889f63c4 100644 --- a/components/bt/esp_ble_audio/api/esp_ble_audio_tmap_api.c +++ b/components/bt/esp_ble_audio/api/esp_ble_audio_tmap_api.c @@ -14,7 +14,7 @@ esp_err_t esp_ble_audio_tmap_register(esp_ble_audio_tmap_role_t role) esp_err_t ret = ESP_OK; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); err = bt_tmap_register(role); if (err) { @@ -49,7 +49,7 @@ esp_err_t esp_ble_audio_tmap_discover(uint16_t conn_handle, return ESP_ERR_INVALID_ARG; } - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -67,8 +67,14 @@ unlock: return ret; } -void esp_ble_audio_tmap_set_role(esp_ble_audio_tmap_role_t role) +esp_err_t esp_ble_audio_tmap_set_role(esp_ble_audio_tmap_role_t role) { - bt_tmap_set_role_safe(role); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + bt_tmap_set_role(role); + + bt_le_host_unlock(); + + return ESP_OK; } #endif /* CONFIG_BT_TMAP */ diff --git a/components/bt/esp_ble_audio/api/esp_ble_audio_vcp_api.c b/components/bt/esp_ble_audio/api/esp_ble_audio_vcp_api.c index 7ff0ef48500..ecbfab0b5d4 100644 --- a/components/bt/esp_ble_audio/api/esp_ble_audio_vcp_api.c +++ b/components/bt/esp_ble_audio/api/esp_ble_audio_vcp_api.c @@ -16,7 +16,12 @@ esp_err_t esp_ble_audio_vcp_vol_rend_included_get(esp_ble_audio_vcp_included_t * return ESP_ERR_INVALID_ARG; } - err = bt_vcp_vol_rend_included_get_safe(included); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_vcp_vol_rend_included_get(included); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -45,7 +50,7 @@ esp_err_t esp_ble_audio_vcp_vol_rend_register(esp_ble_audio_vcp_vol_rend_registe return ESP_ERR_INVALID_ARG; } - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); err = bt_vcp_vol_rend_register(param); if (err) { @@ -77,7 +82,12 @@ esp_err_t esp_ble_audio_vcp_vol_rend_set_step(uint8_t volume_step) return ESP_ERR_INVALID_ARG; } - err = bt_vcp_vol_rend_set_step_safe(volume_step); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_vcp_vol_rend_set_step(volume_step); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -89,7 +99,12 @@ esp_err_t esp_ble_audio_vcp_vol_rend_get_state(void) { int err; - err = bt_vcp_vol_rend_get_state_safe(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_vcp_vol_rend_get_state(); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -101,7 +116,12 @@ esp_err_t esp_ble_audio_vcp_vol_rend_get_flags(void) { int err; - err = bt_vcp_vol_rend_get_flags_safe(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_vcp_vol_rend_get_flags(); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -113,7 +133,12 @@ esp_err_t esp_ble_audio_vcp_vol_rend_vol_down(void) { int err; - err = bt_vcp_vol_rend_vol_down_safe(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_vcp_vol_rend_vol_down(); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -125,7 +150,12 @@ esp_err_t esp_ble_audio_vcp_vol_rend_vol_up(void) { int err; - err = bt_vcp_vol_rend_vol_up_safe(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_vcp_vol_rend_vol_up(); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -137,7 +167,12 @@ esp_err_t esp_ble_audio_vcp_vol_rend_unmute_vol_down(void) { int err; - err = bt_vcp_vol_rend_unmute_vol_down_safe(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_vcp_vol_rend_unmute_vol_down(); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -149,7 +184,12 @@ esp_err_t esp_ble_audio_vcp_vol_rend_unmute_vol_up(void) { int err; - err = bt_vcp_vol_rend_unmute_vol_up_safe(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_vcp_vol_rend_unmute_vol_up(); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -161,7 +201,12 @@ esp_err_t esp_ble_audio_vcp_vol_rend_set_vol(uint8_t volume) { int err; - err = bt_vcp_vol_rend_set_vol_safe(volume); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_vcp_vol_rend_set_vol(volume); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -173,7 +218,12 @@ esp_err_t esp_ble_audio_vcp_vol_rend_unmute(void) { int err; - err = bt_vcp_vol_rend_unmute_safe(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_vcp_vol_rend_unmute(); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -185,7 +235,12 @@ esp_err_t esp_ble_audio_vcp_vol_rend_mute(void) { int err; - err = bt_vcp_vol_rend_mute_safe(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_vcp_vol_rend_mute(); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -201,7 +256,12 @@ esp_err_t esp_ble_audio_vcp_vol_rend_reset_state(const esp_ble_audio_vcp_vol_ren return ESP_ERR_INVALID_ARG; } - err = bt_vcp_vol_rend_reset_state_safe(param); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_vcp_vol_rend_reset_state(param); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -219,7 +279,12 @@ esp_err_t esp_ble_audio_vcp_vol_ctlr_cb_register(esp_ble_audio_vcp_vol_ctlr_cb_t return ESP_ERR_INVALID_ARG; } - err = bt_vcp_vol_ctlr_cb_register_safe(cb); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_vcp_vol_ctlr_cb_register(cb); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -235,7 +300,12 @@ esp_err_t esp_ble_audio_vcp_vol_ctlr_cb_unregister(esp_ble_audio_vcp_vol_ctlr_cb return ESP_ERR_INVALID_ARG; } - err = bt_vcp_vol_ctlr_cb_unregister_safe(cb); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_vcp_vol_ctlr_cb_unregister(cb); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -254,7 +324,7 @@ esp_err_t esp_ble_audio_vcp_vol_ctlr_discover(uint16_t conn_handle, return ESP_ERR_INVALID_ARG; } - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -277,7 +347,7 @@ esp_ble_audio_vcp_vol_ctlr_t *esp_ble_audio_vcp_vol_ctlr_get_by_conn(uint16_t co esp_ble_audio_vcp_vol_ctlr_t *ret = NULL; void *conn; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(NULL); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -301,7 +371,12 @@ esp_err_t esp_ble_audio_vcp_vol_ctlr_included_get(esp_ble_audio_vcp_vol_ctlr_t * return ESP_ERR_INVALID_ARG; } - err = bt_vcp_vol_ctlr_included_get_safe(vol_ctlr, included); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = lib_vcp_vol_ctlr_included_get(vol_ctlr, included); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -318,7 +393,12 @@ esp_err_t esp_ble_audio_vcp_vol_ctlr_read_state(esp_ble_audio_vcp_vol_ctlr_t *vo return ESP_ERR_INVALID_ARG; } - err = bt_vcp_vol_ctlr_read_state_safe(vol_ctlr); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_vcp_vol_ctlr_read_state(vol_ctlr); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -334,7 +414,12 @@ esp_err_t esp_ble_audio_vcp_vol_ctlr_read_flags(esp_ble_audio_vcp_vol_ctlr_t *vo return ESP_ERR_INVALID_ARG; } - err = bt_vcp_vol_ctlr_read_flags_safe(vol_ctlr); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_vcp_vol_ctlr_read_flags(vol_ctlr); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -350,7 +435,12 @@ esp_err_t esp_ble_audio_vcp_vol_ctlr_vol_down(esp_ble_audio_vcp_vol_ctlr_t *vol_ return ESP_ERR_INVALID_ARG; } - err = bt_vcp_vol_ctlr_vol_down_safe(vol_ctlr); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_vcp_vol_ctlr_vol_down(vol_ctlr); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -366,7 +456,12 @@ esp_err_t esp_ble_audio_vcp_vol_ctlr_vol_up(esp_ble_audio_vcp_vol_ctlr_t *vol_ct return ESP_ERR_INVALID_ARG; } - err = bt_vcp_vol_ctlr_vol_up_safe(vol_ctlr); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_vcp_vol_ctlr_vol_up(vol_ctlr); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -382,7 +477,12 @@ esp_err_t esp_ble_audio_vcp_vol_ctlr_unmute_vol_down(esp_ble_audio_vcp_vol_ctlr_ return ESP_ERR_INVALID_ARG; } - err = bt_vcp_vol_ctlr_unmute_vol_down_safe(vol_ctlr); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_vcp_vol_ctlr_unmute_vol_down(vol_ctlr); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -398,7 +498,12 @@ esp_err_t esp_ble_audio_vcp_vol_ctlr_unmute_vol_up(esp_ble_audio_vcp_vol_ctlr_t return ESP_ERR_INVALID_ARG; } - err = bt_vcp_vol_ctlr_unmute_vol_up_safe(vol_ctlr); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_vcp_vol_ctlr_unmute_vol_up(vol_ctlr); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -414,7 +519,12 @@ esp_err_t esp_ble_audio_vcp_vol_ctlr_set_vol(esp_ble_audio_vcp_vol_ctlr_t *vol_c return ESP_ERR_INVALID_ARG; } - err = bt_vcp_vol_ctlr_set_vol_safe(vol_ctlr, volume); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_vcp_vol_ctlr_set_vol(vol_ctlr, volume); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -430,7 +540,12 @@ esp_err_t esp_ble_audio_vcp_vol_ctlr_unmute(esp_ble_audio_vcp_vol_ctlr_t *vol_ct return ESP_ERR_INVALID_ARG; } - err = bt_vcp_vol_ctlr_unmute_safe(vol_ctlr); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_vcp_vol_ctlr_unmute(vol_ctlr); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -446,7 +561,12 @@ esp_err_t esp_ble_audio_vcp_vol_ctlr_mute(esp_ble_audio_vcp_vol_ctlr_t *vol_ctlr return ESP_ERR_INVALID_ARG; } - err = bt_vcp_vol_ctlr_mute_safe(vol_ctlr); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_vcp_vol_ctlr_mute(vol_ctlr); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } diff --git a/components/bt/esp_ble_audio/api/esp_ble_audio_vocs_api.c b/components/bt/esp_ble_audio/api/esp_ble_audio_vocs_api.c index af975890442..65762ba0120 100644 --- a/components/bt/esp_ble_audio/api/esp_ble_audio_vocs_api.c +++ b/components/bt/esp_ble_audio/api/esp_ble_audio_vocs_api.c @@ -10,16 +10,32 @@ #if CONFIG_BT_VOCS esp_ble_audio_vocs_t *esp_ble_audio_vocs_free_instance_get(void) { - return bt_vocs_free_instance_get_safe(); + esp_ble_audio_vocs_t *inst; + + BT_LE_HOST_LOCK_OR_RETURN(NULL); + + inst = bt_vocs_free_instance_get(); + + bt_le_host_unlock(); + + return inst; } void *esp_ble_audio_vocs_svc_decl_get(esp_ble_audio_vocs_t *vocs) { + void *decl; + if (vocs == NULL) { return NULL; } - return bt_vocs_svc_decl_get_safe(vocs); + BT_LE_HOST_LOCK_OR_RETURN(NULL); + + decl = bt_vocs_svc_decl_get(vocs); + + bt_le_host_unlock(); + + return decl; } esp_err_t esp_ble_audio_vocs_register(esp_ble_audio_vocs_t *vocs, @@ -31,7 +47,12 @@ esp_err_t esp_ble_audio_vocs_register(esp_ble_audio_vocs_t *vocs, return ESP_ERR_INVALID_ARG; } - err = bt_vocs_register_safe(vocs, param); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_vocs_register(vocs, param); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -49,7 +70,12 @@ esp_err_t esp_ble_audio_vocs_state_get(esp_ble_audio_vocs_t *inst) return ESP_ERR_INVALID_ARG; } - err = bt_vocs_state_get_safe(inst); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_vocs_state_get(inst); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -65,7 +91,12 @@ esp_err_t esp_ble_audio_vocs_state_set(esp_ble_audio_vocs_t *inst, int16_t offse return ESP_ERR_INVALID_ARG; } - err = bt_vocs_state_set_safe(inst, offset); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_vocs_state_set(inst, offset); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -81,7 +112,12 @@ esp_err_t esp_ble_audio_vocs_location_get(esp_ble_audio_vocs_t *inst) return ESP_ERR_INVALID_ARG; } - err = bt_vocs_location_get_safe(inst); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_vocs_location_get(inst); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -97,7 +133,12 @@ esp_err_t esp_ble_audio_vocs_location_set(esp_ble_audio_vocs_t *inst, uint32_t l return ESP_ERR_INVALID_ARG; } - err = bt_vocs_location_set_safe(inst, location); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_vocs_location_set(inst, location); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -113,7 +154,12 @@ esp_err_t esp_ble_audio_vocs_description_get(esp_ble_audio_vocs_t *inst) return ESP_ERR_INVALID_ARG; } - err = bt_vocs_description_get_safe(inst); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_vocs_description_get(inst); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -130,7 +176,12 @@ esp_err_t esp_ble_audio_vocs_description_set(esp_ble_audio_vocs_t *inst, return ESP_ERR_INVALID_ARG; } - err = bt_vocs_description_set_safe(inst, description); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_vocs_description_set(inst, description); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -147,14 +198,26 @@ esp_err_t esp_ble_audio_vocs_client_cb_register(esp_ble_audio_vocs_t *inst, return ESP_ERR_INVALID_ARG; } - bt_vocs_client_cb_register_safe(inst, cb); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + bt_vocs_client_cb_register(inst, cb); + + bt_le_host_unlock(); return ESP_OK; } esp_ble_audio_vocs_t *esp_ble_audio_vocs_client_free_instance_get(void) { - return bt_vocs_client_free_instance_get_safe(); + esp_ble_audio_vocs_t *inst; + + BT_LE_HOST_LOCK_OR_RETURN(NULL); + + inst = bt_vocs_client_free_instance_get(); + + bt_le_host_unlock(); + + return inst; } esp_err_t esp_ble_audio_vocs_discover(uint16_t conn_handle, @@ -178,7 +241,7 @@ esp_err_t esp_ble_audio_vocs_discover(uint16_t conn_handle, return ESP_ERR_INVALID_ARG; } - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { diff --git a/components/bt/esp_ble_audio/api/include/esp_ble_audio_tbs_api.h b/components/bt/esp_ble_audio/api/include/esp_ble_audio_tbs_api.h index c11bab111c9..7fc5dbb93c9 100644 --- a/components/bt/esp_ble_audio/api/include/esp_ble_audio_tbs_api.h +++ b/components/bt/esp_ble_audio/api/include/esp_ble_audio_tbs_api.h @@ -370,8 +370,10 @@ esp_err_t esp_ble_audio_tbs_set_uri_scheme_list(uint8_t bearer_index, const char * @brief Register the callbacks for TBS. * * @param cbs Pointer to the callback structure. + * + * @return ESP_OK on success, or an error code on failure. */ -void esp_ble_audio_tbs_register_cb(esp_ble_audio_tbs_cb_t *cbs); +esp_err_t esp_ble_audio_tbs_register_cb(esp_ble_audio_tbs_cb_t *cbs); /** * @brief Register a Telephone Bearer. diff --git a/components/bt/esp_ble_audio/api/include/esp_ble_audio_tmap_api.h b/components/bt/esp_ble_audio/api/include/esp_ble_audio_tmap_api.h index f90467c4a8e..2de35d4effd 100644 --- a/components/bt/esp_ble_audio/api/include/esp_ble_audio_tmap_api.h +++ b/components/bt/esp_ble_audio/api/include/esp_ble_audio_tmap_api.h @@ -69,8 +69,10 @@ esp_err_t esp_ble_audio_tmap_discover(uint16_t conn_handle, * Previously registered value will be overwritten. * * @param role TMAP role(s). + * + * @return ESP_OK on success, or an error code on failure. */ -void esp_ble_audio_tmap_set_role(esp_ble_audio_tmap_role_t role); +esp_err_t esp_ble_audio_tmap_set_role(esp_ble_audio_tmap_role_t role); #ifdef __cplusplus } diff --git a/components/bt/esp_ble_audio/host/adapter/bluedroid/init.c b/components/bt/esp_ble_audio/host/adapter/bluedroid/init.c index c2a0cafe95f..35597051ab1 100644 --- a/components/bt/esp_ble_audio/host/adapter/bluedroid/init.c +++ b/components/bt/esp_ble_audio/host/adapter/bluedroid/init.c @@ -221,7 +221,7 @@ int bt_le_bluedroid_vcp_vol_rend_init(void) memset(&vcp_included, 0, sizeof(vcp_included)); - err = bt_vcp_vol_rend_included_get_safe(&vcp_included); + err = bt_vcp_vol_rend_included_get(&vcp_included); if (err) { return err; } @@ -243,7 +243,7 @@ int bt_le_bluedroid_micp_mic_dev_init(void) memset(&micp_included, 0, sizeof(micp_included)); - err = bt_micp_mic_dev_included_get_safe(&micp_included); + err = bt_micp_mic_dev_included_get(&micp_included); if (err) { return err; } diff --git a/components/bt/esp_ble_audio/host/adapter/bluedroid/profiles/cas.c b/components/bt/esp_ble_audio/host/adapter/bluedroid/profiles/cas.c index 00ce6a82de2..5f218806198 100644 --- a/components/bt/esp_ble_audio/host/adapter/bluedroid/profiles/cas.c +++ b/components/bt/esp_ble_audio/host/adapter/bluedroid/profiles/cas.c @@ -79,7 +79,7 @@ int bt_le_bluedroid_cas_init(void *csis_svc_p) } #else /* CONFIG_BT_CAP_ACCEPTOR_SET_MEMBER */ /* Insert CAS to the GATT db list */ - err = bt_gatt_service_register_safe(cas_svc); + err = bt_gatt_service_register(cas_svc); if (err) { LOG_ERR("[B]CasSvcRegFail[%d]", err); } diff --git a/components/bt/esp_ble_audio/host/adapter/nimble/init.c b/components/bt/esp_ble_audio/host/adapter/nimble/init.c index f299d1c9567..be7be8e4310 100644 --- a/components/bt/esp_ble_audio/host/adapter/nimble/init.c +++ b/components/bt/esp_ble_audio/host/adapter/nimble/init.c @@ -429,7 +429,7 @@ int bt_le_nimble_vcp_vol_rend_init(void) memset(&vcp_included, 0, sizeof(vcp_included)); - err = bt_vcp_vol_rend_included_get_safe(&vcp_included); + err = bt_vcp_vol_rend_included_get(&vcp_included); if (err) { return err; } @@ -451,7 +451,7 @@ int bt_le_nimble_micp_mic_dev_init(void) memset(&micp_included, 0, sizeof(micp_included)); - err = bt_micp_mic_dev_included_get_safe(&micp_included); + err = bt_micp_mic_dev_included_get(&micp_included); if (err) { return err; } diff --git a/components/bt/esp_ble_audio/host/adapter/nimble/profiles/cas.c b/components/bt/esp_ble_audio/host/adapter/nimble/profiles/cas.c index d89ae99da8e..e6c4d142b92 100644 --- a/components/bt/esp_ble_audio/host/adapter/nimble/profiles/cas.c +++ b/components/bt/esp_ble_audio/host/adapter/nimble/profiles/cas.c @@ -123,7 +123,7 @@ int bt_le_nimble_cas_init(void *csis_svc_p) } /* Insert CAS to the GATT db list */ - rc = bt_gatt_service_register_safe(cas_svc); + rc = bt_gatt_service_register(cas_svc); if (rc) { LOG_ERR("[N]CasSvcRegFail[%d]", rc); } diff --git a/components/bt/esp_ble_audio/host/common/init.c b/components/bt/esp_ble_audio/host/common/init.c index 15339f45d8a..39266de50d7 100644 --- a/components/bt/esp_ble_audio/host/common/init.c +++ b/components/bt/esp_ble_audio/host/common/init.c @@ -185,7 +185,7 @@ static const uint16_t ext_structs[] = { sizeof(struct bt_bond_info), }; -#define LEA_VERSION (0x20260828) +#define LEA_VERSION (0x20260903) struct lib_ext_cfgs { /* BLE */ diff --git a/components/bt/esp_ble_audio/host/services/ots/ots.c b/components/bt/esp_ble_audio/host/services/ots/ots.c index e1b2f93c916..1178cc9762c 100644 --- a/components/bt/esp_ble_audio/host/services/ots/ots.c +++ b/components/bt/esp_ble_audio/host/services/ots/ots.c @@ -839,10 +839,10 @@ int bt_gatt_ots_instances_prepare(void) int bt_gatt_ots_conn_cb_register(void) { - return bt_conn_cb_register_safe((void *)&bt_conn_cb_conn_callbacks); + return bt_conn_cb_register((void *)&bt_conn_cb_conn_callbacks); } void bt_gatt_ots_conn_cb_unregister(void) { - (void)bt_conn_cb_unregister_safe((void *)&bt_conn_cb_conn_callbacks); + (void)bt_conn_cb_unregister((void *)&bt_conn_cb_conn_callbacks); } diff --git a/components/bt/esp_ble_audio/host/services/ots/ots_client.c b/components/bt/esp_ble_audio/host/services/ots/ots_client.c index 4adf1e0cd77..4a986bb152a 100644 --- a/components/bt/esp_ble_audio/host/services/ots/ots_client.c +++ b/components/bt/esp_ble_audio/host/services/ots/ots_client.c @@ -574,12 +574,12 @@ BT_CONN_CB_DEFINE(client_conn_callbacks) = { int bt_gatt_ots_client_conn_cb_register(void) { - return bt_conn_cb_register_safe((void *)&bt_conn_cb_client_conn_callbacks); + return bt_conn_cb_register((void *)&bt_conn_cb_client_conn_callbacks); } void bt_gatt_ots_client_conn_cb_unregister(void) { - (void)bt_conn_cb_unregister_safe((void *)&bt_conn_cb_client_conn_callbacks); + (void)bt_conn_cb_unregister((void *)&bt_conn_cb_client_conn_callbacks); } int bt_ots_client_register(struct bt_ots_client *otc_inst) diff --git a/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/aics.h b/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/aics.h index fcf72f244a3..e874a59942b 100644 --- a/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/aics.h +++ b/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/aics.h @@ -188,7 +188,7 @@ struct bt_aics_discover_param { * * @return Audio Input Control Service instance in case of success or NULL in case of error. */ -struct bt_aics *bt_aics_free_instance_get_safe(void); +struct bt_aics *bt_aics_free_instance_get(void); /** * @brief Get the service declaration attribute. @@ -199,7 +199,7 @@ struct bt_aics *bt_aics_free_instance_get_safe(void); * * @return Pointer to the attributes of the service. */ -void *bt_aics_svc_decl_get_safe(struct bt_aics *aics); +void *bt_aics_svc_decl_get(struct bt_aics *aics); /** * @brief Get the connection pointer of a client instance @@ -222,7 +222,7 @@ int bt_aics_client_conn_get(const struct bt_aics *aics, struct bt_conn **conn); * * @return 0 if success, errno on failure. */ -int bt_aics_register_safe(struct bt_aics *aics, struct bt_aics_register_param *param); +int bt_aics_register(struct bt_aics *aics, struct bt_aics_register_param *param); /** * @brief Callback function for writes. @@ -367,8 +367,6 @@ struct bt_aics_cb { */ int bt_aics_discover(struct bt_conn *conn, struct bt_aics *inst, const struct bt_aics_discover_param *param); -int bt_aics_discover_safe(struct bt_conn *conn, struct bt_aics *inst, - const struct bt_aics_discover_param *param); /** * @brief Deactivates a Audio Input Control Service instance. @@ -380,7 +378,7 @@ int bt_aics_discover_safe(struct bt_conn *conn, struct bt_aics *inst, * * @return 0 if success, errno on failure. */ -int bt_aics_deactivate_safe(struct bt_aics *inst); +int bt_aics_deactivate(struct bt_aics *inst); /** * @brief Activates a Audio Input Control Service instance. @@ -393,7 +391,7 @@ int bt_aics_deactivate_safe(struct bt_aics *inst); * * @return 0 if success, errno on failure. */ -int bt_aics_activate_safe(struct bt_aics *inst); +int bt_aics_activate(struct bt_aics *inst); /** * @brief Read the Audio Input Control Service input state. @@ -402,7 +400,7 @@ int bt_aics_activate_safe(struct bt_aics *inst); * * @return 0 on success, GATT error value on fail. */ -int bt_aics_state_get_safe(struct bt_aics *inst); +int bt_aics_state_get(struct bt_aics *inst); /** * @brief Read the Audio Input Control Service gain settings. @@ -411,7 +409,7 @@ int bt_aics_state_get_safe(struct bt_aics *inst); * * @return 0 on success, GATT error value on fail. */ -int bt_aics_gain_setting_get_safe(struct bt_aics *inst); +int bt_aics_gain_setting_get(struct bt_aics *inst); /** * @brief Read the Audio Input Control Service input type. @@ -420,7 +418,7 @@ int bt_aics_gain_setting_get_safe(struct bt_aics *inst); * * @return 0 on success, GATT error value on fail. */ -int bt_aics_type_get_safe(struct bt_aics *inst); +int bt_aics_type_get(struct bt_aics *inst); /** * @brief Read the Audio Input Control Service input status. @@ -429,7 +427,7 @@ int bt_aics_type_get_safe(struct bt_aics *inst); * * @return 0 on success, GATT error value on fail. */ -int bt_aics_status_get_safe(struct bt_aics *inst); +int bt_aics_status_get(struct bt_aics *inst); /** * @brief Disable mute in the Audio Input Control Service. @@ -441,7 +439,7 @@ int bt_aics_status_get_safe(struct bt_aics *inst); * * @return 0 on success, errno value on fail. */ -int bt_aics_disable_mute_safe(struct bt_aics *inst); +int bt_aics_disable_mute(struct bt_aics *inst); /** * @brief Unmute the Audio Input Control Service input. @@ -450,7 +448,7 @@ int bt_aics_disable_mute_safe(struct bt_aics *inst); * * @return 0 on success, GATT error value on fail. */ -int bt_aics_unmute_safe(struct bt_aics *inst); +int bt_aics_unmute(struct bt_aics *inst); /** * @brief Mute the Audio Input Control Service input. @@ -459,7 +457,7 @@ int bt_aics_unmute_safe(struct bt_aics *inst); * * @return 0 on success, GATT error value on fail. */ -int bt_aics_mute_safe(struct bt_aics *inst); +int bt_aics_mute(struct bt_aics *inst); /** * @brief Set manual only gain mode in Audio Input Control Service. @@ -468,7 +466,7 @@ int bt_aics_mute_safe(struct bt_aics *inst); * * @return 0 on success, errno value on fail. */ -int bt_aics_gain_set_manual_only_safe(struct bt_aics *inst); +int bt_aics_gain_set_manual_only(struct bt_aics *inst); /** * @brief Set automatic only gain mode in Audio Input Control Service. @@ -480,7 +478,7 @@ int bt_aics_gain_set_manual_only_safe(struct bt_aics *inst); * * @return 0 on success, errno value on fail. */ -int bt_aics_gain_set_auto_only_safe(struct bt_aics *inst); +int bt_aics_gain_set_auto_only(struct bt_aics *inst); /** * @brief Set input gain to manual. @@ -489,7 +487,7 @@ int bt_aics_gain_set_auto_only_safe(struct bt_aics *inst); * * @return 0 on success, GATT error value on fail. */ -int bt_aics_manual_gain_set_safe(struct bt_aics *inst); +int bt_aics_manual_gain_set(struct bt_aics *inst); /** * @brief Set the input gain to automatic. @@ -498,7 +496,7 @@ int bt_aics_manual_gain_set_safe(struct bt_aics *inst); * * @return 0 on success, GATT error value on fail. */ -int bt_aics_automatic_gain_set_safe(struct bt_aics *inst); +int bt_aics_automatic_gain_set(struct bt_aics *inst); /** * @brief Set the input gain. @@ -509,7 +507,7 @@ int bt_aics_automatic_gain_set_safe(struct bt_aics *inst); * * @return 0 on success, GATT error value on fail. */ -int bt_aics_gain_set_safe(struct bt_aics *inst, int8_t gain); +int bt_aics_gain_set(struct bt_aics *inst, int8_t gain); /** * @brief Read the Audio Input Control Service description. @@ -518,7 +516,7 @@ int bt_aics_gain_set_safe(struct bt_aics *inst, int8_t gain); * * @return 0 on success, GATT error value on fail. */ -int bt_aics_description_get_safe(struct bt_aics *inst); +int bt_aics_description_get(struct bt_aics *inst); /** * @brief Set the Audio Input Control Service description. @@ -528,14 +526,14 @@ int bt_aics_description_get_safe(struct bt_aics *inst); * * @return 0 on success, GATT error value on fail. */ -int bt_aics_description_set_safe(struct bt_aics *inst, const char *description); +int bt_aics_description_set(struct bt_aics *inst, const char *description); /** * @brief Get a new Audio Input Control Service client instance. * * @return Pointer to the instance, or NULL if no free instances are left. */ -struct bt_aics *bt_aics_client_free_instance_get_safe(void); +struct bt_aics *bt_aics_client_free_instance_get(void); /** * @brief Registers the callbacks for the Audio Input Control Service client. @@ -543,7 +541,7 @@ struct bt_aics *bt_aics_client_free_instance_get_safe(void); * @param inst The instance pointer. * @param cb Pointer to the callback structure. */ -void bt_aics_client_cb_register_safe(struct bt_aics *inst, struct bt_aics_cb *cb); +void bt_aics_client_cb_register(struct bt_aics *inst, struct bt_aics_cb *cb); #ifdef __cplusplus } diff --git a/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/bap.h b/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/bap.h index 597677c7004..52c663f5c72 100644 --- a/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/bap.h +++ b/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/bap.h @@ -881,7 +881,7 @@ struct bt_bap_ep_info { * @retval 0 in case of success * @retval -EINVAL if @p ep or @p info are NULL */ -int bt_bap_ep_get_info_safe(const struct bt_bap_ep *ep, struct bt_bap_ep_info *info); +int bt_bap_ep_get_info(const struct bt_bap_ep *ep, struct bt_bap_ep_info *info); /** * @brief Get the pointer to the ACL connection of an endpoint @@ -1106,7 +1106,7 @@ struct bt_bap_unicast_server_register_param { * @param stream Stream object. * @param ops Stream operations structure. */ -void bt_bap_stream_cb_register_safe(struct bt_bap_stream *stream, struct bt_bap_stream_ops *ops); +void bt_bap_stream_cb_register(struct bt_bap_stream *stream, struct bt_bap_stream_ops *ops); /** * @brief Configure Audio Stream @@ -1123,8 +1123,6 @@ void bt_bap_stream_cb_register_safe(struct bt_bap_stream *stream, struct bt_bap_ */ int bt_bap_stream_config(struct bt_conn *conn, struct bt_bap_stream *stream, struct bt_bap_ep *ep, struct bt_audio_codec_cfg *codec_cfg); -int bt_bap_stream_config_safe(struct bt_conn *conn, struct bt_bap_stream *stream, struct bt_bap_ep *ep, - struct bt_audio_codec_cfg *codec_cfg); /** * @brief Reconfigure Audio Stream @@ -1139,7 +1137,7 @@ int bt_bap_stream_config_safe(struct bt_conn *conn, struct bt_bap_stream *stream * * @return 0 in case of success or negative value in case of error. */ -int bt_bap_stream_reconfig_safe(struct bt_bap_stream *stream, struct bt_audio_codec_cfg *codec_cfg); +int bt_bap_stream_reconfig(struct bt_bap_stream *stream, struct bt_audio_codec_cfg *codec_cfg); /** * @brief Configure Audio Stream QoS @@ -1154,7 +1152,6 @@ int bt_bap_stream_reconfig_safe(struct bt_bap_stream *stream, struct bt_audio_co * @return 0 in case of success or negative value in case of error. */ int bt_bap_stream_qos(struct bt_conn *conn, struct bt_bap_unicast_group *group); -int bt_bap_stream_qos_safe(struct bt_conn *conn, struct bt_bap_unicast_group *group); /** * @brief Enable Audio Stream @@ -1170,7 +1167,7 @@ int bt_bap_stream_qos_safe(struct bt_conn *conn, struct bt_bap_unicast_group *gr * * @return 0 in case of success or negative value in case of error. */ -int bt_bap_stream_enable_safe(struct bt_bap_stream *stream, const uint8_t meta[], size_t meta_len); +int bt_bap_stream_enable(struct bt_bap_stream *stream, const uint8_t meta[], size_t meta_len); /** * @brief Change Audio Stream Metadata @@ -1183,7 +1180,7 @@ int bt_bap_stream_enable_safe(struct bt_bap_stream *stream, const uint8_t meta[] * * @return 0 in case of success or negative value in case of error. */ -int bt_bap_stream_metadata_safe(struct bt_bap_stream *stream, const uint8_t meta[], size_t meta_len); +int bt_bap_stream_metadata(struct bt_bap_stream *stream, const uint8_t meta[], size_t meta_len); /** * @brief Disable Audio Stream @@ -1197,7 +1194,7 @@ int bt_bap_stream_metadata_safe(struct bt_bap_stream *stream, const uint8_t meta * * @return 0 in case of success or negative value in case of error. */ -int bt_bap_stream_disable_safe(struct bt_bap_stream *stream); +int bt_bap_stream_disable(struct bt_bap_stream *stream); /** * @brief Connect unicast audio stream @@ -1222,7 +1219,7 @@ int bt_bap_stream_disable_safe(struct bt_bap_stream *stream); * @retval -EBUSY if another ISO channel is connecting * @retval -ENOEXEC if otherwise rejected by the ISO layer */ -int bt_bap_stream_connect_safe(struct bt_bap_stream *stream); +int bt_bap_stream_connect(struct bt_bap_stream *stream); /** * @brief Start Audio Stream @@ -1246,7 +1243,7 @@ int bt_bap_stream_connect_safe(struct bt_bap_stream *stream); * * @return 0 in case of success or negative value in case of error. */ -int bt_bap_stream_start_safe(struct bt_bap_stream *stream); +int bt_bap_stream_start(struct bt_bap_stream *stream); /** * @brief Stop Audio Stream @@ -1271,7 +1268,7 @@ int bt_bap_stream_start_safe(struct bt_bap_stream *stream); * @retval -ENOEXEC The request was rejected by GATT * @return 0 in case of success or negative value in case of error. */ -int bt_bap_stream_stop_safe(struct bt_bap_stream *stream); +int bt_bap_stream_stop(struct bt_bap_stream *stream); /** * @brief Release Audio Stream @@ -1286,7 +1283,7 @@ int bt_bap_stream_stop_safe(struct bt_bap_stream *stream); * * @return 0 in case of success or negative value in case of error. */ -int bt_bap_stream_release_safe(struct bt_bap_stream *stream); +int bt_bap_stream_release(struct bt_bap_stream *stream); /** * @brief Send data to Audio stream without timestamp @@ -1302,7 +1299,7 @@ int bt_bap_stream_release_safe(struct bt_bap_stream *stream); * * @return Bytes sent in case of success or negative value in case of error. */ -int bt_bap_stream_send_safe(struct bt_bap_stream *stream, struct net_buf *buf, uint16_t seq_num); +int bt_bap_stream_send(struct bt_bap_stream *stream, struct net_buf *buf, uint16_t seq_num); /** * @brief Send data to Audio stream with timestamp @@ -1320,8 +1317,8 @@ int bt_bap_stream_send_safe(struct bt_bap_stream *stream, struct net_buf *buf, u * * @return Bytes sent in case of success or negative value in case of error. */ -int bt_bap_stream_send_ts_safe(struct bt_bap_stream *stream, struct net_buf *buf, uint16_t seq_num, - uint32_t ts); +int bt_bap_stream_send_ts(struct bt_bap_stream *stream, struct net_buf *buf, uint16_t seq_num, + uint32_t ts); /** * @brief Get ISO transmission timing info for a Basic Audio Profile stream @@ -1341,7 +1338,7 @@ int bt_bap_stream_send_ts_safe(struct bt_bap_stream *stream, struct net_buf *buf * not connected with a isochronous stream * @retval Any return value from bt_iso_chan_get_tx_sync() */ -int bt_bap_stream_get_tx_sync_safe(struct bt_bap_stream *stream, struct bt_iso_tx_info *info); +int bt_bap_stream_get_tx_sync(struct bt_bap_stream *stream, struct bt_iso_tx_info *info); /** * @defgroup bt_bap_unicast_server BAP Unicast Server APIs @@ -1506,7 +1503,6 @@ struct bt_bap_unicast_server_cb { * @return 0 in case of success, negative error code otherwise. */ int bt_bap_unicast_server_register(const struct bt_bap_unicast_server_register_param *param); -int bt_bap_unicast_server_register_safe(const struct bt_bap_unicast_server_register_param *param); /** * @brief Unregister the Unicast Server. @@ -1523,7 +1519,6 @@ int bt_bap_unicast_server_register_safe(const struct bt_bap_unicast_server_regis * @return 0 in case of success, negative error code otherwise. */ int bt_bap_unicast_server_unregister(void); -int bt_bap_unicast_server_unregister_safe(void); /** * @brief Register unicast server callbacks. @@ -1537,7 +1532,7 @@ int bt_bap_unicast_server_unregister_safe(void); * * @return 0 in case of success or negative value in case of error. */ -int bt_bap_unicast_server_register_cb_safe(const struct bt_bap_unicast_server_cb *cb); +int bt_bap_unicast_server_register_cb(const struct bt_bap_unicast_server_cb *cb); /** * @brief Unregister unicast server callbacks. @@ -1552,7 +1547,7 @@ int bt_bap_unicast_server_register_cb_safe(const struct bt_bap_unicast_server_cb * * @return 0 in case of success or negative value in case of error. */ -int bt_bap_unicast_server_unregister_cb_safe(const struct bt_bap_unicast_server_cb *cb); +int bt_bap_unicast_server_unregister_cb(const struct bt_bap_unicast_server_cb *cb); /** * @typedef bt_bap_ep_func_t @@ -1592,9 +1587,6 @@ int bt_bap_unicast_server_foreach_ep(struct bt_conn *conn, bt_bap_ep_func_t func int bt_bap_unicast_server_config_ase(struct bt_conn *conn, struct bt_bap_stream *stream, struct bt_audio_codec_cfg *codec_cfg, const struct bt_bap_qos_cfg_pref *qos_pref); -int bt_bap_unicast_server_config_ase_safe(struct bt_conn *conn, struct bt_bap_stream *stream, - struct bt_audio_codec_cfg *codec_cfg, - const struct bt_bap_qos_cfg_pref *qos_pref); /** * @brief Initialize and configure a new ASE of a specific direction. @@ -1706,8 +1698,8 @@ struct bt_bap_unicast_group_param { * * @return Zero on success or (negative) error code otherwise. */ -int bt_bap_unicast_group_create_safe(struct bt_bap_unicast_group_param *param, - struct bt_bap_unicast_group **unicast_group); +int bt_bap_unicast_group_create(struct bt_bap_unicast_group_param *param, + struct bt_bap_unicast_group **unicast_group); /** * @brief Reconfigure unicast group. @@ -1724,8 +1716,8 @@ int bt_bap_unicast_group_create_safe(struct bt_bap_unicast_group_param *param, * * @return Zero on success or (negative) error code otherwise. */ -int bt_bap_unicast_group_reconfig_safe(struct bt_bap_unicast_group *unicast_group, - const struct bt_bap_unicast_group_param *param); +int bt_bap_unicast_group_reconfig(struct bt_bap_unicast_group *unicast_group, + const struct bt_bap_unicast_group_param *param); /** * @brief Add streams to a unicast group as a unicast client @@ -1746,9 +1738,9 @@ int bt_bap_unicast_group_reconfig_safe(struct bt_bap_unicast_group *unicast_grou * * @return 0 in case of success or negative value in case of error. */ -int bt_bap_unicast_group_add_streams_safe(struct bt_bap_unicast_group *unicast_group, - struct bt_bap_unicast_group_stream_pair_param params[], - size_t num_param); +int bt_bap_unicast_group_add_streams(struct bt_bap_unicast_group *unicast_group, + struct bt_bap_unicast_group_stream_pair_param params[], + size_t num_param); /** * @brief Delete audio unicast group. @@ -1760,7 +1752,7 @@ int bt_bap_unicast_group_add_streams_safe(struct bt_bap_unicast_group *unicast_g * * @return Zero on success or (negative) error code otherwise. */ -int bt_bap_unicast_group_delete_safe(struct bt_bap_unicast_group *unicast_group); +int bt_bap_unicast_group_delete(struct bt_bap_unicast_group *unicast_group); /** Callback function for bt_bap_unicast_group_foreach_stream() * @@ -1784,9 +1776,9 @@ typedef bool (*bt_bap_unicast_group_foreach_stream_func_t)(struct bt_bap_stream * @retval -ECANCELED Iteration was stopped by the callback function before complete. * @retval -EINVAL @p unicast_group or @p func were NULL. */ -int bt_bap_unicast_group_foreach_stream_safe(struct bt_bap_unicast_group *unicast_group, - bt_bap_unicast_group_foreach_stream_func_t func, - void *user_data); +int bt_bap_unicast_group_foreach_stream(struct bt_bap_unicast_group *unicast_group, + bt_bap_unicast_group_foreach_stream_func_t func, + void *user_data); /** Structure holding information of audio stream endpoint */ struct bt_bap_unicast_group_info { @@ -1812,8 +1804,8 @@ struct bt_bap_unicast_group_info { * @retval 0 Success * @retval -EINVAL @p unicast_group or @p info are NULL */ -int bt_bap_unicast_group_get_info_safe(const struct bt_bap_unicast_group *unicast_group, - struct bt_bap_unicast_group_info *info); +int bt_bap_unicast_group_get_info(const struct bt_bap_unicast_group *unicast_group, + struct bt_bap_unicast_group_info *info); /** Unicast Client callback structure */ struct bt_bap_unicast_client_cb { @@ -2024,7 +2016,9 @@ struct bt_bap_unicast_client_cb { * @retval -EINVAL @p cb is NULL. * @retval -EEXIST @p cb is already registered. */ -int bt_bap_unicast_client_register_cb_safe(struct bt_bap_unicast_client_cb *cb); +#if 0 +int bt_bap_unicast_client_register_cb(struct bt_bap_unicast_client_cb *cb); +#endif /** * @brief Unregister unicast client callbacks. @@ -2034,7 +2028,7 @@ int bt_bap_unicast_client_register_cb_safe(struct bt_bap_unicast_client_cb *cb); * @retval 0 Success * @retval -EINVAL @p cb is NULL or @p cb was not registered */ -int bt_bap_unicast_client_unregister_cb_safe(struct bt_bap_unicast_client_cb *cb); +int bt_bap_unicast_client_unregister_cb(struct bt_bap_unicast_client_cb *cb); /** * @brief Discover remote capabilities and endpoints @@ -2046,7 +2040,6 @@ int bt_bap_unicast_client_unregister_cb_safe(struct bt_bap_unicast_client_cb *cb * @param dir The type of remote endpoints and capabilities to discover. */ int bt_bap_unicast_client_discover(struct bt_conn *conn, enum bt_audio_dir dir); -int bt_bap_unicast_client_discover_safe(struct bt_conn *conn, enum bt_audio_dir dir); /** @} */ /* End of group bt_bap_unicast_client */ /** @@ -2296,7 +2289,7 @@ struct bt_bap_broadcast_source_cb { * @retval -EINVAL if @p cb is NULL * @retval -EEXIST if @p cb is already registered */ -int bt_bap_broadcast_source_register_cb_safe(struct bt_bap_broadcast_source_cb *cb); +int bt_bap_broadcast_source_register_cb(struct bt_bap_broadcast_source_cb *cb); /** * @brief Unregisters callbacks for Broadcast Sources @@ -2307,7 +2300,7 @@ int bt_bap_broadcast_source_register_cb_safe(struct bt_bap_broadcast_source_cb * * @retval -EINVAL if @p cb is NULL * @retval -ENOENT if @p cb is not registered */ -int bt_bap_broadcast_source_unregister_cb_safe(struct bt_bap_broadcast_source_cb *cb); +int bt_bap_broadcast_source_unregister_cb(struct bt_bap_broadcast_source_cb *cb); /** Broadcast Source stream parameters */ struct bt_bap_broadcast_source_stream_param { @@ -2416,8 +2409,8 @@ struct bt_bap_broadcast_source_param { * * @return Zero on success or (negative) error code otherwise. */ -int bt_bap_broadcast_source_create_safe(struct bt_bap_broadcast_source_param *param, - struct bt_bap_broadcast_source **source); +int bt_bap_broadcast_source_create(struct bt_bap_broadcast_source_param *param, + struct bt_bap_broadcast_source **source); /** * @brief Reconfigure audio broadcast source. @@ -2438,8 +2431,8 @@ int bt_bap_broadcast_source_create_safe(struct bt_bap_broadcast_source_param *pa * * @return Zero on success or (negative) error code otherwise. */ -int bt_bap_broadcast_source_reconfig_safe(struct bt_bap_broadcast_source *source, - struct bt_bap_broadcast_source_param *param); +int bt_bap_broadcast_source_reconfig(struct bt_bap_broadcast_source *source, + struct bt_bap_broadcast_source_param *param); /** * @brief Modify the metadata of an audio broadcast source. @@ -2453,8 +2446,8 @@ int bt_bap_broadcast_source_reconfig_safe(struct bt_bap_broadcast_source *source * * @return Zero on success or (negative) error code otherwise. */ -int bt_bap_broadcast_source_update_metadata_safe(struct bt_bap_broadcast_source *source, - const uint8_t meta[], size_t meta_len); +int bt_bap_broadcast_source_update_metadata(struct bt_bap_broadcast_source *source, + const uint8_t meta[], size_t meta_len); /** * @brief Start audio broadcast source. @@ -2469,8 +2462,6 @@ int bt_bap_broadcast_source_update_metadata_safe(struct bt_bap_broadcast_source */ int bt_bap_broadcast_source_start(struct bt_bap_broadcast_source *source, struct bt_le_ext_adv *adv); -int bt_bap_broadcast_source_start_safe(struct bt_bap_broadcast_source *source, - struct bt_le_ext_adv *adv); /** * @brief Stop audio broadcast source. @@ -2482,7 +2473,7 @@ int bt_bap_broadcast_source_start_safe(struct bt_bap_broadcast_source *source, * * @return Zero on success or (negative) error code otherwise. */ -int bt_bap_broadcast_source_stop_safe(struct bt_bap_broadcast_source *source); +int bt_bap_broadcast_source_stop(struct bt_bap_broadcast_source *source); /** * @brief Delete audio broadcast source. @@ -2494,7 +2485,7 @@ int bt_bap_broadcast_source_stop_safe(struct bt_bap_broadcast_source *source); * * @return Zero on success or (negative) error code otherwise. */ -int bt_bap_broadcast_source_delete_safe(struct bt_bap_broadcast_source *source); +int bt_bap_broadcast_source_delete(struct bt_bap_broadcast_source *source); /** * @brief Get the Broadcast Audio Stream Endpoint of a broadcast source @@ -2510,8 +2501,8 @@ int bt_bap_broadcast_source_delete_safe(struct bt_bap_broadcast_source *source); * * @return Zero on success or (negative) error code otherwise. */ -int bt_bap_broadcast_source_get_base_safe(struct bt_bap_broadcast_source *source, - struct net_buf_simple *base_buf); +int bt_bap_broadcast_source_get_base(struct bt_bap_broadcast_source *source, + struct net_buf_simple *base_buf); /** * @brief Callback function for bt_bap_broadcast_source_foreach_stream() @@ -2536,9 +2527,9 @@ typedef bool (*bt_bap_broadcast_source_foreach_stream_func_t)(struct bt_bap_stre * @retval -ECANCELED The @p func returned false and stopped the iteration. * @retval -EINVAL @p source or @p func were NULL. */ -int bt_bap_broadcast_source_foreach_stream_safe(struct bt_bap_broadcast_source *source, - bt_bap_broadcast_source_foreach_stream_func_t func, - void *user_data); +int bt_bap_broadcast_source_foreach_stream(struct bt_bap_broadcast_source *source, + bt_bap_broadcast_source_foreach_stream_func_t func, + void *user_data); /** @} */ /* End of bt_bap_broadcast_source */ /** @@ -2612,7 +2603,7 @@ struct bt_bap_broadcast_sink_cb { * @retval -EINVAL if @p cb is NULL * @retval -EALREADY if @p cb was already registered */ -int bt_bap_broadcast_sink_register_cb_safe(struct bt_bap_broadcast_sink_cb *cb); +int bt_bap_broadcast_sink_register_cb(struct bt_bap_broadcast_sink_cb *cb); /** * @brief Create a Broadcast Sink from a periodic advertising sync @@ -2632,8 +2623,8 @@ int bt_bap_broadcast_sink_register_cb_safe(struct bt_bap_broadcast_sink_cb *cb); * * @return 0 in case of success or errno value in case of error. */ -int bt_bap_broadcast_sink_create_safe(struct bt_le_per_adv_sync *pa_sync, uint32_t broadcast_id, - struct bt_bap_broadcast_sink **sink); +int bt_bap_broadcast_sink_create(struct bt_le_per_adv_sync *pa_sync, uint32_t broadcast_id, + struct bt_bap_broadcast_sink **sink); /** * @brief Sync to a broadcaster's audio @@ -2654,9 +2645,9 @@ int bt_bap_broadcast_sink_create_safe(struct bt_le_per_adv_sync *pa_sync, uint32 * * @return 0 in case of success or negative value in case of error. */ -int bt_bap_broadcast_sink_sync_safe(struct bt_bap_broadcast_sink *sink, uint32_t indexes_bitfield, - struct bt_bap_stream *streams[], - const uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]); +int bt_bap_broadcast_sink_sync(struct bt_bap_broadcast_sink *sink, uint32_t indexes_bitfield, + struct bt_bap_stream *streams[], + const uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]); /** * @brief Stop audio broadcast sink. @@ -2668,7 +2659,7 @@ int bt_bap_broadcast_sink_sync_safe(struct bt_bap_broadcast_sink *sink, uint32_t * * @return Zero on success or (negative) error code otherwise. */ -int bt_bap_broadcast_sink_stop_safe(struct bt_bap_broadcast_sink *sink); +int bt_bap_broadcast_sink_stop(struct bt_bap_broadcast_sink *sink); /** * @brief Release a broadcast sink @@ -2681,7 +2672,7 @@ int bt_bap_broadcast_sink_stop_safe(struct bt_bap_broadcast_sink *sink); * * @return 0 in case of success or negative value in case of error. */ -int bt_bap_broadcast_sink_delete_safe(struct bt_bap_broadcast_sink *sink); +int bt_bap_broadcast_sink_delete(struct bt_bap_broadcast_sink *sink); /** @} */ /* End of group bt_bap_broadcast_sink */ @@ -2699,7 +2690,6 @@ int bt_bap_broadcast_sink_delete_safe(struct bt_bap_broadcast_sink *sink); * @return 0 in case of success or negative value in case of error. */ int bt_bap_scan_delegator_register(struct bt_bap_scan_delegator_cb *cb); -int bt_bap_scan_delegator_register_safe(struct bt_bap_scan_delegator_cb *cb); /** * @brief unregister the Basic Audio Profile Scan Delegator and BASS. @@ -2710,7 +2700,6 @@ int bt_bap_scan_delegator_register_safe(struct bt_bap_scan_delegator_cb *cb); * @return 0 in case of success or negative value in case of error. */ int bt_bap_scan_delegator_unregister(void); -int bt_bap_scan_delegator_unregister_safe(void); /** * @brief Set the periodic advertising sync state to syncing @@ -2723,8 +2712,8 @@ int bt_bap_scan_delegator_unregister_safe(void); * * @return int Error value. 0 on success, errno on fail. */ -int bt_bap_scan_delegator_set_pa_state_safe(uint8_t src_id, - enum bt_bap_pa_state pa_state); +int bt_bap_scan_delegator_set_pa_state(uint8_t src_id, + enum bt_bap_pa_state pa_state); /** * @brief Set the sync state of a receive state in the server @@ -2734,8 +2723,8 @@ int bt_bap_scan_delegator_set_pa_state_safe(uint8_t src_id, * subgroup. * @return int Error value. 0 on success, ERRNO on fail. */ -int bt_bap_scan_delegator_set_bis_sync_state_safe(uint8_t src_id, - uint32_t bis_synced[CONFIG_BT_BAP_BASS_MAX_SUBGROUPS]); +int bt_bap_scan_delegator_set_bis_sync_state(uint8_t src_id, + uint32_t bis_synced[CONFIG_BT_BAP_BASS_MAX_SUBGROUPS]); /** Parameters for bt_bap_scan_delegator_add_src() */ struct bt_bap_scan_delegator_add_src_param { @@ -2779,7 +2768,7 @@ struct bt_bap_scan_delegator_add_src_param { * * @return int errno on failure, or source ID on success. */ -int bt_bap_scan_delegator_add_src_safe(const struct bt_bap_scan_delegator_add_src_param *param); +int bt_bap_scan_delegator_add_src(const struct bt_bap_scan_delegator_add_src_param *param); /** Parameters for bt_bap_scan_delegator_mod_src() */ struct bt_bap_scan_delegator_mod_src_param { @@ -2817,7 +2806,7 @@ struct bt_bap_scan_delegator_mod_src_param { * * @return int errno on failure, or source ID on success. */ -int bt_bap_scan_delegator_mod_src_safe(const struct bt_bap_scan_delegator_mod_src_param *param); +int bt_bap_scan_delegator_mod_src(const struct bt_bap_scan_delegator_mod_src_param *param); /** * @brief Remove a receive state source @@ -2832,7 +2821,7 @@ int bt_bap_scan_delegator_mod_src_safe(const struct bt_bap_scan_delegator_mod_sr * * @return int Error value. 0 on success, errno on fail. */ -int bt_bap_scan_delegator_rem_src_safe(uint8_t src_id); +int bt_bap_scan_delegator_rem_src(uint8_t src_id); /** Callback function for Scan Delegator receive state search functions * @@ -2853,8 +2842,8 @@ typedef bool (*bt_bap_scan_delegator_state_func_t)( * @param func The callback function * @param user_data User specified data that sent to the callback function */ -void bt_bap_scan_delegator_foreach_state_safe(bt_bap_scan_delegator_state_func_t func, - void *user_data); +void bt_bap_scan_delegator_foreach_state(bt_bap_scan_delegator_state_func_t func, + void *user_data); /** * @brief Find and return a receive state based on a compare function @@ -2864,7 +2853,7 @@ void bt_bap_scan_delegator_foreach_state_safe(bt_bap_scan_delegator_state_func_t * * @return The first receive state where the @p func returned true, or NULL */ -const struct bt_bap_scan_delegator_recv_state *bt_bap_scan_delegator_find_state_safe( +const struct bt_bap_scan_delegator_recv_state *bt_bap_scan_delegator_find_state( bt_bap_scan_delegator_state_func_t func, void *user_data); /******************************** CLIENT API ********************************/ @@ -2998,7 +2987,6 @@ struct bt_bap_broadcast_assistant_cb { * @retval -ENOEXEC Unexpected GATT error */ int bt_bap_broadcast_assistant_discover(struct bt_conn *conn); -int bt_bap_broadcast_assistant_discover_safe(struct bt_conn *conn); /** * @brief Scan start for BISes for a remote server. @@ -3026,8 +3014,6 @@ int bt_bap_broadcast_assistant_discover_safe(struct bt_conn *conn); */ int bt_bap_broadcast_assistant_scan_start(struct bt_conn *conn, bool start_scan); -int bt_bap_broadcast_assistant_scan_start_safe(struct bt_conn *conn, - bool start_scan); /** * @brief Stop remote scanning for BISes for a server. @@ -3043,7 +3029,6 @@ int bt_bap_broadcast_assistant_scan_start_safe(struct bt_conn *conn, * @retval -ENOEXEC Unexpected scan or GATT error */ int bt_bap_broadcast_assistant_scan_stop(struct bt_conn *conn); -int bt_bap_broadcast_assistant_scan_stop_safe(struct bt_conn *conn); /** * @brief Registers the callbacks used by Broadcast Audio Scan Service client. @@ -3054,7 +3039,7 @@ int bt_bap_broadcast_assistant_scan_stop_safe(struct bt_conn *conn); * @retval -EINVAL if @p cb is NULL * @retval -EALREADY if @p cb was already registered */ -int bt_bap_broadcast_assistant_register_cb_safe(struct bt_bap_broadcast_assistant_cb *cb); +int bt_bap_broadcast_assistant_register_cb(struct bt_bap_broadcast_assistant_cb *cb); /** * @brief Unregisters the callbacks used by the Broadcast Audio Scan Service client. @@ -3065,7 +3050,7 @@ int bt_bap_broadcast_assistant_register_cb_safe(struct bt_bap_broadcast_assistan * @retval -EINVAL if @p cb is NULL * @retval -EALREADY if @p cb was not registered */ -int bt_bap_broadcast_assistant_unregister_cb_safe(struct bt_bap_broadcast_assistant_cb *cb); +int bt_bap_broadcast_assistant_unregister_cb(struct bt_bap_broadcast_assistant_cb *cb); /** Parameters for adding a source to a Broadcast Audio Scan Service server */ struct bt_bap_broadcast_assistant_add_src_param { @@ -3114,8 +3099,6 @@ struct bt_bap_broadcast_assistant_add_src_param { */ int bt_bap_broadcast_assistant_add_src( struct bt_conn *conn, const struct bt_bap_broadcast_assistant_add_src_param *param); -int bt_bap_broadcast_assistant_add_src_safe( - struct bt_conn *conn, const struct bt_bap_broadcast_assistant_add_src_param *param); /** Parameters for modifying a source */ struct bt_bap_broadcast_assistant_mod_src_param { @@ -3154,8 +3137,6 @@ struct bt_bap_broadcast_assistant_mod_src_param { */ int bt_bap_broadcast_assistant_mod_src( struct bt_conn *conn, const struct bt_bap_broadcast_assistant_mod_src_param *param); -int bt_bap_broadcast_assistant_mod_src_safe( - struct bt_conn *conn, const struct bt_bap_broadcast_assistant_mod_src_param *param); /** * @brief Set a broadcast code to the specified receive state. @@ -3174,9 +3155,6 @@ int bt_bap_broadcast_assistant_mod_src_safe( int bt_bap_broadcast_assistant_set_broadcast_code( struct bt_conn *conn, uint8_t src_id, const uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]); -int bt_bap_broadcast_assistant_set_broadcast_code_safe( - struct bt_conn *conn, uint8_t src_id, - const uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]); /** * @brief Remove a source from the server. @@ -3192,7 +3170,6 @@ int bt_bap_broadcast_assistant_set_broadcast_code_safe( * @retval -ENOEXEC Unexpected scan or GATT error */ int bt_bap_broadcast_assistant_rem_src(struct bt_conn *conn, uint8_t src_id); -int bt_bap_broadcast_assistant_rem_src_safe(struct bt_conn *conn, uint8_t src_id); /** * @brief Read the specified receive state from the server. @@ -3209,7 +3186,6 @@ int bt_bap_broadcast_assistant_rem_src_safe(struct bt_conn *conn, uint8_t src_id * @retval -ENOEXEC Unexpected scan or GATT error */ int bt_bap_broadcast_assistant_read_recv_state(struct bt_conn *conn, uint8_t idx); -int bt_bap_broadcast_assistant_read_recv_state_safe(struct bt_conn *conn, uint8_t idx); /** @} */ /* end of bt_bap */ diff --git a/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/cap.h b/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/cap.h index cfa4a098957..389102bf397 100644 --- a/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/cap.h +++ b/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/cap.h @@ -77,8 +77,8 @@ struct bt_cap_unicast_group; * * @return 0 if success, errno on failure. */ -int bt_cap_acceptor_register_safe(const struct bt_csip_set_member_register_param *param, - struct bt_csip_set_member_svc_inst **svc_inst); +int bt_cap_acceptor_register(const struct bt_csip_set_member_register_param *param, + struct bt_csip_set_member_svc_inst **svc_inst); /** Callback structure for CAP procedures */ struct bt_cap_initiator_cb { @@ -166,7 +166,6 @@ struct bt_cap_initiator_cb { * @retval -ENOMEM Could not allocated memory for the request */ int bt_cap_initiator_unicast_discover(struct bt_conn *conn); -int bt_cap_initiator_unicast_discover_safe(struct bt_conn *conn); /** Type of CAP set */ enum bt_cap_set_type { @@ -207,7 +206,7 @@ struct bt_cap_stream { * @param stream Stream object. * @param ops Stream operations structure. */ -void bt_cap_stream_ops_register_safe(struct bt_cap_stream *stream, struct bt_bap_stream_ops *ops); +void bt_cap_stream_ops_register(struct bt_cap_stream *stream, struct bt_bap_stream_ops *ops); /** * @brief Send data to Common Audio Profile stream without timestamp @@ -224,7 +223,7 @@ void bt_cap_stream_ops_register_safe(struct bt_cap_stream *stream, struct bt_bap * @retval -EINVAL if stream object is NULL * @retval Any return value from bt_bap_stream_send() */ -int bt_cap_stream_send_safe(struct bt_cap_stream *stream, struct net_buf *buf, uint16_t seq_num); +int bt_cap_stream_send(struct bt_cap_stream *stream, struct net_buf *buf, uint16_t seq_num); /** * @brief Send data to Common Audio Profile stream with timestamp @@ -243,8 +242,8 @@ int bt_cap_stream_send_safe(struct bt_cap_stream *stream, struct net_buf *buf, u * @retval -EINVAL if stream object is NULL * @retval Any return value from bt_bap_stream_send() */ -int bt_cap_stream_send_ts_safe(struct bt_cap_stream *stream, struct net_buf *buf, uint16_t seq_num, - uint32_t ts); +int bt_cap_stream_send_ts(struct bt_cap_stream *stream, struct net_buf *buf, uint16_t seq_num, + uint32_t ts); /** * @brief Get ISO transmission timing info for a Common Audio Profile stream @@ -259,7 +258,7 @@ int bt_cap_stream_send_ts_safe(struct bt_cap_stream *stream, struct net_buf *buf * @retval -EINVAL if stream object is NULL * @retval Any return value from bt_bap_stream_get_tx_sync() */ -int bt_cap_stream_get_tx_sync_safe(struct bt_cap_stream *stream, struct bt_iso_tx_info *info); +int bt_cap_stream_get_tx_sync(struct bt_cap_stream *stream, struct bt_iso_tx_info *info); /** Parameter struct for each stream in the unicast group */ struct bt_cap_unicast_group_stream_param { @@ -344,8 +343,8 @@ struct bt_cap_unicast_group_param { * * @return Zero on success or (negative) error code otherwise. */ -int bt_cap_unicast_group_create_safe(const struct bt_cap_unicast_group_param *param, - struct bt_cap_unicast_group **unicast_group); +int bt_cap_unicast_group_create(const struct bt_cap_unicast_group_param *param, + struct bt_cap_unicast_group **unicast_group); /** * @brief Reconfigure unicast group. @@ -362,8 +361,8 @@ int bt_cap_unicast_group_create_safe(const struct bt_cap_unicast_group_param *pa * * @return Zero on success or (negative) error code otherwise. */ -int bt_cap_unicast_group_reconfig_safe(struct bt_cap_unicast_group *unicast_group, - const struct bt_cap_unicast_group_param *param); +int bt_cap_unicast_group_reconfig(struct bt_cap_unicast_group *unicast_group, + const struct bt_cap_unicast_group_param *param); /** * @brief Add streams to a unicast group as a unicast client @@ -384,9 +383,9 @@ int bt_cap_unicast_group_reconfig_safe(struct bt_cap_unicast_group *unicast_grou * * @return 0 in case of success or negative value in case of error. */ -int bt_cap_unicast_group_add_streams_safe(struct bt_cap_unicast_group *unicast_group, - const struct bt_cap_unicast_group_stream_pair_param params[], - size_t num_param); +int bt_cap_unicast_group_add_streams(struct bt_cap_unicast_group *unicast_group, + const struct bt_cap_unicast_group_stream_pair_param params[], + size_t num_param); /** * @brief Delete audio unicast group. @@ -398,7 +397,7 @@ int bt_cap_unicast_group_add_streams_safe(struct bt_cap_unicast_group *unicast_g * * @return Zero on success or (negative) error code otherwise. */ -int bt_cap_unicast_group_delete_safe(struct bt_cap_unicast_group *unicast_group); +int bt_cap_unicast_group_delete(struct bt_cap_unicast_group *unicast_group); /** Callback function for bt_cap_unicast_group_foreach_stream() * @@ -422,9 +421,9 @@ typedef bool (*bt_cap_unicast_group_foreach_stream_func_t)(struct bt_cap_stream * @retval -ECANCELED The @p func returned false and stopped the iteration. * @retval -EINVAL @p unicast_group or @p func were NULL. */ -int bt_cap_unicast_group_foreach_stream_safe(struct bt_cap_unicast_group *unicast_group, - bt_cap_unicast_group_foreach_stream_func_t func, - void *user_data); +int bt_cap_unicast_group_foreach_stream(struct bt_cap_unicast_group *unicast_group, + bt_cap_unicast_group_foreach_stream_func_t func, + void *user_data); /** Structure holding information of audio stream endpoint */ struct bt_cap_unicast_group_info { @@ -441,8 +440,8 @@ struct bt_cap_unicast_group_info { * @retval 0 Success * @retval -EINVAL @p unicast_group or @p info are NULL */ -int bt_cap_unicast_group_get_info_safe(const struct bt_cap_unicast_group *unicast_group, - struct bt_cap_unicast_group_info *info); +int bt_cap_unicast_group_get_info(const struct bt_cap_unicast_group *unicast_group, + struct bt_cap_unicast_group_info *info); /** Stream specific parameters for the bt_cap_initiator_unicast_audio_start() function */ struct bt_cap_unicast_audio_start_stream_param { @@ -530,7 +529,7 @@ struct bt_cap_unicast_audio_stop_param { * * @return 0 on success or negative error value on failure. */ -int bt_cap_initiator_register_cb_safe(const struct bt_cap_initiator_cb *cb); +int bt_cap_initiator_register_cb(const struct bt_cap_initiator_cb *cb); /** * @brief Unregister Common Audio Profile Initiator callbacks @@ -540,7 +539,7 @@ int bt_cap_initiator_register_cb_safe(const struct bt_cap_initiator_cb *cb); * @retval 0 Success * @retval -EINVAL @p cb is NULL or @p cb was not registered */ -int bt_cap_initiator_unregister_cb_safe(const struct bt_cap_initiator_cb *cb); +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. @@ -560,7 +559,7 @@ int bt_cap_initiator_unregister_cb_safe(const struct bt_cap_initiator_cb *cb); * @retval -EINVAL if any parameter is invalid * @retval -EALREADY All streams are already in the streaming state */ -int bt_cap_initiator_unicast_audio_start_safe(const struct bt_cap_unicast_audio_start_param *param); +int bt_cap_initiator_unicast_audio_start(const struct bt_cap_unicast_audio_start_param *param); /** * @brief Update unicast audio streams. @@ -575,7 +574,7 @@ int bt_cap_initiator_unicast_audio_start_safe(const struct bt_cap_unicast_audio_ * * @return 0 on success or negative error value on failure. */ -int bt_cap_initiator_unicast_audio_update_safe(const struct bt_cap_unicast_audio_update_param *param); +int bt_cap_initiator_unicast_audio_update(const struct bt_cap_unicast_audio_update_param *param); /** * @brief Stop unicast audio streams. @@ -593,7 +592,7 @@ int bt_cap_initiator_unicast_audio_update_safe(const struct bt_cap_unicast_audio * @retval -EINVAL if any parameter is invalid * @retval -EALREADY if no state changes will occur */ -int bt_cap_initiator_unicast_audio_stop_safe(const struct bt_cap_unicast_audio_stop_param *param); +int bt_cap_initiator_unicast_audio_stop(const struct bt_cap_unicast_audio_stop_param *param); /** * @brief Cancel any current Common Audio Profile procedure @@ -618,7 +617,7 @@ int bt_cap_initiator_unicast_audio_stop_safe(const struct bt_cap_unicast_audio_s * @retval 0 on success * @retval -EALREADY if no procedure is active */ -int bt_cap_initiator_unicast_audio_cancel_safe(void); +int bt_cap_initiator_unicast_audio_cancel(void); /** * Parameters part of @p bt_cap_initiator_broadcast_subgroup_param for @@ -737,7 +736,7 @@ struct bt_cap_initiator_broadcast_create_param { * configuration data. * @retval -ENOEXEC The broadcast source failed to be created for other reasons */ -int bt_cap_initiator_broadcast_audio_create_safe( +int bt_cap_initiator_broadcast_audio_create( const struct bt_cap_initiator_broadcast_create_param *param, struct bt_cap_broadcast_source **broadcast_source); @@ -762,8 +761,6 @@ int bt_cap_initiator_broadcast_audio_create_safe( */ int bt_cap_initiator_broadcast_audio_start(struct bt_cap_broadcast_source *broadcast_source, struct bt_le_ext_adv *adv); -int bt_cap_initiator_broadcast_audio_start_safe(struct bt_cap_broadcast_source *broadcast_source, - struct bt_le_ext_adv *adv); /** * @brief Update broadcast audio streams for a Common Audio Profile broadcast source. @@ -779,8 +776,8 @@ int bt_cap_initiator_broadcast_audio_start_safe(struct bt_cap_broadcast_source * * * @return 0 on success or negative error value on failure. */ -int bt_cap_initiator_broadcast_audio_update_safe(struct bt_cap_broadcast_source *broadcast_source, - const uint8_t meta[], size_t meta_len); +int bt_cap_initiator_broadcast_audio_update(struct bt_cap_broadcast_source *broadcast_source, + const uint8_t meta[], size_t meta_len); /** * @brief Stop broadcast audio streams for a Common Audio Profile broadcast source. @@ -794,7 +791,7 @@ int bt_cap_initiator_broadcast_audio_update_safe(struct bt_cap_broadcast_source * * @return 0 on success or negative error value on failure. */ -int bt_cap_initiator_broadcast_audio_stop_safe(struct bt_cap_broadcast_source *broadcast_source); +int bt_cap_initiator_broadcast_audio_stop(struct bt_cap_broadcast_source *broadcast_source); /** * @brief Delete Common Audio Profile broadcast source @@ -813,7 +810,7 @@ int bt_cap_initiator_broadcast_audio_stop_safe(struct bt_cap_broadcast_source *b * * @return 0 on success or negative error value on failure. */ -int bt_cap_initiator_broadcast_audio_delete_safe(struct bt_cap_broadcast_source *broadcast_source); +int bt_cap_initiator_broadcast_audio_delete(struct bt_cap_broadcast_source *broadcast_source); /** * @brief Get the Broadcast Audio Stream Endpoint of a Common Audio Profile broadcast source @@ -830,8 +827,8 @@ int bt_cap_initiator_broadcast_audio_delete_safe(struct bt_cap_broadcast_source * * @return int 0 if on success, errno on error. */ -int bt_cap_initiator_broadcast_get_base_safe(struct bt_cap_broadcast_source *broadcast_source, - struct net_buf_simple *base_buf); +int bt_cap_initiator_broadcast_get_base(struct bt_cap_broadcast_source *broadcast_source, + struct net_buf_simple *base_buf); /** Callback function for bt_cap_initiator_broadcast_foreach_stream() * @@ -855,9 +852,9 @@ typedef bool (*bt_cap_initiator_broadcast_foreach_stream_func_t)(struct bt_cap_s * @retval -ECANCELED The @p func returned false and stopped the iteration. * @retval -EINVAL @p broadcast_source or @p func were NULL. */ -int bt_cap_initiator_broadcast_foreach_stream_safe(struct bt_cap_broadcast_source *broadcast_source, - bt_cap_initiator_broadcast_foreach_stream_func_t func, - void *user_data); +int bt_cap_initiator_broadcast_foreach_stream(struct bt_cap_broadcast_source *broadcast_source, + bt_cap_initiator_broadcast_foreach_stream_func_t func, + void *user_data); /** Parameters for bt_cap_handover_unicast_to_broadcast() */ struct bt_cap_handover_unicast_to_broadcast_param { @@ -948,7 +945,7 @@ struct bt_cap_handover_cb { * * @return 0 on success or negative error value on failure. */ -int bt_cap_handover_register_cb_safe(const struct bt_cap_handover_cb *cb); +int bt_cap_handover_register_cb(const struct bt_cap_handover_cb *cb); /** * @brief Unregister Common Audio Profile Handover callbacks @@ -958,7 +955,7 @@ int bt_cap_handover_register_cb_safe(const struct bt_cap_handover_cb *cb); * @retval 0 Success * @retval -EINVAL @p cb is NULL or @p cb was not registered */ -int bt_cap_handover_unregister_cb_safe(const struct bt_cap_handover_cb *cb); +int bt_cap_handover_unregister_cb(const struct bt_cap_handover_cb *cb); /** * @brief Hands over the sink streams in a unicast group to a broadcast source. @@ -979,8 +976,6 @@ int bt_cap_handover_unregister_cb_safe(const struct bt_cap_handover_cb *cb); */ int bt_cap_handover_unicast_to_broadcast( const struct bt_cap_handover_unicast_to_broadcast_param *param); -int bt_cap_handover_unicast_to_broadcast_safe( - const struct bt_cap_handover_unicast_to_broadcast_param *param); /** Parameters for bt_cap_handover_broadcast_to_unicast() */ struct bt_cap_handover_broadcast_to_unicast_param { @@ -1040,7 +1035,7 @@ struct bt_cap_handover_broadcast_to_unicast_param { * * @return 0 on success or negative error value on failure. */ -int bt_cap_handover_broadcast_to_unicast_safe( +int bt_cap_handover_broadcast_to_unicast( const struct bt_cap_handover_broadcast_to_unicast_param *param); /** Callback structure for CAP procedures */ @@ -1166,7 +1161,7 @@ struct bt_cap_commander_cb { * @retval -EINVAL @p cb is NULL * @retval -EALREADY Callbacks are already registered */ -int bt_cap_commander_register_cb_safe(const struct bt_cap_commander_cb *cb); +int bt_cap_commander_register_cb(const struct bt_cap_commander_cb *cb); /** * @brief Unregister Common Audio Profile Commander callbacks @@ -1176,7 +1171,7 @@ int bt_cap_commander_register_cb_safe(const struct bt_cap_commander_cb *cb); * @retval 0 Success * @retval -EINVAL @p cb is NULL or @p cb was not registered */ -int bt_cap_commander_unregister_cb_safe(const struct bt_cap_commander_cb *cb); +int bt_cap_commander_unregister_cb(const struct bt_cap_commander_cb *cb); /** * @brief Discovers audio support on a remote device. @@ -1197,7 +1192,6 @@ int bt_cap_commander_unregister_cb_safe(const struct bt_cap_commander_cb *cb); * @retval -EBUSY Already doing discovery for @p conn */ int bt_cap_commander_discover(struct bt_conn *conn); -int bt_cap_commander_discover_safe(struct bt_conn *conn); /** * @brief Cancel any current Common Audio Profile commander procedure @@ -1222,7 +1216,7 @@ int bt_cap_commander_discover_safe(struct bt_conn *conn); * @retval 0 on success * @retval -EALREADY if no procedure is active */ -int bt_cap_commander_cancel_safe(void); +int bt_cap_commander_cancel(void); /** * Parameters part of @ref bt_cap_commander_broadcast_reception_start_param for @@ -1279,7 +1273,7 @@ struct bt_cap_commander_broadcast_reception_start_param { * * @return 0 on success or negative error value on failure. */ -int bt_cap_commander_broadcast_reception_start_safe( +int bt_cap_commander_broadcast_reception_start( const struct bt_cap_commander_broadcast_reception_start_param *param); /** Member parameters for stopping broadcast reception */ @@ -1314,7 +1308,7 @@ struct bt_cap_commander_broadcast_reception_stop_param { * * @return 0 on success or negative error value on failure. */ -int bt_cap_commander_broadcast_reception_stop_safe( +int bt_cap_commander_broadcast_reception_stop( const struct bt_cap_commander_broadcast_reception_stop_param *param); /** Member parameters for distributing broadcast code */ @@ -1358,7 +1352,7 @@ struct bt_cap_commander_distribute_broadcast_code_param { * * @return 0 on success or negative error value on failure. */ -int bt_cap_commander_distribute_broadcast_code_safe( +int bt_cap_commander_distribute_broadcast_code( const struct bt_cap_commander_distribute_broadcast_code_param *param); /** Parameters for changing absolute volume */ @@ -1383,7 +1377,7 @@ struct bt_cap_commander_change_volume_param { * * @return 0 on success or negative error value on failure. */ -int bt_cap_commander_change_volume_safe(const struct bt_cap_commander_change_volume_param *param); +int bt_cap_commander_change_volume(const struct bt_cap_commander_change_volume_param *param); /** * Parameters part of @ref bt_cap_commander_change_volume_offset_param for @@ -1420,7 +1414,7 @@ struct bt_cap_commander_change_volume_offset_param { * * @return 0 on success or negative error value on failure. */ -int bt_cap_commander_change_volume_offset_safe( +int bt_cap_commander_change_volume_offset( const struct bt_cap_commander_change_volume_offset_param *param); /** Parameters for changing volume mute state */ @@ -1449,7 +1443,7 @@ struct bt_cap_commander_change_volume_mute_state_param { * * @return 0 on success or negative error value on failure. */ -int bt_cap_commander_change_volume_mute_state_safe( +int bt_cap_commander_change_volume_mute_state( const struct bt_cap_commander_change_volume_mute_state_param *param); /** Parameters for changing microphone mute state */ @@ -1478,7 +1472,7 @@ struct bt_cap_commander_change_microphone_mute_state_param { * * @return 0 on success or negative error value on failure. */ -int bt_cap_commander_change_microphone_mute_state_safe( +int bt_cap_commander_change_microphone_mute_state( const struct bt_cap_commander_change_microphone_mute_state_param *param); /** @@ -1512,7 +1506,7 @@ struct bt_cap_commander_change_microphone_gain_setting_param { * * @return 0 on success or negative error value on failure. */ -int bt_cap_commander_change_microphone_gain_setting_safe( +int bt_cap_commander_change_microphone_gain_setting( const struct bt_cap_commander_change_microphone_gain_setting_param *param); #ifdef __cplusplus } diff --git a/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/ccp.h b/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/ccp.h index e92c312498a..b9fa4f8cdd8 100644 --- a/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/ccp.h +++ b/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/ccp.h @@ -75,8 +75,8 @@ struct bt_ccp_call_control_server_bearer; * @kconfig{CONFIG_BT_TBS_BEARER_COUNT}) * @retval -ENOEXEC The service failed to be registered */ -int bt_ccp_call_control_server_register_bearer_safe(const struct bt_tbs_register_param *param, - struct bt_ccp_call_control_server_bearer **bearer); +int bt_ccp_call_control_server_register_bearer(const struct bt_tbs_register_param *param, + struct bt_ccp_call_control_server_bearer **bearer); /** * @brief Unregister a Telephone Bearer @@ -94,7 +94,7 @@ int bt_ccp_call_control_server_register_bearer_safe(const struct bt_tbs_register * @retval -EALREADY The bearer is not registered * @retval -ENOEXEC The service failed to be unregistered */ -int bt_ccp_call_control_server_unregister_bearer_safe(struct bt_ccp_call_control_server_bearer *bearer); +int bt_ccp_call_control_server_unregister_bearer(struct bt_ccp_call_control_server_bearer *bearer); /** * @brief Set a new bearer provider name. @@ -109,7 +109,7 @@ int bt_ccp_call_control_server_unregister_bearer_safe(struct bt_ccp_call_control * @retval -EBUSY The TBS instance of @p bearer is busy * @retval -ENOEXEC The TBS instance of @p bearer returned unexpected error */ -int bt_ccp_call_control_server_set_bearer_provider_name_safe( +int bt_ccp_call_control_server_set_bearer_provider_name( struct bt_ccp_call_control_server_bearer *bearer, const char *name); /** @@ -126,7 +126,7 @@ int bt_ccp_call_control_server_set_bearer_provider_name_safe( * @retval -EFAULT @p bearer is not registered * @retval -ENOMEM @p name_size is insufficient to hold the bearer name (including null terminator) */ -int bt_ccp_call_control_server_get_bearer_provider_name_safe( +int bt_ccp_call_control_server_get_bearer_provider_name( struct bt_ccp_call_control_server_bearer *bearer, char *name, size_t name_size); /** @@ -140,8 +140,8 @@ int bt_ccp_call_control_server_get_bearer_provider_name_safe( * @retval -EINVAL @p bearer or @p uci is NULL * @retval -EFAULT @p bearer is not registered */ -int bt_ccp_call_control_server_get_bearer_uci_safe(struct bt_ccp_call_control_server_bearer *bearer, - char uci[BT_TBS_MAX_UCI_SIZE]); +int bt_ccp_call_control_server_get_bearer_uci(struct bt_ccp_call_control_server_bearer *bearer, + char uci[BT_TBS_MAX_UCI_SIZE]); /** @} */ /* End of group bt_ccp_call_control_server */ @@ -237,8 +237,8 @@ struct bt_ccp_call_control_client_cb { * @retval -EBUSY Already doing discovery for @p conn * @retval -ENOEXEC Rejected by the GATT layer */ -int bt_ccp_call_control_client_discover_safe(struct bt_conn *conn, - struct bt_ccp_call_control_client **out_client); +int bt_ccp_call_control_client_discover(struct bt_conn *conn, + struct bt_ccp_call_control_client **out_client); /** * @brief Register callbacks for the Call Control Client @@ -249,7 +249,7 @@ int bt_ccp_call_control_client_discover_safe(struct bt_conn *conn, * @retval -EINVAL @p cb is NULL * @retval -EEXISTS @p cb is already registered */ -int bt_ccp_call_control_client_register_cb_safe(struct bt_ccp_call_control_client_cb *cb); +int bt_ccp_call_control_client_register_cb(struct bt_ccp_call_control_client_cb *cb); /** * @brief Unregister callbacks for the Call Control Client @@ -260,7 +260,7 @@ int bt_ccp_call_control_client_register_cb_safe(struct bt_ccp_call_control_clien * @retval -EINVAL @p cb is NULL * @retval -EALREADY @p cb is not registered */ -int bt_ccp_call_control_client_unregister_cb_safe(struct bt_ccp_call_control_client_cb *cb); +int bt_ccp_call_control_client_unregister_cb(struct bt_ccp_call_control_client_cb *cb); /** * @brief Get the bearers of a client instance @@ -271,8 +271,8 @@ int bt_ccp_call_control_client_unregister_cb_safe(struct bt_ccp_call_control_cli * @retval 0 Success * @retval -EINVAL @p client or @p bearers is NULL */ -int bt_ccp_call_control_client_get_bearers_safe(struct bt_ccp_call_control_client *client, - struct bt_ccp_call_control_client_bearers *bearers); +int bt_ccp_call_control_client_get_bearers(struct bt_ccp_call_control_client *client, + struct bt_ccp_call_control_client_bearers *bearers); /** * @brief Read the bearer provider name of a remote TBS bearer. @@ -289,7 +289,7 @@ int bt_ccp_call_control_client_get_bearers_safe(struct bt_ccp_call_control_clien * instance of @p bearer is busy. * @retval -ENOTCONN The @ref bt_ccp_call_control_client identified by @p bearer is not connected */ -int bt_ccp_call_control_client_read_bearer_provider_name_safe( +int bt_ccp_call_control_client_read_bearer_provider_name( struct bt_ccp_call_control_client_bearer *bearer); /** @} */ /* End of group bt_ccp_call_control_client */ #ifdef __cplusplus diff --git a/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/csip.h b/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/csip.h index ad533eed474..5fc33915ae7 100644 --- a/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/csip.h +++ b/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/csip.h @@ -194,7 +194,7 @@ struct bt_csip_set_member_register_param { * * @return The first CSIS attribute instance. */ -void *bt_csip_set_member_svc_decl_get_safe(const struct bt_csip_set_member_svc_inst *svc_inst); +void *bt_csip_set_member_svc_decl_get(const struct bt_csip_set_member_svc_inst *svc_inst); /** * @brief Register a Coordinated Set Identification Service instance. @@ -211,8 +211,8 @@ void *bt_csip_set_member_svc_decl_get_safe(const struct bt_csip_set_member_svc_i * * @return 0 if success, errno on failure. */ -int bt_csip_set_member_register_safe(const struct bt_csip_set_member_register_param *param, - struct bt_csip_set_member_svc_inst **svc_inst); +int bt_csip_set_member_register(const struct bt_csip_set_member_register_param *param, + struct bt_csip_set_member_svc_inst **svc_inst); /** * @brief Unregister a Coordinated Set Identification Service instance. @@ -223,7 +223,7 @@ int bt_csip_set_member_register_safe(const struct bt_csip_set_member_register_pa * * @return 0 if success, errno on failure. */ -int bt_csip_set_member_unregister_safe(struct bt_csip_set_member_svc_inst *svc_inst); +int bt_csip_set_member_unregister(struct bt_csip_set_member_svc_inst *svc_inst); /** * @brief Set the SIRK of a service instance @@ -231,8 +231,8 @@ int bt_csip_set_member_unregister_safe(struct bt_csip_set_member_svc_inst *svc_i * @param svc_inst Pointer to the registered Coordinated Set Identification Service. * @param sirk The new SIRK. */ -int bt_csip_set_member_sirk_safe(struct bt_csip_set_member_svc_inst *svc_inst, - const uint8_t sirk[BT_CSIP_SIRK_SIZE]); +int bt_csip_set_member_sirk(struct bt_csip_set_member_svc_inst *svc_inst, + const uint8_t sirk[BT_CSIP_SIRK_SIZE]); /** * @brief Set a new size and rank for a service instance @@ -256,8 +256,8 @@ int bt_csip_set_member_sirk_safe(struct bt_csip_set_member_svc_inst *svc_inst, * @retval -EALREADY @p size is already set. * @retval 0 Success. */ -int bt_csip_set_member_set_size_and_rank_safe(struct bt_csip_set_member_svc_inst *svc_inst, uint8_t size, - uint8_t rank); +int bt_csip_set_member_set_size_and_rank(struct bt_csip_set_member_svc_inst *svc_inst, uint8_t size, + uint8_t rank); /** * @brief Set the Coordinated Set Name (CSIS v1.1) of a service instance. @@ -274,8 +274,8 @@ int bt_csip_set_member_set_size_and_rank_safe(struct bt_csip_set_member_svc_inst * @retval -EALREADY The name is already set to this value. * @retval 0 Success. */ -int bt_csip_set_member_set_name_safe(struct bt_csip_set_member_svc_inst *svc_inst, - const uint8_t *name, uint8_t len); +int bt_csip_set_member_set_name(struct bt_csip_set_member_svc_inst *svc_inst, + const uint8_t *name, uint8_t len); /** Struct to hold information about a service instance */ struct bt_csip_set_member_set_info { @@ -315,8 +315,8 @@ struct bt_csip_set_member_set_info { * @retval -EINVAL @p svc_inst or @p info is NULL. * @retval 0 Success. */ -int bt_csip_set_member_get_info_safe(const struct bt_csip_set_member_svc_inst *svc_inst, - struct bt_csip_set_member_set_info *info); +int bt_csip_set_member_get_info(const struct bt_csip_set_member_svc_inst *svc_inst, + struct bt_csip_set_member_set_info *info); /** * @brief Generate the Resolvable Set Identifier (RSI) value. @@ -328,8 +328,8 @@ int bt_csip_set_member_get_info_safe(const struct bt_csip_set_member_svc_inst *s * * @return int 0 if on success, errno on error. */ -int bt_csip_set_member_generate_rsi_safe(const struct bt_csip_set_member_svc_inst *svc_inst, - uint8_t rsi[BT_CSIP_RSI_SIZE]); +int bt_csip_set_member_generate_rsi(const struct bt_csip_set_member_svc_inst *svc_inst, + uint8_t rsi[BT_CSIP_RSI_SIZE]); /** * @brief Locks a specific Coordinated Set Identification Service instance on the server. @@ -342,8 +342,8 @@ int bt_csip_set_member_generate_rsi_safe(const struct bt_csip_set_member_svc_ins * * @return 0 on success, GATT error on error. */ -int bt_csip_set_member_lock_safe(struct bt_csip_set_member_svc_inst *svc_inst, - bool lock, bool force); +int bt_csip_set_member_lock(struct bt_csip_set_member_svc_inst *svc_inst, + bool lock, bool force); /** Information about a specific set */ struct bt_csip_set_coordinator_set_info { @@ -416,7 +416,6 @@ typedef void (*bt_csip_set_coordinator_discover_cb)( * @return int Return 0 on success, or an errno value on error. */ int bt_csip_set_coordinator_discover(struct bt_conn *conn); -int bt_csip_set_coordinator_discover_safe(struct bt_conn *conn); /** * @brief Get the set member from a connection pointer @@ -432,8 +431,6 @@ int bt_csip_set_coordinator_discover_safe(struct bt_conn *conn); */ struct bt_csip_set_coordinator_set_member * bt_csip_set_coordinator_set_member_by_conn(const struct bt_conn *conn); -struct bt_csip_set_coordinator_set_member * -bt_csip_set_coordinator_set_member_by_conn_safe(const struct bt_conn *conn); /** * @typedef bt_csip_set_coordinator_lock_set_cb @@ -538,8 +535,8 @@ struct bt_csip_set_coordinator_cb { * * @return true if the advertising data indicates a set member, false otherwise */ -bool bt_csip_set_coordinator_is_set_member_safe(const uint8_t sirk[BT_CSIP_SIRK_SIZE], - struct bt_data *data); +bool bt_csip_set_coordinator_is_set_member(const uint8_t sirk[BT_CSIP_SIRK_SIZE], + struct bt_data *data); /** * @brief Registers callbacks for csip_set_coordinator. @@ -548,7 +545,7 @@ bool bt_csip_set_coordinator_is_set_member_safe(const uint8_t sirk[BT_CSIP_SIRK_ * * @return Return 0 on success, or an errno value on error. */ -int bt_csip_set_coordinator_register_cb_safe(struct bt_csip_set_coordinator_cb *cb); +int bt_csip_set_coordinator_register_cb(struct bt_csip_set_coordinator_cb *cb); /** * @brief Callback function definition for bt_csip_set_coordinator_ordered_access() @@ -589,7 +586,7 @@ typedef bool (*bt_csip_set_coordinator_ordered_access_t)( * be part of multiple sets. * @param cb The callback function to be called for each member. */ -int bt_csip_set_coordinator_ordered_access_safe( +int bt_csip_set_coordinator_ordered_access( const struct bt_csip_set_coordinator_set_member *members[], uint8_t count, const struct bt_csip_set_coordinator_set_info *set_info, @@ -611,9 +608,9 @@ int bt_csip_set_coordinator_ordered_access_safe( * * @return Return 0 on success, or an errno value on error. */ -int bt_csip_set_coordinator_lock_safe(const struct bt_csip_set_coordinator_set_member **members, - uint8_t count, - const struct bt_csip_set_coordinator_set_info *set_info); +int bt_csip_set_coordinator_lock(const struct bt_csip_set_coordinator_set_member **members, + uint8_t count, + const struct bt_csip_set_coordinator_set_info *set_info); /** * @brief Release an array of set members @@ -629,9 +626,9 @@ int bt_csip_set_coordinator_lock_safe(const struct bt_csip_set_coordinator_set_m * * @return Return 0 on success, or an errno value on error. */ -int bt_csip_set_coordinator_release_safe(const struct bt_csip_set_coordinator_set_member **members, - uint8_t count, - const struct bt_csip_set_coordinator_set_info *set_info); +int bt_csip_set_coordinator_release(const struct bt_csip_set_coordinator_set_member **members, + uint8_t count, + const struct bt_csip_set_coordinator_set_info *set_info); #ifdef __cplusplus } diff --git a/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/gmap.h b/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/gmap.h index 4940c5f2958..a35dc3b401b 100644 --- a/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/gmap.h +++ b/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/gmap.h @@ -188,7 +188,7 @@ struct bt_gmap_cb { * @retval -EALREADY if callbacks have already be registered * @retval 0 on success */ -int bt_gmap_cb_register_safe(const struct bt_gmap_cb *cb); +int bt_gmap_cb_register(const struct bt_gmap_cb *cb); /** * @brief Discover Gaming Service on a remote device. @@ -205,7 +205,6 @@ int bt_gmap_cb_register_safe(const struct bt_gmap_cb *cb); * @retval 0 on success */ int bt_gmap_discover(struct bt_conn *conn); -int bt_gmap_discover_safe(struct bt_conn *conn); /** * @brief Adds GMAS instance to database and sets the received Gaming Audio Profile role(s). @@ -218,7 +217,7 @@ int bt_gmap_discover_safe(struct bt_conn *conn); * @retval -ENOEXEC on service register failure * @retval 0 on success */ -int bt_gmap_register_safe(enum bt_gmap_role role, struct bt_gmap_feat features); +int bt_gmap_register(enum bt_gmap_role role, struct bt_gmap_feat features); /** * @brief Set one or multiple Gaming Audio Profile roles and features dynamically. @@ -238,7 +237,7 @@ int bt_gmap_register_safe(enum bt_gmap_role role, struct bt_gmap_feat features); * @retval -ECANCELED on service re-register failure * @retval 0 on success */ -int bt_gmap_set_role_safe(enum bt_gmap_role role, struct bt_gmap_feat features); +int bt_gmap_set_role(enum bt_gmap_role role, struct bt_gmap_feat features); #ifdef __cplusplus } diff --git a/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/has.h b/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/has.h index 95c6e5ab6d1..617993bdf44 100644 --- a/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/has.h +++ b/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/has.h @@ -227,7 +227,7 @@ struct bt_has_client_cb { * * @return 0 in case of success or negative value in case of error. */ -int bt_has_client_cb_register_safe(const struct bt_has_client_cb *cb); +int bt_has_client_cb_register(const struct bt_has_client_cb *cb); /** * @brief Discover Hearing Access Service on a remote device. @@ -241,7 +241,6 @@ int bt_has_client_cb_register_safe(const struct bt_has_client_cb *cb); * @return 0 if success, errno on failure. */ int bt_has_client_discover(struct bt_conn *conn); -int bt_has_client_discover_safe(struct bt_conn *conn); /** * @brief Get the Bluetooth connection object of the service object. @@ -254,7 +253,7 @@ int bt_has_client_discover_safe(struct bt_conn *conn); * * @return 0 in case of success or negative value in case of error. */ -int bt_has_client_conn_get_safe(const struct bt_has *has, struct bt_conn **conn); +int bt_has_client_conn_get(const struct bt_has *has, struct bt_conn **conn); /** * @brief Read Preset Records. @@ -269,7 +268,7 @@ int bt_has_client_conn_get_safe(const struct bt_has *has, struct bt_conn **conn) * * @return 0 in case of success or negative value in case of error. */ -int bt_has_client_presets_read_safe(struct bt_has *has, uint8_t index, uint8_t max_count); +int bt_has_client_presets_read(struct bt_has *has, uint8_t index, uint8_t max_count); /** * @brief Set Active Preset. @@ -283,7 +282,7 @@ int bt_has_client_presets_read_safe(struct bt_has *has, uint8_t index, uint8_t m * * @return 0 in case of success or negative value in case of error. */ -int bt_has_client_preset_set_safe(struct bt_has *has, uint8_t index, bool sync); +int bt_has_client_preset_set(struct bt_has *has, uint8_t index, bool sync); /** * @brief Activate Next Preset. @@ -296,7 +295,7 @@ int bt_has_client_preset_set_safe(struct bt_has *has, uint8_t index, bool sync); * * @return 0 in case of success or negative value in case of error. */ -int bt_has_client_preset_next_safe(struct bt_has *has, bool sync); +int bt_has_client_preset_next(struct bt_has *has, bool sync); /** * @brief Activate Previous Preset. @@ -309,7 +308,7 @@ int bt_has_client_preset_next_safe(struct bt_has *has, bool sync); * * @return 0 in case of success or negative value in case of error. */ -int bt_has_client_preset_prev_safe(struct bt_has *has, bool sync); +int bt_has_client_preset_prev(struct bt_has *has, bool sync); /** * @brief Write Preset Name. @@ -323,7 +322,7 @@ int bt_has_client_preset_prev_safe(struct bt_has *has, bool sync); * * @return 0 in case of success or negative value in case of error. */ -int bt_has_client_preset_name_write_safe(struct bt_has *has, uint8_t index, const char *name); +int bt_has_client_preset_name_write(struct bt_has *has, uint8_t index, const char *name); /** @brief Preset operations structure. */ struct bt_has_preset_ops { @@ -393,7 +392,6 @@ struct bt_has_preset_register_param { * @return 0 if success, errno on failure. */ int bt_has_register(const struct bt_has_features_param *features); -int bt_has_register_safe(const struct bt_has_features_param *features); /** * @brief Register preset. @@ -405,7 +403,7 @@ int bt_has_register_safe(const struct bt_has_features_param *features); * * @return 0 if success, errno on failure. */ -int bt_has_preset_register_safe(const struct bt_has_preset_register_param *param); +int bt_has_preset_register(const struct bt_has_preset_register_param *param); /** * @brief Unregister Preset. @@ -416,7 +414,7 @@ int bt_has_preset_register_safe(const struct bt_has_preset_register_param *param * * @return 0 if success, errno on failure. */ -int bt_has_preset_unregister_safe(uint8_t index); +int bt_has_preset_unregister(uint8_t index); /** * @brief Set the preset as available. @@ -428,7 +426,7 @@ int bt_has_preset_unregister_safe(uint8_t index); * * @return 0 in case of success or negative value in case of error. */ -int bt_has_preset_available_safe(uint8_t index); +int bt_has_preset_available(uint8_t index); /** * @brief Set the preset as unavailable. @@ -440,7 +438,7 @@ int bt_has_preset_available_safe(uint8_t index); * * @return 0 in case of success or negative value in case of error. */ -int bt_has_preset_unavailable_safe(uint8_t index); +int bt_has_preset_unavailable(uint8_t index); /** * @typedef bt_has_preset_func_t @@ -470,7 +468,7 @@ typedef bool (*bt_has_preset_func_t)(uint8_t index, enum bt_has_properties prope * @retval -ECANCELED Iteration was stopped by the callback function before complete. * @retval -EINVAL @p func was NULL. */ -int bt_has_preset_foreach_safe(uint8_t index, bt_has_preset_func_t func, void *user_data); +int bt_has_preset_foreach(uint8_t index, bt_has_preset_func_t func, void *user_data); /** * @brief Set active preset. @@ -482,7 +480,7 @@ int bt_has_preset_foreach_safe(uint8_t index, bt_has_preset_func_t func, void *u * * @return 0 in case of success or negative value in case of error. */ -int bt_has_preset_active_set_safe(uint8_t index); +int bt_has_preset_active_set(uint8_t index); /** * @brief Get active preset. @@ -491,7 +489,7 @@ int bt_has_preset_active_set_safe(uint8_t index); * * @return Active preset index. */ -uint8_t bt_has_preset_active_get_safe(void); +uint8_t bt_has_preset_active_get(void); /** * @brief Clear out active preset. @@ -500,9 +498,9 @@ uint8_t bt_has_preset_active_get_safe(void); * * @return 0 in case of success or negative value in case of error. */ -static inline int bt_has_preset_active_clear_safe(void) +static inline int bt_has_preset_active_clear(void) { - return bt_has_preset_active_set_safe(BT_HAS_PRESET_INDEX_NONE); + return bt_has_preset_active_set(BT_HAS_PRESET_INDEX_NONE); } /** @@ -515,7 +513,7 @@ static inline int bt_has_preset_active_clear_safe(void) * * @return 0 in case of success or negative value in case of error. */ -int bt_has_preset_name_change_safe(uint8_t index, const char *name); +int bt_has_preset_name_change(uint8_t index, const char *name); /** * @brief Change the Hearing Aid Features. @@ -526,7 +524,7 @@ int bt_has_preset_name_change_safe(uint8_t index, const char *name); * * @return 0 in case of success or negative value in case of error. */ -int bt_has_features_set_safe(const struct bt_has_features_param *features); +int bt_has_features_set(const struct bt_has_features_param *features); #ifdef __cplusplus } diff --git a/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/mcc.h b/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/mcc.h index 68767950b53..8bc3959e16b 100644 --- a/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/mcc.h +++ b/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/mcc.h @@ -598,7 +598,7 @@ struct bt_mcc_cb { * * @return 0 if success, errno on failure. */ -int bt_mcc_init_safe(struct bt_mcc_cb *cb); +int bt_mcc_init(struct bt_mcc_cb *cb); /** * @brief Discover Media Control Service @@ -615,7 +615,6 @@ int bt_mcc_init_safe(struct bt_mcc_cb *cb); * @return 0 if success, errno on failure. */ int bt_mcc_discover_mcs(struct bt_conn *conn, bool subscribe); -int bt_mcc_discover_mcs_safe(struct bt_conn *conn, bool subscribe); /** * @brief Read Media Player Name @@ -625,7 +624,6 @@ int bt_mcc_discover_mcs_safe(struct bt_conn *conn, bool subscribe); * @return 0 if success, errno on failure. */ int bt_mcc_read_player_name(struct bt_conn *conn); -int bt_mcc_read_player_name_safe(struct bt_conn *conn); /** * @brief Read Icon Object ID @@ -635,7 +633,6 @@ int bt_mcc_read_player_name_safe(struct bt_conn *conn); * @return 0 if success, errno on failure. */ int bt_mcc_read_icon_obj_id(struct bt_conn *conn); -int bt_mcc_read_icon_obj_id_safe(struct bt_conn *conn); /** * @brief Read Icon Object URL @@ -645,7 +642,6 @@ int bt_mcc_read_icon_obj_id_safe(struct bt_conn *conn); * @return 0 if success, errno on failure. */ int bt_mcc_read_icon_url(struct bt_conn *conn); -int bt_mcc_read_icon_url_safe(struct bt_conn *conn); /** * @brief Read Track Title @@ -655,7 +651,6 @@ int bt_mcc_read_icon_url_safe(struct bt_conn *conn); * @return 0 if success, errno on failure. */ int bt_mcc_read_track_title(struct bt_conn *conn); -int bt_mcc_read_track_title_safe(struct bt_conn *conn); /** * @brief Read Track Duration @@ -665,7 +660,6 @@ int bt_mcc_read_track_title_safe(struct bt_conn *conn); * @return 0 if success, errno on failure. */ int bt_mcc_read_track_duration(struct bt_conn *conn); -int bt_mcc_read_track_duration_safe(struct bt_conn *conn); /** * @brief Read Track Position @@ -675,7 +669,6 @@ int bt_mcc_read_track_duration_safe(struct bt_conn *conn); * @return 0 if success, errno on failure. */ int bt_mcc_read_track_position(struct bt_conn *conn); -int bt_mcc_read_track_position_safe(struct bt_conn *conn); /** * @brief Set Track position @@ -686,7 +679,6 @@ int bt_mcc_read_track_position_safe(struct bt_conn *conn); * @return 0 if success, errno on failure. */ int bt_mcc_set_track_position(struct bt_conn *conn, int32_t pos); -int bt_mcc_set_track_position_safe(struct bt_conn *conn, int32_t pos); /** * @brief Read Playback speed @@ -696,7 +688,6 @@ int bt_mcc_set_track_position_safe(struct bt_conn *conn, int32_t pos); * @return 0 if success, errno on failure. */ int bt_mcc_read_playback_speed(struct bt_conn *conn); -int bt_mcc_read_playback_speed_safe(struct bt_conn *conn); /** * @brief Set Playback Speed @@ -707,7 +698,6 @@ int bt_mcc_read_playback_speed_safe(struct bt_conn *conn); * @return 0 if success, errno on failure. */ int bt_mcc_set_playback_speed(struct bt_conn *conn, int8_t speed); -int bt_mcc_set_playback_speed_safe(struct bt_conn *conn, int8_t speed); /** * @brief Read Seeking speed @@ -717,7 +707,6 @@ int bt_mcc_set_playback_speed_safe(struct bt_conn *conn, int8_t speed); * @return 0 if success, errno on failure. */ int bt_mcc_read_seeking_speed(struct bt_conn *conn); -int bt_mcc_read_seeking_speed_safe(struct bt_conn *conn); /** * @brief Read Track Segments Object ID @@ -727,7 +716,6 @@ int bt_mcc_read_seeking_speed_safe(struct bt_conn *conn); * @return 0 if success, errno on failure. */ int bt_mcc_read_segments_obj_id(struct bt_conn *conn); -int bt_mcc_read_segments_obj_id_safe(struct bt_conn *conn); /** * @brief Read Current Track Object ID @@ -737,7 +725,6 @@ int bt_mcc_read_segments_obj_id_safe(struct bt_conn *conn); * @return 0 if success, errno on failure. */ int bt_mcc_read_current_track_obj_id(struct bt_conn *conn); -int bt_mcc_read_current_track_obj_id_safe(struct bt_conn *conn); /** * @brief Set Current Track Object ID @@ -750,7 +737,6 @@ int bt_mcc_read_current_track_obj_id_safe(struct bt_conn *conn); * @return 0 if success, errno on failure. */ int bt_mcc_set_current_track_obj_id(struct bt_conn *conn, uint64_t id); -int bt_mcc_set_current_track_obj_id_safe(struct bt_conn *conn, uint64_t id); /** * @brief Read Next Track Object ID @@ -760,7 +746,6 @@ int bt_mcc_set_current_track_obj_id_safe(struct bt_conn *conn, uint64_t id); * @return 0 if success, errno on failure. */ int bt_mcc_read_next_track_obj_id(struct bt_conn *conn); -int bt_mcc_read_next_track_obj_id_safe(struct bt_conn *conn); /** * @brief Set Next Track Object ID @@ -773,7 +758,6 @@ int bt_mcc_read_next_track_obj_id_safe(struct bt_conn *conn); * @return 0 if success, errno on failure. */ int bt_mcc_set_next_track_obj_id(struct bt_conn *conn, uint64_t id); -int bt_mcc_set_next_track_obj_id_safe(struct bt_conn *conn, uint64_t id); /** * @brief Read Current Group Object ID @@ -783,7 +767,6 @@ int bt_mcc_set_next_track_obj_id_safe(struct bt_conn *conn, uint64_t id); * @return 0 if success, errno on failure. */ int bt_mcc_read_current_group_obj_id(struct bt_conn *conn); -int bt_mcc_read_current_group_obj_id_safe(struct bt_conn *conn); /** * @brief Set Current Group Object ID @@ -796,7 +779,6 @@ int bt_mcc_read_current_group_obj_id_safe(struct bt_conn *conn); * @return 0 if success, errno on failure. */ int bt_mcc_set_current_group_obj_id(struct bt_conn *conn, uint64_t id); -int bt_mcc_set_current_group_obj_id_safe(struct bt_conn *conn, uint64_t id); /** * @brief Read Parent Group Object ID @@ -806,7 +788,6 @@ int bt_mcc_set_current_group_obj_id_safe(struct bt_conn *conn, uint64_t id); * @return 0 if success, errno on failure. */ int bt_mcc_read_parent_group_obj_id(struct bt_conn *conn); -int bt_mcc_read_parent_group_obj_id_safe(struct bt_conn *conn); /** * @brief Read Playing Order @@ -816,7 +797,6 @@ int bt_mcc_read_parent_group_obj_id_safe(struct bt_conn *conn); * @return 0 if success, errno on failure. */ int bt_mcc_read_playing_order(struct bt_conn *conn); -int bt_mcc_read_playing_order_safe(struct bt_conn *conn); /** * @brief Set Playing Order @@ -827,7 +807,6 @@ int bt_mcc_read_playing_order_safe(struct bt_conn *conn); * @return 0 if success, errno on failure. */ int bt_mcc_set_playing_order(struct bt_conn *conn, uint8_t order); -int bt_mcc_set_playing_order_safe(struct bt_conn *conn, uint8_t order); /** * @brief Read Playing Orders Supported @@ -837,7 +816,6 @@ int bt_mcc_set_playing_order_safe(struct bt_conn *conn, uint8_t order); * @return 0 if success, errno on failure. */ int bt_mcc_read_playing_orders_supported(struct bt_conn *conn); -int bt_mcc_read_playing_orders_supported_safe(struct bt_conn *conn); /** * @brief Read Media State @@ -847,7 +825,6 @@ int bt_mcc_read_playing_orders_supported_safe(struct bt_conn *conn); * @return 0 if success, errno on failure. */ int bt_mcc_read_media_state(struct bt_conn *conn); -int bt_mcc_read_media_state_safe(struct bt_conn *conn); /** * @brief Send a command @@ -860,7 +837,6 @@ int bt_mcc_read_media_state_safe(struct bt_conn *conn); * @return 0 if success, errno on failure. */ int bt_mcc_send_cmd(struct bt_conn *conn, const struct mpl_cmd *cmd); -int bt_mcc_send_cmd_safe(struct bt_conn *conn, const struct mpl_cmd *cmd); /** * @brief Read Opcodes Supported @@ -870,7 +846,6 @@ int bt_mcc_send_cmd_safe(struct bt_conn *conn, const struct mpl_cmd *cmd); * @return 0 if success, errno on failure. */ int bt_mcc_read_opcodes_supported(struct bt_conn *conn); -int bt_mcc_read_opcodes_supported_safe(struct bt_conn *conn); /** * @brief Send a Search command @@ -883,7 +858,6 @@ int bt_mcc_read_opcodes_supported_safe(struct bt_conn *conn); * @return 0 if success, errno on failure. */ int bt_mcc_send_search(struct bt_conn *conn, const struct mpl_search *search); -int bt_mcc_send_search_safe(struct bt_conn *conn, const struct mpl_search *search); /** * @brief Search Results Group Object ID @@ -893,7 +867,6 @@ int bt_mcc_send_search_safe(struct bt_conn *conn, const struct mpl_search *searc * @return 0 if success, errno on failure. */ int bt_mcc_read_search_results_obj_id(struct bt_conn *conn); -int bt_mcc_read_search_results_obj_id_safe(struct bt_conn *conn); /** * @brief Read Content Control ID @@ -903,7 +876,6 @@ int bt_mcc_read_search_results_obj_id_safe(struct bt_conn *conn); * @return 0 if success, errno on failure. */ int bt_mcc_read_content_control_id(struct bt_conn *conn); -int bt_mcc_read_content_control_id_safe(struct bt_conn *conn); /** * @brief Read the current object metadata @@ -913,7 +885,6 @@ int bt_mcc_read_content_control_id_safe(struct bt_conn *conn); * @return 0 if success, errno on failure. */ int bt_mcc_otc_read_object_metadata(struct bt_conn *conn); -int bt_mcc_otc_read_object_metadata_safe(struct bt_conn *conn); /** * @brief Read the Icon Object @@ -923,7 +894,6 @@ int bt_mcc_otc_read_object_metadata_safe(struct bt_conn *conn); * @return 0 if success, errno on failure. */ int bt_mcc_otc_read_icon_object(struct bt_conn *conn); -int bt_mcc_otc_read_icon_object_safe(struct bt_conn *conn); /** * @brief Read the Track Segments Object @@ -933,7 +903,6 @@ int bt_mcc_otc_read_icon_object_safe(struct bt_conn *conn); * @return 0 if success, errno on failure. */ int bt_mcc_otc_read_track_segments_object(struct bt_conn *conn); -int bt_mcc_otc_read_track_segments_object_safe(struct bt_conn *conn); /** * @brief Read the Current Track Object @@ -943,7 +912,6 @@ int bt_mcc_otc_read_track_segments_object_safe(struct bt_conn *conn); * @return 0 if success, errno on failure. */ int bt_mcc_otc_read_current_track_object(struct bt_conn *conn); -int bt_mcc_otc_read_current_track_object_safe(struct bt_conn *conn); /** * @brief Read the Next Track Object @@ -953,7 +921,6 @@ int bt_mcc_otc_read_current_track_object_safe(struct bt_conn *conn); * @return 0 if success, errno on failure. */ int bt_mcc_otc_read_next_track_object(struct bt_conn *conn); -int bt_mcc_otc_read_next_track_object_safe(struct bt_conn *conn); /** * @brief Read the Current Group Object @@ -963,7 +930,6 @@ int bt_mcc_otc_read_next_track_object_safe(struct bt_conn *conn); * @return 0 if success, errno on failure. */ int bt_mcc_otc_read_current_group_object(struct bt_conn *conn); -int bt_mcc_otc_read_current_group_object_safe(struct bt_conn *conn); /** * @brief Read the Parent Group Object @@ -973,7 +939,6 @@ int bt_mcc_otc_read_current_group_object_safe(struct bt_conn *conn); * @return 0 if success, errno on failure. */ int bt_mcc_otc_read_parent_group_object(struct bt_conn *conn); -int bt_mcc_otc_read_parent_group_object_safe(struct bt_conn *conn); /** * @brief Look up MCC OTC instance @@ -984,7 +949,6 @@ int bt_mcc_otc_read_parent_group_object_safe(struct bt_conn *conn); * */ struct bt_ots_client *bt_mcc_otc_inst(struct bt_conn *conn); -struct bt_ots_client *bt_mcc_otc_inst_safe(struct bt_conn *conn); #ifdef __cplusplus } diff --git a/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/media_proxy.h b/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/media_proxy.h index f3ff59566d5..b8228743819 100644 --- a/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/media_proxy.h +++ b/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/media_proxy.h @@ -441,7 +441,7 @@ struct media_proxy_ctrl_cbs { * @brief Media Player Name receive callback * * Called when the Media Player Name is read or changed - * See also media_proxy_ctrl_name_get() + * See also bt_media_proxy_ctrl_get_player_name() * * @param player Media player instance pointer * @param err Error value. 0 on success, GATT error on positive value @@ -454,7 +454,7 @@ struct media_proxy_ctrl_cbs { * @brief Media Player Icon Object ID receive callback * * Called when the Media Player Icon Object ID is read - * See also media_proxy_ctrl_get_icon_id() + * See also bt_media_proxy_ctrl_get_icon_id() * * @param player Media player instance pointer * @param err Error value. 0 on success, GATT error on positive value @@ -467,7 +467,7 @@ struct media_proxy_ctrl_cbs { * @brief Media Player Icon URL receive callback * * Called when the Media Player Icon URL is read - * See also media_proxy_ctrl_get_icon_url() + * See also bt_media_proxy_ctrl_get_icon_url() * * @param player Media player instance pointer * @param err Error value. 0 on success, GATT error on positive value @@ -491,7 +491,7 @@ struct media_proxy_ctrl_cbs { * @brief Track Title receive callback * * Called when the Track Title is read or changed - * See also media_proxy_ctrl_get_track_title() + * See also bt_media_proxy_ctrl_get_track_title() * * @param player Media player instance pointer * @param err Error value. 0 on success, GATT error on positive value @@ -504,7 +504,7 @@ struct media_proxy_ctrl_cbs { * @brief Track Duration receive callback * * Called when the Track Duration is read or changed - * See also media_proxy_ctrl_get_track_duration() + * See also bt_media_proxy_ctrl_get_track_duration() * * @param player Media player instance pointer * @param err Error value. 0 on success, GATT error on positive value @@ -517,8 +517,8 @@ struct media_proxy_ctrl_cbs { * @brief Track Position receive callback * * Called when the Track Position is read or changed - * See also media_proxy_ctrl_get_track_position() and - * media_proxy_ctrl_set_track_position() + * See also bt_media_proxy_ctrl_get_track_position() and + * bt_media_proxy_ctrl_set_track_position() * * @param player Media player instance pointer * @param err Error value. 0 on success, GATT error on positive value @@ -531,7 +531,7 @@ struct media_proxy_ctrl_cbs { * @brief Track Position write callback * * Called when the Track Position is written - * See also media_proxy_ctrl_set_track_position(). + * See also bt_media_proxy_ctrl_set_track_position(). * * @param player Media player instance pointer * @param err Error value. 0 on success, GATT error on positive value @@ -544,8 +544,8 @@ struct media_proxy_ctrl_cbs { * @brief Playback Speed receive callback * * Called when the Playback Speed is read or changed - * See also media_proxy_ctrl_get_playback_speed() and - * media_proxy_ctrl_set_playback_speed() + * See also bt_media_proxy_ctrl_get_playback_speed() and + * bt_media_proxy_ctrl_set_playback_speed() * * @param player Media player instance pointer * @param err Error value. 0 on success, GATT error on positive value @@ -558,7 +558,7 @@ struct media_proxy_ctrl_cbs { * @brief Playback Speed write callback * * Called when the Playback Speed is written - * See also media_proxy_ctrl_set_playback_speed() + * See also bt_media_proxy_ctrl_set_playback_speed() * * @param player Media player instance pointer * @param err Error value. 0 on success, GATT error on positive value @@ -571,7 +571,7 @@ struct media_proxy_ctrl_cbs { * @brief Seeking Speed receive callback * * Called when the Seeking Speed is read or changed - * See also media_proxy_ctrl_get_seeking_speed() + * See also bt_media_proxy_ctrl_get_seeking_speed() * * @param player Media player instance pointer * @param err Error value. 0 on success, GATT error on positive value @@ -584,7 +584,7 @@ struct media_proxy_ctrl_cbs { * @brief Track Segments Object ID receive callback * * Called when the Track Segments Object ID is read - * See also media_proxy_ctrl_get_track_segments_id() + * See also bt_media_proxy_ctrl_get_track_segments_id() * * @param player Media player instance pointer * @param err Error value. 0 on success, GATT error on positive value @@ -597,8 +597,8 @@ struct media_proxy_ctrl_cbs { * @brief Current Track Object ID receive callback * * Called when the Current Track Object ID is read or changed - * See also media_proxy_ctrl_get_current_track_id() and - * media_proxy_ctrl_set_current_track_id() + * See also bt_media_proxy_ctrl_get_current_track_id() and + * bt_media_proxy_ctrl_set_current_track_id() * * @param player Media player instance pointer * @param err Error value. 0 on success, GATT error on positive value @@ -611,7 +611,7 @@ struct media_proxy_ctrl_cbs { * @brief Current Track Object ID write callback * * Called when the Current Track Object ID is written - * See also media_proxy_ctrl_set_current_track_id() + * See also bt_media_proxy_ctrl_set_current_track_id() * * @param player Media player instance pointer * @param err Error value. 0 on success, GATT error on positive value @@ -624,8 +624,8 @@ struct media_proxy_ctrl_cbs { * @brief Next Track Object ID receive callback * * Called when the Next Track Object ID is read or changed - * See also media_proxy_ctrl_get_next_track_id() and - * media_proxy_ctrl_set_next_track_id() + * See also bt_media_proxy_ctrl_get_next_track_id() and + * bt_media_proxy_ctrl_set_next_track_id() * * @param player Media player instance pointer * @param err Error value. 0 on success, GATT error on positive value @@ -638,7 +638,7 @@ struct media_proxy_ctrl_cbs { * @brief Next Track Object ID write callback * * Called when the Next Track Object ID is written - * See also media_proxy_ctrl_set_next_track_id() + * See also bt_media_proxy_ctrl_set_next_track_id() * * @param player Media player instance pointer * @param err Error value. 0 on success, GATT error on positive value @@ -651,7 +651,7 @@ struct media_proxy_ctrl_cbs { * @brief Parent Group Object ID receive callback * * Called when the Parent Group Object ID is read or changed - * See also media_proxy_ctrl_get_parent_group_id() + * See also bt_media_proxy_ctrl_get_parent_group_id() * * @param player Media player instance pointer * @param err Error value. 0 on success, GATT error on positive value @@ -664,8 +664,8 @@ struct media_proxy_ctrl_cbs { * @brief Current Group Object ID receive callback * * Called when the Current Group Object ID is read or changed - * See also media_proxy_ctrl_get_current_group_id() and - * media_proxy_ctrl_set_current_group_id() + * See also bt_media_proxy_ctrl_get_current_group_id() and + * bt_media_proxy_ctrl_set_current_group_id() * * @param player Media player instance pointer * @param err Error value. 0 on success, GATT error on positive value @@ -678,7 +678,7 @@ struct media_proxy_ctrl_cbs { * @brief Current Group Object ID write callback * * Called when the Current Group Object ID is written - * See also media_proxy_ctrl_set_current_group_id() + * See also bt_media_proxy_ctrl_set_current_group_id() * * @param player Media player instance pointer * @param err Error value. 0 on success, GATT error on positive value @@ -691,8 +691,8 @@ struct media_proxy_ctrl_cbs { * @brief Playing Order receive callback * * Called when the Playing Order is read or changed - * See also media_proxy_ctrl_get_playing_order() and - * media_proxy_ctrl_set_playing_order() + * See also bt_media_proxy_ctrl_get_playing_order() and + * bt_media_proxy_ctrl_set_playing_order() * * @param player Media player instance pointer * @param err Error value. 0 on success, GATT error on positive value @@ -705,7 +705,7 @@ struct media_proxy_ctrl_cbs { * @brief Playing Order write callback * * Called when the Playing Order is written - * See also media_proxy_ctrl_set_playing_order() + * See also bt_media_proxy_ctrl_set_playing_order() * * @param player Media player instance pointer * @param err Error value. 0 on success, GATT error on positive value @@ -718,7 +718,7 @@ struct media_proxy_ctrl_cbs { * @brief Playing Orders Supported receive callback * * Called when the Playing Orders Supported is read - * See also media_proxy_ctrl_get_playing_orders_supported() + * See also bt_media_proxy_ctrl_get_playing_orders_supported() * * @param player Media player instance pointer * @param err Error value. 0 on success, GATT error on positive value @@ -732,8 +732,8 @@ struct media_proxy_ctrl_cbs { * @brief Media State receive callback * * Called when the Media State is read or changed - * See also media_proxy_ctrl_get_media_state() and - * media_proxy_ctrl_send_command() + * See also bt_media_proxy_ctrl_get_media_state() and + * bt_media_proxy_ctrl_send_command() * * @param player Media player instance pointer * @param err Error value. 0 on success, GATT error on positive value @@ -746,7 +746,7 @@ struct media_proxy_ctrl_cbs { * @brief Command send callback * * Called when a command has been sent - * See also media_proxy_ctrl_send_command() + * See also bt_media_proxy_ctrl_send_command() * * @param player Media player instance pointer * @param err Error value. 0 on success, GATT error on positive value @@ -759,7 +759,7 @@ struct media_proxy_ctrl_cbs { * @brief Command result receive callback * * Called when a command result has been received - * See also media_proxy_ctrl_send_command() + * See also bt_media_proxy_ctrl_send_command() * * @param player Media player instance pointer * @param err Error value. 0 on success, GATT error on positive value @@ -773,7 +773,7 @@ struct media_proxy_ctrl_cbs { * @brief Commands supported receive callback * * Called when the Commands Supported is read or changed - * See also media_proxy_ctrl_get_commands_supported() + * See also bt_media_proxy_ctrl_get_commands_supported() * * @param player Media player instance pointer * @param err Error value. 0 on success, GATT error on positive value @@ -786,7 +786,7 @@ struct media_proxy_ctrl_cbs { * @brief Search send callback * * Called when a search has been sent - * See also media_proxy_ctrl_send_search() + * See also bt_media_proxy_ctrl_send_search() * * @param player Media player instance pointer * @param err Error value. 0 on success, GATT error on positive value @@ -799,7 +799,7 @@ struct media_proxy_ctrl_cbs { * @brief Search result code receive callback * * Called when a search result code has been received - * See also media_proxy_ctrl_send_search() + * See also bt_media_proxy_ctrl_send_search() * * The search result code tells whether the search was successful or not. * For a successful search, the actual results of the search (i.e. what was found @@ -815,7 +815,7 @@ struct media_proxy_ctrl_cbs { /** * @brief Search Results Object ID receive callback - * See also media_proxy_ctrl_get_search_results_id() + * See also bt_media_proxy_ctrl_get_search_results_id() * * Called when the Search Results Object ID is read or changed * @@ -830,7 +830,7 @@ struct media_proxy_ctrl_cbs { * @brief Content Control ID receive callback * * Called when the Content Control ID is read - * See also media_proxy_ctrl_get_content_ctrl_id() + * See also bt_media_proxy_ctrl_get_content_ctrl_id() * * @param player Media player instance pointer * @param err Error value. 0 on success, GATT error on positive value @@ -847,7 +847,7 @@ struct media_proxy_ctrl_cbs { * * @return 0 if success, errno on failure */ -int bt_media_proxy_ctrl_register_safe(struct media_proxy_ctrl_cbs *ctrl_cbs); +int bt_media_proxy_ctrl_register(struct media_proxy_ctrl_cbs *ctrl_cbs); /** * @brief Discover a remote media player @@ -867,7 +867,6 @@ int bt_media_proxy_ctrl_register_safe(struct media_proxy_ctrl_cbs *ctrl_cbs); * @return 0 if success, errno on failure */ int bt_media_proxy_ctrl_discover_player(struct bt_conn *conn); -int bt_media_proxy_ctrl_discover_player_safe(struct bt_conn *conn); /** * @brief Read Media Player Name @@ -876,7 +875,7 @@ int bt_media_proxy_ctrl_discover_player_safe(struct bt_conn *conn); * * @return 0 if success, errno on failure. */ -int bt_media_proxy_ctrl_get_player_name_safe(struct media_player *player); +int bt_media_proxy_ctrl_get_player_name(struct media_player *player); /** * @brief Read Icon Object ID @@ -893,7 +892,7 @@ int bt_media_proxy_ctrl_get_player_name_safe(struct media_player *player); * * @return 0 if success, errno on failure. */ -int bt_media_proxy_ctrl_get_icon_id_safe(struct media_player *player); +int bt_media_proxy_ctrl_get_icon_id(struct media_player *player); /** * @brief Read Icon URL @@ -902,7 +901,7 @@ int bt_media_proxy_ctrl_get_icon_id_safe(struct media_player *player); * * @param player Media player instance pointer */ -int bt_media_proxy_ctrl_get_icon_url_safe(struct media_player *player); +int bt_media_proxy_ctrl_get_icon_url(struct media_player *player); /** * @brief Read Track Title @@ -911,7 +910,7 @@ int bt_media_proxy_ctrl_get_icon_url_safe(struct media_player *player); * * @return 0 if success, errno on failure. */ -int bt_media_proxy_ctrl_get_track_title_safe(struct media_player *player); +int bt_media_proxy_ctrl_get_track_title(struct media_player *player); /** * @brief Read Track Duration @@ -923,7 +922,7 @@ int bt_media_proxy_ctrl_get_track_title_safe(struct media_player *player); * * @return 0 if success, errno on failure. */ -int bt_media_proxy_ctrl_get_track_duration_safe(struct media_player *player); +int bt_media_proxy_ctrl_get_track_duration(struct media_player *player); /** * @brief Read Track Position @@ -936,7 +935,7 @@ int bt_media_proxy_ctrl_get_track_duration_safe(struct media_player *player); * * @return 0 if success, errno on failure. */ -int bt_media_proxy_ctrl_get_track_position_safe(struct media_player *player); +int bt_media_proxy_ctrl_get_track_position(struct media_player *player); /** * @brief Set Track Position @@ -952,7 +951,7 @@ int bt_media_proxy_ctrl_get_track_position_safe(struct media_player *player); * * @return 0 if success, errno on failure. */ -int bt_media_proxy_ctrl_set_track_position_safe(struct media_player *player, int32_t position); +int bt_media_proxy_ctrl_set_track_position(struct media_player *player, int32_t position); /** * @brief Get Playback Speed @@ -971,7 +970,7 @@ int bt_media_proxy_ctrl_set_track_position_safe(struct media_player *player, int * * @return 0 if success, errno on failure. */ -int bt_media_proxy_ctrl_get_playback_speed_safe(struct media_player *player); +int bt_media_proxy_ctrl_get_playback_speed(struct media_player *player); /** * @brief Set Playback Speed @@ -992,7 +991,7 @@ int bt_media_proxy_ctrl_get_playback_speed_safe(struct media_player *player); * * @return 0 if success, errno on failure. */ -int bt_media_proxy_ctrl_set_playback_speed_safe(struct media_player *player, int8_t speed); +int bt_media_proxy_ctrl_set_playback_speed(struct media_player *player, int8_t speed); /** * @brief Get Seeking Speed @@ -1010,7 +1009,7 @@ int bt_media_proxy_ctrl_set_playback_speed_safe(struct media_player *player, int * * @return 0 if success, errno on failure. */ -int bt_media_proxy_ctrl_get_seeking_speed_safe(struct media_player *player); +int bt_media_proxy_ctrl_get_seeking_speed(struct media_player *player); /** * @brief Read Current Track Segments Object ID @@ -1027,7 +1026,7 @@ int bt_media_proxy_ctrl_get_seeking_speed_safe(struct media_player *player); * * @return 0 if success, errno on failure. */ -int bt_media_proxy_ctrl_get_track_segments_id_safe(struct media_player *player); +int bt_media_proxy_ctrl_get_track_segments_id(struct media_player *player); /** * @brief Read Current Track Object ID @@ -1044,7 +1043,7 @@ int bt_media_proxy_ctrl_get_track_segments_id_safe(struct media_player *player); * * @return 0 if success, errno on failure. */ -int bt_media_proxy_ctrl_get_current_track_id_safe(struct media_player *player); +int bt_media_proxy_ctrl_get_current_track_id(struct media_player *player); /** * @brief Set Current Track Object ID @@ -1059,7 +1058,7 @@ int bt_media_proxy_ctrl_get_current_track_id_safe(struct media_player *player); * * @return 0 if success, errno on failure. */ -int bt_media_proxy_ctrl_set_current_track_id_safe(struct media_player *player, uint64_t id); +int bt_media_proxy_ctrl_set_current_track_id(struct media_player *player, uint64_t id); /** * @brief Read Next Track Object ID @@ -1073,7 +1072,7 @@ int bt_media_proxy_ctrl_set_current_track_id_safe(struct media_player *player, u * * @return 0 if success, errno on failure. */ -int bt_media_proxy_ctrl_get_next_track_id_safe(struct media_player *player); +int bt_media_proxy_ctrl_get_next_track_id(struct media_player *player); /** * @brief Set Next Track Object ID @@ -1087,7 +1086,7 @@ int bt_media_proxy_ctrl_get_next_track_id_safe(struct media_player *player); * * @return 0 if success, errno on failure. */ -int bt_media_proxy_ctrl_set_next_track_id_safe(struct media_player *player, uint64_t id); +int bt_media_proxy_ctrl_set_next_track_id(struct media_player *player, uint64_t id); /** * @brief Read Parent Group Object ID @@ -1106,7 +1105,7 @@ int bt_media_proxy_ctrl_set_next_track_id_safe(struct media_player *player, uint * * @return 0 if success, errno on failure. */ -int bt_media_proxy_ctrl_get_parent_group_id_safe(struct media_player *player); +int bt_media_proxy_ctrl_get_parent_group_id(struct media_player *player); /** * @brief Read Current Group Object ID @@ -1123,7 +1122,7 @@ int bt_media_proxy_ctrl_get_parent_group_id_safe(struct media_player *player); * * @return 0 if success, errno on failure. */ -int bt_media_proxy_ctrl_get_current_group_id_safe(struct media_player *player); +int bt_media_proxy_ctrl_get_current_group_id(struct media_player *player); /** * @brief Set Current Group Object ID @@ -1138,7 +1137,7 @@ int bt_media_proxy_ctrl_get_current_group_id_safe(struct media_player *player); * * @return 0 if success, errno on failure. */ -int bt_media_proxy_ctrl_set_current_group_id_safe(struct media_player *player, uint64_t id); +int bt_media_proxy_ctrl_set_current_group_id(struct media_player *player, uint64_t id); /** * @brief Read Playing Order @@ -1147,7 +1146,7 @@ int bt_media_proxy_ctrl_set_current_group_id_safe(struct media_player *player, u * * @return 0 if success, errno on failure. */ -int bt_media_proxy_ctrl_get_playing_order_safe(struct media_player *player); +int bt_media_proxy_ctrl_get_playing_order(struct media_player *player); /** * @brief Set Playing Order @@ -1159,7 +1158,7 @@ int bt_media_proxy_ctrl_get_playing_order_safe(struct media_player *player); * * @return 0 if success, errno on failure. */ -int bt_media_proxy_ctrl_set_playing_order_safe(struct media_player *player, uint8_t order); +int bt_media_proxy_ctrl_set_playing_order(struct media_player *player, uint8_t order); /** * @brief Read Playing Orders Supported @@ -1171,7 +1170,7 @@ int bt_media_proxy_ctrl_set_playing_order_safe(struct media_player *player, uint * * @return 0 if success, errno on failure. */ -int bt_media_proxy_ctrl_get_playing_orders_supported_safe(struct media_player *player); +int bt_media_proxy_ctrl_get_playing_orders_supported(struct media_player *player); /** * @brief Read Media State @@ -1182,7 +1181,7 @@ int bt_media_proxy_ctrl_get_playing_orders_supported_safe(struct media_player *p * * @return 0 if success, errno on failure. */ -int bt_media_proxy_ctrl_get_media_state_safe(struct media_player *player); +int bt_media_proxy_ctrl_get_media_state(struct media_player *player); /** * @brief Send Command @@ -1197,7 +1196,7 @@ int bt_media_proxy_ctrl_get_media_state_safe(struct media_player *player); * * @return 0 if success, errno on failure. */ -int bt_media_proxy_ctrl_send_command_safe(struct media_player *player, const struct mpl_cmd *command); +int bt_media_proxy_ctrl_send_command(struct media_player *player, const struct mpl_cmd *command); /** * @brief Read Commands Supported @@ -1209,7 +1208,7 @@ int bt_media_proxy_ctrl_send_command_safe(struct media_player *player, const str * * @return 0 if success, errno on failure. */ -int bt_media_proxy_ctrl_get_commands_supported_safe(struct media_player *player); +int bt_media_proxy_ctrl_get_commands_supported(struct media_player *player); /** * @brief Set Search @@ -1230,7 +1229,7 @@ int bt_media_proxy_ctrl_get_commands_supported_safe(struct media_player *player) * * @return 0 if success, errno on failure. */ -int bt_media_proxy_ctrl_send_search_safe(struct media_player *player, const struct mpl_search *search); +int bt_media_proxy_ctrl_send_search(struct media_player *player, const struct mpl_search *search); /** * @brief Read Search Results Object ID @@ -1248,7 +1247,7 @@ int bt_media_proxy_ctrl_send_search_safe(struct media_player *player, const stru * * @return 0 if success, errno on failure. */ -int bt_media_proxy_ctrl_get_search_results_id_safe(struct media_player *player); +int bt_media_proxy_ctrl_get_search_results_id(struct media_player *player); /** * @brief Read Content Control ID @@ -1261,7 +1260,7 @@ int bt_media_proxy_ctrl_get_search_results_id_safe(struct media_player *player); * * @return 0 if success, errno on failure. */ -int bt_media_proxy_ctrl_get_content_ctrl_id_safe(struct media_player *player); +int bt_media_proxy_ctrl_get_content_ctrl_id(struct media_player *player); /** * @brief Available calls in a player, that the media proxy can call @@ -1594,7 +1593,7 @@ struct media_proxy_pl_calls { * * @return 0 if success, errno on failure */ -int bt_media_proxy_pl_register_safe(struct media_proxy_pl_calls *pl_calls); +int bt_media_proxy_pl_register(struct media_proxy_pl_calls *pl_calls); /** * @brief Initialize player @@ -1602,7 +1601,6 @@ int bt_media_proxy_pl_register_safe(struct media_proxy_pl_calls *pl_calls); * TODO: Move to player header file */ int bt_media_proxy_pl_init(void); -int bt_media_proxy_pl_init_safe(void); /** * @brief Set the player name and notify it @@ -1611,7 +1609,7 @@ int bt_media_proxy_pl_init_safe(void); * * @return 0 if success, errno on failure */ -int bt_media_proxy_pl_set_player_name_safe(char *name); +int bt_media_proxy_pl_set_player_name(char *name); /** * @brief Set the current track title and notify it @@ -1620,14 +1618,16 @@ int bt_media_proxy_pl_set_player_name_safe(char *name); * * @return 0 if success, errno on failure */ -int bt_media_proxy_pl_set_track_title_safe(char *title); +int bt_media_proxy_pl_set_track_title(char *title); /** * @brief Get the pointer of the Object Transfer Service used by the Media Control Service * * TODO: Find best location for this call, and move this one also */ -struct bt_ots *bt_mcs_get_ots_safe(void); +#if 0 +struct bt_ots *bt_mcs_get_ots(void); +#endif /** * @brief Player name changed callback @@ -1636,7 +1636,7 @@ struct bt_ots *bt_mcs_get_ots_safe(void); * * @param name The name of the player */ -void bt_media_proxy_pl_name_cb_safe(const char *name); +void bt_media_proxy_pl_name_cb(const char *name); /** * @brief Player icon URL changed callback @@ -1645,14 +1645,14 @@ void bt_media_proxy_pl_name_cb_safe(const char *name); * * @param url The URL of the player's icon */ -void bt_media_proxy_pl_icon_url_cb_safe(const char *url); +void bt_media_proxy_pl_icon_url_cb(const char *url); /** * @brief Track changed callback * * To be called when the player's current track is changed */ -void bt_media_proxy_pl_track_changed_cb_safe(void); +void bt_media_proxy_pl_track_changed_cb(void); /** * @brief Track title callback @@ -1661,7 +1661,7 @@ void bt_media_proxy_pl_track_changed_cb_safe(void); * * @param title The title of the track */ -void bt_media_proxy_pl_track_title_cb_safe(char *title); +void bt_media_proxy_pl_track_title_cb(char *title); /** * @brief Track duration callback @@ -1673,7 +1673,7 @@ void bt_media_proxy_pl_track_title_cb_safe(char *title); * * @param duration The track duration */ -void bt_media_proxy_pl_track_duration_cb_safe(int32_t duration); +void bt_media_proxy_pl_track_duration_cb(int32_t duration); /** * @brief Track position callback @@ -1690,7 +1690,7 @@ void bt_media_proxy_pl_track_duration_cb_safe(int32_t duration); * * @param position The media player's position in the track */ -void bt_media_proxy_pl_track_position_cb_safe(int32_t position); +void bt_media_proxy_pl_track_position_cb(int32_t position); /** * @brief Playback speed callback @@ -1699,7 +1699,7 @@ void bt_media_proxy_pl_track_position_cb_safe(int32_t position); * * @param speed The playback speed parameter */ -void bt_media_proxy_pl_playback_speed_cb_safe(int8_t speed); +void bt_media_proxy_pl_playback_speed_cb(int8_t speed); /** * @brief Seeking speed callback @@ -1708,7 +1708,7 @@ void bt_media_proxy_pl_playback_speed_cb_safe(int8_t speed); * * @param speed The seeking speed factor */ -void bt_media_proxy_pl_seeking_speed_cb_safe(int8_t speed); +void bt_media_proxy_pl_seeking_speed_cb(int8_t speed); /** * @brief Current track object ID callback @@ -1718,7 +1718,9 @@ void bt_media_proxy_pl_seeking_speed_cb_safe(int8_t speed); * * @param id The ID of the current track object in the OTS */ -void bt_media_proxy_pl_current_track_id_cb_safe(uint64_t id); +#if 0 +void bt_media_proxy_pl_current_track_id_cb(uint64_t id); +#endif /** * @brief Next track object ID callback @@ -1727,7 +1729,9 @@ void bt_media_proxy_pl_current_track_id_cb_safe(uint64_t id); * * @param id The ID of the next track object in the OTS */ -void bt_media_proxy_pl_next_track_id_cb_safe(uint64_t id); +#if 0 +void bt_media_proxy_pl_next_track_id_cb(uint64_t id); +#endif /** * @brief Parent group object ID callback @@ -1736,7 +1740,9 @@ void bt_media_proxy_pl_next_track_id_cb_safe(uint64_t id); * * @param id The ID of the parent group object in the OTS */ -void bt_media_proxy_pl_parent_group_id_cb_safe(uint64_t id); +#if 0 +void bt_media_proxy_pl_parent_group_id_cb(uint64_t id); +#endif /** * @brief Current group object ID callback @@ -1745,7 +1751,9 @@ void bt_media_proxy_pl_parent_group_id_cb_safe(uint64_t id); * * @param id The ID of the current group object in the OTS */ -void bt_media_proxy_pl_current_group_id_cb_safe(uint64_t id); +#if 0 +void bt_media_proxy_pl_current_group_id_cb(uint64_t id); +#endif /** * @brief Playing order callback @@ -1754,7 +1762,7 @@ void bt_media_proxy_pl_current_group_id_cb_safe(uint64_t id); * * @param order The playing order */ -void bt_media_proxy_pl_playing_order_cb_safe(uint8_t order); +void bt_media_proxy_pl_playing_order_cb(uint8_t order); /** * @brief Media state callback @@ -1763,7 +1771,7 @@ void bt_media_proxy_pl_playing_order_cb_safe(uint8_t order); * * @param state The media player's state */ -void bt_media_proxy_pl_media_state_cb_safe(uint8_t state); +void bt_media_proxy_pl_media_state_cb(uint8_t state); /** * @brief Command callback @@ -1774,7 +1782,7 @@ void bt_media_proxy_pl_media_state_cb_safe(uint8_t state); * * @param cmd_ntf The result of the command */ -void bt_media_proxy_pl_command_cb_safe(const struct mpl_cmd_ntf *cmd_ntf); +void bt_media_proxy_pl_command_cb(const struct mpl_cmd_ntf *cmd_ntf); /** * @brief Commands supported callback @@ -1783,7 +1791,7 @@ void bt_media_proxy_pl_command_cb_safe(const struct mpl_cmd_ntf *cmd_ntf); * * @param opcodes The supported commands opcodes */ -void bt_media_proxy_pl_commands_supported_cb_safe(uint32_t opcodes); +void bt_media_proxy_pl_commands_supported_cb(uint32_t opcodes); /** * @brief Search callback @@ -1797,7 +1805,9 @@ void bt_media_proxy_pl_commands_supported_cb_safe(uint32_t opcodes); * * @param result_code The result (success or failure) of the search */ -void bt_media_proxy_pl_search_cb_safe(uint8_t result_code); +#if 0 +void bt_media_proxy_pl_search_cb(uint8_t result_code); +#endif /** * @brief Search Results object ID callback @@ -1807,7 +1817,9 @@ void bt_media_proxy_pl_search_cb_safe(uint8_t result_code); * * @param id The ID of the search results object in the OTS */ -void bt_media_proxy_pl_search_results_id_cb_safe(uint64_t id); +#if 0 +void bt_media_proxy_pl_search_results_id_cb(uint64_t id); +#endif #ifdef __cplusplus } diff --git a/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/micp.h b/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/micp.h index 615e3c4b9ef..2ed62864b46 100644 --- a/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/micp.h +++ b/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/micp.h @@ -95,7 +95,6 @@ struct bt_micp_included { * @return 0 if success, errno on failure. */ int bt_micp_mic_dev_register(struct bt_micp_mic_dev_register_param *param); -int bt_micp_mic_dev_register_safe(struct bt_micp_mic_dev_register_param *param); /** * @brief Get Microphone Device included services @@ -109,7 +108,7 @@ int bt_micp_mic_dev_register_safe(struct bt_micp_mic_dev_register_param *param); * * @return 0 if success, errno on failure. */ -int bt_micp_mic_dev_included_get_safe(struct bt_micp_included *included); +int bt_micp_mic_dev_included_get(struct bt_micp_included *included); /** * @brief Struct to hold the Microphone Device callbacks @@ -134,14 +133,14 @@ struct bt_micp_mic_dev_cb { * * @return 0 on success, GATT error value on fail. */ -int bt_micp_mic_dev_unmute_safe(void); +int bt_micp_mic_dev_unmute(void); /** * @brief Mute the Microphone Device. * * @return 0 on success, GATT error value on fail. */ -int bt_micp_mic_dev_mute_safe(void); +int bt_micp_mic_dev_mute(void); /** * @brief Disable the mute functionality on the Microphone Device. @@ -150,14 +149,14 @@ int bt_micp_mic_dev_mute_safe(void); * * @return 0 on success, GATT error value on fail. */ -int bt_micp_mic_dev_mute_disable_safe(void); +int bt_micp_mic_dev_mute_disable(void); /** * @brief Read the mute state on the Microphone Device. * * @return 0 on success, GATT error value on fail. */ -int bt_micp_mic_dev_mute_get_safe(void); +int bt_micp_mic_dev_mute_get(void); /** * @brief Struct to hold the Microphone Controller callbacks @@ -229,8 +228,8 @@ struct bt_micp_mic_ctlr_cb { * * @return 0 if success, errno on failure. */ -int bt_micp_mic_ctlr_included_get_safe(struct bt_micp_mic_ctlr *mic_ctlr, - struct bt_micp_included *included); +int bt_micp_mic_ctlr_included_get(struct bt_micp_mic_ctlr *mic_ctlr, + struct bt_micp_included *included); /** * @brief Get the connection pointer of a Microphone Controller instance @@ -242,8 +241,8 @@ int bt_micp_mic_ctlr_included_get_safe(struct bt_micp_mic_ctlr *mic_ctlr, * * @return 0 if success, errno on failure. */ -int bt_micp_mic_ctlr_conn_get_safe(const struct bt_micp_mic_ctlr *mic_ctlr, - struct bt_conn **conn); +int bt_micp_mic_ctlr_conn_get(const struct bt_micp_mic_ctlr *mic_ctlr, + struct bt_conn **conn); /** * @brief Get the volume controller from a connection pointer @@ -274,8 +273,6 @@ struct bt_micp_mic_ctlr *bt_micp_mic_ctlr_get_by_conn(const struct bt_conn *conn */ int bt_micp_mic_ctlr_discover(struct bt_conn *conn, struct bt_micp_mic_ctlr **mic_ctlr); -int bt_micp_mic_ctlr_discover_safe(struct bt_conn *conn, - struct bt_micp_mic_ctlr **mic_ctlr); /** * @brief Unmute a remote Microphone Device. @@ -284,7 +281,7 @@ int bt_micp_mic_ctlr_discover_safe(struct bt_conn *conn, * * @return 0 on success, GATT error value on fail. */ -int bt_micp_mic_ctlr_unmute_safe(struct bt_micp_mic_ctlr *mic_ctlr); +int bt_micp_mic_ctlr_unmute(struct bt_micp_mic_ctlr *mic_ctlr); /** * @brief Mute a remote Microphone Device. @@ -293,7 +290,7 @@ int bt_micp_mic_ctlr_unmute_safe(struct bt_micp_mic_ctlr *mic_ctlr); * * @return 0 on success, GATT error value on fail. */ -int bt_micp_mic_ctlr_mute_safe(struct bt_micp_mic_ctlr *mic_ctlr); +int bt_micp_mic_ctlr_mute(struct bt_micp_mic_ctlr *mic_ctlr); /** * @brief Read the mute state of a remote Microphone Device. @@ -302,7 +299,7 @@ int bt_micp_mic_ctlr_mute_safe(struct bt_micp_mic_ctlr *mic_ctlr); * * @return 0 on success, GATT error value on fail. */ -int bt_micp_mic_ctlr_mute_get_safe(struct bt_micp_mic_ctlr *mic_ctlr); +int bt_micp_mic_ctlr_mute_get(struct bt_micp_mic_ctlr *mic_ctlr); /** * @brief Registers the callbacks used by Microphone Controller. @@ -313,7 +310,7 @@ int bt_micp_mic_ctlr_mute_get_safe(struct bt_micp_mic_ctlr *mic_ctlr); * * @return 0 if success, errno on failure. */ -int bt_micp_mic_ctlr_cb_register_safe(struct bt_micp_mic_ctlr_cb *cb); +int bt_micp_mic_ctlr_cb_register(struct bt_micp_mic_ctlr_cb *cb); #ifdef __cplusplus } #endif diff --git a/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/pacs.h b/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/pacs.h index 0183a0ae274..a30b1690d9d 100644 --- a/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/pacs.h +++ b/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/pacs.h @@ -98,9 +98,9 @@ typedef bool (*bt_pacs_cap_foreach_func_t)(const struct bt_pacs_cap *cap, * @param func Callback function. * @param user_data Data to pass to the callback. */ -void bt_pacs_cap_foreach_safe(enum bt_audio_dir dir, - bt_pacs_cap_foreach_func_t func, - void *user_data); +void bt_pacs_cap_foreach(enum bt_audio_dir dir, + bt_pacs_cap_foreach_func_t func, + void *user_data); /** * @brief Register the Published Audio Capability Service instance. @@ -112,14 +112,14 @@ void bt_pacs_cap_foreach_safe(enum bt_audio_dir dir, * @retval -EALREADY Already registered * @retval -ENOEXEC Request was rejected by GATT */ -int bt_pacs_register_safe(const struct bt_pacs_register_param *param); +int bt_pacs_register(const struct bt_pacs_register_param *param); /** * @brief Unregister the Published Audio Capability Service instance. * * @return 0 in case of success or negative value in case of error. */ -int bt_pacs_unregister_safe(void); +int bt_pacs_unregister(void); /** * @brief Register Published Audio Capability. @@ -131,7 +131,7 @@ int bt_pacs_unregister_safe(void); * * @return 0 in case of success or negative value in case of error. */ -int bt_pacs_cap_register_safe(enum bt_audio_dir dir, struct bt_pacs_cap *cap); +int bt_pacs_cap_register(enum bt_audio_dir dir, struct bt_pacs_cap *cap); /** * @brief Unregister Published Audio Capability. @@ -143,7 +143,7 @@ int bt_pacs_cap_register_safe(enum bt_audio_dir dir, struct bt_pacs_cap *cap); * * @return 0 in case of success or negative value in case of error. */ -int bt_pacs_cap_unregister_safe(enum bt_audio_dir dir, struct bt_pacs_cap *cap); +int bt_pacs_cap_unregister(enum bt_audio_dir dir, struct bt_pacs_cap *cap); /** * @brief Set the location for an endpoint type @@ -153,8 +153,8 @@ int bt_pacs_cap_unregister_safe(enum bt_audio_dir dir, struct bt_pacs_cap *cap); * * @return 0 in case of success or negative value in case of error. */ -int bt_pacs_set_location_safe(enum bt_audio_dir dir, - enum bt_audio_location location); +int bt_pacs_set_location(enum bt_audio_dir dir, + enum bt_audio_location location); /** * @brief Set the available contexts for an endpoint type @@ -164,8 +164,8 @@ int bt_pacs_set_location_safe(enum bt_audio_dir dir, * * @return 0 in case of success or negative value in case of error. */ -int bt_pacs_set_available_contexts_safe(enum bt_audio_dir dir, - enum bt_audio_context contexts); +int bt_pacs_set_available_contexts(enum bt_audio_dir dir, + enum bt_audio_context contexts); /** * @brief Get the available contexts for an endpoint type @@ -174,7 +174,7 @@ int bt_pacs_set_available_contexts_safe(enum bt_audio_dir dir, * * @return Bitmask of available contexts. */ -enum bt_audio_context bt_pacs_get_available_contexts_safe(enum bt_audio_dir dir); +enum bt_audio_context bt_pacs_get_available_contexts(enum bt_audio_dir dir); /** * @brief Set the available contexts for a given connection @@ -193,8 +193,6 @@ enum bt_audio_context bt_pacs_get_available_contexts_safe(enum bt_audio_dir dir) */ int bt_pacs_conn_set_available_contexts_for_conn(struct bt_conn *conn, enum bt_audio_dir dir, enum bt_audio_context *contexts); -int bt_pacs_conn_set_available_contexts_for_conn_safe(struct bt_conn *conn, enum bt_audio_dir dir, - enum bt_audio_context *contexts); /** * @brief Get the available contexts for a given connection @@ -211,8 +209,6 @@ int bt_pacs_conn_set_available_contexts_for_conn_safe(struct bt_conn *conn, enum */ enum bt_audio_context bt_pacs_get_available_contexts_for_conn(struct bt_conn *conn, enum bt_audio_dir dir); -enum bt_audio_context bt_pacs_get_available_contexts_for_conn_safe(struct bt_conn *conn, - enum bt_audio_dir dir); /** * @brief Set the supported contexts for an endpoint type @@ -222,8 +218,8 @@ enum bt_audio_context bt_pacs_get_available_contexts_for_conn_safe(struct bt_con * * @return 0 in case of success or negative value in case of error. */ -int bt_pacs_set_supported_contexts_safe(enum bt_audio_dir dir, - enum bt_audio_context contexts); +int bt_pacs_set_supported_contexts(enum bt_audio_dir dir, + enum bt_audio_context contexts); #ifdef __cplusplus } diff --git a/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/tbs.h b/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/tbs.h index 8d47ea2838e..6b759aad6eb 100644 --- a/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/tbs.h +++ b/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/tbs.h @@ -300,7 +300,7 @@ struct bt_tbs_cb { * @return int BT_TBS_RESULT_CODE_* if positive or 0, * errno value if negative. */ -int bt_tbs_accept_safe(uint8_t call_index); +int bt_tbs_accept(uint8_t call_index); /** * @brief Hold a call. @@ -310,7 +310,7 @@ int bt_tbs_accept_safe(uint8_t call_index); * @return int BT_TBS_RESULT_CODE_* if positive or 0, * errno value if negative. */ -int bt_tbs_hold_safe(uint8_t call_index); +int bt_tbs_hold(uint8_t call_index); /** * @brief Retrieve a call. @@ -320,7 +320,7 @@ int bt_tbs_hold_safe(uint8_t call_index); * @return int BT_TBS_RESULT_CODE_* if positive or 0, * errno value if negative. */ -int bt_tbs_retrieve_safe(uint8_t call_index); +int bt_tbs_retrieve(uint8_t call_index); /** * @brief Terminate a call. @@ -330,7 +330,7 @@ int bt_tbs_retrieve_safe(uint8_t call_index); * @return int BT_TBS_RESULT_CODE_* if positive or 0, * errno value if negative. */ -int bt_tbs_terminate_safe(uint8_t call_index); +int bt_tbs_terminate(uint8_t call_index); /** * @brief Originate a call @@ -343,7 +343,7 @@ int bt_tbs_terminate_safe(uint8_t call_index); * @return int A call index on success (positive value), * errno value on fail. */ -int bt_tbs_originate_safe(uint8_t bearer_index, char *uri, uint8_t *call_index); +int bt_tbs_originate(uint8_t bearer_index, char *uri, uint8_t *call_index); /** * @brief Join calls @@ -354,7 +354,7 @@ int bt_tbs_originate_safe(uint8_t bearer_index, char *uri, uint8_t *call_index); * @return int BT_TBS_RESULT_CODE_* if positive or 0, * errno value if negative. */ -int bt_tbs_join_safe(uint8_t call_index_cnt, uint8_t *call_indexes); +int bt_tbs_join(uint8_t call_index_cnt, uint8_t *call_indexes); /** * @brief Notify the server that the remote party answered the call. @@ -364,7 +364,7 @@ int bt_tbs_join_safe(uint8_t call_index_cnt, uint8_t *call_indexes); * @return int BT_TBS_RESULT_CODE_* if positive or 0, * errno value if negative. */ -int bt_tbs_remote_answer_safe(uint8_t call_index); +int bt_tbs_remote_answer(uint8_t call_index); /** * @brief Notify the server that the remote party held the call. @@ -374,7 +374,7 @@ int bt_tbs_remote_answer_safe(uint8_t call_index); * @return int BT_TBS_RESULT_CODE_* if positive or 0, * errno value if negative. */ -int bt_tbs_remote_hold_safe(uint8_t call_index); +int bt_tbs_remote_hold(uint8_t call_index); /** * @brief Notify the server that the remote party retrieved the call. @@ -384,7 +384,7 @@ int bt_tbs_remote_hold_safe(uint8_t call_index); * @return int BT_TBS_RESULT_CODE_* if positive or 0, * errno value if negative. */ -int bt_tbs_remote_retrieve_safe(uint8_t call_index); +int bt_tbs_remote_retrieve(uint8_t call_index); /** * @brief Notify the server that the remote party terminated the call. @@ -394,7 +394,7 @@ int bt_tbs_remote_retrieve_safe(uint8_t call_index); * @return int BT_TBS_RESULT_CODE_* if positive or 0, * errno value if negative. */ -int bt_tbs_remote_terminate_safe(uint8_t call_index); +int bt_tbs_remote_terminate(uint8_t call_index); /** * @brief Notify the server of an incoming call. @@ -407,8 +407,8 @@ int bt_tbs_remote_terminate_safe(uint8_t call_index); * @return int New call index if positive or 0, * errno value if negative. */ -int bt_tbs_remote_incoming_safe(uint8_t bearer_index, const char *to, - const char *from, const char *friendly_name); +int bt_tbs_remote_incoming(uint8_t bearer_index, const char *to, + const char *from, const char *friendly_name); /** * @brief Create a call directly in a given state (test setup helper). @@ -427,8 +427,8 @@ int bt_tbs_remote_incoming_safe(uint8_t bearer_index, const char *to, * @return int New call index if positive or 0, * errno value if negative. */ -int bt_tbs_add_call_safe(uint8_t bearer_index, uint8_t state, const char *uri, - uint8_t *call_index); +int bt_tbs_add_call(uint8_t bearer_index, uint8_t state, const char *uri, + uint8_t *call_index); /** * @brief Enable or disable automatic Dialing->Alerting promotion (test control). @@ -443,7 +443,7 @@ int bt_tbs_add_call_safe(uint8_t bearer_index, uint8_t state, const char *uri, * * @return int 0 on success, errno value if negative. */ -int bt_tbs_set_auto_alerting_safe(uint8_t bearer_index, bool enable); +int bt_tbs_set_auto_alerting(uint8_t bearer_index, bool enable); /** * @brief Move a Dialing call to the Alerting state (test setup helper). @@ -453,7 +453,7 @@ int bt_tbs_set_auto_alerting_safe(uint8_t bearer_index, bool enable); * @return int BT_TBS_RESULT_CODE_* if positive or 0, * errno value if negative. */ -int bt_tbs_set_call_alerting_safe(uint8_t call_index); +int bt_tbs_set_call_alerting(uint8_t call_index); /** * @brief Set a new bearer provider. @@ -465,7 +465,7 @@ int bt_tbs_set_call_alerting_safe(uint8_t call_index); * @return int BT_TBS_RESULT_CODE_* if positive or 0, * errno value if negative. */ -int bt_tbs_set_bearer_provider_name_safe(uint8_t bearer_index, const char *name); +int bt_tbs_set_bearer_provider_name(uint8_t bearer_index, const char *name); /** * @brief Set a new bearer technology. @@ -477,7 +477,7 @@ int bt_tbs_set_bearer_provider_name_safe(uint8_t bearer_index, const char *name) * @return int BT_TBS_RESULT_CODE_* if positive or 0, * errno value if negative. */ -int bt_tbs_set_bearer_technology_safe(uint8_t bearer_index, uint8_t new_technology); +int bt_tbs_set_bearer_technology(uint8_t bearer_index, uint8_t new_technology); /** * @brief Update the signal strength reported by the server. @@ -489,8 +489,8 @@ int bt_tbs_set_bearer_technology_safe(uint8_t bearer_index, uint8_t new_technolo * @return int BT_TBS_RESULT_CODE_* if positive or 0, * errno value if negative. */ -int bt_tbs_set_signal_strength_safe(uint8_t bearer_index, - uint8_t new_signal_strength); +int bt_tbs_set_signal_strength(uint8_t bearer_index, + uint8_t new_signal_strength); /** * @brief Sets the feature and status value. @@ -502,7 +502,7 @@ int bt_tbs_set_signal_strength_safe(uint8_t bearer_index, * @return int BT_TBS_RESULT_CODE_* if positive or 0, * errno value if negative. */ -int bt_tbs_set_status_flags_safe(uint8_t bearer_index, uint16_t status_flags); +int bt_tbs_set_status_flags(uint8_t bearer_index, uint16_t status_flags); /** * @brief Sets the URI scheme list of a bearer. @@ -512,13 +512,13 @@ int bt_tbs_set_status_flags_safe(uint8_t bearer_index, uint16_t status_flags); * * @return BT_TBS_RESULT_CODE_* if positive or 0, errno value if negative. */ -int bt_tbs_set_uri_scheme_list_safe(uint8_t bearer_index, const char *uri_scheme_list); +int bt_tbs_set_uri_scheme_list(uint8_t bearer_index, const char *uri_scheme_list); /** * @brief Register the callbacks for TBS. * * @param cbs Pointer to the callback structure. */ -void bt_tbs_register_cb_safe(struct bt_tbs_cb *cbs); +void bt_tbs_register_cb(struct bt_tbs_cb *cbs); /** Parameters for registering a Telephone Bearer Service */ struct bt_tbs_register_param { @@ -592,7 +592,6 @@ struct bt_tbs_register_param { * @retval -ENOEXEC The service failed to be registered */ int bt_tbs_register_bearer(const struct bt_tbs_register_param *param); -int bt_tbs_register_bearer_safe(const struct bt_tbs_register_param *param); /** * @brief Unregister a Telephone Bearer @@ -613,7 +612,6 @@ int bt_tbs_register_bearer_safe(const struct bt_tbs_register_param *param); * @retval -ENOEXEC The service failed to be unregistered */ int bt_tbs_unregister_bearer(uint8_t bearer_index); -int bt_tbs_unregister_bearer_safe(uint8_t bearer_index); /** @brief Prints all calls of all services to the debug log */ void bt_tbs_dbg_print_calls(void); @@ -812,7 +810,6 @@ struct bt_tbs_client_cb { * @return int 0 on success, GATT error value on fail. */ int bt_tbs_client_discover(struct bt_conn *conn); -int bt_tbs_client_discover_safe(struct bt_conn *conn); /** * @brief Set the outgoing URI for a TBS instance on the peer device. @@ -823,8 +820,8 @@ int bt_tbs_client_discover_safe(struct bt_conn *conn); * * @return int 0 on success, errno value on fail. */ -int bt_tbs_client_set_outgoing_uri_safe(struct bt_conn *conn, uint8_t inst_index, - const char *uri); +int bt_tbs_client_set_outgoing_uri(struct bt_conn *conn, uint8_t inst_index, + const char *uri); /** * @brief Set the signal strength reporting interval for a TBS instance. @@ -841,9 +838,6 @@ int bt_tbs_client_set_outgoing_uri_safe(struct bt_conn *conn, uint8_t inst_index int bt_tbs_client_set_signal_strength_interval(struct bt_conn *conn, uint8_t inst_index, uint8_t interval); -int bt_tbs_client_set_signal_strength_interval_safe(struct bt_conn *conn, - uint8_t inst_index, - uint8_t interval); /** * @brief Request to originate a call. @@ -859,8 +853,6 @@ int bt_tbs_client_set_signal_strength_interval_safe(struct bt_conn *conn, */ int bt_tbs_client_originate_call(struct bt_conn *conn, uint8_t inst_index, const char *uri); -int bt_tbs_client_originate_call_safe(struct bt_conn *conn, uint8_t inst_index, - const char *uri); /** * @brief Request to terminate a call @@ -876,8 +868,6 @@ int bt_tbs_client_originate_call_safe(struct bt_conn *conn, uint8_t inst_index, */ int bt_tbs_client_terminate_call(struct bt_conn *conn, uint8_t inst_index, uint8_t call_index); -int bt_tbs_client_terminate_call_safe(struct bt_conn *conn, uint8_t inst_index, - uint8_t call_index); /** * @brief Request to hold a call @@ -893,8 +883,6 @@ int bt_tbs_client_terminate_call_safe(struct bt_conn *conn, uint8_t inst_index, */ int bt_tbs_client_hold_call(struct bt_conn *conn, uint8_t inst_index, uint8_t call_index); -int bt_tbs_client_hold_call_safe(struct bt_conn *conn, uint8_t inst_index, - uint8_t call_index); /** * @brief Accept an incoming call @@ -910,8 +898,6 @@ int bt_tbs_client_hold_call_safe(struct bt_conn *conn, uint8_t inst_index, */ int bt_tbs_client_accept_call(struct bt_conn *conn, uint8_t inst_index, uint8_t call_index); -int bt_tbs_client_accept_call_safe(struct bt_conn *conn, uint8_t inst_index, - uint8_t call_index); /** * @brief Retrieve call from (local) hold. @@ -927,8 +913,6 @@ int bt_tbs_client_accept_call_safe(struct bt_conn *conn, uint8_t inst_index, */ int bt_tbs_client_retrieve_call(struct bt_conn *conn, uint8_t inst_index, uint8_t call_index); -int bt_tbs_client_retrieve_call_safe(struct bt_conn *conn, uint8_t inst_index, - uint8_t call_index); /** * @brief Join multiple calls. @@ -945,8 +929,6 @@ int bt_tbs_client_retrieve_call_safe(struct bt_conn *conn, uint8_t inst_index, */ int bt_tbs_client_join_calls(struct bt_conn *conn, uint8_t inst_index, const uint8_t *call_indexes, uint8_t count); -int bt_tbs_client_join_calls_safe(struct bt_conn *conn, uint8_t inst_index, - const uint8_t *call_indexes, uint8_t count); /** * @brief Read the bearer provider name of a TBS instance. @@ -960,8 +942,6 @@ int bt_tbs_client_join_calls_safe(struct bt_conn *conn, uint8_t inst_index, * for this function to be effective. */ int bt_tbs_client_read_bearer_provider_name(struct bt_conn *conn, uint8_t inst_index); -int bt_tbs_client_read_bearer_provider_name_safe(struct bt_conn *conn, - uint8_t inst_index); /** * @brief Read the UCI of a TBS instance. @@ -975,7 +955,6 @@ int bt_tbs_client_read_bearer_provider_name_safe(struct bt_conn *conn, * for this function to be effective. */ int bt_tbs_client_read_bearer_uci(struct bt_conn *conn, uint8_t inst_index); -int bt_tbs_client_read_bearer_uci_safe(struct bt_conn *conn, uint8_t inst_index); /** * @brief Read the technology of a TBS instance. @@ -989,7 +968,6 @@ int bt_tbs_client_read_bearer_uci_safe(struct bt_conn *conn, uint8_t inst_index) * for this function to be effective. */ int bt_tbs_client_read_technology(struct bt_conn *conn, uint8_t inst_index); -int bt_tbs_client_read_technology_safe(struct bt_conn *conn, uint8_t inst_index); /** * @brief Read the URI schemes list of a TBS instance. @@ -1003,7 +981,6 @@ int bt_tbs_client_read_technology_safe(struct bt_conn *conn, uint8_t inst_index) * for this function to be effective. */ int bt_tbs_client_read_uri_list(struct bt_conn *conn, uint8_t inst_index); -int bt_tbs_client_read_uri_list_safe(struct bt_conn *conn, uint8_t inst_index); /** * @brief Read the current signal strength of a TBS instance. @@ -1017,8 +994,6 @@ int bt_tbs_client_read_uri_list_safe(struct bt_conn *conn, uint8_t inst_index); * for this function to be effective. */ int bt_tbs_client_read_signal_strength(struct bt_conn *conn, uint8_t inst_index); -int bt_tbs_client_read_signal_strength_safe(struct bt_conn *conn, - uint8_t inst_index); /** * @brief Read the signal strength reporting interval of a TBS instance. @@ -1032,8 +1007,6 @@ int bt_tbs_client_read_signal_strength_safe(struct bt_conn *conn, * for this function to be effective. */ int bt_tbs_client_read_signal_interval(struct bt_conn *conn, uint8_t inst_index); -int bt_tbs_client_read_signal_interval_safe(struct bt_conn *conn, - uint8_t inst_index); /** * @brief Read the list of current calls of a TBS instance. @@ -1047,7 +1020,6 @@ int bt_tbs_client_read_signal_interval_safe(struct bt_conn *conn, * for this function to be effective. */ int bt_tbs_client_read_current_calls(struct bt_conn *conn, uint8_t inst_index); -int bt_tbs_client_read_current_calls_safe(struct bt_conn *conn, uint8_t inst_index); /** * @brief Read the content ID of a TBS instance. @@ -1061,7 +1033,6 @@ int bt_tbs_client_read_current_calls_safe(struct bt_conn *conn, uint8_t inst_ind * for this function to be effective. */ int bt_tbs_client_read_ccid(struct bt_conn *conn, uint8_t inst_index); -int bt_tbs_client_read_ccid_safe(struct bt_conn *conn, uint8_t inst_index); /** * @brief Read the call target URI of a TBS instance. @@ -1075,7 +1046,6 @@ int bt_tbs_client_read_ccid_safe(struct bt_conn *conn, uint8_t inst_index); * for this function to be effective. */ int bt_tbs_client_read_call_uri(struct bt_conn *conn, uint8_t inst_index); -int bt_tbs_client_read_call_uri_safe(struct bt_conn *conn, uint8_t inst_index); /** * @brief Read the feature and status value of a TBS instance. @@ -1089,7 +1059,6 @@ int bt_tbs_client_read_call_uri_safe(struct bt_conn *conn, uint8_t inst_index); * for this function to be effective. */ int bt_tbs_client_read_status_flags(struct bt_conn *conn, uint8_t inst_index); -int bt_tbs_client_read_status_flags_safe(struct bt_conn *conn, uint8_t inst_index); /** * @brief Read the states of the current calls of a TBS instance. @@ -1100,7 +1069,6 @@ int bt_tbs_client_read_status_flags_safe(struct bt_conn *conn, uint8_t inst_inde * @return int 0 on success, errno value on fail. */ int bt_tbs_client_read_call_state(struct bt_conn *conn, uint8_t inst_index); -int bt_tbs_client_read_call_state_safe(struct bt_conn *conn, uint8_t inst_index); /** * @brief Read the remote URI of a TBS instance. @@ -1114,7 +1082,6 @@ int bt_tbs_client_read_call_state_safe(struct bt_conn *conn, uint8_t inst_index) * for this function to be effective. */ int bt_tbs_client_read_remote_uri(struct bt_conn *conn, uint8_t inst_index); -int bt_tbs_client_read_remote_uri_safe(struct bt_conn *conn, uint8_t inst_index); /** * @brief Read the friendly name of a call for a TBS instance. @@ -1128,7 +1095,6 @@ int bt_tbs_client_read_remote_uri_safe(struct bt_conn *conn, uint8_t inst_index) * for this function to be effective. */ int bt_tbs_client_read_friendly_name(struct bt_conn *conn, uint8_t inst_index); -int bt_tbs_client_read_friendly_name_safe(struct bt_conn *conn, uint8_t inst_index); /** * @brief Read the supported opcode of a TBS instance. @@ -1143,8 +1109,6 @@ int bt_tbs_client_read_friendly_name_safe(struct bt_conn *conn, uint8_t inst_ind */ int bt_tbs_client_read_optional_opcodes(struct bt_conn *conn, uint8_t inst_index); -int bt_tbs_client_read_optional_opcodes_safe(struct bt_conn *conn, - uint8_t inst_index); /** * @brief Register the callbacks for CCP. @@ -1155,7 +1119,7 @@ int bt_tbs_client_read_optional_opcodes_safe(struct bt_conn *conn, * @retval -EINVAL @p cbs is NULL * @retval -EEXIST @p cbs is already registered */ -int bt_tbs_client_register_cb_safe(struct bt_tbs_client_cb *cbs); +int bt_tbs_client_register_cb(struct bt_tbs_client_cb *cbs); /** * @brief Look up Telephone Bearer Service instance by CCID @@ -1168,8 +1132,10 @@ int bt_tbs_client_register_cb_safe(struct bt_tbs_client_cb *cbs); * @note @kconfig{CONFIG_BT_TBS_CLIENT_CCID} must be set * for this function to be effective. */ -struct bt_tbs_instance *bt_tbs_client_get_by_ccid_safe(const struct bt_conn *conn, - uint8_t ccid); +#if 0 +struct bt_tbs_instance *bt_tbs_client_get_by_ccid(const struct bt_conn *conn, + uint8_t ccid); +#endif /** * @brief Look up Telephone Bearer Service instance by index @@ -1179,7 +1145,9 @@ struct bt_tbs_instance *bt_tbs_client_get_by_ccid_safe(const struct bt_conn *con * * @return Pointer to a Telephone Bearer Service instance if found else NULL. */ -struct bt_tbs_instance *bt_tbs_client_get_by_index_safe(const struct bt_conn *conn, uint8_t index); +#if 0 +struct bt_tbs_instance *bt_tbs_client_get_by_index(const struct bt_conn *conn, uint8_t index); +#endif #ifdef __cplusplus } diff --git a/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/tmap.h b/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/tmap.h index 91b4e2e1f28..eb9b312e840 100644 --- a/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/tmap.h +++ b/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/tmap.h @@ -102,7 +102,6 @@ struct bt_tmap_cb { * @return 0 on success or negative error value on failure. */ int bt_tmap_register(enum bt_tmap_role role); -int bt_tmap_register_safe(enum bt_tmap_role role); /** * @brief Perform service discovery as TMAP Client @@ -113,7 +112,6 @@ int bt_tmap_register_safe(enum bt_tmap_role role); * @return 0 on success or negative error value on failure. */ int bt_tmap_discover(struct bt_conn *conn, const struct bt_tmap_cb *tmap_cb); -int bt_tmap_discover_safe(struct bt_conn *conn, const struct bt_tmap_cb *tmap_cb); /** * @brief Set one or multiple TMAP roles dynamically. @@ -122,7 +120,7 @@ int bt_tmap_discover_safe(struct bt_conn *conn, const struct bt_tmap_cb *tmap_cb * @param role TMAP role(s). * */ -void bt_tmap_set_role_safe(enum bt_tmap_role role); +void bt_tmap_set_role(enum bt_tmap_role role); /** * @} diff --git a/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/vcp.h b/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/vcp.h index e6d1c4b0718..f643b1f41cc 100644 --- a/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/vcp.h +++ b/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/vcp.h @@ -119,7 +119,7 @@ struct bt_vcp_included { * * @return 0 if success, errno on failure. */ -int bt_vcp_vol_rend_included_get_safe(struct bt_vcp_included *included); +int bt_vcp_vol_rend_included_get(struct bt_vcp_included *included); /** * @brief Register the Volume Control Service. @@ -132,7 +132,6 @@ int bt_vcp_vol_rend_included_get_safe(struct bt_vcp_included *included); * @return 0 if success, errno on failure. */ int bt_vcp_vol_rend_register(struct bt_vcp_vol_rend_register_param *param); -int bt_vcp_vol_rend_register_safe(struct bt_vcp_vol_rend_register_param *param); /** * @brief Struct to hold the Volume Renderer callbacks @@ -184,49 +183,49 @@ struct bt_vcp_vol_rend_cb { * * @return 0 if success, errno on failure. */ -int bt_vcp_vol_rend_set_step_safe(uint8_t volume_step); +int bt_vcp_vol_rend_set_step(uint8_t volume_step); /** * @brief Get the Volume Control Service volume state. * * @return 0 if success, errno on failure. */ -int bt_vcp_vol_rend_get_state_safe(void); +int bt_vcp_vol_rend_get_state(void); /** * @brief Get the Volume Control Service flags. * * @return 0 if success, errno on failure. */ -int bt_vcp_vol_rend_get_flags_safe(void); +int bt_vcp_vol_rend_get_flags(void); /** * @brief Turn the volume down by one step on the server. * * @return 0 if success, errno on failure. */ -int bt_vcp_vol_rend_vol_down_safe(void); +int bt_vcp_vol_rend_vol_down(void); /** * @brief Turn the volume up by one step on the server. * * @return 0 if success, errno on failure. */ -int bt_vcp_vol_rend_vol_up_safe(void); +int bt_vcp_vol_rend_vol_up(void); /** * @brief Turn the volume down and unmute the server. * * @return 0 if success, errno on failure. */ -int bt_vcp_vol_rend_unmute_vol_down_safe(void); +int bt_vcp_vol_rend_unmute_vol_down(void); /** * @brief Turn the volume up and unmute the server. * * @return 0 if success, errno on failure. */ -int bt_vcp_vol_rend_unmute_vol_up_safe(void); +int bt_vcp_vol_rend_unmute_vol_up(void); /** * @brief Set the volume on the server @@ -235,21 +234,21 @@ int bt_vcp_vol_rend_unmute_vol_up_safe(void); * * @return 0 if success, errno on failure. */ -int bt_vcp_vol_rend_set_vol_safe(uint8_t volume); +int bt_vcp_vol_rend_set_vol(uint8_t volume); /** * @brief Unmute the server. * * @return 0 if success, errno on failure. */ -int bt_vcp_vol_rend_unmute_safe(void); +int bt_vcp_vol_rend_unmute(void); /** * @brief Mute the server. * * @return 0 if success, errno on failure. */ -int bt_vcp_vol_rend_mute_safe(void); +int bt_vcp_vol_rend_mute(void); /** * @name Volume Renderer reset field selectors @@ -264,7 +263,7 @@ int bt_vcp_vol_rend_mute_safe(void); #define BT_VCP_VOL_REND_RESET_MUTE BIT(1) /** @} */ -/** Parameters for @ref bt_vcp_vol_rend_reset_state_safe. */ +/** Parameters for @ref bt_vcp_vol_rend_reset_state. */ struct bt_vcp_vol_rend_reset_param { /** Bitmask of BT_VCP_VOL_REND_RESET_* selecting which fields to apply. */ uint32_t fields; @@ -289,7 +288,7 @@ struct bt_vcp_vol_rend_reset_param { * * @return 0 if success, errno on failure. */ -int bt_vcp_vol_rend_reset_state_safe(const struct bt_vcp_vol_rend_reset_param *param); +int bt_vcp_vol_rend_reset_state(const struct bt_vcp_vol_rend_reset_param *param); /** * @brief Struct to hold the Volume Controller callbacks @@ -444,7 +443,7 @@ struct bt_vcp_vol_ctlr_cb { * @retval -EINVAL if @p cb is NULL * @retval -EALREADY if @p cb was already registered */ -int bt_vcp_vol_ctlr_cb_register_safe(struct bt_vcp_vol_ctlr_cb *cb); +int bt_vcp_vol_ctlr_cb_register(struct bt_vcp_vol_ctlr_cb *cb); /** * @brief Unregisters the callbacks used by the Volume Controller. @@ -455,7 +454,7 @@ int bt_vcp_vol_ctlr_cb_register_safe(struct bt_vcp_vol_ctlr_cb *cb); * @retval -EINVAL if @p cb is NULL * @retval -EALREADY if @p cb was not registered */ -int bt_vcp_vol_ctlr_cb_unregister_safe(struct bt_vcp_vol_ctlr_cb *cb); +int bt_vcp_vol_ctlr_cb_unregister(struct bt_vcp_vol_ctlr_cb *cb); /** * @brief Discover Volume Control Service and included services. @@ -475,8 +474,6 @@ int bt_vcp_vol_ctlr_cb_unregister_safe(struct bt_vcp_vol_ctlr_cb *cb); */ int bt_vcp_vol_ctlr_discover(struct bt_conn *conn, struct bt_vcp_vol_ctlr **vol_ctlr); -int bt_vcp_vol_ctlr_discover_safe(struct bt_conn *conn, - struct bt_vcp_vol_ctlr **vol_ctlr); /** * @brief Get the volume controller from a connection pointer @@ -503,8 +500,8 @@ struct bt_vcp_vol_ctlr *bt_vcp_vol_ctlr_get_by_conn(const struct bt_conn *conn); * * @return 0 if success, errno on failure. */ -int bt_vcp_vol_ctlr_conn_get_safe(const struct bt_vcp_vol_ctlr *vol_ctlr, - struct bt_conn **conn); +int bt_vcp_vol_ctlr_conn_get(const struct bt_vcp_vol_ctlr *vol_ctlr, + struct bt_conn **conn); /** * @brief Get Volume Control Service included services. @@ -522,8 +519,10 @@ int bt_vcp_vol_ctlr_conn_get_safe(const struct bt_vcp_vol_ctlr *vol_ctlr, * * @return 0 if success, errno on failure. */ -int bt_vcp_vol_ctlr_included_get_safe(struct bt_vcp_vol_ctlr *vol_ctlr, - struct bt_vcp_included *included); +#if 0 +int bt_vcp_vol_ctlr_included_get(struct bt_vcp_vol_ctlr *vol_ctlr, + struct bt_vcp_included *included); +#endif /** * @brief Read the volume state of a remote Volume Renderer. @@ -532,7 +531,7 @@ int bt_vcp_vol_ctlr_included_get_safe(struct bt_vcp_vol_ctlr *vol_ctlr, * * @return 0 if success, errno on failure. */ -int bt_vcp_vol_ctlr_read_state_safe(struct bt_vcp_vol_ctlr *vol_ctlr); +int bt_vcp_vol_ctlr_read_state(struct bt_vcp_vol_ctlr *vol_ctlr); /** * @brief Read the volume flags of a remote Volume Renderer. @@ -541,7 +540,7 @@ int bt_vcp_vol_ctlr_read_state_safe(struct bt_vcp_vol_ctlr *vol_ctlr); * * @return 0 if success, errno on failure. */ -int bt_vcp_vol_ctlr_read_flags_safe(struct bt_vcp_vol_ctlr *vol_ctlr); +int bt_vcp_vol_ctlr_read_flags(struct bt_vcp_vol_ctlr *vol_ctlr); /** * @brief Turn the volume down one step on a remote Volume Renderer @@ -550,7 +549,7 @@ int bt_vcp_vol_ctlr_read_flags_safe(struct bt_vcp_vol_ctlr *vol_ctlr); * * @return 0 if success, errno on failure. */ -int bt_vcp_vol_ctlr_vol_down_safe(struct bt_vcp_vol_ctlr *vol_ctlr); +int bt_vcp_vol_ctlr_vol_down(struct bt_vcp_vol_ctlr *vol_ctlr); /** * @brief Turn the volume up one step on a remote Volume Renderer @@ -559,7 +558,7 @@ int bt_vcp_vol_ctlr_vol_down_safe(struct bt_vcp_vol_ctlr *vol_ctlr); * * @return 0 if success, errno on failure. */ -int bt_vcp_vol_ctlr_vol_up_safe(struct bt_vcp_vol_ctlr *vol_ctlr); +int bt_vcp_vol_ctlr_vol_up(struct bt_vcp_vol_ctlr *vol_ctlr); /** * @brief Turn the volume down one step and unmute on a remote Volume Renderer @@ -568,7 +567,7 @@ int bt_vcp_vol_ctlr_vol_up_safe(struct bt_vcp_vol_ctlr *vol_ctlr); * * @return 0 if success, errno on failure. */ -int bt_vcp_vol_ctlr_unmute_vol_down_safe(struct bt_vcp_vol_ctlr *vol_ctlr); +int bt_vcp_vol_ctlr_unmute_vol_down(struct bt_vcp_vol_ctlr *vol_ctlr); /** * @brief Turn the volume up one step and unmute on a remote Volume Renderer @@ -577,7 +576,7 @@ int bt_vcp_vol_ctlr_unmute_vol_down_safe(struct bt_vcp_vol_ctlr *vol_ctlr); * * @return 0 if success, errno on failure. */ -int bt_vcp_vol_ctlr_unmute_vol_up_safe(struct bt_vcp_vol_ctlr *vol_ctlr); +int bt_vcp_vol_ctlr_unmute_vol_up(struct bt_vcp_vol_ctlr *vol_ctlr); /** * @brief Set the absolute volume on a remote Volume Renderer @@ -587,7 +586,7 @@ int bt_vcp_vol_ctlr_unmute_vol_up_safe(struct bt_vcp_vol_ctlr *vol_ctlr); * * @return 0 if success, errno on failure. */ -int bt_vcp_vol_ctlr_set_vol_safe(struct bt_vcp_vol_ctlr *vol_ctlr, uint8_t volume); +int bt_vcp_vol_ctlr_set_vol(struct bt_vcp_vol_ctlr *vol_ctlr, uint8_t volume); /** * @brief Unmute a remote Volume Renderer. @@ -596,7 +595,7 @@ int bt_vcp_vol_ctlr_set_vol_safe(struct bt_vcp_vol_ctlr *vol_ctlr, uint8_t volum * * @return 0 if success, errno on failure. */ -int bt_vcp_vol_ctlr_unmute_safe(struct bt_vcp_vol_ctlr *vol_ctlr); +int bt_vcp_vol_ctlr_unmute(struct bt_vcp_vol_ctlr *vol_ctlr); /** * @brief Mute a remote Volume Renderer. @@ -605,7 +604,7 @@ int bt_vcp_vol_ctlr_unmute_safe(struct bt_vcp_vol_ctlr *vol_ctlr); * * @return 0 if success, errno on failure. */ -int bt_vcp_vol_ctlr_mute_safe(struct bt_vcp_vol_ctlr *vol_ctlr); +int bt_vcp_vol_ctlr_mute(struct bt_vcp_vol_ctlr *vol_ctlr); #ifdef __cplusplus } diff --git a/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/vocs.h b/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/vocs.h index b037f821f71..a8812d193bd 100644 --- a/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/vocs.h +++ b/components/bt/esp_ble_audio/include/zephyr/bluetooth/audio/vocs.h @@ -114,7 +114,7 @@ struct bt_vocs_discover_param { * * @return Volume Offset Control Service instance in case of success or NULL in case of error. */ -struct bt_vocs *bt_vocs_free_instance_get_safe(void); +struct bt_vocs *bt_vocs_free_instance_get(void); /** * @brief Get the service declaration attribute. @@ -125,7 +125,7 @@ struct bt_vocs *bt_vocs_free_instance_get_safe(void); * * @return Pointer to the attributes of the service. */ -void *bt_vocs_svc_decl_get_safe(struct bt_vocs *vocs); +void *bt_vocs_svc_decl_get(struct bt_vocs *vocs); /** * @brief Get the connection pointer of a client instance @@ -138,7 +138,7 @@ void *bt_vocs_svc_decl_get_safe(struct bt_vocs *vocs); * * @return 0 if success, errno on failure. */ -int bt_vocs_client_conn_get_safe(const struct bt_vocs *vocs, struct bt_conn **conn); +int bt_vocs_client_conn_get(const struct bt_vocs *vocs, struct bt_conn **conn); /** * @brief Register the Volume Offset Control Service instance. @@ -148,8 +148,8 @@ int bt_vocs_client_conn_get_safe(const struct bt_vocs *vocs, struct bt_conn **co * * @return 0 if success, errno on failure. */ -int bt_vocs_register_safe(struct bt_vocs *vocs, - const struct bt_vocs_register_param *param); +int bt_vocs_register(struct bt_vocs *vocs, + const struct bt_vocs_register_param *param); /** * @brief Callback function for the offset state. @@ -252,7 +252,7 @@ struct bt_vocs_cb { * * @return 0 on success, GATT error value on fail. */ -int bt_vocs_state_get_safe(struct bt_vocs *inst); +int bt_vocs_state_get(struct bt_vocs *inst); /** * @brief Set the Volume Offset Control Service offset state. @@ -262,7 +262,7 @@ int bt_vocs_state_get_safe(struct bt_vocs *inst); * * @return 0 on success, GATT error value on fail. */ -int bt_vocs_state_set_safe(struct bt_vocs *inst, int16_t offset); +int bt_vocs_state_set(struct bt_vocs *inst, int16_t offset); /** * @brief Read the Volume Offset Control Service location. @@ -273,7 +273,7 @@ int bt_vocs_state_set_safe(struct bt_vocs *inst, int16_t offset); * * @return 0 on success, GATT error value on fail. */ -int bt_vocs_location_get_safe(struct bt_vocs *inst); +int bt_vocs_location_get(struct bt_vocs *inst); /** * @brief Set the Volume Offset Control Service location. @@ -283,7 +283,7 @@ int bt_vocs_location_get_safe(struct bt_vocs *inst); * * @return 0 on success, GATT error value on fail. */ -int bt_vocs_location_set_safe(struct bt_vocs *inst, uint32_t location); +int bt_vocs_location_set(struct bt_vocs *inst, uint32_t location); /** * @brief Read the Volume Offset Control Service output description. @@ -294,7 +294,7 @@ int bt_vocs_location_set_safe(struct bt_vocs *inst, uint32_t location); * * @return 0 on success, GATT error value on fail. */ -int bt_vocs_description_get_safe(struct bt_vocs *inst); +int bt_vocs_description_get(struct bt_vocs *inst); /** * @brief Set the Volume Offset Control Service description. @@ -304,7 +304,7 @@ int bt_vocs_description_get_safe(struct bt_vocs *inst); * * @return 0 on success, GATT error value on fail. */ -int bt_vocs_description_set_safe(struct bt_vocs *inst, const char *description); +int bt_vocs_description_set(struct bt_vocs *inst, const char *description); /** * @brief Registers the callbacks for the Volume Offset Control Service client. @@ -312,14 +312,14 @@ int bt_vocs_description_set_safe(struct bt_vocs *inst, const char *description); * @param inst Pointer to the Volume Offset Control Service client instance. * @param cb Pointer to the callback structure. */ -void bt_vocs_client_cb_register_safe(struct bt_vocs *inst, struct bt_vocs_cb *cb); +void bt_vocs_client_cb_register(struct bt_vocs *inst, struct bt_vocs_cb *cb); /** * @brief Returns a pointer to a Volume Offset Control Service client instance. * * @return Pointer to the instance, or NULL if no free instances are left. */ -struct bt_vocs *bt_vocs_client_free_instance_get_safe(void); +struct bt_vocs *bt_vocs_client_free_instance_get(void); /** * @brief Discover a Volume Offset Control Service. @@ -334,8 +334,6 @@ struct bt_vocs *bt_vocs_client_free_instance_get_safe(void); */ int bt_vocs_discover(struct bt_conn *conn, struct bt_vocs *inst, const struct bt_vocs_discover_param *param); -int bt_vocs_discover_safe(struct bt_conn *conn, struct bt_vocs *inst, - const struct bt_vocs_discover_param *param); #ifdef __cplusplus } diff --git a/components/bt/esp_ble_audio/lib/lib b/components/bt/esp_ble_audio/lib/lib index 774d7777665..ebded291fc0 160000 --- a/components/bt/esp_ble_audio/lib/lib +++ b/components/bt/esp_ble_audio/lib/lib @@ -1 +1 @@ -Subproject commit 774d7777665adf21ea4bcf2d8f5f283516a0c391 +Subproject commit ebded291fc0d71924a94319f548d6260630500b8 diff --git a/components/bt/esp_ble_iso/api/esp_ble_iso_common_api.c b/components/bt/esp_ble_iso/api/esp_ble_iso_common_api.c index a260efe385c..6d32925da26 100644 --- a/components/bt/esp_ble_iso/api/esp_ble_iso_common_api.c +++ b/components/bt/esp_ble_iso/api/esp_ble_iso_common_api.c @@ -59,7 +59,12 @@ esp_err_t esp_ble_iso_server_register(esp_ble_iso_server_t *server) { int err; - err = bt_iso_server_register_safe(server); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_iso_server_register(server); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -71,7 +76,12 @@ esp_err_t esp_ble_iso_server_unregister(esp_ble_iso_server_t *server) { int err; - err = bt_iso_server_unregister_safe(server); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_iso_server_unregister(server); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -86,7 +96,12 @@ esp_err_t esp_ble_iso_cig_create(esp_ble_iso_cig_param_t *param, { int err; - err = bt_iso_cig_create_safe(param, out_cig); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_iso_cig_create(param, out_cig); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -99,7 +114,12 @@ esp_err_t esp_ble_iso_cig_reconfigure(esp_ble_iso_cig_t *cig, { int err; - err = bt_iso_cig_reconfigure_safe(cig, param); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_iso_cig_reconfigure(cig, param); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -111,7 +131,12 @@ esp_err_t esp_ble_iso_cig_terminate(esp_ble_iso_cig_t *cig) { int err; - err = bt_iso_cig_terminate_safe(cig); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_iso_cig_terminate(cig); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -130,7 +155,7 @@ esp_err_t esp_ble_iso_chan_connect(esp_ble_iso_connect_param_t *param, return ESP_ERR_INVALID_ARG; } - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); conn = bt_le_acl_conn_find(conn_handle); if (conn == NULL) { @@ -158,7 +183,12 @@ esp_err_t esp_ble_iso_chan_disconnect(esp_ble_iso_chan_t *chan) { int err; - err = bt_iso_chan_disconnect_safe(chan); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_iso_chan_disconnect(chan); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -186,7 +216,12 @@ esp_err_t esp_ble_iso_setup_data_path(const esp_ble_iso_chan_t *chan, uint8_t di return ESP_ERR_INVALID_ARG; } - err = bt_iso_setup_data_path_safe(chan, dir, path); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_iso_setup_data_path(chan, dir, path); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -202,7 +237,12 @@ esp_err_t esp_ble_iso_remove_data_path(const esp_ble_iso_chan_t *chan, uint8_t d return ESP_ERR_INVALID_ARG; } - err = bt_iso_remove_data_path_safe(chan, dir); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_iso_remove_data_path(chan, dir); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -219,7 +259,12 @@ esp_err_t esp_ble_iso_big_register_cb(esp_ble_iso_big_cb_t *cb) return ESP_ERR_INVALID_ARG; } - err = bt_iso_big_register_cb_safe(cb); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_iso_big_register_cb(cb); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -236,8 +281,13 @@ esp_err_t esp_ble_iso_big_ext_adv_add(esp_ble_iso_ext_adv_info_t *info) return ESP_ERR_INVALID_ARG; } - err = bt_le_ext_adv_new_safe(info->adv_handle, info->addr_type, - info->addr, info->sid); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_le_ext_adv_new(info->adv_handle, info->addr_type, + info->addr, info->sid); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -253,7 +303,12 @@ esp_err_t esp_ble_iso_big_ext_adv_delete(esp_ble_iso_ext_adv_info_t *info) return ESP_ERR_INVALID_ARG; } - err = bt_le_ext_adv_delete_safe(info->adv_handle); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_le_ext_adv_delete(info->adv_handle); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -269,7 +324,7 @@ esp_err_t esp_ble_iso_big_create(uint8_t adv_handle, void *adv; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); adv = bt_le_ext_adv_find(adv_handle); if (adv == NULL) { @@ -298,7 +353,7 @@ esp_err_t esp_ble_iso_big_sync(uint16_t sync_handle, void *per_adv_sync; int err; - bt_le_host_lock(); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); per_adv_sync = bt_le_per_adv_sync_find(sync_handle); if (per_adv_sync == NULL) { @@ -322,7 +377,12 @@ esp_err_t esp_ble_iso_big_terminate(esp_ble_iso_big_t *big) { int err; - err = bt_iso_big_terminate_safe(big); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_iso_big_terminate(big); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -336,7 +396,12 @@ esp_err_t esp_ble_iso_chan_get_info(esp_ble_iso_chan_t *chan, { int err; - err = bt_iso_chan_get_info_safe(chan, info); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_iso_chan_get_info(chan, info); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -350,7 +415,12 @@ esp_err_t esp_ble_iso_chan_get_tx_sync(esp_ble_iso_chan_t *chan, { int err; - err = bt_iso_chan_get_tx_sync_safe(chan, info); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_iso_chan_get_tx_sync(chan, info); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -374,7 +444,12 @@ esp_err_t esp_ble_iso_chan_send(esp_ble_iso_chan_t *chan, return ESP_ERR_INVALID_ARG; } - err = bt_iso_chan_send_safe(chan, &buf, seq_num); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_iso_chan_send(chan, &buf, seq_num); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } @@ -399,7 +474,12 @@ esp_err_t esp_ble_iso_chan_send_ts(esp_ble_iso_chan_t *chan, return ESP_ERR_INVALID_ARG; } - err = bt_iso_chan_send_ts_safe(chan, &buf, seq_num, ts); + BT_LE_HOST_LOCK_OR_RETURN(ESP_ERR_TIMEOUT); + + err = bt_iso_chan_send_ts(chan, &buf, seq_num, ts); + + bt_le_host_unlock(); + if (err) { return ESP_FAIL; } diff --git a/components/bt/esp_ble_iso/host/common/adv.c b/components/bt/esp_ble_iso/host/common/adv.c index 749627d098d..4b9c7e9be37 100644 --- a/components/bt/esp_ble_iso/host/common/adv.c +++ b/components/bt/esp_ble_iso/host/common/adv.c @@ -79,26 +79,21 @@ void bt_le_ext_adv_state_reset(void) memset(ext_adv_pool, 0, sizeof(ext_adv_pool)); } -int bt_le_ext_adv_new_safe(uint8_t adv_handle, uint8_t addr_type, - const uint8_t *addr, uint8_t sid) +int bt_le_ext_adv_new(uint8_t adv_handle, uint8_t addr_type, + const uint8_t *addr, uint8_t sid) { - struct bt_le_ext_adv *adv = NULL; - int err = 0; - - bt_le_host_lock(); + struct bt_le_ext_adv *adv; adv = ext_adv_find(adv_handle); if (adv) { LOG_WRN("ExtAdvExist[%u]", adv_handle); - err = -EEXIST; - goto end; + return -EEXIST; } adv = ext_adv_new(); if (adv == NULL) { LOG_ERR("NoFreeExtAdv[%u]", adv_handle); - err = -ENOMEM; - goto end; + return -ENOMEM; } adv->handle = adv_handle; @@ -106,33 +101,23 @@ int bt_le_ext_adv_new_safe(uint8_t adv_handle, uint8_t addr_type, bt_addr_copy(&adv->addr.a, (const bt_addr_t *)addr); adv->sid = sid; -end: - bt_le_host_unlock(); - - return err; + return 0; } _IDF_ONLY -int bt_le_ext_adv_delete_safe(uint8_t adv_handle) +int bt_le_ext_adv_delete(uint8_t adv_handle) { - struct bt_le_ext_adv *adv = NULL; - int err = 0; - - bt_le_host_lock(); + struct bt_le_ext_adv *adv; adv = ext_adv_find(adv_handle); if (adv == NULL) { LOG_ERR("ExtAdvNotFound[%u]", adv_handle); - err = -ENODEV; - goto end; + return -ENODEV; } ext_adv_delete(adv); -end: - bt_le_host_unlock(); - - return err; + return 0; } _LIB_ONLY diff --git a/components/bt/esp_ble_iso/host/common/conn.c b/components/bt/esp_ble_iso/host/common/conn.c index b3796a20964..29726a173ec 100644 --- a/components/bt/esp_ble_iso/host/common/conn.c +++ b/components/bt/esp_ble_iso/host/common/conn.c @@ -214,16 +214,6 @@ int bt_conn_cb_register(struct bt_conn_cb *cb) return 0; } -_IDF_ONLY -int bt_conn_cb_register_safe(struct bt_conn_cb *cb) -{ - int err; - bt_le_host_lock(); - err = bt_conn_cb_register(cb); - bt_le_host_unlock(); - return err; -} - int bt_conn_cb_unregister(struct bt_conn_cb *cb) { LOG_DBG("ConnCbUnreg"); @@ -241,16 +231,6 @@ int bt_conn_cb_unregister(struct bt_conn_cb *cb) return 0; } -_IDF_ONLY -int bt_conn_cb_unregister_safe(struct bt_conn_cb *cb) -{ - int err; - bt_le_host_lock(); - err = bt_conn_cb_unregister(cb); - bt_le_host_unlock(); - return err; -} - _LIB_ONLY int bt_conn_auth_info_cb_register(struct bt_conn_auth_info_cb *cb) { @@ -408,27 +388,6 @@ int bt_le_acl_conn_new(uint16_t conn_handle, return (conn ? 0 : -ENOMEM); } -_IDF_ONLY -int bt_le_acl_conn_new_safe(uint16_t conn_handle, uint8_t role, uint8_t addr_type, - const uint8_t *addr, uint8_t sec_level) -{ - bt_addr_le_t dst; - int err; - - if (addr == NULL) { - return -EINVAL; - } - - dst.type = addr_type; - bt_addr_copy(&dst.a, (const bt_addr_t *)addr); - - bt_le_host_lock(); - err = bt_le_acl_conn_new(conn_handle, role, &dst, sec_level); - bt_le_host_unlock(); - - return err; -} - /* Point conn->le.keys at this ACL connection's LTK slot, filled with the bonded * LTK the adapter captured. Used as key K by the lib's CSIS SIRK encryption. */ _IDF_ONLY diff --git a/components/bt/esp_ble_iso/host/common/gatt.c b/components/bt/esp_ble_iso/host/common/gatt.c index 742d70c4562..ac5800da056 100644 --- a/components/bt/esp_ble_iso/host/common/gatt.c +++ b/components/bt/esp_ble_iso/host/common/gatt.c @@ -109,16 +109,6 @@ int bt_gatt_service_register(struct bt_gatt_service *svc) return 0; } -_IDF_ONLY -int bt_gatt_service_register_safe(struct bt_gatt_service *svc) -{ - int err; - bt_le_host_lock(); - err = bt_gatt_service_register(svc); - bt_le_host_unlock(); - return err; -} - _LIB_ONLY int bt_gatt_service_unregister(struct bt_gatt_service *svc) { @@ -139,16 +129,6 @@ int bt_gatt_service_unregister(struct bt_gatt_service *svc) return 0; } -_IDF_ONLY -int bt_gatt_service_unregister_safe(struct bt_gatt_service *svc) -{ - int err; - bt_le_host_lock(); - err = bt_gatt_service_unregister(svc); - bt_le_host_unlock(); - return err; -} - _LIB_ONLY uint16_t bt_gatt_get_mtu(struct bt_conn *conn) { @@ -1111,18 +1091,14 @@ int bt_gatts_sub_changed(uint16_t conn_handle, } _IDF_ONLY -int bt_gattc_disc_start_safe(uint16_t conn_handle) +int bt_gattc_disc_start(uint16_t conn_handle) { - int err; LOG_DBG("GattcDiscStart[%u]", conn_handle); - bt_le_host_lock(); #if CONFIG_BT_BLUEDROID_ENABLED - err = bt_le_bluedroid_gattc_disc_start(conn_handle); + return bt_le_bluedroid_gattc_disc_start(conn_handle); #else - err = bt_le_nimble_gattc_disc_start(conn_handle); + return bt_le_nimble_gattc_disc_start(conn_handle); #endif - bt_le_host_unlock(); - return err; } _LIB_ONLY diff --git a/components/bt/esp_ble_iso/host/common/host.c b/components/bt/esp_ble_iso/host/common/host.c index 6b3185eb8e3..9af7d2d6300 100644 --- a/components/bt/esp_ble_iso/host/common/host.c +++ b/components/bt/esp_ble_iso/host/common/host.c @@ -35,6 +35,14 @@ static BT_ISO_CTRL_BSS_ATTR struct k_mutex host_mutex; extern struct bt_conn iso_conns[CONFIG_BT_ISO_MAX_CHAN]; +/* bt_le_host_lock() retries every HOST_LOCK_POLL_MS, logging LockFail with both + * task names, and reboots once the wait reaches HOST_LOCK_ABORT_MS. Healthy + * holds are microseconds, so 5s is unambiguous - and nothing else would notice: + * both tasks are blocked rather than spinning, so idle keeps feeding the task + * watchdog. Set HOST_LOCK_ABORT_MS 0 to keep a wedge alive for inspection. */ +#define HOST_LOCK_POLL_MS 1000 +#define HOST_LOCK_ABORT_MS 5000 + #if HOST_LOCK_DEBUG void bt_le_host_lock_debug(const char *func, int line) #else /* HOST_LOCK_DEBUG */ @@ -43,19 +51,48 @@ void bt_le_host_lock(void) { /* LOG_DBG("%s: %d", func, line); */ - int err = k_mutex_lock(&host_mutex, K_MUTEX_SHORT); - if (err) { - /* K_MUTEX_SHORT wait failed: the host stack is wedged. k_mutex_lock has - * already logged self/holder task names. Use libc abort() rather - * than BT_LE_ASSERT(0) — assert is a no-op under NDEBUG, which would - * let the caller enter the critical section without the mutex - * held and cause races. abort() halts in every build. - */ - LOG_ERR("HostLockTimeout"); - abort(); + /* Never returns without the mutex: the caller's critical section would run + * unprotected, trading a deadlock for silent state corruption, and this API + * cannot report the failure anyway - it returns void, so every caller + * proceeds as if it holds the mutex. Retries and warns instead, then + * reboots - see HOST_LOCK_POLL_MS. */ + unsigned waited_ms = 0; + + while (k_mutex_lock(&host_mutex, HOST_LOCK_POLL_MS / portTICK_PERIOD_MS) != 0) { + waited_ms += HOST_LOCK_POLL_MS; + + /* Usually an AB-BA inversion: two locks, two tasks, opposite orders. + * + * iso_task: host_mutex held -> blocks on the application's lock + * (an app callback dispatched from under the mutex) + * app task: application's lock held -> blocks here on host_mutex + * + * Neither order is wrong by itself; the pair only deadlocks where the + * two paths overlap, so it need not reproduce. k_mutex_lock's LockFail + * on the line above names both tasks. */ + LOG_WRN("HostLockTimeout[%ums]", waited_ms); + +#if HOST_LOCK_ABORT_MS + if (waited_ms >= HOST_LOCK_ABORT_MS) { + abort(); + } +#endif /* HOST_LOCK_ABORT_MS */ } } +int bt_le_host_lock_timeout(void) +{ + /* The bounded variant, for callers that can report the failure upward - see + * BT_LE_HOST_LOCK_OR_RETURN. Bounded by K_MUTEX_SHORT rather than + * HOST_LOCK_ABORT_MS so that disabling the abort does not turn this into a + * try-lock that fails on any contention. */ + if (k_mutex_lock(&host_mutex, K_MUTEX_SHORT) != 0) { + return -EBUSY; + } + + return 0; +} + #if HOST_LOCK_DEBUG void bt_le_host_unlock_debug(const char *func, int line) #else /* HOST_LOCK_DEBUG */ @@ -64,9 +101,9 @@ void bt_le_host_unlock(void) { /* LOG_DBG("%s: %d", func, line); */ - /* Defense-in-depth: bt_le_host_lock now aborts on timeout, so this - * branch is unreachable in normal flow. Keep the check to catch any - * unbalanced unlock (callers releasing without prior lock). + /* Defense-in-depth: bt_le_host_lock never returns without the mutex, + * so this branch is unreachable in normal flow. Keep the check to + * catch any unbalanced unlock (callers releasing without prior lock). */ if (xSemaphoreGetMutexHolder(host_mutex.handle) != xTaskGetCurrentTaskHandle()) { LOG_WRN("HostUnlockNotHolder"); diff --git a/components/bt/esp_ble_iso/host/common/include/common/adv.h b/components/bt/esp_ble_iso/host/common/include/common/adv.h index b519e58a1e0..56c369e4f48 100644 --- a/components/bt/esp_ble_iso/host/common/include/common/adv.h +++ b/components/bt/esp_ble_iso/host/common/include/common/adv.h @@ -17,10 +17,10 @@ extern "C" { struct bt_le_ext_adv *bt_le_ext_adv_find(uint8_t adv_handle); -int bt_le_ext_adv_new_safe(uint8_t adv_handle, uint8_t addr_type, - const uint8_t *addr, uint8_t sid); +int bt_le_ext_adv_new(uint8_t adv_handle, uint8_t addr_type, + const uint8_t *addr, uint8_t sid); -int bt_le_ext_adv_delete_safe(uint8_t adv_handle); +int bt_le_ext_adv_delete(uint8_t adv_handle); void bt_le_ext_adv_state_reset(void); diff --git a/components/bt/esp_ble_iso/host/common/include/common/conn.h b/components/bt/esp_ble_iso/host/common/include/common/conn.h index 5659a8b7ecc..d4d1e1e0a31 100644 --- a/components/bt/esp_ble_iso/host/common/include/common/conn.h +++ b/components/bt/esp_ble_iso/host/common/include/common/conn.h @@ -41,8 +41,6 @@ int bt_le_acl_conn_new(uint16_t conn_handle, bt_addr_le_t *dst, uint8_t sec_level); -int bt_le_acl_conn_new_safe(uint16_t conn_handle, uint8_t role, uint8_t addr_type, - const uint8_t *addr, uint8_t sec_level); int bt_le_acl_conn_delete(uint16_t conn_handle); diff --git a/components/bt/esp_ble_iso/host/common/include/common/gatt.h b/components/bt/esp_ble_iso/host/common/include/common/gatt.h index b3456b66afd..d48aa3c2506 100644 --- a/components/bt/esp_ble_iso/host/common/include/common/gatt.h +++ b/components/bt/esp_ble_iso/host/common/include/common/gatt.h @@ -306,7 +306,7 @@ int bt_gatts_sub_changed(uint16_t conn_handle, uint8_t cur_indicate, uint8_t reason); -int bt_gattc_disc_start_safe(uint16_t conn_handle); +int bt_gattc_disc_start(uint16_t conn_handle); struct gattc_sub *bt_gattc_sub_find(struct bt_conn *conn); diff --git a/components/bt/esp_ble_iso/host/common/include/common/host.h b/components/bt/esp_ble_iso/host/common/include/common/host.h index bf83a07e1c2..d41a74c9cc4 100644 --- a/components/bt/esp_ble_iso/host/common/include/common/host.h +++ b/components/bt/esp_ble_iso/host/common/include/common/host.h @@ -42,6 +42,21 @@ void bt_le_host_lock(void); void bt_le_host_unlock(void); #endif /* HOST_LOCK_DEBUG */ +int bt_le_host_lock_timeout(void); + +/* For the app-facing api/ wrappers, which run on the application's own tasks: + * acquire, or bail out with the caller's failure value so a task holding a lock + * of its own never waits here indefinitely - that is the AB-BA edge that + * bt_le_host_lock() can only warn about. Safe only where nothing has happened + * yet, which is why every api/ wrapper takes the lock before it touches state. + * Silent by design: k_mutex_lock already logs LockFail with both task names. */ +#define BT_LE_HOST_LOCK_OR_RETURN(_err) \ + do { \ + if (bt_le_host_lock_timeout() != 0) { \ + return (_err); \ + } \ + } while (0) + int bt_le_host_init(void); int bt_le_host_check_idle(void); diff --git a/components/bt/esp_ble_iso/host/common/include/common/iso.h b/components/bt/esp_ble_iso/host/common/include/common/iso.h index 61a8fe5d041..ea45348a3f1 100644 --- a/components/bt/esp_ble_iso/host/common/include/common/iso.h +++ b/components/bt/esp_ble_iso/host/common/include/common/iso.h @@ -55,9 +55,9 @@ struct bt_iso_tx_cb_info { } pkt[2]; }; -int bt_le_iso_cb_register_safe(struct bt_le_iso_cb *cb); +int bt_le_iso_cb_register(struct bt_le_iso_cb *cb); -void bt_le_iso_cb_unregister_safe(struct bt_le_iso_cb *cb); +void bt_le_iso_cb_unregister(struct bt_le_iso_cb *cb); void bt_le_iso_handle_hci_event(uint8_t *data, size_t data_len); diff --git a/components/bt/esp_ble_iso/host/common/include/common/scan.h b/components/bt/esp_ble_iso/host/common/include/common/scan.h index e58b2e8ea97..dd8bf592f22 100644 --- a/components/bt/esp_ble_iso/host/common/include/common/scan.h +++ b/components/bt/esp_ble_iso/host/common/include/common/scan.h @@ -37,8 +37,6 @@ void bt_le_scan_recv_listener(uint16_t event_type, struct bt_le_per_adv_sync *bt_le_per_adv_sync_find(uint16_t sync_handle); -struct bt_le_per_adv_sync *bt_le_per_adv_sync_find_safe(uint16_t sync_handle); - int bt_le_per_adv_sync_new(uint16_t sync_handle, uint8_t sid, uint8_t phy, @@ -48,14 +46,6 @@ int bt_le_per_adv_sync_new(uint16_t sync_handle, uint16_t conn_handle, struct bt_le_per_adv_sync **out_sync); -int bt_le_per_adv_sync_new_safe(uint16_t sync_handle, - uint8_t sid, - uint8_t phy, - uint16_t interval, - uint8_t addr_type, - const uint8_t addr[6], - uint16_t conn_handle, - struct bt_le_per_adv_sync **out_sync); int bt_le_per_adv_sync_delete(uint16_t sync_handle); diff --git a/components/bt/esp_ble_iso/host/common/iso.c b/components/bt/esp_ble_iso/host/common/iso.c index f127e8cc3a1..960b579ef3a 100644 --- a/components/bt/esp_ble_iso/host/common/iso.c +++ b/components/bt/esp_ble_iso/host/common/iso.c @@ -96,10 +96,8 @@ extern int r_ble_hci_trans_hs_iso_tx(const uint8_t *data, uint16_t length, void extern void r_ble_ll_isoal_tx_comp_cb_set(void *cb); _IDF_ONLY -int bt_le_iso_cb_register_safe(struct bt_le_iso_cb *cb) +int bt_le_iso_cb_register(struct bt_le_iso_cb *cb) { - int err = 0; - LOG_DBG("IsoCbReg"); if (cb == NULL) { @@ -107,24 +105,18 @@ int bt_le_iso_cb_register_safe(struct bt_le_iso_cb *cb) return -EINVAL; } - bt_le_host_lock(); - if (sys_slist_find(&iso_cbs, &cb->node, NULL)) { LOG_WRN("IsoCbRegExist"); - err = -EEXIST; - goto end; + return -EEXIST; } sys_slist_append(&iso_cbs, &cb->node); -end: - bt_le_host_unlock(); - - return err; + return 0; } _IDF_ONLY -void bt_le_iso_cb_unregister_safe(struct bt_le_iso_cb *cb) +void bt_le_iso_cb_unregister(struct bt_le_iso_cb *cb) { LOG_DBG("IsoCbUnreg"); @@ -133,9 +125,7 @@ void bt_le_iso_cb_unregister_safe(struct bt_le_iso_cb *cb) return; } - bt_le_host_lock(); sys_slist_find_and_remove(&iso_cbs, &cb->node); - bt_le_host_unlock(); } #if CONFIG_BT_ISO_UNICAST @@ -896,7 +886,10 @@ int bt_le_iso_init(void) iso_features_set(); - err = bt_le_iso_cb_register_safe(&iso_cb); + bt_le_host_lock(); + err = bt_le_iso_cb_register(&iso_cb); + bt_le_host_unlock(); + if (err) { return err; } @@ -923,7 +916,9 @@ void bt_le_iso_deinit(void) iso_features_unset(); - bt_le_iso_cb_unregister_safe(&iso_cb); + bt_le_host_lock(); + bt_le_iso_cb_unregister(&iso_cb); + bt_le_host_unlock(); #if CONFIG_BT_ISO_TX r_ble_ll_isoal_tx_comp_cb_set(NULL); diff --git a/components/bt/esp_ble_iso/host/common/scan.c b/components/bt/esp_ble_iso/host/common/scan.c index cd04b1cc644..383d89646bc 100644 --- a/components/bt/esp_ble_iso/host/common/scan.c +++ b/components/bt/esp_ble_iso/host/common/scan.c @@ -252,17 +252,6 @@ struct bt_le_per_adv_sync *bt_le_per_adv_sync_find(uint16_t handle) return per_adv_sync; } -_IDF_ONLY -struct bt_le_per_adv_sync *bt_le_per_adv_sync_find_safe(uint16_t sync_handle) -{ - struct bt_le_per_adv_sync *per_adv_sync = NULL; - LOG_DBG("PaSyncFind[%u]", sync_handle); - bt_le_host_lock(); - per_adv_sync = bt_le_per_adv_sync_find(sync_handle); - bt_le_host_unlock(); - return per_adv_sync; -} - static struct bt_le_per_adv_sync *per_adv_sync_new(void) { struct bt_le_per_adv_sync *per_adv_sync = NULL; @@ -339,24 +328,6 @@ int bt_le_per_adv_sync_new(uint16_t sync_handle, return 0; } -_IDF_ONLY -int bt_le_per_adv_sync_new_safe(uint16_t sync_handle, - uint8_t sid, - uint8_t phy, - uint16_t interval, - uint8_t addr_type, - const uint8_t addr[6], - uint16_t conn_handle, - struct bt_le_per_adv_sync **out_sync) -{ - int err; - bt_le_host_lock(); - err = bt_le_per_adv_sync_new(sync_handle, sid, phy, interval, addr_type, - addr, conn_handle, out_sync); - bt_le_host_unlock(); - return err; -} - int bt_le_per_adv_sync_delete(uint16_t sync_handle) { struct bt_le_per_adv_sync *per_adv_sync = NULL; diff --git a/components/bt/esp_ble_iso/host/common/task.c b/components/bt/esp_ble_iso/host/common/task.c index 9e3dc1f44b5..22d4fb2fc10 100644 --- a/components/bt/esp_ble_iso/host/common/task.c +++ b/components/bt/esp_ble_iso/host/common/task.c @@ -76,6 +76,29 @@ static BT_ISO_CTRL_BSS_ATTR struct iso_dispatch_stats { uint32_t slow_count; } iso_stats[ISO_QUEUE_ITEM_TYPE_MAX]; +static inline bool iso_dispatch_is_timed(uint8_t type) +{ + return type != ISO_QUEUE_ITEM_TYPE_ISO_RX_DATA && + type != ISO_QUEUE_ITEM_TYPE_ISO_TX_COMP; +} + +static const char *iso_dispatch_type_name(uint8_t type) +{ + switch (type) { + case ISO_QUEUE_ITEM_TYPE_TIMER_EVENT: return "timer"; + case ISO_QUEUE_ITEM_TYPE_GAP_EVENT: return "gap"; + case ISO_QUEUE_ITEM_TYPE_EXT_ADV_REPORT: return "ext-adv"; + case ISO_QUEUE_ITEM_TYPE_PER_ADV_REPORT: return "per-adv"; + case ISO_QUEUE_ITEM_TYPE_GATT_EVENT: return "gatt"; +#if CONFIG_BT_OTS || CONFIG_BT_OTS_CLIENT + case ISO_QUEUE_ITEM_TYPE_L2CAP_EVENT: return "l2cap"; +#endif /* CONFIG_BT_OTS || CONFIG_BT_OTS_CLIENT */ + case ISO_QUEUE_ITEM_TYPE_ISO_HCI_EVENT: return "hci"; + case ISO_QUEUE_ITEM_TYPE_BIGINFO_ADV_REPORT: return "biginfo"; + default: return "other"; + } +} + static void iso_dispatch_record(uint8_t type, int64_t elapsed_us) { struct iso_dispatch_stats *st; @@ -91,7 +114,8 @@ static void iso_dispatch_record(uint8_t type, int64_t elapsed_us) } if (elapsed_us > ISO_DISPATCH_THRESHOLD_US) { st->slow_count++; - LOG_WRN("IsoCbSlow[%u][%lld]", type, (long long)elapsed_us); + LOG_WRN("IsoCbSlow[%s][%lldus]", + iso_dispatch_type_name(type), (long long)elapsed_us); } } @@ -161,10 +185,9 @@ static void iso_queues_drain(void) static void iso_dispatch_item(const struct iso_queue_item *item) { #if CONFIG_BT_ISO_DISPATCH_MONITOR + const bool timed = iso_dispatch_is_timed(item->type); int64_t elapsed_us; - int64_t start_us; - - start_us = esp_timer_get_time(); + int64_t start_us = timed ? esp_timer_get_time() : 0; #endif /* CONFIG_BT_ISO_DISPATCH_MONITOR */ switch (item->type) { @@ -201,8 +224,10 @@ static void iso_dispatch_item(const struct iso_queue_item *item) } #if CONFIG_BT_ISO_DISPATCH_MONITOR - elapsed_us = esp_timer_get_time() - start_us; - iso_dispatch_record(item->type, elapsed_us); + if (timed) { + elapsed_us = esp_timer_get_time() - start_us; + iso_dispatch_record(item->type, elapsed_us); + } #endif /* CONFIG_BT_ISO_DISPATCH_MONITOR */ } diff --git a/components/bt/esp_ble_iso/host/iso/iso.c b/components/bt/esp_ble_iso/host/iso/iso.c index 024351633f2..460ba37ae68 100644 --- a/components/bt/esp_ble_iso/host/iso/iso.c +++ b/components/bt/esp_ble_iso/host/iso/iso.c @@ -3391,186 +3391,6 @@ void bt_iso_reset(void) #endif /* CONFIG_BT_ISO_BROADCAST */ } -/************************ Thread-safe wrapper functions ************************/ - -int bt_iso_setup_data_path_safe(const struct bt_iso_chan *chan, uint8_t dir, - const struct bt_iso_chan_path *path) -{ - int err; - bt_le_host_lock(); - err = bt_iso_setup_data_path(chan, dir, path); - bt_le_host_unlock(); - return err; -} - -int bt_iso_remove_data_path_safe(const struct bt_iso_chan *chan, uint8_t dir) -{ - int err; - bt_le_host_lock(); - err = bt_iso_remove_data_path(chan, dir); - bt_le_host_unlock(); - return err; -} - -int bt_iso_chan_get_info_safe(const struct bt_iso_chan *chan, struct bt_iso_info *info) -{ - int err; - bt_le_host_lock(); - err = bt_iso_chan_get_info(chan, info); - bt_le_host_unlock(); - return err; -} - -#if CONFIG_BT_ISO_TX -int bt_iso_chan_send_safe(struct bt_iso_chan *chan, struct net_buf *buf, uint16_t seq_num) -{ - int err; - bt_le_host_lock(); - err = bt_iso_chan_send(chan, buf, seq_num); - bt_le_host_unlock(); - return err; -} - -int bt_iso_chan_send_ts_safe(struct bt_iso_chan *chan, struct net_buf *buf, uint16_t seq_num, - uint32_t ts) -{ - int err; - bt_le_host_lock(); - err = bt_iso_chan_send_ts(chan, buf, seq_num, ts); - bt_le_host_unlock(); - return err; -} - -int bt_iso_chan_get_tx_sync_safe(const struct bt_iso_chan *chan, struct bt_iso_tx_info *info) -{ - int err; - bt_le_host_lock(); - err = bt_iso_chan_get_tx_sync(chan, info); - bt_le_host_unlock(); - return err; -} -#endif /* CONFIG_BT_ISO_TX */ - -#if CONFIG_BT_ISO_UNICAST -int bt_iso_chan_disconnect_safe(struct bt_iso_chan *chan) -{ - int err; - bt_le_host_lock(); - err = bt_iso_chan_disconnect(chan); - bt_le_host_unlock(); - return err; -} - -#if CONFIG_BT_ISO_PERIPHERAL -int bt_iso_server_register_safe(struct bt_iso_server *server) -{ - int err; - bt_le_host_lock(); - err = bt_iso_server_register(server); - bt_le_host_unlock(); - return err; -} - -int bt_iso_server_unregister_safe(struct bt_iso_server *server) -{ - int err; - bt_le_host_lock(); - err = bt_iso_server_unregister(server); - bt_le_host_unlock(); - return err; -} -#endif /* CONFIG_BT_ISO_PERIPHERAL */ - -#if CONFIG_BT_ISO_CENTRAL -int bt_iso_cig_create_safe(const struct bt_iso_cig_param *param, struct bt_iso_cig **out_cig) -{ - int err; - bt_le_host_lock(); - err = bt_iso_cig_create(param, out_cig); - bt_le_host_unlock(); - return err; -} - -int bt_iso_cig_reconfigure_safe(struct bt_iso_cig *cig, const struct bt_iso_cig_param *param) -{ - int err; - bt_le_host_lock(); - err = bt_iso_cig_reconfigure(cig, param); - bt_le_host_unlock(); - return err; -} - -int bt_iso_cig_terminate_safe(struct bt_iso_cig *cig) -{ - int err; - bt_le_host_lock(); - err = bt_iso_cig_terminate(cig); - bt_le_host_unlock(); - return err; -} - -int bt_iso_chan_connect_safe(const struct bt_iso_connect_param *param, size_t count) -{ - int err; - bt_le_host_lock(); - err = bt_iso_chan_connect(param, count); - bt_le_host_unlock(); - return err; -} -#endif /* CONFIG_BT_ISO_CENTRAL */ -#endif /* CONFIG_BT_ISO_UNICAST */ - -#if CONFIG_BT_ISO_BROADCAST -#if CONFIG_BT_ISO_BROADCASTER -int bt_iso_big_register_cb_safe(struct bt_iso_big_cb *cb) -{ - int err; - bt_le_host_lock(); - err = bt_iso_big_register_cb(cb); - bt_le_host_unlock(); - return err; -} - -int bt_iso_big_create_safe(struct bt_le_ext_adv *padv, struct bt_iso_big_create_param *param, - struct bt_iso_big **out_big) -{ - int err; - bt_le_host_lock(); - err = bt_iso_big_create(padv, param, out_big); - bt_le_host_unlock(); - return err; -} -#endif /* CONFIG_BT_ISO_BROADCASTER */ - -int bt_iso_big_terminate_safe(struct bt_iso_big *big) -{ - int err; - bt_le_host_lock(); - err = bt_iso_big_terminate(big); - bt_le_host_unlock(); - return err; -} - -#if CONFIG_BT_ISO_SYNC_RECEIVER -int bt_iso_big_sync_safe(struct bt_le_per_adv_sync *sync, struct bt_iso_big_sync_param *param, - struct bt_iso_big **out_big) -{ - int err; - bt_le_host_lock(); - err = bt_iso_big_sync(sync, param, out_big); - bt_le_host_unlock(); - return err; -} -#endif /* CONFIG_BT_ISO_SYNC_RECEIVER */ -#endif /* CONFIG_BT_ISO_BROADCAST */ - -void bt_iso_reset_safe(void) -{ - bt_le_host_lock(); - bt_iso_reset(); - bt_le_host_unlock(); -} - void bt_le_iso_state_reset(void) { /* Clear the CIG/BIG pools, the registered server and the BIG callback list. diff --git a/components/bt/esp_ble_iso/host/utils/timer.c b/components/bt/esp_ble_iso/host/utils/timer.c index 61d4dfee826..a22601053c9 100644 --- a/components/bt/esp_ble_iso/host/utils/timer.c +++ b/components/bt/esp_ble_iso/host/utils/timer.c @@ -52,15 +52,6 @@ int k_work_submit(struct k_work *work) return 0; } -int k_work_submit_safe(struct k_work *work) -{ - int err; - bt_le_host_lock(); - err = k_work_submit(work); - bt_le_host_unlock(); - return err; -} - bool k_work_is_pending(struct k_work *work) { bool is_pending; diff --git a/components/bt/esp_ble_iso/include/zephyr/bluetooth/conn.h b/components/bt/esp_ble_iso/include/zephyr/bluetooth/conn.h index 02cb1d05049..bd81a2bfca9 100644 --- a/components/bt/esp_ble_iso/include/zephyr/bluetooth/conn.h +++ b/components/bt/esp_ble_iso/include/zephyr/bluetooth/conn.h @@ -365,7 +365,6 @@ struct bt_conn_cb { * @retval -EEXIST if @p cb was already registered. */ int bt_conn_cb_register(struct bt_conn_cb *cb); -int bt_conn_cb_register_safe(struct bt_conn_cb *cb); /** * @brief Unregister connection callbacks. @@ -379,7 +378,6 @@ int bt_conn_cb_register_safe(struct bt_conn_cb *cb); * @retval -ENOENT if @p cb was not registered */ int bt_conn_cb_unregister(struct bt_conn_cb *cb); -int bt_conn_cb_unregister_safe(struct bt_conn_cb *cb); /** * @brief Register a callback structure for connection events. diff --git a/components/bt/esp_ble_iso/include/zephyr/bluetooth/gatt.h b/components/bt/esp_ble_iso/include/zephyr/bluetooth/gatt.h index dddb44e6179..1958bb015b2 100644 --- a/components/bt/esp_ble_iso/include/zephyr/bluetooth/gatt.h +++ b/components/bt/esp_ble_iso/include/zephyr/bluetooth/gatt.h @@ -563,7 +563,6 @@ struct bt_gatt_cpf { * @return -EAGAIN if ``bt_init()`` has been called but ``settings_load()`` hasn't yet. */ int bt_gatt_service_register(struct bt_gatt_service *svc); -int bt_gatt_service_register_safe(struct bt_gatt_service *svc); /** @brief Unregister GATT service. * @@ -572,7 +571,6 @@ int bt_gatt_service_register_safe(struct bt_gatt_service *svc); * @return 0 in case of success or negative value in case of error. */ int bt_gatt_service_unregister(struct bt_gatt_service *svc); -int bt_gatt_service_unregister_safe(struct bt_gatt_service *svc); /** @brief to be used as return values for @ref bt_gatt_attr_func_t and @ref bt_gatt_read_func_t * type callbacks. diff --git a/components/bt/esp_ble_iso/include/zephyr/bluetooth/iso.h b/components/bt/esp_ble_iso/include/zephyr/bluetooth/iso.h index 04bf14e3dc1..594cd9b68f2 100644 --- a/components/bt/esp_ble_iso/include/zephyr/bluetooth/iso.h +++ b/components/bt/esp_ble_iso/include/zephyr/bluetooth/iso.h @@ -794,7 +794,7 @@ struct bt_iso_server { * * @return 0 in case of success or negative value in case of error. */ -int bt_iso_server_register_safe(struct bt_iso_server *server); +int bt_iso_server_register(struct bt_iso_server *server); /** * @brief Unregister ISO server. @@ -805,7 +805,7 @@ int bt_iso_server_register_safe(struct bt_iso_server *server); * * @return 0 in case of success or negative value in case of error. */ -int bt_iso_server_unregister_safe(struct bt_iso_server *server); +int bt_iso_server_unregister(struct bt_iso_server *server); /** * @brief Creates a CIG as a central @@ -821,7 +821,7 @@ int bt_iso_server_unregister_safe(struct bt_iso_server *server); * * @return 0 in case of success or negative value in case of error. */ -int bt_iso_cig_create_safe(const struct bt_iso_cig_param *param, struct bt_iso_cig **out_cig); +int bt_iso_cig_create(const struct bt_iso_cig_param *param, struct bt_iso_cig **out_cig); /** * @brief Reconfigure a CIG as a central @@ -843,7 +843,7 @@ int bt_iso_cig_create_safe(const struct bt_iso_cig_param *param, struct bt_iso_c * * @return 0 in case of success or negative value in case of error. */ -int bt_iso_cig_reconfigure_safe(struct bt_iso_cig *cig, const struct bt_iso_cig_param *param); +int bt_iso_cig_reconfigure(struct bt_iso_cig *cig, const struct bt_iso_cig_param *param); /** * @brief Terminates a CIG as a central @@ -854,7 +854,7 @@ int bt_iso_cig_reconfigure_safe(struct bt_iso_cig *cig, const struct bt_iso_cig_ * * @return 0 in case of success or negative value in case of error. */ -int bt_iso_cig_terminate_safe(struct bt_iso_cig *cig); +int bt_iso_cig_terminate(struct bt_iso_cig *cig); /** * @brief Connect ISO channels on ACL connections @@ -894,7 +894,6 @@ int bt_iso_cig_terminate_safe(struct bt_iso_cig *cig); * connected. */ int bt_iso_chan_connect(const struct bt_iso_connect_param *param, size_t count); -int bt_iso_chan_connect_safe(const struct bt_iso_connect_param *param, size_t count); /** * @brief Disconnect connected ISO channel @@ -915,7 +914,7 @@ int bt_iso_chan_connect_safe(const struct bt_iso_connect_param *param, size_t co * * @return 0 in case of success or negative value in case of error. */ -int bt_iso_chan_disconnect_safe(struct bt_iso_chan *chan); +int bt_iso_chan_disconnect(struct bt_iso_chan *chan); /** * @brief Send data to ISO channel without timestamp @@ -936,7 +935,7 @@ int bt_iso_chan_disconnect_safe(struct bt_iso_chan *chan); * * @return Number of octets sent in case of success or negative value in case of error. */ -int bt_iso_chan_send_safe(struct bt_iso_chan *chan, struct net_buf *buf, uint16_t seq_num); +int bt_iso_chan_send(struct bt_iso_chan *chan, struct net_buf *buf, uint16_t seq_num); /** * @brief Send data to ISO channel with timestamp @@ -960,8 +959,8 @@ int bt_iso_chan_send_safe(struct bt_iso_chan *chan, struct net_buf *buf, uint16_ * * @return Number of octets sent in case of success or negative value in case of error. */ -int bt_iso_chan_send_ts_safe(struct bt_iso_chan *chan, struct net_buf *buf, uint16_t seq_num, - uint32_t ts); +int bt_iso_chan_send_ts(struct bt_iso_chan *chan, struct net_buf *buf, uint16_t seq_num, + uint32_t ts); /** * @brief Sets up the ISO data path for a ISO channel @@ -984,8 +983,8 @@ int bt_iso_chan_send_ts_safe(struct bt_iso_chan *chan, struct net_buf *buf, uint * @retval -EACCES The controller rejected the request as disallowed * @retval -ENOEXEC Unexpected error occurred */ -int bt_iso_setup_data_path_safe(const struct bt_iso_chan *chan, uint8_t dir, - const struct bt_iso_chan_path *path); +int bt_iso_setup_data_path(const struct bt_iso_chan *chan, uint8_t dir, + const struct bt_iso_chan_path *path); /** * @brief Removes the ISO data path for a ISO channel @@ -1025,7 +1024,7 @@ int bt_iso_setup_data_path_safe(const struct bt_iso_chan *chan, uint8_t dir, * @retval -EACCES The controller rejected the request as disallowed * @retval -ENOEXEC Unexpected error occurred */ -int bt_iso_remove_data_path_safe(const struct bt_iso_chan *chan, uint8_t dir); +int bt_iso_remove_data_path(const struct bt_iso_chan *chan, uint8_t dir); /** @brief ISO Unicast TX Info Structure */ struct bt_iso_unicast_tx_info { @@ -1202,7 +1201,7 @@ struct bt_iso_info { * * @return Zero on success or (negative) error code on failure. */ -int bt_iso_chan_get_info_safe(const struct bt_iso_chan *chan, struct bt_iso_info *info); +int bt_iso_chan_get_info(const struct bt_iso_chan *chan, struct bt_iso_info *info); /** * @brief Get ISO transmission timing info @@ -1219,7 +1218,7 @@ int bt_iso_chan_get_info_safe(const struct bt_iso_chan *chan, struct bt_iso_info * * @return Zero on success or (negative) error code on failure. */ -int bt_iso_chan_get_tx_sync_safe(const struct bt_iso_chan *chan, struct bt_iso_tx_info *info); +int bt_iso_chan_get_tx_sync(const struct bt_iso_chan *chan, struct bt_iso_tx_info *info); /** * @brief Struct to hold the Broadcast Isochronous Group callbacks @@ -1255,7 +1254,7 @@ struct bt_iso_big_cb { * @retval -EINVAL if @p cb is NULL * @retval -EEXIST if @p cb is already registered */ -int bt_iso_big_register_cb_safe(struct bt_iso_big_cb *cb); +int bt_iso_big_register_cb(struct bt_iso_big_cb *cb); /** * @brief Creates a BIG as a broadcaster @@ -1270,8 +1269,6 @@ int bt_iso_big_register_cb_safe(struct bt_iso_big_cb *cb); */ int bt_iso_big_create(struct bt_le_ext_adv *padv, struct bt_iso_big_create_param *param, struct bt_iso_big **out_big); -int bt_iso_big_create_safe(struct bt_le_ext_adv *padv, struct bt_iso_big_create_param *param, - struct bt_iso_big **out_big); /** * @brief Terminates a BIG as a broadcaster or receiver @@ -1283,7 +1280,7 @@ int bt_iso_big_create_safe(struct bt_le_ext_adv *padv, struct bt_iso_big_create_ * * @return 0 in case of success or negative value in case of error. */ -int bt_iso_big_terminate_safe(struct bt_iso_big *big); +int bt_iso_big_terminate(struct bt_iso_big *big); /** * @brief Creates a BIG as a receiver @@ -1296,8 +1293,6 @@ int bt_iso_big_terminate_safe(struct bt_iso_big *big); */ int bt_iso_big_sync(struct bt_le_per_adv_sync *sync, struct bt_iso_big_sync_param *param, struct bt_iso_big **out_big); -int bt_iso_big_sync_safe(struct bt_le_per_adv_sync *sync, struct bt_iso_big_sync_param *param, - struct bt_iso_big **out_big); #ifdef __cplusplus } diff --git a/examples/bluetooth/esp_ble_audio/tmap/central/main/ccp_server.c b/examples/bluetooth/esp_ble_audio/tmap/central/main/ccp_server.c index c3174caa1f9..f2de05a2024 100644 --- a/examples/bluetooth/esp_ble_audio/tmap/central/main/ccp_server.c +++ b/examples/bluetooth/esp_ble_audio/tmap/central/main/ccp_server.c @@ -47,7 +47,11 @@ int ccp_server_init(void) uint8_t bearer_index; int err; - esp_ble_audio_tbs_register_cb(&tbs_cbs); + err = esp_ble_audio_tbs_register_cb(&tbs_cbs); + if (err) { + ESP_LOGE(TAG, "Failed to register tbs callbacks (err %d)", err); + return err; + } err = esp_ble_audio_tbs_register_bearer(>bs_param, &bearer_index); if (err) { diff --git a/examples/bluetooth/esp_ble_audio/tmap/central/main/vcp_vol_ctlr.c b/examples/bluetooth/esp_ble_audio/tmap/central/main/vcp_vol_ctlr.c index 694cf8e1d31..225c7ee8f12 100644 --- a/examples/bluetooth/esp_ble_audio/tmap/central/main/vcp_vol_ctlr.c +++ b/examples/bluetooth/esp_ble_audio/tmap/central/main/vcp_vol_ctlr.c @@ -39,9 +39,9 @@ static bool streams_started; * borrowing one of the stack's. Not an esp_timer callback either: that task is * shared with the BLE stack's own timers — the ISO TX schedulers post from it * every SDU interval — and it is serial, so a GATT write chain dispatched there - * would sit in front of them. The audio APIs take the host lock themselves - * (esp_ble_audio_cap_commander_* -> bt_cap_commander_*_safe -> k_lock), which is - * what makes calling them from here safe. */ + * would sit in front of them. The audio APIs take the host lock themselves, and + * with a bounded wait that returns ESP_ERR_TIMEOUT rather than blocking this + * task indefinitely, which is what makes calling them from here safe. */ #define VOLUME_PERIOD_MS (5 * 60 * 1000) /* 5 minutes */ #define VOLUME_TASK_STACK 3072 #define VOLUME_TASK_PRIO 5