Bluetooth A2DP Profile

group BT_A2DP

Provide BT A2DP profile interfaces.

Typedefs

typedef enum t_bt_a2dp_role T_BT_A2DP_ROLE

BT A2DP role.

typedef enum t_bt_a2dp_lhdc_min_bitrate T_BT_A2DP_LHDC_MIN_BITRATE

BT A2DP LHDC minimum bitrate.

typedef enum t_bt_a2dp_lhdc_max_bitrate T_BT_A2DP_LHDC_MAX_BITRATE

BT A2DP LHDC maximum bitrate.

typedef struct t_bt_a2dp_media_codec_sbc T_BT_A2DP_MEDIA_CODEC_SBC

BT A2DP media codec SBC.

typedef struct t_bt_a2dp_media_codec_aac T_BT_A2DP_MEDIA_CODEC_AAC

BT A2DP media codec AAC.

typedef struct t_bt_a2dp_media_codec_usac T_BT_A2DP_MEDIA_CODEC_USAC

BT A2DP media codec USAC.

typedef struct t_bt_a2dp_media_codec_ldac T_BT_A2DP_MEDIA_CODEC_LDAC

BT A2DP media codec LDAC.

typedef struct t_bt_a2dp_media_codec_lc3 T_BT_A2DP_MEDIA_CODEC_LC3

BT A2DP media codec LC3.

typedef struct t_bt_a2dp_media_codec_lhdc T_BT_A2DP_MEDIA_CODEC_LHDC

BT A2DP media codec LHDC.

typedef struct t_bt_a2dp_stream_endpoint T_BT_A2DP_STREAM_ENDPOINT

BT A2DP stream endpoint.

Enums

enum t_bt_a2dp_role

BT A2DP role.

Values:

enumerator BT_A2DP_ROLE_SRC
enumerator BT_A2DP_ROLE_SNK
enum t_bt_a2dp_lhdc_min_bitrate

BT A2DP LHDC minimum bitrate.

Values:

enumerator BT_A2DP_LHDC_MIN_BITRATE_AUTO_ADJUST_LOW

No lower limit, but re-adjusted by specific rules: 44.1/48KHz: 64kbps (re-adjusted to at least 64Kbps); 96/192KHz: 256kbps (re-adjusted to at least 256Kbps).

enumerator BT_A2DP_LHDC_MIN_BITRATE_AUTO_ADJUST_HIGH

No lower limit, but re-adjusted by specific rules: 44.1/48KHz: 128kbps (re-adjusted to at least 128Kbps); 96/192KHz: 256kbps (re-adjusted to at least 256Kbps).

enumerator BT_A2DP_LHDC_MIN_BITRATE_256KBPS

Minimum bitrate 256Kbps.

enumerator BT_A2DP_LHDC_MIN_BITRATE_400KBPS

Minimum bitrate 400Kbps.

enum t_bt_a2dp_lhdc_max_bitrate

BT A2DP LHDC maximum bitrate.

Values:

enumerator BT_A2DP_LHDC_MAX_BITRATE_AUTO_ADJUST

Re-adjusted by specific rules: 44.1KHz: 900kbps (re-adjusted to at most 900Kbps); 48KHz: 900kbps (re-adjusted to at most 900Kbps); 96/192KHz: 1000kbps (re-adjusted to at most 900Kbps).

enumerator BT_A2DP_LHDC_MAX_BITRATE_400KBPS

Maximum bitrate 400Kbps.

enumerator BT_A2DP_LHDC_MAX_BITRATE_500KBPS

Maximum bitrate 500Kbps.

enumerator BT_A2DP_LHDC_MAX_BITRATE_900KBPS

Maximum bitrate 900Kbps.

Functions

bool bt_a2dp_stream_endpoint_add(T_BT_A2DP_STREAM_ENDPOINT sep)

Add A2DP stream endpoint.

Note

Stream endpoint must be added when all A2DP profile links were disconnected.

Parameters:

sep[in] A2DP stream endpoint T_BT_A2DP_STREAM_ENDPOINT.

