1 /* 2 * Copyright (C) 2014 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 3. Neither the name of the copyright holders nor the names of 14 * contributors may be used to endorse or promote products derived 15 * from this software without specific prior written permission. 16 * 4. Any redistribution, use, or modification is done solely for 17 * personal benefit and not for any commercial purpose or for 18 * monetary gain. 19 * 20 * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS 21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS 24 * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 26 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 27 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 28 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 30 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * Please inquire about commercial licensing options at 34 * [email protected] 35 * 36 */ 37 38 #ifndef GAP_H 39 #define GAP_H 40 41 #if defined __cplusplus 42 extern "C" { 43 #endif 44 45 #include "btstack_defines.h" 46 #include "btstack_util.h" 47 #include "classic/btstack_link_key_db.h" 48 49 typedef enum { 50 51 // MITM protection not required 52 // No encryption required 53 // No user interaction required 54 LEVEL_0 = 0, 55 56 // MITM protection not required 57 // No encryption required 58 // Minimal user interaction desired 59 LEVEL_1, 60 61 // MITM protection not required 62 // Encryption required 63 LEVEL_2, 64 65 // MITM protection required 66 // Encryption required 67 // User interaction acceptable 68 LEVEL_3, 69 70 // MITM protection required 71 // Encryption required 72 // 128-bit equivalent strength for link and encryption keys required (P-192 is not enough) 73 // User interaction acceptable 74 LEVEL_4, 75 } gap_security_level_t; 76 77 typedef enum { 78 GAP_SECURITY_NONE, 79 GAP_SECUIRTY_ENCRYPTED, // SSP: JUST WORKS 80 GAP_SECURITY_AUTHENTICATED, // SSP: numeric comparison, passkey, OOB 81 // GAP_SECURITY_AUTHORIZED 82 } gap_security_state; 83 84 typedef enum { 85 GAP_CONNECTION_INVALID, 86 GAP_CONNECTION_ACL, 87 GAP_CONNECTION_SCO, 88 GAP_CONNECTION_LE 89 } gap_connection_type_t; 90 91 typedef struct le_connection_parameter_range{ 92 uint16_t le_conn_interval_min; 93 uint16_t le_conn_interval_max; 94 uint16_t le_conn_latency_min; 95 uint16_t le_conn_latency_max; 96 uint16_t le_supervision_timeout_min; 97 uint16_t le_supervision_timeout_max; 98 } le_connection_parameter_range_t; 99 100 typedef enum { 101 GAP_RANDOM_ADDRESS_TYPE_OFF = 0, 102 GAP_RANDOM_ADDRESS_TYPE_STATIC, 103 GAP_RANDOM_ADDRESS_NON_RESOLVABLE, 104 GAP_RANDOM_ADDRESS_RESOLVABLE, 105 } gap_random_address_type_t; 106 107 // Authorization state 108 typedef enum { 109 AUTHORIZATION_UNKNOWN, 110 AUTHORIZATION_PENDING, 111 AUTHORIZATION_DECLINED, 112 AUTHORIZATION_GRANTED 113 } authorization_state_t; 114 115 116 /* API_START */ 117 118 // Classic + LE 119 120 /** 121 * @brief Disconnect connection with handle 122 * @param handle 123 */ 124 uint8_t gap_disconnect(hci_con_handle_t handle); 125 126 /** 127 * @brief Get connection type 128 * @param con_handle 129 * @result connection_type 130 */ 131 gap_connection_type_t gap_get_connection_type(hci_con_handle_t connection_handle); 132 133 // Classic 134 135 /** 136 * @brief Sets local name. 137 * @note has to be done before stack starts up 138 * @note Default name is 'BTstack 00:00:00:00:00:00' 139 * @note '00:00:00:00:00:00' in local_name will be replaced with actual bd addr 140 * @param name is not copied, make sure memory is accessible during stack startup 141 */ 142 void gap_set_local_name(const char * local_name); 143 144 /** 145 * @brief Set Extended Inquiry Response data 146 * @note has to be done before stack starts up 147 * @note If not set, local name will be used for EIR data (see gap_set_local_name) 148 * @note '00:00:00:00:00:00' in local_name will be replaced with actual bd addr 149 * @param eir_data size HCI_EXTENDED_INQUIRY_RESPONSE_DATA_LEN (240) bytes, is not copied make sure memory is accessible during stack startup 150 */ 151 void gap_set_extended_inquiry_response(const uint8_t * data); 152 153 /** 154 * @brief Set class of device that will be set during Bluetooth init. 155 * @note has to be done before stack starts up 156 */ 157 void gap_set_class_of_device(uint32_t class_of_device); 158 159 /** 160 * @brief Set default link policy settings for all classic ACL links 161 * @param default_link_policy_settings - see LM_LINK_POLICY_* in bluetooth.h 162 * @note common value: LM_LINK_POLICY_ENABLE_ROLE_SWITCH | LM_LINK_POLICY_ENABLE_SNIFF_MODE to enable role switch and sniff mode 163 * @note has to be done before stack starts up 164 */ 165 void gap_set_default_link_policy_settings(uint16_t default_link_policy_settings); 166 167 /** 168 * @brief Set Allow Role Switch param for outgoing classic ACL links 169 * @param allow_role_switch - true: allow remote device to request role switch, false: stay master 170 */ 171 void gap_set_allow_role_switch(bool allow_role_switch); 172 173 /** 174 * @brief Set link supervision timeout for outgoing classic ACL links 175 * @param default_link_supervision_timeout * 0.625 ms, default 0x7d00 = 20 seconds 176 */ 177 void gap_set_link_supervision_timeout(uint16_t link_supervision_timeout); 178 179 /** 180 * @brief Enable/disable bonding. Default is enabled. 181 * @param enabled 182 */ 183 void gap_set_bondable_mode(int enabled); 184 185 /** 186 * @brief Get bondable mode. 187 * @return 1 if bondable 188 */ 189 int gap_get_bondable_mode(void); 190 191 /** 192 * @brief Set security level for all outgoing and incoming connections. Default: LEVEL_2 193 * @param security_level 194 * @note has to be called before services or profiles are initialized 195 */ 196 void gap_set_security_level(gap_security_level_t security_level); 197 198 /** 199 * @brief Get security level 200 * @return security_level 201 */ 202 gap_security_level_t gap_get_security_level(void); 203 204 /** 205 * @brief Register filter for rejecting classic connections. Callback will return 1 accept connection, 0 on reject. 206 */ 207 void gap_register_classic_connection_filter(int (*accept_callback)(bd_addr_t addr)); 208 209 /* Configure Secure Simple Pairing */ 210 211 /** 212 * @brief Enable will enable SSP during init. Default: true 213 */ 214 void gap_ssp_set_enable(int enable); 215 216 /** 217 * @brief Set IO Capability. BTstack will return capability to SSP requests 218 */ 219 void gap_ssp_set_io_capability(int ssp_io_capability); 220 221 /** 222 * @brief Set Authentication Requirements using during SSP 223 */ 224 void gap_ssp_set_authentication_requirement(int authentication_requirement); 225 226 /** 227 * @brief Enable/disable Secure Connections. Default: true if supported by Controller 228 */ 229 void gap_secure_connections_enable(bool enable); 230 231 /** 232 * @brief If set, BTstack will confirm a numeric comparison and enter '000000' if requested. 233 */ 234 void gap_ssp_set_auto_accept(int auto_accept); 235 236 /** 237 * @brief Set required encryption key size for GAP Levels 1-3 on ccassic connections. Default: 16 bytes 238 * @param encryption_key_size in bytes. Valid 7..16 239 */ 240 void gap_set_required_encryption_key_size(uint8_t encryption_key_size); 241 242 /** 243 * @brief Start dedicated bonding with device. Disconnect after bonding. 244 * @param device 245 * @param request MITM protection 246 * @return error, if max num acl connections active 247 * @result GAP_DEDICATED_BONDING_COMPLETE 248 */ 249 int gap_dedicated_bonding(bd_addr_t device, int mitm_protection_required); 250 251 gap_security_level_t gap_security_level_for_link_key_type(link_key_type_t link_key_type); 252 253 /** 254 * @brief map link keys to secure connection yes/no 255 */ 256 int gap_secure_connection_for_link_key_type(link_key_type_t link_key_type); 257 258 /** 259 * @brief map link keys to authenticated 260 */ 261 int gap_authenticated_for_link_key_type(link_key_type_t link_key_type); 262 263 gap_security_level_t gap_security_level(hci_con_handle_t con_handle); 264 265 void gap_request_security_level(hci_con_handle_t con_handle, gap_security_level_t level); 266 267 int gap_mitm_protection_required_for_security_level(gap_security_level_t level); 268 269 // LE 270 271 /** 272 * @brief Set parameters for LE Scan 273 */ 274 void gap_set_scan_parameters(uint8_t scan_type, uint16_t scan_interval, uint16_t scan_window); 275 276 /** 277 * @brief Start LE Scan 278 */ 279 void gap_start_scan(void); 280 281 /** 282 * @brief Stop LE Scan 283 */ 284 void gap_stop_scan(void); 285 286 /** 287 * @brief Enable privacy by using random addresses 288 * @param random_address_type to use (incl. OFF) 289 */ 290 void gap_random_address_set_mode(gap_random_address_type_t random_address_type); 291 292 /** 293 * @brief Get privacy mode 294 */ 295 gap_random_address_type_t gap_random_address_get_mode(void); 296 297 /** 298 * @brief Sets update period for random address 299 * @param period_ms in ms 300 */ 301 void gap_random_address_set_update_period(int period_ms); 302 303 /** 304 * @brief Sets a fixed random address for advertising 305 * @param addr 306 * @note Sets random address mode to type off 307 */ 308 void gap_random_address_set(bd_addr_t addr); 309 310 /** 311 * @brief Set Advertisement Data 312 * @param advertising_data_length 313 * @param advertising_data (max 31 octets) 314 * @note data is not copied, pointer has to stay valid 315 * @note '00:00:00:00:00:00' in advertising_data will be replaced with actual bd addr 316 */ 317 void gap_advertisements_set_data(uint8_t advertising_data_length, uint8_t * advertising_data); 318 319 /** 320 * @brief Set Advertisement Paramters 321 * @param adv_int_min 322 * @param adv_int_max 323 * @param adv_type 324 * @param direct_address_type 325 * @param direct_address 326 * @param channel_map 327 * @param filter_policy 328 * @note own_address_type is used from gap_random_address_set_mode 329 */ 330 void gap_advertisements_set_params(uint16_t adv_int_min, uint16_t adv_int_max, uint8_t adv_type, 331 uint8_t direct_address_typ, bd_addr_t direct_address, uint8_t channel_map, uint8_t filter_policy); 332 333 /** 334 * @brief Enable/Disable Advertisements. OFF by default. 335 * @param enabled 336 */ 337 void gap_advertisements_enable(int enabled); 338 339 /** 340 * @brief Set Scan Response Data 341 * 342 * @note For scan response data, scannable undirected advertising (ADV_SCAN_IND) need to be used 343 * 344 * @param advertising_data_length 345 * @param advertising_data (max 31 octets) 346 * @note data is not copied, pointer has to stay valid 347 * @note '00:00:00:00:00:00' in scan_response_data will be replaced with actual bd addr 348 */ 349 void gap_scan_response_set_data(uint8_t scan_response_data_length, uint8_t * scan_response_data); 350 351 /** 352 * @brief Set connection parameters for outgoing connections 353 * @param conn_scan_interval (unit: 0.625 msec), default: 60 ms 354 * @param conn_scan_window (unit: 0.625 msec), default: 30 ms 355 * @param conn_interval_min (unit: 1.25ms), default: 10 ms 356 * @param conn_interval_max (unit: 1.25ms), default: 30 ms 357 * @param conn_latency, default: 4 358 * @param supervision_timeout (unit: 10ms), default: 720 ms 359 * @param min_ce_length (unit: 0.625ms), default: 10 ms 360 * @param max_ce_length (unit: 0.625ms), default: 30 ms 361 */ 362 void gap_set_connection_parameters(uint16_t conn_scan_interval, uint16_t conn_scan_window, 363 uint16_t conn_interval_min, uint16_t conn_interval_max, uint16_t conn_latency, 364 uint16_t supervision_timeout, uint16_t min_ce_length, uint16_t max_ce_length); 365 366 /** 367 * @brief Request an update of the connection parameter for a given LE connection 368 * @param handle 369 * @param conn_interval_min (unit: 1.25ms) 370 * @param conn_interval_max (unit: 1.25ms) 371 * @param conn_latency 372 * @param supervision_timeout (unit: 10ms) 373 * @returns 0 if ok 374 */ 375 int gap_request_connection_parameter_update(hci_con_handle_t con_handle, uint16_t conn_interval_min, 376 uint16_t conn_interval_max, uint16_t conn_latency, uint16_t supervision_timeout); 377 378 /** 379 * @brief Updates the connection parameters for a given LE connection 380 * @param handle 381 * @param conn_interval_min (unit: 1.25ms) 382 * @param conn_interval_max (unit: 1.25ms) 383 * @param conn_latency 384 * @param supervision_timeout (unit: 10ms) 385 * @returns 0 if ok 386 */ 387 int gap_update_connection_parameters(hci_con_handle_t con_handle, uint16_t conn_interval_min, 388 uint16_t conn_interval_max, uint16_t conn_latency, uint16_t supervision_timeout); 389 390 /** 391 * @brief Set accepted connection parameter range 392 * @param range 393 */ 394 void gap_get_connection_parameter_range(le_connection_parameter_range_t * range); 395 396 /** 397 * @brief Get accepted connection parameter range 398 * @param range 399 */ 400 void gap_set_connection_parameter_range(le_connection_parameter_range_t * range); 401 402 /** 403 * @brief Test if connection parameters are inside in existing rage 404 * @param conn_interval_min (unit: 1.25ms) 405 * @param conn_interval_max (unit: 1.25ms) 406 * @param conn_latency 407 * @param supervision_timeout (unit: 10ms) 408 * @returns 1 if included 409 */ 410 int gap_connection_parameter_range_included(le_connection_parameter_range_t * existing_range, uint16_t le_conn_interval_min, uint16_t le_conn_interval_max, uint16_t le_conn_latency, uint16_t le_supervision_timeout); 411 412 /** 413 * @brief Set max number of connections in LE Peripheral role (if Bluetooth Controller supports it) 414 * @note: default: 1 415 * @param max_peripheral_connections 416 */ 417 void gap_set_max_number_peripheral_connections(int max_peripheral_connections); 418 419 /** 420 * @brief Connect to remote LE device 421 */ 422 uint8_t gap_connect(bd_addr_t addr, bd_addr_type_t addr_type); 423 424 /** 425 * @brief Cancel connection process initiated by gap_connect 426 */ 427 uint8_t gap_connect_cancel(void); 428 429 /** 430 * @brief Auto Connection Establishment - Start Connecting to device 431 * @param address_typ 432 * @param address 433 * @returns 0 if ok 434 */ 435 int gap_auto_connection_start(bd_addr_type_t address_typ, bd_addr_t address); 436 437 /** 438 * @brief Auto Connection Establishment - Stop Connecting to device 439 * @param address_typ 440 * @param address 441 * @returns 0 if ok 442 */ 443 int gap_auto_connection_stop(bd_addr_type_t address_typ, bd_addr_t address); 444 445 /** 446 * @brief Auto Connection Establishment - Stop everything 447 * @note Convenience function to stop all active auto connection attempts 448 */ 449 void gap_auto_connection_stop_all(void); 450 451 /** 452 * @brief Set LE PHY 453 * @param con_handle 454 * @param all_phys 0 = set rx/tx, 1 = set only rx, 2 = set only tx 455 * @param tx_phys 1 = 1M, 2 = 2M, 4 = Coded 456 * @param rx_phys 1 = 1M, 2 = 2M, 4 = Coded 457 * @param phy_options 0 = no preferred coding for Coded, 1 = S=2 coding (500 kbit), 2 = S=8 coding (125 kbit) 458 * @returns 0 if ok 459 */ 460 uint8_t gap_le_set_phy(hci_con_handle_t con_handle, uint8_t all_phys, uint8_t tx_phys, uint8_t rx_phys, uint8_t phy_options); 461 462 /** 463 * @brief Get connection interval 464 * @return connection interval, otherwise 0 if error 465 */ 466 uint16_t gap_le_connection_interval(hci_con_handle_t connection_handle); 467 468 /** 469 * 470 * @brief Get encryption key size. 471 * @param con_handle 472 * @return 0 if not encrypted, 7-16 otherwise 473 */ 474 int gap_encryption_key_size(hci_con_handle_t con_handle); 475 476 /** 477 * @brief Get authentication property. 478 * @param con_handle 479 * @return 1 if bonded with OOB/Passkey (AND MITM protection) 480 */ 481 int gap_authenticated(hci_con_handle_t con_handle); 482 483 /** 484 * @brief Get secure connection property 485 * @param con_handle 486 * @return 1 if bonded usiung LE Secure Connections 487 */ 488 int gap_secure_connection(hci_con_handle_t con_handle); 489 490 /** 491 * @brief Queries authorization state. 492 * @param con_handle 493 * @return authorization_state for the current session 494 */ 495 authorization_state_t gap_authorization_state(hci_con_handle_t con_handle); 496 497 // Classic 498 499 /** 500 * @brief Override page scan mode. Page scan mode enabled by l2cap when services are registered 501 * @note Might be used to reduce power consumption while Bluetooth module stays powered but no (new) 502 * connections are expected 503 */ 504 void gap_connectable_control(uint8_t enable); 505 506 /** 507 * @brief Allows to control if device is discoverable. OFF by default. 508 */ 509 void gap_discoverable_control(uint8_t enable); 510 511 /** 512 * @brief Gets local address. 513 */ 514 void gap_local_bd_addr(bd_addr_t address_buffer); 515 516 /** 517 * @brief Deletes link key for remote device with baseband address. 518 * @param addr 519 * @note On most desktop ports, the Link Key DB uses a TLV and there is one TLV storage per 520 * Controller resp. its Bluetooth Address. As the Bluetooth Address is retrieved during 521 * power up, this function only works, when the stack is in working state for these ports. 522 */ 523 void gap_drop_link_key_for_bd_addr(bd_addr_t addr); 524 525 /** 526 * @brief Delete all stored link keys 527 * @note On most desktop ports, the Link Key DB uses a TLV and there is one TLV storage per 528 * Controller resp. its Bluetooth Address. As the Bluetooth Address is retrieved during 529 * power up, this function only works, when the stack is in working state for these ports. 530 */ 531 void gap_delete_all_link_keys(void); 532 533 /** 534 * @brief Store link key for remote device with baseband address 535 * @param addr 536 * @param link_key 537 * @param link_key_type 538 * @note On most desktop ports, the Link Key DB uses a TLV and there is one TLV storage per 539 * Controller resp. its Bluetooth Address. As the Bluetooth Address is retrieved during 540 * power up, this function only works, when the stack is in working state for these ports. 541 */ 542 void gap_store_link_key_for_bd_addr(bd_addr_t addr, link_key_t link_key, link_key_type_t type); 543 544 /** 545 * @brief Setup Link Key iterator 546 * @param it 547 * @returns 1 on success 548 * @note On most desktop ports, the Link Key DB uses a TLV and there is one TLV storage per 549 * Controller resp. its Bluetooth Address. As the Bluetooth Address is retrieved during 550 * power up, this function only works, when the stack is in working state for these ports. 551 */ 552 int gap_link_key_iterator_init(btstack_link_key_iterator_t * it); 553 554 /** 555 * @brief Get next Link Key 556 * @param it 557 * @brief addr 558 * @brief link_key 559 * @brief type of link key 560 * @returns 1, if valid link key found 561 * @see note on gap_link_key_iterator_init 562 */ 563 int gap_link_key_iterator_get_next(btstack_link_key_iterator_t * it, bd_addr_t bd_addr, link_key_t link_key, link_key_type_t * type); 564 565 /** 566 * @brief Frees resources allocated by iterator_init 567 * @note Must be called after iteration to free resources 568 * @param it 569 * @see note on gap_link_key_iterator_init 570 */ 571 void gap_link_key_iterator_done(btstack_link_key_iterator_t * it); 572 573 /** 574 * @brief Start GAP Classic Inquiry 575 * @param duration in 1.28s units 576 * @return 0 if ok 577 * @events: GAP_EVENT_INQUIRY_RESULT, GAP_EVENT_INQUIRY_COMPLETE 578 */ 579 int gap_inquiry_start(uint8_t duration_in_1280ms_units); 580 581 /** 582 * @brief Stop GAP Classic Inquiry 583 * @brief Stop GAP Classic Inquiry 584 * @returns 0 if ok 585 * @events: GAP_EVENT_INQUIRY_COMPLETE 586 */ 587 int gap_inquiry_stop(void); 588 589 /** 590 * @brief Remote Name Request 591 * @param addr 592 * @param page_scan_repetition_mode 593 * @param clock_offset only used when bit 15 is set - pass 0 if not known 594 * @events: HCI_EVENT_REMOTE_NAME_REQUEST_COMPLETE 595 */ 596 int gap_remote_name_request(bd_addr_t addr, uint8_t page_scan_repetition_mode, uint16_t clock_offset); 597 598 /** 599 * @brief Read RSSI 600 * @param con_handle 601 * @events: GAP_EVENT_RSSI_MEASUREMENT 602 */ 603 int gap_read_rssi(hci_con_handle_t con_handle); 604 605 /** 606 * @brief Legacy Pairing Pin Code Response 607 * @param addr 608 * @param pin 609 * @return 0 if ok 610 */ 611 int gap_pin_code_response(bd_addr_t addr, const char * pin); 612 613 /** 614 * @brief Abort Legacy Pairing 615 * @param addr 616 * @param pin 617 * @return 0 if ok 618 */ 619 int gap_pin_code_negative(bd_addr_t addr); 620 621 /** 622 * @brief SSP Passkey Response 623 * @param addr 624 * @param passkey [0..999999] 625 * @return 0 if ok 626 */ 627 int gap_ssp_passkey_response(bd_addr_t addr, uint32_t passkey); 628 629 /** 630 * @brief Abort SSP Passkey Entry/Pairing 631 * @param addr 632 * @param pin 633 * @return 0 if ok 634 */ 635 int gap_ssp_passkey_negative(bd_addr_t addr); 636 637 /** 638 * @brief Accept SSP Numeric Comparison 639 * @param addr 640 * @param passkey 641 * @return 0 if ok 642 */ 643 int gap_ssp_confirmation_response(bd_addr_t addr); 644 645 /** 646 * @brief Abort SSP Numeric Comparison/Pairing 647 * @param addr 648 * @param pin 649 * @return 0 if ok 650 */ 651 int gap_ssp_confirmation_negative(bd_addr_t addr); 652 653 /** 654 * @brief Enter Sniff mode 655 * @param con_handle 656 * @param sniff_min_interval range: 0x0002 to 0xFFFE; only even values are valid, Time = N * 0.625 ms 657 * @param sniff_max_interval range: 0x0002 to 0xFFFE; only even values are valid, Time = N * 0.625 ms 658 * @param sniff_attempt Number of Baseband receive slots for sniff attempt. 659 * @param sniff_timeout Number of Baseband receive slots for sniff timeout. 660 @ @return 0 if ok 661 */ 662 uint8_t gap_sniff_mode_enter(hci_con_handle_t con_handle, uint16_t sniff_min_interval, uint16_t sniff_max_interval, uint16_t sniff_attempt, uint16_t sniff_timeout); 663 664 /** 665 * @brief Exit Sniff mode 666 * @param con_handle 667 @ @return 0 if ok 668 */ 669 uint8_t gap_sniff_mode_exit(hci_con_handle_t con_handle); 670 671 // LE 672 673 /** 674 * @brief Get own addr type and address used for LE 675 */ 676 void gap_le_get_own_address(uint8_t * addr_type, bd_addr_t addr); 677 678 679 /** 680 * @brief Get state of connection re-encryptiong for bonded devices when in central role 681 * @note used by gatt_client and att_server to wait for re-encryption 682 * @param con_handle 683 * @return 1 if security setup is active 684 */ 685 int gap_reconnect_security_setup_active(hci_con_handle_t con_handle); 686 687 688 /* API_END*/ 689 690 #if defined __cplusplus 691 } 692 #endif 693 694 #endif // GAP_H 695