Zephyr API Documentation 4.0.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
a2dp.h File Reference

Advanced Audio Distribution Profile header. More...

Go to the source code of this file.

Data Structures

struct  bt_a2dp_codec_ie
 codec information elements for the endpoint More...
 
struct  bt_a2dp_codec_cfg
 The endpoint configuration. More...
 
struct  bt_a2dp_ep
 Stream End Point. More...
 
struct  bt_a2dp_ep_info
 
struct  bt_a2dp_discover_param
 
struct  bt_a2dp_cb
 The connecting callback. More...
 
struct  bt_a2dp_stream
 A2DP Stream. More...
 
struct  bt_a2dp_stream_ops
 The stream endpoint related operations. More...
 

Macros

#define BT_A2DP_STREAM_BUF_RESERVE   (12u + BT_L2CAP_BUF_SIZE(0))
 
#define BT_A2DP_SBC_IE_LENGTH   (4u)
 SBC IE length.
 
#define BT_A2DP_MPEG_1_2_IE_LENGTH   (4u)
 MPEG1,2 IE length.
 
#define BT_A2DP_MPEG_2_4_IE_LENGTH   (6u)
 MPEG2,4 IE length.
 
#define A2DP_MAX_IE_LENGTH   (8U)
 The max IE (Codec Info Element) length.
 
#define BT_A2DP_EP_INIT(_role, _codec, _capability)
 define the audio endpoint
 
#define BT_A2DP_SINK_EP_INIT(_codec, _capability)
 define the audio sink endpoint
 
#define BT_A2DP_SOURCE_EP_INIT(_codec, _capability)
 define the audio source endpoint
 
#define BT_A2DP_SBC_SINK_EP(_name, _freq, _ch_mode, _blk_len, _subband, _alloc_mthd, _min_bitpool, _max_bitpool)
 define the SBC sink endpoint that can be used as bt_a2dp_register_endpoint's parameter.
 
#define BT_A2DP_SBC_SOURCE_EP(_name, _freq, _ch_mode, _blk_len, _subband, _alloc_mthd, _min_bitpool, _max_bitpool)
 define the SBC source endpoint that can be used as bt_a2dp_register_endpoint's parameter.
 
#define BT_A2DP_SBC_SINK_EP_DEFAULT(_name)
 define the default SBC sink endpoint that can be used as bt_a2dp_register_endpoint's parameter.
 
#define BT_A2DP_SBC_SOURCE_EP_DEFAULT(_name)
 define the default SBC source endpoint that can be used as bt_a2dp_register_endpoint's parameter.
 
#define BT_A2DP_SBC_EP_CFG(_name, _freq_cfg, _ch_mode_cfg, _blk_len_cfg, _subband_cfg, _alloc_mthd_cfg, _min_bitpool_cfg, _max_bitpool_cfg)
 define the SBC default configuration.
 
#define BT_A2DP_SBC_EP_CFG_DEFAULT(_name, _freq_cfg)
 define the SBC default configuration.
 

Typedefs

typedef uint8_t(* bt_a2dp_discover_ep_cb) (struct bt_a2dp *a2dp, struct bt_a2dp_ep_info *info, struct bt_a2dp_ep **ep)
 Called when a stream endpoint is discovered.
 

Enumerations

