1 /****************************************************************************** 2 * 3 * Copyright 2006-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 * nterface to AVRCP Application Programming Interface 22 * 23 ******************************************************************************/ 24 #ifndef AVRC_API_H 25 #define AVRC_API_H 26 27 #include <base/functional/callback.h> 28 29 #include <cstdint> 30 31 #include "stack/include/avct_api.h" 32 #include "stack/include/avrc_defs.h" 33 #include "stack/include/bt_hdr.h" 34 #include "stack/include/sdp_status.h" 35 #include "stack/sdp/sdp_discovery_db.h" 36 #include "types/raw_address.h" 37 38 /***************************************************************************** 39 * constants 40 ****************************************************************************/ 41 42 /* API function return value result codes. */ 43 /* 0 Function successful */ 44 #define AVRC_SUCCESS AVCT_SUCCESS 45 /* 1 Not enough resources */ 46 #define AVRC_NO_RESOURCES AVCT_NO_RESOURCES 47 /* 2 Bad handle */ 48 #define AVRC_BAD_HANDLE AVCT_BAD_HANDLE 49 /* 3 PID already in use */ 50 #define AVRC_PID_IN_USE AVCT_PID_IN_USE 51 /* 4 Connection not open */ 52 #define AVRC_NOT_OPEN AVCT_NOT_OPEN 53 /* 5 the message length exceed the MTU of the browsing channel */ 54 #define AVRC_MSG_TOO_BIG 5 55 /* 0x10 generic failure */ 56 #define AVRC_FAIL 0x10 57 /* 0x11 bad parameter */ 58 #define AVRC_BAD_PARAM 0x11 59 60 /* Control role - same as AVCT_TARGET/AVCT_CONTROL */ 61 /* target */ 62 #define AVRC_CT_TARGET 1 63 /* controller */ 64 #define AVRC_CT_CONTROL 2 65 /* If conflict, allow the other side to succeed */ 66 #define AVRC_CT_PASSIVE 4 67 68 /* AVRC CTRL events */ 69 /* AVRC_OPEN_IND_EVT event is sent when the connection is successfully opened. 70 * This eventis sent in response to an AVRC_Open(). */ 71 #define AVRC_OPEN_IND_EVT 0 72 73 /* AVRC_CLOSE_IND_EVT event is sent when a connection is closed. 74 * This event can result from a call to AVRC_Close() or when the peer closes 75 * the connection. It is also sent when a connection attempted through 76 * AVRC_Open() fails. */ 77 #define AVRC_CLOSE_IND_EVT 1 78 79 /* AVRC_CONG_IND_EVT event indicates that AVCTP is congested and cannot send 80 * any more messages. */ 81 #define AVRC_CONG_IND_EVT 2 82 83 /* AVRC_UNCONG_IND_EVT event indicates that AVCTP is uncongested and ready to 84 * send messages. */ 85 #define AVRC_UNCONG_IND_EVT 3 86 87 /* AVRC_BROWSE_OPEN_IND_EVT event is sent when the browse channel is 88 * successfully opened. 89 * This eventis sent in response to an AVRC_Open() or AVRC_OpenBrowse() . */ 90 #define AVRC_BROWSE_OPEN_IND_EVT 4 91 92 /* AVRC_BROWSE_CLOSE_IND_EVT event is sent when a browse channel is closed. 93 * This event can result from a call to AVRC_Close(), AVRC_CloseBrowse() or 94 * when the peer closes the connection. It is also sent when a connection 95 * attempted through AVRC_OpenBrowse() fails. */ 96 #define AVRC_BROWSE_CLOSE_IND_EVT 5 97 98 /* AVRC_BROWSE_CONG_IND_EVT event indicates that AVCTP browse channel is 99 * congested and cannot send any more messages. */ 100 #define AVRC_BROWSE_CONG_IND_EVT 6 101 102 /* AVRC_BROWSE_UNCONG_IND_EVT event indicates that AVCTP browse channel is 103 * uncongested and ready to send messages. */ 104 #define AVRC_BROWSE_UNCONG_IND_EVT 7 105 106 /* AVRC_CMD_TIMEOUT_EVT event indicates timeout waiting for AVRC command 107 * response from the peer */ 108 #define AVRC_CMD_TIMEOUT_EVT 8 109 110 /* Configurable avrcp version key and constant values */ 111 #ifndef AVRC_VERSION_PROPERTY 112 #define AVRC_VERSION_PROPERTY "persist.bluetooth.avrcpversion" 113 #endif 114 115 /* Configurable avrcp control version key */ 116 #ifndef AVRC_CONTROL_VERSION_PROPERTY 117 #define AVRC_CONTROL_VERSION_PROPERTY "persist.bluetooth.avrcpcontrolversion" 118 #endif 119 120 #ifndef AVRC_1_6_STRING 121 #define AVRC_1_6_STRING "avrcp16" 122 #endif 123 124 #ifndef AVRC_1_5_STRING 125 #define AVRC_1_5_STRING "avrcp15" 126 #endif 127 128 #ifndef AVRC_1_4_STRING 129 #define AVRC_1_4_STRING "avrcp14" 130 #endif 131 132 #ifndef AVRC_1_3_STRING 133 #define AVRC_1_3_STRING "avrcp13" 134 #endif 135 136 /* Configurable dynamic avrcp version enable key*/ 137 #ifndef AVRC_DYNAMIC_AVRCP_ENABLE_PROPERTY 138 #define AVRC_DYNAMIC_AVRCP_ENABLE_PROPERTY "persist.bluetooth.dynamic_avrcp.enable" 139 #endif 140 141 /* Supported categories */ 142 #define AVRC_SUPF_CT_CAT1 0x0001 /* Category 1 */ 143 #define AVRC_SUPF_CT_CAT2 0x0002 /* Category 2 */ 144 #define AVRC_SUPF_CT_CAT3 0x0004 /* Category 3 */ 145 #define AVRC_SUPF_CT_CAT4 0x0008 /* Category 4 */ 146 #define AVRC_SUPF_CT_APP_SETTINGS 0x0010 /* Player Application Settings */ 147 #define AVRC_SUPF_CT_GROUP_NAVI 0x0020 /* Group Navigation */ 148 #define AVRC_SUPF_CT_BROWSE 0x0040 /* Browsing */ 149 150 /* Cover Art, get image property */ 151 #define AVRC_SUPF_CT_COVER_ART_GET_IMAGE_PROP 0x0080 152 /* Cover Art, get image */ 153 #define AVRC_SUPF_CT_COVER_ART_GET_IMAGE 0x0100 154 /* Cover Art, get Linked Thumbnail */ 155 #define AVRC_SUPF_CT_COVER_ART_GET_THUMBNAIL 0x0200 156 157 #define AVRC_SUPF_TG_CAT1 0x0001 /* Category 1 */ 158 #define AVRC_SUPF_TG_CAT2 0x0002 /* Category 2 */ 159 #define AVRC_SUPF_TG_CAT3 0x0004 /* Category 3 */ 160 #define AVRC_SUPF_TG_CAT4 0x0008 /* Category 4 */ 161 #define AVRC_SUPF_TG_APP_SETTINGS 0x0010 /* Player Application Settings */ 162 #define AVRC_SUPF_TG_GROUP_NAVI 0x0020 /* Group Navigation */ 163 #define AVRC_SUPF_TG_BROWSE 0x0040 /* Browsing */ 164 #define AVRC_SUPF_TG_MULTI_PLAYER 0x0080 /* Muliple Media Player */ 165 #define AVRC_SUPF_TG_PLAYER_COVER_ART 0x0100 /* Cover Art */ 166 167 #define AVRC_META_SUCCESS AVRC_SUCCESS 168 #define AVRC_META_FAIL AVRC_FAIL 169 #define AVRC_METADATA_CMD 0x0000 170 #define AVRC_METADATA_RESP 0x0001 171 172 #define AVRCP_SUPPORTED_FEATURES_POSITION 1 173 #define AVRCP_BROWSE_SUPPORT_BITMASK 0x40 174 #define AVRCP_MULTI_PLAYER_SUPPORT_BITMASK 0x80 175 #define AVRCP_CA_SUPPORT_BITMASK 0x01 176 177 #define AVRCP_FEAT_CA_BIT 0x0180 178 #define AVRCP_FEAT_BRW_BIT 0x0040 179 180 /***************************************************************************** 181 * data type definitions 182 ****************************************************************************/ 183 184 /* This data type is used in AVRC_FindService() to initialize the SDP database 185 * to hold the result service search. */ 186 typedef struct { 187 uint32_t db_len; /* Length, in bytes, of the discovery database */ 188 tSDP_DISCOVERY_DB* p_db; /* Pointer to the discovery database */ 189 uint16_t num_attr; /* The number of attributes in p_attrs */ 190 uint16_t* p_attrs; /* The attributes filter. If NULL, AVRCP API sets the 191 * attribute filter 192 * to be ATTR_ID_SERVICE_CLASS_ID_LIST, 193 * ATTR_ID_BT_PROFILE_DESC_LIST, 194 * ATTR_ID_SUPPORTED_FEATURES, ATTR_ID_SERVICE_NAME, 195 * ATTR_ID_PROVIDER_NAME. 196 * If not NULL, the input is taken as the filter. */ 197 } tAVRC_SDP_DB_PARAMS; 198 199 /* This callback function returns service discovery information to the 200 * application after the AVRC_FindService() API function is called. The 201 * implementation of this callback function must copy the p_service_name 202 * and p_provider_name parameters passed to it as they are not guaranteed 203 * to remain after the callback function exits. */ 204 using tAVRC_FIND_CBACK = base::Callback<void(tSDP_STATUS status)>; 205 206 /* This is the control callback function. This function passes events 207 * listed in Table 20 to the application. */ 208 using tAVRC_CTRL_CBACK = base::Callback<void(uint8_t handle, uint8_t event, uint16_t result, 209 const RawAddress* peer_addr)>; 210 211 /* This is the message callback function. It is executed when AVCTP has 212 * a message packet ready for the application. The implementation of this 213 * callback function must copy the tAVRC_MSG structure passed to it as it 214 * is not guaranteed to remain after the callback function exits. */ 215 using tAVRC_MSG_CBACK = 216 base::Callback<void(uint8_t handle, uint8_t label, uint8_t opcode, tAVRC_MSG* p_msg)>; 217 218 typedef struct { 219 tAVRC_CTRL_CBACK ctrl_cback; /* application control callback */ 220 tAVRC_MSG_CBACK msg_cback; /* application message callback */ 221 uint32_t company_id; /* the company ID */ 222 tAVCT_ROLE conn; /* Connection role (Initiator/acceptor) */ 223 uint8_t control; /* Control role (Control/Target) */ 224 } tAVRC_CONN_CB; 225 226 typedef struct { 227 uint8_t handle; 228 uint8_t label; 229 uint8_t msg_mask; 230 } tAVRC_PARAM; 231 232 /***************************************************************************** 233 * external function declarations 234 ****************************************************************************/ 235 /****************************************************************************** 236 * 237 * Function avrcp_absolute_volume_is_enabled 238 * 239 * Description Check if config support advance control (absolute volume) 240 * 241 * Returns return true if absolute_volume is enabled 242 * 243 *****************************************************************************/ 244 bool avrcp_absolute_volume_is_enabled(); 245 246 /****************************************************************************** 247 * 248 * Function AVRC_GetControlProfileVersion 249 * 250 * Description Get the overlaid AVRCP control profile version 251 * 252 * Returns The AVRCP control profile version 253 * 254 *****************************************************************************/ 255 uint16_t AVRC_GetControlProfileVersion(); 256 257 /****************************************************************************** 258 * 259 * Function ARVC_GetProfileVersion 260 * 261 * Description Get the user assigned AVRCP profile version 262 * 263 * Returns The AVRCP profile version 264 * 265 *****************************************************************************/ 266 uint16_t AVRC_GetProfileVersion(); 267 268 /****************************************************************************** 269 * 270 * Function AVRC_AddRecord 271 * 272 * Description This function is called to build an AVRCP SDP record. 273 * Prior to calling this function the application must 274 * call SDP_CreateRecord() to create an SDP record. 275 * 276 * Input Parameters: 277 * service_uuid: Indicates 278 * TG(UUID_SERVCLASS_AV_REM_CTRL_TARGET) 279 * or CT(UUID_SERVCLASS_AV_REMOTE_CONTROL) 280 * 281 * p_service_name: Pointer to a null-terminated character 282 * string containing the service name. 283 * If service name is not used set this to NULL. 284 * 285 * p_provider_name: Pointer to a null-terminated character 286 * string containing the provider name. 287 * If provider name is not used set this to NULL. 288 * 289 * categories: Supported categories. 290 * 291 * sdp_handle: SDP handle returned by SDP_CreateRecord(). 292 * 293 * browse_supported: browse support info. 294 * 295 * profile_version: profile version of avrcp record. 296 * 297 * cover_art_psm: The PSM of a cover art service, if 298 * supported. Use 0 Otherwise. Ignored on controller 299 * 300 * Output Parameters: 301 * None. 302 * 303 * Returns AVRC_SUCCESS if successful. 304 * AVRC_NO_RESOURCES if not enough resources to build the SDP 305 * record. 306 * 307 *****************************************************************************/ 308 uint16_t AVRC_AddRecord(uint16_t service_uuid, const char* p_service_name, 309 const char* p_provider_name, uint16_t categories, uint32_t sdp_handle, 310 bool browse_supported, uint16_t profile_version, uint16_t cover_art_psm); 311 312 /******************************************************************************* 313 * 314 * Function AVRC_RemoveRecord 315 * 316 * Description This function is called to remove an AVRCP SDP record. 317 * 318 * Input Parameters: 319 * sdp_handle: Handle you used with AVRC_AddRecord 320 * 321 * Returns AVRC_SUCCESS if successful. 322 * AVRC_FAIL otherwise 323 * 324 *******************************************************************************/ 325 uint16_t AVRC_RemoveRecord(uint32_t sdp_handle); 326 327 /****************************************************************************** 328 * 329 * Function AVRC_FindService 330 * 331 * Description This function is called by the application to perform 332 * service discovery and retrieve AVRCP SDP record information 333 * from a peer device. Information is returned for the first 334 * service record found on the server that matches the service 335 * UUID. The callback function will be executed when service 336 * discovery is complete. There can only be one outstanding 337 * call to AVRC_FindService() at a time; the application must 338 * wait for the callback before it makes another call to the 339 * function. The application is responsible for allocating 340 * memory for the discovery database. It is recommended that 341 * the size of the discovery database be at least 300 bytes. 342 * The application can deallocate the memory after the 343 * callback function has executed. 344 * 345 * Input Parameters: 346 * service_uuid: Indicates 347 * TG(UUID_SERVCLASS_AV_REM_CTRL_TARGET) 348 * or CT(UUID_SERVCLASS_AV_REMOTE_CONTROL) 349 * 350 * bd_addr: BD address of the peer device. 351 * 352 * p_db: SDP discovery database parameters. 353 * 354 * p_cback: Pointer to the callback function. 355 * 356 * Output Parameters: 357 * None. 358 * 359 * Returns AVRC_SUCCESS if successful. 360 * AVRC_BAD_PARAMS if discovery database parameters are 361 * invalid. 362 * AVRC_NO_RESOURCES if there are not enough resources to 363 * perform the service search. 364 * 365 *****************************************************************************/ 366 uint16_t AVRC_FindService(uint16_t service_uuid, const RawAddress& bd_addr, 367 tAVRC_SDP_DB_PARAMS* p_db, const tAVRC_FIND_CBACK& cback); 368 369 /****************************************************************************** 370 * 371 * Function AVRC_Open 372 * 373 * Description This function is called to open a connection to AVCTP. 374 * The connection can be either an initiator or acceptor, as 375 * determined by the p_ccb->stream parameter. 376 * The connection can be a target, a controller or for both 377 * roles, as determined by the p_ccb->control parameter. 378 * By definition, a target connection is an acceptor connection 379 * that waits for an incoming AVCTP connection from the peer. 380 * The connection remains available to the application until 381 * the application closes it by calling AVRC_Close(). The 382 * application does not need to reopen the connection after an 383 * AVRC_CLOSE_IND_EVT is received. 384 * 385 * Input Parameters: 386 * p_ccb->company_id: Company Identifier. 387 * 388 * p_ccb->p_ctrl_cback: Pointer to the control callback 389 * function. 390 * 391 * p_ccb->p_msg_cback: Pointer to the message callback 392 * function. 393 * 394 * p_ccb->conn: AVCTP connection role. This is set to 395 * AVCTP_INT for initiator connections and AVCTP_ACP 396 * for acceptor connections. 397 * 398 * p_ccb->control: Control role. This is set to 399 * AVRC_CT_TARGET for target connections, AVRC_CT_CONTROL 400 * for control connections or 401 * (AVRC_CT_TARGET|AVRC_CT_CONTROL) for connections that 402 * support both roles. 403 * 404 * peer_addr: BD address of peer device. This value is 405 * only used for initiator connections; for acceptor 406 * connections it can be set to NULL. 407 * 408 * Output Parameters: 409 * p_handle: Pointer to handle. This parameter is only 410 * valid if AVRC_SUCCESS is returned. 411 * 412 * Returns AVRC_SUCCESS if successful. 413 * AVRC_NO_RESOURCES if there are not enough resources to open 414 * the connection. 415 * 416 *****************************************************************************/ 417 uint16_t AVRC_Open(uint8_t* p_handle, tAVRC_CONN_CB* p_ccb, const RawAddress& peer_addr); 418 419 /****************************************************************************** 420 * 421 * Function AVRC_Close 422 * 423 * Description Close a connection opened with AVRC_Open(). 424 * This function is called when the 425 * application is no longer using a connection. 426 * 427 * Input Parameters: 428 * handle: Handle of this connection. 429 * 430 * Output Parameters: 431 * None. 432 * 433 * Returns AVRC_SUCCESS if successful. 434 * AVRC_BAD_HANDLE if handle is invalid. 435 * 436 *****************************************************************************/ 437 uint16_t AVRC_Close(uint8_t handle); 438 439 /****************************************************************************** 440 * 441 * Function AVRC_OpenBrowse 442 * 443 * Description This function is called to open a browsing connection to 444 * AVCTP. The connection can be either an initiator or 445 * acceptor, as determined by the conn_role. 446 * The handle is returned by a previous call to AVRC_Open. 447 * 448 * Returns AVRC_SUCCESS if successful. 449 * AVRC_NO_RESOURCES if there are not enough resources to open 450 * the connection. 451 * 452 *****************************************************************************/ 453 uint16_t AVRC_OpenBrowse(uint8_t handle, tAVCT_ROLE conn_role); 454 455 /****************************************************************************** 456 * 457 * Function AVRC_CloseBrowse 458 * 459 * Description Close a connection opened with AVRC_OpenBrowse(). 460 * This function is called when the 461 * application is no longer using a connection. 462 * 463 * Returns AVRC_SUCCESS if successful. 464 * AVRC_BAD_HANDLE if handle is invalid. 465 * 466 *****************************************************************************/ 467 uint16_t AVRC_CloseBrowse(uint8_t handle); 468 469 /****************************************************************************** 470 * 471 * Function AVRC_MsgReq 472 * 473 * Description This function is used to send the AVRCP byte stream in p_pkt 474 * down to AVCTP. 475 * 476 * It is expected that: 477 * p_pkt->offset is at least AVCT_MSG_OFFSET 478 * p_pkt->layer_specific is AVCT_DATA_CTRL or AVCT_DATA_BROWSE 479 * p_pkt->event is AVRC_OP_VENDOR, AVRC_OP_PASS_THRU or 480 * AVRC_OP_BROWSING 481 * The above BT_HDR settings are set by the AVRC_Bld* 482 * functions. 483 * 484 * Returns AVRC_SUCCESS if successful. 485 * AVRC_BAD_HANDLE if handle is invalid. 486 * 487 *****************************************************************************/ 488 uint16_t AVRC_MsgReq(uint8_t handle, uint8_t label, uint8_t ctype, BT_HDR* p_pkt, 489 bool is_new_avrcp); 490 491 /****************************************************************************** 492 * 493 * Function AVRC_SaveControllerVersion 494 * 495 * Description Save AVRC controller version of peer device into bt_config. 496 * This version is used to send same AVRC target version to 497 * peer device to avoid version mismatch IOP issue. 498 * 499 * Input Parameters: 500 * bdaddr: BD address of peer device. 501 * 502 * version: AVRC controller version of peer device. 503 * 504 * Output Parameters: 505 * None. 506 * 507 * Returns Nothing 508 * 509 *****************************************************************************/ 510 void AVRC_SaveControllerVersion(const RawAddress& bdaddr, uint16_t new_version); 511 512 /****************************************************************************** 513 * 514 * Function AVRC_UnitCmd 515 * 516 * Description Send a UNIT INFO command to the peer device. This 517 * function can only be called for controller role connections. 518 * Any response message from the peer is passed back through 519 * the tAVRC_MSG_CBACK callback function. 520 * 521 * Input Parameters: 522 * handle: Handle of this connection. 523 * 524 * label: Transaction label. 525 * 526 * Output Parameters: 527 * None. 528 * 529 * Returns AVRC_SUCCESS if successful. 530 * AVRC_BAD_HANDLE if handle is invalid. 531 * 532 *****************************************************************************/ 533 uint16_t AVRC_UnitCmd(uint8_t handle, uint8_t label); 534 535 /****************************************************************************** 536 * 537 * Function AVRC_SubCmd 538 * 539 * Description Send a SUBUNIT INFO command to the peer device. This 540 * function can only be called for controller role connections. 541 * Any response message from the peer is passed back through 542 * the tAVRC_MSG_CBACK callback function. 543 * 544 * Input Parameters: 545 * handle: Handle of this connection. 546 * 547 * label: Transaction label. 548 * 549 * page: Specifies which part of the subunit type table 550 * is requested. For AVRCP it is typically zero. 551 * Value range is 0-7. 552 * 553 * Output Parameters: 554 * None. 555 * 556 * Returns AVRC_SUCCESS if successful. 557 * AVRC_BAD_HANDLE if handle is invalid. 558 * 559 *****************************************************************************/ 560 uint16_t AVRC_SubCmd(uint8_t handle, uint8_t label, uint8_t page); 561 562 /****************************************************************************** 563 * 564 * Function AVRC_PassCmd 565 * 566 * Description Send a PASS THROUGH command to the peer device. This 567 * function can only be called for controller role connections. 568 * Any response message from the peer is passed back through 569 * the tAVRC_MSG_CBACK callback function. 570 * 571 * Input Parameters: 572 * handle: Handle of this connection. 573 * 574 * label: Transaction label. 575 * 576 * p_msg: Pointer to PASS THROUGH message structure. 577 * 578 * Output Parameters: 579 * None. 580 * 581 * Returns AVRC_SUCCESS if successful. 582 * AVRC_BAD_HANDLE if handle is invalid. 583 * 584 *****************************************************************************/ 585 uint16_t AVRC_PassCmd(uint8_t handle, uint8_t label, tAVRC_MSG_PASS* p_msg); 586 587 /****************************************************************************** 588 * 589 * Function AVRC_PassRsp 590 * 591 * Description Send a PASS THROUGH response to the peer device. This 592 * function can only be called for target role connections. 593 * This function must be called when a PASS THROUGH command 594 * message is received from the peer through the 595 * tAVRC_MSG_CBACK callback function. 596 * 597 * Input Parameters: 598 * handle: Handle of this connection. 599 * 600 * label: Transaction label. Must be the same value as 601 * passed with the command message in the callback 602 * function. 603 * 604 * p_msg: Pointer to PASS THROUGH message structure. 605 * 606 * Output Parameters: 607 * None. 608 * 609 * Returns AVRC_SUCCESS if successful. 610 * AVRC_BAD_HANDLE if handle is invalid. 611 * 612 *****************************************************************************/ 613 uint16_t AVRC_PassRsp(uint8_t handle, uint8_t label, tAVRC_MSG_PASS* p_msg); 614 615 /****************************************************************************** 616 * 617 * Function AVRC_VendorCmd 618 * 619 * Description Send a VENDOR DEPENDENT command to the peer device. This 620 * function can only be called for controller role connections. 621 * Any response message from the peer is passed back through 622 * the tAVRC_MSG_CBACK callback function. 623 * 624 * Input Parameters: 625 * handle: Handle of this connection. 626 * 627 * label: Transaction label. 628 * 629 * p_msg: Pointer to VENDOR DEPENDENT message structure. 630 * 631 * Output Parameters: 632 * None. 633 * 634 * Returns AVRC_SUCCESS if successful. 635 * AVRC_BAD_HANDLE if handle is invalid. 636 * 637 *****************************************************************************/ 638 uint16_t AVRC_VendorCmd(uint8_t handle, uint8_t label, tAVRC_MSG_VENDOR* p_msg); 639 640 /****************************************************************************** 641 * 642 * Function AVRC_VendorRsp 643 * 644 * Description Send a VENDOR DEPENDENT response to the peer device. This 645 * function can only be called for target role connections. 646 * This function must be called when a VENDOR DEPENDENT 647 * command message is received from the peer through the 648 * tAVRC_MSG_CBACK callback function. 649 * 650 * Input Parameters: 651 * handle: Handle of this connection. 652 * 653 * label: Transaction label. Must be the same value as 654 * passed with the command message in the callback 655 * function. 656 * 657 * p_msg: Pointer to VENDOR DEPENDENT message structure. 658 * 659 * Output Parameters: 660 * None. 661 * 662 * Returns AVRC_SUCCESS if successful. 663 * AVRC_BAD_HANDLE if handle is invalid. 664 * 665 *****************************************************************************/ 666 uint16_t AVRC_VendorRsp(uint8_t handle, uint8_t label, tAVRC_MSG_VENDOR* p_msg); 667 668 /******************************************************************************* 669 * 670 * Function AVRC_Init 671 * 672 * Description This function is called at stack startup to allocate the 673 * control block (if using dynamic memory), and initializes the 674 * control block and tracing level. 675 * 676 * Returns void 677 * 678 ******************************************************************************/ 679 void AVRC_Init(void); 680 681 /******************************************************************************* 682 * 683 * Function AVRC_Ctrl_ParsCommand 684 * 685 * Description This function is used to parse cmds received for CTRL 686 * Currently it is for SetAbsVolume and Volume Change 687 * Notification.. 688 * 689 * Returns AVRC_STS_NO_ERROR, if the message in p_data is parsed 690 * successfully. 691 * Otherwise, the error code defined by AVRCP 1.4 692 * 693 ******************************************************************************/ 694 tAVRC_STS AVRC_Ctrl_ParsCommand(tAVRC_MSG* p_msg, tAVRC_COMMAND* p_result); 695 696 /******************************************************************************* 697 * 698 * Function AVRC_ParsCommand 699 * 700 * Description This function is used to parse the received command. 701 * 702 * Returns AVRC_STS_NO_ERROR, if the message in p_data is parsed 703 * successfully. 704 * Otherwise, the error code defined by AVRCP 1.4 705 * 706 ******************************************************************************/ 707 tAVRC_STS AVRC_ParsCommand(tAVRC_MSG* p_msg, tAVRC_COMMAND* p_result, uint8_t* p_buf, 708 uint16_t buf_len); 709 710 /******************************************************************************* 711 * 712 * Function AVRC_ParsResponse 713 * 714 * Description This function is used to parse the received response. 715 * 716 * Returns AVRC_STS_NO_ERROR, if the message in p_data is parsed 717 * successfully. 718 * Otherwise, the error code defined by AVRCP 1.4 719 * 720 ******************************************************************************/ 721 tAVRC_STS AVRC_ParsResponse(tAVRC_MSG* p_msg, tAVRC_RESPONSE* p_result, uint8_t* p_buf, 722 uint16_t buf_len); 723 724 /******************************************************************************* 725 * 726 * Function AVRC_Ctrl_ParsResponse 727 * 728 * Description This function is a parse response for AVRCP Controller. 729 * 730 * Returns AVRC_STS_NO_ERROR, if the message in p_data is parsed 731 * successfully. 732 * Otherwise, the error code defined by AVRCP 1.4 733 * 734 ******************************************************************************/ 735 tAVRC_STS AVRC_Ctrl_ParsResponse(tAVRC_MSG* p_msg, tAVRC_RESPONSE* p_result, uint8_t* p_buf, 736 uint16_t* buf_len); 737 738 /******************************************************************************* 739 * 740 * Function AVRC_BldCommand 741 * 742 * Description This function builds the given AVRCP command to the given 743 * GKI buffer 744 * 745 * Returns AVRC_STS_NO_ERROR, if the command is built successfully 746 * Otherwise, the error code. 747 * 748 ******************************************************************************/ 749 tAVRC_STS AVRC_BldCommand(tAVRC_COMMAND* p_cmd, BT_HDR** pp_pkt); 750 751 /******************************************************************************* 752 * 753 * Function AVRC_BldResponse 754 * 755 * Description This function builds the given AVRCP response to the given 756 * GKI buffer 757 * 758 * Returns AVRC_STS_NO_ERROR, if the response is built successfully 759 * Otherwise, the error code. 760 * 761 ******************************************************************************/ 762 tAVRC_STS AVRC_BldResponse(uint8_t handle, tAVRC_RESPONSE* p_rsp, BT_HDR** pp_pkt); 763 764 /************************************************************************** 765 * 766 * Function AVRC_IsValidAvcType 767 * 768 * Description Check if correct AVC type is specified 769 * 770 * Returns returns true if it is valid 771 * 772 * 773 ******************************************************************************/ 774 bool AVRC_IsValidAvcType(uint8_t pdu_id, uint8_t avc_type); 775 776 /******************************************************************************* 777 * 778 * Function AVRC_IsValidPlayerAttr 779 * 780 * Description Check if the given attrib value is a valid one 781 * 782 * 783 * Returns returns true if it is valid 784 * 785 ******************************************************************************/ 786 bool AVRC_IsValidPlayerAttr(uint8_t attr); 787 788 void AVRC_UpdateCcb(RawAddress* addr, uint32_t company_id); 789 790 #endif /* AVRC_API_H */ 791