1 /****************************************************************************** 2 * 3 * Copyright 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 "a2dp_codec_api.h" 30 #include "avdt_api.h" 31 #include "avrc_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 38 * authorization */ 39 /* Typically FALSE when AVRCP is used in conjunction with A2DP */ 40 #ifndef BTA_AV_WITH_AVCTP_AUTHORIZATION 41 #define BTA_AV_WITH_AVCTP_AUTHORIZATION FALSE 42 #endif 43 44 /* AV status values */ 45 #define BTA_AV_SUCCESS 0 /* successful operation */ 46 #define BTA_AV_FAIL 1 /* generic failure */ 47 #define BTA_AV_FAIL_SDP 2 /* service not found */ 48 #define BTA_AV_FAIL_STREAM 3 /* stream connection failed */ 49 #define BTA_AV_FAIL_RESOURCES 4 /* no resources */ 50 #define BTA_AV_FAIL_ROLE 5 /* failed due to role management related issues */ 51 #define BTA_AV_FAIL_GET_CAP \ 52 6 /* get capability failed due to no SEP availale on the peer */ 53 54 typedef uint8_t tBTA_AV_STATUS; 55 56 /* AV features masks */ 57 #define BTA_AV_FEAT_RCTG 0x0001 /* remote control target */ 58 #define BTA_AV_FEAT_RCCT 0x0002 /* remote control controller */ 59 #define BTA_AV_FEAT_PROTECT 0x0004 /* streaming media contect protection */ 60 #define BTA_AV_FEAT_VENDOR \ 61 0x0008 /* remote control vendor dependent commands \ 62 */ 63 #define BTA_AV_FEAT_REPORT 0x0020 /* use reporting service for VDP */ 64 #define BTA_AV_FEAT_METADATA \ 65 0x0040 /* remote control Metadata Transfer command/response */ 66 #define BTA_AV_FEAT_MULTI_AV \ 67 0x0080 /* use multi-av, if controller supports it */ 68 #define BTA_AV_FEAT_BROWSE 0x0010 /* use browsing channel */ 69 #define BTA_AV_FEAT_MASTER 0x0100 /* stream only as master role */ 70 #define BTA_AV_FEAT_ADV_CTRL \ 71 0x0200 /* remote control Advanced Control command/response */ 72 #define BTA_AV_FEAT_DELAY_RPT 0x0400 /* allow delay reporting */ 73 #define BTA_AV_FEAT_ACP_START \ 74 0x0800 /* start stream when 2nd SNK was accepted */ 75 #define BTA_AV_FEAT_APP_SETTING 0x2000 /* Player app setting support */ 76 77 /* Internal features */ 78 #define BTA_AV_FEAT_NO_SCO_SSPD \ 79 0x8000 /* Do not suspend av streaming as to AG events(SCO or Call) */ 80 81 typedef uint16_t tBTA_AV_FEAT; 82 83 /* AV channel values */ 84 #define BTA_AV_CHNL_MSK 0xC0 85 #define BTA_AV_CHNL_AUDIO 0x40 /* audio channel */ 86 #define BTA_AV_CHNL_VIDEO 0x80 /* video channel */ 87 typedef uint8_t tBTA_AV_CHNL; 88 89 #define BTA_AV_HNDL_MSK 0x3F 90 typedef uint8_t tBTA_AV_HNDL; 91 /* handle index to mask */ 92 #define BTA_AV_HNDL_TO_MSK(h) ((uint8_t)(1 << (h))) 93 94 /* maximum number of streams created */ 95 #ifndef BTA_AV_NUM_STRS 96 #define BTA_AV_NUM_STRS 6 97 #endif 98 99 /* operation id list for BTA_AvRemoteCmd */ 100 typedef uint8_t tBTA_AV_RC; 101 102 /* state flag for pass through command */ 103 typedef uint8_t tBTA_AV_STATE; 104 105 /* command codes for BTA_AvVendorCmd */ 106 typedef uint8_t tBTA_AV_CMD; 107 108 /* response codes for BTA_AvVendorRsp */ 109 typedef uint8_t tBTA_AV_CODE; 110 111 /* error codes for BTA_AvProtectRsp */ 112 typedef uint8_t tBTA_AV_ERR; 113 114 /* AV callback events */ 115 #define BTA_AV_ENABLE_EVT 0 /* AV enabled */ 116 #define BTA_AV_REGISTER_EVT 1 /* registered to AVDT */ 117 #define BTA_AV_OPEN_EVT 2 /* connection opened */ 118 #define BTA_AV_CLOSE_EVT 3 /* connection closed */ 119 #define BTA_AV_START_EVT 4 /* stream data transfer started */ 120 #define BTA_AV_STOP_EVT 5 /* stream data transfer stopped */ 121 #define BTA_AV_PROTECT_REQ_EVT 6 /* content protection request */ 122 #define BTA_AV_PROTECT_RSP_EVT 7 /* content protection response */ 123 #define BTA_AV_RC_OPEN_EVT 8 /* remote control channel open */ 124 #define BTA_AV_RC_CLOSE_EVT 9 /* remote control channel closed */ 125 #define BTA_AV_REMOTE_CMD_EVT 10 /* remote control command */ 126 #define BTA_AV_REMOTE_RSP_EVT 11 /* remote control response */ 127 #define BTA_AV_VENDOR_CMD_EVT 12 /* vendor dependent remote control command */ 128 #define BTA_AV_VENDOR_RSP_EVT \ 129 13 /* vendor dependent remote control response \ 130 */ 131 #define BTA_AV_RECONFIG_EVT 14 /* reconfigure response */ 132 #define BTA_AV_SUSPEND_EVT 15 /* suspend response */ 133 #define BTA_AV_PENDING_EVT \ 134 16 /* incoming connection pending: \ 135 * signal channel is open and stream is \ 136 * not open after \ 137 * BTA_AV_SIGNALLING_TIMEOUT_MS */ 138 #define BTA_AV_META_MSG_EVT 17 /* metadata messages */ 139 #define BTA_AV_REJECT_EVT 18 /* incoming connection rejected */ 140 #define BTA_AV_RC_FEAT_EVT \ 141 19 /* remote control channel peer supported features update */ 142 #define BTA_AV_SINK_MEDIA_CFG_EVT 20 /* command to configure codec */ 143 #define BTA_AV_SINK_MEDIA_DATA_EVT 21 /* sending data to Media Task */ 144 #define BTA_AV_OFFLOAD_START_RSP_EVT 22 /* a2dp offload start response */ 145 #define BTA_AV_RC_BROWSE_OPEN_EVT 23 /* remote control channel open */ 146 #define BTA_AV_RC_BROWSE_CLOSE_EVT 24 /* remote control channel closed */ 147 /* Max BTA event */ 148 #define BTA_AV_MAX_EVT 25 149 150 typedef uint8_t tBTA_AV_EVT; 151 152 typedef enum { 153 BTA_AV_CODEC_TYPE_UNKNOWN = 0x00, 154 BTA_AV_CODEC_TYPE_SBC = 0x01, 155 BTA_AV_CODEC_TYPE_AAC = 0x02, 156 BTA_AV_CODEC_TYPE_APTX = 0x04, 157 BTA_AV_CODEC_TYPE_APTXHD = 0x08, 158 BTA_AV_CODEC_TYPE_LDAC = 0x10 159 } tBTA_AV_CODEC_TYPE; 160 161 /* Event associated with BTA_AV_ENABLE_EVT */ 162 typedef struct { tBTA_AV_FEAT features; } tBTA_AV_ENABLE; 163 164 /* Event associated with BTA_AV_REGISTER_EVT */ 165 typedef struct { 166 tBTA_AV_CHNL chnl; /* audio/video */ 167 tBTA_AV_HNDL hndl; /* Handle associated with the stream. */ 168 uint8_t app_id; /* ID associated with call to BTA_AvRegister() */ 169 tBTA_AV_STATUS status; 170 } tBTA_AV_REGISTER; 171 172 /* data associated with BTA_AV_OPEN_EVT */ 173 #define BTA_AV_EDR_2MBPS 0x01 174 #define BTA_AV_EDR_3MBPS 0x02 175 typedef uint8_t tBTA_AV_EDR; 176 177 typedef struct { 178 tBTA_AV_CHNL chnl; 179 tBTA_AV_HNDL hndl; 180 RawAddress bd_addr; 181 tBTA_AV_STATUS status; 182 bool starting; 183 tBTA_AV_EDR edr; /* 0, if peer device does not support EDR */ 184 uint8_t sep; /* sep type of peer device */ 185 } tBTA_AV_OPEN; 186 187 /* data associated with BTA_AV_CLOSE_EVT */ 188 typedef struct { 189 tBTA_AV_CHNL chnl; 190 tBTA_AV_HNDL hndl; 191 } tBTA_AV_CLOSE; 192 193 /* data associated with BTA_AV_START_EVT */ 194 typedef struct { 195 tBTA_AV_CHNL chnl; 196 tBTA_AV_HNDL hndl; 197 tBTA_AV_STATUS status; 198 bool initiator; /* true, if local device initiates the START */ 199 bool suspending; 200 } tBTA_AV_START; 201 202 /* data associated with BTA_AV_SUSPEND_EVT, BTA_AV_STOP_EVT */ 203 typedef struct { 204 tBTA_AV_CHNL chnl; 205 tBTA_AV_HNDL hndl; 206 bool initiator; /* true, if local device initiates the SUSPEND */ 207 tBTA_AV_STATUS status; 208 } tBTA_AV_SUSPEND; 209 210 /* data associated with BTA_AV_RECONFIG_EVT */ 211 typedef struct { 212 tBTA_AV_CHNL chnl; 213 tBTA_AV_HNDL hndl; 214 tBTA_AV_STATUS status; 215 } tBTA_AV_RECONFIG; 216 217 /* data associated with BTA_AV_PROTECT_REQ_EVT */ 218 typedef struct { 219 tBTA_AV_CHNL chnl; 220 tBTA_AV_HNDL hndl; 221 uint8_t* p_data; 222 uint16_t len; 223 } tBTA_AV_PROTECT_REQ; 224 225 /* data associated with BTA_AV_PROTECT_RSP_EVT */ 226 typedef struct { 227 tBTA_AV_CHNL chnl; 228 tBTA_AV_HNDL hndl; 229 uint8_t* p_data; 230 uint16_t len; 231 tBTA_AV_ERR err_code; 232 } tBTA_AV_PROTECT_RSP; 233 234 /* data associated with BTA_AV_RC_OPEN_EVT */ 235 typedef struct { 236 uint8_t rc_handle; 237 tBTA_AV_FEAT peer_features; 238 RawAddress peer_addr; 239 tBTA_AV_STATUS status; 240 } tBTA_AV_RC_OPEN; 241 242 /* data associated with BTA_AV_RC_CLOSE_EVT */ 243 typedef struct { 244 uint8_t rc_handle; 245 RawAddress peer_addr; 246 } tBTA_AV_RC_CLOSE; 247 248 /* data associated with BTA_AV_RC_BROWSE_OPEN_EVT */ 249 typedef struct { 250 uint8_t rc_handle; 251 RawAddress peer_addr; 252 tBTA_AV_STATUS status; 253 } tBTA_AV_RC_BROWSE_OPEN; 254 255 /* data associated with BTA_AV_RC_BROWSE_CLOSE_EVT */ 256 typedef struct { 257 uint8_t rc_handle; 258 RawAddress peer_addr; 259 } tBTA_AV_RC_BROWSE_CLOSE; 260 261 /* data associated with BTA_AV_RC_FEAT_EVT */ 262 typedef struct { 263 uint8_t rc_handle; 264 tBTA_AV_FEAT peer_features; 265 RawAddress peer_addr; 266 } tBTA_AV_RC_FEAT; 267 268 /* data associated with BTA_AV_REMOTE_CMD_EVT */ 269 typedef struct { 270 uint8_t rc_handle; 271 tBTA_AV_RC rc_id; 272 tBTA_AV_STATE key_state; 273 uint8_t len; 274 uint8_t* p_data; 275 tAVRC_HDR hdr; /* Message header. */ 276 uint8_t label; 277 } tBTA_AV_REMOTE_CMD; 278 279 /* data associated with BTA_AV_REMOTE_RSP_EVT */ 280 typedef struct { 281 uint8_t rc_handle; 282 tBTA_AV_RC rc_id; 283 tBTA_AV_STATE key_state; 284 uint8_t len; 285 uint8_t* p_data; 286 tBTA_AV_CODE rsp_code; 287 uint8_t label; 288 } tBTA_AV_REMOTE_RSP; 289 290 /* data associated with BTA_AV_VENDOR_CMD_EVT, BTA_AV_VENDOR_RSP_EVT */ 291 typedef struct { 292 uint8_t rc_handle; 293 uint16_t len; /* Max vendor dependent message is 512 */ 294 uint8_t label; 295 tBTA_AV_CODE code; 296 uint32_t company_id; 297 uint8_t* p_data; 298 } tBTA_AV_VENDOR; 299 300 /* data associated with BTA_AV_META_MSG_EVT */ 301 typedef struct { 302 uint8_t rc_handle; 303 uint16_t len; 304 uint8_t label; 305 tBTA_AV_CODE code; 306 uint32_t company_id; 307 uint8_t* p_data; 308 tAVRC_MSG* p_msg; 309 } tBTA_AV_META_MSG; 310 311 /* data associated with BTA_AV_PENDING_EVT */ 312 typedef struct { RawAddress bd_addr; } tBTA_AV_PEND; 313 314 /* data associated with BTA_AV_REJECT_EVT */ 315 typedef struct { 316 RawAddress bd_addr; 317 tBTA_AV_HNDL hndl; /* Handle associated with the stream that rejected the 318 connection. */ 319 } tBTA_AV_REJECT; 320 321 /* union of data associated with AV callback */ 322 typedef union { 323 tBTA_AV_CHNL chnl; 324 tBTA_AV_ENABLE enable; 325 tBTA_AV_REGISTER registr; 326 tBTA_AV_OPEN open; 327 tBTA_AV_CLOSE close; 328 tBTA_AV_START start; 329 tBTA_AV_PROTECT_REQ protect_req; 330 tBTA_AV_PROTECT_RSP protect_rsp; 331 tBTA_AV_RC_OPEN rc_open; 332 tBTA_AV_RC_CLOSE rc_close; 333 tBTA_AV_RC_BROWSE_OPEN rc_browse_open; 334 tBTA_AV_RC_BROWSE_CLOSE rc_browse_close; 335 tBTA_AV_REMOTE_CMD remote_cmd; 336 tBTA_AV_REMOTE_RSP remote_rsp; 337 tBTA_AV_VENDOR vendor_cmd; 338 tBTA_AV_VENDOR vendor_rsp; 339 tBTA_AV_RECONFIG reconfig; 340 tBTA_AV_SUSPEND suspend; 341 tBTA_AV_PEND pend; 342 tBTA_AV_META_MSG meta_msg; 343 tBTA_AV_REJECT reject; 344 tBTA_AV_RC_FEAT rc_feat; 345 tBTA_AV_STATUS status; 346 } tBTA_AV; 347 348 typedef struct { 349 uint8_t* codec_info; 350 RawAddress bd_addr; 351 } tBTA_AVK_CONFIG; 352 353 /* union of data associated with AV Media callback */ 354 typedef union { 355 BT_HDR* p_data; 356 tBTA_AVK_CONFIG avk_config; 357 } tBTA_AV_MEDIA; 358 359 #define BTA_GROUP_NAVI_MSG_OP_DATA_LEN 5 360 361 /* AV callback */ 362 typedef void(tBTA_AV_CBACK)(tBTA_AV_EVT event, tBTA_AV* p_data); 363 typedef void(tBTA_AV_SINK_DATA_CBACK)(tBTA_AV_EVT event, tBTA_AV_MEDIA* p_data); 364 365 /* type for stream state machine action functions */ 366 struct tBTA_AV_SCB; 367 union tBTA_AV_DATA; 368 typedef void (*tBTA_AV_ACT)(tBTA_AV_SCB* p_cb, tBTA_AV_DATA* p_data); 369 370 /* AV configuration structure */ 371 typedef struct { 372 uint32_t company_id; /* AVRCP Company ID */ 373 uint16_t avrc_mtu; /* AVRCP MTU at L2CAP for control channel */ 374 uint16_t avrc_br_mtu; /* AVRCP MTU at L2CAP for browsing channel */ 375 uint16_t avrc_ct_cat; /* AVRCP controller categories */ 376 uint16_t avrc_tg_cat; /* AVRCP target categories */ 377 uint16_t sig_mtu; /* AVDTP signaling channel MTU at L2CAP */ 378 uint16_t audio_mtu; /* AVDTP audio transport channel MTU at L2CAP */ 379 const uint16_t* 380 p_audio_flush_to; /* AVDTP audio transport channel flush timeout */ 381 uint16_t audio_mqs; /* AVDTP audio channel max data queue size */ 382 bool avrc_group; /* true, to accept AVRC 1.3 group nevigation command */ 383 uint8_t num_co_ids; /* company id count in p_meta_co_ids */ 384 uint8_t num_evt_ids; /* event id count in p_meta_evt_ids */ 385 tBTA_AV_CODE 386 rc_pass_rsp; /* the default response code for pass through commands */ 387 const uint32_t* 388 p_meta_co_ids; /* the metadata Get Capabilities response for company id */ 389 const uint8_t* p_meta_evt_ids; /* the the metadata Get Capabilities response 390 for event id */ 391 const tBTA_AV_ACT* p_act_tbl; /* action function table for audio stream */ 392 char avrc_controller_name[BTA_SERVICE_NAME_LEN]; /* Default AVRCP controller 393 name */ 394 char avrc_target_name[BTA_SERVICE_NAME_LEN]; /* Default AVRCP target name*/ 395 } tBTA_AV_CFG; 396 397 /***************************************************************************** 398 * External Function Declarations 399 ****************************************************************************/ 400 401 /******************************************************************************* 402 * 403 * Function BTA_AvEnable 404 * 405 * Description Enable the advanced audio/video service. When the enable 406 * operation is complete the callback function will be 407 * called with a BTA_AV_ENABLE_EVT. This function must 408 * be called before other function in the AV API are 409 * called. 410 * 411 * Returns void 412 * 413 ******************************************************************************/ 414 void BTA_AvEnable(tBTA_SEC sec_mask, tBTA_AV_FEAT features, 415 tBTA_AV_CBACK* p_cback); 416 417 /******************************************************************************* 418 * 419 * Function BTA_AvDisable 420 * 421 * Description Disable the advanced audio/video service. 422 * 423 * 424 * Returns void 425 * 426 ******************************************************************************/ 427 void BTA_AvDisable(void); 428 429 /******************************************************************************* 430 * 431 * Function BTA_AvRegister 432 * 433 * Description Register the audio or video service to stack. When the 434 * operation is complete the callback function will be 435 * called with a BTA_AV_REGISTER_EVT. This function must 436 * be called before AVDT stream is open. 437 * 438 * 439 * Returns void 440 * 441 ******************************************************************************/ 442 void BTA_AvRegister(tBTA_AV_CHNL chnl, const char* p_service_name, 443 uint8_t app_id, tBTA_AV_SINK_DATA_CBACK* p_sink_data_cback, 444 uint16_t service_uuid); 445 446 /******************************************************************************* 447 * 448 * Function BTA_AvDeregister 449 * 450 * Description Deregister the audio or video service 451 * 452 * Returns void 453 * 454 ******************************************************************************/ 455 void BTA_AvDeregister(tBTA_AV_HNDL hndl); 456 457 /******************************************************************************* 458 * 459 * Function BTA_AvOpen 460 * 461 * Description Opens an advanced audio/video connection to a peer device. 462 * When connection is open callback function is called 463 * with a BTA_AV_OPEN_EVT. 464 * 465 * Returns void 466 * 467 ******************************************************************************/ 468 void BTA_AvOpen(const RawAddress& bd_addr, tBTA_AV_HNDL handle, bool use_rc, 469 tBTA_SEC sec_mask, uint16_t uuid); 470 471 /******************************************************************************* 472 * 473 * Function BTA_AvClose 474 * 475 * Description Close the current streams. 476 * 477 * Returns void 478 * 479 ******************************************************************************/ 480 void BTA_AvClose(tBTA_AV_HNDL handle); 481 482 /******************************************************************************* 483 * 484 * Function BTA_AvDisconnect 485 * 486 * Description Close the connection to the address. 487 * 488 * Returns void 489 * 490 ******************************************************************************/ 491 void BTA_AvDisconnect(const RawAddress& bd_addr); 492 493 /******************************************************************************* 494 * 495 * Function BTA_AvStart 496 * 497 * Description Start audio/video stream data transfer. 498 * 499 * Returns void 500 * 501 ******************************************************************************/ 502 void BTA_AvStart(tBTA_AV_HNDL handle); 503 504 /******************************************************************************* 505 * 506 * Function BTA_AvStop 507 * 508 * Description Stop audio/video stream data transfer. 509 * If suspend is true, this function sends AVDT suspend signal 510 * to the connected peer(s). 511 * 512 * Returns void 513 * 514 ******************************************************************************/ 515 void BTA_AvStop(tBTA_AV_HNDL handle, bool suspend); 516 517 /******************************************************************************* 518 * 519 * Function BTA_AvReconfig 520 * 521 * Description Reconfigure the audio/video stream. 522 * If suspend is true, this function tries the 523 * suspend/reconfigure procedure first. 524 * If suspend is false or when suspend/reconfigure fails, 525 * this function closes and re-opens the AVDT connection. 526 * 527 * Returns void 528 * 529 ******************************************************************************/ 530 void BTA_AvReconfig(tBTA_AV_HNDL hndl, bool suspend, uint8_t sep_info_idx, 531 uint8_t* p_codec_info, uint8_t num_protect, 532 const uint8_t* p_protect_info); 533 534 /******************************************************************************* 535 * 536 * Function BTA_AvProtectReq 537 * 538 * Description Send a content protection request. This function can only 539 * be used if AV is enabled with feature BTA_AV_FEAT_PROTECT. 540 * 541 * Returns void 542 * 543 ******************************************************************************/ 544 void BTA_AvProtectReq(tBTA_AV_HNDL hndl, uint8_t* p_data, uint16_t len); 545 546 /******************************************************************************* 547 * 548 * Function BTA_AvProtectRsp 549 * 550 * Description Send a content protection response. This function must 551 * be called if a BTA_AV_PROTECT_REQ_EVT is received. 552 * This function can only be used if AV is enabled with 553 * feature BTA_AV_FEAT_PROTECT. 554 * 555 * Returns void 556 * 557 ******************************************************************************/ 558 void BTA_AvProtectRsp(tBTA_AV_HNDL hndl, uint8_t error_code, uint8_t* p_data, 559 uint16_t len); 560 561 /******************************************************************************* 562 * 563 * Function BTA_AvRemoteCmd 564 * 565 * Description Send a remote control command. This function can only 566 * be used if AV is enabled with feature BTA_AV_FEAT_RCCT. 567 * 568 * Returns void 569 * 570 ******************************************************************************/ 571 void BTA_AvRemoteCmd(uint8_t rc_handle, uint8_t label, tBTA_AV_RC rc_id, 572 tBTA_AV_STATE key_state); 573 574 /******************************************************************************* 575 * 576 * Function BTA_AvRemoteVendorUniqueCmd 577 * 578 * Description Send a remote control command with Vendor Unique rc_id. 579 * This function can only be used if AV is enabled with 580 * feature BTA_AV_FEAT_RCCT. 581 * 582 * Returns void 583 * 584 ******************************************************************************/ 585 void BTA_AvRemoteVendorUniqueCmd(uint8_t rc_handle, uint8_t label, 586 tBTA_AV_STATE key_state, uint8_t* p_msg, 587 uint8_t buf_len); 588 589 /******************************************************************************* 590 * 591 * Function BTA_AvVendorCmd 592 * 593 * Description Send a vendor dependent remote control command. This 594 * function can only be used if AV is enabled with feature 595 * BTA_AV_FEAT_VENDOR. 596 * 597 * Returns void 598 * 599 ******************************************************************************/ 600 void BTA_AvVendorCmd(uint8_t rc_handle, uint8_t label, tBTA_AV_CODE cmd_code, 601 uint8_t* p_data, uint16_t len); 602 603 /******************************************************************************* 604 * 605 * Function BTA_AvVendorRsp 606 * 607 * Description Send a vendor dependent remote control response. 608 * This function must be called if a BTA_AV_VENDOR_CMD_EVT 609 * is received. This function can only be used if AV is 610 * enabled with feature BTA_AV_FEAT_VENDOR. 611 * 612 * Returns void 613 * 614 ******************************************************************************/ 615 void BTA_AvVendorRsp(uint8_t rc_handle, uint8_t label, tBTA_AV_CODE rsp_code, 616 uint8_t* p_data, uint16_t len, uint32_t company_id); 617 618 /******************************************************************************* 619 * 620 * Function BTA_AvOpenRc 621 * 622 * Description Open an AVRCP connection toward the device with the 623 * specified handle 624 * 625 * Returns void 626 * 627 ******************************************************************************/ 628 void BTA_AvOpenRc(tBTA_AV_HNDL handle); 629 630 /******************************************************************************* 631 * 632 * Function BTA_AvCloseRc 633 * 634 * Description Close an AVRCP connection 635 * 636 * Returns void 637 * 638 ******************************************************************************/ 639 void BTA_AvCloseRc(uint8_t rc_handle); 640 641 /******************************************************************************* 642 * 643 * Function BTA_AvMetaRsp 644 * 645 * Description Send a Metadata command/response. The message contained 646 * in p_pkt can be composed with AVRC utility functions. 647 * This function can only be used if AV is enabled with feature 648 * BTA_AV_FEAT_METADATA. 649 * 650 * Returns void 651 * 652 ******************************************************************************/ 653 void BTA_AvMetaRsp(uint8_t rc_handle, uint8_t label, tBTA_AV_CODE rsp_code, 654 BT_HDR* p_pkt); 655 656 /******************************************************************************* 657 * 658 * Function BTA_AvMetaCmd 659 * 660 * Description Send a Metadata/Advanced Control command. The message 661 *contained 662 * in p_pkt can be composed with AVRC utility functions. 663 * This function can only be used if AV is enabled with feature 664 * BTA_AV_FEAT_METADATA. 665 * This message is sent only when the peer supports the TG 666 *role. 667 *8 The only command makes sense right now is the absolute 668 *volume command. 669 * 670 * Returns void 671 * 672 ******************************************************************************/ 673 void BTA_AvMetaCmd(uint8_t rc_handle, uint8_t label, tBTA_AV_CMD cmd_code, 674 BT_HDR* p_pkt); 675 676 /******************************************************************************* 677 * 678 * Function BTA_AvOffloadStart 679 * 680 * Description Request Starting of A2DP Offload. 681 * This function is used to start A2DP offload if vendor lib 682 * has the feature enabled. 683 * 684 * Returns void 685 * 686 ******************************************************************************/ 687 void BTA_AvOffloadStart(tBTA_AV_HNDL hndl); 688 689 /******************************************************************************* 690 * 691 * Function BTA_AvOffloadStartRsp 692 * 693 * Description Response from vendor library indicating response for 694 * OffloadStart. 695 * 696 * Returns void 697 * 698 ******************************************************************************/ 699 void BTA_AvOffloadStartRsp(tBTA_AV_HNDL hndl, tBTA_AV_STATUS status); 700 701 /** 702 * Obtain the Channel Index for a peer. 703 * If the peer already has associated internal state, the corresponding 704 * Channel Index for that state is returned. Otherwise, the Channel Index 705 * for unused internal state is returned instead. 706 * 707 * @param peer_address the peer address 708 * @return the peer Channel Index index if obtained, otherwise -1 709 */ 710 int BTA_AvObtainPeerChannelIndex(const RawAddress& peer_address); 711 712 /** 713 * Dump debug-related information for the BTA AV module. 714 * 715 * @param fd the file descriptor to use for writing the ASCII formatted 716 * information 717 */ 718 void bta_debug_av_dump(int fd); 719 720 #endif /* BTA_AV_API_H */ 721