enum  bt_a2dp_err_code {
  BT_A2DP_INVALID_CODEC_TYPE = 0xC1 , BT_A2DP_NOT_SUPPORTED_CODEC_TYPE = 0xC2 , BT_A2DP_INVALID_SAMPLING_FREQUENCY = 0xC3 , BT_A2DP_NOT_SUPPORTED_SAMPLING_FREQUENCY = 0xC4 ,
  BT_A2DP_INVALID_CHANNEL_MODE = 0xC5 , BT_A2DP_NOT_SUPPORTED_CHANNEL_MODE = 0xC6 , BT_A2DP_INVALID_SUBBANDS = 0xC7 , BT_A2DP_NOT_SUPPORTED_SUBBANDS = 0xC8 ,
  BT_A2DP_INVALID_ALLOCATION_METHOD = 0xC9 , BT_A2DP_NOT_SUPPORTED_ALLOCATION_METHOD = 0xCA , BT_A2DP_INVALID_MINIMUM_BITPOOL_VALUE = 0xCB , BT_A2DP_NOT_SUPPORTED_MINIMUM_BITPOOL_VALUE = 0xCC ,
  BT_A2DP_INVALID_MAXIMUM_BITPOOL_VALUE = 0xCD , BT_A2DP_NOT_SUPPORTED_MAXIMUM_BITPOOL_VALUE = 0xCE , BT_A2DP_INVALID_LAYER = 0xCF , BT_A2DP_NOT_SUPPORTED_LAYER = 0xD0 ,
  BT_A2DP_NOT_SUPPORTED_CRC = 0xD1 , BT_A2DP_NOT_SUPPORTED_MPF = 0xD2 , BT_A2DP_NOT_SUPPORTED_VBR = 0xD3 , BT_A2DP_INVALID_BIT_RATE = 0xD4 ,
  BT_A2DP_NOT_SUPPORTED_BIT_RATE = 0xD5 , BT_A2DP_INVALID_OBJECT_TYPE = 0xD6 , BT_A2DP_NOT_SUPPORTED_OBJECT_TYPE = 0xD7 , BT_A2DP_INVALID_CHANNELS = 0xD8 ,
  BT_A2DP_NOT_SUPPORTED_CHANNELS = 0xD9 , BT_A2DP_INVALID_VERSION = 0xDA , BT_A2DP_NOT_SUPPORTED_VERSION = 0xDB , BT_A2DP_NOT_SUPPORTED_MAXIMUM_SUL = 0xDC ,
  BT_A2DP_INVALID_BLOCK_LENGTH = 0xDD , BT_A2DP_INVALID_CP_TYPE = 0xE0 , BT_A2DP_INVALID_CP_FORMAT = 0xE1 , BT_A2DP_INVALID_CODEC_PARAMETER = 0xE2 ,
  BT_A2DP_NOT_SUPPORTED_CODEC_PARAMETER = 0xE3 , BT_A2DP_INVALID_DRC = 0xE4 , BT_A2DP_NOT_SUPPORTED_DRC = 0xE5
}
 A2DP error code. More...
 
enum  bt_a2dp_codec_type {
  BT_A2DP_SBC = 0x00 , BT_A2DP_MPEG1 = 0x01 , BT_A2DP_MPEG2 = 0x02 , BT_A2DP_ATRAC = 0x04 ,
  BT_A2DP_VENDOR = 0xff
}
 Codec Type. More...
 
enum  { BT_A2DP_DISCOVER_EP_STOP = 0 , BT_A2DP_DISCOVER_EP_CONTINUE }
 Helper enum to be used as return value of bt_a2dp_discover_ep_cb. More...
 

Functions

struct bt_a2dp * bt_a2dp_connect (struct bt_conn *conn)
 A2DP Connect.
 
int bt_a2dp_disconnect (struct bt_a2dp *a2dp)
 disconnect l2cap a2dp
 
int bt_a2dp_register_ep (struct bt_a2dp_ep *ep, uint8_t media_type, uint8_t role)
 Endpoint Registration.
 
int bt_a2dp_register_cb (struct bt_a2dp_cb *cb)
 register callback.
 
int bt_a2dp_discover (struct bt_a2dp *a2dp, struct bt_a2dp_discover_param *param)
 Discover remote endpoints.
 
void bt_a2dp_stream_cb_register (struct bt_a2dp_stream *stream, struct bt_a2dp_stream_ops *ops)
 Register Audio callbacks for a stream.
 
int bt_a2dp_stream_config (struct bt_a2dp *a2dp, struct bt_a2dp_stream *stream, struct bt_a2dp_ep *local_ep, struct bt_a2dp_ep *remote_ep, struct bt_a2dp_codec_cfg *config)
 configure endpoint.
 
int bt_a2dp_stream_establish (struct bt_a2dp_stream *stream)
 establish a2dp streamer.
 
int bt_a2dp_stream_release (struct bt_a2dp_stream *stream)
 release a2dp streamer.
 
int bt_a2dp_stream_start (struct bt_a2dp_stream *stream)
 start a2dp streamer.
 
int bt_a2dp_stream_suspend (struct bt_a2dp_stream *stream)
 suspend a2dp streamer.
 
int bt_a2dp_stream_reconfig (struct bt_a2dp_stream *stream, struct bt_a2dp_codec_cfg *config)
 re-configure a2dp streamer
 
