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