Microchip® Advanced Software Framework

a2dp_source.h File Reference
#include <stdint.h>

Functions

int a2dp_max_media_payload_size (uint16_t a2dp_cid, uint8_t local_seid)
 Return maximal media payload size, does not include media header. More...
 
void a2dp_source_create_sdp_record (uint8_t *service, uint32_t service_record_handle, uint16_t supported_features, const char *service_name, const char *service_provider_name)
 Create A2DP Source service record. More...
 
avdtp_stream_endpoint_ta2dp_source_create_stream_endpoint (avdtp_media_type_t media_type, avdtp_media_codec_type_t media_codec_type, uint8_t *codec_capabilities, uint16_t codec_capabilities_len, uint8_t *codec_configuration, uint16_t codec_configuration_len)
 Create a stream endpoint of type SOURCE, and register media codec by specifying its capabilities and the default configuration. More...
 
uint8_t a2dp_source_disconnect (uint16_t a2dp_cid)
 Release stream and disconnect from remote. More...
 
uint8_t a2dp_source_establish_stream (bd_addr_t remote, uint8_t local_seid, uint16_t *out_a2dp_cid)
 Open stream. More...
 
void a2dp_source_init (void)
 Initialize up A2DP Source device. More...
 
uint8_t a2dp_source_pause_stream (uint16_t a2dp_cid, uint8_t local_seid)
 Pause stream. More...
 
void a2dp_source_register_packet_handler (btstack_packet_handler_t callback)
 Register callback for the A2DP Source client. More...
 
uint8_t a2dp_source_start_stream (uint16_t a2dp_cid, uint8_t local_seid)
 Start stream. More...
 
void a2dp_source_stream_endpoint_request_can_send_now (uint16_t a2dp_cid, uint8_t local_seid)
 Request to send a media packet. More...
 
int a2dp_source_stream_send_media_payload (uint16_t a2dp_cid, uint8_t local_seid, uint8_t *storage, int num_bytes_to_copy, uint8_t num_frames, uint8_t marker)
 Send media payload. More...
 

int a2dp_max_media_payload_size ( uint16_t  a2dp_cid,
uint8_t  local_seid 
)

Return maximal media payload size, does not include media header.

Parameters
a2dp_cidA2DP channel identifyer.
local_seidID of a local stream endpoint.
Returns
max_media_payload_size_without_media_header
void a2dp_source_create_sdp_record ( uint8_t *  service,
uint32_t  service_record_handle,
uint16_t  supported_features,
const char *  service_name,
const char *  service_provider_name 
)

Create A2DP Source service record.

Parameters
service
service_record_handle
supported_features16-bit bitmap, see AVDTP_SOURCE_SF_* values in avdtp.h
service_name
service_provider_name
avdtp_stream_endpoint_t* a2dp_source_create_stream_endpoint ( avdtp_media_type_t  media_type,
avdtp_media_codec_type_t  media_codec_type,
uint8_t *  codec_capabilities,
uint16_t  codec_capabilities_len,
uint8_t *  codec_configuration,
uint16_t  codec_configuration_len 
)

Create a stream endpoint of type SOURCE, and register media codec by specifying its capabilities and the default configuration.

Parameters
media_typeSee avdtp_media_type_t values in avdtp.h (audio, video or multimedia).
media_codec_typeSee avdtp_media_codec_type_t values in avdtp.h
codec_capabilitiesMedia codec capabilities as defined in A2DP spec, section 4 - Audio Codec Interoperability Requirements.
codec_capabilities_lenMedia codec capabilities length.
codec_configurationDefault media codec configuration.
codec_configuration_lenMedia codec configuration length.
out_local_seidAssigned stream endpoint ID used in further A2DP commands.
Returns
status ERROR_CODE_SUCCESS if sucessful.
uint8_t a2dp_source_disconnect ( uint16_t  a2dp_cid)

Release stream and disconnect from remote.

Parameters
a2dp_cidA2DP channel identifyer.
uint8_t a2dp_source_establish_stream ( bd_addr_t  remote,
uint8_t  local_seid,
uint16_t *  out_a2dp_cid 
)

Open stream.

Parameters
remote
local_seidID assigned to a local stream endpoint
out_a2dp_cidAssigned A2DP channel identifyer used for furhter A2DP commands.
void a2dp_source_init ( void  )

Initialize up A2DP Source device.

uint8_t a2dp_source_pause_stream ( uint16_t  a2dp_cid,
uint8_t  local_seid 
)

Pause stream.

Parameters
a2dp_cidA2DP channel identifyer.
local_seidID of a local stream endpoint.
void a2dp_source_register_packet_handler ( btstack_packet_handler_t  callback)

Register callback for the A2DP Source client.

It will receive following subevents of HCI_EVENT_A2DP_META HCI event type:

  • A2DP_SUBEVENT_INCOMING_CONNECTION_ESTABLISHED: Received when signaling connection with a remote is established .
  • A2DP_SUBEVENT_SIGNALING_CONNECTION_RELEASED: Received when signaling connection with a remote is released .
  • A2DP_SUBEVENT_STREAM_ESTABLISHED: Received when stream to a remote device is established.
  • A2DP_SUBEVENT_STREAM_STARTED: Received when stream is started.
  • A2DP_SUBEVENT_STREAM_SUSPENDED: Received when stream is paused.
  • A2DP_SUBEVENT_STREAM_STOPED: received when stream is aborted or stopped.
  • A2DP_SUBEVENT_STREAM_RELEASED: Received when stream is released.
  • A2DP_SUBEVENT_STREAMING_CAN_SEND_MEDIA_PACKET_NOW: Indicates that the next media packet can be sent.
Parameters
callback
uint8_t a2dp_source_start_stream ( uint16_t  a2dp_cid,
uint8_t  local_seid 
)

Start stream.

Parameters
a2dp_cidA2DP channel identifyer.
local_seidID of a local stream endpoint.
void a2dp_source_stream_endpoint_request_can_send_now ( uint16_t  a2dp_cid,
uint8_t  local_seid 
)

Request to send a media packet.

Packet can be then sent on reception of A2DP_SUBEVENT_STREAMING_CAN_SEND_MEDIA_PACKET_NOW event.

Parameters
a2dp_cidA2DP channel identifyer.
local_seidID of a local stream endpoint.
int a2dp_source_stream_send_media_payload ( uint16_t  a2dp_cid,
uint8_t  local_seid,
uint8_t *  storage,
int  num_bytes_to_copy,
uint8_t  num_frames,
uint8_t  marker 
)

Send media payload.

Parameters
a2dp_cidA2DP channel identifyer.
local_seidID of a local stream endpoint.
storage
num_bytes_to_copy
num_frames
marker
Returns
max_media_payload_size_without_media_header