uint32_t bt_a2dp_get_mtu (struct bt_a2dp_stream *stream)
 get the stream l2cap mtu
 

Detailed Description

Advanced Audio Distribution Profile header.

Macro Definition Documentation

◆ A2DP_MAX_IE_LENGTH

#define A2DP_MAX_IE_LENGTH   (8U)

The max IE (Codec Info Element) length.

◆ BT_A2DP_EP_INIT

#define BT_A2DP_EP_INIT ( _role,
_codec,
_capability )
Value:
{\
.codec_type = _codec,\
.sep = {.sep_info = {.media_type = BT_AVDTP_AUDIO, .tsep = _role}},\
.codec_cap = _capability,\
.stream = NULL,\
}
@ BT_AVDTP_AUDIO
Audio Media Type.
Definition avdtp.h:78

define the audio endpoint

Parameters
_roleBT_AVDTP_SOURCE or BT_AVDTP_SINK.
_codecvalue of enum bt_a2dp_codec_id.
_capabilitythe codec capability.

◆ BT_A2DP_MPEG_1_2_IE_LENGTH

#define BT_A2DP_MPEG_1_2_IE_LENGTH   (4u)

MPEG1,2 IE length.

◆ BT_A2DP_MPEG_2_4_IE_LENGTH

#define BT_A2DP_MPEG_2_4_IE_LENGTH   (6u)

MPEG2,4 IE length.

◆ BT_A2DP_SBC_EP_CFG

