From e3e958c9b182ca099da4b18e0b3d514c00a91df9 Mon Sep 17 00:00:00 2001 From: yangfeng Date: Mon, 1 Dec 2025 17:29:51 +0800 Subject: [PATCH] docs(bt): update Classic Bluetooth api reference of A2DP --- .../bluedroid/api/include/api/esp_a2dp_api.h | 39 ++++++------------- docs/en/api-reference/bluetooth/esp_a2dp.rst | 9 ++++- 2 files changed, 18 insertions(+), 30 deletions(-) diff --git a/components/bt/host/bluedroid/api/include/api/esp_a2dp_api.h b/components/bt/host/bluedroid/api/include/api/esp_a2dp_api.h index 514e533f648..254eccf69f5 100644 --- a/components/bt/host/bluedroid/api/include/api/esp_a2dp_api.h +++ b/components/bt/host/bluedroid/api/include/api/esp_a2dp_api.h @@ -14,31 +14,27 @@ extern "C" { #endif -/** - * @brief Media codec types supported by A2DP. - */ +/* Media codec types supported by A2DP. */ #define ESP_A2D_MCT_SBC (0) /*!< SBC */ #define ESP_A2D_MCT_M12 (0x01) /*!< MPEG-1, 2 Audio */ #define ESP_A2D_MCT_M24 (0x02) /*!< MPEG-2, 4 AAC */ #define ESP_A2D_MCT_ATRAC (0x04) /*!< ATRAC family */ #define ESP_A2D_MCT_NON_A2DP (0xff) /*!< NON-A2DP */ -typedef uint8_t esp_a2d_mct_t; +typedef uint8_t esp_a2d_mct_t; /*!< Media codec type of A2DP */ -/** - * @brief Protocol service capabilities. This value is a mask. - */ +/* Protocol service capabilities. This value is a mask. */ #define ESP_A2D_PSC_DELAY_RPT (1<<0) /*!< Delay Report */ -typedef uint16_t esp_a2d_psc_t; +typedef uint16_t esp_a2d_psc_t; /*!< Protocol service capabilities type */ /** * @brief A2DP media codec capabilities union */ typedef struct { esp_a2d_mct_t type; /*!< A2DP media codec type */ -#define ESP_A2D_CIE_LEN_SBC (4) -#define ESP_A2D_CIE_LEN_M12 (4) -#define ESP_A2D_CIE_LEN_M24 (6) -#define ESP_A2D_CIE_LEN_ATRAC (7) +#define ESP_A2D_CIE_LEN_SBC (4) /*!< SBC cie length */ +#define ESP_A2D_CIE_LEN_M12 (4) /*!< MPEG-1,2 cie length */ +#define ESP_A2D_CIE_LEN_M24 (6) /*!< MPEG-2,4 AAC cie length */ +#define ESP_A2D_CIE_LEN_ATRAC (7) /*!< ATRAC family cie length */ union { uint8_t sbc[ESP_A2D_CIE_LEN_SBC]; /*!< SBC codec capabilities */ uint8_t m12[ESP_A2D_CIE_LEN_M12]; /*!< MPEG-1,2 audio codec capabilities */ @@ -100,7 +96,7 @@ typedef enum { */ typedef enum { ESP_A2D_DEINIT_SUCCESS = 0, /*!< A2DP profile deinit successful event */ - ESP_A2D_INIT_SUCCESS /*!< A2DP profile deinit successful event */ + ESP_A2D_INIT_SUCCESS /*!< A2DP profile init successful event */ } esp_a2d_init_state_t; /** @@ -213,9 +209,9 @@ typedef union { /** * @brief A2DP profile callback function type * - * @param event : Event type + * @param[in] event : Event type * - * @param param : Pointer to callback parameter + * @param[in] param : Pointer to callback parameter */ typedef void (* esp_a2d_cb_t)(esp_a2d_cb_event_t event, esp_a2d_cb_param_t *param); @@ -257,7 +253,6 @@ typedef int32_t (* esp_a2d_source_data_cb_t)(uint8_t *buf, int32_t len); */ esp_err_t esp_a2d_register_callback(esp_a2d_cb_t callback); - /** * @brief Register A2DP sink data output function; For now the output is PCM data stream decoded * from SBC format. This function should be called only after esp_bluedroid_enable() @@ -274,7 +269,6 @@ esp_err_t esp_a2d_register_callback(esp_a2d_cb_t callback); */ esp_err_t esp_a2d_sink_register_data_callback(esp_a2d_sink_data_cb_t callback); - /** * * @brief Initialize the bluetooth A2DP sink module. This function should be called @@ -291,7 +285,6 @@ esp_err_t esp_a2d_sink_register_data_callback(esp_a2d_sink_data_cb_t callback); */ esp_err_t esp_a2d_sink_init(void); - /** * * @brief De-initialize for A2DP sink module. This function @@ -306,7 +299,6 @@ esp_err_t esp_a2d_sink_init(void); */ esp_err_t esp_a2d_sink_deinit(void); - /** * * @brief Connect to remote bluetooth A2DP source device. This API must be called after @@ -322,7 +314,6 @@ esp_err_t esp_a2d_sink_deinit(void); */ esp_err_t esp_a2d_sink_connect(esp_bd_addr_t remote_bda); - /** * * @brief Disconnect from the remote A2DP source device. This API must be called after @@ -368,7 +359,6 @@ esp_err_t esp_a2d_sink_set_delay_value(uint16_t delay_value); */ esp_err_t esp_a2d_sink_get_delay_value(void); - /** * * @brief Media control commands. This API can be used for both A2DP sink and source @@ -384,7 +374,6 @@ esp_err_t esp_a2d_sink_get_delay_value(void); */ esp_err_t esp_a2d_media_ctrl(esp_a2d_media_ctrl_t ctrl); - /** * @brief This function is used to get the status of A2DP * @@ -396,7 +385,6 @@ esp_err_t esp_a2d_media_ctrl(esp_a2d_media_ctrl_t ctrl); */ esp_err_t esp_a2d_get_profile_status(esp_a2d_profile_status_t *profile_status); - /** * * @brief Initialize the bluetooth A2DP source module. A2DP can work independently. @@ -413,7 +401,6 @@ esp_err_t esp_a2d_get_profile_status(esp_a2d_profile_status_t *profile_status); */ esp_err_t esp_a2d_source_init(void); - /** * * @brief De-initialize for A2DP source module. This function @@ -428,7 +415,6 @@ esp_err_t esp_a2d_source_init(void); */ esp_err_t esp_a2d_source_deinit(void); - /** * @brief Register A2DP source data input function. For now, the input should be PCM data stream. * This function should be called only after esp_bluedroid_enable() completes @@ -445,7 +431,6 @@ esp_err_t esp_a2d_source_deinit(void); */ esp_err_t esp_a2d_source_register_data_callback(esp_a2d_source_data_cb_t callback); - /** * * @brief Connect to remote A2DP sink device. This API must be called @@ -461,7 +446,6 @@ esp_err_t esp_a2d_source_register_data_callback(esp_a2d_source_data_cb_t callbac */ esp_err_t esp_a2d_source_connect(esp_bd_addr_t remote_bda); - /** * * @brief Disconnect from the remote A2DP sink device. This API must be called @@ -480,5 +464,4 @@ esp_err_t esp_a2d_source_disconnect(esp_bd_addr_t remote_bda); } #endif - #endif /* __ESP_A2DP_API_H__ */ diff --git a/docs/en/api-reference/bluetooth/esp_a2dp.rst b/docs/en/api-reference/bluetooth/esp_a2dp.rst index 0bf8f6034cc..09d6d8f20ce 100644 --- a/docs/en/api-reference/bluetooth/esp_a2dp.rst +++ b/docs/en/api-reference/bluetooth/esp_a2dp.rst @@ -1,8 +1,13 @@ Bluetooth® A2DP API =================== -Application Example -------------------- +Overview +-------- + +A2DP (Advanced Audio Distribution Profile) enables high-quality audio streaming from one device to another over Bluetooth. It is primarily used for streaming audio from source devices such as smartphones, computers, and media players to sink devices such as Bluetooth speakers, headphones, and car audio systems. Users can use the A2DP APIs to transmit or receive audio streams. + +Application Examples +-------------------- Check :example:`bluetooth/bluedroid/classic_bt` folder in ESP-IDF examples, which contains the following application: