1 /****************************************************************************** 2 * 3 * Copyright 1999-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 file contains the Bluetooth Manager (BTM) API function external 22 * definitions. 23 * 24 ******************************************************************************/ 25 #ifndef BTM_API_H 26 #define BTM_API_H 27 28 #include "bt_target.h" 29 #include "device/include/esco_parameters.h" 30 #include "hcidefs.h" 31 #include "sdp_api.h" 32 33 #include "smp_api.h" 34 35 #include "btm_api_types.h" 36 37 /***************************************************************************** 38 * DEVICE CONTROL and COMMON 39 ****************************************************************************/ 40 41 /***************************************************************************** 42 * EXTERNAL FUNCTION DECLARATIONS 43 ****************************************************************************/ 44 45 /***************************************************************************** 46 * DEVICE CONTROL and COMMON FUNCTIONS 47 ****************************************************************************/ 48 49 /******************************************************************************* 50 * 51 * Function BTM_DeviceReset 52 * 53 * Description This function is called to reset the controller. The 54 * Callback function if provided is called when startup of the 55 * device has completed. 56 * 57 * Returns void 58 * 59 ******************************************************************************/ 60 extern void BTM_DeviceReset(tBTM_CMPL_CB* p_cb); 61 62 /******************************************************************************* 63 * 64 * Function BTM_IsDeviceUp 65 * 66 * Description This function is called to check if the device is up. 67 * 68 * Returns true if device is up, else false 69 * 70 ******************************************************************************/ 71 extern bool BTM_IsDeviceUp(void); 72 73 /******************************************************************************* 74 * 75 * Function BTM_SetLocalDeviceName 76 * 77 * Description This function is called to set the local device name. 78 * 79 * Returns BTM_CMD_STARTED if successful, otherwise an error 80 * 81 ******************************************************************************/ 82 extern tBTM_STATUS BTM_SetLocalDeviceName(char* p_name); 83 84 /******************************************************************************* 85 * 86 * Function BTM_SetDeviceClass 87 * 88 * Description This function is called to set the local device class 89 * 90 * Returns BTM_SUCCESS if successful, otherwise an error 91 * 92 ******************************************************************************/ 93 extern tBTM_STATUS BTM_SetDeviceClass(DEV_CLASS dev_class); 94 95 /******************************************************************************* 96 * 97 * Function BTM_ReadLocalDeviceName 98 * 99 * Description This function is called to read the local device name. 100 * 101 * Returns status of the operation 102 * If success, BTM_SUCCESS is returned and p_name points stored 103 * local device name 104 * If BTM doesn't store local device name, BTM_NO_RESOURCES is 105 * is returned and p_name is set to NULL 106 * 107 ******************************************************************************/ 108 extern tBTM_STATUS BTM_ReadLocalDeviceName(char** p_name); 109 110 /******************************************************************************* 111 * 112 * Function BTM_ReadLocalDeviceNameFromController 113 * 114 * Description Get local device name from controller. Do not use cached 115 * name (used to get chip-id prior to btm reset complete). 116 * 117 * Returns BTM_CMD_STARTED if successful, otherwise an error 118 * 119 ******************************************************************************/ 120 extern tBTM_STATUS BTM_ReadLocalDeviceNameFromController( 121 tBTM_CMPL_CB* p_rln_cmpl_cback); 122 123 /******************************************************************************* 124 * 125 * Function BTM_ReadDeviceClass 126 * 127 * Description This function is called to read the local device class 128 * 129 * Returns pointer to the device class 130 * 131 ******************************************************************************/ 132 extern uint8_t* BTM_ReadDeviceClass(void); 133 134 /******************************************************************************* 135 * 136 * Function BTM_ReadLocalFeatures 137 * 138 * Description This function is called to read the local features 139 * 140 * Returns pointer to the local features string 141 * 142 ******************************************************************************/ 143 extern uint8_t* BTM_ReadLocalFeatures(void); 144 145 /******************************************************************************* 146 * 147 * Function BTM_RegisterForDeviceStatusNotif 148 * 149 * Description This function is called to register for device status 150 * change notifications. 151 * 152 * Returns pointer to previous caller's callback function or NULL if 153 * first registration. 154 * 155 ******************************************************************************/ 156 extern tBTM_DEV_STATUS_CB* BTM_RegisterForDeviceStatusNotif( 157 tBTM_DEV_STATUS_CB* p_cb); 158 159 /******************************************************************************* 160 * 161 * Function BTM_RegisterForVSEvents 162 * 163 * Description This function is called to register/deregister for vendor 164 * specific HCI events. 165 * 166 * If is_register=true, then the function will be registered; 167 * otherwise the function will be deregistered. 168 * 169 * Returns BTM_SUCCESS if successful, 170 * BTM_BUSY if maximum number of callbacks have already been 171 * registered. 172 * 173 ******************************************************************************/ 174 extern tBTM_STATUS BTM_RegisterForVSEvents(tBTM_VS_EVT_CB* p_cb, 175 bool is_register); 176 177 /******************************************************************************* 178 * 179 * Function BTM_VendorSpecificCommand 180 * 181 * Description Send a vendor specific HCI command to the controller. 182 * 183 ******************************************************************************/ 184 extern void BTM_VendorSpecificCommand(uint16_t opcode, uint8_t param_len, 185 uint8_t* p_param_buf, 186 tBTM_VSC_CMPL_CB* p_cb); 187 188 /******************************************************************************* 189 * 190 * Function BTM_AllocateSCN 191 * 192 * Description Look through the Server Channel Numbers for a free one to be 193 * used with an RFCOMM connection. 194 * 195 * Returns Allocated SCN number or 0 if none. 196 * 197 ******************************************************************************/ 198 extern uint8_t BTM_AllocateSCN(void); 199 200 /******************************************************************************* 201 * 202 * Function BTM_TryAllocateSCN 203 * 204 * Description Try to allocate a fixed server channel 205 * 206 * Returns Returns true if server channel was available 207 * 208 ******************************************************************************/ 209 extern bool BTM_TryAllocateSCN(uint8_t scn); 210 211 /******************************************************************************* 212 * 213 * Function BTM_FreeSCN 214 * 215 * Description Free the specified SCN. 216 * 217 * Returns true if successful, false if SCN is not in use or invalid 218 * 219 ******************************************************************************/ 220 extern bool BTM_FreeSCN(uint8_t scn); 221 222 /******************************************************************************* 223 * 224 * Function BTM_SetTraceLevel 225 * 226 * Description This function sets the trace level for BTM. If called with 227 * a value of 0xFF, it simply returns the current trace level. 228 * 229 * Returns The new or current trace level 230 * 231 ******************************************************************************/ 232 extern uint8_t BTM_SetTraceLevel(uint8_t new_level); 233 234 /******************************************************************************* 235 * 236 * Function BTM_WritePageTimeout 237 * 238 * Description Send HCI Wite Page Timeout. 239 * 240 ******************************************************************************/ 241 extern void BTM_WritePageTimeout(uint16_t timeout); 242 243 /******************************************************************************* 244 * 245 * Function BTM_WriteVoiceSettings 246 * 247 * Description Send HCI Write Voice Settings command. 248 * See hcidefs.h for settings bitmask values. 249 * 250 ******************************************************************************/ 251 extern void BTM_WriteVoiceSettings(uint16_t settings); 252 253 /******************************************************************************* 254 * 255 * Function BTM_EnableTestMode 256 * 257 * Description Send HCI the enable device under test command. 258 * 259 * Note: Controller can only be taken out of this mode by 260 * resetting the controller. 261 * 262 * Returns 263 * BTM_SUCCESS Command sent. 264 * BTM_NO_RESOURCES If out of resources to send the command. 265 * 266 * 267 ******************************************************************************/ 268 extern tBTM_STATUS BTM_EnableTestMode(void); 269 270 /******************************************************************************* 271 * DEVICE DISCOVERY FUNCTIONS - Inquiry, Remote Name, Discovery, Class of Device 272 ******************************************************************************/ 273 274 /******************************************************************************* 275 * 276 * Function BTM_SetDiscoverability 277 * 278 * Description This function is called to set the device into or out of 279 * discoverable mode. Discoverable mode means inquiry 280 * scans are enabled. If a value of '0' is entered for window 281 * or interval, the default values are used. 282 * 283 * Returns BTM_SUCCESS if successful 284 * BTM_BUSY if a setting of the filter is already in progress 285 * BTM_NO_RESOURCES if couldn't get a memory pool buffer 286 * BTM_ILLEGAL_VALUE if a bad parameter was detected 287 * BTM_WRONG_MODE if the device is not up. 288 * 289 ******************************************************************************/ 290 extern tBTM_STATUS BTM_SetDiscoverability(uint16_t inq_mode, uint16_t window, 291 uint16_t interval); 292 293 /******************************************************************************* 294 * 295 * Function BTM_ReadDiscoverability 296 * 297 * Description This function is called to read the current discoverability 298 * mode of the device. 299 * 300 * Output Params: p_window - current inquiry scan duration 301 * p_interval - current inquiry scan interval 302 * 303 * Returns BTM_NON_DISCOVERABLE, BTM_LIMITED_DISCOVERABLE, or 304 * BTM_GENERAL_DISCOVERABLE 305 * 306 ******************************************************************************/ 307 extern uint16_t BTM_ReadDiscoverability(uint16_t* p_window, 308 uint16_t* p_interval); 309 310 /******************************************************************************* 311 * 312 * Function BTM_SetPeriodicInquiryMode 313 * 314 * Description This function is called to set the device periodic inquiry 315 * mode. If the duration is zero, the periodic inquiry mode is 316 * cancelled. 317 * 318 * Parameters: p_inqparms - pointer to the inquiry information 319 * mode - GENERAL or LIMITED inquiry 320 * duration - length in 1.28 sec intervals (If '0', the 321 * inquiry is CANCELLED) 322 * max_resps - maximum amount of devices to search for 323 * before ending the inquiry 324 * filter_cond_type - BTM_CLR_INQUIRY_FILTER, 325 * BTM_FILTER_COND_DEVICE_CLASS, or 326 * BTM_FILTER_COND_BD_ADDR 327 * filter_cond - value for the filter (based on 328 * filter_cond_type) 329 * 330 * max_delay - maximum amount of time between successive 331 * inquiries 332 * min_delay - minimum amount of time between successive 333 * inquiries 334 * p_results_cb - callback returning pointer to results 335 * (tBTM_INQ_RESULTS) 336 * 337 * Returns BTM_CMD_STARTED if successfully started 338 * BTM_ILLEGAL_VALUE if a bad parameter is detected 339 * BTM_NO_RESOURCES if could not allocate a message buffer 340 * BTM_SUCCESS - if cancelling the periodic inquiry 341 * BTM_BUSY - if an inquiry is already active 342 * BTM_WRONG_MODE if the device is not up. 343 * 344 ******************************************************************************/ 345 extern tBTM_STATUS BTM_SetPeriodicInquiryMode( 346 tBTM_INQ_PARMS* p_inqparms, uint16_t max_delay, uint16_t min_delay, 347 tBTM_INQ_RESULTS_CB* p_results_cb); 348 349 /******************************************************************************* 350 * 351 * Function BTM_StartInquiry 352 * 353 * Description This function is called to start an inquiry. 354 * 355 * Parameters: p_inqparms - pointer to the inquiry information 356 * mode - GENERAL or LIMITED inquiry 357 * duration - length in 1.28 sec intervals (If '0', the 358 * inquiry is CANCELLED) 359 * max_resps - maximum amount of devices to search for 360 * before ending the inquiry 361 * filter_cond_type - BTM_CLR_INQUIRY_FILTER, 362 * BTM_FILTER_COND_DEVICE_CLASS, or 363 * BTM_FILTER_COND_BD_ADDR 364 * filter_cond - value for the filter (based on 365 * filter_cond_type) 366 * 367 * p_results_cb - Pointer to the callback routine which gets 368 * called upon receipt of an inquiry result. If 369 * this field is NULL, the application is not 370 * notified. 371 * 372 * p_cmpl_cb - Pointer to the callback routine which gets 373 * called upon completion. If this field is 374 * NULL, the application is not notified when 375 * completed. 376 * Returns tBTM_STATUS 377 * BTM_CMD_STARTED if successfully initiated 378 * BTM_BUSY if already in progress 379 * BTM_ILLEGAL_VALUE if parameter(s) are out of range 380 * BTM_NO_RESOURCES if could not allocate resources to start 381 * the command 382 * BTM_WRONG_MODE if the device is not up. 383 * 384 ******************************************************************************/ 385 extern tBTM_STATUS BTM_StartInquiry(tBTM_INQ_PARMS* p_inqparms, 386 tBTM_INQ_RESULTS_CB* p_results_cb, 387 tBTM_CMPL_CB* p_cmpl_cb); 388 389 /******************************************************************************* 390 * 391 * Function BTM_IsInquiryActive 392 * 393 * Description Return a bit mask of the current inquiry state 394 * 395 * Returns BTM_INQUIRY_INACTIVE if inactive (0) 396 * BTM_LIMITED_INQUIRY_ACTIVE if a limted inquiry is active 397 * BTM_GENERAL_INQUIRY_ACTIVE if a general inquiry is active 398 * BTM_PERIODIC_INQUIRY_ACTIVE if a periodic inquiry is active 399 * 400 ******************************************************************************/ 401 extern uint16_t BTM_IsInquiryActive(void); 402 403 /******************************************************************************* 404 * 405 * Function BTM_CancelInquiry 406 * 407 * Description This function cancels an inquiry if active 408 * 409 * Returns BTM_SUCCESS if successful 410 * BTM_NO_RESOURCES if could not allocate a message buffer 411 * BTM_WRONG_MODE if the device is not up. 412 * 413 ******************************************************************************/ 414 extern tBTM_STATUS BTM_CancelInquiry(void); 415 416 /******************************************************************************* 417 * 418 * Function BTM_CancelPeriodicInquiry 419 * 420 * Description This function cancels a periodic inquiry 421 * 422 * Returns 423 * BTM_NO_RESOURCES if could not allocate a message buffer 424 * BTM_SUCCESS - if cancelling the periodic inquiry 425 * BTM_WRONG_MODE if the device is not up. 426 * 427 ******************************************************************************/ 428 extern tBTM_STATUS BTM_CancelPeriodicInquiry(void); 429 430 /******************************************************************************* 431 * 432 * Function BTM_SetConnectability 433 * 434 * Description This function is called to set the device into or out of 435 * connectable mode. Discoverable mode means page scans are 436 * enabled. 437 * 438 * Returns BTM_SUCCESS if successful 439 * BTM_ILLEGAL_VALUE if a bad parameter is detected 440 * BTM_NO_RESOURCES if could not allocate a message buffer 441 * BTM_WRONG_MODE if the device is not up. 442 * 443 ******************************************************************************/ 444 extern tBTM_STATUS BTM_SetConnectability(uint16_t page_mode, uint16_t window, 445 uint16_t interval); 446 447 /******************************************************************************* 448 * 449 * Function BTM_ReadConnectability 450 * 451 * Description This function is called to read the current discoverability 452 * mode of the device. 453 * Output Params p_window - current page scan duration 454 * p_interval - current time between page scans 455 * 456 * Returns BTM_NON_CONNECTABLE or BTM_CONNECTABLE 457 * 458 ******************************************************************************/ 459 extern uint16_t BTM_ReadConnectability(uint16_t* p_window, 460 uint16_t* p_interval); 461 462 /******************************************************************************* 463 * 464 * Function BTM_SetInquiryMode 465 * 466 * Description This function is called to set standard, with RSSI 467 * mode or extended of the inquiry for local device. 468 * 469 * Input Params: BTM_INQ_RESULT_STANDARD, BTM_INQ_RESULT_WITH_RSSI or 470 * BTM_INQ_RESULT_EXTENDED 471 * 472 * Returns BTM_SUCCESS if successful 473 * BTM_NO_RESOURCES if couldn't get a memory pool buffer 474 * BTM_ILLEGAL_VALUE if a bad parameter was detected 475 * BTM_WRONG_MODE if the device is not up. 476 * 477 ******************************************************************************/ 478 extern tBTM_STATUS BTM_SetInquiryMode(uint8_t mode); 479 480 /******************************************************************************* 481 * 482 * Function BTM_SetInquiryScanType 483 * 484 * Description This function is called to set the iquiry scan-type to 485 * standard or interlaced. 486 * 487 * Input Params: BTM_SCAN_TYPE_STANDARD or BTM_SCAN_TYPE_INTERLACED 488 * 489 * Returns BTM_SUCCESS if successful 490 * BTM_MODE_UNSUPPORTED if not a 1.2 device 491 * BTM_WRONG_MODE if the device is not up. 492 * 493 ******************************************************************************/ 494 extern tBTM_STATUS BTM_SetInquiryScanType(uint16_t scan_type); 495 496 /******************************************************************************* 497 * 498 * Function BTM_SetPageScanType 499 * 500 * Description This function is called to set the page scan-type to 501 * standard or interlaced. 502 * 503 * Input Params: BTM_SCAN_TYPE_STANDARD or BTM_SCAN_TYPE_INTERLACED 504 * 505 * Returns BTM_SUCCESS if successful 506 * BTM_MODE_UNSUPPORTED if not a 1.2 device 507 * BTM_WRONG_MODE if the device is not up. 508 * 509 ******************************************************************************/ 510 511 extern tBTM_STATUS BTM_SetPageScanType(uint16_t scan_type); 512 513 /******************************************************************************* 514 * 515 * Function BTM_ReadRemoteDeviceName 516 * 517 * Description This function initiates a remote device HCI command to the 518 * controller and calls the callback when the process has 519 * completed. 520 * 521 * Input Params: remote_bda - device address of name to retrieve 522 * p_cb - callback function called when 523 * BTM_CMD_STARTED is returned. 524 * A pointer to tBTM_REMOTE_DEV_NAME is 525 * passed to the callback. 526 * 527 * Returns 528 * BTM_CMD_STARTED is returned if the request was successfully 529 * sent to HCI. 530 * BTM_BUSY if already in progress 531 * BTM_UNKNOWN_ADDR if device address is bad 532 * BTM_NO_RESOURCES if resources could not be allocated to 533 * start the command 534 * BTM_WRONG_MODE if the device is not up. 535 * 536 ******************************************************************************/ 537 extern tBTM_STATUS BTM_ReadRemoteDeviceName(const RawAddress& remote_bda, 538 tBTM_CMPL_CB* p_cb, 539 tBT_TRANSPORT transport); 540 541 /******************************************************************************* 542 * 543 * Function BTM_CancelRemoteDeviceName 544 * 545 * Description This function initiates the cancel request for the specified 546 * remote device. 547 * 548 * Input Params: None 549 * 550 * Returns 551 * BTM_CMD_STARTED is returned if the request was successfully 552 * sent to HCI. 553 * BTM_NO_RESOURCES if resources could not be allocated to 554 * start the command 555 * BTM_WRONG_MODE if there is no active remote name request. 556 * 557 ******************************************************************************/ 558 extern tBTM_STATUS BTM_CancelRemoteDeviceName(void); 559 560 /******************************************************************************* 561 * 562 * Function BTM_ReadRemoteVersion 563 * 564 * Description This function is called to read a remote device's version 565 * 566 * Returns BTM_SUCCESS if successful, otherwise an error 567 * 568 ******************************************************************************/ 569 extern tBTM_STATUS BTM_ReadRemoteVersion(const RawAddress& addr, 570 uint8_t* lmp_version, 571 uint16_t* manufacturer, 572 uint16_t* lmp_sub_version); 573 574 /******************************************************************************* 575 * 576 * Function BTM_ReadRemoteFeatures 577 * 578 * Description This function is called to read a remote device's 579 * supported features mask (features mask located at page 0) 580 * 581 * Note: The size of device features mask page is 582 * BTM_FEATURE_BYTES_PER_PAGE bytes. 583 * 584 * Returns pointer to the remote supported features mask 585 * 586 ******************************************************************************/ 587 extern uint8_t* BTM_ReadRemoteFeatures(const RawAddress& addr); 588 589 /******************************************************************************* 590 * 591 * Function BTM_ReadRemoteExtendedFeatures 592 * 593 * Description This function is called to read a specific extended features 594 * page of the remote device 595 * 596 * Note1: The size of device features mask page is 597 * BTM_FEATURE_BYTES_PER_PAGE bytes. 598 * Note2: The valid device features mask page number depends on 599 * the remote device capabilities. It is expected to be in the 600 * range [0 - BTM_EXT_FEATURES_PAGE_MAX]. 601 602 * Returns pointer to the remote extended features mask 603 * or NULL if page_number is not valid 604 * 605 ******************************************************************************/ 606 extern uint8_t* BTM_ReadRemoteExtendedFeatures(const RawAddress& addr, 607 uint8_t page_number); 608 609 /******************************************************************************* 610 * 611 * Function BTM_ReadNumberRemoteFeaturesPages 612 * 613 * Description This function is called to retrieve the number of feature 614 * pages read from the remote device 615 * 616 * Returns number of features pages read from the remote device 617 * 618 ******************************************************************************/ 619 extern uint8_t BTM_ReadNumberRemoteFeaturesPages(const RawAddress& addr); 620 621 /******************************************************************************* 622 * 623 * Function BTM_ReadAllRemoteFeatures 624 * 625 * Description Read all the features of the remote device 626 * 627 * Returns pointer to the byte[0] of the page[0] of the remote device 628 * feature mask. 629 * 630 * Note: the function returns the pointer to the array of the size 631 * BTM_FEATURE_BYTES_PER_PAGE * (BTM_EXT_FEATURES_PAGE_MAX + 1) 632 * 633 ******************************************************************************/ 634 extern uint8_t* BTM_ReadAllRemoteFeatures(const RawAddress& addr); 635 636 /******************************************************************************* 637 * 638 * Function BTM_InqDbRead 639 * 640 * Description This function looks through the inquiry database for a match 641 * based on Bluetooth Device Address. This is the application's 642 * interface to get the inquiry details of a specific BD 643 * address. 644 * 645 * Returns pointer to entry, or NULL if not found 646 * 647 ******************************************************************************/ 648 extern tBTM_INQ_INFO* BTM_InqDbRead(const RawAddress& p_bda); 649 650 /******************************************************************************* 651 * 652 * Function BTM_InqDbFirst 653 * 654 * Description This function looks through the inquiry database for the 655 * first used entry, and returns that. This is used in 656 * conjunction with BTM_InqDbNext by applications as a way to 657 * walk through the inquiry database. 658 * 659 * Returns pointer to first in-use entry, or NULL if DB is empty 660 * 661 ******************************************************************************/ 662 extern tBTM_INQ_INFO* BTM_InqDbFirst(void); 663 664 /******************************************************************************* 665 * 666 * Function BTM_InqDbNext 667 * 668 * Description This function looks through the inquiry database for the 669 * next used entry, and returns that. If the input parameter 670 * is NULL, the first entry is returned. 671 * 672 * Returns pointer to next in-use entry, or NULL if no more found. 673 * 674 ******************************************************************************/ 675 extern tBTM_INQ_INFO* BTM_InqDbNext(tBTM_INQ_INFO* p_cur); 676 677 /******************************************************************************* 678 * 679 * Function BTM_ClearInqDb 680 * 681 * Description This function is called to clear out a device or all devices 682 * from the inquiry database. 683 * 684 * Parameter p_bda - (input) BD_ADDR -> Address of device to clear 685 * (NULL clears all entries) 686 * 687 * Returns BTM_BUSY if an inquiry, get remote name, or event filter 688 * is active, otherwise BTM_SUCCESS 689 * 690 ******************************************************************************/ 691 extern tBTM_STATUS BTM_ClearInqDb(const RawAddress* p_bda); 692 693 /******************************************************************************* 694 * 695 * Function BTM_ReadInquiryRspTxPower 696 * 697 * Description This command will read the inquiry Transmit Power level used 698 * to transmit the FHS and EIR data packets. 699 * This can be used directly in the Tx Power Level EIR data 700 * type. 701 * 702 * Returns BTM_SUCCESS if successful 703 * 704 ******************************************************************************/ 705 extern tBTM_STATUS BTM_ReadInquiryRspTxPower(tBTM_CMPL_CB* p_cb); 706 707 /***************************************************************************** 708 * ACL CHANNEL MANAGEMENT FUNCTIONS 709 ****************************************************************************/ 710 /******************************************************************************* 711 * 712 * Function BTM_SetLinkPolicy 713 * 714 * Description Create and send HCI "Write Policy Set" command 715 * 716 * Returns BTM_CMD_STARTED if successfully initiated, otherwise error 717 * 718 ******************************************************************************/ 719 extern tBTM_STATUS BTM_SetLinkPolicy(const RawAddress& remote_bda, 720 uint16_t* settings); 721 722 /******************************************************************************* 723 * 724 * Function BTM_SetDefaultLinkPolicy 725 * 726 * Description Set the default value for HCI "Write Policy Set" command 727 * to use when an ACL link is created. 728 * 729 * Returns void 730 * 731 ******************************************************************************/ 732 extern void BTM_SetDefaultLinkPolicy(uint16_t settings); 733 734 /******************************************************************************* 735 * 736 * Function BTM_SetDefaultLinkSuperTout 737 * 738 * Description Set the default value for HCI "Write Link Supervision 739 * Timeout" command to use when an ACL link is created. 740 * 741 * Returns void 742 * 743 ******************************************************************************/ 744 extern void BTM_SetDefaultLinkSuperTout(uint16_t timeout); 745 746 /******************************************************************************* 747 * 748 * Function BTM_SetLinkSuperTout 749 * 750 * Description Create and send HCI "Write Link Supervision Timeout" command 751 * 752 * Returns BTM_CMD_STARTED if successfully initiated, otherwise error 753 * 754 ******************************************************************************/ 755 extern tBTM_STATUS BTM_SetLinkSuperTout(const RawAddress& remote_bda, 756 uint16_t timeout); 757 /******************************************************************************* 758 * 759 * Function BTM_GetLinkSuperTout 760 * 761 * Description Read the link supervision timeout value of the connection 762 * 763 * Returns status of the operation 764 * 765 ******************************************************************************/ 766 extern tBTM_STATUS BTM_GetLinkSuperTout(const RawAddress& remote_bda, 767 uint16_t* p_timeout); 768 769 /******************************************************************************* 770 * 771 * Function BTM_IsAclConnectionUp 772 * 773 * Description This function is called to check if an ACL connection exists 774 * to a specific remote BD Address. 775 * 776 * Returns true if connection is up, else false. 777 * 778 ******************************************************************************/ 779 extern bool BTM_IsAclConnectionUp(const RawAddress& remote_bda, 780 tBT_TRANSPORT transport); 781 782 /******************************************************************************* 783 * 784 * Function BTM_GetRole 785 * 786 * Description This function is called to get the role of the local device 787 * for the ACL connection with the specified remote device 788 * 789 * Returns BTM_SUCCESS if connection exists. 790 * BTM_UNKNOWN_ADDR if no active link with bd addr specified 791 * 792 ******************************************************************************/ 793 extern tBTM_STATUS BTM_GetRole(const RawAddress& remote_bd_addr, 794 uint8_t* p_role); 795 796 /******************************************************************************* 797 * 798 * Function BTM_SwitchRole 799 * 800 * Description This function is called to switch role between master and 801 * slave. If role is already set it will do nothing. If the 802 * command was initiated, the callback function is called upon 803 * completion. 804 * 805 * Returns BTM_SUCCESS if already in specified role. 806 * BTM_CMD_STARTED if command issued to controller. 807 * BTM_NO_RESOURCES if memory couldn't be allocated to issue 808 * the command 809 * BTM_UNKNOWN_ADDR if no active link with bd addr specified 810 * BTM_MODE_UNSUPPORTED if the local device does not support 811 * role switching 812 * 813 ******************************************************************************/ 814 extern tBTM_STATUS BTM_SwitchRole(const RawAddress& remote_bd_addr, 815 uint8_t new_role, tBTM_CMPL_CB* p_cb); 816 817 /******************************************************************************* 818 * 819 * Function BTM_ReadRSSI 820 * 821 * Description This function is called to read the link policy settings. 822 * The address of link policy results are returned in the 823 * callback. (tBTM_RSSI_RESULT) 824 * 825 * Returns BTM_CMD_STARTED if command issued to controller. 826 * BTM_NO_RESOURCES if memory couldn't be allocated to issue 827 * the command 828 * BTM_UNKNOWN_ADDR if no active link with bd addr specified 829 * BTM_BUSY if command is already in progress 830 * 831 ******************************************************************************/ 832 extern tBTM_STATUS BTM_ReadRSSI(const RawAddress& remote_bda, 833 tBTM_CMPL_CB* p_cb); 834 835 /******************************************************************************* 836 * 837 * Function BTM_ReadFailedContactCounter 838 * 839 * Description This function is called to read the failed contact counter. 840 * The result is returned in the callback. 841 * (tBTM_FAILED_CONTACT_COUNTER_RESULT) 842 * 843 * Returns BTM_CMD_STARTED if command issued to controller. 844 * BTM_NO_RESOURCES if memory couldn't be allocated to issue 845 * the command 846 * BTM_UNKNOWN_ADDR if no active link with bd addr specified 847 * BTM_BUSY if command is already in progress 848 * 849 ******************************************************************************/ 850 extern tBTM_STATUS BTM_ReadFailedContactCounter(const RawAddress& remote_bda, 851 tBTM_CMPL_CB* p_cb); 852 853 /******************************************************************************* 854 * 855 * Function BTM_ReadAutomaticFlushTimeout 856 * 857 * Description This function is called to read the automatic flush timeout. 858 * The result is returned in the callback. 859 * (tBTM_AUTOMATIC_FLUSH_TIMEOUT_RESULT) 860 * 861 * Returns BTM_CMD_STARTED if command issued to controller. 862 * BTM_NO_RESOURCES if memory couldn't be allocated to issue 863 * the command 864 * BTM_UNKNOWN_ADDR if no active link with bd addr specified 865 * BTM_BUSY if command is already in progress 866 * 867 ******************************************************************************/ 868 extern tBTM_STATUS BTM_ReadAutomaticFlushTimeout(const RawAddress& remote_bda, 869 tBTM_CMPL_CB* p_cb); 870 871 /******************************************************************************* 872 * 873 * Function BTM_ReadTxPower 874 * 875 * Description This function is called to read the current connection 876 * TX power of the connection. The TX power level results 877 * are returned in the callback. 878 * (tBTM_RSSI_RESULT) 879 * 880 * Returns BTM_CMD_STARTED if command issued to controller. 881 * BTM_NO_RESOURCES if memory couldn't be allocated to issue 882 * the command 883 * BTM_UNKNOWN_ADDR if no active link with bd addr specified 884 * BTM_BUSY if command is already in progress 885 * 886 ******************************************************************************/ 887 extern tBTM_STATUS BTM_ReadTxPower(const RawAddress& remote_bda, 888 tBT_TRANSPORT transport, tBTM_CMPL_CB* p_cb); 889 890 /******************************************************************************* 891 * 892 * Function BTM_ReadLinkQuality 893 * 894 * Description This function is called to read the link quality. 895 * The value of the link quality is returned in the callback. 896 * (tBTM_LINK_QUALITY_RESULT) 897 * 898 * Returns BTM_CMD_STARTED if command issued to controller. 899 * BTM_NO_RESOURCES if memory couldn't be allocated to issue 900 * the command 901 * BTM_UNKNOWN_ADDR if no active link with bd addr specified 902 * BTM_BUSY if command is already in progress 903 * 904 ******************************************************************************/ 905 extern tBTM_STATUS BTM_ReadLinkQuality(const RawAddress& remote_bda, 906 tBTM_CMPL_CB* p_cb); 907 908 /******************************************************************************* 909 * 910 * Function BTM_RegBusyLevelNotif 911 * 912 * Description This function is called to register a callback to receive 913 * busy level change events. 914 * 915 * Returns BTM_SUCCESS if successfully registered, otherwise error 916 * 917 ******************************************************************************/ 918 extern tBTM_STATUS BTM_RegBusyLevelNotif(tBTM_BL_CHANGE_CB* p_cb, 919 uint8_t* p_level, 920 tBTM_BL_EVENT_MASK evt_mask); 921 922 /******************************************************************************* 923 * 924 * Function BTM_AclRegisterForChanges 925 * 926 * Description This function is called to register a callback to receive 927 * ACL database change events, i.e. new connection or removed. 928 * 929 * Returns BTM_SUCCESS if successfully initiated, otherwise error 930 * 931 ******************************************************************************/ 932 extern tBTM_STATUS BTM_AclRegisterForChanges(tBTM_ACL_DB_CHANGE_CB* p_cb); 933 934 /******************************************************************************* 935 * 936 * Function BTM_GetNumAclLinks 937 * 938 * Description This function is called to count the number of 939 * ACL links that are active. 940 * 941 * Returns uint16_t Number of active ACL links 942 * 943 ******************************************************************************/ 944 extern uint16_t BTM_GetNumAclLinks(void); 945 946 /******************************************************************************* 947 * 948 * Function BTM_SetQoS 949 * 950 * Description This function is called to setup QoS 951 * 952 * Returns BTM_CMD_STARTED if successfully initiated, otherwise error 953 * 954 ******************************************************************************/ 955 extern tBTM_STATUS BTM_SetQoS(const RawAddress& bd, FLOW_SPEC* p_flow, 956 tBTM_CMPL_CB* p_cb); 957 958 /***************************************************************************** 959 * (e)SCO CHANNEL MANAGEMENT FUNCTIONS 960 ****************************************************************************/ 961 /******************************************************************************* 962 * 963 * Function BTM_CreateSco 964 * 965 * Description This function is called to create an SCO connection. If the 966 * "is_orig" flag is true, the connection will be originated, 967 * otherwise BTM will wait for the other side to connect. 968 * 969 * Returns BTM_UNKNOWN_ADDR if the ACL connection is not up 970 * BTM_BUSY if another SCO being set up to 971 * the same BD address 972 * BTM_NO_RESOURCES if the max SCO limit has been reached 973 * BTM_CMD_STARTED if the connection establishment is started. 974 * In this case, "*p_sco_inx" is filled in 975 * with the sco index used for the connection. 976 * 977 ******************************************************************************/ 978 extern tBTM_STATUS BTM_CreateSco(const RawAddress* remote_bda, bool is_orig, 979 uint16_t pkt_types, uint16_t* p_sco_inx, 980 tBTM_SCO_CB* p_conn_cb, 981 tBTM_SCO_CB* p_disc_cb); 982 983 /******************************************************************************* 984 * 985 * Function BTM_RemoveSco 986 * 987 * Description This function is called to remove a specific SCO connection. 988 * 989 * Returns BTM_CMD_STARTED if successfully initiated, otherwise error 990 * 991 ******************************************************************************/ 992 extern tBTM_STATUS BTM_RemoveSco(uint16_t sco_inx); 993 994 /******************************************************************************* 995 * 996 * Function BTM_SetScoPacketTypes 997 * 998 * Description This function is called to set the packet types used for 999 * a specific SCO connection, 1000 * 1001 * Parameters pkt_types - One or more of the following 1002 * BTM_SCO_PKT_TYPES_MASK_HV1 1003 * BTM_SCO_PKT_TYPES_MASK_HV2 1004 * BTM_SCO_PKT_TYPES_MASK_HV3 1005 * BTM_SCO_PKT_TYPES_MASK_EV3 1006 * BTM_SCO_PKT_TYPES_MASK_EV4 1007 * BTM_SCO_PKT_TYPES_MASK_EV5 1008 * 1009 * BTM_SCO_LINK_ALL_MASK - enables all supported types 1010 * 1011 * Returns BTM_CMD_STARTED if successfully initiated, otherwise error 1012 * 1013 ******************************************************************************/ 1014 extern tBTM_STATUS BTM_SetScoPacketTypes(uint16_t sco_inx, uint16_t pkt_types); 1015 1016 /******************************************************************************* 1017 * 1018 * Function BTM_ReadScoPacketTypes 1019 * 1020 * Description This function is read the packet types used for a specific 1021 * SCO connection. 1022 * 1023 * Returns One or more of the following (bitmask) 1024 * BTM_SCO_PKT_TYPES_MASK_HV1 1025 * BTM_SCO_PKT_TYPES_MASK_HV2 1026 * BTM_SCO_PKT_TYPES_MASK_HV3 1027 * BTM_SCO_PKT_TYPES_MASK_EV3 1028 * BTM_SCO_PKT_TYPES_MASK_EV4 1029 * BTM_SCO_PKT_TYPES_MASK_EV5 1030 * 1031 * Returns packet types supported for the connection 1032 * 1033 ******************************************************************************/ 1034 extern uint16_t BTM_ReadScoPacketTypes(uint16_t sco_inx); 1035 1036 /******************************************************************************* 1037 * 1038 * Function BTM_ReadDeviceScoPacketTypes 1039 * 1040 * Description This function is read the SCO packet types that 1041 * the device supports. 1042 * 1043 * Returns packet types supported by the device. 1044 * 1045 ******************************************************************************/ 1046 extern uint16_t BTM_ReadDeviceScoPacketTypes(void); 1047 1048 /******************************************************************************* 1049 * 1050 * Function BTM_ReadScoHandle 1051 * 1052 * Description Reead the HCI handle used for a specific SCO connection, 1053 * 1054 * Returns handle for the connection, or 0xFFFF if invalid SCO index. 1055 * 1056 ******************************************************************************/ 1057 extern uint16_t BTM_ReadScoHandle(uint16_t sco_inx); 1058 1059 /******************************************************************************* 1060 * 1061 * Function BTM_ReadScoBdAddr 1062 * 1063 * Description This function is read the remote BD Address for a specific 1064 * SCO connection, 1065 * 1066 * Returns pointer to BD address or NULL if not known 1067 * 1068 ******************************************************************************/ 1069 extern const RawAddress* BTM_ReadScoBdAddr(uint16_t sco_inx); 1070 1071 /******************************************************************************* 1072 * 1073 * Function BTM_ReadScoDiscReason 1074 * 1075 * Description This function is returns the reason why an (e)SCO connection 1076 * has been removed. It contains the value until read, or until 1077 * another (e)SCO connection has disconnected. 1078 * 1079 * Returns HCI reason or BTM_INVALID_SCO_DISC_REASON if not set. 1080 * 1081 ******************************************************************************/ 1082 extern uint16_t BTM_ReadScoDiscReason(void); 1083 1084 /******************************************************************************* 1085 * 1086 * Function BTM_SetEScoMode 1087 * 1088 * Description This function sets up the negotiated parameters for SCO or 1089 * eSCO, and sets as the default mode used for calls to 1090 * BTM_CreateSco. It can be called only when there are no 1091 * active (e)SCO links. 1092 * 1093 * Returns BTM_SUCCESS if the successful. 1094 * BTM_BUSY if there are one or more active (e)SCO links. 1095 * 1096 ******************************************************************************/ 1097 extern tBTM_STATUS BTM_SetEScoMode(enh_esco_params_t* p_parms); 1098 1099 /******************************************************************************* 1100 * 1101 * Function BTM_SetWBSCodec 1102 * 1103 * Description This function sends command to the controller to setup 1104 * WBS codec for the upcoming eSCO connection. 1105 * 1106 * Returns BTM_SUCCESS. 1107 * 1108 * 1109 ******************************************************************************/ 1110 extern tBTM_STATUS BTM_SetWBSCodec(tBTM_SCO_CODEC_TYPE codec_type); 1111 1112 /******************************************************************************* 1113 * 1114 * Function BTM_RegForEScoEvts 1115 * 1116 * Description This function registers a SCO event callback with the 1117 * specified instance. It should be used to received 1118 * connection indication events and change of link parameter 1119 * events. 1120 * 1121 * Returns BTM_SUCCESS if the successful. 1122 * BTM_ILLEGAL_VALUE if there is an illegal sco_inx 1123 * 1124 ******************************************************************************/ 1125 extern tBTM_STATUS BTM_RegForEScoEvts(uint16_t sco_inx, 1126 tBTM_ESCO_CBACK* p_esco_cback); 1127 1128 /******************************************************************************* 1129 * 1130 * Function BTM_ReadEScoLinkParms 1131 * 1132 * Description This function returns the current eSCO link parameters for 1133 * the specified handle. This can be called anytime a 1134 * connection is active, but is typically called after 1135 * receiving the SCO opened callback. 1136 * 1137 * Note: If called over a 1.1 controller, only the packet types 1138 * field has meaning. 1139 * Note: If the upper layer doesn't know the current sco index, 1140 * BTM_FIRST_ACTIVE_SCO_INDEX can be used as the first 1141 * parameter to find the first active SCO index 1142 * 1143 * Returns BTM_SUCCESS if returned data is valid connection. 1144 * BTM_ILLEGAL_VALUE if no connection for specified sco_inx. 1145 * BTM_MODE_UNSUPPORTED if local controller does not support 1146 * 1.2 specification. 1147 * 1148 ******************************************************************************/ 1149 extern tBTM_STATUS BTM_ReadEScoLinkParms(uint16_t sco_inx, 1150 tBTM_ESCO_DATA* p_parms); 1151 1152 /******************************************************************************* 1153 * 1154 * Function BTM_ChangeEScoLinkParms 1155 * 1156 * Description This function requests renegotiation of the parameters on 1157 * the current eSCO Link. If any of the changes are accepted 1158 * by the controllers, the BTM_ESCO_CHG_EVT event is sent in 1159 * the tBTM_ESCO_CBACK function with the current settings of 1160 * the link. The callback is registered through the call to 1161 * BTM_SetEScoMode. 1162 * 1163 * 1164 * Returns BTM_CMD_STARTED if command is successfully initiated. 1165 * BTM_ILLEGAL_VALUE if no connection for specified sco_inx. 1166 * BTM_NO_RESOURCES - not enough resources to initiate command. 1167 * BTM_MODE_UNSUPPORTED if local controller does not support 1168 * 1.2 specification. 1169 * 1170 ******************************************************************************/ 1171 extern tBTM_STATUS BTM_ChangeEScoLinkParms(uint16_t sco_inx, 1172 tBTM_CHG_ESCO_PARAMS* p_parms); 1173 1174 /******************************************************************************* 1175 * 1176 * Function BTM_EScoConnRsp 1177 * 1178 * Description This function is called upon receipt of an (e)SCO connection 1179 * request event (BTM_ESCO_CONN_REQ_EVT) to accept or reject 1180 * the request. Parameters used to negotiate eSCO links. 1181 * If p_parms is NULL, then values set through BTM_SetEScoMode 1182 * are used. 1183 * If the link type of the incoming request is SCO, then only 1184 * the tx_bw, max_latency, content format, and packet_types are 1185 * valid. The hci_status parameter should be 1186 * ([0x0] to accept, [0x0d..0x0f] to reject) 1187 * 1188 * 1189 * Returns void 1190 * 1191 ******************************************************************************/ 1192 extern void BTM_EScoConnRsp(uint16_t sco_inx, uint8_t hci_status, 1193 enh_esco_params_t* p_parms); 1194 1195 /******************************************************************************* 1196 * 1197 * Function BTM_GetNumScoLinks 1198 * 1199 * Description This function returns the number of active SCO links. 1200 * 1201 * Returns uint8_t 1202 * 1203 ******************************************************************************/ 1204 extern uint8_t BTM_GetNumScoLinks(void); 1205 1206 /***************************************************************************** 1207 * SECURITY MANAGEMENT FUNCTIONS 1208 ****************************************************************************/ 1209 /******************************************************************************* 1210 * 1211 * Function BTM_SecRegister 1212 * 1213 * Description Application manager calls this function to register for 1214 * security services. There can be one and only one 1215 * application saving link keys. BTM allows only first 1216 * registration. 1217 * 1218 * Returns true if registered OK, else false 1219 * 1220 ******************************************************************************/ 1221 extern bool BTM_SecRegister(const tBTM_APPL_INFO* p_cb_info); 1222 1223 /******************************************************************************* 1224 * 1225 * Function BTM_SecRegisterLinkKeyNotificationCallback 1226 * 1227 * Description Profiles can register to be notified when a new Link Key 1228 * is generated per connection. 1229 * 1230 * Returns true if registered OK, else false 1231 * 1232 ******************************************************************************/ 1233 extern bool BTM_SecRegisterLinkKeyNotificationCallback( 1234 tBTM_LINK_KEY_CALLBACK* p_callback); 1235 1236 /******************************************************************************* 1237 * 1238 * Function BTM_SecAddRmtNameNotifyCallback 1239 * 1240 * Description Profiles can register to be notified when name of the 1241 * remote device is resolved (up to 1242 * BTM_SEC_MAX_RMT_NAME_CALLBACKS). 1243 * 1244 * Returns true if registered OK, else false 1245 * 1246 ******************************************************************************/ 1247 extern bool BTM_SecAddRmtNameNotifyCallback(tBTM_RMT_NAME_CALLBACK* p_callback); 1248 1249 /******************************************************************************* 1250 * 1251 * Function BTM_SecDeleteRmtNameNotifyCallback 1252 * 1253 * Description A profile can deregister notification when a new Link Key 1254 * is generated per connection. 1255 * 1256 * Returns true if OK, else false 1257 * 1258 ******************************************************************************/ 1259 extern bool BTM_SecDeleteRmtNameNotifyCallback( 1260 tBTM_RMT_NAME_CALLBACK* p_callback); 1261 1262 /******************************************************************************* 1263 * 1264 * Function BTM_GetSecurityFlags 1265 * 1266 * Description Get security flags for the device 1267 * 1268 * Returns bool true or false is device found 1269 * 1270 ******************************************************************************/ 1271 extern bool BTM_GetSecurityFlags(const RawAddress& bd_addr, 1272 uint8_t* p_sec_flags); 1273 1274 /******************************************************************************* 1275 * 1276 * Function BTM_GetSecurityFlagsByTransport 1277 * 1278 * Description Get security flags for the device on a particular transport 1279 * 1280 * Parameters bd_addr: BD address of remote device 1281 * p_sec_flags : Out parameter to be filled with security 1282 * flags for the connection 1283 * transport : Physical transport of the connection 1284 * (BR/EDR or LE) 1285 * 1286 * Returns bool true or false is device found 1287 * 1288 ******************************************************************************/ 1289 extern bool BTM_GetSecurityFlagsByTransport(const RawAddress& bd_addr, 1290 uint8_t* p_sec_flags, 1291 tBT_TRANSPORT transport); 1292 1293 /******************************************************************************* 1294 * 1295 * Function BTM_ReadTrustedMask 1296 * 1297 * Description Get trusted mask for the device 1298 * 1299 * Returns NULL, if the device record is not found. 1300 * otherwise, the trusted mask 1301 * 1302 ******************************************************************************/ 1303 extern uint32_t* BTM_ReadTrustedMask(const RawAddress& bd_addr); 1304 1305 /******************************************************************************* 1306 * 1307 * Function BTM_SetPinType 1308 * 1309 * Description Set PIN type for the device. 1310 * 1311 * Returns void 1312 * 1313 ******************************************************************************/ 1314 extern void BTM_SetPinType(uint8_t pin_type, PIN_CODE pin_code, 1315 uint8_t pin_code_len); 1316 1317 /******************************************************************************* 1318 * 1319 * Function BTM_SetPairableMode 1320 * 1321 * Description Enable or disable pairing 1322 * 1323 * Parameters allow_pairing - (true or false) whether or not the device 1324 * allows pairing. 1325 * connect_only_paired - (true or false) whether or not to 1326 * only allow paired devices to connect. 1327 * 1328 * Returns void 1329 * 1330 ******************************************************************************/ 1331 extern void BTM_SetPairableMode(bool allow_pairing, bool connect_only_paired); 1332 1333 /******************************************************************************* 1334 * 1335 * Function BTM_SetSecureConnectionsOnly 1336 * 1337 * Description Enable or disable default treatment for Mode 4 Level 0 1338 * services 1339 * 1340 * Parameter secure_connections_only_mode - (true or false) 1341 * true means that the device should treat Mode 4 Level 0 1342 * services as services of other levels. 1343 * false means that the device should provide default 1344 * treatment for Mode 4 Level 0 services. 1345 * 1346 * Returns void 1347 * 1348 ******************************************************************************/ 1349 extern void BTM_SetSecureConnectionsOnly(bool secure_connections_only_mode); 1350 1351 /******************************************************************************* 1352 * 1353 * Function BTM_SetSecurityLevel 1354 * 1355 * Description Register service security level with Security Manager. Each 1356 * service must register its requirements regardless of the 1357 * security level that is used. This API is called once for 1358 * originators and again for acceptors of connections. 1359 * 1360 * Returns true if registered OK, else false 1361 * 1362 ******************************************************************************/ 1363 extern bool BTM_SetSecurityLevel(bool is_originator, const char* p_name, 1364 uint8_t service_id, uint16_t sec_level, 1365 uint16_t psm, uint32_t mx_proto_id, 1366 uint32_t mx_chan_id); 1367 1368 /******************************************************************************* 1369 * 1370 * Function BTM_SetOutService 1371 * 1372 * Description This function is called to set the service for 1373 * outgoing connection. 1374 * 1375 * Returns void 1376 * 1377 ******************************************************************************/ 1378 extern void BTM_SetOutService(const RawAddress& bd_addr, uint8_t service_id, 1379 uint32_t mx_chan_id); 1380 1381 /******************************************************************************* 1382 * 1383 * Function BTM_SecClrService 1384 * 1385 * Description Removes specified service record(s) from the security 1386 * database. All service records with the specified name are 1387 * removed. Typically used only by devices with limited RAM 1388 * so that it can reuse an old security service record. 1389 * 1390 * Returns Number of records that were freed. 1391 * 1392 ******************************************************************************/ 1393 extern uint8_t BTM_SecClrService(uint8_t service_id); 1394 1395 /******************************************************************************* 1396 * 1397 * Function BTM_SecAddDevice 1398 * 1399 * Description Add/modify device. This function will be normally called 1400 * during host startup to restore all required information 1401 * stored in the NVRAM. 1402 * dev_class, bd_name, link_key, and features are NULL if 1403 * unknown 1404 * 1405 * Returns true if added OK, else false 1406 * 1407 ******************************************************************************/ 1408 extern bool BTM_SecAddDevice(const RawAddress& bd_addr, DEV_CLASS dev_class, 1409 BD_NAME bd_name, uint8_t* features, 1410 uint32_t trusted_mask[], LinkKey* link_key, 1411 uint8_t key_type, tBTM_IO_CAP io_cap, 1412 uint8_t pin_length); 1413 1414 /** Free resources associated with the device associated with |bd_addr| address. 1415 * 1416 * *** WARNING *** 1417 * tBTM_SEC_DEV_REC associated with bd_addr becomes invalid after this function 1418 * is called, also any of it's fields. i.e. if you use p_dev_rec->bd_addr, it is 1419 * no longer valid! 1420 * *** WARNING *** 1421 * 1422 * Returns true if removed OK, false if not found or ACL link is active. 1423 */ 1424 extern bool BTM_SecDeleteDevice(const RawAddress& bd_addr); 1425 1426 /******************************************************************************* 1427 * 1428 * Function BTM_SecClearSecurityFlags 1429 * 1430 * Description Reset the security flags (mark as not-paired) for a given 1431 * remove device. 1432 * 1433 ******************************************************************************/ 1434 extern void BTM_SecClearSecurityFlags(const RawAddress& bd_addr); 1435 1436 /******************************************************************************* 1437 * 1438 * Function BTM_SecGetDeviceLinkKey 1439 * 1440 * Description This function is called to obtain link key for the device 1441 * it returns BTM_SUCCESS if link key is available, or 1442 * BTM_UNKNOWN_ADDR if Security Manager does not know about 1443 * the device or device record does not contain link key info 1444 * 1445 * Returns BTM_SUCCESS if successful, otherwise error code 1446 * 1447 ******************************************************************************/ 1448 extern tBTM_STATUS BTM_SecGetDeviceLinkKey(const RawAddress& bd_addr, 1449 LinkKey* link_key); 1450 1451 /******************************************************************************* 1452 * 1453 * Function BTM_SecGetDeviceLinkKeyType 1454 * 1455 * Description This function is called to obtain link key type for the 1456 * device. 1457 * it returns BTM_SUCCESS if link key is available, or 1458 * BTM_UNKNOWN_ADDR if Security Manager does not know about 1459 * the device or device record does not contain link key info 1460 * 1461 * Returns BTM_LKEY_TYPE_IGNORE if link key is unknown, link type 1462 * otherwise. 1463 * 1464 ******************************************************************************/ 1465 extern tBTM_LINK_KEY_TYPE BTM_SecGetDeviceLinkKeyType( 1466 const RawAddress& bd_addr); 1467 1468 /******************************************************************************* 1469 * 1470 * Function BTM_PINCodeReply 1471 * 1472 * Description This function is called after Security Manager submitted 1473 * PIN code request to the UI. 1474 * 1475 * Parameters: bd_addr - Address of the device for which PIN was 1476 * requested 1477 * res - result of the operation BTM_SUCCESS if 1478 * success 1479 * pin_len - length in bytes of the PIN Code 1480 * p_pin - pointer to array with the PIN Code 1481 * trusted_mask - bitwise OR of trusted services 1482 * (array of uint32_t) 1483 * 1484 * Returns void 1485 * 1486 ******************************************************************************/ 1487 extern void BTM_PINCodeReply(const RawAddress& bd_addr, uint8_t res, 1488 uint8_t pin_len, uint8_t* p_pin, 1489 uint32_t trusted_mask[]); 1490 1491 /******************************************************************************* 1492 * 1493 * Function BTM_SecBond 1494 * 1495 * Description This function is called to perform bonding with peer device. 1496 * 1497 * Parameters: bd_addr - Address of the device to bond 1498 * pin_len - length in bytes of the PIN Code 1499 * p_pin - pointer to array with the PIN Code 1500 * trusted_mask - bitwise OR of trusted services 1501 * (array of uint32_t) 1502 * Returns BTM_CMD_STARTED if successfully initiated, otherwise error 1503 * 1504 ******************************************************************************/ 1505 extern tBTM_STATUS BTM_SecBond(const RawAddress& bd_addr, uint8_t pin_len, 1506 uint8_t* p_pin, uint32_t trusted_mask[]); 1507 1508 /******************************************************************************* 1509 * 1510 * Function BTM_SecBondByTransport 1511 * 1512 * Description Perform bonding by designated transport 1513 * 1514 * Parameters: bd_addr - Address of the device to bond 1515 * pin_len - length in bytes of the PIN Code 1516 * p_pin - pointer to array with the PIN Code 1517 * trusted_mask - bitwise OR of trusted services 1518 * (array of uint32_t) 1519 * transport : Physical transport to use for bonding 1520 * (BR/EDR or LE) 1521 * 1522 * Returns BTM_CMD_STARTED if successfully initiated, otherwise error 1523 * 1524 ******************************************************************************/ 1525 extern tBTM_STATUS BTM_SecBondByTransport(const RawAddress& bd_addr, 1526 tBT_TRANSPORT transport, 1527 uint8_t pin_len, uint8_t* p_pin, 1528 uint32_t trusted_mask[]); 1529 1530 /******************************************************************************* 1531 * 1532 * Function BTM_SecBondCancel 1533 * 1534 * Description This function is called to cancel ongoing bonding process 1535 * with peer device. 1536 * 1537 * Returns BTM_CMD_STARTED if successfully initiated, otherwise error 1538 * 1539 ******************************************************************************/ 1540 extern tBTM_STATUS BTM_SecBondCancel(const RawAddress& bd_addr); 1541 1542 /******************************************************************************* 1543 * 1544 * Function BTM_SetEncryption 1545 * 1546 * Description This function is called to ensure that connection is 1547 * encrypted. Should be called only on an open connection. 1548 * Typically only needed for connections that first want to 1549 * bring up unencrypted links, then later encrypt them. 1550 * 1551 * Parameters: bd_addr - Address of the peer device 1552 * transport - Link transport 1553 * p_callback - Pointer to callback function called if 1554 * this function returns PENDING after required 1555 * procedures are completed. Can be set to 1556 * NULL if status is not desired. 1557 * p_ref_data - pointer to any data the caller wishes to 1558 * receive in the callback function upon 1559 * completion. 1560 * can be set to NULL if not used. 1561 * sec_act - LE security action, unused for BR/EDR 1562 * 1563 * Returns BTM_SUCCESS - already encrypted 1564 * BTM_PENDING - command will be returned in the callback 1565 * BTM_WRONG_MODE- connection not up. 1566 * BTM_BUSY - security procedures are currently active 1567 * BTM_MODE_UNSUPPORTED - if security manager not linked in. 1568 * 1569 ******************************************************************************/ 1570 extern tBTM_STATUS BTM_SetEncryption(const RawAddress& bd_addr, 1571 tBT_TRANSPORT transport, 1572 tBTM_SEC_CBACK* p_callback, 1573 void* p_ref_data, 1574 tBTM_BLE_SEC_ACT sec_act); 1575 1576 /******************************************************************************* 1577 * 1578 * Function BTM_ConfirmReqReply 1579 * 1580 * Description This function is called to confirm the numeric value for 1581 * Simple Pairing in response to BTM_SP_CFM_REQ_EVT 1582 * 1583 * Parameters: res - result of the operation BTM_SUCCESS if 1584 * success 1585 * bd_addr - Address of the peer device 1586 * 1587 ******************************************************************************/ 1588 extern void BTM_ConfirmReqReply(tBTM_STATUS res, const RawAddress& bd_addr); 1589 1590 /******************************************************************************* 1591 * 1592 * Function BTM_PasskeyReqReply 1593 * 1594 * Description This function is called to provide the passkey for 1595 * Simple Pairing in response to BTM_SP_KEY_REQ_EVT 1596 * 1597 * Parameters: res - result of the operation BTM_SUCCESS if 1598 * success 1599 * bd_addr - Address of the peer device 1600 * passkey - numeric value in the range of 1601 * 0 - 999999(0xF423F). 1602 * 1603 ******************************************************************************/ 1604 extern void BTM_PasskeyReqReply(tBTM_STATUS res, const RawAddress& bd_addr, 1605 uint32_t passkey); 1606 1607 /******************************************************************************* 1608 * 1609 * Function BTM_SendKeypressNotif 1610 * 1611 * Description This function is used during the passkey entry model 1612 * by a device with KeyboardOnly IO capabilities 1613 * (very likely to be a HID Device). 1614 * It is called by a HID Device to inform the remote device 1615 * when a key has been entered or erased. 1616 * 1617 * Parameters: bd_addr - Address of the peer device 1618 * type - notification type 1619 * 1620 ******************************************************************************/ 1621 extern void BTM_SendKeypressNotif(const RawAddress& bd_addr, 1622 tBTM_SP_KEY_TYPE type); 1623 1624 /******************************************************************************* 1625 * 1626 * Function BTM_IoCapRsp 1627 * 1628 * Description This function is called in response to BTM_SP_IO_REQ_EVT 1629 * When the event data io_req.oob_data is set to 1630 * BTM_OOB_UNKNOWN by the tBTM_SP_CALLBACK implementation, this 1631 * function is called to provide the actual response 1632 * 1633 * Parameters: bd_addr - Address of the peer device 1634 * io_cap - The IO capability of local device. 1635 * oob - BTM_OOB_NONE or BTM_OOB_PRESENT. 1636 * auth_req- MITM protection required or not. 1637 * 1638 ******************************************************************************/ 1639 extern void BTM_IoCapRsp(const RawAddress& bd_addr, tBTM_IO_CAP io_cap, 1640 tBTM_OOB_DATA oob, tBTM_AUTH_REQ auth_req); 1641 1642 /******************************************************************************* 1643 * 1644 * Function BTM_ReadLocalOobData 1645 * 1646 * Description This function is called to read the local OOB data from 1647 * LM 1648 * 1649 ******************************************************************************/ 1650 extern void BTM_ReadLocalOobData(void); 1651 1652 /******************************************************************************* 1653 * 1654 * Function BTM_RemoteOobDataReply 1655 * 1656 * Description This function is called to provide the remote OOB data for 1657 * Simple Pairing in response to BTM_SP_RMT_OOB_EVT 1658 * 1659 * Parameters: bd_addr - Address of the peer device 1660 * c - simple pairing Hash C. 1661 * r - simple pairing Randomizer C. 1662 * 1663 ******************************************************************************/ 1664 extern void BTM_RemoteOobDataReply(tBTM_STATUS res, const RawAddress& bd_addr, 1665 const Octet16& c, const Octet16& r); 1666 1667 /******************************************************************************* 1668 * 1669 * Function BTM_BuildOobData 1670 * 1671 * Description This function is called to build the OOB data payload to 1672 * be sent over OOB (non-Bluetooth) link 1673 * 1674 * Parameters: p_data - the location for OOB data 1675 * max_len - p_data size. 1676 * c - simple pairing Hash C. 1677 * r - simple pairing Randomizer C. 1678 * name_len- 0, local device name would not be included. 1679 * otherwise, the local device name is included for 1680 * up to this specified length 1681 * 1682 * Returns Number of bytes in p_data. 1683 * 1684 ******************************************************************************/ 1685 extern uint16_t BTM_BuildOobData(uint8_t* p_data, uint16_t max_len, 1686 const Octet16& c, const Octet16& r, 1687 uint8_t name_len); 1688 1689 /******************************************************************************* 1690 * 1691 * Function BTM_BothEndsSupportSecureConnections 1692 * 1693 * Description This function is called to check if both the local device 1694 * and the peer device specified by bd_addr support BR/EDR 1695 * Secure Connections. 1696 * 1697 * Parameters: bd_addr - address of the peer 1698 * 1699 * Returns true if BR/EDR Secure Connections are supported by both 1700 * local and the remote device. 1701 * else false. 1702 * 1703 ******************************************************************************/ 1704 extern bool BTM_BothEndsSupportSecureConnections(const RawAddress& bd_addr); 1705 1706 /******************************************************************************* 1707 * 1708 * Function BTM_PeerSupportsSecureConnections 1709 * 1710 * Description This function is called to check if the peer supports 1711 * BR/EDR Secure Connections. 1712 * 1713 * Parameters: bd_addr - address of the peer 1714 * 1715 * Returns true if BR/EDR Secure Connections are supported by the peer, 1716 * else false. 1717 * 1718 ******************************************************************************/ 1719 extern bool BTM_PeerSupportsSecureConnections(const RawAddress& bd_addr); 1720 1721 /******************************************************************************* 1722 * 1723 * Function BTM_ReadOobData 1724 * 1725 * Description This function is called to parse the OOB data payload 1726 * received over OOB (non-Bluetooth) link 1727 * 1728 * Parameters: p_data - the location for OOB data 1729 * eir_tag - The associated EIR tag to read the data. 1730 * *p_len(output) - the length of the data with the given tag. 1731 * 1732 * Returns the beginning of the data with the given tag. 1733 * NULL, if the tag is not found. 1734 * 1735 ******************************************************************************/ 1736 extern uint8_t* BTM_ReadOobData(uint8_t* p_data, uint8_t eir_tag, 1737 uint8_t* p_len); 1738 1739 /******************************************************************************* 1740 * 1741 * Function BTM_SecReadDevName 1742 * 1743 * Description Looks for the device name in the security database for the 1744 * specified BD address. 1745 * 1746 * Returns Pointer to the name or NULL 1747 * 1748 ******************************************************************************/ 1749 extern char* BTM_SecReadDevName(const RawAddress& bd_addr); 1750 1751 /***************************************************************************** 1752 * POWER MANAGEMENT FUNCTIONS 1753 ****************************************************************************/ 1754 /******************************************************************************* 1755 * 1756 * Function BTM_PmRegister 1757 * 1758 * Description register or deregister with power manager 1759 * 1760 * Returns BTM_SUCCESS if successful, 1761 * BTM_NO_RESOURCES if no room to hold registration 1762 * BTM_ILLEGAL_VALUE 1763 * 1764 ******************************************************************************/ 1765 extern tBTM_STATUS BTM_PmRegister(uint8_t mask, uint8_t* p_pm_id, 1766 tBTM_PM_STATUS_CBACK* p_cb); 1767 1768 /******************************************************************************* 1769 * 1770 * Function BTM_SetPowerMode 1771 * 1772 * Description store the mode in control block or 1773 * alter ACL connection behavior. 1774 * 1775 * Returns BTM_SUCCESS if successful, 1776 * BTM_UNKNOWN_ADDR if bd addr is not active or bad 1777 * 1778 ******************************************************************************/ 1779 extern tBTM_STATUS BTM_SetPowerMode(uint8_t pm_id, const RawAddress& remote_bda, 1780 const tBTM_PM_PWR_MD* p_mode); 1781 1782 /******************************************************************************* 1783 * 1784 * Function BTM_ReadPowerMode 1785 * 1786 * Description This returns the current mode for a specific 1787 * ACL connection. 1788 * 1789 * Input Param remote_bda - device address of desired ACL connection 1790 * 1791 * Output Param p_mode - address where the current mode is copied into. 1792 * BTM_ACL_MODE_NORMAL 1793 * BTM_ACL_MODE_HOLD 1794 * BTM_ACL_MODE_SNIFF 1795 * BTM_ACL_MODE_PARK 1796 * (valid only if return code is BTM_SUCCESS) 1797 * 1798 * Returns BTM_SUCCESS if successful, 1799 * BTM_UNKNOWN_ADDR if bd addr is not active or bad 1800 * 1801 ******************************************************************************/ 1802 extern tBTM_STATUS BTM_ReadPowerMode(const RawAddress& remote_bda, 1803 tBTM_PM_MODE* p_mode); 1804 1805 /******************************************************************************* 1806 * 1807 * Function BTM_SetSsrParams 1808 * 1809 * Description This sends the given SSR parameters for the given ACL 1810 * connection if it is in ACTIVE mode. 1811 * 1812 * Input Param remote_bda - device address of desired ACL connection 1813 * max_lat - maximum latency (in 0.625ms)(0-0xFFFE) 1814 * min_rmt_to - minimum remote timeout 1815 * min_loc_to - minimum local timeout 1816 * 1817 * 1818 * Returns BTM_SUCCESS if the HCI command is issued successful, 1819 * BTM_UNKNOWN_ADDR if bd addr is not active or bad 1820 * BTM_CMD_STORED if the command is stored 1821 * 1822 ******************************************************************************/ 1823 extern tBTM_STATUS BTM_SetSsrParams(const RawAddress& remote_bda, 1824 uint16_t max_lat, uint16_t min_rmt_to, 1825 uint16_t min_loc_to); 1826 1827 /******************************************************************************* 1828 * 1829 * Function BTM_GetHCIConnHandle 1830 * 1831 * Description This function is called to get the handle for an ACL 1832 * connection to a specific remote BD Address. 1833 * 1834 * Returns the handle of the connection, or 0xFFFF if none. 1835 * 1836 ******************************************************************************/ 1837 extern uint16_t BTM_GetHCIConnHandle(const RawAddress& remote_bda, 1838 tBT_TRANSPORT transport); 1839 1840 /******************************************************************************* 1841 * 1842 * Function BTM_DeleteStoredLinkKey 1843 * 1844 * Description This function is called to delete link key for the specified 1845 * device addresses from the NVRAM storage attached to the 1846 * Bluetooth controller. 1847 * 1848 * Parameters: bd_addr - Addresses of the devices 1849 * p_cb - Call back function to be called to return 1850 * the results 1851 * 1852 ******************************************************************************/ 1853 extern tBTM_STATUS BTM_DeleteStoredLinkKey(const RawAddress* bd_addr, 1854 tBTM_CMPL_CB* p_cb); 1855 1856 /******************************************************************************* 1857 * 1858 * Function BTM_WriteEIR 1859 * 1860 * Description This function is called to write EIR data to controller. 1861 * 1862 * Parameters p_buff - allocated HCI command buffer including extended 1863 * inquriry response 1864 * 1865 * Returns BTM_SUCCESS - if successful 1866 * BTM_MODE_UNSUPPORTED - if local device cannot support it 1867 * 1868 ******************************************************************************/ 1869 extern tBTM_STATUS BTM_WriteEIR(BT_HDR* p_buff); 1870 1871 /******************************************************************************* 1872 * 1873 * Function BTM_HasEirService 1874 * 1875 * Description This function is called to know if UUID in bit map of UUID. 1876 * 1877 * Parameters p_eir_uuid - bit map of UUID list 1878 * uuid16 - UUID 16-bit 1879 * 1880 * Returns true - if found 1881 * false - if not found 1882 * 1883 ******************************************************************************/ 1884 extern bool BTM_HasEirService(const uint32_t* p_eir_uuid, uint16_t uuid16); 1885 1886 /******************************************************************************* 1887 * 1888 * Function BTM_HasInquiryEirService 1889 * 1890 * Description Return if a UUID is in the bit map of a UUID list. 1891 * 1892 * Parameters p_results - inquiry results 1893 * uuid16 - UUID 16-bit 1894 * 1895 * Returns BTM_EIR_FOUND - if found 1896 * BTM_EIR_NOT_FOUND - if not found and it is a complete list 1897 * BTM_EIR_UNKNOWN - if not found and it is not complete list 1898 * 1899 ******************************************************************************/ 1900 extern tBTM_EIR_SEARCH_RESULT BTM_HasInquiryEirService( 1901 tBTM_INQ_RESULTS* p_results, uint16_t uuid16); 1902 1903 /******************************************************************************* 1904 * 1905 * Function BTM_AddEirService 1906 * 1907 * Description This function is called to add a service in the bit map UUID 1908 * list. 1909 * 1910 * Parameters p_eir_uuid - bit mask of UUID list for EIR 1911 * uuid16 - UUID 16-bit 1912 * 1913 * Returns None 1914 * 1915 ******************************************************************************/ 1916 extern void BTM_AddEirService(uint32_t* p_eir_uuid, uint16_t uuid16); 1917 1918 /******************************************************************************* 1919 * 1920 * Function BTM_RemoveEirService 1921 * 1922 * Description This function is called to remove a service from the bit map 1923 * UUID list. 1924 * 1925 * Parameters p_eir_uuid - bit mask of UUID list for EIR 1926 * uuid16 - UUID 16-bit 1927 * 1928 * Returns None 1929 * 1930 ******************************************************************************/ 1931 extern void BTM_RemoveEirService(uint32_t* p_eir_uuid, uint16_t uuid16); 1932 1933 /******************************************************************************* 1934 * 1935 * Function BTM_GetEirSupportedServices 1936 * 1937 * Description This function is called to get UUID list from bit map UUID 1938 * list. 1939 * 1940 * Parameters p_eir_uuid - bit mask of UUID list for EIR 1941 * p - reference of current pointer of EIR 1942 * max_num_uuid16 - max number of UUID can be written in EIR 1943 * num_uuid16 - number of UUID have been written in EIR 1944 * 1945 * Returns BTM_EIR_MORE_16BITS_UUID_TYPE, if it has more than max 1946 * BTM_EIR_COMPLETE_16BITS_UUID_TYPE, otherwise 1947 * 1948 ******************************************************************************/ 1949 extern uint8_t BTM_GetEirSupportedServices(uint32_t* p_eir_uuid, uint8_t** p, 1950 uint8_t max_num_uuid16, 1951 uint8_t* p_num_uuid16); 1952 1953 /******************************************************************************* 1954 * 1955 * Function BTM_GetEirUuidList 1956 * 1957 * Description This function parses EIR and returns UUID list. 1958 * 1959 * Parameters p_eir - EIR 1960 * eirl_len - EIR len 1961 * uuid_size - Uuid::kNumBytes16, Uuid::kNumBytes32, 1962 * Uuid::kNumBytes128 1963 * p_num_uuid - return number of UUID in found list 1964 * p_uuid_list - return UUID 16-bit list 1965 * max_num_uuid - maximum number of UUID to be returned 1966 * 1967 * Returns 0 - if not found 1968 * BTM_EIR_COMPLETE_16BITS_UUID_TYPE 1969 * BTM_EIR_MORE_16BITS_UUID_TYPE 1970 * BTM_EIR_COMPLETE_32BITS_UUID_TYPE 1971 * BTM_EIR_MORE_32BITS_UUID_TYPE 1972 * BTM_EIR_COMPLETE_128BITS_UUID_TYPE 1973 * BTM_EIR_MORE_128BITS_UUID_TYPE 1974 * 1975 ******************************************************************************/ 1976 extern uint8_t BTM_GetEirUuidList(uint8_t* p_eir, size_t eir_len, 1977 uint8_t uuid_size, uint8_t* p_num_uuid, 1978 uint8_t* p_uuid_list, uint8_t max_num_uuid); 1979 1980 /***************************************************************************** 1981 * SCO OVER HCI 1982 ****************************************************************************/ 1983 /******************************************************************************* 1984 * 1985 * Function BTM_ConfigScoPath 1986 * 1987 * Description This function enable/disable SCO over HCI and registers SCO 1988 * data callback if SCO over HCI is enabled. 1989 * 1990 * Parameter path: SCO or HCI 1991 * p_sco_data_cb: callback function or SCO data if path is set 1992 * to transport. 1993 * p_pcm_param: pointer to the PCM interface parameter. If a 1994 * NULL pointer is used, the PCM parameter 1995 * maintained in the control block will be used; 1996 * otherwise update the control block value. 1997 * err_data_rpt: Lisbon feature to enable the erronous data 1998 * report or not. 1999 * 2000 * Returns BTM_SUCCESS if the successful. 2001 * BTM_NO_RESOURCES: no rsource to start the command. 2002 * BTM_ILLEGAL_VALUE: invalid callback function pointer. 2003 * BTM_CMD_STARTED : Command sent. Waiting for command 2004 * complete event. 2005 * 2006 * 2007 ******************************************************************************/ 2008 extern tBTM_STATUS BTM_ConfigScoPath(esco_data_path_t path, 2009 tBTM_SCO_DATA_CB* p_sco_data_cb, 2010 tBTM_SCO_PCM_PARAM* p_pcm_param, 2011 bool err_data_rpt); 2012 2013 /******************************************************************************* 2014 * 2015 * Function BTM_WriteScoData 2016 * 2017 * Description This function write SCO data to a specified instance. The 2018 * data to be written p_buf needs to carry an offset of 2019 * HCI_SCO_PREAMBLE_SIZE bytes, and the data length can not 2020 * exceed BTM_SCO_DATA_SIZE_MAX bytes, whose default value is 2021 * set to 60 and is configurable. Data longer than the maximum 2022 * bytes will be truncated. 2023 * 2024 * Returns BTM_SUCCESS: data write is successful 2025 * BTM_ILLEGAL_VALUE: SCO data contains illegal offset value. 2026 * BTM_SCO_BAD_LENGTH: SCO data length exceeds the max SCO 2027 * packet size. 2028 * BTM_NO_RESOURCES: no resources. 2029 * BTM_UNKNOWN_ADDR: unknown SCO connection handle, or SCO is 2030 * not routed via HCI. 2031 * 2032 * 2033 ******************************************************************************/ 2034 extern tBTM_STATUS BTM_WriteScoData(uint16_t sco_inx, BT_HDR* p_buf); 2035 2036 /******************************************************************************* 2037 * 2038 * Function BTM_SetARCMode 2039 * 2040 * Description Send Audio Routing Control command. 2041 * 2042 * Returns void 2043 * 2044 ******************************************************************************/ 2045 extern void BTM_SetARCMode(uint8_t iface, uint8_t arc_mode, 2046 tBTM_VSC_CMPL_CB* p_arc_cb); 2047 2048 /******************************************************************************* 2049 * 2050 * Function BTM_PCM2Setup_Write 2051 * 2052 * Description Send PCM2_Setup write command. 2053 * 2054 * Returns void 2055 * 2056 ******************************************************************************/ 2057 extern void BTM_PCM2Setup_Write(bool clk_master, tBTM_VSC_CMPL_CB* p_arc_cb); 2058 2059 /******************************************************************************* 2060 * 2061 * Function BTM_PM_ReadControllerState 2062 * 2063 * Description This function is called to obtain the controller state 2064 * 2065 * Returns Controller state (BTM_CONTRL_ACTIVE, BTM_CONTRL_SCAN, and 2066 * BTM_CONTRL_IDLE) 2067 * 2068 ******************************************************************************/ 2069 extern tBTM_CONTRL_STATE BTM_PM_ReadControllerState(void); 2070 2071 #endif /* BTM_API_H */ 2072