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