#define BT_A2DP_SBC_EP_CFG ( _name,
_freq_cfg,
_ch_mode_cfg,
_blk_len_cfg,
_subband_cfg,
_alloc_mthd_cfg,
_min_bitpool_cfg,
_max_bitpool_cfg )
Value:
static struct bt_a2dp_codec_ie bt_a2dp_codec_ie##_name = {\
.len = BT_A2DP_SBC_IE_LENGTH, .codec_ie = {_freq_cfg | _ch_mode_cfg,\
_blk_len_cfg | _subband_cfg | _alloc_mthd_cfg, _min_bitpool_cfg, _max_bitpool_cfg},};\
struct bt_a2dp_codec_cfg _name = {.codec_config = &bt_a2dp_codec_ie##_name,}
#define BT_A2DP_SBC_IE_LENGTH
SBC IE length.
Definition a2dp.h:27
The endpoint configuration.
Definition a2dp.h:302
codec information elements for the endpoint
Definition a2dp.h:294

define the SBC default configuration.

Parameters
_nameunique structure name postfix.
_freq_cfgsbc codec frequency. for example: A2DP_SBC_SAMP_FREQ_44100
_ch_mode_cfgsbc codec channel mode. for example: A2DP_SBC_CH_MODE_JOINT
_blk_len_cfgsbc codec block length. for example: A2DP_SBC_BLK_LEN_16
_subband_cfgsbc codec subband. for example: A2DP_SBC_SUBBAND_8
_alloc_mthd_cfgsbc codec allocate method. for example: A2DP_SBC_ALLOC_MTHD_LOUDNESS
_min_bitpool_cfgsbc codec min bit pool. for example: 18
_max_bitpool_cfgsbc codec max bit pool. for example: 35

◆ BT_A2DP_SBC_EP_CFG_DEFAULT

#define BT_A2DP_SBC_EP_CFG_DEFAULT ( _name,
_freq_cfg )
Value:
static struct bt_a2dp_codec_ie bt_a2dp_codec_ie##_name = {\
.len = BT_A2DP_SBC_IE_LENGTH, .codec_ie = {_freq_cfg | A2DP_SBC_CH_MODE_JOINT,\
struct bt_a2dp_codec_cfg _name = {.codec_config = &bt_a2dp_codec_ie##_name,}
#define A2DP_SBC_BLK_LEN_16
Definition a2dp_codec_sbc.h:44
#define A2DP_SBC_ALLOC_MTHD_LOUDNESS
Definition a2dp_codec_sbc.h:52
#define A2DP_SBC_SUBBAND_8
Definition a2dp_codec_sbc.h:48
#define A2DP_SBC_CH_MODE_JOINT
Definition a2dp_codec_sbc.h:38

define the SBC default configuration.

Parameters
_nameunique structure name postfix.
_freq_cfgthe frequency to configure the remote same codec type endpoint.

◆ BT_A2DP_SBC_IE_LENGTH

#define BT_A2DP_SBC_IE_LENGTH   (4u)

SBC IE length.

◆ BT_A2DP_SBC_SINK_EP

#define BT_A2DP_SBC_SINK_EP ( _name,
_freq,
_ch_mode,
_blk_len,
_subband,
_alloc_mthd,
_min_bitpool,
_max_bitpool )
Value:
static struct bt_a2dp_codec_ie bt_a2dp_ep_cap_ie##_name =\
{.len = BT_A2DP_SBC_IE_LENGTH, .codec_ie = {_freq | _ch_mode,\
_blk_len | _subband | _alloc_mthd, _min_bitpool, _max_bitpool}};\
(&bt_a2dp_ep_cap_ie##_name))
#define BT_A2DP_SINK_EP_INIT(_codec, _capability)
define the audio sink endpoint
Definition a2dp.h:52
@ BT_A2DP_SBC
Codec SBC.
Definition a2dp.h:276
Stream End Point.
Definition a2dp.h:308

define the SBC sink endpoint that can be used as bt_a2dp_register_endpoint's parameter.

SBC is mandatory as a2dp specification, BT_A2DP_SBC_SINK_EP_DEFAULT is more convenient for user to register SBC endpoint.

Parameters
_nameunique structure name postfix.
_freqsbc codec frequency. for example: A2DP_SBC_SAMP_FREQ_44100 | A2DP_SBC_SAMP_FREQ_48000
_ch_modesbc codec channel mode. for example: A2DP_SBC_CH_MODE_MONO | A2DP_SBC_CH_MODE_STREO
_blk_lensbc codec block length. for example: A2DP_SBC_BLK_LEN_16
_subbandsbc codec subband. for example: A2DP_SBC_SUBBAND_8
_alloc_mthdsbc codec allocate method. for example: A2DP_SBC_ALLOC_MTHD_LOUDNESS
_min_bitpoolsbc codec min bit pool. for example: 18
_max_bitpoolsbc codec max bit pool. for example: 35 @

◆ BT_A2DP_SBC_SINK_EP_DEFAULT

#define BT_A2DP_SBC_SINK_EP_DEFAULT ( _name)
Value:
static struct bt_a2dp_codec_ie bt_a2dp_ep_cap_ie##_name =\
&bt_a2dp_ep_cap_ie##_name)
#define A2DP_SBC_SAMP_FREQ_48000
Definition a2dp_codec_sbc.h:32
#define A2DP_SBC_SAMP_FREQ_44100
Definition a2dp_codec_sbc.h:31
#define A2DP_SBC_CH_MODE_MONO
Definition a2dp_codec_sbc.h:35
#define A2DP_SBC_CH_MODE_STREO
Definition a2dp_codec_sbc.h:37

define the default SBC sink endpoint that can be used as bt_a2dp_register_endpoint's parameter.

SBC is mandatory as a2dp specification, BT_A2DP_SBC_SINK_EP_DEFAULT is more convenient for user to register SBC endpoint.

Parameters
_namethe endpoint variable name.

◆ BT_A2DP_SBC_SOURCE_EP

#define BT_A2DP_SBC_SOURCE_EP ( _name,
_freq,
_ch_mode,
_blk_len,
_subband,
_alloc_mthd,
_min_bitpool,
_max_bitpool )
Value:
static struct bt_a2dp_codec_ie bt_a2dp_ep_cap_ie##_name =\
{.len = BT_A2DP_SBC_IE_LENGTH, .codec_ie = {_freq | _ch_mode,\
_blk_len | _subband | _alloc_mthd, _min_bitpool, _max_bitpool}};\
&bt_a2dp_ep_cap_ie##_name)
#define BT_A2DP_SOURCE_EP_INIT(_codec, _capability)
define the audio source endpoint
Definition a2dp.h:59

define the SBC source endpoint that can be used as bt_a2dp_register_endpoint's parameter.

SBC is mandatory as a2dp specification, BT_A2DP_SBC_SOURCE_EP_DEFAULT is more convenient for user to register SBC endpoint.

Parameters
_namethe endpoint variable name.
_freqsbc codec frequency. for example: A2DP_SBC_SAMP_FREQ_44100 | A2DP_SBC_SAMP_FREQ_48000
_ch_modesbc codec channel mode. for example: A2DP_SBC_CH_MODE_MONO | A2DP_SBC_CH_MODE_STREO
_blk_lensbc codec block length. for example: A2DP_SBC_BLK_LEN_16
_subbandsbc codec subband. for example: A2DP_SBC_SUBBAND_8
_alloc_mthdsbc codec allocate method. for example: A2DP_SBC_ALLOC_MTHD_LOUDNESS
_min_bitpoolsbc codec min bit pool. for example: 18
_max_bitpoolsbc codec max bit pool. for example: 35

◆ BT_A2DP_SBC_SOURCE_EP_DEFAULT

#define BT_A2DP_SBC_SOURCE_EP_DEFAULT ( _name)
Value:

define the default SBC source endpoint that can be used as bt_a2dp_register_endpoint's parameter.

SBC is mandatory as a2dp specification, BT_A2DP_SBC_SOURCE_EP_DEFAULT is more convenient for user to register SBC endpoint.

Parameters
_namethe endpoint variable name.

◆ BT_A2DP_SINK_EP_INIT

#define BT_A2DP_SINK_EP_INIT ( _codec,
_capability )
Value:
BT_A2DP_EP_INIT(BT_AVDTP_SINK, _codec, _capability)
#define BT_A2DP_EP_INIT(_role, _codec, _capability)
define the audio endpoint
Definition a2dp.h:40
@ BT_AVDTP_SINK
Sink Role.
Definition avdtp.h:72

