# Bluetooth® AVRCP APIs

## Overview

Bluetooth AVRCP reference APIs.

## API Reference

### Header File

- components/bt/host/bluedroid/api/include/api/esp_avrc_api.h

- This header file can be included with:

  >     #include "esp_avrc_api.h"

- This header file is a part of the API provided by the `bt` component. To declare that your component depends on `bt`, add the following to your CMakeLists.txt:

  >     REQUIRES bt

  > or

  >     PRIV_REQUIRES bt

### Functions

esp_err_t esp_avrc_ct_register_callback(esp_avrc_ct_cb_t callback)

  Register application callbacks to AVRCP module. This function should be called after esp_bluedroid_enable() completes successfully.

  参数:

    callback -- [in] AVRCP controller callback function

  返回:

    - ESP_OK: success

    - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled

    - ESP_FAIL: others

esp_err_t esp_avrc_ct_init(void)

  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.

  返回:

    - ESP_OK: success

    - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled

    - ESP_FAIL: others

esp_err_t esp_avrc_ct_deinit(void)

  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.

  返回:

    - ESP_OK: success

    - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled

    - ESP_FAIL: others

esp_err_t esp_avrc_ct_send_set_player_value_cmd(uint8_t tl, uint8_t attr_id, uint8_t value_id)

  Send player application settings command to AVRCP target. This function should be called after ESP_AVRC_CT_CONNECTION_STATE_EVT is received and AVRCP connection is established.

  参数:

    - tl -- [in] : transaction label, 0 to 15, consecutive commands should use different values

    - attr_id -- [in] : player application setting attribute IDs from one of esp_avrc_ps_attr_ids_t

    - value_id -- [in] : attribute value defined for the specific player application setting attribute

  返回:

    - ESP_OK: success

    - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled

    - ESP_FAIL: others

esp_err_t esp_avrc_ct_send_get_rn_capabilities_cmd(uint8_t tl)

  Send GetCapabilities PDU to AVRCP target to retrieve remote device's supported notification event_ids. This function should be called after ESP_AVRC_CT_CONNECTION_STATE_EVT is received and AVRCP connection is established.

  参数:

    tl -- [in] : transaction label, 0 to 15, consecutive commands should use different values

  返回:

    - ESP_OK: success

    - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled

    - ESP_FAIL: others

esp_err_t esp_avrc_ct_send_register_notification_cmd(uint8_t tl, uint8_t event_id, uint32_t event_parameter)

  Send register notification command to AVRCP target. This function should be called after ESP_AVRC_CT_CONNECTION_STATE_EVT is received and AVRCP connection is established.

  参数:

    - tl -- [in] : transaction label, 0 to 15, consecutive commands should use different values.

    - event_id -- [in] : id of events, e.g. ESP_AVRC_RN_PLAY_STATUS_CHANGE, ESP_AVRC_RN_TRACK_CHANGE, etc.

    - event_parameter -- [in] : playback interval for ESP_AVRC_RN_PLAY_POS_CHANGED; For other events , value of this parameter is ignored.

  返回:

    - ESP_OK: success

    - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled

    - ESP_ERR_NOT_SUPPORTED: if the event_id is not supported in current implementation

    - ESP_FAIL: others

esp_err_t esp_avrc_ct_send_set_absolute_volume_cmd(uint8_t tl, uint8_t volume)

  Send set absolute volume command to AVRCP target. This function should be called after ESP_AVRC_CT_CONNECTION_STATE_EVT is received and AVRCP connection is established.

  参数:

    - tl -- [in] : transaction label, 0 to 15, consecutive commands should use different values

    - volume -- [in] : volume, 0 to 0x7f, means 0% to 100%

  返回:

    - ESP_OK: success

    - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled

    - ESP_ERR_NOT_SUPPORTED: if the event_id is not supported in current implementation

    - ESP_FAIL: others

esp_err_t esp_avrc_ct_send_metadata_cmd(uint8_t tl, uint8_t attr_mask)

  Send metadata command to AVRCP target. This function should be called after ESP_AVRC_CT_CONNECTION_STATE_EVT is received and AVRCP connection is established.

  参数:

    - tl -- [in] : transaction label, 0 to 15, consecutive commands should use different values.

    - attr_mask -- [in] : mask of attributes, e.g. ESP_AVRC_MD_ATTR_ID_TITLE | ESP_AVRC_MD_ATTR_ID_ARTIST.

  返回:

    - ESP_OK: success

    - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled

    - ESP_FAIL: others

esp_err_t esp_avrc_ct_send_passthrough_cmd(uint8_t tl, uint8_t key_code, uint8_t key_state)

  Send passthrough command to AVRCP target. This function should be called after ESP_AVRC_CT_CONNECTION_STATE_EVT is received and AVRCP connection is established.

  参数:

    - tl -- [in] : transaction label, 0 to 15, consecutive commands should use different values.

    - key_code -- [in] : passthrough command code, e.g. ESP_AVRC_PT_CMD_PLAY, ESP_AVRC_PT_CMD_STOP, etc.

    - key_state -- [in] : passthrough command key state, ESP_AVRC_PT_CMD_STATE_PRESSED or ESP_AVRC_PT_CMD_STATE_RELEASED

  返回:

    - ESP_OK: success

    - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled

    - ESP_FAIL: others

esp_err_t esp_avrc_ct_send_get_play_status_cmd(uint8_t tl)

  Send get play status command to AVRCP target. This function should be called after ESP_AVRC_CT_CONNECTION_STATE_EVT is received and AVRCP connection is established.

  参数:

    tl -- [in] : transaction label, 0 to 15, consecutive commands should use different values.

  返回:

    - ESP_OK: success

    - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled

    - ESP_FAIL: others

esp_err_t esp_avrc_tg_register_callback(esp_avrc_tg_cb_t callback)

  Register application callbacks to AVRCP target module. This function should be called after esp_bluedroid_enable() completes successfully.

  参数:

    callback -- [in] AVRCP target callback function

  返回:

    - ESP_OK: success

    - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled

    - ESP_FAIL: others

esp_err_t esp_avrc_tg_init(void)

  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.

  返回:

    - ESP_OK: success

    - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled

    - ESP_FAIL: others

esp_err_t esp_avrc_tg_deinit(void)

  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.

  返回:

    - ESP_OK: success

    - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled

    - ESP_FAIL: others

esp_err_t esp_avrc_tg_get_psth_cmd_filter(esp_avrc_psth_filter_t filter, esp_avrc_psth_bit_mask_t *cmd_set)

  Get the current filter of remote passthrough commands on AVRC target. Filter is given by filter type and bit mask for the passthrough commands. This function should be called after esp_avrc_tg_init(). For filter type ESP_AVRC_PSTH_FILTER_ALLOWED_CMD, the retrieved command set is constant and it covers all of the passthrough commands that can possibly be supported. For filter type ESP_AVRC_PSTH_FILTER_SUPPORT_COMMANDS, the retrieved command set covers the passthrough commands selected to be supported according to current configuration. The configuration can be changed using esp_avrc_tg_set_psth_cmd_filter().

  返回:

    - ESP_OK: success

    - ESP_ERR_INVALID_STATE: if bluetooth stack is not enabled or AVRC TG is not initialized

    - ESP_ERR_INVALID_ARG: if filter type is invalid or cmd_set is NULL

    - ESP_FAIL: otherwise

esp_err_t esp_avrc_tg_set_psth_cmd_filter(esp_avrc_psth_filter_t filter, const esp_avrc_psth_bit_mask_t *cmd_set)

  Set the filter of remote passthrough commands on AVRC target. Filter is given by filter type and bit mask for the passthrough commands. This function should be called after esp_avrc_tg_init().

  If filter type is ESP_AVRC_PSTH_FILTER_SUPPORT_CMD, the passthrough commands which are set "1" as given in cmd_set will generate ESP_AVRC_CT_PASSTHROUGH_RSP_EVT callback event and are auto-accepted in the protocol stack, other commands are replied with response type "NOT IMPLEMENTED" (8). The set of supported commands should be a subset of allowed command set. The allowed command set can be retrieved using esp_avrc_tg_get_psth_cmd_filter() with filter type "ESP_AVRC_PSTH_FILTER_ALLOWED_CMD".

  Filter type "ESP_AVRC_PSTH_FILTER_ALLOWED_CMD" does not apply to this function.

  返回:

    - ESP_OK: success

    - ESP_ERR_INVALID_STATE: if bluetooth stack is not enabled

    - ESP_ERR_INVALID_ARG: if filter type is invalid or cmd_set is NULL

    - ESP_ERR_NOT_SUPPORTED:: if filter type is ESP_AVRC_PSTH_FILTER_ALLOWED_CMD, or cmd_set includes commands that are not allowed

bool esp_avrc_psth_bit_mask_operation(esp_avrc_bit_mask_op_t op, esp_avrc_psth_bit_mask_t *psth, esp_avrc_pt_cmd_t cmd)

  Operate on the type esp_avrc_psth_bit_mask_t with regard to a specific PASSTHROUGH command.

  参数:

    - op -- [in] operation requested on the bit mask field

    - psth -- [in] pointer to passthrough command bit mask structure

    - cmd -- [in] passthrough command code

  返回:

    For operation ESP_AVRC_BIT_MASK_OP_SET or ESP_AVRC_BIT_MASK_OP_CLEAR, return true for a successful operation, otherwise return false. For operation ESP_AVRC_BIT_MASK_OP_TEST, return true if the corresponding bit is set, otherwise false.

esp_err_t esp_avrc_tg_get_rn_evt_cap(esp_avrc_rn_evt_cap_t cap, esp_avrc_rn_evt_cap_mask_t *evt_set)

  Get the requested event notification capabilities on local AVRC target. The capability is returned in a bit mask representation in evt_set. This function should be called after esp_avrc_tg_init().

  For capability type "ESP_AVRC_RN_CAP_ALLOWED_EVT, the retrieved event set is constant and it covers all of the notification events that can possibly be supported with current implementation.

  For capability type ESP_AVRC_RN_CAP_SUPPORTED_EVT, the event set covers the notification events selected to be supported under current configuration, The configuration can be changed using esp_avrc_tg_set_rn_evt_cap().

  返回:

    - ESP_OK: success

    - ESP_ERR_INVALID_STATE: if bluetooth stack is not enabled or AVRC TG is not initialized

    - ESP_ERR_INVALID_ARG: if cap is invalid or evt_set is NULL

    - ESP_FAIL: otherwise

esp_err_t esp_avrc_tg_set_rn_evt_cap(const esp_avrc_rn_evt_cap_mask_t *evt_set)

  Set the event notification capabilities on local AVRCP target. The capability is given in a bit mask representation in evt_set and must be a subset of allowed event IDs with current implementation. This function should be called after esp_avrc_tg_init().

  返回:

    - ESP_OK: success

    - ESP_ERR_INVALID_STATE: if bluetooth stack is not enabled

    - ESP_ERR_INVALID_ARG: if evt_set is NULL

bool esp_avrc_rn_evt_bit_mask_operation(esp_avrc_bit_mask_op_t op, esp_avrc_rn_evt_cap_mask_t *events, esp_avrc_rn_event_ids_t event_id)

  Operate on the type esp_avrc_rn_evt_cap_mask_t with regard to a specific event.

  For operation ESP_AVRC_BIT_MASK_OP_TEST, return true if the corresponding bit is set, otherwise false.

  参数:

    - op -- [in] operation requested on the bit mask field

    - events -- [in] pointer to event notification capability bit mask structure

    - event_id -- [in] notification event code

  返回:

    For operation ESP_AVRC_BIT_MASK_OP_SET or ESP_AVRC_BIT_MASK_OP_CLEAR, return true for a successful operation, otherwise return false.

esp_err_t esp_avrc_tg_send_rn_rsp(esp_avrc_rn_event_ids_t event_id, esp_avrc_rn_rsp_t rsp, esp_avrc_rn_param_t *param)

  Send RegisterNotification Response to remote AVRCP controller. Local event notification capability can be set using esp_avrc_tg_set_rn_evt_cap(), in a bit mask representation in evt_set. This function should be called after esp_avrc_tg_init().

  参数:

    - event_id -- [in] notification event ID that remote AVRCP CT registers

    - rsp -- [in] notification response code

    - param -- [in] parameters included in the specific notification

  返回:

    - ESP_OK: success

    - ESP_ERR_INVALID_STATE: if bluetooth stack is not enabled or AVRC TG is not initialized

    - ESP_ERR_INVALID_ARG: if evt_set is NULL

esp_err_t esp_avrc_ct_cover_art_connect(uint16_t mtu)

  Start the process to establish OBEX connection used in Cover Art Client. Once the operation done, ESP_AVRC_CT_COVER_ART_STATE_EVT will come, operation result can be found in event param. This API can be used only when AVRC Cover Art feature is enabled.

  参数:

    mtu -- [in] MTU used in lower level connection, should not smaller than ESP_AVRC_CA_MTU_MIN or larger than ESP_AVRC_CA_MTU_MAX, if value is not valid, will be reset to ESP_AVRC_CA_MTU_MAX. This can limit the max data length in cover_art_data event.

  返回:

    - ESP_OK: success

    - ESP_ERR_INVALID_STATE: if bluetooth stack is not enabled or AVRC CT is not initialized

    - ESP_ERR_NOT_SUPPORTED: if peer device does not support Cover Art function

esp_err_t esp_avrc_ct_cover_art_disconnect(void)

  Start the process to release the OBEX connection used in Cover Art Client.Once the operation done, ESP_AVRC_CT_COVER_ART_STATE_EVT will come, operation result can be found in event param. This API can be used only when AVRC Cover Art feature is enabled.

  返回:

    - ESP_OK: success

    - ESP_ERR_INVALID_STATE: if bluetooth stack is not enabled or AVRC CT is not initialized

    - ESP_ERR_NOT_SUPPORTED: if peer device does not support Cover Art function

esp_err_t esp_avrc_ct_cover_art_get_image_properties(uint8_t *image_handle)

  Start the process to get image properties from Cover Art server. This API can be used only when AVRC Cover Art feature is enabled.

  参数:

    image_handle -- [in] pointer to image handle with a length of ESP_AVRC_CA_IMAGE_HANDLE_LEN bytes, can be freed after this function return

  返回:

    - ESP_OK: success

    - ESP_ERR_INVALID_STATE: if bluetooth stack is not enabled or AVRC CT is not initialized

    - ESP_ERR_NOT_SUPPORTED: if peer device does not support Cover Art function

esp_err_t esp_avrc_ct_cover_art_get_image(uint8_t *image_handle, uint8_t *image_descriptor, uint16_t image_descriptor_len)

  Start the process to get image from Cover Art server. This API can be used only when AVRC Cover Art feature is enabled.

  参数:

    - image_handle -- [in] pointer to image handle with a length of ESP_AVRC_CA_IMAGE_HANDLE_LEN bytes, can be freed after this function return

    - image_descriptor -- [in] pointer to image descriptor, will be cache internally by bluetooth stack, can be freed once this api return

    - image_descriptor_len -- [in] the length of image descriptor

  返回:

    - ESP_OK: success

    - ESP_ERR_INVALID_STATE: if bluetooth stack is not enabled or AVRC CT is not initialized

    - ESP_ERR_NOT_SUPPORTED: if peer device does not support Cover Art function

esp_err_t esp_avrc_ct_cover_art_get_linked_thumbnail(uint8_t *image_handle)

  Start the process to get linked thumbnail from Cover Art server. This API can be used only when AVRC Cover Art feature is enabled.

  参数:

    image_handle -- [in] pointer to image handle with a length of ESP_AVRC_CA_IMAGE_HANDLE_LEN bytes, can be freed after this function return

  返回:

    - ESP_OK: success

    - ESP_ERR_INVALID_STATE: if bluetooth stack is not enabled or AVRC CT is not initialized

    - ESP_ERR_NOT_SUPPORTED: if peer device does not support Cover Art function

esp_err_t esp_avrc_get_profile_status(esp_avrc_profile_status_t *profile_status)

  This function is used to get the status of AVRCP.

  参数:

    profile_status -- [out] - AVRCP status

  返回:

    - ESP_OK: success

    - other: failed

### Unions

union esp_avrc_rn_param_t
  #include <esp_avrc_api.h>

  AVRCP notification parameters.

  Public Members

  uint8_t volume

    response data for ESP_AVRC_RN_VOLUME_CHANGE, ranges 0..127

  esp_avrc_playback_stat_t playback

    response data for ESP_AVRC_RN_PLAY_STATUS_CHANGE

  uint8_t elm_id[8]

    response data for ESP_AVRC_RN_TRACK_CHANGE

  uint32_t play_pos

    response data for ESP_AVRC_RN_PLAY_POS_CHANGED, in millisecond

  esp_avrc_batt_stat_t batt

    response data for ESP_AVRC_RN_BATTERY_STATUS_CHANGE

union esp_avrc_ct_cb_param_t
  #include <esp_avrc_api.h>

  AVRC controller callback parameters.

  Public Members

  struct esp_avrc_ct_cb_param_t::avrc_ct_conn_stat_param conn_stat

    AVRC connection status

  struct esp_avrc_ct_cb_param_t::avrc_ct_psth_rsp_param psth_rsp

    passthrough command response

  struct esp_avrc_ct_cb_param_t::avrc_ct_meta_rsp_param meta_rsp

    metadata attributes response

  struct esp_avrc_ct_cb_param_t::avrc_ct_get_play_status_rsp_param play_status_rsp

    get play status command response

  struct esp_avrc_ct_cb_param_t::avrc_ct_change_notify_param change_ntf

    notifications

  struct esp_avrc_ct_cb_param_t::avrc_ct_rmt_feats_param rmt_feats

    AVRC features discovered from remote SDP server

  struct esp_avrc_ct_cb_param_t::avrc_ct_get_rn_caps_rsp_param get_rn_caps_rsp

    get supported event capabilities response from AVRCP target

  struct esp_avrc_ct_cb_param_t::avrc_ct_set_volume_rsp_param set_volume_rsp

    set absolute volume response event

  struct esp_avrc_ct_cb_param_t::avrc_ct_cover_art_state_param cover_art_state

    AVRC Cover Art connection state change event

  struct esp_avrc_ct_cb_param_t::avrc_ct_cover_art_data_param cover_art_data

    AVRC Cover Art data event

  struct esp_avrc_ct_cb_param_t::avrc_ct_init_stat_param avrc_ct_init_stat

    status to indicate avrcp ct init or deinit

  struct avrc_ct_change_notify_param
    #include <esp_avrc_api.h>

    ESP_AVRC_CT_CHANGE_NOTIFY_EVT.

    Public Members

    uint8_t event_id

      id of AVRC event notification

    esp_avrc_rn_param_t event_parameter

      event notification parameter

  struct avrc_ct_conn_stat_param
    #include <esp_avrc_api.h>

    ESP_AVRC_CT_CONNECTION_STATE_EVT.

    Public Members

    bool connected

      whether AVRC connection is set up

    esp_bd_addr_t remote_bda

      remote bluetooth device address

  struct avrc_ct_cover_art_data_param
    #include <esp_avrc_api.h>

    ESP_AVRC_CT_COVER_ART_DATA_EVT.

    Public Members

    esp_bt_status_t status

      indicate whether the get operation is success, p_data is valid only when status is ESP_BT_STATUS_SUCCESS

    bool final

      indicate whether this data event is the final one, true if we have received the entire object

    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

  struct avrc_ct_cover_art_state_param
    #include <esp_avrc_api.h>

    ESP_AVRC_CT_COVER_ART_STATE_EVT.

    Public Members

    esp_avrc_cover_art_conn_state_t state

      indicate the Cover Art connection status

    esp_bt_status_t reason

      the disconnect reason of Cover Art connection

  struct avrc_ct_get_play_status_rsp_param
    #include <esp_avrc_api.h>

    ESP_AVRC_CT_PLAY_STATUS_RSP_EVT.

    Public Members

    uint32_t song_length

      total length of the playing song in milliseconds

    uint32_t song_position

      current position of the playing song in milliseconds elapsed

    esp_avrc_playback_stat_t play_status

      current status of playing

  struct avrc_ct_get_rn_caps_rsp_param
    #include <esp_avrc_api.h>

    ESP_AVRC_CT_GET_RN_CAPABILITIES_RSP_EVT.

    Public Members

    uint8_t cap_count

      number of items provided in event or company_id according to cap_id used

    esp_avrc_rn_evt_cap_mask_t evt_set

      supported event_ids represented in bit-mask

  struct avrc_ct_init_stat_param
    #include <esp_avrc_api.h>

    ESP_AVRC_CT_PROF_STATE_EVT.

    Public Members

    esp_avrc_init_state_t state

      avrc ct initialization param

  struct avrc_ct_meta_rsp_param
    #include <esp_avrc_api.h>

    ESP_AVRC_CT_METADATA_RSP_EVT.

    Public Members

    uint8_t attr_id

      id of metadata attribute

    uint8_t *attr_text

      attribute itself

    int attr_length

      attribute character length

  struct avrc_ct_psth_rsp_param
    #include <esp_avrc_api.h>

    ESP_AVRC_CT_PASSTHROUGH_RSP_EVT.

    Public Members

    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

  struct avrc_ct_rmt_feats_param
    #include <esp_avrc_api.h>

    ESP_AVRC_CT_REMOTE_FEATURES_EVT.

    Public Members

    uint32_t feat_mask

      AVRC feature mask of remote device

    uint16_t tg_feat_flag

      feature flag of remote device as TG

    esp_bd_addr_t remote_bda

      remote bluetooth device address

  struct avrc_ct_set_volume_rsp_param
    #include <esp_avrc_api.h>

    ESP_AVRC_CT_SET_ABSOLUTE_VOLUME_RSP_EVT.

    Public Members

    uint8_t volume

      the volume which has actually been set, range is 0 to 0x7f, means 0% to 100%

