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