define the audio sink endpoint

Parameters
_codecvalue of enum bt_a2dp_codec_id.
_capabilitythe codec capability.

◆ BT_A2DP_SOURCE_EP_INIT

#define BT_A2DP_SOURCE_EP_INIT ( _codec,
_capability )
Value:
BT_A2DP_EP_INIT(BT_AVDTP_SOURCE, _codec, _capability)
@ BT_AVDTP_SOURCE
Source Role.
Definition avdtp.h:70

define the audio source endpoint

Parameters
_codecvalue of enum bt_a2dp_codec_id.
_capabilitythe codec capability.

◆ BT_A2DP_STREAM_BUF_RESERVE

#define BT_A2DP_STREAM_BUF_RESERVE   (12u + BT_L2CAP_BUF_SIZE(0))

Typedef Documentation

◆ bt_a2dp_discover_ep_cb

typedef uint8_t(* bt_a2dp_discover_ep_cb) (struct bt_a2dp *a2dp, struct bt_a2dp_ep_info *info, struct bt_a2dp_ep **ep)

Called when a stream endpoint is discovered.

A function of this type is given by the user to the bt_a2dp_discover_param object. It'll be called on each valid stream endpoint discovery completion. When no more endpoint then NULL is passed to the user. Otherwise user can get valid endpoint information from parameter info, user can set parameter ep to get the endpoint after the callback is return. The returned function value allows the user to control retrieving follow-up endpoints if any. If the user doesn't want to read more endpoints since current found endpoints fulfill its requirements then should return BT_A2DP_DISCOVER_EP_STOP. Otherwise returned value means more subcall iterations are allowable.

Parameters
a2dpa2dp connection object identifying a2dp connection to queried remote.
infoObject pointing to the information of the callbacked endpoint.
epIf the user want to use this found endpoint, user can set value to it to get the endpoint that can be used further in other A2DP APIs. It is NULL if info is NULL (no more endpoint is found).
Returns
BT_A2DP_DISCOVER_EP_STOP in case of no more need to continue discovery for next endpoint. By returning BT_A2DP_DISCOVER_EP_STOP user allows this discovery continuation.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Helper enum to be used as return value of bt_a2dp_discover_ep_cb.

The value informs the caller to perform further pending actions or stop them.

Enumerator
BT_A2DP_DISCOVER_EP_STOP 
BT_A2DP_DISCOVER_EP_CONTINUE 

◆ bt_a2dp_codec_type

Codec Type.

Enumerator
BT_A2DP_SBC 

Codec SBC.

BT_A2DP_MPEG1 

Codec MPEG-1.

BT_A2DP_MPEG2 

Codec MPEG-2.

BT_A2DP_ATRAC 

Codec ATRAC.

BT_A2DP_VENDOR 

Codec Non-A2DP.

◆ bt_a2dp_err_code

A2DP error code.