union esp_avrc_tg_cb_param_t
  #include <esp_avrc_api.h>

  AVRC target callback parameters.

  Public Members

  struct esp_avrc_tg_cb_param_t::avrc_tg_conn_stat_param conn_stat

    AVRC connection status

  struct esp_avrc_tg_cb_param_t::avrc_tg_rmt_feats_param rmt_feats

    AVRC features discovered through SDP

  struct esp_avrc_tg_cb_param_t::avrc_tg_psth_cmd_param psth_cmd

    passthrough command

  struct esp_avrc_tg_cb_param_t::avrc_tg_set_abs_vol_param set_abs_vol

    set absolute volume command targeted on audio sink

  struct esp_avrc_tg_cb_param_t::avrc_tg_reg_ntf_param reg_ntf

    register notification

  struct esp_avrc_tg_cb_param_t::avrc_tg_set_app_value_param set_app_value

    set player application value

  struct esp_avrc_tg_cb_param_t::avrc_tg_init_stat_param avrc_tg_init_stat

    status to indicate avrcp tg init or deinit

  struct avrc_tg_conn_stat_param
    #include <esp_avrc_api.h>

    ESP_AVRC_TG_CONNECTION_STATE_EVT.

    Public Members

    bool connected

      whether AVRC connection is set up

    esp_bd_addr_t remote_bda

      remote bluetooth device address

  struct avrc_tg_init_stat_param
    #include <esp_avrc_api.h>

    ESP_AVRC_TG_PROF_STATE_EVT.

    Public Members

    esp_avrc_init_state_t state

      avrc tg initialization param

  struct avrc_tg_psth_cmd_param
    #include <esp_avrc_api.h>

    ESP_AVRC_TG_PASSTHROUGH_CMD_EVT.

    Public Members

    uint8_t key_code

      passthrough command code

    uint8_t key_state

      0 for PRESSED, 1 for RELEASED

  struct avrc_tg_reg_ntf_param
    #include <esp_avrc_api.h>

    ESP_AVRC_TG_REGISTER_NOTIFICATION_EVT.

    Public Members

    uint8_t event_id

      event id of AVRC RegisterNotification

    uint32_t event_parameter

      event notification parameter

  struct avrc_tg_rmt_feats_param
    #include <esp_avrc_api.h>

    ESP_AVRC_TG_REMOTE_FEATURES_EVT.

    Public Members

    uint32_t feat_mask

      AVRC feature mask of remote device

    uint16_t ct_feat_flag

      feature flag of remote device as CT

    esp_bd_addr_t remote_bda

      remote bluetooth device address

  struct avrc_tg_set_abs_vol_param
    #include <esp_avrc_api.h>

    ESP_AVRC_TG_SET_ABSOLUTE_VOLUME_CMD_EVT.

    Public Members

    uint8_t volume

      volume ranges from 0 to 127

  struct avrc_tg_set_app_value_param
    #include <esp_avrc_api.h>

    ESP_AVRC_TG_SET_PLAYER_APP_VALUE_EVT.

    Public Members

    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

### Structures

struct esp_avrc_psth_bit_mask_t

  AVRC passthrough command bit mask.

  Public Members

  uint16_t bits[8]

    bit mask representation of PASSTHROUGH commands

struct esp_avrc_rn_evt_cap_mask_t

  AVRC target notification event capability bit mask.

  Public Members

  uint16_t bits

    bit mask representation of PASSTHROUGH commands

struct esp_avrc_set_app_value_param_t

  AVRCP set app value parameters.

  Public Members

  uint8_t attr_id

    player application attribute id

  uint8_t attr_val

    player application attribute value

struct esp_avrc_profile_status_t

  AVRCP profile status parameters.

  Public Members

  bool avrc_ct_inited

    AVRCP CT initialization

  bool avrc_tg_inited

    AVRCP TG initialization

  uint8_t ct_cover_art_conn_num

    Number of cover art client connections

### Macros

ESP_AVRC_TRANS_LABEL_MAX

  max transaction label

ESP_AVRC_CA_IMAGE_HANDLE_LEN

ESP_AVRC_CA_MTU_MIN

ESP_AVRC_CA_MTU_MAX

### Type Definitions

typedef void (*esp_avrc_ct_cb_t)(esp_avrc_ct_cb_event_t event, esp_avrc_ct_cb_param_t *param)

  AVRCP controller callback function type.

  Param event:

    : Event type

  Param param:

    : Pointer to callback parameter union

typedef void (*esp_avrc_tg_cb_t)(esp_avrc_tg_cb_event_t event, esp_avrc_tg_cb_param_t *param)

  AVRCP target callback function type.

  Param event:

    : Event type

  Param param:

    : Pointer to callback parameter union

### Enumerations

enum esp_avrc_features_t

  AVRC feature bit mask.

  Values:

  enumerator ESP_AVRC_FEAT_RCTG

    remote control target

  enumerator ESP_AVRC_FEAT_RCCT

    remote control controller

  enumerator ESP_AVRC_FEAT_VENDOR

    remote control vendor dependent commands

  enumerator ESP_AVRC_FEAT_BROWSE

    use browsing channel

  enumerator ESP_AVRC_FEAT_META_DATA

    remote control metadata transfer command/response

  enumerator ESP_AVRC_FEAT_ADV_CTRL

    remote control advanced control command/response

