dotstack API Reference
1.10.37
|
AVDTP is the transport protocol for audio and/or video distribution connections and streaming of audio or video media over the Bluetooth air interface. More...
Modules | |
Configuration | |
This module describes parameters used to configure AVDTP layer. | |
Data Structures | |
struct | bt_media_packet_t |
Media packet buffer. More... | |
struct | bt_avdtp_sep_capabilities_t |
SEP capabilities. More... | |
struct | bt_avdtp_sep_t |
SEP description. More... | |
struct | bt_avdtp_evt_ctrl_channel_connected_t |
Parameter to AVDTP_EVT_CTRL_CHANNEL_CONNECTED event. More... | |
struct | bt_avdtp_evt_ctrl_connection_failed_t |
Parameter to AVDTP_EVT_CTRL_CONNECTION_FAILED event. More... | |
struct | bt_avdtp_evt_ctrl_channel_disconnected_t |
Parameter to AVDTP_EVT_CTRL_CHANNEL_DISCONNECTED event. More... | |
struct | bt_avdtp_evt_discover_completed_t |
Parameter to AVDTP_EVT_DISCOVER_COMPLETED event. More... | |
struct | bt_avdtp_evt_sep_info_received_t |
Parameter to AVDTP_EVT_SEP_INFO_RECEIVED event. More... | |
struct | bt_avdtp_evt_get_sep_capabilities_completed_t |
Parameter to AVDTP_EVT_GET_SEP_CAPABILITIES_COMPLETED event. More... | |
struct | bt_avdtp_evt_sep_capabilities_received_t |
Parameter to AVDTP_EVT_SEP_CAPABILITIES_RECEIVED and AVDTP_EVT_STREAM_CONFIGURATION_RECEIVED events. More... | |
struct | bt_avdtp_evt_set_stream_configuration_completed_t |
Parameter to AVDTP_EVT_SET_STREAM_CONFIGURATION_COMPLETED event. More... | |
struct | bt_avdtp_evt_get_stream_configuration_completed_t |
Parameter to AVDTP_EVT_SET_STREAM_CONFIGURATION_COMPLETED event. More... | |
struct | bt_avdtp_evt_stream_reconfigure_completed_t |
Parameter to AVDTP_EVT_STREAM_RECONFIGURE_COMPLETED event. More... | |
struct | bt_avdtp_evt_open_stream_completed_t |
Parameter to AVDTP_EVT_OPEN_STREAM_COMPLETED event. More... | |
struct | bt_avdtp_evt_start_stream_completed_t |
Parameter to AVDTP_EVT_START_STREAM_COMPLETED event. More... | |
struct | bt_avdtp_evt_close_stream_completed_t |
Parameter to AVDTP_EVT_CLOSE_STREAM_COMPLETED event. More... | |
struct | bt_avdtp_evt_suspend_stream_completed_t |
Parameter to AVDTP_EVT_SUSPEND_STREAM_COMPLETED event. More... | |
struct | bt_avdtp_evt_stream_security_control_completed_t |
Parameter to AVDTP_EVT_STREAM_SECURITY_CONTROL_COMPLETED event. More... | |
struct | bt_avdtp_evt_set_stream_configuration_requested_t |
Parameter to AVDTP_EVT_SET_STREAM_CONFIGURATION_REQUESTED event. More... | |
struct | bt_avdtp_evt_reconfigure_stream_requested_t |
Parameter to AVDTP_EVT_RECONFIGURE_STREAM_REQUESTED event. More... | |
struct | bt_avdtp_evt_open_stream_requested_t |
Parameter to AVDTP_EVT_OPEN_STREAM_REQUESTED event. More... | |
struct | bt_avdtp_evt_start_stream_requested_t |
Parameter to AVDTP_EVT_START_STREAM_REQUESTED event. More... | |
struct | bt_avdtp_evt_suspend_stream_requested_t |
Parameter to AVDTP_EVT_SUSPEND_STREAM_REQUESTED event. More... | |
struct | bt_avdtp_evt_close_stream_requested_t |
Parameter to AVDTP_EVT_CLOSE_STREAM_REQUESTED event. More... | |
struct | bt_avdtp_evt_abort_stream_requested_t |
Parameter to AVDTP_EVT_ABORT_STREAM_REQUESTED event. More... | |
struct | bt_avdtp_evt_delay_report_completed_t |
Parameter to AVDTP_EVT_DELAYREPORT_COMPLETED event. More... | |
struct | bt_avdtp_evt_stream_configured_t |
Parameter to AVDTP_EVT_STREAM_CONFIGURED event. More... | |
struct | bt_avdtp_evt_stream_reconfigured_t |
Parameter to AVDTP_EVT_STREAM_RECONFIGURED event. More... | |
struct | bt_avdtp_evt_stream_opened_t |
Parameter to AVDTP_EVT_STREAM_OPENED event. More... | |
struct | bt_avdtp_evt_stream_started_t |
Parameter to AVDTP_EVT_STREAM_STARTED event. More... | |
struct | bt_avdtp_evt_stream_suspended_t |
Parameter to AVDTP_EVT_STREAM_SUSPENDED event. More... | |
struct | bt_avdtp_evt_stream_closed_t |
Parameter to AVDTP_EVT_STREAM_CLOSED event. More... | |
struct | bt_avdtp_evt_stream_aborted_t |
Parameter to AVDTP_EVT_STREAM_ABORTED event. More... | |
struct | bt_avdtp_evt_media_packet_received_t |
Parameter to AVDTP_EVT_MEDIA_PACKET_RECEIVED event. More... | |
struct | bt_avdtp_evt_media_packet_sent_t |
Parameter to AVDTP_EVT_MEDIA_PACKET_SENT event. More... | |
struct | bt_avdtp_evt_media_packet_send_failed_t |
Parameter to AVDTP_EVT_MEDIA_PACKET_SEND_FAILED event. More... | |
struct | bt_avdtp_evt_set_stream_configuration_t |
Parameter to AVDTP_EVT_SET_STREAM_CONFIGURATION event. More... | |
union | bt_avdtp_event_t |
Parameter to an application callback. More... | |
struct | bt_avdtp_transport_channel_t |
Transport channel description. More... | |
struct | bt_avdtp_transport_session_t |
Transport session description. More... | |
struct | bt_avdtp_stream_t |
Stream description. More... | |
struct | bt_avdtp_codec_t |
Codec handler description. More... | |
struct | bt_avdtp_codec_op_parse_config_t |
Parameter to AVDTP_CODEC_OPCODE_PARSE_CONFIG operation. More... | |
struct | bt_avdtp_codec_op_serialize_config_t |
Parameter to AVDTP_CODEC_OPCODE_SERIALIZE_CONFIG operation. More... | |
union | bt_avdtp_codec_op_param_t |
Parameter to a codec handler. More... | |
struct | bt_avdtp_mgr_t |
AVDTP manager. More... | |
Macros | |
#define | bt_avdtp_connect(mgr, remote_addr) _bt_avdtp_open_control_channel_ex(mgr, remote_addr, HCI_CONFIG_ENABLE_AUTHENTICATION | HCI_CONFIG_ENABLE_ENCRYPTION) |
Connect to a remote device. More... | |
#define | bt_avdtp_connect_ex(mgr, remote_addr, acl_config) _bt_avdtp_open_control_channel_ex(mgr, remote_addr, acl_config) |
Connect to a remote device. More... | |
Typedefs | |
typedef bt_byte(* | bt_avdtp_codec_handler_fp) (struct _bt_avdtp_codec_t *codec, bt_byte opcode, bt_avdtp_codec_op_param_t *op_param, struct _bt_avdtp_mgr_t *mgr) |
Codec handler. More... | |
typedef void(* | bt_avdtp_mgr_callback_fp) (struct _bt_avdtp_mgr_t *mgr, bt_byte evt, bt_avdtp_event_t *evt_param, void *callback_param) |
AVDTP application callback. More... | |
Functions | |
bt_avdtp_mgr_t * | bt_avdtp_get_mgr (void) |
Return a pointer to an instance of the AVDTP manager. More... | |
void | bt_avdtp_init (void) |
Initialize the AVDTP layer. More... | |
bt_bool | bt_avdtp_start (bt_avdtp_mgr_t *mgr) |
Start the AVDTP layer. More... | |
void | bt_avdtp_register_callback (bt_avdtp_mgr_t *mgr, bt_avdtp_mgr_callback_fp callback, void *callback_param) |
Register a AVDTP application callback. More... | |
bt_byte | bt_avdtp_register_sep (bt_avdtp_mgr_t *mgr, bt_byte type, const bt_avdtp_sep_capabilities_t *caps) |
Register a SEP with the local AVDTP manager. More... | |
bt_avdtp_sep_t * | bt_avdtp_get_sep (bt_avdtp_mgr_t *mgr, bt_byte sep_id) |
Get a SEP info by its ID. More... | |
bt_bool | bt_avdtp_disconnect (bt_avdtp_mgr_t *mgr, bt_bdaddr_t *remote_addr) |
Disconnect from a remote device. More... | |
bt_bool | bt_avdtp_discover (bt_avdtp_mgr_t *mgr, bt_bdaddr_t *remote_addr) |
Discover SEPs on a remote device. More... | |
bt_bool | bt_avdtp_get_capabilities (bt_avdtp_mgr_t *mgr, bt_bdaddr_t *remote_addr, bt_byte seid_acp) |
Get remote SEP capabilities. More... | |
bt_bool | bt_avdtp_get_all_capabilities (bt_avdtp_mgr_t *mgr, bt_bdaddr_t *remote_addr, bt_byte seid_acp) |
Get remote SEP capabilities. More... | |
bt_byte | bt_avdtp_create_stream (bt_avdtp_mgr_t *mgr) |
Create a stream. More... | |
bt_bool | bt_avdtp_destroy_stream (bt_avdtp_mgr_t *mgr, bt_byte strm_handle) |
Destroy a stream. More... | |
bt_bool | bt_avdtp_listen (bt_avdtp_mgr_t *mgr, bt_byte strm_handle, bt_byte sep_id) |
Listen for incoming connections. More... | |
void | bt_avdtp_cancel_listen (bt_avdtp_mgr_t *mgr, bt_byte strm_handle, bt_byte sep_id) |
Cancel listening for incoming connections. More... | |
bt_bool | bt_avdtp_set_configuration (bt_avdtp_mgr_t *mgr, bt_byte strm_handle, bt_bdaddr_t *remote_addr, bt_byte seid_int, bt_byte seid_acp, const bt_avdtp_sep_capabilities_t *caps) |
Set stream configuration. More... | |
bt_bool | bt_avdtp_get_configuration (bt_avdtp_mgr_t *mgr, bt_byte strm_handle) |
Get stream configuration. More... | |
bt_bool | bt_avdtp_reconfigure_stream (bt_avdtp_mgr_t *mgr, bt_byte strm_handle, bt_avdtp_sep_capabilities_t *caps) |
Reconfigure stream. More... | |
bt_byte | bt_avdtp_get_stream_state (bt_avdtp_mgr_t *mgr, bt_byte strm_handle) |
Get local stream state. More... | |
bt_byte | bt_avdtp_get_stream_local_sep_id (bt_avdtp_mgr_t *mgr, bt_byte strm_handle) |
Get stream's local SEP ID. More... | |
bt_byte | bt_avdtp_get_stream_remote_sep_id (bt_avdtp_mgr_t *mgr, bt_byte strm_handle) |
Get stream's remote SEP ID. More... | |
bt_bdaddr_t * | bt_avdtp_get_stream_remote_address (bt_avdtp_mgr_t *mgr, bt_byte strm_handle) |
Get stream's remote BT address. More... | |
bt_byte | bt_avdtp_get_stream_codec_type (bt_avdtp_mgr_t *mgr, bt_byte strm_handle) |
Get the type of the codec currently used with the stream. More... | |
void * | bt_avdtp_get_stream_codec_config (bt_avdtp_mgr_t *mgr, bt_byte strm_handle) |
Get the configuration of the codec currently used with the stream. More... | |
bt_avdtp_sep_capabilities_t * | bt_avdtp_get_stream_config (bt_avdtp_mgr_t *mgr, bt_byte strm_handle) |
Get stream's configuration. More... | |
bt_bool | bt_avdtp_open_stream (bt_avdtp_mgr_t *mgr, bt_byte strm_handle) |
Open a stream. More... | |
bt_bool | bt_avdtp_start_stream (bt_avdtp_mgr_t *mgr, bt_byte strm_handle) |
Start a stream. More... | |
bt_bool | bt_avdtp_close_stream (bt_avdtp_mgr_t *mgr, bt_byte strm_handle) |
Close a stream. More... | |
bt_bool | bt_avdtp_suspend_stream (bt_avdtp_mgr_t *mgr, bt_byte strm_handle) |
Suspend a stream. More... | |
bt_bool | bt_avdtp_abort_stream (bt_avdtp_mgr_t *mgr, bt_byte strm_handle) |
Suspend a stream. More... | |
bt_bool | bt_avdtp_security_control (bt_avdtp_mgr_t *mgr, bt_byte strm_handle, bt_byte *sc_data, bt_byte sc_data_len) |
Exchange content protection control data. More... | |
bt_bool | bt_avdtp_report_delay (bt_avdtp_mgr_t *mgr, bt_byte strm_handle, bt_uint delay) |
Report delay value of a Sink to a Source. More... | |
bt_bool | bt_avdtp_register_codec (bt_avdtp_mgr_t *mgr, bt_avdtp_codec_t *codec) |
Register a codec. More... | |
bt_bool | bt_avdtp_unregister_codec (bt_avdtp_mgr_t *mgr, bt_byte codec_type) |
Unregister a codec. More... | |
bt_avdtp_codec_t * | bt_avdtp_find_codec (bt_avdtp_mgr_t *mgr, bt_byte codec_type) |
Find a codec. More... | |
bt_bool | bt_avdtp_add_media_rx_buffer (bt_avdtp_mgr_t *mgr, bt_byte strm_handle, bt_media_packet_t *buffer) |
Add a media packet buffer to a receive queue. More... | |
bt_bool | bt_avdtp_remove_media_rx_buffer (bt_avdtp_mgr_t *mgr, bt_byte strm_handle, bt_media_packet_t *buffer) |
Remove a media packet buffer from a receive queue. More... | |
bt_bool | bt_avdtp_add_media_tx_buffer (bt_avdtp_mgr_t *mgr, bt_byte strm_handle, bt_media_packet_t *buffer) |
Add a media packet buffer to a send queue. More... | |
bt_bool | bt_avdtp_remove_media_tx_buffer (bt_avdtp_mgr_t *mgr, bt_byte strm_handle, bt_media_packet_t *buffer) |
Remove a media packet buffer from a send queue. More... | |
bt_bool | bt_avdtp_clear_media_tx_queue (bt_avdtp_mgr_t *mgr, bt_byte strm_handle) |
Clear send queue. More... | |
bt_bool | bt_avdtp_set_media_tx_queue_limit (bt_avdtp_mgr_t *mgr, bt_byte strm_handle, bt_uint limit) |
Set limit on the send queue. More... | |
bt_hci_conn_state_t * | bt_avdtp_get_hci_connection (bt_avdtp_mgr_t *mgr, bt_byte strm_handle) |
Get HCI connection for a stream. More... | |
Events | |
The following is a list of events AVDTP layer generates and can report to the upper layer when it completes executing an operation initiated by either local or remote device. | |
#define | AVDTP_EVT_CTRL_CHANNEL_CONNECTED 1 |
This event is generated when a control channel between two AVDTP entities has been established. | |
#define | AVDTP_EVT_CTRL_CHANNEL_DISCONNECTED 2 |
This event is generated when a control channel between two AVDTP entities has been terminated. | |
#define | AVDTP_EVT_CTRL_CONNECTION_FAILED 3 |
This event is generated when a local device failed to create a control channel between two AVDTP entities. | |
#define | AVDTP_EVT_DISCOVER_COMPLETED 4 |
This event is generated when a local device received a response (either positive or negative) to a "discover" request. | |
#define | AVDTP_EVT_GET_SEP_CAPABILITIES_COMPLETED 5 |
This event is generated when a local device received a response (either positive or negative) to a "get SEP capabilities" request. | |
#define | AVDTP_EVT_SET_STREAM_CONFIGURATION_COMPLETED 6 |
This event is generated when a local device received a response (either positive or negative) to a "set stream configuration" request. | |
#define | AVDTP_EVT_GET_STREAM_CONFIGURATION_COMPLETED 7 |
This event is generated when a local device received a response (either positive or negative) to a "get stream configuration" request. | |
#define | AVDTP_EVT_STREAM_RECONFIGURE_COMPLETED 8 |
This event is generated when a local device received a response (either positive or negative) to a "change stream configuration" request. | |
#define | AVDTP_EVT_OPEN_STREAM_COMPLETED 9 |
This event is generated when a local device received a response (either positive or negative) to a "open stream" request. | |
#define | AVDTP_EVT_START_STREAM_COMPLETED 10 |
This event is generated when a local device received a response (either positive or negative) to a "start stream" request. | |
#define | AVDTP_EVT_CLOSE_STREAM_COMPLETED 11 |
This event is generated when a local device received a response (either positive or negative) to a "close stream" request. | |
#define | AVDTP_EVT_SUSPEND_STREAM_COMPLETED 12 |
This event is generated when a local device received a response (either positive or negative) to a "suspend stream" request. | |
#define | AVDTP_EVT_STREAM_SECURITY_CONTROL_COMPLETED 13 |
This event is generated when a local device received a response (either positive or negative) to a "exchange content protection control data" request. | |
#define | AVDTP_EVT_ABORT_STREAM_COMPLETED 14 |
This event is generated when a local device received a response (either positive or negative) to a "abort stream" request. | |
#define | AVDTP_EVT_SEP_INFO_RECEIVED 15 |
This event is generated for each SEP contained in a positive response to a "discover" request. | |
#define | AVDTP_EVT_SEP_CAPABILITIES_RECEIVED 16 |
This event is generated when a local device received a positive response to a "get SEP capabilities" request. | |
#define | AVDTP_EVT_STREAM_CONFIGURATION_RECEIVED 17 |
This event is generated when a local device received a positive response to a "get stream configuration" request. | |
#define | AVDTP_EVT_DELAYREPORT_COMPLETED 18 |
This event is generated when a local device received a response (either positive or negative) to a "delay report" request. | |
#define | AVDTP_EVT_SET_STREAM_CONFIGURATION 19 |
#define | AVDTP_EVT_DISCOVER_REQUESTED 49 |
This event is generated when a local device received "stream end point discovery" request. | |
#define | AVDTP_EVT_SET_STREAM_CONFIGURATION_REQUESTED 50 |
This event is generated when a local device received "set stream configuration" request. | |
#define | AVDTP_EVT_OPEN_STREAM_REQUESTED 51 |
This event is generated when a local device received "open stream" request. | |
#define | AVDTP_EVT_START_STREAM_REQUESTED 52 |
This event is generated when a local device received "start stream" request. | |
#define | AVDTP_EVT_CLOSE_STREAM_REQUESTED 53 |
This event is generated when a local device received "close stream" request. | |
#define | AVDTP_EVT_SUSPEND_STREAM_REQUESTED 54 |
This event is generated when a local device received "suspend stream" request. | |
#define | AVDTP_EVT_ABORT_STREAM_REQUESTED 55 |
This event is generated when a local device received "abort stream" request. | |
#define | AVDTP_EVT_RECONFIGURE_STREAM_REQUESTED 56 |
This event is generated when a local device received "change stream configuration" request. | |
#define | AVDTP_EVT_MEDIA_PACKET_RECEIVED 57 |
This event is generated when a local device received a media packet. | |
#define | AVDTP_EVT_STREAM_CONFIGURED 58 |
This event is generated when a local device has successfully configured a stream. More... | |
#define | AVDTP_EVT_STREAM_RECONFIGURED 59 |
This event is generated when a local device has successfully reconfigured a stream. More... | |
#define | AVDTP_EVT_STREAM_OPENED 60 |
This event is generated when a local device has successfully opened a stream. More... | |
#define | AVDTP_EVT_STREAM_STARTED 61 |
This event is generated when a local device has successfully started a stream. More... | |
#define | AVDTP_EVT_STREAM_CLOSED 62 |
This event is generated when a local device has successfully closed a stream. More... | |
#define | AVDTP_EVT_STREAM_SUSPENDED 63 |
This event is generated when a local device has successfully suspended a stream. More... | |
#define | AVDTP_EVT_STREAM_ABORTED 64 |
This event is generated when a local device has successfully aborted a stream. More... | |
#define | AVDTP_EVT_MEDIA_PACKET_SENT 65 |
This event is generated when a local device sent a media packet. | |
#define | AVDTP_EVT_MEDIA_PACKET_SEND_FAILED 66 |
This event is generated when a local device failed to send a media packet. | |
Stream States | |
#define | AVDTP_STREAM_STATE_IDLE 0 |
The stream is idle. More... | |
#define | AVDTP_STREAM_OPENING_TRANSPORT_CHANNELS 1 |
The stream is opening transport channels. | |
#define | AVDTP_STREAM_CLOSING_TRANSPORT_CHANNELS 2 |
The stream is closing transport channels. | |
#define | AVDTP_STREAM_STATE_CONFIGURED 3 |
The stream has been configured. | |
#define | AVDTP_STREAM_STATE_OPEN 4 |
The stream has been opened. | |
#define | AVDTP_STREAM_STATE_STREAMING 5 |
The stream has been started. More... | |
#define | AVDTP_STREAM_STATE_CLOSING 6 |
The stream is closing. More... | |
#define | AVDTP_STREAM_STATE_ABORTING 7 |
The stream is aborting. More... | |
SEP Type | |
#define | AVDTP_SEP_TYPE_SOURCE 0 |
Source (usually a device like a phone, desktop or laptop). | |
#define | AVDTP_SEP_TYPE_SINK 1 |
Sink (usually a device like a headphones or BMW). | |
Service Categories | |
The following is a list of service categories a SEP supports.
| |
#define | AVDTP_SEP_SERVICE_CAPABILITY_MEDIA_TRANSPORT 1 |
Media. A SEP is capable of transferring media (audio, video or both) packets. | |
#define | AVDTP_SEP_SERVICE_CAPABILITY_REPORTING 2 |
Reporting. A SEP is capable of transferring reporting packets. | |
#define | AVDTP_SEP_SERVICE_CAPABILITY_RECOVERY 3 |
Recovery. A SEP is capable of transferring recovery packets. | |
#define | AVDTP_SEP_SERVICE_CAPABILITY_CONTENT_PROTECTION 4 |
Content Prortection. A SEP is capable of transferring content protection packets. | |
#define | AVDTP_SEP_SERVICE_CAPABILITY_HEADER_COMPRESSION 5 |
Header Compression. A SEP can use header compression for transferring Media or Recovery packets. | |
#define | AVDTP_SEP_SERVICE_CAPABILITY_MULTIPLEXING 6 |
Multiplexing. Multiple transport sessions, belonging to the same or to a different stream, can share a common transport (L2CAP) channel. | |
#define | AVDTP_SEP_SERVICE_CAPABILITY_MEDIA_CODEC 7 |
Media Codec. Defines which codec a SEP supports. A SEP can support only one codec. | |
#define | AVDTP_SEP_SERVICE_CAPABILITY_DELAY_REPORTING 8 |
Delay Reporting. | |
Service Categories Flags | |
The following is a list of constants that can be used to initialize bt_avdtp_sep_capabilities_t::categories. A combination of these constants defines service capabilities exposed by a SEP to a remote party.
| |
#define | AVDTP_SEP_CAPABILITY_FLAG_MEDIA_TRANSPORT 0x01 |
Media. A SEP is capable of transferring media (audio, video or both) packets. | |
#define | AVDTP_SEP_CAPABILITY_FLAG_REPORTING 0x02 |
Reporting. A SEP is capable of transferring reporting packets. | |
#define | AVDTP_SEP_CAPABILITY_FLAG_RECOVERY 0x04 |
Recovery. A SEP is capable of transferring recovery packets. | |
#define | AVDTP_SEP_CAPABILITY_FLAG_CONTENT_PROTECTION 0x08 |
Content Prortection. A SEP is capable of transferring content protection packets. | |
#define | AVDTP_SEP_CAPABILITY_FLAG_HEADER_COMPRESSION 0x10 |
Header Compression. A SEP can use header compression for transferring Media or Recovery packets. | |
#define | AVDTP_SEP_CAPABILITY_FLAG_MULTIPLEXING 0x20 |
Multiplexing. Multiple transport sessions, belonging to the same or to a different stream, can share a common transport (L2CAP) channel. | |
#define | AVDTP_SEP_CAPABILITY_FLAG_MEDIA_CODEC 0x40 |
Media Codec. Defines which codec a SEP supports. A SEP can support only one codec. | |
#define | AVDTP_SEP_CAPABILITY_FLAG_DELAY_REPORTING 0x80 |
Delat reporitng. | |
Transport Session Types | |
The following is a list of transport sessions a SEP supports.
| |
#define | AVDTP_TRANSPORT_SESSION_TYPE_MEDIA 0 |
Media (audio or video). | |
#define | AVDTP_TRANSPORT_SESSION_TYPE_REPORTING 1 |
Reporting (currently not supported). | |
#define | AVDTP_TRANSPORT_SESSION_TYPE_RECOVERY 2 |
Recovery (currently not supported). | |
Codec Types | |
#define | AVDTP_CODEC_TYPE_SBC 0x00 |
SBC (mandatory to support in A2DP profile). | |
#define | AVDTP_CODEC_TYPE_MPEG1_2_AUDIO 0x01 |
MPEG-1,2 (optional). | |
#define | AVDTP_CODEC_TYPE_MPEG2_4_AAC 0x02 |
MPEG-2,4 AAC (optional, used in Apple's products). | |
#define | AVDTP_CODEC_TYPE_ATRAC 0x04 |
ATRAC (proprietary codec owned by Sony Corporation). | |
#define | AVDTP_CODEC_TYPE_NON_A2DP 0xFF |
Vendor specific. | |
Media Types | |
#define | AVDTP_MEDIA_TYPE_AUDIO 0 |
Audio. | |
#define | AVDTP_MEDIA_TYPE_VIDEO 1 |
Video. | |
#define | AVDTP_MEDIA_TYPE_MULTIMEDIA 2 |
Both Audio & Video. | |
Codec Handler Operations | |
#define | AVDTP_CODEC_OPCODE_PARSE_CONFIG 0 |
Parse codec configuration. | |
#define | AVDTP_CODEC_OPCODE_SERIALIZE_CONFIG 1 |
Serialize codec configuration. | |
Error Codes | |
#define | AVDTP_SUCCESS 0 |
The operation completed with no errors. | |
#define | AVDTP_ERROR_SUCCESS 0 |
The operation completed with no errors. | |
#define | AVDTP_ERROR_BAD_HEADER_FORMAT 0x01 |
The request packet header format is invalid. | |
#define | AVDTP_ERROR_BAD_LENGTH 0x11 |
The request packet length is not match the assumed length. | |
#define | AVDTP_ERROR_BAD_ACP_SEID 0x12 |
The requested command indicates an invalid ACP SEP ID (not addressable) | |
#define | AVDTP_ERROR_SEP_IN_USE 0x13 |
The SEP is in use. | |
#define | AVDTP_ERROR_SEP_NOT_IN_USE 0x14 |
The SEP is not in use. | |
#define | AVDTP_ERROR_BAD_SERV_CATEGORY 0x17 |
The value of Service Category in the request packet is not defined in AVDTP. | |
#define | AVDTP_ERROR_BAD_PAYLOAD_FORMAT 0x18 |
The requested command has an incorrect payload format. | |
#define | AVDTP_ERROR_NOT_SUPPORTED_COMMAND 0x19 |
The requested command is not supported by the device. | |
#define | AVDTP_ERROR_INVALID_CAPABILITIES 0x1a |
The reconfigure command is an attempt to reconfigure a transport service capabilities of the SEP. Reconfigure is only permitted for application service capabilities. | |
#define | AVDTP_ERROR_BAD_RECOVERY_TYPE 0x22 |
The requested Recovery Type is not defined in AVDTP. | |
#define | AVDTP_ERROR_BAD_MEDIA_TRANSPORT_FORMAT 0x23 |
The format of Media Transport Capability is not correct. | |
#define | AVDTP_ERROR_BAD_RECOVERY_FORMAT 0x25 |
The format of Recovery Service Capability is not correct. | |
#define | AVDTP_ERROR_BAD_ROHC_FORMAT 0x26 |
The format of Header Compression Service Capability is not correct. | |
#define | AVDTP_ERROR_BAD_CP_FORMAT 0x27 |
The format of Content Protection Service Capability is not correct. | |
#define | AVDTP_ERROR_BAD_MULTIPLEXING_FORMAT 0x28 |
The format of Multiplexing Service Capability is not correct. | |
#define | AVDTP_ERROR_UNSUPPORTED_CONFIGURAION 0x29 |
Configuration not supported. | |
#define | AVDTP_ERROR_BAD_STATE 0x31 |
The stream is in state that does not permit executing commands. | |
#define | AVDTP_ERROR_FAILED_TO_CONNECT_TRANSPORT 0x40 |
An attempt to establish a transport channel has failed. | |
#define | AVDTP_ERROR_FAILED_TO_CONNECT_CONTROL 0x41 |
An attempt to establish a control channel has failed. | |
#define | AVDTP_ERROR_DELAY_RESPONSE 0xF0 |
Tells the command handler to not sends the response. The response will be later sent by the application. | |
AVDTP is the transport protocol for audio and/or video distribution connections and streaming of audio or video media over the Bluetooth air interface.
#define AVDTP_EVT_STREAM_ABORTED 64 |
This event is generated when a local device has successfully aborted a stream.
This event follows the AVDTP_EVT_ABORT_STREAM_REQUESTED if the upper layer has accepted it. This event is not generated if stream abortion was initiated by the local device.
#define AVDTP_EVT_STREAM_CLOSED 62 |
This event is generated when a local device has successfully closed a stream.
This event follows the AVDTP_EVT_CLOSE_STREAM_REQUESTED if the upper layer has accepted it. This event is not generated if stream closing was initiated by the local device.
#define AVDTP_EVT_STREAM_CONFIGURED 58 |
This event is generated when a local device has successfully configured a stream.
This event follows the AVDTP_EVT_SET_STREAM_CONFIGURATION_REQUESTED if the upper layer has accepted it. This event is not generated if stream configuration was initiated by the local device.
#define AVDTP_EVT_STREAM_OPENED 60 |
This event is generated when a local device has successfully opened a stream.
This event follows the AVDTP_EVT_OPEN_STREAM_REQUESTED if the upper layer has accepted it. This event is not generated if stream opening was initiated by the local device.
#define AVDTP_EVT_STREAM_RECONFIGURED 59 |
This event is generated when a local device has successfully reconfigured a stream.
This event follows the AVDTP_EVT_RECONFIGURE_STREAM_REQUESTED if the upper layer has accepted it. This event is not generated if stream reconfiguration was initiated by the local device.
#define AVDTP_EVT_STREAM_STARTED 61 |
This event is generated when a local device has successfully started a stream.
This event follows the AVDTP_EVT_START_STREAM_REQUESTED if the upper layer has accepted it. This event is not generated if stream starting was initiated by the local device.
#define AVDTP_EVT_STREAM_SUSPENDED 63 |
This event is generated when a local device has successfully suspended a stream.
This event follows the AVDTP_EVT_SUSPEND_STREAM_REQUESTED if the upper layer has accepted it. This event is not generated if stream suspension was initiated by the local device.
#define AVDTP_STREAM_STATE_ABORTING 7 |
The stream is aborting.
This means that all transport channels associated with the stream are being closed. After they have been closed the stream goes to AVDTP_STREAM_STATE_IDLE state.
#define AVDTP_STREAM_STATE_CLOSING 6 |
The stream is closing.
This means that all transport channels associated with the stream are being closed. After they have been closed the stream goes to AVDTP_STREAM_STATE_IDLE state.
#define AVDTP_STREAM_STATE_IDLE 0 |
The stream is idle.
This can mean two things. The stream specified by strm_handle does not exist or the stream is closed.
#define AVDTP_STREAM_STATE_STREAMING 5 |
The stream has been started.
Depending on the local SEP type (source or sink) it means that the stream can send or receive media packets.
#define bt_avdtp_connect | ( | mgr, | |
remote_addr | |||
) | _bt_avdtp_open_control_channel_ex(mgr, remote_addr, HCI_CONFIG_ENABLE_AUTHENTICATION | HCI_CONFIG_ENABLE_ENCRYPTION) |
Connect to a remote device.
This function opens a control channel connection to a remote device specified by the remote_addr
. If connection cannot be initiated for some reason, for example, there is not enough resources, it returns FALSE and not events are generated. Otherwise the result of an attempt to connect to the remote device is reported via the AVDTP callback. The events generated will either be AVDTP_EVT_CTRL_CHANNEL_CONNECTED or AVDTP_EVT_CTRL_CHANNEL_CONNECTION_FAILED.
mgr | AVDTP manager. |
remote_addr | The address of a remote device. |
TRUE
if connection establishment has been started. FALSE
otherwise. #define bt_avdtp_connect_ex | ( | mgr, | |
remote_addr, | |||
acl_config | |||
) | _bt_avdtp_open_control_channel_ex(mgr, remote_addr, acl_config) |
Connect to a remote device.
This function opens a control channel connection to a remote device specified by the remote_addr
. If connection cannot be initiated for some reason, for example, there is not enough resources, it returns FALSE and not events are generated. Otherwise the result of an attempt to connect to the remote device is reported via the AVDTP callback. The events generated will either be AVDTP_EVT_CTRL_CHANNEL_CONNECTED or AVDTP_EVT_CTRL_CHANNEL_CONNECTION_FAILED.
mgr | AVDTP manager. |
remote_addr | The address of a remote device. |
acl_config | ACL link configuration. This can be a combination of the following values:
|
TRUE
if connection establishment has been started. FALSE
otherwise. typedef bt_byte(* bt_avdtp_codec_handler_fp) (struct _bt_avdtp_codec_t *codec, bt_byte opcode, bt_avdtp_codec_op_param_t *op_param, struct _bt_avdtp_mgr_t *mgr) |
Codec handler.
AVDTP in theory can support any type of codec. Each codec uses its own format for exchanging capabilities and configuration information. In order to make out implementation do not care about these formats we use a simple way of telling AVDTP how to parse and serialize codec's configuration. The consumer of AVDTP (e.g. A2DP) for each codec it wishes to support has to register a callback function (one per codec type). That callback has to perform two function. The first one is to read the configuration received from the remote device and store it in a structure defined by the consumer. The second one is to serialize the data from a structure to a format (in case of standard A2DP codecs the format is defined in A2DP specification, vendor specific codecs can define their own formats) suitable for sending as a part of a AVDTP request.
This typedef defines the interace for the callback function.
codec | A pointer to a structure that describes a codec. |
opcode | The code of an operation to execute. The opcode can be one of the following values:
|
op_param | A pointer to the operation's specific parameters. Parameters are passed as a pointer to the bt_avdtp_codec_op_param_t union. Which member of the union points to a valid structure depends on the value of the opcode:
|
mgr | AVDTP manager. |
typedef void(* bt_avdtp_mgr_callback_fp) (struct _bt_avdtp_mgr_t *mgr, bt_byte evt, bt_avdtp_event_t *evt_param, void *callback_param) |
AVDTP application callback.
In order to be notified of various events a consumer of the AVDTP layer has to register a callback function. The stack will call that function whenever a new event has been generated.
mgr | AVDTP manager. |
evt | AVDTP event. The event can be one of the following values:
|
evt_param | Event parameter. Which member of the bt_avdtp_event_t union is valid depends on the event:
|
callback_param | A pointer to an arbitrary data set by a call to bt_avdtp_register_callback. |
bt_bool bt_avdtp_abort_stream | ( | bt_avdtp_mgr_t * | mgr, |
bt_byte | strm_handle | ||
) |
Suspend a stream.
This function tries to suspend a stream by sending a request to the remote party. The stream can be in any state state except AVDTP_STREAM_STATE_IDLE. As a result of this operation the AVDTP_EVT_ABORT_STREAM_COMPLETED event will be generated. This operation cannot be rejected. The evt_param.abort_stream_requested.err_code
is always == AVDTP_ERROR_SUCCESS.
mgr | AVDTP manager. |
strm_handle | Stream handle. |
TRUE
if the function succeeds, i.e. the actual request has been sent to the remote party. FALSE
otherwise. No events will be generated. bt_bool bt_avdtp_add_media_rx_buffer | ( | bt_avdtp_mgr_t * | mgr, |
bt_byte | strm_handle, | ||
bt_media_packet_t * | buffer | ||
) |
Add a media packet buffer to a receive queue.
The consumer of AVDTP is responsible for allocating and supplying AVDTP with buffers used to store received packets. AVDTP itself only has a queue for storing pointers to buffers supplied by the consumer. When a packet comes in AVDTP finds the first buffer large enough to hold the received packet, copies the packet to the buffer and generates a AVDTP_EVT_MEDIA_PACKET_RECEIVED event. The consumer then has to process the data in the buffer and return it back to the queue. If there is no buffers in the queue or none of the buffers is large enough the received packets is dropped. Each buffer has a field (data_len) that holds the length of the received buffer. This field is never 0 if the buffer contains a packet. If a channel closed regardless of what has caused that and there are still buffers in the queue AVDTP generates a AVDTP_EVT_MEDIA_PACKET_RECEIVED event for each buffer and sets the data_len to 0. This is to inform the AVDTP consumer that the buffer has not been used and can be, for example, deallocated. This function adds a buffer to the receive queue.
mgr | AVDTP manager. |
strm_handle | Stream handle. |
buffer | Pointer to a structure that holds the buffer and its parameters. |
TRUE
if the function succeeds. FALSE
otherwise. The function fails only if a stream specified by the strm_handle
parameter bt_bool bt_avdtp_add_media_tx_buffer | ( | bt_avdtp_mgr_t * | mgr, |
bt_byte | strm_handle, | ||
bt_media_packet_t * | buffer | ||
) |
Add a media packet buffer to a send queue.
When the consumer of AVDTP wants to send a packet to a remote device it calls this function. The function adds the packet to a queue and tells AVDTP that it has something to send. The packet will be send as soon as the stream goes to AVDTP_STREAM_STATE_STREAMING state. When the packet has been successfully sent a AVDTP_EVT_MEDIA_PACKET_SENT is generated. Otherwise a AVDTP_EVT_MEDIA_PACKET_SEND_FAILED is generated. Regardless of the event generated the consumer can re-use the buffer as AVDTP has removed it from the queue and gave up control over it. As in the case of received buffers, if a channel closed regardless of what has caused that and there are still buffers in the queue AVDTP generates a AVDTP_EVT_MEDIA_PACKET_SENT event for each buffer and sets the data_len field to 0. This is to inform the AVDTP consumer that the buffer has not been used and can be, for example, deallocated.
mgr | AVDTP manager. |
strm_handle | Stream handle. |
buffer | Pointer to a structure that holds the buffer and its parameters. |
TRUE
if the function succeeds. FALSE
otherwise. The function fails only if a stream specified by the strm_handle
parameter void bt_avdtp_cancel_listen | ( | bt_avdtp_mgr_t * | mgr, |
bt_byte | strm_handle, | ||
bt_byte | sep_id | ||
) |
Cancel listening for incoming connections.
This function removes a SEP from a list of SEPS which a stream can use for incoming requests.
mgr | AVDTP manager. |
strm_handle | Stream handle. |
sep_id | Local SEP ID. |
TRUE
if the function succeeds. FALSE
otherwise. bt_bool bt_avdtp_clear_media_tx_queue | ( | bt_avdtp_mgr_t * | mgr, |
bt_byte | strm_handle | ||
) |
Clear send queue.
When the consumer of AVDTP wants to send a packet to a remote device it calls bt_avdtp_add_media_tx_buffer function. The function adds the packet to a queue and tells AVDTP that it has something to send. The packet will be send as soon as the stream goes to AVDTP_STREAM_STATE_STREAMING state. The consumer can remove all packets from the queue before they have been sent to a remote device by calling bt_avdtp_clear_media_tx_queue.
mgr | AVDTP manager. |
strm_handle | Stream handle. |
TRUE
if the function succeeds. FALSE
otherwise. The function fails only if a stream specified by the strm_handle
parameter bt_bool bt_avdtp_close_stream | ( | bt_avdtp_mgr_t * | mgr, |
bt_byte | strm_handle | ||
) |
Close a stream.
This function tries to close a stream by sending a request to the remote party. The stream has to be in AVDTP_STREAM_STATE_OPEN or AVDTP_STREAM_STATE_STREAMING state. As a result of this operation the AVDTP_EVT_CLOSE_STREAM_COMPLETED event will be generated. If the stream has been closed the evt_param.bt_avdtp_evt_close_stream_completed_t.err_code
== AVDTP_ERROR_SUCCESS. Otherwise, if the remote device for any reason cannot or does not wish to close the stream, the evt_param.bt_avdtp_evt_close_stream_completed_t.err_code
== the error code sent by the remote.
mgr | AVDTP manager. |
strm_handle | Stream handle. |
TRUE
if the function succeeds, i.e. the actual request has been sent to the remote party. FALSE
otherwise. No events will be generated. bt_byte bt_avdtp_create_stream | ( | bt_avdtp_mgr_t * | mgr | ) |
Create a stream.
This function allocates memory for storing stream's data and assigns a stream handle. The stream handle is used to manipulate the stream - open, close, configure, suspend, abort.
mgr | AVDTP manager. |
Stream
handle if the function succeeds. 0
otherwise. bt_bool bt_avdtp_destroy_stream | ( | bt_avdtp_mgr_t * | mgr, |
bt_byte | strm_handle | ||
) |
Destroy a stream.
This function frees memory used by the stream. The stream has to exist and be in the "idle" state for this function to succeed. I.e. the stream has to be closed or aborted before this function can be called.
mgr | AVDTP manager. |
strm_handle | Stream handle. |
TRUE
if the function succeeds. FALSE
otherwise. bt_bool bt_avdtp_disconnect | ( | bt_avdtp_mgr_t * | mgr, |
bt_bdaddr_t * | remote_addr | ||
) |
Disconnect from a remote device.
This function closes a control and transport channels on all streams associated with the remote device specified by the remote_addr
. As a result of this operation the following events will be generated:
mgr | AVDTP manager. |
remote_addr | The address of a remote device. |
TRUE
if disconnection has been started. FALSE
otherwise. No events will be generated. bt_bool bt_avdtp_discover | ( | bt_avdtp_mgr_t * | mgr, |
bt_bdaddr_t * | remote_addr | ||
) |
Discover SEPs on a remote device.
This function asks the remote device to send a list of all available SEPs. As a result of this operation the following events will be generated:
evt_param.sep_info_received
contains SEP information. evt_param.discover_completed.err_code
== AVDTP_ERROR_SUCCESS. if the remote rejected the request the evt_param.discover_completed.err_code
== the error code sent by the remote.mgr | AVDTP manager. |
remote_addr | The address of a remote device. |
TRUE
if discover request has been sent. FALSE
otherwise. No events will be generated. bt_avdtp_codec_t* bt_avdtp_find_codec | ( | bt_avdtp_mgr_t * | mgr, |
bt_byte | codec_type | ||
) |
Find a codec.
AVDTP in theory can support any type of codec. Each codec uses its own format for exchanging capabilities and configuration information. In order to make out implementation do not care about these formats we use a simple way of telling AVDTP how to parse and serialize codec's configuration. The consumer of AVDTP (e.g. A2DP) for each codec it wishes to support has to register a callback function (one per codec type). That callback has to perform two function. The first one is to read the configuration received from the remote device and store it in a structure defined by the consumer. The second one is to serialize the data from a structure to a format (in case of standard A2DP codecs the format is defined in A2DP specification, vendor specific codecs can define their own formats) suitable for sending as a part of a AVDTP request. This function returns a pointer to a structure that holds a pointer to a codec's callback function.
mgr | AVDTP manager. |
codec_type | Codec type. The codec_type can be one of the following values:
|
TRUE
if the function succeeds. FALSE
otherwise. The function fails if a callback for a codec type specified in the codec
parameter bt_bool bt_avdtp_get_all_capabilities | ( | bt_avdtp_mgr_t * | mgr, |
bt_bdaddr_t * | remote_addr, | ||
bt_byte | seid_acp | ||
) |
Get remote SEP capabilities.
This function asks the remote device to send capabilities of a SEP specified by the seid_acp
. As a result of this operation the following events will be generated:
evt_param.sep_capabilities_received
contains SEP capabilities. evt_param.get_sep_capabilities_completed.err_code
== AVDTP_ERROR_SUCCESS. if the remote rejected the request the evt_param.get_sep_capabilities_completed.err_code
== the error code sent by the remote.mgr | AVDTP manager. |
remote_addr | The address of a remote device. |
seid_acp | The ID of a remote SEP. |
TRUE
if discover request has been sent. FALSE
otherwise. No events will be generated. bt_bool bt_avdtp_get_capabilities | ( | bt_avdtp_mgr_t * | mgr, |
bt_bdaddr_t * | remote_addr, | ||
bt_byte | seid_acp | ||
) |
Get remote SEP capabilities.
This function asks the remote device to send capabilities of a SEP specified by the seid_acp
. As a result of this operation the following events will be generated:
evt_param.sep_capabilities_received
contains SEP capabilities. evt_param.get_sep_capabilities_completed.err_code
== AVDTP_ERROR_SUCCESS. if the remote rejected the request the evt_param.get_sep_capabilities_completed.err_code
== the error code sent by the remote.mgr | AVDTP manager. |
remote_addr | The address of a remote device. |
seid_acp | The ID of a remote SEP. |
TRUE
if discover request has been sent. FALSE
otherwise. No events will be generated. bt_bool bt_avdtp_get_configuration | ( | bt_avdtp_mgr_t * | mgr, |
bt_byte | strm_handle | ||
) |
Get stream configuration.
This function requests stream configuration from a remote device. As a result of this operation the following events will be generated:
ebt_para.sep_capabilities_received.caps
will contain current stream configuration. evt_param.get_stream_configuration_completed.err_code
== AVDTP_ERROR_SUCCESS. if the remote rejected the request the evt_param.get_stream_configuration_completed.err_code
== the error code sent by the remote.mgr | AVDTP manager. |
strm_handle | Stream handle. |
TRUE
if the function succeeds, i.e. the actual request has been sent to the remote party. FALSE
otherwise. No events will be generated. bt_hci_conn_state_t* bt_avdtp_get_hci_connection | ( | bt_avdtp_mgr_t * | mgr, |
bt_byte | strm_handle | ||
) |
Get HCI connection for a stream.
This function returns a pointer to a structure that describes an HCI connection a stream is open on. The return value can be used to call various function from the HCI layer. For example, if an app wants to force disconnection from a remote device it can call bt_hci_disconnect.
mgr | AVDTP manager. |
strm_handle | Stream handle. |
Pointer
to a structure that describes an HCI connection if the function succeeds. NULL
otherwise. The function fails only if a stream specified by the strm_handle
parameter bt_avdtp_mgr_t* bt_avdtp_get_mgr | ( | void | ) |
Return a pointer to an instance of the AVDTP manager.
This function returns a pointer to an instance of the AVDTP manager. There is only one instance of the manager allocated by the stack. The pointer is passed as the first parameter to all AVDTP functions.
bt_avdtp_sep_t* bt_avdtp_get_sep | ( | bt_avdtp_mgr_t * | mgr, |
bt_byte | sep_id | ||
) |
Get a SEP info by its ID.
This function returns a pointer to bt_avdtp_sep_t structure that describes a SEP previously registered with bt_avdtp_register_sep.
mgr | AVDTP manager. |
sep_id | The ID of a SEP. |
Pointer
to bt_avdtp_sep_t if the SEP is in the list of registered SEPs. NULL
otherwise. void* bt_avdtp_get_stream_codec_config | ( | bt_avdtp_mgr_t * | mgr, |
bt_byte | strm_handle | ||
) |
Get the configuration of the codec currently used with the stream.
This function returns a pointer to a structure that contains configuration of the codec currently used with the stream. The structure returned depends on the codec. The dotstack defines structures only for SBC, MPEG-1,2 and MPEG-2,4 AAC codecs:
mgr | AVDTP manager. |
strm_handle | Stream handle. |
AVDTP_STREAM_STATE_CONFIGURED AVDTP_STREAM_STATE_OPEN AVDTP_STREAM_STATE_STREAMING \li NULL otherwise.
bt_byte bt_avdtp_get_stream_codec_type | ( | bt_avdtp_mgr_t * | mgr, |
bt_byte | strm_handle | ||
) |
Get the type of the codec currently used with the stream.
This function returns the type of the codec currently used with the stream.
mgr | AVDTP manager. |
strm_handle | Stream handle. |
AVDTP_STREAM_STATE_CONFIGURED AVDTP_STREAM_STATE_OPEN AVDTP_STREAM_STATE_STREAMING @arg The result will be one of the following values: AVDTP_CODEC_TYPE_SBC: SBC AVDTP_CODEC_TYPE_MPEG1_2_AUDIO: MPEG-1,2 (used in MP3 files) AVDTP_CODEC_TYPE_MPEG2_4_AAC: MPEG-2,4 AAC (used in Apple products) AVDTP_CODEC_TYPE_ATRAC: ATRAC (used in Sony products) AVDTP_CODEC_TYPE_NON_A2DP: Non-A2DP Codec @arg 0xFF otherwise.
bt_avdtp_sep_capabilities_t* bt_avdtp_get_stream_config | ( | bt_avdtp_mgr_t * | mgr, |
bt_byte | strm_handle | ||
) |
Get stream's configuration.
This function returns a pointer to a structure holding the current configuration of stream.
mgr | AVDTP manager. |
strm_handle | Stream handle. |
AVDTP_STREAM_STATE_CONFIGURED AVDTP_STREAM_STATE_OPEN AVDTP_STREAM_STATE_STREAMING \li NULL otherwise.
bt_byte bt_avdtp_get_stream_local_sep_id | ( | bt_avdtp_mgr_t * | mgr, |
bt_byte | strm_handle | ||
) |
Get stream's local SEP ID.
This function returns the ID of the local SEP associated with the stream.
mgr | AVDTP manager. |
strm_handle | Stream handle. |
bt_bdaddr_t* bt_avdtp_get_stream_remote_address | ( | bt_avdtp_mgr_t * | mgr, |
bt_byte | strm_handle | ||
) |
Get stream's remote BT address.
This function returns the address of the remote device associated with the stream.
mgr | AVDTP manager. |
strm_handle | Stream handle. |
bt_byte bt_avdtp_get_stream_remote_sep_id | ( | bt_avdtp_mgr_t * | mgr, |
bt_byte | strm_handle | ||
) |
Get stream's remote SEP ID.
This function returns the ID of the remote SEP associated with the stream.
mgr | AVDTP manager. |
strm_handle | Stream handle. |
bt_byte bt_avdtp_get_stream_state | ( | bt_avdtp_mgr_t * | mgr, |
bt_byte | strm_handle | ||
) |
Get local stream state.
This function returns local state of a stream specified by the strm_handle
. No request is sent to the remote party.
mgr | AVDTP manager. |
strm_handle | Stream handle. |
strm_handle
does not exist or the stream is closed. void bt_avdtp_init | ( | void | ) |
Initialize the AVDTP layer.
This function initializes the AVDTP layer of the stack. It must be called prior to any other AVDTP function can be called.
bt_bool bt_avdtp_listen | ( | bt_avdtp_mgr_t * | mgr, |
bt_byte | strm_handle, | ||
bt_byte | sep_id | ||
) |
Listen for incoming connections.
This function tells a stream that it can use a particular SEP to accept incoming requests to open it. The SEP can be associated with multiple streams but used with only one. The stream has to be closed before the SEP can be used with another stream. For outgoing connections this is not needed. Any SEP can be used with any stream given that the SEP is not already in use by another stream.
mgr | AVDTP manager. |
strm_handle | Stream handle. |
sep_id | Local SEP ID. |
TRUE
if the function succeeds. FALSE
otherwise. bt_bool bt_avdtp_open_stream | ( | bt_avdtp_mgr_t * | mgr, |
bt_byte | strm_handle | ||
) |
Open a stream.
This function tries to open a stream by sending a request to the remote party. The stream has to be already configured with a bt_avdtp_set_configuration call. As a result of this operation the AVDTP_EVT_OPEN_STREAM_COMPLETED event will be generated. If the stream has been open the evt_param.open_stream_completed.err_code
== AVDTP_ERROR_SUCCESS. Otherwise, if the remote device for any reason cannot or does not wish to open the stream, the evt_param.open_stream_completed.err_code
== the error code sent by the remote.
mgr | AVDTP manager. |
strm_handle | Stream handle. |
TRUE
if the function succeeds, i.e. the actual request has been sent to the remote party. FALSE
otherwise. No events will be generated. bt_bool bt_avdtp_reconfigure_stream | ( | bt_avdtp_mgr_t * | mgr, |
bt_byte | strm_handle, | ||
bt_avdtp_sep_capabilities_t * | caps | ||
) |
Reconfigure stream.
This function tries to change the stream's configuration. For this function to succeed the stream has to be open. As a result of this operation the AVDTP_EVT_STREAM_RECONFIGURE_COMPLETED event will be generated. If reconfiguration was a success the evt_param.stream_reconfigure_completed.err_code
== AVDTP_ERROR_SUCCESS. Otherwise the evt_param.stream_reconfigure_completed.err_code
== the error code sent by the remote.
mgr | AVDTP manager. |
strm_handle | Stream handle. |
caps | New stream configuration. |
TRUE
if the function succeeds, i.e. the actual request has been sent to the remote party. FALSE
otherwise. No events will be generated. void bt_avdtp_register_callback | ( | bt_avdtp_mgr_t * | mgr, |
bt_avdtp_mgr_callback_fp | callback, | ||
void * | callback_param | ||
) |
Register a AVDTP application callback.
In order to be notified of various events a consumer of the AVDTP layer has to register a callback function. The stack will call this function whenever a new event has been generated passing the code of the event as the second parameter. The event can be one of the following values:
mgr | AVDTP manager. |
callback | The callback function that will be called when the AVDTP generates an event. |
callback_param | A pointer to arbitrary data to be passed to the callback callback. |
bt_bool bt_avdtp_register_codec | ( | bt_avdtp_mgr_t * | mgr, |
bt_avdtp_codec_t * | codec | ||
) |
Register a codec.
AVDTP in theory can support any type of codec. Each codec uses its own format for exchanging capabilities and configuration information. In order to make out implementation do not care about these formats we use a simple way of telling AVDTP how to parse and serialize codec's configuration. The consumer of AVDTP (e.g. A2DP) for each codec it wishes to support has to register a callback function (one per codec type). That callback has to perform two function. The first one is to read the configuration received from the remote device and store it in a structure defined by the consumer. The second one is to serialize the data from a structure to a format (in case of standard A2DP codecs the format is defined in A2DP specification, vendor specific codecs can define their own formats) suitable for sending as a part of a AVDTP request. This function adds a codec's callback function to an internal list.
mgr | AVDTP manager. |
codec | Pointer to a structure specifying codec type and a callback. |
TRUE
if the function succeeds. FALSE
otherwise. The function fails if there already is a callback for a codec type specified in the codec
parameter. bt_byte bt_avdtp_register_sep | ( | bt_avdtp_mgr_t * | mgr, |
bt_byte | type, | ||
const bt_avdtp_sep_capabilities_t * | caps | ||
) |
Register a SEP with the local AVDTP manager.
This function is used to make a list of SEPs supported by the local ADVTP entity.
mgr | AVDTP manager. |
type | The type of a SEP. The type can be one of the following values:
|
caps | The capabilities of a SEP. |
ID
of a SEP if the function succeeds. FALSE
otherwise. bt_bool bt_avdtp_remove_media_rx_buffer | ( | bt_avdtp_mgr_t * | mgr, |
bt_byte | strm_handle, | ||
bt_media_packet_t * | buffer | ||
) |
Remove a media packet buffer from a receive queue.
The consumer of AVDTP is responsible for allocating and supplying AVDTP with buffers used to store received packets. AVDTP itself only has a queue for storing pointers to buffers supplied by the consumer. When a packet comes in AVDTP finds the first buffer large enough to hold the received packet, copies the packet to the buffer and generates a AVDTP_EVT_MEDIA_PACKET_RECEIVED event. The consumer then has to process the data in the buffer and return it back to the queue. If there is no buffers in the queue or none of the buffers is large enough the received packets is dropped. Each buffer has a field (data_len) that holds the length of the received buffer. This field is never 0 if the buffer contains a packet. If a channel closed regardless of what has caused that and there are still buffers in the queue AVDTP generates a AVDTP_EVT_MEDIA_PACKET_RECEIVED event for each buffer and sets the data_len to 0. This is to inform the AVDTP consumer that the buffer has not been used and can be, for example, deallocated. This function removes a buffer from the receive queue.
mgr | AVDTP manager. |
strm_handle | Stream handle. |
buffer | Pointer to a structure that holds the buffer and its parameters. |
TRUE
if the function succeeds. FALSE
otherwise. The function fails only if a stream specified by the strm_handle
parameter bt_bool bt_avdtp_remove_media_tx_buffer | ( | bt_avdtp_mgr_t * | mgr, |
bt_byte | strm_handle, | ||
bt_media_packet_t * | buffer | ||
) |
Remove a media packet buffer from a send queue.
When the consumer of AVDTP wants to send a packet to a remote device it calls bt_avdtp_add_media_tx_buffer function. The function adds the packet to a queue and tells AVDTP that it has something to send. The packet will be send as soon as the stream goes to AVDTP_STREAM_STATE_STREAMING state. The consumer has a chance to remove a packet from the queue before it has been sent to a remote device by calling bt_avdtp_remove_media_tx_buffer.
mgr | AVDTP manager. |
strm_handle | Stream handle. |
buffer | Pointer to a structure that holds the buffer and its parameters. |
TRUE
if the function succeeds. FALSE
otherwise. The function fails only if a stream specified by the strm_handle
parameter bt_bool bt_avdtp_report_delay | ( | bt_avdtp_mgr_t * | mgr, |
bt_byte | strm_handle, | ||
bt_uint | delay | ||
) |
Report delay value of a Sink to a Source.
This function sends the delay value of a Sink to a Source. This enables synchronous playback of audio and video. Delay reports are always sent from the Sink to the Source. If the Sink's delay report has been accepted by the Source the evt_param.delay_report_completed.err_code
== AVDTP_ERROR_SUCCESS. Otherwise the evt_param.delay_report_completed.err_code
== the error code sent by the Source.
mgr | AVDTP manager. |
strm_handle | Stream handle. |
delay | The delay value in 1/10 milliseconds. |
TRUE
if the function succeeds, i.e. the actual request has been sent to the remote party. FALSE
otherwise. No events will be generated. bt_bool bt_avdtp_security_control | ( | bt_avdtp_mgr_t * | mgr, |
bt_byte | strm_handle, | ||
bt_byte * | sc_data, | ||
bt_byte | sc_data_len | ||
) |
Exchange content protection control data.
This function tries to establish content protection by sending a request to the remote party. The stream can be in any state state except AVDTP_STREAM_STATE_IDLE, AVDTP_STREAM_STATE_CLOSING, AVDTP_STREAM_STATE_ABORTING. As a result of this operation the AVDTP_EVT_STREAM_SECURITY_CONTROL_COMPLETED event will be generated. If the stream's content protection data has been accepted by the remote party the evt_param.security_control_completed.err_code
== AVDTP_ERROR_SUCCESS. Otherwise the evt_param.security_control_completed.err_code
== the error code sent by the remote.
mgr | AVDTP manager. |
strm_handle | Stream handle. |
TRUE
if the function succeeds, i.e. the actual request has been sent to the remote party. FALSE
otherwise. No events will be generated. bt_bool bt_avdtp_set_configuration | ( | bt_avdtp_mgr_t * | mgr, |
bt_byte | strm_handle, | ||
bt_bdaddr_t * | remote_addr, | ||
bt_byte | seid_int, | ||
bt_byte | seid_acp, | ||
const bt_avdtp_sep_capabilities_t * | caps | ||
) |
Set stream configuration.
This function tries to configure a stream before opening it. As a result of this operation the AVDTP_EVT_SET_STREAM_CONFIGURATION_COMPLETED event will be generated. If configuration was a success the evt_param.set_stream_configuration_completed.err_code
== AVDTP_ERROR_SUCCESS. Otherwise the evt_param.set_stream_configuration_completed.err_code
== the error code sent by the remote and evt_param.set_stream_configuration_completed.svc_category
== the value of the first Service Category to fail.
mgr | AVDTP manager. |
strm_handle | Stream handle. |
remote_addr | The address of a remote device. |
seid_int | Local SEP ID. |
seid_acp | Remote SEP ID. |
caps | Stream configuration. |
TRUE
if the function succeeds. FALSE
otherwise. No events will be generated. bt_bool bt_avdtp_set_media_tx_queue_limit | ( | bt_avdtp_mgr_t * | mgr, |
bt_byte | strm_handle, | ||
bt_uint | limit | ||
) |
Set limit on the send queue.
When the consumer of AVDTP wants to send a packet to a remote device it calls bt_avdtp_add_media_tx_buffer function. The function adds the packet to a queue and tells AVDTP that it has something to send. The packet will be send as soon as the stream goes to AVDTP_STREAM_STATE_STREAMING state. By default the send queue can contain unlimited number of packets. The consumer can set a limit on how many packets are held in the queue. In this case when new packet is added to the queue and the length of the queue exceeds the set limit the first packet is removed from the queue. The removed packet is not send to the remote device.
mgr | AVDTP manager. |
strm_handle | Stream handle. |
limit | Queue limit. |
TRUE
if the function succeeds. FALSE
otherwise. The function fails only if a stream specified by the strm_handle
parameter bt_bool bt_avdtp_start | ( | bt_avdtp_mgr_t * | mgr | ) |
Start the AVDTP layer.
This function makes the AVDTP layer ready to accept connection requests from remote device. To make an outgoing connection calling this function is not required.
mgr | AVDTP manager. |
TRUE
if the function succeeds. FALSE
otherwise. bt_bool bt_avdtp_start_stream | ( | bt_avdtp_mgr_t * | mgr, |
bt_byte | strm_handle | ||
) |
Start a stream.
This function tries to start a stream by sending a request to the remote party. The stream has to be in AVDTP_STREAM_STATE_OPEN state. The stream goes to this state as a result of successful configuration or suspension (both can be initiated by either party). As a result of this operation the AVDTP_EVT_START_STREAM_COMPLETED event will be generated. If the stream has been open the evt_param.start_stream_requested.err_code
== AVDTP_ERROR_SUCCESS. Otherwise, if the remote device for any reason cannot or does not wish to start the stream, the evt_param.start_stream_requested.err_code
== the error code sent by the remote.
mgr | AVDTP manager. |
strm_handle | Stream handle. |
TRUE
if the function succeeds, i.e. the actual request has been sent to the remote party. FALSE
otherwise. No events will be generated. bt_bool bt_avdtp_suspend_stream | ( | bt_avdtp_mgr_t * | mgr, |
bt_byte | strm_handle | ||
) |
Suspend a stream.
This function tries to suspend a stream by sending a request to the remote party. The stream has to be in AVDTP_STREAM_STATE_STREAMING state. As a result of this operation the AVDTP_EVT_SUSPEND_STREAM_COMPLETED event will be generated. If the stream has been suspended the evt_param.bt_avdtp_evt_suspend_stream_requested_t.err_code
== AVDTP_ERROR_SUCCESS. Otherwise, if the remote device for any reason cannot or does not wish to suspend the stream, the evt_param.bt_avdtp_evt_suspend_stream_requested_t.err_code
== the error code sent by the remote.
mgr | AVDTP manager. |
strm_handle | Stream handle. |
TRUE
if the function succeeds, i.e. the actual request has been sent to the remote party. FALSE
otherwise. No events will be generated. bt_bool bt_avdtp_unregister_codec | ( | bt_avdtp_mgr_t * | mgr, |
bt_byte | codec_type | ||
) |
Unregister a codec.
AVDTP in theory can support any type of codec. Each codec uses its own format for exchanging capabilities and configuration information. In order to make out implementation do not care about these formats we use a simple way of telling AVDTP how to parse and serialize codec's configuration. The consumer of AVDTP (e.g. A2DP) for each codec it wishes to support has to register a callback function (one per codec type). That callback has to perform two function. The first one is to read the configuration received from the remote device and store it in a structure defined by the consumer. The second one is to serialize the data from a structure to a format (in case of standard A2DP codecs the format is defined in A2DP specification, vendor specific codecs can define their own formats) suitable for sending as a part of a AVDTP request. This function removes a codec's callback function from an internal list.
mgr | AVDTP manager. |
codec_type | Codec type. The codec_type can be one of the following values:
|
TRUE
if the function succeeds. FALSE
otherwise. The function fails if a callback for a codec type specified in the codec
parameter