Enumerator
BT_A2DP_INVALID_CODEC_TYPE 

Media Codec Type is not valid.

BT_A2DP_NOT_SUPPORTED_CODEC_TYPE 

Media Codec Type is not supported.

BT_A2DP_INVALID_SAMPLING_FREQUENCY 

Sampling Frequency is not valid or multiple values have been selected.

BT_A2DP_NOT_SUPPORTED_SAMPLING_FREQUENCY 

Sampling Frequency is not supported.

BT_A2DP_INVALID_CHANNEL_MODE 

Channel Mode is not valid or multiple values have been selected.

BT_A2DP_NOT_SUPPORTED_CHANNEL_MODE 

Channel Mode is not supported.

BT_A2DP_INVALID_SUBBANDS 

None or multiple values have been selected for Number of Subbands.

BT_A2DP_NOT_SUPPORTED_SUBBANDS 

Number of Subbands is not supported.

BT_A2DP_INVALID_ALLOCATION_METHOD 

None or multiple values have been selected for Allocation Method.

BT_A2DP_NOT_SUPPORTED_ALLOCATION_METHOD 

Allocation Method is not supported.

BT_A2DP_INVALID_MINIMUM_BITPOOL_VALUE 

Minimum Bitpool Value is not valid.

BT_A2DP_NOT_SUPPORTED_MINIMUM_BITPOOL_VALUE 

Minimum Bitpool Value is not supported.

BT_A2DP_INVALID_MAXIMUM_BITPOOL_VALUE 

Maximum Bitpool Value is not valid.

BT_A2DP_NOT_SUPPORTED_MAXIMUM_BITPOOL_VALUE 

Maximum Bitpool Value is not supported.

BT_A2DP_INVALID_LAYER 

None or multiple values have been selected for Layer.

BT_A2DP_NOT_SUPPORTED_LAYER 

Layer is not supported.

BT_A2DP_NOT_SUPPORTED_CRC 

CRC is not supported.

BT_A2DP_NOT_SUPPORTED_MPF 

MPF-2 is not supported.

BT_A2DP_NOT_SUPPORTED_VBR 

VBR is not supported.

BT_A2DP_INVALID_BIT_RATE 

None or multiple values have been selected for Bit Rate.

BT_A2DP_NOT_SUPPORTED_BIT_RATE 

Bit Rate is not supported.

BT_A2DP_INVALID_OBJECT_TYPE 

Either 1) Object type is not valid or 2) None or multiple values have been selected for Object Type.

BT_A2DP_NOT_SUPPORTED_OBJECT_TYPE 

Object Type is not supported.

BT_A2DP_INVALID_CHANNELS 

Either 1) Channels is not valid or 2) None or multiple values have been selected for Channels.

BT_A2DP_NOT_SUPPORTED_CHANNELS 

Channels is not supported.

BT_A2DP_INVALID_VERSION 

Version is not valid.

BT_A2DP_NOT_SUPPORTED_VERSION 

Version is not supported.

BT_A2DP_NOT_SUPPORTED_MAXIMUM_SUL 

Maximum SUL is not acceptable for the Decoder in the SNK.

BT_A2DP_INVALID_BLOCK_LENGTH 

None or multiple values have been selected for Block Length.

BT_A2DP_INVALID_CP_TYPE 

The requested CP Type is not supported.

BT_A2DP_INVALID_CP_FORMAT 

The format of Content Protection Service Capability/Content Protection Scheme Dependent Data is not correct.

BT_A2DP_INVALID_CODEC_PARAMETER 

The codec parameter is invalid.

Used if a more specific error code does not exist for the codec in use

BT_A2DP_NOT_SUPPORTED_CODEC_PARAMETER 

The codec parameter is not supported.

Used if a more specific error code does not exist for the codec in use

BT_A2DP_INVALID_DRC 

Combination of Object Type and DRC is invalid.

BT_A2DP_NOT_SUPPORTED_DRC 

DRC is not supported.

Function Documentation

◆ bt_a2dp_connect()

struct bt_a2dp * bt_a2dp_connect ( struct bt_conn * conn)

A2DP Connect.

This function is to be called after the conn parameter is obtained by performing a GAP procedure. The API is to be used to establish A2DP connection between devices. This function only establish AVDTP L2CAP Signaling connection. After connection success, the callback that is registered by bt_a2dp_register_connect_callback is called.

Parameters
connPointer to bt_conn structure.
Returns
pointer to struct bt_a2dp in case of success or NULL in case of error.

◆ bt_a2dp_disconnect()

int bt_a2dp_disconnect ( struct bt_a2dp * a2dp)

disconnect l2cap a2dp

This function close AVDTP L2CAP Signaling connection. It closes the AVDTP L2CAP Media connection too if it is established.

Parameters
a2dpThe a2dp instance.
Returns
0 in case of success and error code in case of error.

◆ bt_a2dp_discover()

int bt_a2dp_discover ( struct bt_a2dp * a2dp,
struct bt_a2dp_discover_param * param )

Discover remote endpoints.

Parameters
a2dpThe a2dp instance.
paramthe discover used param.
Returns
0 in case of success and error code in case of error.

◆ bt_a2dp_get_mtu()

uint32_t bt_a2dp_get_mtu ( struct bt_a2dp_stream * stream)

get the stream l2cap mtu

Parameters
streamThe stream object.
Returns
mtu value

◆ bt_a2dp_register_cb()

int bt_a2dp_register_cb ( struct bt_a2dp_cb * cb)

register callback.

The cb is called when bt_a2dp_connect is called or it is operated by remote device.

Parameters
cbThe callback function.
Returns
0 in case of success and error code in case of error.

◆ bt_a2dp_register_ep()

int bt_a2dp_register_ep ( struct bt_a2dp_ep * ep,
uint8_t media_type,
uint8_t role )

Endpoint Registration.

Parameters
epPointer to bt_a2dp_ep structure.
media_typeMedia type that the Endpoint is.
roleRole of Endpoint.
Returns
0 in case of success and error code in case of error.

◆ bt_a2dp_stream_cb_register()

void bt_a2dp_stream_cb_register ( struct bt_a2dp_stream * stream,
struct bt_a2dp_stream_ops * ops )

Register Audio callbacks for a stream.

Register Audio callbacks for a stream.

Parameters
streamStream object.
opsStream operations structure.

◆ bt_a2dp_stream_config()

int bt_a2dp_stream_config ( struct bt_a2dp * a2dp,
struct bt_a2dp_stream * stream,
struct bt_a2dp_ep * local_ep,
struct bt_a2dp_ep * remote_ep,
struct bt_a2dp_codec_cfg * config )

configure endpoint.

bt_a2dp_discover can be used to find remote's endpoints. This function to configure the selected endpoint that is found by bt_a2dp_discover. This function sends AVDTP_SET_CONFIGURATION.

Parameters
a2dpThe a2dp instance.
streamStream object.
local_epThe configured endpoint that is registered.
remote_epThe remote endpoint.
configThe config to configure the endpoint.
Returns
0 in case of success and error code in case of error.

◆ bt_a2dp_stream_establish()

int bt_a2dp_stream_establish ( struct bt_a2dp_stream * stream)

establish a2dp streamer.

This function sends the AVDTP_OPEN command and create the l2cap channel.

Parameters
streamThe stream object.
Returns
0 in case of success and error code in case of error.

◆ bt_a2dp_stream_reconfig()

int bt_a2dp_stream_reconfig ( struct bt_a2dp_stream * stream,
struct bt_a2dp_codec_cfg * config )

re-configure a2dp streamer

This function sends the AVDTP_RECONFIGURE command.

Parameters
streamThe stream object.
configThe config to configure the stream.
Returns
0 in case of success and error code in case of error.

◆ bt_a2dp_stream_release()

int bt_a2dp_stream_release ( struct bt_a2dp_stream * stream)

release a2dp streamer.

This function sends the AVDTP_CLOSE command and release the l2cap channel.

Parameters
streamThe stream object.
Returns
0 in case of success and error code in case of error.

◆ bt_a2dp_stream_start()

int bt_a2dp_stream_start ( struct bt_a2dp_stream * stream)

start a2dp streamer.

This function sends the AVDTP_START command.

Parameters
streamThe stream object.
Returns
0 in case of success and error code in case of error.

◆ bt_a2dp_stream_suspend()

int bt_a2dp_stream_suspend ( struct bt_a2dp_stream * stream)

suspend a2dp streamer.

This function sends the AVDTP_SUSPEND command.

Parameters
streamThe stream object.
Returns
0 in case of success and error code in case of error.