xref: /btstack/src/gap.h (revision c435f47b63025db89c42b8ffaaa28b0cfbdcce6e)
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 BLUEKITCHEN
24  * GMBH 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 /**
39  * @title Genral Access Profile (GAP)
40  *
41  */
42 
43 #ifndef GAP_H
44 #define GAP_H
45 
46 #if defined __cplusplus
47 extern "C" {
48 #endif
49 
50 #include "btstack_defines.h"
51 #include "btstack_util.h"
52 
53 #ifdef ENABLE_CLASSIC
54 #include "classic/btstack_link_key_db.h"
55 #endif
56 
57 // BIG has up to 2 BIS (stereo)
58 #ifndef MAX_NR_BIS
59 #define MAX_NR_BIS 2
60 #endif
61 
62 typedef enum {
63 
64 	// MITM protection not required
65 	// No encryption required
66 	// No user interaction required
67 	LEVEL_0 = 0,
68 
69 	// MITM protection not required
70 	// No encryption required
71 	// Minimal user interaction desired
72 	LEVEL_1,
73 
74 	// MITM protection not required
75 	// Encryption required
76 	LEVEL_2,
77 
78 	// MITM protection required
79 	// Encryption required
80 	// User interaction acceptable
81 	LEVEL_3,
82 
83 	// MITM protection required
84 	// Encryption required
85 	// 128-bit equivalent strength for link and encryption keys required (P-192 is not enough)
86 	// User interaction acceptable
87 	LEVEL_4,
88 } gap_security_level_t;
89 
90 
91 typedef enum {
92     // non-secure
93     GAP_SECURITY_MODE_1 = 1,
94 
95     // service level enforced security
96     GAP_SECURITY_MODE_2,
97 
98     // link level enforced security
99     GAP_SECURITY_MODE_3,
100 
101     // service level enforced security
102     GAP_SECURITY_MODE_4
103 } gap_security_mode_t;
104 
105 typedef enum {
106 	GAP_SECURITY_NONE,
107 	GAP_SECURITY_ENCRYPTED,		// SSP: JUST WORKS
108 	GAP_SECURITY_AUTHENTICATED, // SSP: numeric comparison, passkey, OOB
109 	// GAP_SECURITY_AUTHORIZED
110 } gap_security_state;
111 
112 typedef enum {
113 	GAP_CONNECTION_INVALID,
114 	GAP_CONNECTION_ACL,
115 	GAP_CONNECTION_SCO,
116 	GAP_CONNECTION_LE
117 } gap_connection_type_t;
118 
119 typedef struct le_connection_parameter_range{
120     uint16_t le_conn_interval_min;
121     uint16_t le_conn_interval_max;
122     uint16_t le_conn_latency_min;
123     uint16_t le_conn_latency_max;
124     uint16_t le_supervision_timeout_min;
125     uint16_t le_supervision_timeout_max;
126 } le_connection_parameter_range_t;
127 
128 typedef enum {
129     GAP_RANDOM_ADDRESS_TYPE_OFF = 0,
130     GAP_RANDOM_ADDRESS_TYPE_STATIC,
131     GAP_RANDOM_ADDRESS_NON_RESOLVABLE,
132     GAP_RANDOM_ADDRESS_RESOLVABLE,
133 } gap_random_address_type_t;
134 
135 // Authorization state
136 typedef enum {
137     AUTHORIZATION_UNKNOWN,
138     AUTHORIZATION_PENDING,
139     AUTHORIZATION_DECLINED,
140     AUTHORIZATION_GRANTED
141 } authorization_state_t;
142 
143 // Extended Advertising Parameters
144 typedef struct {
145     uint16_t        advertising_event_properties;
146     uint16_t        primary_advertising_interval_min;
147     uint16_t        primary_advertising_interval_max;
148     uint8_t         primary_advertising_channel_map;
149     bd_addr_type_t  own_address_type;
150     bd_addr_type_t  peer_address_type;
151     bd_addr_t       peer_address;
152     uint8_t         advertising_filter_policy;
153     int8_t          advertising_tx_power;
154     uint8_t         primary_advertising_phy;
155     uint8_t         secondary_advertising_max_skip;
156     uint8_t         secondary_advertising_phy;
157     uint8_t         advertising_sid;
158     uint8_t         scan_request_notification_enable;
159 } le_extended_advertising_parameters_t;
160 
161 typedef struct {
162     uint16_t  periodic_advertising_interval_min;
163     uint16_t  periodic_advertising_interval_max;
164     uint16_t  periodic_advertising_properties;
165 } le_periodic_advertising_parameters_t;
166 
167 // Extended Advertising Set State
168 typedef struct {
169     btstack_linked_item_t item;
170     le_extended_advertising_parameters_t extended_params;
171     le_periodic_advertising_parameters_t periodic_params;
172     bd_addr_t random_address;
173     const uint8_t * adv_data;
174     const uint8_t * scan_data;
175     const uint8_t * periodic_data;
176     uint16_t  adv_data_len;
177     uint16_t  scan_data_len;
178     uint16_t  periodic_data_len;
179     uint16_t  adv_data_pos;
180     uint16_t  scan_data_pos;
181     uint16_t  periodic_data_pos;
182     uint16_t  enable_timeout;
183     uint8_t   advertising_handle;
184     uint8_t   enable_max_scan_events;
185     bool      periodic_include_adi;
186     uint8_t   state;
187     uint8_t   tasks;
188 } le_advertising_set_t;
189 
190 // Isochronous Streams
191 
192 // -- Broadcast Isochronous Group BIG
193 
194 typedef struct {
195     uint8_t  big_handle;
196     uint8_t  advertising_handle;
197     uint8_t  num_bis;
198     uint32_t sdu_interval_us;
199     uint16_t max_sdu;
200     uint16_t max_transport_latency_ms;
201     uint8_t  rtn;
202     uint8_t  phy;
203     uint8_t  packing;
204     uint8_t  framing;
205     uint8_t  encryption;
206     uint8_t  broadcast_code[16];
207 } le_audio_big_params_t;
208 
209 typedef struct {
210     uint8_t  big_handle;
211     uint8_t  sync_handle;
212     uint8_t  encryption;
213     uint8_t  broadcast_code[16];
214     uint8_t  mse;
215     uint16_t big_sync_timeout_10ms;
216     uint8_t  num_bis;
217     hci_con_handle_t bis_indices[MAX_NR_BIS];
218 } le_audio_big_sync_params_t;
219 
220 typedef enum {
221     LE_AUDIO_BIG_STATE_CREATE,
222     LE_AUDIO_BIG_STATE_W4_ESTABLISHED,
223     LE_AUDIO_BIG_STATE_SETUP_ISO_PATH,
224     LE_AUDIO_BIG_STATE_W4_SETUP_ISO_PATH,
225     LE_AUDIO_BIG_STATE_W4_SETUP_ISO_PATH_THEN_TERMINATE,
226     LE_AUDIO_BIG_STATE_SETUP_ISO_PATHS_FAILED,
227     LE_AUDIO_BIG_STATE_ACTIVE,
228     LE_AUDIO_BIG_STATE_TERMINATE,
229     LE_AUDIO_BIG_STATE_W4_TERMINATED_AFTER_SETUP_FAILED,
230     LE_AUDIO_BIG_STATE_W4_TERMINATED,
231 } le_audio_big_state_t;
232 
233 typedef struct {
234 	btstack_linked_item_t item;
235     uint8_t big_handle;
236     le_audio_big_state_t state;
237     union {
238         uint8_t next_bis;
239         uint8_t status;
240     } state_vars;
241     uint8_t num_bis;
242     hci_con_handle_t bis_con_handles[MAX_NR_BIS];
243     const le_audio_big_params_t * params;
244 } le_audio_big_t;
245 
246 typedef struct {
247     btstack_linked_item_t  item;
248     uint8_t big_handle;
249     le_audio_big_state_t   state;
250     union {
251         uint8_t next_bis;
252         uint8_t status;
253     } state_vars;
254     uint8_t num_bis;
255     hci_con_handle_t bis_con_handles[MAX_NR_BIS];
256     const le_audio_big_sync_params_t * params;
257 } le_audio_big_sync_t;
258 
259 /* API_START */
260 
261 // Classic + LE
262 
263 /**
264  * @brief Read RSSI
265  * @param con_handle
266  * @events: GAP_EVENT_RSSI_MEASUREMENT
267  */
268 int gap_read_rssi(hci_con_handle_t con_handle);
269 
270 
271 /**
272  * @brief Gets local address.
273  */
274 void gap_local_bd_addr(bd_addr_t address_buffer);
275 
276 /**
277  * @brief Disconnect connection with handle
278  * @param handle
279  */
280 uint8_t gap_disconnect(hci_con_handle_t handle);
281 
282 /**
283  * @brief Get connection type
284  * @param con_handle
285  * @result connection_type
286  */
287 gap_connection_type_t gap_get_connection_type(hci_con_handle_t connection_handle);
288 
289 /**
290  * @brief Get HCI connection role
291  * @param con_handle
292  * @result hci_role_t HCI_ROLE_MASTER / HCI_ROLE_SLAVE / HCI_ROLE_INVALID (if connection does not exist)
293  */
294 hci_role_t gap_get_role(hci_con_handle_t connection_handle);
295 
296 // Classic
297 
298 /**
299  * @brief Request role switch
300  * @note this only requests the role switch. A HCI_EVENT_ROLE_CHANGE is emitted and its status field will indicate if the switch was succesful
301  * @param addr
302  * @param hci_role_t HCI_ROLE_MASTER / HCI_ROLE_SLAVE
303  * @result status
304  */
305 uint8_t gap_request_role(const bd_addr_t addr, hci_role_t role);
306 
307 /**
308  * @brief Sets local name.
309  * @note Default name is 'BTstack 00:00:00:00:00:00'
310  * @note '00:00:00:00:00:00' in local_name will be replaced with actual bd addr
311  * @param name is not copied, make sure memory stays valid
312  */
313 void gap_set_local_name(const char * local_name);
314 
315 /**
316  * @brief Set Extended Inquiry Response data
317  * @note If not set, local name will be used for EIR data (see gap_set_local_name)
318  * @note '00:00:00:00:00:00' in local_name will be replaced with actual bd addr
319  * @param eir_data size HCI_EXTENDED_INQUIRY_RESPONSE_DATA_LEN (240) bytes, is not copied make sure memory stays valid
320  */
321 void gap_set_extended_inquiry_response(const uint8_t * data);
322 
323 /**
324  * @brief Set class of device
325  */
326 void gap_set_class_of_device(uint32_t class_of_device);
327 
328 /**
329  * @brief Set default link policy settings for all classic ACL links
330  * @param default_link_policy_settings - see LM_LINK_POLICY_* in bluetooth.h
331  * @note common value: LM_LINK_POLICY_ENABLE_ROLE_SWITCH | LM_LINK_POLICY_ENABLE_SNIFF_MODE to enable role switch and sniff mode
332  */
333 void gap_set_default_link_policy_settings(uint16_t default_link_policy_settings);
334 
335 /**
336  * @brief Set Allow Role Switch param for outgoing classic ACL links
337  * @param allow_role_switch - true: allow remote device to request role switch, false: stay master
338  */
339 void gap_set_allow_role_switch(bool allow_role_switch);
340 
341 /**
342  * @brief Set  link supervision timeout for outgoing classic ACL links
343  * @param default_link_supervision_timeout * 0.625 ms, default 0x7d00 = 20 seconds, 0 = no link supervision timeout
344  */
345 void gap_set_link_supervision_timeout(uint16_t link_supervision_timeout);
346 
347 /**
348  * @brief Enable link watchdog. If no ACL packet is sent within timeout_ms, the link will get disconnected
349  * note: current implementation uses the automatic flush timeout controller feature with a max timeout of 1.28s
350  * @param timeout_ms
351  */
352 void gap_enable_link_watchdog(uint16_t timeout_ms);
353 
354 /**
355  * @brief Enable/disable bonding. Default is enabled.
356  * @param enabled
357  */
358 void gap_set_bondable_mode(int enabled);
359 
360 /**
361  * @brief Get bondable mode.
362  * @return 1 if bondable
363  */
364 int gap_get_bondable_mode(void);
365 
366 /**
367  * @brief Set security mode for all outgoing and incoming connections. Default: GAP_SECURITY_MODE_4
368  * @param security_mode is GAP_SECURITY_MODE_2 or GAP_SECURITY_MODE_4
369  * @return status ERROR_CODE_SUCCESS or ERROR_CODE_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE
370  */
371 uint8_t gap_set_security_mode(gap_security_mode_t security_mode);
372 
373 /**
374  * @brief Get security mode
375  * @return security_mode
376  */
377 gap_security_mode_t gap_get_security_mode(void);
378 
379 /**
380  * @brief Set security level for all outgoing and incoming connections. Default: LEVEL_2
381  * @param security_level
382  * @note has to be called before services or profiles are initialized
383  */
384 void gap_set_security_level(gap_security_level_t security_level);
385 
386 /**
387  * @brief Get security level
388  * @return security_level
389  */
390 gap_security_level_t gap_get_security_level(void);
391 
392 /**
393  * @brief Set Secure Connections Only Mode for BR/EDR (Classic) Default: false
394  * @param enable
395  */
396 void gap_set_secure_connections_only_mode(bool enable);
397 
398 /**
399  * @breif Get Secure Connections Only Mode
400  * @param enabled
401  */
402 bool gap_get_secure_connections_only_mode(void);
403 
404 /**
405  * @brief Set minimal security level for registered services
406  * @param security_level
407  * @note Called by L2CAP based on registered services
408  */
409 void gap_set_minimal_service_security_level(gap_security_level_t security_level);
410 
411 /**
412  * @brief Register filter for rejecting classic connections. Callback will return 1 accept connection, 0 on reject.
413  */
414 void gap_register_classic_connection_filter(int (*accept_callback)(bd_addr_t addr, hci_link_type_t link_type));
415 
416 /* Configure Secure Simple Pairing */
417 
418 /**
419  * @brief Enable will enable SSP during init. Default: true
420  */
421 void gap_ssp_set_enable(int enable);
422 
423 /**
424  * @brief Set IO Capability. BTstack will return capability to SSP requests
425  */
426 void gap_ssp_set_io_capability(int ssp_io_capability);
427 
428 /**
429  * @brief Set Authentication Requirements using during SSP
430  */
431 void gap_ssp_set_authentication_requirement(int authentication_requirement);
432 
433 /**
434  * @brief Enable/disable Secure Connections. Default: true if supported by Controller
435  */
436 void gap_secure_connections_enable(bool enable);
437 
438 /**
439  * @brief Query if Secure Connections can be used for Classic connections.
440  * @note Requires gap_secure_connections_enable == true and Controller to support it
441  */
442 bool gap_secure_connections_active(void);
443 
444 /**
445  * @brief If set, BTstack will confirm a numeric comparison and enter '000000' if requested.
446  */
447 void gap_ssp_set_auto_accept(int auto_accept);
448 
449 /**
450  * @brief Set required encryption key size for GAP Levels 1-3 on ccassic connections. Default: 16 bytes
451  * @param encryption_key_size in bytes. Valid 7..16
452  */
453 void gap_set_required_encryption_key_size(uint8_t encryption_key_size);
454 
455 /**
456  * @brief Start dedicated bonding with device. Disconnect after bonding.
457  * @param device
458  * @param request MITM protection
459  * @return error, if max num acl connections active
460  * @result GAP_DEDICATED_BONDING_COMPLETE
461  */
462 int gap_dedicated_bonding(bd_addr_t device, int mitm_protection_required);
463 
464 gap_security_level_t gap_security_level_for_link_key_type(link_key_type_t link_key_type);
465 
466 /**
467  * @brief map link keys to secure connection yes/no
468  */
469 bool gap_secure_connection_for_link_key_type(link_key_type_t link_key_type);
470 
471 /**
472  * @brief map link keys to authenticated
473  */
474 bool gap_authenticated_for_link_key_type(link_key_type_t link_key_type);
475 
476 gap_security_level_t gap_security_level(hci_con_handle_t con_handle);
477 
478 void gap_request_security_level(hci_con_handle_t con_handle, gap_security_level_t level);
479 
480 bool gap_mitm_protection_required_for_security_level(gap_security_level_t level);
481 
482 /**
483  * @brief Set Page Scan Type
484  * @param page_scan_interval * 0.625 ms, range: 0x0012..0x1000, default: 0x0800
485  * @param page_scan_windows  * 0.625 ms, range: 0x0011..page_scan_interval, default: 0x0012
486  */
487 void gap_set_page_scan_activity(uint16_t page_scan_interval, uint16_t page_scan_window);
488 
489 /**
490  * @brief Set Page Scan Type
491  * @param page_scan_mode
492  */
493 void gap_set_page_scan_type(page_scan_type_t page_scan_type);
494 
495 /**
496  * @brief Set Page Timeout
497  * @param page_timeout * 0.625 ms, range: 0x0001..0xffff, default: 0x6000 (ca 15 seconds)
498  */
499 void gap_set_page_timeout(uint16_t page_timeout);
500 
501 // LE
502 
503 /**
504  * @brief Set parameters for LE Scan
505  * @param scan_type 0 = passive, 1 = active
506  * @param scan_interval range 0x0004..0x4000, unit 0.625 ms
507  * @param scan_window range 0x0004..0x4000, unit 0.625 ms
508  * @param scanning_filter_policy 0 = all devices, 1 = all from whitelist
509  */
510 void gap_set_scan_params(uint8_t scan_type, uint16_t scan_interval, uint16_t scan_window, uint8_t scanning_filter_policy);
511 
512 /**
513  * @brief Set parameters for LE Scan
514  * @deprecated Use gap_set_scan_params instead
515  */
516 void gap_set_scan_parameters(uint8_t scan_type, uint16_t scan_interval, uint16_t scan_window);
517 
518 /**
519  * @brief Start LE Scan
520  */
521 void gap_start_scan(void);
522 
523 /**
524  * @brief Stop LE Scan
525  */
526 void gap_stop_scan(void);
527 
528 /**
529  * @brief Enable privacy by using random addresses
530  * @param random_address_type to use (incl. OFF)
531  */
532 void gap_random_address_set_mode(gap_random_address_type_t random_address_type);
533 
534 /**
535  * @brief Get privacy mode
536  */
537 gap_random_address_type_t gap_random_address_get_mode(void);
538 
539 /**
540  * @brief Sets update period for random address
541  * @param period_ms in ms
542  */
543  void gap_random_address_set_update_period(int period_ms);
544 
545 /**
546  * @brief Sets a fixed random address for advertising
547  * @param addr
548  * @note Sets random address mode to type off
549  */
550 void gap_random_address_set(const bd_addr_t addr);
551 
552 /**
553  * @brief Set Advertisement Data
554  * @param advertising_data_length
555  * @param advertising_data (max 31 octets)
556  * @note data is not copied, pointer has to stay valid
557  * @note '00:00:00:00:00:00' in advertising_data will be replaced with actual bd addr
558  */
559 void gap_advertisements_set_data(uint8_t advertising_data_length, uint8_t * advertising_data);
560 
561 /**
562  * @brief Set Advertisement Parameters
563  * @param adv_int_min
564  * @param adv_int_max
565  * @param adv_type
566  * @param direct_address_type
567  * @param direct_address
568  * @param channel_map
569  * @param filter_policy
570  * @note own_address_type is used from gap_random_address_set_mode
571  */
572 void gap_advertisements_set_params(uint16_t adv_int_min, uint16_t adv_int_max, uint8_t adv_type,
573 	uint8_t direct_address_typ, bd_addr_t direct_address, uint8_t channel_map, uint8_t filter_policy);
574 
575 /**
576  * @brief Enable/Disable Advertisements. OFF by default.
577  * @param enabled
578  */
579 void gap_advertisements_enable(int enabled);
580 
581 /**
582  * @brief Set Scan Response Data
583  *
584  * @note For scan response data, scannable undirected advertising (ADV_SCAN_IND) need to be used
585  *
586  * @param advertising_data_length
587  * @param advertising_data (max 31 octets)
588  * @note data is not copied, pointer has to stay valid
589  * @note '00:00:00:00:00:00' in scan_response_data will be replaced with actual bd addr
590  */
591 void gap_scan_response_set_data(uint8_t scan_response_data_length, uint8_t * scan_response_data);
592 
593 /**
594  * @brief Provide storage for new advertising set and setup on Controller
595  * @param storage to use by stack, needs to stay valid until adv set is removed with gap_extended_advertising_remove
596  * @param advertising_parameters
597  * @param out_advertising_handle to use with other adv config commands
598  * @return status
599  * @events: GAP_SUBEVENT_ADVERTISING_SET_INSTALLED
600  */
601 uint8_t gap_extended_advertising_setup(le_advertising_set_t * storage, const le_extended_advertising_parameters_t * advertising_parameters, uint8_t * out_advertising_handle);
602 
603 /**
604  * @param Set advertising params for advertising set
605  * @param advertising_handle
606  * @param advertising_parameters
607  * @return status
608  */
609 uint8_t gap_extended_advertising_set_params(uint8_t advertising_handle, const le_extended_advertising_parameters_t * advertising_parameters);
610 
611 /**
612  * @param Get advertising params for advertising set, e.g. to update params
613  * @param advertising_handle
614  * @param advertising_parameters
615  * @return status
616  */
617 uint8_t gap_extended_advertising_get_params(uint8_t advertising_handle, le_extended_advertising_parameters_t * advertising_parameters);
618 
619 /**
620  * @param Set periodic advertising params for advertising set
621  * @param advertising_handle
622  * @param advertising_parameters
623  * @return status
624  */
625 uint8_t gap_periodic_advertising_set_params(uint8_t advertising_handle, const le_periodic_advertising_parameters_t * advertising_parameters);
626 
627 /**
628  * @param Get params for periodic advertising set, e.g. to update params
629  * @param advertising_handle
630  * @param advertising_parameters
631  * @return status
632  */
633 uint8_t gap_periodic_advertising_get_params(uint8_t advertising_handle, le_periodic_advertising_parameters_t * advertising_parameters);
634 
635 /**
636  * @param Set random addrress for advertising set
637  * @param advertising_handle
638  * @param random_address
639  * @return status
640  */
641 uint8_t gap_extended_advertising_set_random_address(uint8_t advertising_handle, bd_addr_t random_address);
642 
643 /**
644  * @brief Set Advertising Data for a advertisement set
645  * @param advertising_handle
646  * @param advertising_data_length
647  * @param advertising_data
648  * @return status
649  */
650 uint8_t gap_extended_advertising_set_adv_data(uint8_t advertising_handle, uint16_t advertising_data_length, const uint8_t * advertising_data);
651 
652 /**
653  * @brief Set Scan Response Data for a advertisement set
654  * @param advertising_handle
655  * @param scan_response_data_length
656  * @param scan_response_data
657  * @return status
658  */
659 uint8_t gap_extended_advertising_set_scan_response_data(uint8_t advertising_handle, uint16_t scan_response_data_length, const uint8_t * scan_response_data);
660 
661 /**
662  * @brief Set data for periodic advertisement set
663  * @param advertising_handle
664  * @param periodic_data_length
665  * @param periodic_data
666  * @return status
667  */
668 uint8_t gap_periodic_advertising_set_data(uint8_t advertising_handle, uint16_t periodic_data_length, const uint8_t * periodic_data);
669 
670 /**
671  * @brief Start advertising advertising set
672  * @param advertising_handle
673  * @param timeout in 10ms, or 0 == no timeout
674  * @param num_extended_advertising_events Controller shall send, or 0 == no max number
675  * @return status
676  */
677 uint8_t gap_extended_advertising_start(uint8_t advertising_handle, uint16_t timeout, uint8_t num_extended_advertising_events);
678 
679 /**
680  * @brief Stop advertising
681  * @param advertising_handle
682  * @return status
683  */
684 uint8_t gap_extended_advertising_stop(uint8_t advertising_handle);
685 
686 /**
687  * @brief Start periodic advertising for given advertising set
688  * @param advertising_handle
689  * @param include_adi
690  * @return status
691  */
692 uint8_t gap_periodic_advertising_start(uint8_t advertising_handle, bool include_adi);
693 
694 /**
695  * @brief Stop periodic advertising for given advertising set
696  * @param advertising_handle
697  * @return status
698  */
699 uint8_t gap_periodic_advertising_stop(uint8_t advertising_handle);
700 
701 /**
702  * @brief Remove advertising set from Controller
703  * @param advertising_handle
704  * @return status
705  * @events GAP_SUBEVENT_ADVERTISING_SET_REMOVED
706  */
707 uint8_t gap_extended_advertising_remove(uint8_t advertising_handle);
708 
709 /**
710  * @brief Create Broadcast Isochronous Group (BIG)
711  * @param storage to use by stack, needs to stay valid until adv set is removed with gap_big_terminate
712  * @param big_params
713  * @return status
714  * @events GAP_SUBEVENT_BIG_CREATED unless interrupted by call to gap_big_terminate
715  */
716 uint8_t gap_big_create(le_audio_big_t * storage, le_audio_big_params_t * big_params);
717 
718 /**
719  * @brief Terminate Broadcast Isochronous Group (BIG)
720  * @param big_handle
721  * @return status
722  * @events: GAP_SUBEVENT_BIG_TERMINATED
723  */
724 uint8_t gap_big_terminate(uint8_t big_handle);
725 
726 /**
727  * @brief Synchronize to Broadcast Isochronous Group (BIG)
728  * @param storage to use by stack, needs to stay valid until adv set is removed with gap_big_terminate
729  * @param big_sync_params
730  * @return status
731  * @events GAP_SUBEVENT_BIG_SYNC_CREATED unless interrupted by call to gap_big_sync_terminate
732  */
733 uint8_t gap_big_sync_create(le_audio_big_sync_t * storage, le_audio_big_sync_params_t * big_sync_params);
734 
735 /**
736  * @brief Stop synchronizing to Broadcast Isochronous Group (BIG). Triggers GAP_SUBEVENT_BIG_SYNC_STOPPED
737  * @note Also used to stop synchronizing before BIG Sync was established
738  * @param big_handle
739  * @return status
740  * @events GAP_SUBEVENT_BIG_SYNC_STOPPED
741  */
742 uint8_t gap_big_sync_terminate(uint8_t big_handle);
743 
744 /**
745  * @brief Set connection parameters for outgoing connections
746  * @param conn_scan_interval (unit: 0.625 msec), default: 60 ms
747  * @param conn_scan_window (unit: 0.625 msec), default: 30 ms
748  * @param conn_interval_min (unit: 1.25ms), default: 10 ms
749  * @param conn_interval_max (unit: 1.25ms), default: 30 ms
750  * @param conn_latency, default: 4
751  * @param supervision_timeout (unit: 10ms), default: 720 ms
752  * @param min_ce_length (unit: 0.625ms), default: 10 ms
753  * @param max_ce_length (unit: 0.625ms), default: 30 ms
754  */
755 void gap_set_connection_parameters(uint16_t conn_scan_interval, uint16_t conn_scan_window,
756     uint16_t conn_interval_min, uint16_t conn_interval_max, uint16_t conn_latency,
757     uint16_t supervision_timeout, uint16_t min_ce_length, uint16_t max_ce_length);
758 
759 /**
760  * @brief Request an update of the connection parameter for a given LE connection
761  * @param handle
762  * @param conn_interval_min (unit: 1.25ms)
763  * @param conn_interval_max (unit: 1.25ms)
764  * @param conn_latency
765  * @param supervision_timeout (unit: 10ms)
766  * @return 0 if ok
767  */
768 int gap_request_connection_parameter_update(hci_con_handle_t con_handle, uint16_t conn_interval_min,
769 	uint16_t conn_interval_max, uint16_t conn_latency, uint16_t supervision_timeout);
770 
771 /**
772  * @brief Updates the connection parameters for a given LE connection
773  * @param handle
774  * @param conn_interval_min (unit: 1.25ms)
775  * @param conn_interval_max (unit: 1.25ms)
776  * @param conn_latency
777  * @param supervision_timeout (unit: 10ms)
778  * @return 0 if ok
779  */
780 int gap_update_connection_parameters(hci_con_handle_t con_handle, uint16_t conn_interval_min,
781 	uint16_t conn_interval_max, uint16_t conn_latency, uint16_t supervision_timeout);
782 
783 /**
784  * @brief Set accepted connection parameter range
785  * @param range
786  */
787 void gap_get_connection_parameter_range(le_connection_parameter_range_t * range);
788 
789 /**
790  * @brief Get accepted connection parameter range
791  * @param range
792  */
793 void gap_set_connection_parameter_range(le_connection_parameter_range_t * range);
794 
795 /**
796  * @brief Test if connection parameters are inside in existing rage
797  * @param conn_interval_min (unit: 1.25ms)
798  * @param conn_interval_max (unit: 1.25ms)
799  * @param conn_latency
800  * @param supervision_timeout (unit: 10ms)
801  * @return 1 if included
802  */
803 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);
804 
805 /**
806  * @brief Set max number of connections in LE Peripheral role (if Bluetooth Controller supports it)
807  * @note: default: 1
808  * @param max_peripheral_connections
809  */
810 void gap_set_max_number_peripheral_connections(int max_peripheral_connections);
811 
812 /**
813  * @brief Add Device to Whitelist
814  * @param address_typ
815  * @param address
816  * @return 0 if ok
817  */
818 uint8_t gap_whitelist_add(bd_addr_type_t address_type, const bd_addr_t address);
819 
820 /**
821  * @brief Remove Device from Whitelist
822  * @param address_typ
823  * @param address
824  * @return 0 if ok
825  */
826 uint8_t gap_whitelist_remove(bd_addr_type_t address_type, const bd_addr_t address);
827 
828 /**
829  * @brief Clear Whitelist
830  * @return 0 if ok
831  */
832 uint8_t gap_whitelist_clear(void);
833 
834 /**
835  * @brief Connect to remote LE device
836  */
837 uint8_t gap_connect(const bd_addr_t addr, bd_addr_type_t addr_type);
838 
839 /**
840  *  @brief Connect with Whitelist
841  *  @note Explicit whitelist management and this connect with whitelist replace deprecated gap_auto_connection_* functions
842  *  @return - if ok
843  */
844 uint8_t gap_connect_with_whitelist(void);
845 
846 /**
847  * @brief Cancel connection process initiated by gap_connect
848  */
849 uint8_t gap_connect_cancel(void);
850 
851 /**
852  * @brief Auto Connection Establishment - Start Connecting to device
853  * @deprecated Please setup Whitelist with gap_whitelist_* and start connecting with gap_connect_with_whitelist
854  * @param address_type
855  * @param address
856  * @return 0 if ok
857  */
858 uint8_t gap_auto_connection_start(bd_addr_type_t address_type, const bd_addr_t address);
859 
860 /**
861  * @brief Auto Connection Establishment - Stop Connecting to device
862  * @deprecated Please setup Whitelist with gap_whitelist_* and start connecting with gap_connect_with_whitelist
863  * @param address_type
864  * @param address
865  * @return 0 if ok
866  */
867 uint8_t gap_auto_connection_stop(bd_addr_type_t address_type, const bd_addr_t address);
868 
869 /**
870  * @brief Auto Connection Establishment - Stop everything
871  * @deprecated Please setup Whitelist with gap_whitelist_* and start connecting with gap_connect_with_whitelist
872  * @note  Convenience function to stop all active auto connection attempts
873  */
874 uint8_t gap_auto_connection_stop_all(void);
875 
876 /**
877  * @brief Set LE PHY
878  * @param con_handle
879  * @param all_phys 0 = set rx/tx, 1 = set only rx, 2 = set only tx
880  * @param tx_phys 1 = 1M, 2 = 2M, 4 = Coded
881  * @param rx_phys 1 = 1M, 2 = 2M, 4 = Coded
882  * @param phy_options 0 = no preferred coding for Coded, 1 = S=2 coding (500 kbit), 2 = S=8 coding (125 kbit)
883  * @return 0 if ok
884  */
885 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);
886 
887 /**
888  * @brief Get connection interval
889  * @param con_handle
890  * @return connection interval, otherwise 0 if error
891  */
892 uint16_t gap_le_connection_interval(hci_con_handle_t con_handle);
893 
894 /**
895  *
896  * @brief Get encryption key size.
897  * @param con_handle
898  * @return 0 if not encrypted, 7-16 otherwise
899  */
900 uint8_t gap_encryption_key_size(hci_con_handle_t con_handle);
901 
902 /**
903  * @brief Get authentication property.
904  * @param con_handle
905  * @return 1 if bonded with OOB/Passkey (AND MITM protection)
906  */
907 bool gap_authenticated(hci_con_handle_t con_handle);
908 
909 /**
910  * @brief Get secure connection property
911  * @param con_handle
912  * @return 1 if bonded usiung LE Secure Connections
913  */
914 bool gap_secure_connection(hci_con_handle_t con_handle);
915 
916 /**
917  * @brief Queries authorization state.
918  * @param con_handle
919  * @return authorization_state for the current session
920  */
921 authorization_state_t gap_authorization_state(hci_con_handle_t con_handle);
922 
923 /**
924  * @brief Get bonded property (BR/EDR/LE)
925  * @note LE: has to be called after identity resolving is complete
926  * @param con_handle
927  * @return true if bonded
928  */
929 bool gap_bonded(hci_con_handle_t con_handle);
930 
931 // Classic
932 #ifdef ENABLE_CLASSIC
933 
934 /**
935  * @brief Override page scan mode. Page scan mode enabled by l2cap when services are registered
936  * @note Might be used to reduce power consumption while Bluetooth module stays powered but no (new)
937  *       connections are expected
938  */
939 void gap_connectable_control(uint8_t enable);
940 
941 /**
942  * @brief Allows to control if device is discoverable. OFF by default.
943  */
944 void gap_discoverable_control(uint8_t enable);
945 
946 /**
947  * @brief Deletes link key for remote device with baseband address.
948  * @param addr
949  * @note On most desktop ports, the Link Key DB uses a TLV and there is one TLV storage per
950  *       Controller resp. its Bluetooth Address. As the Bluetooth Address is retrieved during
951  *       power up, this function only works, when the stack is in working state for these ports.
952  */
953 void gap_drop_link_key_for_bd_addr(bd_addr_t addr);
954 
955 /**
956  * @brief Delete all stored link keys
957  * @note On most desktop ports, the Link Key DB uses a TLV and there is one TLV storage per
958  *       Controller resp. its Bluetooth Address. As the Bluetooth Address is retrieved during
959  *       power up, this function only works, when the stack is in working state for these ports.
960  */
961 void gap_delete_all_link_keys(void);
962 
963 /**
964  * @brief Store link key for remote device with baseband address
965  * @param addr
966  * @param link_key
967  * @param link_key_type
968  * @note On most desktop ports, the Link Key DB uses a TLV and there is one TLV storage per
969  *       Controller resp. its Bluetooth Address. As the Bluetooth Address is retrieved during
970  *       power up, this function only works, when the stack is in working state for these ports.
971  */
972 void gap_store_link_key_for_bd_addr(bd_addr_t addr, link_key_t link_key, link_key_type_t type);
973 
974 /**
975  * @brief Get link for remote device with basband address
976  * @param addr
977  * @param link_key (out) is stored here
978  * @param link_key_type (out) is stored here
979  * @note On most desktop ports, the Link Key DB uses a TLV and there is one TLV storage per
980  *       Controller resp. its Bluetooth Address. As the Bluetooth Address is retrieved during
981  *       power up, this function only works, when the stack is in working state for these ports.
982  */
983 bool gap_get_link_key_for_bd_addr(bd_addr_t addr, link_key_t link_key, link_key_type_t * type);
984 
985 /**
986  * @brief Setup Link Key iterator
987  * @param it
988  * @return 1 on success
989  * @note On most desktop ports, the Link Key DB uses a TLV and there is one TLV storage per
990  *       Controller resp. its Bluetooth Address. As the Bluetooth Address is retrieved during
991  *       power up, this function only works, when the stack is in working state for these ports.
992  */
993 int gap_link_key_iterator_init(btstack_link_key_iterator_t * it);
994 
995 /**
996  * @brief Get next Link Key
997  * @param it
998  * @brief addr
999  * @brief link_key
1000  * @brief type of link key
1001  * @return 1, if valid link key found
1002  * @see note on gap_link_key_iterator_init
1003  */
1004 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);
1005 
1006 /**
1007  * @brief Frees resources allocated by iterator_init
1008  * @note Must be called after iteration to free resources
1009  * @param it
1010  * @see note on gap_link_key_iterator_init
1011  */
1012 void gap_link_key_iterator_done(btstack_link_key_iterator_t * it);
1013 
1014 /**
1015  * @brief Start GAP Classic Inquiry
1016  * @param duration in 1.28s units
1017  * @return 0 if ok
1018  * @events: GAP_EVENT_INQUIRY_RESULT, GAP_EVENT_INQUIRY_COMPLETE
1019  */
1020 int gap_inquiry_start(uint8_t duration_in_1280ms_units);
1021 
1022 /**
1023  * @brief Start GAP Classic Periodic Inquiry
1024  * @param duration in 1.28s units
1025  * @param max_period_length between consecutive inquiries in 1.28s units
1026  * @param min_period_length between consecutive inquiries in 1.28s units
1027  * @return 0 if ok
1028  * @events: GAP_EVENT_INQUIRY_RESULT, GAP_EVENT_INQUIRY_COMPLETE
1029  */
1030 uint8_t gap_inquiry_periodic_start(uint8_t duration, uint16_t max_period_length, uint16_t min_period_length);
1031 
1032 /**
1033  * @brief Stop GAP Classic Inquiry (regular or periodic)
1034  * @return 0 if ok
1035  * @events: GAP_EVENT_INQUIRY_COMPLETE
1036  */
1037 int gap_inquiry_stop(void);
1038 
1039 /**
1040  * @brief Set LAP for GAP Classic Inquiry
1041  * @param lap GAP_IAC_GENERAL_INQUIRY (default), GAP_IAC_LIMITED_INQUIRY
1042  */
1043 void gap_inquiry_set_lap(uint32_t lap);
1044 
1045 /**
1046  * @brief Set Inquiry Scan Activity
1047  * @param inquiry_scan_interval range: 0x0012 to 0x1000; only even values are valid, Time = N * 0.625 ms
1048  * @param inquiry_scan_window range: 0x0011 to 0x1000; Time = N * 0.625 ms
1049  */
1050 void gap_inquiry_set_scan_activity(uint16_t inquiry_scan_interval, uint16_t inquiry_scan_window);
1051 
1052 /**
1053  * @brief Remote Name Request
1054  * @param addr
1055  * @param page_scan_repetition_mode
1056  * @param clock_offset only used when bit 15 is set - pass 0 if not known
1057  * @events: HCI_EVENT_REMOTE_NAME_REQUEST_COMPLETE
1058  */
1059 int gap_remote_name_request(const bd_addr_t addr, uint8_t page_scan_repetition_mode, uint16_t clock_offset);
1060 
1061 /**
1062  * @brief Legacy Pairing Pin Code Response
1063  * @note data is not copied, pointer has to stay valid
1064  * @param addr
1065  * @param pin
1066  * @return 0 if ok
1067  */
1068 int gap_pin_code_response(const bd_addr_t addr, const char * pin);
1069 
1070 /**
1071  * @brief Legacy Pairing Pin Code Response for binary data / non-strings
1072  * @note data is not copied, pointer has to stay valid
1073  * @param addr
1074  * @param pin_data
1075  * @param pin_len
1076  * @return 0 if ok
1077  */
1078 int gap_pin_code_response_binary(const bd_addr_t addr, const uint8_t * pin_data, uint8_t pin_len);
1079 
1080 /**
1081  * @brief Abort Legacy Pairing
1082  * @param addr
1083  * @param pin
1084  * @return 0 if ok
1085  */
1086 int gap_pin_code_negative(bd_addr_t addr);
1087 
1088 /**
1089  * @brief SSP Passkey Response
1090  * @param addr
1091  * @param passkey [0..999999]
1092  * @return 0 if ok
1093  */
1094 int gap_ssp_passkey_response(const bd_addr_t addr, uint32_t passkey);
1095 
1096 /**
1097  * @brief Abort SSP Passkey Entry/Pairing
1098  * @param addr
1099  * @param pin
1100  * @return 0 if ok
1101  */
1102 int gap_ssp_passkey_negative(const bd_addr_t addr);
1103 
1104 /**
1105  * @brief Accept SSP Numeric Comparison
1106  * @param addr
1107  * @param passkey
1108  * @return 0 if ok
1109  */
1110 int gap_ssp_confirmation_response(const bd_addr_t addr);
1111 
1112 /**
1113  * @brief Abort SSP Numeric Comparison/Pairing
1114  * @param addr
1115  * @param pin
1116  * @return 0 if ok
1117  */
1118 int gap_ssp_confirmation_negative(const bd_addr_t addr);
1119 
1120 /**
1121  * @brief Generate new OOB data
1122  * @note OOB data will be provided in GAP_EVENT_LOCAL_OOB_DATA and be used in future pairing procedures
1123  */
1124 void gap_ssp_generate_oob_data(void);
1125 
1126 /**
1127  * @brief Report Remote OOB Data
1128  * @note Pairing Hash and Randomizer are expected in big-endian byte format
1129  * @param bd_addr
1130  * @param c_192 Simple Pairing Hash C derived from P-192 public key
1131  * @param r_192 Simple Pairing Randomizer derived from P-192 public key
1132  * @param c_256 Simple Pairing Hash C derived from P-256 public key
1133  * @param r_256 Simple Pairing Randomizer derived from P-256 public key
1134  */
1135 uint8_t gap_ssp_remote_oob_data(const bd_addr_t addr, const uint8_t * c_192, const uint8_t * r_192, const uint8_t * c_256, const uint8_t * r_256);
1136 
1137 /**
1138  * Send SSP IO Capabilities Reply
1139  * @note IO Capabilities (Negative) Reply is sent automatically unless ENABLE_EXPLICIT_IO_CAPABILITIES_REPLY
1140  * @param addr
1141  * @return 0 if ok
1142  */
1143 uint8_t gap_ssp_io_capabilities_response(const bd_addr_t addr);
1144 
1145 /**
1146  * Send SSP IO Capabilities Negative Reply
1147  * @note IO Capabilities (Negative) Reply is sent automatically unless ENABLE_EXPLICIT_IO_CAPABILITIES_REPLY
1148  * @param addr
1149  * @return 0 if ok
1150  */
1151 uint8_t gap_ssp_io_capabilities_negative(const bd_addr_t addr);
1152 
1153 /**
1154  * Send Link Key Reponse
1155  * @note Link Key (Negative) Reply is sent automatically unless ENABLE_EXPLICIT_LINK_KEY_RESPONSE
1156  * @param addr
1157  * @param link_key
1158  * @param type or INVALID_LINK_KEY if link key not available
1159  * @return 0 if ok
1160  */
1161  uint8_t gap_send_link_key_response(const bd_addr_t addr, link_key_t link_key, link_key_type_t type);
1162 
1163 /**
1164  * @brief Enter Sniff mode
1165  * @param con_handle
1166  * @param sniff_min_interval range: 0x0002 to 0xFFFE; only even values are valid, Time = N * 0.625 ms
1167  * @param sniff_max_interval range: 0x0002 to 0xFFFE; only even values are valid, Time = N * 0.625 ms
1168  * @param sniff_attempt Number of Baseband receive slots for sniff attempt.
1169  * @param sniff_timeout Number of Baseband receive slots for sniff timeout.
1170  @ @return 0 if ok
1171  */
1172 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);
1173 
1174 /**
1175  * @brief Exit Sniff mode
1176  * @param con_handle
1177  @ @return 0 if ok
1178  */
1179 uint8_t gap_sniff_mode_exit(hci_con_handle_t con_handle);
1180 
1181 /**
1182  * @brief Configure Sniff Subrating
1183  * @param con_handle
1184  * @param max_latency range: 0x0002 to 0xFFFE; Time = N * 0.625 ms
1185  * @param min_remote_timeout range:  0x0002 to 0xFFFE; Time = N * 0.625 ms
1186  * @param min_local_timeout range:  0x0002 to 0xFFFE; Time = N * 0.625 ms
1187  @ @return 0 if ok
1188  */
1189 uint8_t gap_sniff_subrating_configure(hci_con_handle_t con_handle, uint16_t max_latency, uint16_t min_remote_timeout, uint16_t min_local_timeout);
1190 
1191 /**
1192  * @Brief Set QoS
1193  * @param con_handle
1194  * @param service_type
1195  * @param token_rate
1196  * @param peak_bandwidth
1197  * @param latency
1198  * @param delay_variation
1199  @ @return 0 if ok
1200  */
1201 uint8_t gap_qos_set(hci_con_handle_t con_handle, hci_service_type_t service_type, uint32_t token_rate, uint32_t peak_bandwidth, uint32_t latency, uint32_t delay_variation);
1202 
1203 #endif
1204 
1205 // LE
1206 
1207 /**
1208  * @brief Get own addr type and address used for LE for next scan/advertisement/connect operation
1209  */
1210 void gap_le_get_own_address(uint8_t * addr_type, bd_addr_t addr);
1211 
1212 /**
1213  * @brief Get own addr type and address used for LE advertisements (Peripheral)
1214  */
1215 void gap_le_get_own_advertisements_address(uint8_t * addr_type, bd_addr_t addr);
1216 
1217 /**
1218  * @brief Get own addr type and address used for LE connections (Central)
1219  */
1220 void gap_le_get_own_connection_address(uint8_t * addr_type, bd_addr_t addr);
1221 
1222 /**
1223  * @brief Get state of connection re-encryption for bonded devices when in central role
1224  * @note used by gatt_client and att_server to wait for re-encryption
1225  * @param con_handle
1226  * @return 1 if security setup is active
1227  */
1228 int gap_reconnect_security_setup_active(hci_con_handle_t con_handle);
1229 
1230 /**
1231  * @brief Delete bonding information for remote device
1232  * @note On most desktop ports, the LE Device DB uses a TLV and there is one TLV storage per
1233  *       Controller resp. its Bluetooth Address. As the Bluetooth Address is retrieved during
1234  *       power up, this function only works, when the stack is in working state for these ports.
1235  * @param address_type
1236  * @param address
1237  */
1238 void gap_delete_bonding(bd_addr_type_t address_type, bd_addr_t address);
1239 
1240 /**
1241  * LE Privacy 1.2 - requires support by Controller and ENABLE_LE_RESOLVING_LIST to be defined
1242  */
1243 
1244 /**
1245  * @brief Load LE Device DB entries into Controller Resolving List to allow filtering on
1246  *        bonded devies with resolvable private addresses
1247  * @return EROOR_CODE_SUCCESS if supported by Controller
1248  */
1249 uint8_t gap_load_resolving_list_from_le_device_db(void);
1250 
1251 /**
1252  * @brief Get local persistent IRK
1253  */
1254 const uint8_t * gap_get_persistent_irk(void);
1255 
1256 /* API_END*/
1257 
1258 #if defined __cplusplus
1259 }
1260 #endif
1261 
1262 #endif // GAP_H
1263