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