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 2f4f1eee70..339e08737d 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 @@ -152,6 +152,7 @@ typedef enum { ESP_AVRC_TG_PASSTHROUGH_CMD_EVT = 2, /*!< passthrough command event */ ESP_AVRC_TG_SET_ABSOLUTE_VOLUME_CMD_EVT = 3, /*!< set absolute volume command from remote device */ ESP_AVRC_TG_REGISTER_NOTIFICATION_EVT = 4, /*!< register notification event */ + ESP_AVRC_TG_SET_PLAYER_APP_VALUE_EVT = 5, /*!< set applicaton attribute value, attribute refer to esp_avrc_ps_attr_ids_t */ } esp_avrc_tg_cb_event_t; /// AVRC metadata attribute mask @@ -278,6 +279,12 @@ typedef union esp_avrc_batt_stat_t batt; /*!< response data for ESP_AVRC_RN_BATTERY_STATUS_CHANGE */ } esp_avrc_rn_param_t; +/// AVRCP set app value parameters +typedef struct { + uint8_t attr_id; /*!< player application attribute id */ + uint8_t attr_val; /*!< player application attribute value */ +} esp_avrc_set_app_value_param_t; + /// AVRC controller callback parameters typedef union { /** @@ -380,6 +387,15 @@ typedef union { uint8_t event_id; /*!< event id of AVRC RegisterNotification */ uint32_t event_parameter; /*!< event notification parameter */ } reg_ntf; /*!< register notification */ + + /** + * @brief ESP_AVRC_TG_SET_PLAYER_APP_VALUE_EVT + */ + struct avrc_tg_set_app_value_param { + uint8_t num_val; /*!< attribute num */ + esp_avrc_set_app_value_param_t *p_vals; /*!< point to the id and value of player application attribute */ + } set_app_value; /*!< set player application value */ + } esp_avrc_tg_cb_param_t; /** 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 e3687da832..b07101b1f1 100644 --- a/components/bt/host/bluedroid/bta/av/bta_av_act.c +++ b/components/bt/host/bluedroid/bta/av/bta_av_act.c @@ -777,6 +777,10 @@ tBTA_AV_EVT bta_av_proc_meta_cmd(tAVRC_RESPONSE *p_rc_rsp, tBTA_AV_RC_MSG *p_ms case AVRC_PDU_SET_ABSOLUTE_VOLUME: p_rc_rsp->rsp.status = BTA_AV_STS_NO_RSP; break; + case AVRC_PDU_SET_PLAYER_APP_VALUE: + /* Setting of a value by CT does not implicitly mean that the setting will take effect on TG. */ + /* The setting shall take effect after a play command from CT. */ + break; default: APPL_TRACE_WARNING("%s unhandled RC vendor PDU: 0x%x", __FUNCTION__, pdu); break; 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 ff9621e7e1..eaf6576780 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 @@ -455,7 +455,6 @@ static void handle_rc_connect (tBTA_AV_RC_OPEN *p_rc_open) btc_rc_cb.rc_handle = p_rc_open->rc_handle; bdcpy(rc_addr.address, btc_rc_cb.rc_addr); - // callback to application if (p_rc_open->peer_features & BTA_AV_FEAT_RCTG) { esp_avrc_ct_cb_param_t param; @@ -695,7 +694,6 @@ static void handle_rc_metamsg_cmd (tBTA_AV_META_MSG *p_meta_msg) } else { btc_rc_upstreams_evt(avrc_command.cmd.pdu, &avrc_command, p_meta_msg->code, p_meta_msg->label); } - osi_free(buf); } @@ -732,6 +730,14 @@ static void btc_rc_upstreams_evt(UINT16 event, tAVRC_COMMAND *pavrc_cmd, UINT8 c btc_avrc_tg_cb_to_app(ESP_AVRC_TG_SET_ABSOLUTE_VOLUME_CMD_EVT, ¶m); } break; + case AVRC_PDU_SET_PLAYER_APP_VALUE: { + // set up callback + esp_avrc_tg_cb_param_t param; + param.set_app_value.num_val = pavrc_cmd->set_app_val.num_val; + param.set_app_value.p_vals = (esp_avrc_set_app_value_param_t *)pavrc_cmd->set_app_val.p_vals; + btc_avrc_tg_cb_to_app(ESP_AVRC_TG_SET_PLAYER_APP_VALUE_EVT, ¶m); + } + break; case AVRC_PDU_GET_PLAY_STATUS: case AVRC_PDU_GET_ELEMENT_ATTR: case AVRC_PDU_INFORM_DISPLAY_CHARSET: @@ -739,7 +745,6 @@ static void btc_rc_upstreams_evt(UINT16 event, tAVRC_COMMAND *pavrc_cmd, UINT8 c case AVRC_PDU_LIST_PLAYER_APP_ATTR: case AVRC_PDU_LIST_PLAYER_APP_VALUES: case AVRC_PDU_GET_CUR_PLAYER_APP_VALUE: - case AVRC_PDU_SET_PLAYER_APP_VALUE: case AVRC_PDU_GET_PLAYER_APP_ATTR_TEXT: case AVRC_PDU_GET_PLAYER_APP_VALUE_TEXT: { send_reject_response (btc_rc_cb.rc_handle, label, pavrc_cmd->pdu, AVRC_STS_BAD_CMD); 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 17c2edbb3c..d2043cd810 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 @@ -113,6 +113,7 @@ void bt_app_rc_tg_cb(esp_avrc_tg_cb_event_t event, esp_avrc_tg_cb_param_t *param case ESP_AVRC_TG_PASSTHROUGH_CMD_EVT: case ESP_AVRC_TG_SET_ABSOLUTE_VOLUME_CMD_EVT: case ESP_AVRC_TG_REGISTER_NOTIFICATION_EVT: + case ESP_AVRC_TG_SET_PLAYER_APP_VALUE_EVT: bt_app_work_dispatch(bt_av_hdl_avrc_tg_evt, event, param, sizeof(esp_avrc_tg_cb_param_t), NULL); break; default: