From 46e734717755a28d5d341d0ef7871226e38e1f1d Mon Sep 17 00:00:00 2001 From: xiongweichao Date: Wed, 22 Feb 2023 15:23:28 +0800 Subject: [PATCH] bt:Added a parameter to tell the user the result of the pass through command implementation --- components/bt/host/bluedroid/api/include/api/esp_avrc_api.h | 1 + components/bt/host/bluedroid/bta/av/bta_av_act.c | 6 +----- .../bt/host/bluedroid/btc/profile/std/avrc/btc_avrc.c | 1 + .../bluedroid/classic_bt/a2dp_sink/main/bt_app_av.c | 3 ++- .../bluetooth/bluedroid/classic_bt/a2dp_source/main/main.c | 3 ++- .../bluedroid/coex/a2dp_gatts_coex/main/bt_app_av.c | 3 ++- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/components/bt/host/bluedroid/api/include/api/esp_avrc_api.h b/components/bt/host/bluedroid/api/include/api/esp_avrc_api.h index 1c86600356..f226577efc 100644 --- a/components/bt/host/bluedroid/api/include/api/esp_avrc_api.h +++ b/components/bt/host/bluedroid/api/include/api/esp_avrc_api.h @@ -294,6 +294,7 @@ typedef union { uint8_t tl; /*!< transaction label, 0 to 15 */ uint8_t key_code; /*!< passthrough command code */ uint8_t key_state; /*!< 0 for PRESSED, 1 for RELEASED */ + esp_avrc_rsp_t rsp_code; /*!< response code */ } psth_rsp; /*!< passthrough command response */ /** diff --git a/components/bt/host/bluedroid/bta/av/bta_av_act.c b/components/bt/host/bluedroid/bta/av/bta_av_act.c index 4857a88ab3..f7f3dc3fc0 100644 --- a/components/bt/host/bluedroid/bta/av/bta_av_act.c +++ b/components/bt/host/bluedroid/bta/av/bta_av_act.c @@ -858,12 +858,8 @@ void bta_av_rc_msg(tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data) av.remote_cmd.label = p_data->rc_msg.label; } } - /* else if this is a pass thru respone that TG doesn't implement thie command */ - else if (p_data->rc_msg.msg.hdr.ctype == AVRC_RSP_NOT_IMPL) { - /* do nothing, no need to setup for callback */ - } /* else if this is a pass thru response */ - else if (p_data->rc_msg.msg.hdr.ctype >= AVRC_RSP_ACCEPT) { + else if (p_data->rc_msg.msg.hdr.ctype >= AVRC_RSP_NOT_IMPL) { /* set up for callback */ evt = BTA_AV_REMOTE_RSP_EVT; av.remote_rsp.rc_id = p_data->rc_msg.msg.pass.op_id; diff --git a/components/bt/host/bluedroid/btc/profile/std/avrc/btc_avrc.c b/components/bt/host/bluedroid/btc/profile/std/avrc/btc_avrc.c index 25b04d5aba..7e7f1b2bb6 100644 --- a/components/bt/host/bluedroid/btc/profile/std/avrc/btc_avrc.c +++ b/components/bt/host/bluedroid/btc/profile/std/avrc/btc_avrc.c @@ -869,6 +869,7 @@ static void handle_rc_passthrough_rsp ( tBTA_AV_REMOTE_RSP *p_remote_rsp) param.psth_rsp.tl = p_remote_rsp->label; param.psth_rsp.key_code = p_remote_rsp->rc_id; param.psth_rsp.key_state = key_state; + param.psth_rsp.rsp_code = p_remote_rsp->rsp_code; btc_avrc_ct_cb_to_app(ESP_AVRC_CT_PASSTHROUGH_RSP_EVT, ¶m); } while (0); } else { diff --git a/examples/bluetooth/bluedroid/classic_bt/a2dp_sink/main/bt_app_av.c b/examples/bluetooth/bluedroid/classic_bt/a2dp_sink/main/bt_app_av.c index 9cfedbacfc..150fa21416 100644 --- a/examples/bluetooth/bluedroid/classic_bt/a2dp_sink/main/bt_app_av.c +++ b/examples/bluetooth/bluedroid/classic_bt/a2dp_sink/main/bt_app_av.c @@ -405,7 +405,8 @@ static void bt_av_hdl_avrc_ct_evt(uint16_t event, void *p_param) } /* when passthrough responsed, this event comes */ case ESP_AVRC_CT_PASSTHROUGH_RSP_EVT: { - ESP_LOGI(BT_RC_CT_TAG, "AVRC passthrough rsp: key_code 0x%x, key_state %d", rc->psth_rsp.key_code, rc->psth_rsp.key_state); + ESP_LOGI(BT_RC_CT_TAG, "AVRC passthrough rsp: key_code 0x%x, key_state %d, rsp_code %d", rc->psth_rsp.key_code, + rc->psth_rsp.key_state, rc->psth_rsp.rsp_code); break; } /* when metadata responsed, this event comes */ diff --git a/examples/bluetooth/bluedroid/classic_bt/a2dp_source/main/main.c b/examples/bluetooth/bluedroid/classic_bt/a2dp_source/main/main.c index abade5a024..d4dd9a0d91 100644 --- a/examples/bluetooth/bluedroid/classic_bt/a2dp_source/main/main.c +++ b/examples/bluetooth/bluedroid/classic_bt/a2dp_source/main/main.c @@ -680,7 +680,8 @@ static void bt_av_hdl_avrc_ct_evt(uint16_t event, void *p_param) } /* when passthrough responsed, this event comes */ case ESP_AVRC_CT_PASSTHROUGH_RSP_EVT: { - ESP_LOGI(BT_RC_CT_TAG, "AVRC passthrough response: key_code 0x%x, key_state %d", rc->psth_rsp.key_code, rc->psth_rsp.key_state); + ESP_LOGI(BT_RC_CT_TAG, "AVRC passthrough response: key_code 0x%x, key_state %d, rsp_code %d", rc->psth_rsp.key_code, + rc->psth_rsp.key_state, rc->psth_rsp.rsp_code); break; } /* when metadata responsed, this event comes */ diff --git a/examples/bluetooth/bluedroid/coex/a2dp_gatts_coex/main/bt_app_av.c b/examples/bluetooth/bluedroid/coex/a2dp_gatts_coex/main/bt_app_av.c index 9cfedbacfc..150fa21416 100644 --- a/examples/bluetooth/bluedroid/coex/a2dp_gatts_coex/main/bt_app_av.c +++ b/examples/bluetooth/bluedroid/coex/a2dp_gatts_coex/main/bt_app_av.c @@ -405,7 +405,8 @@ static void bt_av_hdl_avrc_ct_evt(uint16_t event, void *p_param) } /* when passthrough responsed, this event comes */ case ESP_AVRC_CT_PASSTHROUGH_RSP_EVT: { - ESP_LOGI(BT_RC_CT_TAG, "AVRC passthrough rsp: key_code 0x%x, key_state %d", rc->psth_rsp.key_code, rc->psth_rsp.key_state); + ESP_LOGI(BT_RC_CT_TAG, "AVRC passthrough rsp: key_code 0x%x, key_state %d, rsp_code %d", rc->psth_rsp.key_code, + rc->psth_rsp.key_state, rc->psth_rsp.rsp_code); break; } /* when metadata responsed, this event comes */