feat(bt/bluedroid): Add events to indicate the initialization states of AVRCP

This commit is contained in:
xiongweichao
2025-05-19 16:55:31 +08:00
parent ba70c7f3d1
commit 4d83f1b8af
4 changed files with 176 additions and 86 deletions
@@ -145,6 +145,7 @@ typedef enum {
ESP_AVRC_CT_SET_ABSOLUTE_VOLUME_RSP_EVT = 7, /*!< set absolute volume response event */
ESP_AVRC_CT_COVER_ART_STATE_EVT = 8, /*!< cover art client connection state changed event */
ESP_AVRC_CT_COVER_ART_DATA_EVT = 9, /*!< cover art client data event */
ESP_AVRC_CT_PROF_STATE_EVT = 10, /*!< Indicate AVRCP controller init or deinit complete */
} esp_avrc_ct_cb_event_t;
/// AVRC Target callback events
@@ -155,6 +156,7 @@ typedef enum {
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 application attribute value, attribute refer to esp_avrc_ps_attr_ids_t */
ESP_AVRC_TG_PROF_STATE_EVT = 6, /*!< Indicate AVRCP target init or deinit complete */
} esp_avrc_tg_cb_event_t;
/// AVRC metadata attribute mask
@@ -303,6 +305,18 @@ typedef struct {
uint8_t ct_cover_art_conn_num; /*!< Number of cover art client connections */
} esp_avrc_profile_status_t;
/**
* @brief Bluetooth AVRCP Initiation states
*/
typedef enum {
ESP_AVRC_INIT_SUCCESS = 0, /*!< Indicate init successful */
ESP_AVRC_INIT_ALREADY, /*!< Indicate init repeated */
ESP_AVRC_INIT_FAIL, /*!< Indicate init fail */
ESP_AVRC_DEINIT_SUCCESS, /*!< Indicate deinit successful */
ESP_AVRC_DEINIT_ALREADY, /*!< Indicate deinit repeated */
ESP_AVRC_DEINIT_FAIL, /*!< Indicate deinit fail */
} esp_avrc_init_state_t;
/// AVRC controller callback parameters
typedef union {
/**
@@ -390,6 +404,14 @@ typedef union {
uint16_t data_len; /*!< the data length of this data event, in bytes */
uint8_t *p_data; /*!< pointer to data, should copy to other buff before event callback return */
} cover_art_data; /*!< AVRC Cover Art data event */
/**
* @brief ESP_AVRC_CT_PROF_STATE_EVT
*/
struct avrc_ct_init_stat_param {
esp_avrc_init_state_t state; /*!< avrc ct initialization param */
} avrc_ct_init_stat; /*!< status to indicate avrcp ct init or deinit */
} esp_avrc_ct_cb_param_t;
/// AVRC target callback parameters
@@ -442,6 +464,13 @@ typedef union {
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 */
/**
* @brief ESP_AVRC_TG_PROF_STATE_EVT
*/
struct avrc_tg_init_stat_param {
esp_avrc_init_state_t state; /*!< avrc tg initialization param */
} avrc_tg_init_stat; /*!< status to indicate avrcp tg init or deinit */
} esp_avrc_tg_cb_param_t;
/**
@@ -482,6 +511,7 @@ esp_err_t esp_avrc_ct_register_callback(esp_avrc_ct_cb_t callback);
* @brief Initialize the bluetooth AVRCP controller module, This function should be called
* after esp_bluedroid_enable() completes successfully. Note: AVRC cannot work independently,
* AVRC should be used along with A2DP and AVRC should be initialized before A2DP.
* ESP_AVRC_CT_PROF_STATE_EVT with ESP_AVRC_INIT_SUCCESS will reported to the APP layer.
*
* @return
* - ESP_OK: success
@@ -496,6 +526,7 @@ esp_err_t esp_avrc_ct_init(void);
* @brief De-initialize AVRCP controller module. This function should be called after
* after esp_bluedroid_enable() completes successfully. Note: AVRC cannot work independently,
* AVRC should be used along with A2DP and AVRC should be deinitialized before A2DP.
* ESP_AVRC_CT_PROF_STATE_EVT with ESP_AVRC_DEINIT_SUCCESS will reported to the APP layer.
*
* @return
* - ESP_OK: success
@@ -636,6 +667,7 @@ esp_err_t esp_avrc_tg_register_callback(esp_avrc_tg_cb_t callback);
* @brief Initialize the bluetooth AVRCP target module, This function should be called
* after esp_bluedroid_enable() completes successfully. Note: AVRC cannot work independently,
* AVRC should be used along with A2DP and AVRC should be initialized before A2DP.
* ESP_AVRC_TG_PROF_STATE_EVT with ESP_AVRC_INIT_SUCCESS will reported to the APP layer.
*
* @return
* - ESP_OK: success
@@ -650,6 +682,7 @@ esp_err_t esp_avrc_tg_init(void);
* @brief De-initialize AVRCP target module. This function should be called after
* after esp_bluedroid_enable() completes successfully. Note: AVRC cannot work independently,
* AVRC should be used along with A2DP and AVRC should be deinitialized before A2DP.
* ESP_AVRC_TG_PROF_STATE_EVT with ESP_AVRC_DEINIT_SUCCESS will reported to the APP layer.
*
* @return
* - ESP_OK: success