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_BLE_API_H 26 #define BTM_BLE_API_H 27 28 #include <base/callback_forward.h> 29 #include <hardware/bt_common_types.h> 30 #include <memory> 31 #include "bt_common.h" 32 #include "btm_api.h" 33 #include "btm_ble_api_types.h" 34 #include "osi/include/alarm.h" 35 36 /***************************************************************************** 37 * EXTERNAL FUNCTION DECLARATIONS 38 ****************************************************************************/ 39 /******************************************************************************* 40 * 41 * Function BTM_SecAddBleDevice 42 * 43 * Description Add/modify device. This function will be normally called 44 * during host startup to restore all required information 45 * for a LE device stored in the NVRAM. 46 * 47 * Parameters: bd_addr - BD address of the peer 48 * bd_name - Name of the peer device. NULL if unknown. 49 * dev_type - Remote device's device type. 50 * addr_type - LE device address type. 51 * 52 * Returns true if added OK, else false 53 * 54 ******************************************************************************/ 55 extern bool BTM_SecAddBleDevice(const RawAddress& bd_addr, BD_NAME bd_name, 56 tBT_DEVICE_TYPE dev_type, 57 tBLE_ADDR_TYPE addr_type); 58 59 /******************************************************************************* 60 * 61 * Function BTM_SecAddBleKey 62 * 63 * Description Add/modify LE device information. This function will be 64 * normally called during host startup to restore all required 65 * information stored in the NVRAM. 66 * 67 * Parameters: bd_addr - BD address of the peer 68 * p_le_key - LE key values. 69 * key_type - LE SMP key type. 70 * 71 * Returns true if added OK, else false 72 * 73 ******************************************************************************/ 74 extern bool BTM_SecAddBleKey(const RawAddress& bd_addr, 75 tBTM_LE_KEY_VALUE* p_le_key, 76 tBTM_LE_KEY_TYPE key_type); 77 78 /******************************************************************************* 79 * 80 * Function BTM_BleObtainVendorCapabilities 81 * 82 * Description This function is called to obatin vendor capabilties 83 * 84 * Parameters p_cmn_vsc_cb - Returns the vednor capabilities 85 * 86 * Returns void 87 * 88 ******************************************************************************/ 89 extern void BTM_BleObtainVendorCapabilities(tBTM_BLE_VSC_CB* p_cmn_vsc_cb); 90 91 /** 92 * This function is called to set scan parameters. |cb| is called with operation 93 * status 94 **/ 95 extern void BTM_BleSetScanParams(uint32_t scan_interval, uint32_t scan_window, 96 tBLE_SCAN_MODE scan_type, 97 base::Callback<void(uint8_t)> cb); 98 99 /******************************************************************************* 100 * 101 * Function BTM_BleGetVendorCapabilities 102 * 103 * Description This function reads local LE features 104 * 105 * Parameters p_cmn_vsc_cb : Locala LE capability structure 106 * 107 * Returns void 108 * 109 ******************************************************************************/ 110 extern void BTM_BleGetVendorCapabilities(tBTM_BLE_VSC_CB* p_cmn_vsc_cb); 111 /******************************************************************************* 112 * 113 * Function BTM_BleSetStorageConfig 114 * 115 * Description This function is called to setup storage configuration and 116 * setup callbacks. 117 * 118 * Parameters uint8_t batch_scan_full_max -Batch scan full maximum 119 uint8_t batch_scan_trunc_max - Batch scan truncated value 120 maximum 121 uint8_t batch_scan_notify_threshold - Threshold value 122 cb - Setup callback 123 tBTM_BLE_SCAN_THRESHOLD_CBACK *p_thres_cback -Threshold 124 callback 125 void *p_ref - Reference value 126 * 127 * 128 ******************************************************************************/ 129 extern void BTM_BleSetStorageConfig( 130 uint8_t batch_scan_full_max, uint8_t batch_scan_trunc_max, 131 uint8_t batch_scan_notify_threshold, 132 base::Callback<void(uint8_t /* status */)> cb, 133 tBTM_BLE_SCAN_THRESHOLD_CBACK* p_thres_cback, tBTM_BLE_REF_VALUE ref_value); 134 135 /* This function is called to enable batch scan */ 136 extern void BTM_BleEnableBatchScan( 137 tBTM_BLE_BATCH_SCAN_MODE scan_mode, uint32_t scan_interval, 138 uint32_t scan_window, tBTM_BLE_DISCARD_RULE discard_rule, 139 tBLE_ADDR_TYPE addr_type, base::Callback<void(uint8_t /* status */)> cb); 140 141 /* This function is called to disable batch scanning */ 142 extern void BTM_BleDisableBatchScan( 143 base::Callback<void(uint8_t /* status */)> cb); 144 145 /* This function is called to read batch scan reports */ 146 extern void BTM_BleReadScanReports(tBLE_SCAN_MODE scan_mode, 147 tBTM_BLE_SCAN_REP_CBACK cb); 148 149 /* This function is called to setup the callback for tracking */ 150 extern void BTM_BleTrackAdvertiser(tBTM_BLE_TRACK_ADV_CBACK* p_track_cback, 151 tBTM_BLE_REF_VALUE ref_value); 152 153 /******************************************************************************* 154 * 155 * Function BTM_BleWriteScanRsp 156 * 157 * Description This function is called to write LE scan response. 158 * 159 * Parameters: p_scan_rsp: scan response. 160 * 161 * Returns status 162 * 163 ******************************************************************************/ 164 extern void BTM_BleWriteScanRsp(uint8_t* data, uint8_t length, 165 tBTM_BLE_ADV_DATA_CMPL_CBACK* p_adv_data_cback); 166 167 /******************************************************************************* 168 * 169 * Function BTM_BleObserve 170 * 171 * Description This procedure keep the device listening for advertising 172 * events from a broadcast device. 173 * 174 * Parameters start: start or stop observe. 175 * 176 * Returns void 177 * 178 ******************************************************************************/ 179 extern tBTM_STATUS BTM_BleObserve(bool start, uint8_t duration, 180 tBTM_INQ_RESULTS_CB* p_results_cb, 181 tBTM_CMPL_CB* p_cmpl_cb); 182 183 /** Returns local device encryption root (ER) */ 184 const Octet16& BTM_GetDeviceEncRoot(); 185 186 /** Returns local device identity root (IR) */ 187 extern const Octet16& BTM_GetDeviceIDRoot(); 188 189 /** Return local device DHK. */ 190 extern const Octet16& BTM_GetDeviceDHK(); 191 192 /******************************************************************************* 193 * 194 * Function BTM_SecurityGrant 195 * 196 * Description This function is called to grant security process. 197 * 198 * Parameters bd_addr - peer device bd address. 199 * res - result of the operation BTM_SUCCESS if success. 200 * Otherwise, BTM_REPEATED_ATTEMPTS is too many 201 * attempts. 202 * 203 * Returns None 204 * 205 ******************************************************************************/ 206 extern void BTM_SecurityGrant(const RawAddress& bd_addr, uint8_t res); 207 208 /******************************************************************************* 209 * 210 * Function BTM_BlePasskeyReply 211 * 212 * Description This function is called after Security Manager submitted 213 * passkey request to the application. 214 * 215 * Parameters: bd_addr - Address of the device for which passkey was 216 * requested 217 * res - result of the operation SMP_SUCCESS if success 218 * passkey - numeric value in the range of 219 * BTM_MIN_PASSKEY_VAL(0) - 220 * BTM_MAX_PASSKEY_VAL(999999(0xF423F)). 221 * 222 ******************************************************************************/ 223 extern void BTM_BlePasskeyReply(const RawAddress& bd_addr, uint8_t res, 224 uint32_t passkey); 225 226 /******************************************************************************* 227 * 228 * Function BTM_BleConfirmReply 229 * 230 * Description This function is called after Security Manager submitted 231 * numeric comparison request to the application. 232 * 233 * Parameters: bd_addr - Address of the device with which numeric 234 * comparison was requested 235 * res - comparison result BTM_SUCCESS if success 236 * 237 ******************************************************************************/ 238 extern void BTM_BleConfirmReply(const RawAddress& bd_addr, uint8_t res); 239 240 /******************************************************************************* 241 * 242 * Function BTM_LeOobDataReply 243 * 244 * Description This function is called to provide the OOB data for 245 * SMP in response to BTM_LE_OOB_REQ_EVT 246 * 247 * Parameters: bd_addr - Address of the peer device 248 * res - result of the operation SMP_SUCCESS if success 249 * p_data - simple pairing Randomizer C. 250 * 251 ******************************************************************************/ 252 extern void BTM_BleOobDataReply(const RawAddress& bd_addr, uint8_t res, 253 uint8_t len, uint8_t* p_data); 254 255 /******************************************************************************* 256 * 257 * Function BTM_BleSecureConnectionOobDataReply 258 * 259 * Description This function is called to provide the OOB data for 260 * SMP in response to BTM_LE_OOB_REQ_EVT when secure connection 261 * data is available 262 * 263 * Parameters: bd_addr - Address of the peer device 264 * p_c - pointer to Confirmation 265 * p_r - pointer to Randomizer. 266 * 267 ******************************************************************************/ 268 extern void BTM_BleSecureConnectionOobDataReply(const RawAddress& bd_addr, 269 uint8_t* p_c, uint8_t* p_r); 270 271 /******************************************************************************* 272 * 273 * Function BTM_BleDataSignature 274 * 275 * Description This function is called to sign the data using AES128 CMAC 276 * algorith. 277 * 278 * Parameter bd_addr: target device the data to be signed for. 279 * p_text: singing data 280 * len: length of the signing data 281 * signature: output parameter where data signature is going to 282 * be stored. 283 * 284 * Returns true if signing sucessul, otherwise false. 285 * 286 ******************************************************************************/ 287 extern bool BTM_BleDataSignature(const RawAddress& bd_addr, uint8_t* p_text, 288 uint16_t len, BLE_SIGNATURE signature); 289 290 /******************************************************************************* 291 * 292 * Function BTM_BleVerifySignature 293 * 294 * Description This function is called to verify the data signature 295 * 296 * Parameter bd_addr: target device the data to be signed for. 297 * p_orig: original data before signature. 298 * len: length of the signing data 299 * counter: counter used when doing data signing 300 * p_comp: signature to be compared against. 301 302 * Returns true if signature verified correctly; otherwise false. 303 * 304 ******************************************************************************/ 305 extern bool BTM_BleVerifySignature(const RawAddress& bd_addr, uint8_t* p_orig, 306 uint16_t len, uint32_t counter, 307 uint8_t* p_comp); 308 309 /******************************************************************************* 310 * 311 * Function BTM_ReadConnectionAddr 312 * 313 * Description Read the local device random address. 314 * 315 * Returns void 316 * 317 ******************************************************************************/ 318 extern void BTM_ReadConnectionAddr(const RawAddress& remote_bda, 319 RawAddress& local_conn_addr, 320 tBLE_ADDR_TYPE* p_addr_type); 321 322 /******************************************************************************* 323 * 324 * Function BTM_IsBleConnection 325 * 326 * Description This function is called to check if the connection handle 327 * for an LE link 328 * 329 * Returns true if connection is LE link, otherwise false. 330 * 331 ******************************************************************************/ 332 extern bool BTM_IsBleConnection(uint16_t conn_handle); 333 334 /******************************************************************************* 335 * 336 * Function BTM_ReadRemoteConnectionAddr 337 * 338 * Description Read the remote device address currently used. 339 * 340 * Returns void 341 * 342 ******************************************************************************/ 343 extern bool BTM_ReadRemoteConnectionAddr(const RawAddress& pseudo_addr, 344 RawAddress& conn_addr, 345 tBLE_ADDR_TYPE* p_addr_type); 346 347 /******************************************************************************* 348 * 349 * Function BTM_BleLoadLocalKeys 350 * 351 * Description Local local identity key, encryption root or sign counter. 352 * 353 * Parameters: key_type: type of key, can be BTM_BLE_KEY_TYPE_ID, 354 * BTM_BLE_KEY_TYPE_ER 355 * or BTM_BLE_KEY_TYPE_COUNTER. 356 * p_key: pointer to the key. 357 * 358 * Returns non2. 359 * 360 ******************************************************************************/ 361 extern void BTM_BleLoadLocalKeys(uint8_t key_type, tBTM_BLE_LOCAL_KEYS* p_key); 362 363 #include "stack/btm/btm_ble_bgconn.h" 364 365 /******************************************************** 366 * 367 * Function BTM_BleSetPrefConnParams 368 * 369 * Description Set a peripheral's preferred connection parameters. When 370 * any of the value does not want to be updated while others 371 * do, use BTM_BLE_CONN_PARAM_UNDEF for the ones want to 372 * leave untouched. 373 * 374 * Parameters: bd_addr - BD address of the peripheral 375 * min_conn_int - minimum preferred connection interval 376 * max_conn_int - maximum preferred connection interval 377 * slave_latency - preferred slave latency 378 * supervision_tout - preferred supervision timeout 379 * 380 * Returns void 381 * 382 ******************************************************************************/ 383 extern void BTM_BleSetPrefConnParams(const RawAddress& bd_addr, 384 uint16_t min_conn_int, 385 uint16_t max_conn_int, 386 uint16_t slave_latency, 387 uint16_t supervision_tout); 388 389 /****************************************************************************** 390 * 391 * Function BTM_BleSetConnScanParams 392 * 393 * Description Set scan parameters used in BLE connection request 394 * 395 * Parameters: scan_interval - scan interval 396 * scan_window - scan window 397 * 398 * Returns void 399 * 400 ******************************************************************************/ 401 extern void BTM_BleSetConnScanParams(uint32_t scan_interval, 402 uint32_t scan_window); 403 404 /****************************************************************************** 405 * 406 * Function BTM_BleReadControllerFeatures 407 * 408 * Description Reads BLE specific controller features 409 * 410 * Parameters: tBTM_BLE_CTRL_FEATURES_CBACK : Callback to notify when 411 * features are read 412 * 413 * Returns void 414 * 415 ******************************************************************************/ 416 extern void BTM_BleReadControllerFeatures( 417 tBTM_BLE_CTRL_FEATURES_CBACK* p_vsc_cback); 418 419 /******************************************************************************* 420 * 421 * Function BTM__BLEReadDiscoverability 422 * 423 * Description This function is called to read the current LE 424 * discoverability mode of the device. 425 * 426 * Returns BTM_BLE_NON_DISCOVERABLE ,BTM_BLE_LIMITED_DISCOVERABLE or 427 * BTM_BLE_GENRAL_DISCOVERABLE 428 * 429 ******************************************************************************/ 430 uint16_t BTM_BleReadDiscoverability(); 431 432 /******************************************************************************* 433 * 434 * Function BTM__BLEReadConnectability 435 * 436 * Description This function is called to read the current LE 437 * connectibility mode of the device. 438 * 439 * Returns BTM_BLE_NON_CONNECTABLE or BTM_BLE_CONNECTABLE 440 * 441 ******************************************************************************/ 442 extern uint16_t BTM_BleReadConnectability(); 443 444 /******************************************************************************* 445 * 446 * Function BTM_ReadDevInfo 447 * 448 * Description This function is called to read the device/address type 449 * of BD address. 450 * 451 * Parameter remote_bda: remote device address 452 * p_dev_type: output parameter to read the device type. 453 * p_addr_type: output parameter to read the address type. 454 * 455 ******************************************************************************/ 456 extern void BTM_ReadDevInfo(const RawAddress& remote_bda, 457 tBT_DEVICE_TYPE* p_dev_type, 458 tBLE_ADDR_TYPE* p_addr_type); 459 460 /******************************************************************************* 461 * 462 * Function BTM_ReadConnectedTransportAddress 463 * 464 * Description This function is called to read the paired device/address 465 * type of other device paired corresponding to the BD_address 466 * 467 * Parameter remote_bda: remote device address, carry out the transport 468 * address 469 * transport: active transport 470 * 471 * Return true if an active link is identified; false otherwise 472 * 473 ******************************************************************************/ 474 extern bool BTM_ReadConnectedTransportAddress(RawAddress* remote_bda, 475 tBT_TRANSPORT transport); 476 477 /******************************************************************************* 478 * 479 * Function BTM_BleConfigPrivacy 480 * 481 * Description This function is called to enable or disable the privacy in 482 * the local device. 483 * 484 * Parameters enable: true to enable it; false to disable it. 485 * 486 * Returns bool privacy mode set success; otherwise failed. 487 * 488 ******************************************************************************/ 489 extern bool BTM_BleConfigPrivacy(bool enable); 490 491 /******************************************************************************* 492 * 493 * Function BTM_BleLocalPrivacyEnabled 494 * 495 * Description Checks if local device supports private address 496 * 497 * Returns Return true if local privacy is enabled else false 498 * 499 ******************************************************************************/ 500 extern bool BTM_BleLocalPrivacyEnabled(void); 501 502 /******************************************************************************* 503 * 504 * Function BTM_BleEnableMixedPrivacyMode 505 * 506 * Description This function is called to enabled Mixed mode if privacy 1.2 507 * is applicable in controller. 508 * 509 * Parameters mixed_on: mixed mode to be used or not. 510 * 511 * Returns void 512 * 513 ******************************************************************************/ 514 extern void BTM_BleEnableMixedPrivacyMode(bool mixed_on); 515 516 /******************************************************************************* 517 * 518 * Function BTM_BleMaxMultiAdvInstanceCount 519 * 520 * Description Returns the maximum number of multi adv instances supported 521 * by the controller. 522 * 523 * Returns Max multi adv instance count 524 * 525 ******************************************************************************/ 526 extern uint8_t BTM_BleMaxMultiAdvInstanceCount(); 527 528 /******************************************************************************* 529 * 530 * Function BTM_BleSetConnectableMode 531 * 532 * Description This function is called to set BLE connectable mode for a 533 * peripheral device. 534 * 535 * Parameters connectable_mode: directed connectable mode, or 536 * non-directed. It can be 537 * BTM_BLE_CONNECT_EVT, 538 * BTM_BLE_CONNECT_DIR_EVT or 539 * BTM_BLE_CONNECT_LO_DUTY_DIR_EVT 540 * 541 * Returns BTM_ILLEGAL_VALUE if controller does not support BLE. 542 * BTM_SUCCESS is status set successfully; otherwise failure. 543 * 544 ******************************************************************************/ 545 extern tBTM_STATUS BTM_BleSetConnectableMode( 546 tBTM_BLE_CONN_MODE connectable_mode); 547 548 /******************************************************************************* 549 * 550 * Function BTM_BleTurnOnPrivacyOnRemote 551 * 552 * Description This function is called to enable or disable the privacy on 553 * the remote device. 554 * 555 * Parameters bd_addr: remote device address. 556 * privacy_on: true to enable it; false to disable it. 557 * 558 * Returns void 559 * 560 ******************************************************************************/ 561 extern void BTM_BleTurnOnPrivacyOnRemote(const RawAddress& bd_addr, 562 bool privacy_on); 563 564 /******************************************************************************* 565 * 566 * Function BTM_BleUpdateAdvFilterPolicy 567 * 568 * Description This function update the filter policy of advertiser. 569 * 570 * Parameter adv_policy: advertising filter policy 571 * 572 * Return void 573 ******************************************************************************/ 574 extern void BTM_BleUpdateAdvFilterPolicy(tBTM_BLE_AFP adv_policy); 575 576 /******************************************************************************* 577 * 578 * Function BTM_BleReceiverTest 579 * 580 * Description This function is called to start the LE Receiver test 581 * 582 * Parameter rx_freq - Frequency Range 583 * p_cmd_cmpl_cback - Command Complete callback 584 * 585 ******************************************************************************/ 586 void BTM_BleReceiverTest(uint8_t rx_freq, tBTM_CMPL_CB* p_cmd_cmpl_cback); 587 588 /******************************************************************************* 589 * 590 * Function BTM_BleTransmitterTest 591 * 592 * Description This function is called to start the LE Transmitter test 593 * 594 * Parameter tx_freq - Frequency Range 595 * test_data_len - Length in bytes of payload data in each 596 * packet 597 * packet_payload - Pattern to use in the payload 598 * p_cmd_cmpl_cback - Command Complete callback 599 * 600 ******************************************************************************/ 601 void BTM_BleTransmitterTest(uint8_t tx_freq, uint8_t test_data_len, 602 uint8_t packet_payload, 603 tBTM_CMPL_CB* p_cmd_cmpl_cback); 604 605 /******************************************************************************* 606 * 607 * Function BTM_BleTestEnd 608 * 609 * Description This function is called to stop the in-progress TX or RX test 610 * 611 * Parameter p_cmd_cmpl_cback - Command complete callback 612 * 613 ******************************************************************************/ 614 void BTM_BleTestEnd(tBTM_CMPL_CB* p_cmd_cmpl_cback); 615 616 /******************************************************************************* 617 * 618 * Function BTM_UseLeLink 619 * 620 * Description Select the underlying physical link to use. 621 * 622 * Returns true to use LE, false use BR/EDR. 623 * 624 ******************************************************************************/ 625 extern bool BTM_UseLeLink(const RawAddress& bd_addr); 626 627 /******************************************************************************* 628 * 629 * Function BTM_BleStackEnable 630 * 631 * Description Enable/Disable BLE functionality on stack regardless of 632 * controller capability. 633 * 634 * Parameters: enable: true to enable, false to disable. 635 * 636 * Returns true if added OK, else false 637 * 638 ******************************************************************************/ 639 extern tBTM_STATUS BTM_BleStackEnable(bool enable); 640 641 /******************************************************************************* 642 * 643 * Function BTM_GetLeSecurityState 644 * 645 * Description This function is called to get security mode 1 flags and 646 * encryption key size for LE peer. 647 * 648 * Returns bool true if LE device is found, false otherwise. 649 * 650 ******************************************************************************/ 651 extern bool BTM_GetLeSecurityState(const RawAddress& bd_addr, 652 uint8_t* p_le_dev_sec_flags, 653 uint8_t* p_le_key_size); 654 655 /******************************************************************************* 656 * 657 * Function BTM_BleSecurityProcedureIsRunning 658 * 659 * Description This function indicates if LE security procedure is 660 * currently running with the peer. 661 * 662 * Returns bool true if security procedure is running, false otherwise. 663 * 664 ******************************************************************************/ 665 extern bool BTM_BleSecurityProcedureIsRunning(const RawAddress& bd_addr); 666 667 /******************************************************************************* 668 * 669 * Function BTM_BleGetSupportedKeySize 670 * 671 * Description This function gets the maximum encryption key size in bytes 672 * the local device can suport. 673 * record. 674 * 675 * Returns the key size or 0 if the size can't be retrieved. 676 * 677 ******************************************************************************/ 678 extern uint8_t BTM_BleGetSupportedKeySize(const RawAddress& bd_addr); 679 680 /******************************************************************************* 681 * 682 * Function BTM_BleAdvFilterParamSetup 683 * 684 * Description This function is called to setup the adv data payload filter 685 * condition. 686 * 687 ******************************************************************************/ 688 extern void BTM_BleAdvFilterParamSetup( 689 int action, tBTM_BLE_PF_FILT_INDEX filt_index, 690 std::unique_ptr<btgatt_filt_param_setup_t> p_filt_params, 691 tBTM_BLE_PF_PARAM_CB cb); 692 693 /** 694 * This functions are called to configure the adv data payload filter condition 695 */ 696 extern void BTM_LE_PF_set(tBTM_BLE_PF_FILT_INDEX filt_index, 697 std::vector<ApcfCommand> commands, 698 tBTM_BLE_PF_CFG_CBACK cb); 699 extern void BTM_LE_PF_clear(tBTM_BLE_PF_FILT_INDEX filt_index, 700 tBTM_BLE_PF_CFG_CBACK cb); 701 702 /******************************************************************************* 703 * 704 * Function BTM_BleEnableDisableFilterFeature 705 * 706 * Description Enable or disable the APCF feature 707 * 708 * Parameters enable - true - enables APCF, false - disables APCF 709 * 710 ******************************************************************************/ 711 extern void BTM_BleEnableDisableFilterFeature( 712 uint8_t enable, tBTM_BLE_PF_STATUS_CBACK p_stat_cback); 713 714 /******************************************************************************* 715 * 716 * Function BTM_BleGetEnergyInfo 717 * 718 * Description This function obtains the energy info 719 * 720 * Parameters p_ener_cback - Callback pointer 721 * 722 * Returns status 723 * 724 ******************************************************************************/ 725 extern tBTM_STATUS BTM_BleGetEnergyInfo( 726 tBTM_BLE_ENERGY_INFO_CBACK* p_ener_cback); 727 728 /******************************************************************************* 729 * 730 * Function BTM_SetBleDataLength 731 * 732 * Description Set the maximum BLE transmission packet size 733 * 734 * Returns BTM_SUCCESS if success; otherwise failed. 735 * 736 ******************************************************************************/ 737 extern tBTM_STATUS BTM_SetBleDataLength(const RawAddress& bd_addr, 738 uint16_t tx_pdu_length); 739 740 /******************************************************************************* 741 * 742 * Function BTM_BleReadPhy 743 * 744 * Description To read the current PHYs for specified LE connection 745 * 746 * 747 * Returns BTM_SUCCESS if success; otherwise failed. 748 * 749 ******************************************************************************/ 750 extern void BTM_BleReadPhy( 751 const RawAddress& bd_addr, 752 base::Callback<void(uint8_t tx_phy, uint8_t rx_phy, uint8_t status)> cb); 753 754 /******************************************************************************* 755 * 756 * Function BTM_BleSetDefaultPhy 757 * 758 * Description To set preferred PHY for ensuing LE connections 759 * 760 * 761 * Returns BTM_SUCCESS if success; otherwise failed. 762 * 763 ******************************************************************************/ 764 extern tBTM_STATUS BTM_BleSetDefaultPhy(uint8_t all_phys, uint8_t tx_phys, 765 uint8_t rx_phys); 766 767 /******************************************************************************* 768 * 769 * Function BTM_BleSetPhy 770 * 771 * Description To set PHY preferences for specified LE connection 772 * 773 * 774 * Returns BTM_SUCCESS if success; otherwise failed. 775 * 776 ******************************************************************************/ 777 extern void BTM_BleSetPhy(const RawAddress& bd_addr, uint8_t tx_phys, 778 uint8_t rx_phys, uint16_t phy_options); 779 780 extern void btm_ble_multi_adv_cleanup(void); 781 782 #endif 783