enum esp_avrc_feature_flag_t

  AVRC supported features flag retrieved in SDP record.

  Values:

  enumerator ESP_AVRC_FEAT_FLAG_CAT1

    category 1

  enumerator ESP_AVRC_FEAT_FLAG_CAT2

    category 2

  enumerator ESP_AVRC_FEAT_FLAG_CAT3

    category 3

  enumerator ESP_AVRC_FEAT_FLAG_CAT4

    category 4

  enumerator ESP_AVRC_FEAT_FLAG_BROWSING

    browsing

  enumerator ESP_AVRC_FEAT_FLAG_COVER_ART_GET_IMAGE_PROP

    CT support Cover Art GetImageProperties

  enumerator ESP_AVRC_FEAT_FLAG_COVER_ART_GET_IMAGE

    CT support Cover Art GetImage

  enumerator ESP_AVRC_FEAT_FLAG_COVER_ART_GET_LINKED_THUMBNAIL

    CT support Cover Art GetLinkedThumbnail

  enumerator ESP_AVRC_FEAT_FLAG_TG_COVER_ART

    TG support Cover Art

enum esp_avrc_pt_cmd_t

  AVRC passthrough command code.

  Values:

  enumerator ESP_AVRC_PT_CMD_SELECT

    select

  enumerator ESP_AVRC_PT_CMD_UP

    up

  enumerator ESP_AVRC_PT_CMD_DOWN

    down

  enumerator ESP_AVRC_PT_CMD_LEFT

    left

  enumerator ESP_AVRC_PT_CMD_RIGHT

    right

  enumerator ESP_AVRC_PT_CMD_RIGHT_UP

    right-up

  enumerator ESP_AVRC_PT_CMD_RIGHT_DOWN

    right-down

  enumerator ESP_AVRC_PT_CMD_LEFT_UP

    left-up

  enumerator ESP_AVRC_PT_CMD_LEFT_DOWN

    left-down

  enumerator ESP_AVRC_PT_CMD_ROOT_MENU

    root menu

  enumerator ESP_AVRC_PT_CMD_SETUP_MENU

    setup menu

  enumerator ESP_AVRC_PT_CMD_CONT_MENU

    contents menu

  enumerator ESP_AVRC_PT_CMD_FAV_MENU

    favorite menu

  enumerator ESP_AVRC_PT_CMD_EXIT

    exit

  enumerator ESP_AVRC_PT_CMD_0

    0

  enumerator ESP_AVRC_PT_CMD_1

    1

  enumerator ESP_AVRC_PT_CMD_2

    2

  enumerator ESP_AVRC_PT_CMD_3

    3

  enumerator ESP_AVRC_PT_CMD_4

    4

  enumerator ESP_AVRC_PT_CMD_5

    5

  enumerator ESP_AVRC_PT_CMD_6

    6

  enumerator ESP_AVRC_PT_CMD_7

    7

  enumerator ESP_AVRC_PT_CMD_8

    8

  enumerator ESP_AVRC_PT_CMD_9

    9

  enumerator ESP_AVRC_PT_CMD_DOT

    dot

  enumerator ESP_AVRC_PT_CMD_ENTER

    enter

  enumerator ESP_AVRC_PT_CMD_CLEAR

    clear

  enumerator ESP_AVRC_PT_CMD_CHAN_UP

    channel up

  enumerator ESP_AVRC_PT_CMD_CHAN_DOWN

    channel down

  enumerator ESP_AVRC_PT_CMD_PREV_CHAN

    previous channel

  enumerator ESP_AVRC_PT_CMD_SOUND_SEL

    sound select

  enumerator ESP_AVRC_PT_CMD_INPUT_SEL

    input select

  enumerator ESP_AVRC_PT_CMD_DISP_INFO

    display information

  enumerator ESP_AVRC_PT_CMD_HELP

    help

  enumerator ESP_AVRC_PT_CMD_PAGE_UP

    page up

  enumerator ESP_AVRC_PT_CMD_PAGE_DOWN

    page down

  enumerator ESP_AVRC_PT_CMD_POWER

    power

  enumerator ESP_AVRC_PT_CMD_VOL_UP

    volume up

  enumerator ESP_AVRC_PT_CMD_VOL_DOWN

    volume down

  enumerator ESP_AVRC_PT_CMD_MUTE

    mute

  enumerator ESP_AVRC_PT_CMD_PLAY

    play

  enumerator ESP_AVRC_PT_CMD_STOP

    stop

  enumerator ESP_AVRC_PT_CMD_PAUSE

    pause

  enumerator ESP_AVRC_PT_CMD_RECORD

    record

  enumerator ESP_AVRC_PT_CMD_REWIND

    rewind

  enumerator ESP_AVRC_PT_CMD_FAST_FORWARD

    fast forward

  enumerator ESP_AVRC_PT_CMD_EJECT

    eject

  enumerator ESP_AVRC_PT_CMD_FORWARD

    forward

  enumerator ESP_AVRC_PT_CMD_BACKWARD

    backward

  enumerator ESP_AVRC_PT_CMD_ANGLE

    angle

  enumerator ESP_AVRC_PT_CMD_SUBPICT

    subpicture

  enumerator ESP_AVRC_PT_CMD_F1

    F1

  enumerator ESP_AVRC_PT_CMD_F2

    F2

  enumerator ESP_AVRC_PT_CMD_F3

    F3

  enumerator ESP_AVRC_PT_CMD_F4

    F4

  enumerator ESP_AVRC_PT_CMD_F5

    F5

  enumerator ESP_AVRC_PT_CMD_VENDOR

    vendor unique