Return values:
  • true – A2DP stream endpoint was added successfully.

  • false – A2DP stream endpoint was failed to add.

Returns:

The status of adding A2DP stream endpoint.

bool bt_a2dp_stream_endpoint_delete(T_BT_A2DP_STREAM_ENDPOINT sep)

Delete A2DP stream endpoint.

Experimental Added Since 2.13.0.0:

Note

Stream endpoint must be deleted when all A2DP profile links were disconnected.

Parameters:

sep[in] A2DP stream endpoint T_BT_A2DP_STREAM_ENDPOINT.

Return values:
  • true – A2DP stream endpoint was deleted successfully.

  • false – A2DP stream endpoint was failed to delete.

Returns:

The status of deleting A2DP stream endpoint.

bool bt_a2dp_init(uint8_t service_capabilities, uint16_t delay)

Initialize A2DP profile.

Parameters:
  • service_capabilities[in] A2DP supported service capabilities bitmask BT A2DP Service Capabilities.

  • delay[in] The delay reporting feature enables synchronization of audio and video playback by reporting of SNK delay values caused by buffering, decoding and rendering.

Return values:
  • true – A2DP profile was initialized successfully.

  • false – A2DP profile was failed to initialize.

Returns:

The status of initializing A2DP profile.

bool bt_a2dp_connect_req(uint8_t bd_addr[6], uint16_t avdtp_ver, T_BT_A2DP_ROLE role)

Send an A2DP connection request.

Parameters:
  • bd_addr[in] Remote BT address.

  • avdtp_ver[in] Remote AVDTP version.

  • role[in] Remote AVDTP role.

Return values:
  • true – A2DP connection request was sent successfully.

  • false – A2DP connection request was failed to send.

Returns:

The status of sending the A2DP connection request.

bool bt_a2dp_disconnect_req(uint8_t bd_addr[6])

Send an A2DP disconnection request.

Parameters:

bd_addr[in] Remote BT address.

Return values:
  • true – A2DP disconnection request was sent successfully.

  • false – A2DP disconnection request was failed to send.

Returns:

The status of sending the A2DP disconnection request.

bool bt_a2dp_connect_cfm(uint8_t bd_addr[6], bool accept)

Send an A2DP connection confirmation.

Parameters:
  • bd_addr[in] Remote BT address.

  • accept[in] Accept or reject the connection indication.

    • true Accept the connection indication.

    • false Reject the connection indication.

Return values:
  • true – A2DP connection confirmation was sent successfully.

  • false – A2DP connection confirmation was failed to send.

Returns:

The status of sending the A2DP connection confirmation.

bool bt_a2dp_stream_start_cfm(uint8_t bd_addr[6], bool accept)

Send an A2DP stream start confirmation.

Parameters:
  • bd_addr[in] Remote BT address.

  • accept[in] Accept or reject the stream start indication.

    • true Accept the stream start indication.

    • false Reject the stream start indication.

Return values:
  • true – A2DP stream start confirmation was sent successfully.

  • false – A2DP stream start confirmation was failed to send.

Returns:

The status of sending the A2DP stream start confirmation.

bool bt_a2dp_stream_open_req(uint8_t bd_addr[6], T_BT_A2DP_ROLE role)

Send an A2DP stream channel open request.

Parameters:
  • bd_addr[in] Remote BT address.

  • role[in] Remote AVDTP role.

Return values:
  • true – A2DP stream channel open request was sent successfully.

  • false – A2DP stream channel open request was failed to send.

Returns:

The status of sending the A2DP stream channel open request.

bool bt_a2dp_stream_start_req(uint8_t bd_addr[6])

Send an A2DP stream channel start request.

Parameters:

bd_addr[in] Remote BT address.

Return values:
  • true – A2DP stream channel start request was sent successfully.

  • false – A2DP stream channel start request was failed to send.

Returns:

The status of sending the A2DP stream channel start request.

bool bt_a2dp_stream_data_send(uint8_t bd_addr[6], uint16_t seq_num, uint32_t time_stamp, uint8_t frame_num, uint8_t *frame_buf, uint16_t len)

Send A2DP stream data.

