diff --git a/components/bt/bluedroid/api/include/api/esp_a2dp_api.h b/components/bt/bluedroid/api/include/api/esp_a2dp_api.h index 3b002a405f..748c58e903 100644 --- a/components/bt/bluedroid/api/include/api/esp_a2dp_api.h +++ b/components/bt/bluedroid/api/include/api/esp_a2dp_api.h @@ -89,6 +89,7 @@ typedef enum { ESP_A2D_AUDIO_STATE_EVT, /*!< audio stream transmission state changed event */ ESP_A2D_AUDIO_CFG_EVT, /*!< audio codec is configured, only used for A2DP SINK */ ESP_A2D_MEDIA_CTRL_ACK_EVT, /*!< acknowledge event in response to media control commands */ + ESP_A2D_PROF_STATE_EVT, /*!< indicate a2dp deinit complete */ } esp_a2d_cb_event_t; /// A2DP state callback parameters @@ -125,6 +126,13 @@ typedef union { esp_a2d_media_ctrl_t cmd; /*!< media control commands to acknowledge */ esp_a2d_media_ctrl_ack_t status; /*!< acknowledgement to media control commands */ } media_ctrl_stat; /*!< status in acknowledgement to media control commands */ + + /** + * @brief ESP_A2D_PROF_STATE_EVT + */ + struct a2d_prof_stat_param { + int init_state; /*!< a2dp profile state param */ + } a2d_prof_stat; /*!< status to indicate a2d prof init or deinit */ } esp_a2d_cb_param_t; /** diff --git a/components/bt/bluedroid/btc/profile/std/a2dp/btc_av.c b/components/bt/bluedroid/btc/profile/std/a2dp/btc_av.c index e61126dff2..d15816061f 100644 --- a/components/bt/bluedroid/btc/profile/std/a2dp/btc_av.c +++ b/components/bt/bluedroid/btc/profile/std/a2dp/btc_av.c @@ -989,7 +989,10 @@ static bt_status_t btc_av_init(int service_id) } btc_a2dp_on_init(); - + esp_a2d_cb_param_t param; + memset(¶m, 0, sizeof(esp_a2d_cb_param_t)); + param.a2d_prof_stat.init_state = 1; + btc_a2d_cb_to_app(ESP_A2D_PROF_STATE_EVT, ¶m); return BT_STATUS_SUCCESS; } @@ -1056,6 +1059,11 @@ static void clean_up(int service_id) } else { BTC_TRACE_WARNING("AV sm handle already free\n"); } + + esp_a2d_cb_param_t param; + memset(¶m, 0, sizeof(esp_a2d_cb_param_t)); + param.a2d_prof_stat.init_state = 0; + btc_a2d_cb_to_app(ESP_A2D_PROF_STATE_EVT, ¶m); } /*******************************************************************************