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