Parameters:
  • bd_addr[in] Remote BT address.

  • seq_num[in] The sequence number of the stream data.

  • time_stamp[in] The sampling instant of the first octet which determined from the sampling clock is to be used.

  • frame_num[in] The frame number of the stream data.

  • frame_buf[in] The start address of the data buffer.

  • len[in] The length of the data.

Return values:
  • true – A2DP stream data was sent successfully.

  • false – A2DP stream data was failed to send.

Returns:

The status of sending A2DP stream data.

bool bt_a2dp_stream_close_req(uint8_t bd_addr[6])

Send an A2DP stream channel close request.

Parameters:

bd_addr[in] Remote BT address.

Return values:
  • true – A2DP stream channel close request was sent successfully.

  • false – A2DP stream channel close request was failed to send.

Returns:

The status of sending the A2DP stream channel close request.

bool bt_a2dp_stream_suspend_req(uint8_t bd_addr[6])

Send an A2DP stream channel suspend request.

Parameters:

bd_addr[in] Remote BT address.

Return values:
  • true – A2DP stream channel suspend request was sent successfully.

  • false – A2DP stream channel suspend request was failed to send.

Returns:

The status of sending the A2DP stream channel suspend request.

bool bt_a2dp_stream_abort_req(uint8_t bd_addr[6])

Send an A2DP stream channel abort request.

Parameters:

bd_addr[in] Remote BT address.

Return values:
  • true – A2DP stream channel abort request was sent successfully.

  • false – A2DP stream channel abort request was failed to send.

Returns:

The status of sending the A2DP stream channel abort request.

Set an active A2DP stream link for A2DP multi-links.

Parameters:

bd_addr[in] Remote BT address.

Return values:
  • true – Active A2DP stream link was set successfully.

  • false – Active A2DP stream link was failed to set.

Returns:

The status of setting the active A2DP stream link.

bool bt_a2dp_stream_delay_report_request(uint8_t bd_addr[6], uint16_t delay)

Set A2DP stream latency.

Parameters:
  • bd_addr[in] Remote BT address.

  • delay[in] The delay reporting feature enables synchronization of audio and video playback by reporting of SNK delay values caused by buffering, decoding and rendering.

Return values:
  • true – Set A2DP stream latency was set successfully.

  • false – Set A2DP stream latency was failed to set.

Returns:

The status of setting the A2DP stream latency.

struct t_bt_a2dp_media_codec_sbc

BT A2DP media codec SBC.

Public Members

uint8_t sampling_frequency_mask
uint8_t channel_mode_mask
uint8_t block_length_mask
uint8_t subbands_mask
uint8_t allocation_method_mask
uint8_t min_bitpool
uint8_t max_bitpool
struct t_bt_a2dp_media_codec_aac

BT A2DP media codec AAC.

Public Members

uint8_t object_type_mask
uint16_t sampling_frequency_mask
uint8_t channel_number_mask
bool vbr_supported
uint32_t bit_rate
struct t_bt_a2dp_media_codec_usac

BT A2DP media codec USAC.

Public Members

uint8_t object_type_mask
uint32_t sampling_frequency_mask
uint8_t channel_number_mask
bool vbr_supported
uint32_t bit_rate
struct t_bt_a2dp_media_codec_ldac

BT A2DP media codec LDAC.

Public Members

uint8_t sampling_frequency_mask
uint8_t channel_mode_mask
struct t_bt_a2dp_media_codec_lc3

BT A2DP media codec LC3.

Public Members

uint8_t sampling_frequency_mask
uint8_t channel_num_mask
uint8_t frame_duration_mask
uint16_t frame_length
struct t_bt_a2dp_media_codec_lhdc

BT A2DP media codec LHDC.

Public Members

uint8_t sampling_frequency_mask
T_BT_A2DP_LHDC_MIN_BITRATE min_bitrate
T_BT_A2DP_LHDC_MAX_BITRATE max_bitrate
uint8_t bit_depth_mask
uint8_t version_number
bool low_latency
bool meta
bool jas
bool ar
struct t_bt_a2dp_stream_endpoint

BT A2DP stream endpoint.