]> granicus.if.org Git - esp-idf/commitdiff
component/bt: A2DP APIs refactor
authorwangmengyang <wangmengyang@espressif.com>
Thu, 1 Dec 2016 11:48:51 +0000 (19:48 +0800)
committerwangmengyang <wangmengyang@espressif.com>
Thu, 1 Dec 2016 11:48:51 +0000 (19:48 +0800)
1. change A2DP typedef and API prefixes
2. modify function audio configuration callback

examples/09_a2dp/components/bluedroid_demos/app_project/SampleBtSdp.c
examples/09_a2dp/components/bluedroid_demos/btif/btif_avk.c
examples/09_a2dp/components/bluedroid_demos/include/esp_a2dp_api.h

index 56645c596b59e25bdabdd60520996c3362b0546f..fd20efbc8e66a8a75c331ccb8dbf4a7a1db94784 100644 (file)
@@ -32,7 +32,7 @@ typedef union {
 static void bt_stack_evt(tBT_APP_EVT event, tBT_APP_EVT_DATA *p_data);
 static void bt_stack_state_changed(bt_state_t state);
 
-static bt_bdaddr_t peer_bd_addr = {{0x00, 0x1b, 0xdc, 0x08, 0x0f, 0xe7}};
+// static bt_bdaddr_t peer_bd_addr = {{0x00, 0x1b, 0xdc, 0x08, 0x0f, 0xe7}};
 
 static bt_callbacks_t bt_callbacks = {
     bt_stack_state_changed
@@ -40,14 +40,14 @@ static bt_callbacks_t bt_callbacks = {
 
 osi_alarm_t *app_alarm = NULL;
 
-static void btav_conn_state_cb(esp_a2dp_connection_state_t state,
+static void btav_conn_state_cb(esp_a2d_connection_state_t state,
                                esp_bd_addr_t *bd_addr)
 {
     LOG_ERROR("===esp_a2dp_conn_state_cb %d ===\n", state);
     (void) bd_addr;
 }
 
-static void btav_audio_state_cb(esp_a2dp_audio_state_t state, esp_bd_addr_t *bd_addr)
+static void btav_audio_state_cb(esp_a2d_audio_state_t state, esp_bd_addr_t *bd_addr)
 {
     LOG_ERROR("===esp_a2dp_audio_state_cb %d ===\n", state);
     (void) bd_addr;
@@ -59,7 +59,7 @@ static void btav_audio_cfg_cb(esp_bd_addr_t *bd_addr, uint32_t sample_rate, uint
     (void) bd_addr;
 }
 
-static esp_a2dp_callbacks_t btav_cbs = {
+static esp_a2d_callbacks_t btav_cbs = {
     btav_conn_state_cb,
     btav_audio_state_cb,
     btav_audio_cfg_cb
@@ -92,7 +92,7 @@ static void bt_app_stack_evt(UINT16 event, char *p_param)
         btav_set_device_class();
         BTA_DmSetDeviceName(dev_name);
         esp_bt_gap_set_scan_mode(BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE);
-       esp_a2dp_sink_init(&btav_cbs);
+       esp_a2d_sink_init(&btav_cbs);
         // btif_av_get_sink_interface()->init(&btav_cbs);
 
         // app_alarm = osi_alarm_new("app_alarm", bt_sdp_add_record_to, NULL, 1000, false);
index 9c31838736bab022a5ab7c562c9f1b504d49024f..ed8b35e2e8b01edb9c8e4e59731926bcfa2dcefb 100644 (file)
@@ -91,15 +91,10 @@ typedef struct {
     uint16_t uuid;
 } btif_av_connect_req_t;
 
-typedef struct {
-    int sample_rate;
-    int channel_count;
-} btif_av_sink_config_req_t;
-
 /*****************************************************************************
 **  Static variables
 ******************************************************************************/
-static esp_a2dp_callbacks_t *bt_av_sink_callbacks = NULL;
+static esp_a2d_callbacks_t *bt_av_sink_callbacks = NULL;
 
 static btif_av_cb_t btif_av_cb = {0};
 // static TIMER_LIST_ENT tle_av_open_on_rc;
@@ -207,7 +202,7 @@ const char *dump_av_sm_event_name(btif_av_sm_event_t event)
 /*****************************************************************************
 **  Static functions
 ******************************************************************************/
-static void btif_report_connection_state(esp_a2dp_connection_state_t state, bt_bdaddr_t *bd_addr)
+static void btif_report_connection_state(esp_a2d_connection_state_t state, bt_bdaddr_t *bd_addr)
 {
     if (bt_av_sink_callbacks != NULL) {
         esp_bd_addr_t remote_bda;
@@ -220,7 +215,7 @@ static void btif_report_connection_state(esp_a2dp_connection_state_t state, bt_b
     }
 }
 
-static void btif_report_audio_state(esp_a2dp_audio_state_t state, bt_bdaddr_t *bd_addr)
+static void btif_report_audio_state(esp_a2d_audio_state_t state, bt_bdaddr_t *bd_addr)
 {
     if (bt_av_sink_callbacks != NULL) {
         esp_bd_addr_t remote_bda;
@@ -320,7 +315,7 @@ static BOOLEAN btif_av_state_opening_handler(btif_sm_event_t event, void *p_data
     switch (event) {
     case BTIF_SM_ENTER_EVT:
         /* inform the application that we are entering connecting state */
-        btif_report_connection_state(ESP_A2DP_CONNECTION_STATE_CONNECTING, &(btif_av_cb.peer_bda));
+        btif_report_connection_state(ESP_A2D_CONNECTION_STATE_CONNECTING, &(btif_av_cb.peer_bda));
         break;
 
     case BTIF_SM_EXIT_EVT:
@@ -328,19 +323,19 @@ static BOOLEAN btif_av_state_opening_handler(btif_sm_event_t event, void *p_data
 
     case BTA_AV_REJECT_EVT:
         BTIF_TRACE_DEBUG(" Received  BTA_AV_REJECT_EVT \n");
-        btif_report_connection_state(ESP_A2DP_CONNECTION_STATE_DISCONNECTED, &(btif_av_cb.peer_bda));
+        btif_report_connection_state(ESP_A2D_CONNECTION_STATE_DISCONNECTED, &(btif_av_cb.peer_bda));
         btif_sm_change_state(btif_av_cb.sm_handle, BTIF_AV_STATE_IDLE);
         break;
 
     case BTA_AV_OPEN_EVT: {
         tBTA_AV *p_bta_data = (tBTA_AV *)p_data;
-        esp_a2dp_connection_state_t state;
+        esp_a2d_connection_state_t state;
         btif_sm_state_t av_state;
         BTIF_TRACE_DEBUG("status:%d, edr 0x%x\n", p_bta_data->open.status,
                          p_bta_data->open.edr);
 
         if (p_bta_data->open.status == BTA_AV_SUCCESS) {
-            state = ESP_A2DP_CONNECTION_STATE_CONNECTED;
+            state = ESP_A2D_CONNECTION_STATE_CONNECTED;
             av_state = BTIF_AV_STATE_OPENED;
             btif_av_cb.edr = p_bta_data->open.edr;
 
@@ -349,7 +344,7 @@ static BOOLEAN btif_av_state_opening_handler(btif_sm_event_t event, void *p_data
         } else {
             BTIF_TRACE_WARNING("BTA_AV_OPEN_EVT::FAILED status: %d\n",
                                p_bta_data->open.status );
-            state = ESP_A2DP_CONNECTION_STATE_DISCONNECTED;
+            state = ESP_A2D_CONNECTION_STATE_DISCONNECTED;
             av_state  = BTIF_AV_STATE_IDLE;
         }
 
@@ -373,17 +368,14 @@ static BOOLEAN btif_av_state_opening_handler(btif_sm_event_t event, void *p_data
     } break;
 
     case BTIF_AV_SINK_CONFIG_REQ_EVT: {
-        btif_av_sink_config_req_t req;
+        esp_a2d_mcc_t mcc;
         // copy to avoid alignment problems
-        memcpy(&req, p_data, sizeof(req));
-
-        BTIF_TRACE_WARNING("BTIF_AV_SINK_CONFIG_REQ_EVT %d %d\n", req.sample_rate,
-                           req.channel_count);
+        memcpy(&mcc, p_data, sizeof(mcc));
+        BTIF_TRACE_DEBUG("BTIF_AV_SINK_CONFIG_REQ_EVT SBC 0x%x %x %x %x\n", mcc.cie.sbc.oct[0], mcc.cie.sbc.oct[1], mcc.cie.sbc.oct[2], mcc.cie.sbc.oct[3]);
         if (btif_av_cb.peer_sep == AVDT_TSEP_SRC && bt_av_sink_callbacks != NULL) {
             esp_bd_addr_t remote_bda;
             memcpy(&remote_bda, &btif_av_cb.peer_bda, sizeof(esp_bd_addr_t));
-            HAL_CBACK(bt_av_sink_callbacks, audio_config_cb, &remote_bda,
-                      req.sample_rate, req.channel_count);
+            HAL_CBACK(bt_av_sink_callbacks, audio_config_cb, &remote_bda, &mcc);
         }
     } break;
 
@@ -396,7 +388,7 @@ static BOOLEAN btif_av_state_opening_handler(btif_sm_event_t event, void *p_data
             break;
         } else {
             BTIF_TRACE_DEBUG("%s: Moved from idle by Incoming Connection request\n", __func__);
-            btif_report_connection_state(ESP_A2DP_CONNECTION_STATE_DISCONNECTED, (bt_bdaddr_t *)p_data);
+            btif_report_connection_state(ESP_A2D_CONNECTION_STATE_DISCONNECTED, (bt_bdaddr_t *)p_data);
             btif_queue_advance();
             break;
         }
@@ -476,7 +468,7 @@ static BOOLEAN btif_av_state_closing_handler(btif_sm_event_t event, void *p_data
     case BTA_AV_CLOSE_EVT:
 
         /* inform the application that we are disconnecting */
-        btif_report_connection_state(ESP_A2DP_CONNECTION_STATE_DISCONNECTED, &(btif_av_cb.peer_bda));
+        btif_report_connection_state(ESP_A2D_CONNECTION_STATE_DISCONNECTED, &(btif_av_cb.peer_bda));
 
         btif_sm_change_state(btif_av_cb.sm_handle, BTIF_AV_STATE_IDLE);
         break;
@@ -594,7 +586,7 @@ static BOOLEAN btif_av_state_opened_handler(btif_sm_event_t event, void *p_data)
         BTA_AvClose(btif_av_cb.bta_handle);
 
         /* inform the application that we are disconnecting */
-        btif_report_connection_state(ESP_A2DP_CONNECTION_STATE_DISCONNECTING, &(btif_av_cb.peer_bda));
+        btif_report_connection_state(ESP_A2D_CONNECTION_STATE_DISCONNECTING, &(btif_av_cb.peer_bda));
         break;
 
     case BTA_AV_CLOSE_EVT:
@@ -602,7 +594,7 @@ static BOOLEAN btif_av_state_opened_handler(btif_sm_event_t event, void *p_data)
         btif_a2dp_on_stopped(NULL);
 
         /* inform the application that we are disconnected */
-        btif_report_connection_state(ESP_A2DP_CONNECTION_STATE_DISCONNECTED, &(btif_av_cb.peer_bda));
+        btif_report_connection_state(ESP_A2D_CONNECTION_STATE_DISCONNECTED, &(btif_av_cb.peer_bda));
 
         /* change state to idle, send acknowledgement if start is pending */
         if (btif_av_cb.flags & BTIF_AV_FLAG_PENDING_START) {
@@ -629,7 +621,7 @@ static BOOLEAN btif_av_state_opened_handler(btif_sm_event_t event, void *p_data)
             BTIF_TRACE_DEBUG("%s: Ignore BTIF_AV_CONNECT_REQ_EVT for same device\n", __func__);
         } else {
             BTIF_TRACE_DEBUG("%s: Moved to opened by Other Incoming Conn req\n", __func__);
-            btif_report_connection_state(ESP_A2DP_CONNECTION_STATE_DISCONNECTED,
+            btif_report_connection_state(ESP_A2D_CONNECTION_STATE_DISCONNECTED,
                                          (bt_bdaddr_t *)p_data);
         }
         btif_queue_advance();
@@ -669,7 +661,7 @@ static BOOLEAN btif_av_state_started_handler(btif_sm_event_t event, void *p_data
         /* we are again in started state, clear any remote suspend flags */
         btif_av_cb.flags &= ~BTIF_AV_FLAG_REMOTE_SUSPEND;
 
-        btif_report_audio_state(ESP_A2DP_AUDIO_STATE_STARTED, &(btif_av_cb.peer_bda));
+        btif_report_audio_state(ESP_A2D_AUDIO_STATE_STARTED, &(btif_av_cb.peer_bda));
 
         /* increase the a2dp consumer task priority temporarily when start
         ** audio playing, to avoid overflow the audio packet queue. */
@@ -723,7 +715,7 @@ static BOOLEAN btif_av_state_started_handler(btif_sm_event_t event, void *p_data
         BTA_AvClose(btif_av_cb.bta_handle);
 
         /* inform the application that we are disconnecting */
-        btif_report_connection_state(ESP_A2DP_CONNECTION_STATE_DISCONNECTING, &(btif_av_cb.peer_bda));
+        btif_report_connection_state(ESP_A2D_CONNECTION_STATE_DISCONNECTING, &(btif_av_cb.peer_bda));
 
         /* wait in closing state until fully closed */
         btif_sm_change_state(btif_av_cb.sm_handle, BTIF_AV_STATE_CLOSING);
@@ -759,9 +751,9 @@ static BOOLEAN btif_av_state_started_handler(btif_sm_event_t event, void *p_data
                 btif_av_cb.flags |= BTIF_AV_FLAG_REMOTE_SUSPEND;
             }
 
-            btif_report_audio_state(ESP_A2DP_AUDIO_STATE_REMOTE_SUSPEND, &(btif_av_cb.peer_bda));
+            btif_report_audio_state(ESP_A2D_AUDIO_STATE_REMOTE_SUSPEND, &(btif_av_cb.peer_bda));
         } else {
-            btif_report_audio_state(ESP_A2DP_AUDIO_STATE_STOPPED, &(btif_av_cb.peer_bda));
+            btif_report_audio_state(ESP_A2D_AUDIO_STATE_STOPPED, &(btif_av_cb.peer_bda));
         }
 
         btif_sm_change_state(btif_av_cb.sm_handle, BTIF_AV_STATE_OPENED);
@@ -775,7 +767,7 @@ static BOOLEAN btif_av_state_started_handler(btif_sm_event_t event, void *p_data
         btif_av_cb.flags |= BTIF_AV_FLAG_PENDING_STOP;
         btif_a2dp_on_stopped(&p_av->suspend);
 
-        btif_report_audio_state(ESP_A2DP_AUDIO_STATE_STOPPED, &(btif_av_cb.peer_bda));
+        btif_report_audio_state(ESP_A2D_AUDIO_STATE_STOPPED, &(btif_av_cb.peer_bda));
 
         /* if stop was successful, change state to open */
         if (p_av->suspend.status == BTA_AV_SUCCESS) {
@@ -792,7 +784,7 @@ static BOOLEAN btif_av_state_started_handler(btif_sm_event_t event, void *p_data
         btif_a2dp_on_stopped(NULL);
 
         /* inform the application that we are disconnected */
-        btif_report_connection_state(ESP_A2DP_CONNECTION_STATE_DISCONNECTED, &(btif_av_cb.peer_bda));
+        btif_report_connection_state(ESP_A2D_CONNECTION_STATE_DISCONNECTED, &(btif_av_cb.peer_bda));
 
         btif_sm_change_state(btif_av_cb.sm_handle, BTIF_AV_STATE_IDLE);
         break;
@@ -891,7 +883,7 @@ static void bte_av_media_callback(tBTA_AV_EVT event, tBTA_AV_MEDIA *p_data)
     UINT8 que_len;
     tA2D_STATUS a2d_status;
     tA2D_SBC_CIE sbc_cie;
-    btif_av_sink_config_req_t config_req;
+    esp_a2d_mcc_t mcc;
 
     if (event == BTA_AV_MEDIA_DATA_EVT) { /* Switch to BTIF_MEDIA context */
         state = btif_sm_get_state(btif_av_cb.sm_handle);
@@ -908,13 +900,14 @@ static void bte_av_media_callback(tBTA_AV_EVT event, tBTA_AV_MEDIA *p_data)
         /* send a command to BT Media Task */
         btif_reset_decoder((UINT8 *)p_data);
 
+       /* currently only supportes SBC */
         a2d_status = A2D_ParsSbcInfo(&sbc_cie, (UINT8 *)p_data, FALSE);
         if (a2d_status == A2D_SUCCESS) {
+            mcc.type = ESP_A2D_MCT_SBC;
+            memcpy(&mcc.cie, (uint8_t *)p_data + 3, ESP_A2D_CIE_LEN_SBC);
             /* Switch to BTIF context */
-            config_req.sample_rate = btif_a2dp_get_track_frequency(sbc_cie.samp_freq);
-            config_req.channel_count = btif_a2dp_get_track_channel_count(sbc_cie.ch_mode);
             btif_transfer_context(btif_av_handle_event, BTIF_AV_SINK_CONFIG_REQ_EVT,
-                                  (char *)&config_req, sizeof(config_req), NULL);
+                                  (char *)&mcc, sizeof(mcc), NULL);
         } else {
             APPL_TRACE_ERROR("ERROR dump_codec_info A2D_ParsSbcInfo fail:%d\n", a2d_status);
         }
@@ -985,7 +978,7 @@ static bt_status_t init_src(btav_callbacks_t *callbacks)
 ** Returns          bt_status_t
 **
 *******************************************************************************/
-esp_err_t esp_a2dp_sink_init(esp_a2dp_callbacks_t *callbacks)
+esp_err_t esp_a2d_sink_init(esp_a2d_callbacks_t *callbacks)
 // static bt_status_t init_sink(btav_callbacks_t *callbacks)
 {
     BTIF_TRACE_EVENT("%s()\n", __func__);
@@ -1030,7 +1023,7 @@ static bt_status_t src_connect_sink(bt_bdaddr_t *bd_addr)
 }
 #endif
 
-esp_err_t esp_a2dp_sink_connect(esp_bd_addr_t *remote_bda)
+esp_err_t esp_a2d_sink_connect(esp_bd_addr_t *remote_bda)
 // static bt_status_t sink_connect_src(bt_bdaddr_t *bd_addr)
 {
     BTIF_TRACE_EVENT("%s\n", __FUNCTION__);
@@ -1064,7 +1057,7 @@ static bt_status_t disconnect(bt_bdaddr_t *bd_addr)
                                  (char *)bd_addr, sizeof(bt_bdaddr_t), NULL);
 }
 
-esp_err_t esp_a2dp_sink_disconnect(esp_bd_addr_t *remote_bda)
+esp_err_t esp_a2d_sink_disconnect(esp_bd_addr_t *remote_bda)
 {
     bt_status_t stat;
     bt_bdaddr_t bd_addr;
@@ -1115,7 +1108,7 @@ static void cleanup_src(void)
 }
 #endif
 
-void esp_a2dp_sink_deinit(void)
+void esp_a2d_sink_deinit(void)
 {
     BTIF_TRACE_EVENT("%s\n", __FUNCTION__);
 
index 682d16fb1b4e9eeb766f0ba33f1016a9258f1892..c8974512a2c2c08e5b57400e80825e875363d9ea 100644 (file)
@@ -4,88 +4,87 @@
 #include "esp_err.h"
 #include "esp_bt_defs.h"
 
-/* Codec types */
-#define ESP_A2DP_CODEC_SBC         (0)
-#define ESP_A2DP_CODEC_M12         (0x01)
-#define ESP_A2DP_CODEC_M24         (0x02)
-#define ESP_A2DP_CODEC_ATRAC       (0x04)
-#define ESP_A2DP_CODEC_NON_A2DP    (0xff)
-typedef uint8_t esp_a2dp_codec_type_t;
+/* Media codec types */
+#define ESP_A2D_MCT_SBC         (0)
+#define ESP_A2D_MCT_M12         (0x01)
+#define ESP_A2D_MCT_M24         (0x02)
+#define ESP_A2D_MCT_ATRAC       (0x04)
+#define ESP_A2D_MCT_NON_A2DP    (0xff)
+typedef uint8_t esp_a2d_mct_t;
 
 /* codec specific information element */
+#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)
+
 typedef struct {
-    uint8_t oct[4];
-} esp_sbc_cie_t;
+    uint8_t oct[ESP_A2D_CIE_LEN_SBC];
+} esp_a2d_cie_sbc_t;
 
 typedef struct {
-    uint8_t oct[4];
-} esp_mpeg12_audio_cie_t;
+    uint8_t oct[ESP_A2D_CIE_LEN_M12];
+} esp_a2d_cie_m12_t;
 
 typedef struct {
-    uint8_t oct[6];
-} esp_mpeg24_aac_cie_t;
+    uint8_t oct[ESP_A2D_CIE_LEN_M24];
+} esp_a2d_cie_m24_t;
 
 typedef struct {
-    uint8_t oct[7];
-} esp_atrac_cie_t;
+    uint8_t oct[ESP_A2D_CIE_LEN_ATRAC];
+} esp_a2d_cie_atrac_t;
 
+/* media codec capabilities */
 typedef struct {
-    esp_a2dp_codec_type_t type;         /* A2DP codec type*/
+    esp_a2d_mct_t type;         /* A2DP media codec type*/
     union {
-        esp_sbc_cie_t sbc;
-        esp_mpeg12_audio_cie_t mpeg12;
-        esp_mpeg24_aac_cie_t mpeg24;
-        esp_atrac_cie_t atrac;
+        esp_a2d_cie_sbc_t sbc;
+        esp_a2d_cie_m12_t m12;
+        esp_a2d_cie_m24_t m24;
+        esp_a2d_cie_atrac_t atrac;
     } cie;
-} esp_a2dp_codec_cfg_t;
+} esp_a2d_mcc_t;
 
 /* Bluetooth A2DP connection states */
 typedef enum {
-    ESP_A2DP_CONNECTION_STATE_DISCONNECTED = 0,
-    ESP_A2DP_CONNECTION_STATE_CONNECTING,
-    ESP_A2DP_CONNECTION_STATE_CONNECTED,
-    ESP_A2DP_CONNECTION_STATE_DISCONNECTING
-} esp_a2dp_connection_state_t;
+    ESP_A2D_CONNECTION_STATE_DISCONNECTED = 0,
+    ESP_A2D_CONNECTION_STATE_CONNECTING,
+    ESP_A2D_CONNECTION_STATE_CONNECTED,
+    ESP_A2D_CONNECTION_STATE_DISCONNECTING
+} esp_a2d_connection_state_t;
 
 /* Bluetooth A2DP datapath states */
 typedef enum {
-    ESP_A2DP_AUDIO_STATE_REMOTE_SUSPEND = 0,
-    ESP_A2DP_AUDIO_STATE_STOPPED,
-    ESP_A2DP_AUDIO_STATE_STARTED,
-} esp_a2dp_audio_state_t;
+    ESP_A2D_AUDIO_STATE_REMOTE_SUSPEND = 0,
+    ESP_A2D_AUDIO_STATE_STOPPED,
+    ESP_A2D_AUDIO_STATE_STARTED,
+} esp_a2d_audio_state_t;
 
 /** Callback for connection state change.
  *  state will have one of the values from btav_connection_state_t
  */
-typedef void (* esp_a2dp_connection_state_cb_t)(esp_a2dp_connection_state_t state,
+typedef void (* esp_a2d_connection_state_cb_t)(esp_a2d_connection_state_t state,
     esp_bd_addr_t *remote_bda);
 
 /** Callback for audiopath state change.
  *  state will have one of the values from btav_audio_state_t
  */
-typedef void (* esp_a2dp_audio_state_cb_t)(esp_a2dp_audio_state_t state,
+typedef void (* esp_a2d_audio_state_cb_t)(esp_a2d_audio_state_t state,
     esp_bd_addr_t *remote_bda);
 
 /** Callback for audio configuration change.
  *  Used only for the A2DP sink interface.
  *  state will have one of the values from btav_audio_state_t
- *  sample_rate: sample rate in Hz
- *  channel_count: number of channels (1 for mono, 2 for stereo)
  */
-/*
-typedef void (* esp_a2dp_audio_config_cb_t)(esp_bd_addr_t *remote_bda,
-    esp_a2dp_codec_cfg_t *cfg);
-*/
-typedef void (* esp_a2dp_audio_config_cb_t)(esp_bd_addr_t *remote_bda,
-                                           uint32_t sample_rate, uint8_t channel_count); // TODO: to be modified
+typedef void (* esp_a2d_audio_config_cb_t)(esp_bd_addr_t *remote_bda,
+    esp_a2d_mcc_t *mcc);
 
 /** BT-a2dp callback structure. */
 typedef struct {
-    esp_a2dp_connection_state_cb_t connection_state_cb;
-    esp_a2dp_audio_state_cb_t audio_state_cb;
-    esp_a2dp_audio_config_cb_t audio_config_cb;
-} esp_a2dp_callbacks_t;
-
+    esp_a2d_connection_state_cb_t connection_state_cb;
+    esp_a2d_audio_state_cb_t audio_state_cb;
+    esp_a2d_audio_config_cb_t audio_config_cb;
+} esp_a2d_callbacks_t;
 
 /**
  * NOTE:
@@ -98,19 +97,19 @@ typedef struct {
     void (* close)(void);
     int (* ioctl)(int cmd, void *param); // not used for now
     uint32_t (* write)(uint8_t *buf, uint32_t len);
-} esp_a2dp_sink_audio_hal_t;
+} esp_a2d_sink_audio_hal_t;
 
-#define ESP_A2DP_AUDIO_HAL_IOC_WRITE_FLUSH            (1)   // ioctl command, which is not used for now
+#define ESP_A2D_AUDIO_HAL_IOC_WRITE_FLUSH            (1)   // ioctl command, which is not used for now
 
 
 /** Represents the A2DP sink interface.
  */
-esp_err_t esp_a2dp_sink_init(esp_a2dp_callbacks_t *callbacks);
+esp_err_t esp_a2d_sink_init(esp_a2d_callbacks_t *callbacks);
 
-esp_err_t esp_a2dp_sink_connect(esp_bd_addr_t *remote_bda);
+esp_err_t esp_a2d_sink_connect(esp_bd_addr_t *remote_bda);
 
-esp_err_t esp_a2dp_sink_disconnect(esp_bd_addr_t *remote_bda);
+esp_err_t esp_a2d_sink_disconnect(esp_bd_addr_t *remote_bda);
 
-void esp_a2dp_sink_deinit(void);
+void esp_a2d_sink_deinit(void);
 
 #endif /* __ESP_A2DP_API_H__ */