1/****************************************************************************** 2 * 3 * Copyright (C) 2004-2012 Broadcom Corporation 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at: 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 ******************************************************************************/ 18 19/****************************************************************************** 20 * 21 * This is the public interface file for the advanced audio/video streaming 22 * (AV) subsystem of BTA, Broadcom's Bluetooth application layer for mobile 23 * phones. 24 * 25 ******************************************************************************/ 26#ifndef BTA_AV_API_H 27#define BTA_AV_API_H 28 29#include "avrc_api.h" 30#include "avdt_api.h" 31#include "a2d_api.h" 32#include "bta_api.h" 33 34/***************************************************************************** 35** Constants and data types 36*****************************************************************************/ 37/* Set to TRUE if seperate authorization prompt desired for AVCTP besides A2DP authorization */ 38/* Typically FALSE when AVRCP is used in conjunction with A2DP */ 39#ifndef BTA_AV_WITH_AVCTP_AUTHORIZATION 40#define BTA_AV_WITH_AVCTP_AUTHORIZATION FALSE 41#endif 42 43/* AV status values */ 44#define BTA_AV_SUCCESS 0 /* successful operation */ 45#define BTA_AV_FAIL 1 /* generic failure */ 46#define BTA_AV_FAIL_SDP 2 /* service not found */ 47#define BTA_AV_FAIL_STREAM 3 /* stream connection failed */ 48#define BTA_AV_FAIL_RESOURCES 4 /* no resources */ 49#define BTA_AV_FAIL_ROLE 5 /* failed due to role management related issues */ 50 51typedef UINT8 tBTA_AV_STATUS; 52 53/* AV features masks */ 54#define BTA_AV_FEAT_RCTG 0x0001 /* remote control target */ 55#define BTA_AV_FEAT_RCCT 0x0002 /* remote control controller */ 56#define BTA_AV_FEAT_PROTECT 0x0004 /* streaming media contect protection */ 57#define BTA_AV_FEAT_VENDOR 0x0008 /* remote control vendor dependent commands */ 58#define BTA_AV_FEAT_REPORT 0x0020 /* use reporting service for VDP */ 59#define BTA_AV_FEAT_METADATA 0x0040 /* remote control Metadata Transfer command/response */ 60#define BTA_AV_FEAT_MULTI_AV 0x0080 /* use multi-av, if controller supports it */ 61#define BTA_AV_FEAT_BROWSE 0x0010 /* use browsing channel */ 62#define BTA_AV_FEAT_MASTER 0x0100 /* stream only as master role */ 63#define BTA_AV_FEAT_ADV_CTRL 0x0200 /* remote control Advanced Control command/response */ 64#define BTA_AV_FEAT_DELAY_RPT 0x0400 /* allow delay reporting */ 65#define BTA_AV_FEAT_ACP_START 0x0800 /* start stream when 2nd SNK was accepted */ 66 67/* Internal features */ 68#define BTA_AV_FEAT_NO_SCO_SSPD 0x8000 /* Do not suspend av streaming as to AG events(SCO or Call) */ 69 70typedef UINT16 tBTA_AV_FEAT; 71 72/* AV channel values */ 73#define BTA_AV_CHNL_MSK 0xC0 74#define BTA_AV_CHNL_AUDIO 0x40 /* audio channel */ 75#define BTA_AV_CHNL_VIDEO 0x80 /* video channel */ 76typedef UINT8 tBTA_AV_CHNL; 77 78 79#define BTA_AV_HNDL_MSK 0x3F 80typedef UINT8 tBTA_AV_HNDL; 81/* handle index to mask */ 82#define BTA_AV_HNDL_TO_MSK(h) ((UINT8)(1 << (h))) 83 84/* tBTA_AV_HNDL to mask */ 85#define BTA_AV_HNDL_TYPE_TO_MSK(h) ((UINT8)(1 << (h&BTA_AV_HNDL_MSK))) 86 87/* offset of codec type in codec info byte array */ 88#define BTA_AV_CODEC_TYPE_IDX AVDT_CODEC_TYPE_INDEX /* 2 */ 89 90 91 92/* maximum number of streams created: 1 for audio, 1 for video */ 93#ifndef BTA_AV_NUM_STRS 94#define BTA_AV_NUM_STRS 2 95#endif 96 97#ifndef BTA_AV_MAX_SEPS 98#define BTA_AV_MAX_SEPS 2 99#endif 100 101#ifndef BTA_AV_MAX_A2DP_MTU 102 /*#define BTA_AV_MAX_A2DP_MTU 668 //224 (DM5) * 3 - 4(L2CAP header) */ 103#define BTA_AV_MAX_A2DP_MTU 1008 104#endif 105 106#ifndef BTA_AV_MAX_VDP_MTU 107#define BTA_AV_MAX_VDP_MTU 1008 108#endif 109 110 111/* codec type */ 112#define BTA_AV_CODEC_SBC A2D_MEDIA_CT_SBC /* SBC media codec type */ 113#define BTA_AV_CODEC_M12 A2D_MEDIA_CT_M12 /* MPEG-1, 2 Audio media codec type */ 114#define BTA_AV_CODEC_M24 A2D_MEDIA_CT_M24 /* MPEG-2, 4 AAC media codec type */ 115#define BTA_AV_CODEC_ATRAC A2D_MEDIA_CT_ATRAC /* ATRAC family media codec type */ 116#define BTA_AV_CODEC_H263_P0 VDP_MEDIA_CT_H263_P0 /* H.263 baseline (profile 0) */ 117#define BTA_AV_CODEC_MPEG4 VDP_MEDIA_CT_MPEG4 /* MPEG-4 Visual Simple Profile */ 118#define BTA_AV_CODEC_H263_P3 VDP_MEDIA_CT_H263_P3 /* H.263 profile 3 */ 119#define BTA_AV_CODEC_H263_P8 VDP_MEDIA_CT_H263_P8 /* H.263 profile 8 */ 120#define BTA_AV_CODEC_VEND VDP_MEDIA_CT_VEND /* Non-VDP */ 121 122typedef UINT8 tBTA_AV_CODEC; 123 124/* Company ID in BT assigned numbers */ 125#define BTA_AV_BT_VENDOR_ID VDP_BT_VENDOR_ID /* Broadcom Corporation */ 126 127/* vendor specific codec ID */ 128#define BTA_AV_CODEC_ID_H264 VDP_CODEC_ID_H264 /* Non-VDP codec ID - H.264 */ 129#define BTA_AV_CODEC_ID_IMG VDP_CODEC_ID_IMG /* Non-VDP codec ID - images/slideshow */ 130 131/* operation id list for BTA_AvRemoteCmd */ 132#define BTA_AV_RC_SELECT AVRC_ID_SELECT /* select */ 133#define BTA_AV_RC_UP AVRC_ID_UP /* up */ 134#define BTA_AV_RC_DOWN AVRC_ID_DOWN /* down */ 135#define BTA_AV_RC_LEFT AVRC_ID_LEFT /* left */ 136#define BTA_AV_RC_RIGHT AVRC_ID_RIGHT /* right */ 137#define BTA_AV_RC_RIGHT_UP AVRC_ID_RIGHT_UP /* right-up */ 138#define BTA_AV_RC_RIGHT_DOWN AVRC_ID_RIGHT_DOWN /* right-down */ 139#define BTA_AV_RC_LEFT_UP AVRC_ID_LEFT_UP /* left-up */ 140#define BTA_AV_RC_LEFT_DOWN AVRC_ID_LEFT_DOWN /* left-down */ 141#define BTA_AV_RC_ROOT_MENU AVRC_ID_ROOT_MENU /* root menu */ 142#define BTA_AV_RC_SETUP_MENU AVRC_ID_SETUP_MENU /* setup menu */ 143#define BTA_AV_RC_CONT_MENU AVRC_ID_CONT_MENU /* contents menu */ 144#define BTA_AV_RC_FAV_MENU AVRC_ID_FAV_MENU /* favorite menu */ 145#define BTA_AV_RC_EXIT AVRC_ID_EXIT /* exit */ 146#define BTA_AV_RC_0 AVRC_ID_0 /* 0 */ 147#define BTA_AV_RC_1 AVRC_ID_1 /* 1 */ 148#define BTA_AV_RC_2 AVRC_ID_2 /* 2 */ 149#define BTA_AV_RC_3 AVRC_ID_3 /* 3 */ 150#define BTA_AV_RC_4 AVRC_ID_4 /* 4 */ 151#define BTA_AV_RC_5 AVRC_ID_5 /* 5 */ 152#define BTA_AV_RC_6 AVRC_ID_6 /* 6 */ 153#define BTA_AV_RC_7 AVRC_ID_7 /* 7 */ 154#define BTA_AV_RC_8 AVRC_ID_8 /* 8 */ 155#define BTA_AV_RC_9 AVRC_ID_9 /* 9 */ 156#define BTA_AV_RC_DOT AVRC_ID_DOT /* dot */ 157#define BTA_AV_RC_ENTER AVRC_ID_ENTER /* enter */ 158#define BTA_AV_RC_CLEAR AVRC_ID_CLEAR /* clear */ 159#define BTA_AV_RC_CHAN_UP AVRC_ID_CHAN_UP /* channel up */ 160#define BTA_AV_RC_CHAN_DOWN AVRC_ID_CHAN_DOWN /* channel down */ 161#define BTA_AV_RC_PREV_CHAN AVRC_ID_PREV_CHAN /* previous channel */ 162#define BTA_AV_RC_SOUND_SEL AVRC_ID_SOUND_SEL /* sound select */ 163#define BTA_AV_RC_INPUT_SEL AVRC_ID_INPUT_SEL /* input select */ 164#define BTA_AV_RC_DISP_INFO AVRC_ID_DISP_INFO /* display information */ 165#define BTA_AV_RC_HELP AVRC_ID_HELP /* help */ 166#define BTA_AV_RC_PAGE_UP AVRC_ID_PAGE_UP /* page up */ 167#define BTA_AV_RC_PAGE_DOWN AVRC_ID_PAGE_DOWN /* page down */ 168#define BTA_AV_RC_POWER AVRC_ID_POWER /* power */ 169#define BTA_AV_RC_VOL_UP AVRC_ID_VOL_UP /* volume up */ 170#define BTA_AV_RC_VOL_DOWN AVRC_ID_VOL_DOWN /* volume down */ 171#define BTA_AV_RC_MUTE AVRC_ID_MUTE /* mute */ 172#define BTA_AV_RC_PLAY AVRC_ID_PLAY /* play */ 173#define BTA_AV_RC_STOP AVRC_ID_STOP /* stop */ 174#define BTA_AV_RC_PAUSE AVRC_ID_PAUSE /* pause */ 175#define BTA_AV_RC_RECORD AVRC_ID_RECORD /* record */ 176#define BTA_AV_RC_REWIND AVRC_ID_REWIND /* rewind */ 177#define BTA_AV_RC_FAST_FOR AVRC_ID_FAST_FOR /* fast forward */ 178#define BTA_AV_RC_EJECT AVRC_ID_EJECT /* eject */ 179#define BTA_AV_RC_FORWARD AVRC_ID_FORWARD /* forward */ 180#define BTA_AV_RC_BACKWARD AVRC_ID_BACKWARD /* backward */ 181#define BTA_AV_RC_ANGLE AVRC_ID_ANGLE /* angle */ 182#define BTA_AV_RC_SUBPICT AVRC_ID_SUBPICT /* subpicture */ 183#define BTA_AV_RC_F1 AVRC_ID_F1 /* F1 */ 184#define BTA_AV_RC_F2 AVRC_ID_F2 /* F2 */ 185#define BTA_AV_RC_F3 AVRC_ID_F3 /* F3 */ 186#define BTA_AV_RC_F4 AVRC_ID_F4 /* F4 */ 187#define BTA_AV_RC_F5 AVRC_ID_F5 /* F5 */ 188#define BTA_AV_VENDOR AVRC_ID_VENDOR /* vendor unique */ 189 190typedef UINT8 tBTA_AV_RC; 191 192/* state flag for pass through command */ 193#define BTA_AV_STATE_PRESS AVRC_STATE_PRESS /* key pressed */ 194#define BTA_AV_STATE_RELEASE AVRC_STATE_RELEASE /* key released */ 195 196typedef UINT8 tBTA_AV_STATE; 197 198/* command codes for BTA_AvVendorCmd */ 199#define BTA_AV_CMD_CTRL AVRC_CMD_CTRL 200#define BTA_AV_CMD_STATUS AVRC_CMD_STATUS 201#define BTA_AV_CMD_SPEC_INQ AVRC_CMD_SPEC_INQ 202#define BTA_AV_CMD_NOTIF AVRC_CMD_NOTIF 203#define BTA_AV_CMD_GEN_INQ AVRC_CMD_GEN_INQ 204 205typedef UINT8 tBTA_AV_CMD; 206 207/* response codes for BTA_AvVendorRsp */ 208#define BTA_AV_RSP_NOT_IMPL AVRC_RSP_NOT_IMPL 209#define BTA_AV_RSP_ACCEPT AVRC_RSP_ACCEPT 210#define BTA_AV_RSP_REJ AVRC_RSP_REJ 211#define BTA_AV_RSP_IN_TRANS AVRC_RSP_IN_TRANS 212#define BTA_AV_RSP_IMPL_STBL AVRC_RSP_IMPL_STBL 213#define BTA_AV_RSP_CHANGED AVRC_RSP_CHANGED 214#define BTA_AV_RSP_INTERIM AVRC_RSP_INTERIM 215 216typedef UINT8 tBTA_AV_CODE; 217 218/* error codes for BTA_AvProtectRsp */ 219#define BTA_AV_ERR_NONE A2D_SUCCESS /* Success, no error */ 220#define BTA_AV_ERR_BAD_STATE AVDT_ERR_BAD_STATE /* Message cannot be processed in this state */ 221#define BTA_AV_ERR_RESOURCE AVDT_ERR_RESOURCE /* Insufficient resources */ 222#define BTA_AV_ERR_BAD_CP_TYPE A2D_BAD_CP_TYPE /* The requested Content Protection Type is not supported */ 223#define BTA_AV_ERR_BAD_CP_FORMAT A2D_BAD_CP_FORMAT /* The format of Content Protection Data is not correct */ 224 225typedef UINT8 tBTA_AV_ERR; 226 227 228/* AV callback events */ 229#define BTA_AV_ENABLE_EVT 0 /* AV enabled */ 230#define BTA_AV_REGISTER_EVT 1 /* registered to AVDT */ 231#define BTA_AV_OPEN_EVT 2 /* connection opened */ 232#define BTA_AV_CLOSE_EVT 3 /* connection closed */ 233#define BTA_AV_START_EVT 4 /* stream data transfer started */ 234#define BTA_AV_STOP_EVT 5 /* stream data transfer stopped */ 235#define BTA_AV_PROTECT_REQ_EVT 6 /* content protection request */ 236#define BTA_AV_PROTECT_RSP_EVT 7 /* content protection response */ 237#define BTA_AV_RC_OPEN_EVT 8 /* remote control channel open */ 238#define BTA_AV_RC_CLOSE_EVT 9 /* remote control channel closed */ 239#define BTA_AV_REMOTE_CMD_EVT 10 /* remote control command */ 240#define BTA_AV_REMOTE_RSP_EVT 11 /* remote control response */ 241#define BTA_AV_VENDOR_CMD_EVT 12 /* vendor dependent remote control command */ 242#define BTA_AV_VENDOR_RSP_EVT 13 /* vendor dependent remote control response */ 243#define BTA_AV_RECONFIG_EVT 14 /* reconfigure response */ 244#define BTA_AV_SUSPEND_EVT 15 /* suspend response */ 245#define BTA_AV_PENDING_EVT 16 /* incoming connection pending: 246 * signal channel is open and stream is not open 247 * after BTA_AV_SIG_TIME_VAL ms */ 248#define BTA_AV_META_MSG_EVT 17 /* metadata messages */ 249#define BTA_AV_REJECT_EVT 18 /* incoming connection rejected */ 250#define BTA_AV_RC_FEAT_EVT 19 /* remote control channel peer supported features update */ 251/* Max BTA event */ 252#define BTA_AV_MAX_EVT 20 253 254typedef UINT8 tBTA_AV_EVT; 255 256/* Event associated with BTA_AV_ENABLE_EVT */ 257typedef struct 258{ 259 tBTA_AV_FEAT features; 260} tBTA_AV_ENABLE; 261 262/* Event associated with BTA_AV_REGISTER_EVT */ 263typedef struct 264{ 265 tBTA_AV_CHNL chnl; /* audio/video */ 266 tBTA_AV_HNDL hndl; /* Handle associated with the stream. */ 267 UINT8 app_id; /* ID associated with call to BTA_AvRegister() */ 268 tBTA_AV_STATUS status; 269} tBTA_AV_REGISTER; 270 271/* data associated with BTA_AV_OPEN_EVT */ 272#define BTA_AV_EDR_2MBPS 0x01 273#define BTA_AV_EDR_3MBPS 0x02 274typedef UINT8 tBTA_AV_EDR; 275 276typedef struct 277{ 278 tBTA_AV_CHNL chnl; 279 tBTA_AV_HNDL hndl; 280 BD_ADDR bd_addr; 281 tBTA_AV_STATUS status; 282 BOOLEAN starting; 283 tBTA_AV_EDR edr; /* 0, if peer device does not support EDR */ 284} tBTA_AV_OPEN; 285 286/* data associated with BTA_AV_CLOSE_EVT */ 287typedef struct 288{ 289 tBTA_AV_CHNL chnl; 290 tBTA_AV_HNDL hndl; 291} tBTA_AV_CLOSE; 292 293/* data associated with BTA_AV_START_EVT */ 294typedef struct 295{ 296 tBTA_AV_CHNL chnl; 297 tBTA_AV_HNDL hndl; 298 tBTA_AV_STATUS status; 299 BOOLEAN initiator; /* TRUE, if local device initiates the START */ 300 BOOLEAN suspending; 301} tBTA_AV_START; 302 303/* data associated with BTA_AV_SUSPEND_EVT */ 304typedef struct 305{ 306 tBTA_AV_CHNL chnl; 307 tBTA_AV_HNDL hndl; 308 BOOLEAN initiator; /* TRUE, if local device initiates the SUSPEND */ 309 tBTA_AV_STATUS status; 310} tBTA_AV_SUSPEND; 311 312/* data associated with BTA_AV_RECONFIG_EVT */ 313typedef struct 314{ 315 tBTA_AV_CHNL chnl; 316 tBTA_AV_HNDL hndl; 317 tBTA_AV_STATUS status; 318} tBTA_AV_RECONFIG; 319 320/* data associated with BTA_AV_PROTECT_REQ_EVT */ 321typedef struct 322{ 323 tBTA_AV_CHNL chnl; 324 tBTA_AV_HNDL hndl; 325 UINT8 *p_data; 326 UINT16 len; 327} tBTA_AV_PROTECT_REQ; 328 329/* data associated with BTA_AV_PROTECT_RSP_EVT */ 330typedef struct 331{ 332 tBTA_AV_CHNL chnl; 333 tBTA_AV_HNDL hndl; 334 UINT8 *p_data; 335 UINT16 len; 336 tBTA_AV_ERR err_code; 337} tBTA_AV_PROTECT_RSP; 338 339/* data associated with BTA_AV_RC_OPEN_EVT */ 340typedef struct 341{ 342 UINT8 rc_handle; 343 tBTA_AV_FEAT peer_features; 344 BD_ADDR peer_addr; 345 tBTA_AV_STATUS status; 346} tBTA_AV_RC_OPEN; 347 348/* data associated with BTA_AV_RC_CLOSE_EVT */ 349typedef struct 350{ 351 UINT8 rc_handle; 352 BD_ADDR peer_addr; 353} tBTA_AV_RC_CLOSE; 354 355/* data associated with BTA_AV_RC_FEAT_EVT */ 356typedef struct 357{ 358 UINT8 rc_handle; 359 tBTA_AV_FEAT peer_features; 360} tBTA_AV_RC_FEAT; 361 362/* data associated with BTA_AV_REMOTE_CMD_EVT */ 363typedef struct 364{ 365 UINT8 rc_handle; 366 tBTA_AV_RC rc_id; 367 tBTA_AV_STATE key_state; 368 UINT8 len; 369 UINT8 *p_data; 370 tAVRC_HDR hdr; /* Message header. */ 371 UINT8 label; 372} tBTA_AV_REMOTE_CMD; 373 374/* data associated with BTA_AV_REMOTE_RSP_EVT */ 375typedef struct 376{ 377 UINT8 rc_handle; 378 tBTA_AV_RC rc_id; 379 tBTA_AV_STATE key_state; 380 UINT8 len; 381 UINT8 *p_data; 382 tBTA_AV_CODE rsp_code; 383 UINT8 label; 384} tBTA_AV_REMOTE_RSP; 385 386/* data associated with BTA_AV_VENDOR_CMD_EVT, BTA_AV_VENDOR_RSP_EVT */ 387typedef struct 388{ 389 UINT8 rc_handle; 390 UINT16 len; /* Max vendor dependent message is 512 */ 391 UINT8 label; 392 tBTA_AV_CODE code; 393 UINT32 company_id; 394 UINT8 *p_data; 395} tBTA_AV_VENDOR; 396 397/* data associated with BTA_AV_META_MSG_EVT */ 398typedef struct 399{ 400 UINT8 rc_handle; 401 UINT16 len; 402 UINT8 label; 403 tBTA_AV_CODE code; 404 UINT32 company_id; 405 UINT8 *p_data; 406 tAVRC_MSG *p_msg; 407} tBTA_AV_META_MSG; 408 409/* data associated with BTA_AV_PENDING_EVT */ 410typedef struct 411{ 412 BD_ADDR bd_addr; 413} tBTA_AV_PEND; 414 415/* data associated with BTA_AV_REJECT_EVT */ 416typedef struct 417{ 418 BD_ADDR bd_addr; 419 tBTA_AV_HNDL hndl; /* Handle associated with the stream that rejected the connection. */ 420} tBTA_AV_REJECT; 421 422 423/* union of data associated with AV callback */ 424typedef union 425{ 426 tBTA_AV_CHNL chnl; 427 tBTA_AV_ENABLE enable; 428 tBTA_AV_REGISTER registr; 429 tBTA_AV_OPEN open; 430 tBTA_AV_CLOSE close; 431 tBTA_AV_START start; 432 tBTA_AV_PROTECT_REQ protect_req; 433 tBTA_AV_PROTECT_RSP protect_rsp; 434 tBTA_AV_RC_OPEN rc_open; 435 tBTA_AV_RC_CLOSE rc_close; 436 tBTA_AV_REMOTE_CMD remote_cmd; 437 tBTA_AV_REMOTE_RSP remote_rsp; 438 tBTA_AV_VENDOR vendor_cmd; 439 tBTA_AV_VENDOR vendor_rsp; 440 tBTA_AV_RECONFIG reconfig; 441 tBTA_AV_SUSPEND suspend; 442 tBTA_AV_PEND pend; 443 tBTA_AV_META_MSG meta_msg; 444 tBTA_AV_REJECT reject; 445 tBTA_AV_RC_FEAT rc_feat; 446} tBTA_AV; 447 448 449#define BTA_AVC_PACKET_LEN AVRC_PACKET_LEN 450#define BTA_VENDOR_DATA_OFFSET 6 451#define BTA_VENDOR_HEADER_LEN 4 452#define BTA_MAX_VENDOR_DEPENDENT_DATA_LEN (BTA_AVC_PACKET_LEN-BTA_VENDOR_DATA_OFFSET-BTA_VENDOR_HEADER_LEN) 453#define BTA_GROUP_NAVI_MSG_OP_DATA_LEN 5 454 455#define BTA_ERROR_INVALID_CMD AVRC_STS_BAD_CMD 456#define BTA_ERROR_INVALID_PARAM AVRC_STS_BAD_PARAM 457#define BTA_ERROR_BAD_CONTENTS AVRC_STS_NOT_FOUND 458#define BTA_ERROR_INTERNAL AVRC_STS_INTERNAL_ERR 459 460#define BTA_AV_META_SINGLE_PACKET AVRC_PKT_SINGLE 461 462#define BTA_AV_CO_METADATA AVRC_CO_METADATA 463 464/* AV callback */ 465typedef void (tBTA_AV_CBACK)(tBTA_AV_EVT event, tBTA_AV *p_data); 466 467/* type for stream state machine action functions */ 468typedef void (*tBTA_AV_ACT)(void *p_cb, void *p_data); 469 470/* type for registering VDP */ 471typedef void (tBTA_AV_REG) (tAVDT_CS *p_cs, char *p_service_name, void *p_data); 472 473/* AV configuration structure */ 474typedef struct 475{ 476 UINT32 company_id; /* AVRCP Company ID */ 477 UINT16 avrc_mtu; /* AVRCP MTU at L2CAP for control channel */ 478 UINT16 avrc_br_mtu; /* AVRCP MTU at L2CAP for browsing channel */ 479 UINT16 avrc_ct_cat; /* AVRCP controller categories */ 480 UINT16 avrc_tg_cat; /* AVRCP target categories */ 481 UINT16 sig_mtu; /* AVDTP signaling channel MTU at L2CAP */ 482 UINT16 audio_mtu; /* AVDTP audio transport channel MTU at L2CAP */ 483 const UINT16 *p_audio_flush_to;/* AVDTP audio transport channel flush timeout */ 484 UINT16 audio_mqs; /* AVDTP audio channel max data queue size */ 485 UINT16 video_mtu; /* AVDTP video transport channel MTU at L2CAP */ 486 UINT16 video_flush_to; /* AVDTP video transport channel flush timeout */ 487 BOOLEAN avrc_group; /* TRUE, to accept AVRC 1.3 group nevigation command */ 488 UINT8 num_co_ids; /* company id count in p_meta_co_ids */ 489 UINT8 num_evt_ids; /* event id count in p_meta_evt_ids */ 490 tBTA_AV_CODE rc_pass_rsp; /* the default response code for pass through commands */ 491 const UINT32 *p_meta_co_ids;/* the metadata Get Capabilities response for company id */ 492 const UINT8 *p_meta_evt_ids;/* the the metadata Get Capabilities response for event id */ 493 const tBTA_AV_ACT *p_act_tbl;/* the action function table for VDP stream */ 494 tBTA_AV_REG *p_reg; /* action function to register VDP */ 495} tBTA_AV_CFG; 496 497#ifdef __cplusplus 498extern "C" 499{ 500#endif 501 502/***************************************************************************** 503** External Function Declarations 504*****************************************************************************/ 505 506/******************************************************************************* 507** 508** Function BTA_AvEnable 509** 510** Description Enable the advanced audio/video service. When the enable 511** operation is complete the callback function will be 512** called with a BTA_AV_ENABLE_EVT. This function must 513** be called before other function in the AV API are 514** called. 515** 516** Returns void 517** 518*******************************************************************************/ 519BTA_API void BTA_AvEnable(tBTA_SEC sec_mask, tBTA_AV_FEAT features, 520 tBTA_AV_CBACK *p_cback); 521 522/******************************************************************************* 523** 524** Function BTA_AvDisable 525** 526** Description Disable the advanced audio/video service. 527** 528** 529** Returns void 530** 531*******************************************************************************/ 532BTA_API void BTA_AvDisable(void); 533 534/******************************************************************************* 535** 536** Function BTA_AvRegister 537** 538** Description Register the audio or video service to stack. When the 539** operation is complete the callback function will be 540** called with a BTA_AV_REGISTER_EVT. This function must 541** be called before AVDT stream is open. 542** 543** 544** Returns void 545** 546*******************************************************************************/ 547BTA_API void BTA_AvRegister(tBTA_AV_CHNL chnl, const char *p_service_name, 548 UINT8 app_id); 549 550/******************************************************************************* 551** 552** Function BTA_AvDeregister 553** 554** Description Deregister the audio or video service 555** 556** Returns void 557** 558*******************************************************************************/ 559BTA_API void BTA_AvDeregister(tBTA_AV_HNDL hndl); 560 561/******************************************************************************* 562** 563** Function BTA_AvOpen 564** 565** Description Opens an advanced audio/video connection to a peer device. 566** When connection is open callback function is called 567** with a BTA_AV_OPEN_EVT. 568** 569** Returns void 570** 571*******************************************************************************/ 572BTA_API void BTA_AvOpen(BD_ADDR bd_addr, tBTA_AV_HNDL handle, 573 BOOLEAN use_rc, tBTA_SEC sec_mask); 574 575/******************************************************************************* 576** 577** Function BTA_AvClose 578** 579** Description Close the current streams. 580** 581** Returns void 582** 583*******************************************************************************/ 584BTA_API void BTA_AvClose(tBTA_AV_HNDL handle); 585 586/******************************************************************************* 587** 588** Function BTA_AvDisconnect 589** 590** Description Close the connection to the address. 591** 592** Returns void 593** 594*******************************************************************************/ 595BTA_API void BTA_AvDisconnect(BD_ADDR bd_addr); 596 597/******************************************************************************* 598** 599** Function BTA_AvStart 600** 601** Description Start audio/video stream data transfer. 602** 603** Returns void 604** 605*******************************************************************************/ 606BTA_API void BTA_AvStart(void); 607 608/******************************************************************************* 609** 610** Function BTA_AvStop 611** 612** Description Stop audio/video stream data transfer. 613** If suspend is TRUE, this function sends AVDT suspend signal 614** to the connected peer(s). 615** 616** Returns void 617** 618*******************************************************************************/ 619BTA_API void BTA_AvStop(BOOLEAN suspend); 620 621/******************************************************************************* 622** 623** Function BTA_AvReconfig 624** 625** Description Reconfigure the audio/video stream. 626** If suspend is TRUE, this function tries the suspend/reconfigure 627** procedure first. 628** If suspend is FALSE or when suspend/reconfigure fails, 629** this function closes and re-opens the AVDT connection. 630** 631** Returns void 632** 633*******************************************************************************/ 634BTA_API void BTA_AvReconfig(tBTA_AV_HNDL hndl, BOOLEAN suspend, UINT8 sep_info_idx, 635 UINT8 *p_codec_info, UINT8 num_protect, UINT8 *p_protect_info); 636 637/******************************************************************************* 638** 639** Function BTA_AvProtectReq 640** 641** Description Send a content protection request. This function can only 642** be used if AV is enabled with feature BTA_AV_FEAT_PROTECT. 643** 644** Returns void 645** 646*******************************************************************************/ 647BTA_API void BTA_AvProtectReq(tBTA_AV_HNDL hndl, UINT8 *p_data, UINT16 len); 648 649/******************************************************************************* 650** 651** Function BTA_AvProtectRsp 652** 653** Description Send a content protection response. This function must 654** be called if a BTA_AV_PROTECT_REQ_EVT is received. 655** This function can only be used if AV is enabled with 656** feature BTA_AV_FEAT_PROTECT. 657** 658** Returns void 659** 660*******************************************************************************/ 661BTA_API void BTA_AvProtectRsp(tBTA_AV_HNDL hndl, UINT8 error_code, UINT8 *p_data, 662 UINT16 len); 663 664/******************************************************************************* 665** 666** Function BTA_AvRemoteCmd 667** 668** Description Send a remote control command. This function can only 669** be used if AV is enabled with feature BTA_AV_FEAT_RCCT. 670** 671** Returns void 672** 673*******************************************************************************/ 674BTA_API void BTA_AvRemoteCmd(UINT8 rc_handle, UINT8 label, tBTA_AV_RC rc_id, 675 tBTA_AV_STATE key_state); 676 677/******************************************************************************* 678** 679** Function BTA_AvVendorCmd 680** 681** Description Send a vendor dependent remote control command. This 682** function can only be used if AV is enabled with feature 683** BTA_AV_FEAT_VENDOR. 684** 685** Returns void 686** 687*******************************************************************************/ 688BTA_API void BTA_AvVendorCmd(UINT8 rc_handle, UINT8 label, tBTA_AV_CODE cmd_code, 689 UINT8 *p_data, UINT16 len); 690 691/******************************************************************************* 692** 693** Function BTA_AvVendorRsp 694** 695** Description Send a vendor dependent remote control response. 696** This function must be called if a BTA_AV_VENDOR_CMD_EVT 697** is received. This function can only be used if AV is 698** enabled with feature BTA_AV_FEAT_VENDOR. 699** 700** Returns void 701** 702*******************************************************************************/ 703BTA_API void BTA_AvVendorRsp(UINT8 rc_handle, UINT8 label, tBTA_AV_CODE rsp_code, 704 UINT8 *p_data, UINT16 len, UINT32 company_id); 705 706 707/******************************************************************************* 708** 709** Function BTA_AvOpenRc 710** 711** Description Open an AVRCP connection toward the device with the 712** specified handle 713** 714** Returns void 715** 716*******************************************************************************/ 717BTA_API void BTA_AvOpenRc(tBTA_AV_HNDL handle); 718 719/******************************************************************************* 720** 721** Function BTA_AvCloseRc 722** 723** Description Close an AVRCP connection 724** 725** Returns void 726** 727*******************************************************************************/ 728BTA_API void BTA_AvCloseRc(UINT8 rc_handle); 729 730/******************************************************************************* 731** 732** Function BTA_AvMetaRsp 733** 734** Description Send a Metadata command/response. The message contained 735** in p_pkt can be composed with AVRC utility functions. 736** This function can only be used if AV is enabled with feature 737** BTA_AV_FEAT_METADATA. 738** 739** Returns void 740** 741*******************************************************************************/ 742BTA_API void BTA_AvMetaRsp(UINT8 rc_handle, UINT8 label, tBTA_AV_CODE rsp_code, 743 BT_HDR *p_pkt); 744 745/******************************************************************************* 746** 747** Function BTA_AvMetaCmd 748** 749** Description Send a Metadata/Advanced Control command. The message contained 750** in p_pkt can be composed with AVRC utility functions. 751** This function can only be used if AV is enabled with feature 752** BTA_AV_FEAT_METADATA. 753** This message is sent only when the peer supports the TG role. 754*8 The only command makes sense right now is the absolute volume command. 755** 756** Returns void 757** 758*******************************************************************************/ 759BTA_API void BTA_AvMetaCmd(UINT8 rc_handle, UINT8 label, tBTA_AV_CMD cmd_code, BT_HDR *p_pkt); 760 761#ifdef __cplusplus 762} 763#endif 764 765#endif /* BTA_AV_API_H */ 766