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