enum esp_avrc_psth_filter_t

  AVRC passthrough command filter.

  Values:

  enumerator ESP_AVRC_PSTH_FILTER_ALLOWED_CMD

    all of the PASSTHROUGH commands that can possibly be used, immutable

  enumerator ESP_AVRC_PSTH_FILTER_SUPPORTED_CMD

    PASSTHROUGH commands selectively supported according to the current configuration

  enumerator ESP_AVRC_PSTH_FILTER_SUPPORT_MAX

enum esp_avrc_bit_mask_op_t

  Values:

  enumerator ESP_AVRC_BIT_MASK_OP_TEST

    operation code to test a specific bit

  enumerator ESP_AVRC_BIT_MASK_OP_SET

    operation code to set a specific bit

  enumerator ESP_AVRC_BIT_MASK_OP_CLEAR

    operation code to clear a specific bit

enum esp_avrc_pt_cmd_state_t

  AVRC passthrough command state.

  Values:

  enumerator ESP_AVRC_PT_CMD_STATE_PRESSED

    key pressed

  enumerator ESP_AVRC_PT_CMD_STATE_RELEASED

    key released

enum esp_avrc_ct_cb_event_t

  AVRC Controller callback events.

  Values:

  enumerator ESP_AVRC_CT_CONNECTION_STATE_EVT

    connection state changed event

  enumerator ESP_AVRC_CT_PASSTHROUGH_RSP_EVT

    passthrough response event

  enumerator ESP_AVRC_CT_METADATA_RSP_EVT

    metadata response event

  enumerator ESP_AVRC_CT_PLAY_STATUS_RSP_EVT

    play status response event

  enumerator ESP_AVRC_CT_CHANGE_NOTIFY_EVT

    notification event

  enumerator ESP_AVRC_CT_REMOTE_FEATURES_EVT

    feature of remote device indication event

  enumerator ESP_AVRC_CT_GET_RN_CAPABILITIES_RSP_EVT

    supported notification events capability of peer device

  enumerator ESP_AVRC_CT_SET_ABSOLUTE_VOLUME_RSP_EVT

    set absolute volume response event

  enumerator ESP_AVRC_CT_COVER_ART_STATE_EVT

    cover art client connection state changed event

  enumerator ESP_AVRC_CT_COVER_ART_DATA_EVT

    cover art client data event

  enumerator ESP_AVRC_CT_PROF_STATE_EVT

    Indicate AVRCP controller init or deinit complete

enum esp_avrc_tg_cb_event_t

  AVRC Target callback events.

  Values:

  enumerator ESP_AVRC_TG_CONNECTION_STATE_EVT

    connection state changed event

  enumerator ESP_AVRC_TG_REMOTE_FEATURES_EVT

    feature of remote device indication event

  enumerator ESP_AVRC_TG_PASSTHROUGH_CMD_EVT

    passthrough command event

  enumerator ESP_AVRC_TG_SET_ABSOLUTE_VOLUME_CMD_EVT

    set absolute volume command from remote device

  enumerator ESP_AVRC_TG_REGISTER_NOTIFICATION_EVT

    register notification event

  enumerator ESP_AVRC_TG_SET_PLAYER_APP_VALUE_EVT

    set application attribute value, attribute refer to esp_avrc_ps_attr_ids_t

  enumerator ESP_AVRC_TG_PROF_STATE_EVT

    Indicate AVRCP target init or deinit complete

enum esp_avrc_md_attr_mask_t

  AVRC metadata attribute mask.

  Values:

  enumerator ESP_AVRC_MD_ATTR_TITLE

    title of the playing track

  enumerator ESP_AVRC_MD_ATTR_ARTIST

    track artist

  enumerator ESP_AVRC_MD_ATTR_ALBUM

    album name

  enumerator ESP_AVRC_MD_ATTR_TRACK_NUM

    track position on the album

  enumerator ESP_AVRC_MD_ATTR_NUM_TRACKS

    number of tracks on the album

  enumerator ESP_AVRC_MD_ATTR_GENRE

    track genre

  enumerator ESP_AVRC_MD_ATTR_PLAYING_TIME

    total album playing time in milliseconds

  enumerator ESP_AVRC_MD_ATTR_COVER_ART

    cover art image handle

enum esp_avrc_rn_event_ids_t

  AVRC event notification ids.

  Values:

  enumerator ESP_AVRC_RN_PLAY_STATUS_CHANGE

    track status change, eg. from playing to paused

  enumerator ESP_AVRC_RN_TRACK_CHANGE

    new track is loaded

  enumerator ESP_AVRC_RN_TRACK_REACHED_END

    current track reached end

  enumerator ESP_AVRC_RN_TRACK_REACHED_START

    current track reached start position

  enumerator ESP_AVRC_RN_PLAY_POS_CHANGED

    track playing position changed

  enumerator ESP_AVRC_RN_BATTERY_STATUS_CHANGE

    battery status changed

  enumerator ESP_AVRC_RN_SYSTEM_STATUS_CHANGE

    system status changed

  enumerator ESP_AVRC_RN_APP_SETTING_CHANGE

    application settings changed

  enumerator ESP_AVRC_RN_NOW_PLAYING_CHANGE

    now playing content changed

  enumerator ESP_AVRC_RN_AVAILABLE_PLAYERS_CHANGE

    available players changed

  enumerator ESP_AVRC_RN_ADDRESSED_PLAYER_CHANGE

    the addressed player changed

  enumerator ESP_AVRC_RN_UIDS_CHANGE

    UIDs changed

  enumerator ESP_AVRC_RN_VOLUME_CHANGE

    volume changed locally on TG

  enumerator ESP_AVRC_RN_MAX_EVT

