Added ACL link related events handler in A2DP sink GAP callback

pull/10984/head
jincheng 2022-08-24 10:56:57 +08:00 zatwierdzone przez Jin Cheng
rodzic 48212875f8
commit a901900533
1 zmienionych plików z 14 dodań i 0 usunięć

Wyświetl plik

@ -56,6 +56,8 @@ static void bt_av_hdl_stack_evt(uint16_t event, void *p_param);
static void bt_app_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *param) static void bt_app_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *param)
{ {
uint8_t *bda = NULL;
switch (event) { switch (event) {
/* when authentication completed, this event comes */ /* when authentication completed, this event comes */
case ESP_BT_GAP_AUTH_CMPL_EVT: { case ESP_BT_GAP_AUTH_CMPL_EVT: {
@ -88,6 +90,18 @@ static void bt_app_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *pa
case ESP_BT_GAP_MODE_CHG_EVT: case ESP_BT_GAP_MODE_CHG_EVT:
ESP_LOGI(BT_AV_TAG, "ESP_BT_GAP_MODE_CHG_EVT mode: %d", param->mode_chg.mode); ESP_LOGI(BT_AV_TAG, "ESP_BT_GAP_MODE_CHG_EVT mode: %d", param->mode_chg.mode);
break; break;
/* when ACL connection completed, this event comes */
case ESP_BT_GAP_ACL_CONN_CMPL_STAT_EVT:
bda = (uint8_t *)param->acl_conn_cmpl_stat.bda;
ESP_LOGI(BT_AV_TAG, "ESP_BT_GAP_ACL_CONN_CMPL_STAT_EVT Connected to [%02x:%02x:%02x:%02x:%02x:%02x], status: 0x%x",
bda[0], bda[1], bda[2], bda[3], bda[4], bda[5], param->acl_conn_cmpl_stat.stat);
break;
/* when ACL disconnection completed, this event comes */
case ESP_BT_GAP_ACL_DISCONN_CMPL_STAT_EVT:
bda = (uint8_t *)param->acl_disconn_cmpl_stat.bda;
ESP_LOGI(BT_AV_TAG, "ESP_BT_GAP_ACL_DISC_CMPL_STAT_EVT Disconnected from [%02x:%02x:%02x:%02x:%02x:%02x], reason: 0x%x",
bda[0], bda[1], bda[2], bda[3], bda[4], bda[5], param->acl_disconn_cmpl_stat.reason);
break;
/* others */ /* others */
default: { default: {
ESP_LOGI(BT_AV_TAG, "event: %d", event); ESP_LOGI(BT_AV_TAG, "event: %d", event);