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_BLE_API_H 26 #define BTM_BLE_API_H 27 28 #include "btm_api.h" 29 30 #define CHNL_MAP_LEN 5 31 typedef UINT8 tBTM_BLE_CHNL_MAP[CHNL_MAP_LEN]; 32 33 #define BTM_BLE_SCAN_MODE_PASS 0 34 #define BTM_BLE_SCAN_MODE_ACTI 1 35 #define BTM_BLE_SCAN_MODE_NONE 0xff 36 typedef UINT8 tBTM_BLE_SCAN_MODE; 37 38 /* advertising channel map */ 39 #define BTM_BLE_ADV_CHNL_37 (0x01 << 0) 40 #define BTM_BLE_ADV_CHNL_38 (0x01 << 1) 41 #define BTM_BLE_ADV_CHNL_39 (0x01 << 2) 42 typedef UINT8 tBTM_BLE_ADV_CHNL_MAP; 43 44 /*d efault advertising channel map */ 45 #ifndef BTM_BLE_DEFAULT_ADV_CHNL_MAP 46 #define BTM_BLE_DEFAULT_ADV_CHNL_MAP (BTM_BLE_ADV_CHNL_37| BTM_BLE_ADV_CHNL_38| BTM_BLE_ADV_CHNL_39) 47 #endif 48 49 /* advertising filter policy */ 50 #define AP_SCAN_CONN_ALL 0x00 /* default */ 51 #define AP_SCAN_WL_CONN_ALL 0x01 52 #define AP_SCAN_ALL_CONN_WL 0x02 53 #define AP_SCAN_CONN_WL 0x03 54 #define AP_SCAN_CONN_POLICY_MAX 0x04 55 typedef UINT8 tBTM_BLE_AFP; 56 57 /* default advertising filter policy */ 58 #ifndef BTM_BLE_DEFAULT_AFP 59 #define BTM_BLE_DEFAULT_AFP AP_SCAN_CONN_ALL 60 #endif 61 62 /* scanning filter policy */ 63 #define SP_ADV_ALL 0x00 /* accept adv pakt from all, directed adv pkt not directed to me is ignored */ 64 #define SP_ADV_WL 0x01 /* accept adv pakt from device in white list, directed adv pkt not directed to me is ignored */ 65 typedef UINT8 tBTM_BLE_SFP; 66 67 #ifndef BTM_BLE_DEFAULT_SFP 68 #define BTM_BLE_DEFAULT_SFP SP_ADV_ALL 69 #endif 70 71 /* adv parameter boundary values */ 72 #define BTM_BLE_ADV_INT_MIN 0x0020 73 #define BTM_BLE_ADV_INT_MAX 0x4000 74 75 /* connection parameter boundary value */ 76 #define BTM_BLE_SCAN_INT_MIN 0x0004 77 #define BTM_BLE_SCAN_INT_MAX 0x4000 78 #define BTM_BLE_SCAN_WIN_MIN 0x0004 79 #define BTM_BLE_SCAN_WIN_MAX 0x4000 80 #define BTM_BLE_CONN_INT_MIN 0x0006 81 #define BTM_BLE_CONN_INT_MAX 0x0C80 82 #define BTM_BLE_CONN_LATENCY_MAX 500 83 #define BTM_BLE_CONN_SUP_TOUT_MIN 0x000A 84 #define BTM_BLE_CONN_SUP_TOUT_MAX 0x0C80 85 #define BTM_BLE_CONN_PARAM_UNDEF 0xffff /* use this value when a specific value not to be overwritten */ 86 87 /* default connection parameters if not configured, use GAP recommend value for auto/selective connection */ 88 /* default scan interval */ 89 #ifndef BTM_BLE_CONN_EST_SCAN_INT 90 #define BTM_BLE_CONN_EST_SCAN_INT 96 /* 312.5 ms = 500 *0.625 */ 91 #endif 92 /* default scan window for background connection, applicable for auto connection or selective conenction */ 93 #ifndef BTM_BLE_CONN_EST_SCAN_WIND 94 #define BTM_BLE_CONN_EST_SCAN_WIND 48 /* 187.5 ms = 400 *0.625 */ 95 #endif 96 97 /* default scan paramter used in reduced power cycle */ 98 #ifndef BTM_BLE_CONN_EST_SCAN_INT_LO 99 #define BTM_BLE_CONN_EST_SCAN_INT_LO 2048 /* 1.28 s = 500 *0.625 */ 100 #endif 101 #ifndef BTM_BLE_CONN_EST_SCAN_WIND_LO 102 #define BTM_BLE_CONN_EST_SCAN_WIND_LO 18 /* 11.25 ms = 400 *0.625 */ 103 #endif 104 105 /* default connection interval min */ 106 #ifndef BTM_BLE_CONN_INT_MIN_DEF 107 #define BTM_BLE_CONN_INT_MIN_DEF 40 /* 50ms = 400 * 1.25 */ 108 #endif 109 /* default connectino interval max */ 110 #ifndef BTM_BLE_CONN_INT_MAX_DEF 111 #define BTM_BLE_CONN_INT_MAX_DEF 56 /* 70ms = 56 * 1.25 */ 112 #endif 113 /* default slave latency */ 114 #ifndef BTM_BLE_CONN_SLAVE_LATENCY_DEF 115 #define BTM_BLE_CONN_SLAVE_LATENCY_DEF 0 /* 0 */ 116 #endif 117 /* default supervision timeout */ 118 #ifndef BTM_BLE_CONN_TIMEOUT_DEF 119 #define BTM_BLE_CONN_TIMEOUT_DEF 2000 120 #endif 121 122 #define BTM_CMAC_TLEN_SIZE 8 /* 64 bits */ 123 #define BTM_BLE_AUTH_SIGN_LEN 12 /* BLE data signature length 8 Bytes + 4 bytes counter*/ 124 typedef UINT8 BLE_SIGNATURE[BTM_BLE_AUTH_SIGN_LEN]; /* Device address */ 125 126 /* Structure returned with Rand/Encrypt complete callback */ 127 typedef struct 128 { 129 UINT8 status; 130 UINT8 param_len; 131 UINT16 opcode; 132 UINT8 param_buf[BT_OCTET16_LEN]; 133 } tBTM_RAND_ENC; 134 135 /* General callback function for notifying an application that a synchronous 136 ** BTM function is complete. The pointer contains the address of any returned data. 137 */ 138 typedef void (tBTM_RAND_ENC_CB) (tBTM_RAND_ENC *p1); 139 140 #define BTM_BLE_FILTER_TARGET_SCANNER 0x01 141 #define BTM_BLE_FILTER_TARGET_ADVR 0x00 142 143 #define BTM_BLE_POLICY_BLACK_ALL 0x00 /* relevant to both */ 144 #define BTM_BLE_POLICY_ALLOW_SCAN 0x01 /* relevant to advertiser */ 145 #define BTM_BLE_POLICY_ALLOW_CONN 0x02 /* relevant to advertiser */ 146 #define BTM_BLE_POLICY_WHITE_ALL 0x03 /* relevant to both */ 147 148 typedef struct 149 { 150 UINT8 adv_int_min; 151 UINT8 adv_int_max; 152 tBTM_BLE_CHNL_MAP chnl_map; 153 154 }tBTM_BLE_ADV_PARAMS; 155 156 /* ADV data flag bit definition used for BTM_BLE_AD_TYPE_FLAG */ 157 #define BTM_BLE_LIMIT_DISC_FLAG (0x01 << 0) 158 #define BTM_BLE_GEN_DISC_FLAG (0x01 << 1) 159 #define BTM_BLE_BREDR_NOT_SPT (0x01 << 2) 160 #define BTM_BLE_NON_LIMIT_DISC_FLAG (0x00 ) /* lowest bit unset */ 161 #define BTM_BLE_ADV_FLAG_MASK (BTM_BLE_LIMIT_DISC_FLAG | BTM_BLE_BREDR_NOT_SPT | BTM_BLE_GEN_DISC_FLAG) 162 #define BTM_BLE_LIMIT_DISC_MASK (BTM_BLE_LIMIT_DISC_FLAG ) 163 164 #define BTM_BLE_AD_BIT_DEV_NAME (0x0001 << 0) 165 #define BTM_BLE_AD_BIT_FLAGS (0x0001 << 1) 166 #define BTM_BLE_AD_BIT_MANU (0x0001 << 2) 167 #define BTM_BLE_AD_BIT_TX_PWR (0x0001 << 3) 168 #define BTM_BLE_AD_BIT_ATTR (0x0001 << 4) 169 #define BTM_BLE_AD_BIT_INT_RANGE (0x0001 << 5) 170 #define BTM_BLE_AD_BIT_SERVICE (0x0001 << 6) 171 #define BTM_BLE_AD_BIT_SERVICE_SOL (0x0001 << 7) 172 #define BTM_BLE_AD_BIT_SERVICE_DATA (0x0001 << 8) 173 #define BTM_BLE_AD_BIT_SIGN_DATA (0x0001 << 9) 174 #define BTM_BLE_AD_BIT_PROPRIETARY (0x0001 << 15) 175 176 typedef UINT16 tBTM_BLE_AD_MASK; 177 178 #define BTM_BLE_AD_TYPE_FLAG 0x01 179 #define BTM_BLE_AD_TYPE_SRV_PART 0x02 180 #define BTM_BLE_AD_TYPE_SRV_CMPL 0x03 181 #define BTM_BLE_AD_TYPE_NAME_SHORT 0x08 182 #define BTM_BLE_AD_TYPE_NAME_CMPL 0x09 183 #define BTM_BLE_AD_TYPE_TX_PWR 0x0A 184 #define BTM_BLE_AD_TYPE_DEV_CLASS 0x0D 185 #define BTM_BLE_AD_TYPE_ATTR 0x10 186 #define BTM_BLE_AD_TYPE_MANU 0xff 187 #define BTM_BLE_AD_TYPE_INT_RANGE 0x12 188 #define BTM_BLE_AD_TYPE_SOL_SRV_UUID 0x14 189 typedef UINT8 tBTM_BLE_AD_TYPE; 190 191 /* slave preferred connection interval range */ 192 typedef struct 193 { 194 UINT16 low; 195 UINT16 hi; 196 197 }tBTM_BLE_INT_RANGE; 198 199 /* Service tag supported in the device */ 200 typedef struct 201 { 202 UINT8 num_service; 203 BOOLEAN list_cmpl; 204 UINT16 *p_uuid; 205 }tBTM_BLE_SERVICE; 206 207 /* attribute data */ 208 typedef struct 209 { 210 UINT16 uuid; 211 UINT16 data_len; 212 UINT8 *p_data; 213 }tBTM_BLE_ATTR; 214 215 #ifndef BTM_BLE_NUM_AD_ATTR_MAX 216 #define BTM_BLE_NUM_AD_ATTR_MAX 10 217 #endif 218 /* attribute list contained in adv data */ 219 typedef struct 220 { 221 UINT8 num_attr; 222 tBTM_BLE_ATTR attr_list[BTM_BLE_NUM_AD_ATTR_MAX]; 223 }tBTM_BLE_ATTR_DATA; 224 225 typedef struct 226 { 227 UINT8 len; 228 UINT8 *p_val; 229 }tBTM_BLE_MANU; 230 231 typedef struct 232 { 233 UINT8 adv_type; 234 UINT8 len; 235 UINT8 *p_val; /* number of len byte */ 236 }tBTM_BLE_PROP_ELEM; 237 238 typedef struct 239 { 240 UINT8 num_elem; 241 tBTM_BLE_PROP_ELEM *p_elem; 242 }tBTM_BLE_PROPRIETARY; 243 244 typedef struct 245 { 246 tBTM_BLE_MANU manu; /* manufactuer data */ 247 tBTM_BLE_INT_RANGE int_range; /* slave prefered conn interval range */ 248 tBTM_BLE_SERVICE services; /* services */ 249 tBTM_BLE_ATTR_DATA attr; /* attribute data */ 250 UINT8 flag; 251 tBTM_BLE_PROPRIETARY *p_proprietary; 252 }tBTM_BLE_ADV_DATA; 253 254 /* These are the fields returned in each device adv packet. It 255 ** is returned in the results callback if registered. 256 */ 257 typedef struct 258 { 259 UINT8 conn_mode; 260 tBTM_BLE_AD_MASK ad_mask; /* mask of the valid adv data field */ 261 UINT8 flag; 262 UINT8 tx_power_level; 263 UINT8 remote_name_len; 264 UINT8 *p_remote_name; 265 tBTM_BLE_ATTR_DATA attr_data; 266 tBTM_BLE_SERVICE service; 267 } tBTM_BLE_INQ_DATA; 268 269 enum 270 { 271 BTM_BLE_CONN_NONE, 272 BTM_BLE_CONN_AUTO, 273 BTM_BLE_CONN_SELECTIVE 274 }; 275 typedef UINT8 tBTM_BLE_CONN_TYPE; 276 277 typedef BOOLEAN (tBTM_BLE_SEL_CBACK)(BD_ADDR random_bda, UINT8 *p_remote_name); 278 279 /* callback function for SMP signing algorithm, signed data in little endian order with tlen bits long */ 280 typedef void (tBTM_BLE_SIGN_CBACK)(void *p_ref_data, UINT8 *p_signing_data); 281 typedef void (tBTM_BLE_VERIFY_CBACK)(void *p_ref_data, BOOLEAN match); 282 /* random address set complete callback */ 283 typedef void (tBTM_BLE_RANDOM_SET_CBACK) (BD_ADDR random_bda); 284 285 typedef void (tBTM_BLE_SCAN_REQ_CBACK)(BD_ADDR remote_bda, tBLE_ADDR_TYPE addr_type, UINT8 adv_evt); 286 /***************************************************************************** 287 ** EXTERNAL FUNCTION DECLARATIONS 288 *****************************************************************************/ 289 #ifdef __cplusplus 290 extern "C" { 291 #endif 292 /******************************************************************************* 293 ** 294 ** Function BTM_SecAddBleDevice 295 ** 296 ** Description Add/modify device. This function will be normally called 297 ** during host startup to restore all required information 298 ** for a LE device stored in the NVRAM. 299 ** 300 ** Parameters: bd_addr - BD address of the peer 301 ** bd_name - Name of the peer device. NULL if unknown. 302 ** dev_type - Remote device's device type. 303 ** addr_type - LE device address type. 304 ** 305 ** Returns TRUE if added OK, else FALSE 306 ** 307 *******************************************************************************/ 308 BTM_API extern BOOLEAN BTM_SecAddBleDevice (BD_ADDR bd_addr, BD_NAME bd_name, 309 tBT_DEVICE_TYPE dev_type, tBLE_ADDR_TYPE addr_type); 310 311 /******************************************************************************* 312 ** 313 ** Function BTM_SecAddBleKey 314 ** 315 ** Description Add/modify LE device information. This function will be 316 ** normally called during host startup to restore all required 317 ** information stored in the NVRAM. 318 ** 319 ** Parameters: bd_addr - BD address of the peer 320 ** p_le_key - LE key values. 321 ** key_type - LE SMP key type. 322 * 323 ** Returns TRUE if added OK, else FALSE 324 ** 325 *******************************************************************************/ 326 BTM_API extern BOOLEAN BTM_SecAddBleKey (BD_ADDR bd_addr, tBTM_LE_KEY_VALUE *p_le_key, 327 tBTM_LE_KEY_TYPE key_type); 328 329 /******************************************************************************* 330 ** 331 ** Function BTM_BleSetAdvParams 332 ** 333 ** Description This function is called to set advertising parameters. 334 ** 335 ** Parameters: None. 336 ** 337 ** Returns void 338 ** 339 *******************************************************************************/ 340 BTM_API extern tBTM_STATUS BTM_BleSetAdvParams(UINT16 adv_int_min, UINT16 adv_int_max, 341 tBLE_BD_ADDR *p_dir_bda, tBTM_BLE_ADV_CHNL_MAP chnl_map); 342 343 /******************************************************************************* 344 ** 345 ** Function BTM_BleWriteAdvData 346 ** 347 ** Description This function is called to write advertising data. 348 ** 349 ** Parameters: None. 350 ** 351 ** Returns void 352 ** 353 *******************************************************************************/ 354 BTM_API extern tBTM_STATUS BTM_BleWriteAdvData(tBTM_BLE_AD_MASK data_mask, 355 tBTM_BLE_ADV_DATA *p_data); 356 357 /******************************************************************************* 358 ** 359 ** Function BTM_BleSetAdvParams 360 ** 361 ** Description This function is called to set advertising parameters. 362 ** 363 ** Parameters adv_int_min: minimum advertising interval 364 ** adv_int_max: maximum advertising interval 365 ** p_dir_bda: connectable direct initiator's LE device address 366 ** chnl_map: advertising channel map. 367 ** 368 ** Returns void 369 ** 370 *******************************************************************************/ 371 BTM_API extern void BTM_BleReadAdvParams (UINT16 *adv_int_min, UINT16 *adv_int_max, 372 tBLE_BD_ADDR *p_dir_bda, tBTM_BLE_ADV_CHNL_MAP *p_chnl_map); 373 374 375 /******************************************************************************* 376 ** 377 ** Function BTM_BleSetScanParams 378 ** 379 ** Description This function is called to set Scan parameters. 380 ** 381 ** Parameters adv_int_min: minimum advertising interval 382 ** adv_int_max: maximum advertising interval 383 ** scan_type: scan mode. 384 ** 385 ** Returns void 386 ** 387 *******************************************************************************/ 388 BTM_API extern void BTM_BleSetScanParams(UINT16 scan_interval, UINT16 scan_window, 389 tBTM_BLE_SCAN_MODE scan_type); 390 391 /******************************************************************************* 392 ** 393 ** Function BTM_BleWriteScanRsp 394 ** 395 ** Description This function is called to write LE scan response. 396 ** 397 ** Parameters: p_scan_rsp: scan response. 398 ** 399 ** Returns status 400 ** 401 *******************************************************************************/ 402 BTM_API extern tBTM_STATUS BTM_BleWriteScanRsp(tBTM_BLE_AD_MASK data_mask, 403 tBTM_BLE_ADV_DATA *p_data); 404 405 /******************************************************************************* 406 ** 407 ** Function BTM_BleReset 408 ** 409 ** Description This function is called to reset ULP controller. 410 ** 411 ** Parameters None. 412 ** 413 ** Returns void 414 ** 415 *******************************************************************************/ 416 BTM_API extern void BTM_BleReset(void); 417 418 /******************************************************************************* 419 ** 420 ** Function BTM_BleObserve 421 ** 422 ** Description This procedure keep the device listening for advertising 423 ** events from a broadcast device. 424 ** 425 ** Parameters start: start or stop observe. 426 ** 427 ** Returns void 428 ** 429 *******************************************************************************/ 430 BTM_API extern tBTM_STATUS BTM_BleObserve(BOOLEAN start, UINT8 duration, 431 tBTM_INQ_RESULTS_CB *p_results_cb, tBTM_CMPL_CB *p_cmpl_cb); 432 433 434 /******************************************************************************* 435 ** 436 ** Function BTM_GetDeviceIDRoot 437 ** 438 ** Description This function is called to read the local device identity 439 ** root. 440 ** 441 ** Returns void 442 ** the local device ER is copied into er 443 ** 444 *******************************************************************************/ 445 BTM_API extern void BTM_GetDeviceIDRoot (BT_OCTET16 ir); 446 447 /******************************************************************************* 448 ** 449 ** Function BTM_GetDeviceEncRoot 450 ** 451 ** Description This function is called to read the local device encryption 452 ** root. 453 ** 454 ** Returns void 455 ** the local device ER is copied into er 456 ** 457 *******************************************************************************/ 458 BTM_API extern void BTM_GetDeviceEncRoot (BT_OCTET16 er); 459 460 /******************************************************************************* 461 ** 462 ** Function BTM_GetDeviceDHK 463 ** 464 ** Description This function is called to read the local device DHK. 465 ** 466 ** Returns void 467 ** the local device DHK is copied into dhk 468 ** 469 *******************************************************************************/ 470 BTM_API extern void BTM_GetDeviceDHK (BT_OCTET16 dhk); 471 472 /******************************************************************************* 473 ** 474 ** Function BTM_SecurityGrant 475 ** 476 ** Description This function is called to grant security process. 477 ** 478 ** Parameters bd_addr - peer device bd address. 479 ** res - result of the operation BTM_SUCCESS if success. 480 ** Otherwise, BTM_REPEATED_ATTEMPTS is too many attempts. 481 ** 482 ** Returns None 483 ** 484 *******************************************************************************/ 485 BTM_API extern void BTM_SecurityGrant(BD_ADDR bd_addr, UINT8 res); 486 487 /******************************************************************************* 488 ** 489 ** Function BTM_BlePasskeyReply 490 ** 491 ** Description This function is called after Security Manager submitted 492 ** passkey request to the application. 493 ** 494 ** Parameters: bd_addr - Address of the device for which passkey was requested 495 ** res - result of the operation SMP_SUCCESS if success 496 ** passkey - numeric value in the range of 497 ** BTM_MIN_PASSKEY_VAL(0) - BTM_MAX_PASSKEY_VAL(999999(0xF423F)). 498 ** 499 *******************************************************************************/ 500 BTM_API extern void BTM_BlePasskeyReply (BD_ADDR bd_addr, UINT8 res, UINT32 passkey); 501 502 /******************************************************************************* 503 ** 504 ** Function BTM_LeOobDataReply 505 ** 506 ** Description This function is called to provide the OOB data for 507 ** SMP in response to BTM_LE_OOB_REQ_EVT 508 ** 509 ** Parameters: bd_addr - Address of the peer device 510 ** res - result of the operation SMP_SUCCESS if success 511 ** p_data - simple pairing Randomizer C. 512 ** 513 *******************************************************************************/ 514 BTM_API extern void BTM_BleOobDataReply(BD_ADDR bd_addr, UINT8 res, UINT8 len, UINT8 *p_data); 515 516 517 /******************************************************************************* 518 ** 519 ** Function BTM_BleDataSignature 520 ** 521 ** Description This function is called to sign the data using AES128 CMAC 522 ** algorith. 523 ** 524 ** Parameter bd_addr: target device the data to be signed for. 525 ** p_text: singing data 526 ** len: length of the signing data 527 ** signature: output parameter where data signature is going to 528 ** be stored. 529 ** 530 ** Returns TRUE if signing sucessul, otherwise FALSE. 531 ** 532 *******************************************************************************/ 533 BTM_API extern BOOLEAN BTM_BleDataSignature (BD_ADDR bd_addr, UINT8 *p_text, UINT16 len, 534 BLE_SIGNATURE signature); 535 536 /******************************************************************************* 537 ** 538 ** Function BTM_BleVerifySignature 539 ** 540 ** Description This function is called to verify the data signature 541 ** 542 ** Parameter bd_addr: target device the data to be signed for. 543 ** p_orig: original data before signature. 544 ** len: length of the signing data 545 ** counter: counter used when doing data signing 546 ** p_comp: signature to be compared against. 547 548 ** Returns TRUE if signature verified correctly; otherwise FALSE. 549 ** 550 *******************************************************************************/ 551 BTM_API extern BOOLEAN BTM_BleVerifySignature (BD_ADDR bd_addr, UINT8 *p_orig, 552 UINT16 len, UINT32 counter, 553 UINT8 *p_comp); 554 555 /******************************************************************************* 556 ** 557 ** Function BTM_SetRandomAddr 558 ** 559 ** Description This function is called to set the local device random address 560 ** . 561 ** 562 ** Returns void 563 ** 564 *******************************************************************************/ 565 BTM_API extern void BTM_SetRandomAddr (tBTM_BLE_RANDOM_SET_CBACK *p_cback); 566 567 /******************************************************************************* 568 ** 569 ** Function BTM_ReadConnectionAddr 570 ** 571 ** Description This function is called to set the local device random address 572 ** . 573 ** 574 ** Returns void 575 ** 576 *******************************************************************************/ 577 BTM_API extern void BTM_ReadConnectionAddr (BD_ADDR conn_addr); 578 579 /******************************************************************************* 580 ** 581 ** Function BTM_BleLoadLocalKeys 582 ** 583 ** Description Local local identity key, encryption root or sign counter. 584 ** 585 ** Parameters: key_type: type of key, can be BTM_BLE_KEY_TYPE_ID, BTM_BLE_KEY_TYPE_ER 586 ** or BTM_BLE_KEY_TYPE_COUNTER. 587 ** p_key: pointer to the key. 588 * 589 ** Returns non2. 590 ** 591 *******************************************************************************/ 592 BTM_API extern void BTM_BleLoadLocalKeys(UINT8 key_type, tBTM_BLE_LOCAL_KEYS *p_key); 593 594 595 /******************************************************************************* 596 ** 597 ** Function BTM_BleSetBgConnType 598 ** 599 ** Description This function is called to set BLE background connection 600 ** procedure type. It can be auto connection, or selective connection. 601 ** 602 ** Parameters conn_type: it can be auto connection, or selective connection. 603 ** p_select_cback: callback function when selective connection procedure 604 ** is being used. 605 ** 606 ** Returns void 607 ** 608 *******************************************************************************/ 609 BTM_API extern BOOLEAN BTM_BleSetBgConnType(tBTM_BLE_CONN_TYPE conn_type, 610 tBTM_BLE_SEL_CBACK *p_select_cback); 611 612 /******************************************************************************* 613 ** 614 ** Function BTM_BleUpdateBgConnDev 615 ** 616 ** Description This function is called to add or remove a device into/from 617 ** background connection procedure. The background connection 618 * procedure is decided by the background connection type, it can be 619 * auto connection, or selective connection. 620 ** 621 ** Parameters add_remove: TRUE to add; FALSE to remove. 622 ** remote_bda: device address to add/remove. 623 ** 624 ** Returns void 625 ** 626 *******************************************************************************/ 627 BTM_API extern BOOLEAN BTM_BleUpdateBgConnDev(BOOLEAN add_remove, BD_ADDR remote_bda); 628 629 630 /******************************************************** 631 ** 632 ** Function BTM_BleSetPrefConnParams 633 ** 634 ** Description Set a peripheral's preferred connection parameters. When 635 ** any of the value does not want to be updated while others 636 ** do, use BTM_BLE_CONN_PARAM_UNDEF for the ones want to 637 ** leave untouched. 638 ** 639 ** Parameters: bd_addr - BD address of the peripheral 640 ** min_conn_int - minimum preferred connection interval 641 ** max_conn_int - maximum preferred connection interval 642 ** slave_latency - preferred slave latency 643 ** supervision_tout - preferred supervision timeout 644 ** 645 ** Returns void 646 ** 647 *******************************************************************************/ 648 BTM_API extern void BTM_BleSetPrefConnParams (BD_ADDR bd_addr, 649 UINT16 min_conn_int, UINT16 max_conn_int, 650 UINT16 slave_latency, UINT16 supervision_tout); 651 652 /****************************************************************************** 653 ** 654 ** Function BTM_BleSetConnScanParams 655 ** 656 ** Description Set scan parameters used in BLE connection request 657 ** 658 ** Parameters: scan_interval - scan interval 659 ** scan_window - scan window 660 ** 661 ** Returns void 662 ** 663 *******************************************************************************/ 664 BTM_API extern void BTM_BleSetConnScanParams (UINT16 scan_interval, UINT16 scan_window); 665 666 /******************************************************************************* 667 ** 668 ** Function BTM_CheckAdvData 669 ** 670 ** Description This function is called to get ADV data for a specific type. 671 ** 672 ** Parameters p_adv - pointer of ADV data 673 ** type - finding ADV data type 674 ** p_length - return the length of ADV data not including type 675 ** 676 ** Returns pointer of ADV data 677 ** 678 *******************************************************************************/ 679 BTM_API extern UINT8 *BTM_CheckAdvData( UINT8 *p_adv, UINT8 type, UINT8 *p_length); 680 681 /******************************************************************************* 682 ** 683 ** Function BTM_ReadDevInfo 684 ** 685 ** Description This function is called to read the device/address type 686 ** of BD address. 687 ** 688 ** Parameter remote_bda: remote device address 689 ** p_dev_type: output parameter to read the device type. 690 ** p_addr_type: output parameter to read the address type. 691 ** 692 *******************************************************************************/ 693 BTM_API extern void BTM_ReadDevInfo (BD_ADDR remote_bda, tBT_DEVICE_TYPE *p_dev_type, 694 tBLE_ADDR_TYPE *p_addr_type); 695 696 /******************************************************************************* 697 ** 698 ** Function BTM_BleBroadcast 699 ** 700 ** Description This function is to start or stop broadcasting. 701 ** 702 ** Parameters start: start or stop broadcasting. 703 ** 704 ** Returns status. 705 ** 706 *******************************************************************************/ 707 BTM_API extern tBTM_STATUS BTM_BleBroadcast(BOOLEAN start); 708 709 /******************************************************************************* 710 ** 711 ** Function BTM_RegisterScanReqEvt 712 ** 713 ** Description This function is called to register a scan request callback 714 ** on the advertiser. 715 ** 716 ** Parameters p_scan_req_cback: scan request callback. If NULL, remove the 717 ** registration. 718 ** 719 ** Returns void 720 ** 721 *******************************************************************************/ 722 BTM_API extern void BTM_RegisterScanReqEvt(tBTM_BLE_SCAN_REQ_CBACK *p_scan_req_cback); 723 724 725 #ifdef __cplusplus 726 } 727 #endif 728 729 #endif 730