enum esp_avrc_rn_evt_cap_t

  AVRC target notification event notification capability.

  Values:

  enumerator ESP_AVRC_RN_CAP_ALLOWED_EVT

    all of the notification events that can possibly be supported, immutable

  enumerator ESP_AVRC_RN_CAP_SUPPORTED_EVT

    notification events selectively supported according to the current configuration

  enumerator ESP_AVRC_RN_CAP_MAX

enum esp_avrc_rn_rsp_t

  AVRC notification response type.

  Values:

  enumerator ESP_AVRC_RN_RSP_INTERIM

    initial response to RegisterNotification, should be sent T_mtp(1000ms) from receiving the command

  enumerator ESP_AVRC_RN_RSP_CHANGED

    final response to RegisterNotification command

enum esp_avrc_ps_attr_ids_t

  AVRC player setting ids.

  Values:

  enumerator ESP_AVRC_PS_EQUALIZER

    equalizer, on or off

  enumerator ESP_AVRC_PS_REPEAT_MODE

    repeat mode

  enumerator ESP_AVRC_PS_SHUFFLE_MODE

    shuffle mode

  enumerator ESP_AVRC_PS_SCAN_MODE

    scan mode on or off

  enumerator ESP_AVRC_PS_MAX_ATTR

enum esp_avrc_ps_eq_value_ids_t

  AVRC equalizer modes.

  Values:

  enumerator ESP_AVRC_PS_EQUALIZER_OFF

    equalizer OFF

  enumerator ESP_AVRC_PS_EQUALIZER_ON

    equalizer ON

enum esp_avrc_ps_rpt_value_ids_t

  AVRC repeat modes.

  Values:

  enumerator ESP_AVRC_PS_REPEAT_OFF

    repeat mode off

  enumerator ESP_AVRC_PS_REPEAT_SINGLE

    single track repeat

  enumerator ESP_AVRC_PS_REPEAT_GROUP

    group repeat

enum esp_avrc_ps_shf_value_ids_t

  AVRC shuffle modes.

  Values:

  enumerator ESP_AVRC_PS_SHUFFLE_OFF
  enumerator ESP_AVRC_PS_SHUFFLE_ALL
  enumerator ESP_AVRC_PS_SHUFFLE_GROUP

enum esp_avrc_ps_scn_value_ids_t

  AVRC scan modes.

  Values:

  enumerator ESP_AVRC_PS_SCAN_OFF

    scan off

  enumerator ESP_AVRC_PS_SCAN_ALL

    all tracks scan

  enumerator ESP_AVRC_PS_SCAN_GROUP

    group scan

enum esp_avrc_rsp_t

  AVCTP response codes.

  Values:

  enumerator ESP_AVRC_RSP_NOT_IMPL

    not implemented

  enumerator ESP_AVRC_RSP_ACCEPT

    accept

  enumerator ESP_AVRC_RSP_REJECT

    reject

  enumerator ESP_AVRC_RSP_IN_TRANS

    in transition

  enumerator ESP_AVRC_RSP_IMPL_STBL

    implemented/stable

  enumerator ESP_AVRC_RSP_CHANGED

    changed

  enumerator ESP_AVRC_RSP_INTERIM

    interim

enum esp_avrc_batt_stat_t

  AVRCP battery status.

  Values:

  enumerator ESP_AVRC_BATT_NORMAL

    normal state

  enumerator ESP_AVRC_BATT_WARNING

    unable to operate soon

  enumerator ESP_AVRC_BATT_CRITICAL

    cannot operate any more

  enumerator ESP_AVRC_BATT_EXTERNAL

    plugged to external power supply

  enumerator ESP_AVRC_BATT_FULL_CHARGE

    when completely charged from external power supply

enum esp_avrc_playback_stat_t

  AVRCP current status of playback.

  Values:

  enumerator ESP_AVRC_PLAYBACK_STOPPED

    stopped

  enumerator ESP_AVRC_PLAYBACK_PLAYING

    playing

  enumerator ESP_AVRC_PLAYBACK_PAUSED

    paused

  enumerator ESP_AVRC_PLAYBACK_FWD_SEEK

    forward seek

  enumerator ESP_AVRC_PLAYBACK_REV_SEEK

    reverse seek

  enumerator ESP_AVRC_PLAYBACK_ERROR

    error

enum esp_avrc_cover_art_conn_state_t

  AVRC Cover Art connection error code.

  Values:

  enumerator ESP_AVRC_COVER_ART_DISCONNECTED

    Cover Art connection disconnected or connection failed

  enumerator ESP_AVRC_COVER_ART_CONNECTED

    Cover Art connection established

enum esp_avrc_init_state_t

  Bluetooth AVRCP Initiation states.

  Values:

  enumerator ESP_AVRC_INIT_SUCCESS

    Indicate init successful

  enumerator ESP_AVRC_INIT_ALREADY

    Indicate init repeated

  enumerator ESP_AVRC_INIT_FAIL

    Indicate init fail

  enumerator ESP_AVRC_DEINIT_SUCCESS

    Indicate deinit successful

  enumerator ESP_AVRC_DEINIT_ALREADY

    Indicate deinit repeated

  enumerator ESP_AVRC_DEINIT_FAIL

    Indicate deinit fail

此文档对您有帮助吗？

- 反馈已收到，谢谢！
- 如果您有其他意见，欢迎填写乐鑫文档反馈表。

- 我们重视您的反馈。
- 您可以填写乐鑫文档反馈表告诉我们如何改进该文档。