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