xref: /btstack/port/stm32-wb55xx-nucleo-freertos/Middlewares/STM32_WPAN/ble/core/auto/ble_gap_aci.h (revision 0561b2d8d5dba972c7daa57d5e677f7a1327edfd)
1 /******************************************************************************
2  * @file    ble_gap_aci.h
3  * @author  MCD Application Team
4  * @date    19 July 2019
5  * @brief   Header file for STM32WB (gap_aci)
6  *          Auto-generated file: do not edit!
7  ******************************************************************************
8  * @attention
9  *
10  * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
11  * All rights reserved.</center></h2>
12  *
13  * This software component is licensed by ST under Ultimate Liberty license
14  * SLA0044, the "License"; You may not use this file except in compliance with
15  * the License. You may obtain a copy of the License at:
16  *                             www.st.com/SLA0044
17  *
18  ******************************************************************************
19  */
20 
21 #ifndef BLE_GAP_ACI_H__
22 #define BLE_GAP_ACI_H__
23 
24 
25 #include "ble_types.h"
26 
27 /**
28   * @brief Put the device in non-discoverable mode. This command disables the LL advertising.
29   * @retval Value indicating success or error code.
30 */
31 tBleStatus aci_gap_set_non_discoverable(void);
32 
33 /**
34   * @brief Put the device in limited discoverable mode (as defined in Bluetooth Specification v.5.0,
35 Vol. 3, Part C, section 9.2.3). The device will be discoverable for maximum period of TGAP
36 (lim_adv_timeout) = 180 seconds (from errata). The advertising can be disabled at any time
37 by issuing @ref aci_gap_set_non_discoverable command.
38 The Adv_Interval_Min and Adv_Interval_Max parameters are optional. If both are set to 0,
39 the GAP will use default values for adv intervals for limited discoverable mode (250 ms
40 and 500 ms respectively).
41 To allow a fast connection, the host can set Local_Name, Service_Uuid_List,
42 Slave_Conn_Interval_Min and Slave_Conn_Interval_Max. If provided, these data will be
43 inserted into the advertising packet payload as AD data. These parameters are optional
44 in this command. These values can be set in advertised data using GAP_Update_Adv_Data
45 command separately.
46 The total size of data in advertising packet cannot exceed 31 bytes.
47 With this command, the BLE Stack will also add automatically the following
48 standard AD types:
49 - AD Flags
50 - Power Level
51 When advertising timeout happens (i.e. limited discovery period has elapsed), controller generates
52 @ref aci_gap_limited_discoverable_event event.
53   * @param Advertising_Type Advertising type. Advertising_Type type cannot be any of GAP_ADV_HIGH_DC_DIRECT_IND or GAP_ADV_HIGH_DC_DIRECT_IND.
54   * Values:
55   - 0x00: ADV_IND (Connectable undirected advertising)
56   - 0x01: ADV_DIRECT_IND (Connectable directed advertising)
57   - 0x02: ADV_SCAN_IND (Scannable undirected advertising)
58   - 0x03: ADV_NONCONN_IND (Non connectable undirected advertising)
59   * @param Advertising_Interval_Min Minimum advertising interval.
60 Time = N * 0.625 msec.
61   * Values:
62   - 0x0020 (20.000 ms)  ... 0x4000 (10240.000 ms)
63   * @param Advertising_Interval_Max Maximum advertising interval.
64 Time = N * 0.625 msec.
65   * Values:
66   - 0x0020 (20.000 ms)  ... 0x4000 (10240.000 ms)
67   * @param Own_Address_Type Own address type:
68  - 0x00: Public Device Address (it is allowed only if privacy is disabled)
69  - 0x01: Random Device Address (it is allowed only if privacy is disabled)
70  - 0x02: Resolvable Private Address (it is allowed only if privacy is enabled)
71  - 0x03: Non Resolvable Private Address (it is allowed only if privacy is enabled)
72   * Values:
73   - 0x00: Public Device Address
74   - 0x01: Random Device Address
75   - 0x02: Resolvable Private Address
76   - 0x03: Non Resolvable Private Address
77   * @param Advertising_Filter_Policy Advertising filter policy: not applicable (the value of Advertising_Filter_Policy parameter is not used inside the Stack)
78   * @param Local_Name_Length Length of the local_name field in octets.
79 If length is set to 0x00, Local_Name parameter is not used.
80   * @param Local_Name Local name of the device. First byte must be 0x08 for Shortened Local Name
81 or 0x09 for Complete Local Name. No NULL character at the end.
82   * @param Service_Uuid_length Length of the Service Uuid List in octets.
83 If there is no service to be advertised, set this field to 0x00.
84   * @param Service_Uuid_List This is the list of the UUIDs as defined in Volume 3,
85 Section 11 of GAP Specification. First byte is the AD Type.
86 See also Supplement to the Bluetooth Core 5.0 specification.
87   * @param Slave_Conn_Interval_Min Slave connection interval minimum value suggested by Peripheral.
88 If Slave_Conn_Interval_Min and Slave_Conn_Interval_Max are not 0x0000,
89 Slave Connection Interval Range AD structure will be added in advertising
90 data.
91 Connection interval is defined in the following manner:
92 connIntervalmin = Slave_Conn_Interval_Min x 1.25ms.
93   * Values:
94   - 0x0000 (NaN)
95   - 0xFFFF (NaN) : No specific minimum
96   - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
97   * @param Slave_Conn_Interval_Max Slave connection interval maximum value suggested by Peripheral.
98 If Slave_Conn_Interval_Min and Slave_Conn_Interval_Max are not 0x0000,
99 Slave Connection Interval Range AD structure will be added in advertising
100 data.
101 Connection interval is defined in the following manner:
102 connIntervalmax = Slave_Conn_Interval_Max x 1.25ms
103   * Values:
104   - 0x0000 (NaN)
105   - 0xFFFF (NaN) : No specific maximum
106   - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
107   * @retval Value indicating success or error code.
108 */
109 tBleStatus aci_gap_set_limited_discoverable(uint8_t Advertising_Type,
110                                             uint16_t Advertising_Interval_Min,
111                                             uint16_t Advertising_Interval_Max,
112                                             uint8_t Own_Address_Type,
113                                             uint8_t Advertising_Filter_Policy,
114                                             uint8_t Local_Name_Length,
115                                             uint8_t Local_Name[],
116                                             uint8_t Service_Uuid_length,
117                                             uint8_t Service_Uuid_List[],
118                                             uint16_t Slave_Conn_Interval_Min,
119                                             uint16_t Slave_Conn_Interval_Max);
120 
121 /**
122   * @brief Put the device in general discoverable mode (as defined in Bluetooth Specification v.5.0,
123 Vol. 3, Part C, section 9.2.4). The device will be discoverable until the host issues
124 the @ref aci_gap_set_non_discoverable command. The Adv_Interval_Min and Adv_Interval_Max
125 parameters are optional. If both are set to 0, the GAP uses the default values for adv
126 intervals for general discoverable mode.
127 When using connectable undirected advertising events:
128 - Adv_Interval_Min = 30 ms
129 - Adv_Interval_Max = 60 ms
130 When using non-connectable advertising events or scannable undirected advertising events:
131 - Adv_Interval_Min = 100 ms
132 - Adv_Interval_Max = 150 ms
133 Host can set the Local Name, a Service UUID list and the Slave Connection Interval Range.
134 If provided, these data will be inserted into the advertising packet payload as AD data.
135 These parameters are optional in this command. These values can be also set using
136 aci_gap_update_adv_data() separately.
137 The total size of data in advertising packet cannot exceed 31 bytes.
138 With this command, the BLE Stack will also add automatically the following standard
139 AD types:
140 - AD Flags
141 - TX Power Level
142   * @param Advertising_Type Advertising type. Advertising_Type type cannot be any of GAP_ADV_HIGH_DC_DIRECT_IND or GAP_ADV_HIGH_DC_DIRECT_IND.
143   * Values:
144   - 0x00: ADV_IND (Connectable undirected advertising)
145   - 0x01: ADV_DIRECT_IND (Connectable directed advertising)
146   - 0x02: ADV_SCAN_IND (Scannable undirected advertising)
147   - 0x03: ADV_NONCONN_IND (Non connectable undirected advertising)
148   * @param Advertising_Interval_Min Minimum advertising interval.
149 Time = N * 0.625 msec.
150   * Values:
151   - 0x0020 (20.000 ms)  ... 0x4000 (10240.000 ms)
152   * @param Advertising_Interval_Max Maximum advertising interval.
153 Time = N * 0.625 msec.
154   * Values:
155   - 0x0020 (20.000 ms)  ... 0x4000 (10240.000 ms)
156   * @param Own_Address_Type Own address type:
157  - 0x00: Public Device Address (it is allowed only if privacy is disabled)
158  - 0x01: Random Device Address (it is allowed only if privacy is disabled)
159  - 0x02: Resolvable Private Address (it is allowed only if privacy is enabled)
160  - 0x03: Non Resolvable Private Address (it is allowed only if privacy is enabled)
161   * Values:
162   - 0x00: Public Device Address
163   - 0x01: Random Device Address
164   - 0x02: Resolvable Private Address
165   - 0x03: Non Resolvable Private Address
166   * @param Advertising_Filter_Policy Advertising filter policy: not applicable (the value of Advertising_Filter_Policy parameter is not used inside the Stack)
167   * @param Local_Name_Length Length of the local_name field in octets.
168 If length is set to 0x00, Local_Name parameter is not used.
169   * @param Local_Name Local name of the device. First byte must be 0x08 for Shortened Local Name
170 or 0x09 for Complete Local Name. No NULL character at the end.
171   * @param Service_Uuid_length Length of the Service Uuid List in octets.
172 If there is no service to be advertised, set this field to 0x00.
173   * @param Service_Uuid_List This is the list of the UUIDs as defined in Volume 3,
174 Section 11 of GAP Specification. First byte is the AD Type.
175 See also Supplement to the Bluetooth Core 5.0 specification.
176   * @param Slave_Conn_Interval_Min Slave connection interval minimum value suggested by Peripheral.
177 If Slave_Conn_Interval_Min and Slave_Conn_Interval_Max are not 0x0000,
178 Slave Connection Interval Range AD structure will be added in advertising
179 data.
180 Connection interval is defined in the following manner:
181 connIntervalmin = Slave_Conn_Interval_Min x 1.25ms.
182   * Values:
183   - 0x0000 (NaN)
184   - 0xFFFF (NaN) : No specific minimum
185   - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
186   * @param Slave_Conn_Interval_Max Slave connection interval maximum value suggested by Peripheral.
187 If Slave_Conn_Interval_Min and Slave_Conn_Interval_Max are not 0x0000,
188 Slave Connection Interval Range AD structure will be added in advertising
189 data.
190 Connection interval is defined in the following manner:
191 connIntervalmax = Slave_Conn_Interval_Max x 1.25ms
192   * Values:
193   - 0x0000 (NaN)
194   - 0xFFFF (NaN) : No specific maximum
195   - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
196   * @retval Value indicating success or error code.
197 */
198 tBleStatus aci_gap_set_discoverable(uint8_t Advertising_Type,
199                                     uint16_t Advertising_Interval_Min,
200                                     uint16_t Advertising_Interval_Max,
201                                     uint8_t Own_Address_Type,
202                                     uint8_t Advertising_Filter_Policy,
203                                     uint8_t Local_Name_Length,
204                                     uint8_t Local_Name[],
205                                     uint8_t Service_Uuid_length,
206                                     uint8_t Service_Uuid_List[],
207                                     uint16_t Slave_Conn_Interval_Min,
208                                     uint16_t Slave_Conn_Interval_Max);
209 
210 /**
211   * @brief Set the device in direct connectable mode (as defined in Bluetooth Specification v.5.0,
212 Vol. 3, Part C, section 9.3.3). Device uses direct connectable mode to advertise using High Duty
213 cycle advertisement events or Low Duty cycle advertisement events and the address as
214 either what is specified in the Own Address Type parameter. The command specifies the type of the advertising used.
215 If the privacy is enabled, the Type parameter in reconnection address is used for advertising, otherwise the address
216 of the type specified in OwnAddrType is used.
217 The device will be in directed connectable mode only for 1.28 seconds. If no connection
218 is established within this duration, the device enters non discoverable mode and
219 advertising will have to be again enabled explicitly.
220 The controller generates a @ref hci_le_connection_complete_event event with the status set to
221 HCI_DIRECTED_ADV_TIMEOUT if the connection was not established and 0x00 if the
222 connection was successfully established.If Host privacy (i.e. privacy 1.1) is enabled this command returns BLE_STATUS_INVALID_PARAMS.
223   * @param Own_Address_Type Own address type:
224  - 0x00: Public Device Address (only if privacy is disabled)
225  - 0x01: Random Device Address (only if privacy is disabled)
226  - 0x02: Resolvable Private Address (only if privacy is enabled)
227   * Values:
228   - 0x00: Public Device Address
229   - 0x01: Random Device Address
230   - 0x02: Resolvable Private Address
231   * @param Directed_Advertising_Type Type of directed advertising.
232   * Values:
233   - 0x01: High Duty Cycle Directed Advertising
234   - 0x04: Low Duty Cycle Directed Advertising
235   * @param Direct_Address_Type The address type of the peer device.
236   * Values:
237   - 0x00: Public Device Address
238   - 0x01: Random Device Address
239   * @param Direct_Address Initiator Bluetooth address
240   * @param Advertising_Interval_Min Minimum advertising interval.
241 Time = N * 0.625 msec.
242   * Values:
243   - 0x0020 (20.000 ms)  ... 0x4000 (10240.000 ms)
244   * @param Advertising_Interval_Max Maximum advertising interval.
245 Time = N * 0.625 msec.
246   * Values:
247   - 0x0020 (20.000 ms)  ... 0x4000 (10240.000 ms)
248   * @retval Value indicating success or error code.
249 */
250 tBleStatus aci_gap_set_direct_connectable(uint8_t Own_Address_Type,
251                                           uint8_t Directed_Advertising_Type,
252                                           uint8_t Direct_Address_Type,
253                                           uint8_t Direct_Address[6],
254                                           uint16_t Advertising_Interval_Min,
255                                           uint16_t Advertising_Interval_Max);
256 
257 /**
258   * @brief Set the IO capabilities of the device. This command has to be given only when the device is
259 not in a connected state.
260   * @param IO_Capability IO capability of the device.
261   * Values:
262   - 0x00: IO_CAP_DISPLAY_ONLY
263   - 0x01: IO_CAP_DISPLAY_YES_NO
264   - 0x02: IO_CAP_KEYBOARD_ONLY
265   - 0x03: IO_CAP_NO_INPUT_NO_OUTPUT
266   - 0x04: IO_CAP_KEYBOARD_DISPLAY
267   * @retval Value indicating success or error code.
268 */
269 tBleStatus aci_gap_set_io_capability(uint8_t IO_Capability);
270 
271 /**
272   * @brief Set the authentication requirements for the device. If the OOB_Enable is set to 0, the
273 following 16 octets of OOB_Data will be ignored on reception. This command has to be
274 given only when the device is not in a connected state.
275   * @param Bonding_Mode Bonding mode.
276 Only if bonding is enabled (0x01), the bonding
277 information is stored in flash
278   * Values:
279   - 0x00: No-bonding mode
280   - 0x01: Bonding mode
281   * @param MITM_Mode MITM mode.
282   * Values:
283   - 0x00: MITM protection not required
284   - 0x01: MITM protection required
285   * @param SC_Support LE Secure connections support
286   * Values:
287   - 0x00: Secure Connections Pairing not supported
288   - 0x01: Secure Connections Pairing supported but optional
289   - 0x02: Secure Connections Pairing supported and mandatory (SC Only Mode)
290   * @param KeyPress_Notification_Support Keypress notification support
291   * Values:
292   - 0x00: Keypress notification not supported
293   - 0x01: Keypress notification supported
294   * @param Min_Encryption_Key_Size Minimum encryption key size to be used during pairing
295   * @param Max_Encryption_Key_Size Maximum encryption key size to be used during pairing
296   * @param Use_Fixed_Pin Use or not fixed pin. If set to 0x00, then during the pairing process
297 the application will not be requested for a pin (Fixed_Pin will be used).
298 If set to 0x01, then during pairing process if a
299 passkey is required the application will be
300 notified
301   * Values:
302   - 0x00: use a fixed pin
303   - 0x01: do not use a fixed pin
304   * @param Fixed_Pin Fixed pin to be used during pairing if MIMT protection is enabled.
305 Any random value between 0 to 999999
306   * Values:
307   - 0 ... 999999
308   * @param Identity_Address_Type Identity address type.
309   * Values:
310   - 0x00: Public Identity Address
311   - 0x01: Random (static) Identity Address
312   * @retval Value indicating success or error code.
313 */
314 tBleStatus aci_gap_set_authentication_requirement(uint8_t Bonding_Mode,
315                                                   uint8_t MITM_Mode,
316                                                   uint8_t SC_Support,
317                                                   uint8_t KeyPress_Notification_Support,
318                                                   uint8_t Min_Encryption_Key_Size,
319                                                   uint8_t Max_Encryption_Key_Size,
320                                                   uint8_t Use_Fixed_Pin,
321                                                   uint32_t Fixed_Pin,
322                                                   uint8_t Identity_Address_Type);
323 
324 /**
325   * @brief Set the authorization requirements of the device. This command has to be given when connected
326 to a device if authorization is required to access services which require authorization.
327   * @param Connection_Handle Connection handle for which the command is given.
328   * Values:
329   - 0x0000 ... 0x0EFF
330   * @param Authorization_Enable Enable the authorization in the device
331 and when a remote device tries to read/write a characteristic with authorization
332 requirements, the stack will send back an error response with
333 "Insufficient authorization" error code. After pairing is complete a
334 ACI_GAP_AUTHORIZATION_REQ_EVENT will be sent to the Host.
335   * Values:
336   - 0x00: Authorization not required
337   - 0x01: Authorization required
338   * @retval Value indicating success or error code.
339 */
340 tBleStatus aci_gap_set_authorization_requirement(uint16_t Connection_Handle,
341                                                  uint8_t Authorization_Enable);
342 
343 /**
344   * @brief This command should be send by the host in response to @ref aci_gap_pass_key_req_event
345 event. The command parameter contains the pass key which will be used during the pairing process.
346   * @param Connection_Handle Connection handle for which the command is given.
347   * Values:
348   - 0x0000 ... 0x0EFF
349   * @param Pass_Key Pass key that will be used during the pairing process.
350 Must be a six-digit decimal number.
351   * Values:
352   - 0 ... 999999
353   * @retval Value indicating success or error code.
354 */
355 tBleStatus aci_gap_pass_key_resp(uint16_t Connection_Handle,
356                                  uint32_t Pass_Key);
357 
358 /**
359   * @brief Authorize a device to access attributes. This command should be send by the host in
360 response to @ref aci_gap_authorization_req_event event.
361   * @param Connection_Handle Connection handle for which the command is given.
362   * Values:
363   - 0x0000 ... 0x0EFF
364   * @param Authorize Authorization response.
365   * Values:
366   - 0x01: Authorize
367   - 0x02: Reject
368   * @retval Value indicating success or error code.
369 */
370 tBleStatus aci_gap_authorization_resp(uint16_t Connection_Handle,
371                                       uint8_t Authorize);
372 
373 /**
374   * @brief Initialize the GAP layer. Register the GAP service with the GATT.
375 All the standard GAP characteristics will also be added:
376 - Device Name
377 - Appearance
378 - Peripheral Preferred Connection Parameters (peripheral role only)
379   * @param Role Bitmap of allowed roles.
380   * Flags:
381   - 0x01: Peripheral
382   - 0x02: Broadcaster
383   - 0x04: Central
384   - 0x08: Observer
385   * @param privacy_enabled Specify if privacy is enabled or not and which one .
386   * Values:
387   - 0x00: Privacy disabled
388   - 0x01: Privacy host enabled
389   - 0x02: Privacy controller enabled
390   * @param device_name_char_len Length of the device name characteristic
391   * @param[out] Service_Handle Handle of the GAP service
392   * @param[out] Dev_Name_Char_Handle Device Name Characteristic handle
393   * @param[out] Appearance_Char_Handle Appearance Characteristic handle
394   * @retval Value indicating success or error code.
395 */
396 tBleStatus aci_gap_init(uint8_t Role,
397                         uint8_t privacy_enabled,
398                         uint8_t device_name_char_len,
399                         uint16_t *Service_Handle,
400                         uint16_t *Dev_Name_Char_Handle,
401                         uint16_t *Appearance_Char_Handle);
402 
403 /**
404   * @brief Put the device into non connectable mode. This mode does not support connection. The
405 privacy setting done in the @ref aci_gap_init command plays a role in deciding the valid
406 parameters for this command.Advertiser filter policy is internally set to 0x00
407   * @param Advertising_Event_Type Advertising type.
408   * Values:
409   - 0x02: ADV_SCAN_IND (Scannable undirected advertising)
410   - 0x03: ADV_NONCONN_IND (Non connectable undirected advertising)
411   * @param Own_Address_Type Own address type:
412  - 0x00: Public Device Address (it is allowed only if privacy is disabled)
413  - 0x01: Random Device Address (it is allowed only if privacy is disabled)
414  - 0x02: Resolvable Private Address (it is allowed only if privacy is enabled)
415  - 0x03: Non Resolvable Private Address (it is allowed only if privacy is enabled)
416   * Values:
417   - 0x00: Public Device Address
418   - 0x01: Random Device Address
419   - 0x02: Resolvable Private Address
420   - 0x03: Non Resolvable Private Address
421   * @retval Value indicating success or error code.
422 */
423 tBleStatus aci_gap_set_non_connectable(uint8_t Advertising_Event_Type,
424                                        uint8_t Own_Address_Type);
425 
426 /**
427   * @brief Put the device into undirected connectable mode.
428 If privacy is enabled in the device, a resolvable private address is generated and used as the
429 advertiser's address. If not, the address of the type specified in own_addr_type is used for
430 advertising.
431   * @param Advertising_Interval_Min Minimum advertising interval.
432 Time = N * 0.625 msec.
433   * Values:
434   - 0x0020 (20.000 ms)  ... 0x4000 (10240.000 ms)
435   * @param Advertising_Interval_Max Maximum advertising interval.
436 Time = N * 0.625 msec.
437   * Values:
438   - 0x0020 (20.000 ms)  ... 0x4000 (10240.000 ms)
439   * @param Own_Address_Type Own address type:
440  - 0x00: Public Device Address (it is allowed only if privacy is disabled)
441  - 0x01: Random Device Address (it is allowed only if privacy is disabled)
442  - 0x02: Resolvable Private Address (it is allowed only if controller privacy is enabled or if Host privacy (i.e. privacy 1.1) is enabled)
443  - 0x03: Non Resolvable Private Address (it is allowed only if Host privacy (i.e. privacy 1.1) is enabled)
444   * Values:
445   - 0x00: Public Device Address
446   - 0x01: Random Device Address
447   - 0x02: Resolvable Private Address
448   - 0x03: Non Resolvable Private Address
449   * @param Adv_Filter_Policy Advertising filter policy.
450   * Values:
451   - 0x00: Allow Scan Request from Any, Allow Connect Request from Any
452   - 0x03: Allow Scan Request from White List Only, Allow Connect Request from White List Only
453   * @retval Value indicating success or error code.
454 */
455 tBleStatus aci_gap_set_undirected_connectable(uint16_t Advertising_Interval_Min,
456                                               uint16_t Advertising_Interval_Max,
457                                               uint8_t Own_Address_Type,
458                                               uint8_t Adv_Filter_Policy);
459 
460 /**
461   * @brief Send a slave security request to the master.
462 This command has to be issued to notify the master of the security requirements of the slave.
463 The master may encrypt the link, initiate the pairing procedure, or reject the request.
464   * @param Connection_Handle Connection handle for which the command is given.
465   * Values:
466   - 0x0000 ... 0x0EFF
467   * @retval Value indicating success or error code.
468 */
469 tBleStatus aci_gap_slave_security_req(uint16_t Connection_Handle);
470 
471 /**
472   * @brief This command can be used to update the advertising data for a particular AD type. If the AD
473 type specified does not exist, then it is added to the advertising data. If the overall
474 advertising data length is more than 31 octets after the update, then the command is
475 rejected and the old data is retained.
476   * @param AdvDataLen Length of AdvData in octets
477   * @param AdvData Advertising data used by the device while advertising.
478   * @retval Value indicating success or error code.
479 */
480 tBleStatus aci_gap_update_adv_data(uint8_t AdvDataLen,
481                                    uint8_t AdvData[]);
482 
483 /**
484   * @brief This command can be used to delete the specified AD type from the advertisement data if
485 present.
486   * @param ADType One of the AD types like in Bluetooth specification (see volume 3, Part C, 11.1)
487   * @retval Value indicating success or error code.
488 */
489 tBleStatus aci_gap_delete_ad_type(uint8_t ADType);
490 
491 /**
492   * @brief This command can be used to get the current security settings of the device.
493   * @param Connection_Handle Connection handle for which the command is given.
494   * Values:
495   - 0x0000 ... 0x0EFF
496   * @param[out] Security_Mode Security mode.
497   * Values:
498   - 0x01: Security Mode 1
499   - 0x02: Security Mode 2
500   * @param[out] Security_Level Security Level.
501   * Values:
502   - 0x01: Security Level 1
503   - 0x02: Security Level 2
504   - 0x03: Security Level 3
505   - 0x04: Security Level 4
506   * @retval Value indicating success or error code.
507 */
508 tBleStatus aci_gap_get_security_level(uint16_t Connection_Handle,
509                                       uint8_t *Security_Mode,
510                                       uint8_t *Security_Level);
511 
512 /**
513   * @brief It allows masking events from the GAP. The default configuration is all the events masked.
514   * @param GAP_Evt_Mask GAP event mask. Default: 0xFFFF.
515   * Flags:
516   - 0x0000: No events
517   - 0x0001: ACI_GAP_LIMITED_DISCOVERABLE_EVENT
518   - 0x0002: ACI_GAP_PAIRING_COMPLETE_EVENT
519   - 0x0004: ACI_GAP_PASS_KEY_REQ_EVENT
520   - 0x0008: ACI_GAP_AUTHORIZATION_REQ_EVENT
521   - 0x0010: ACI_GAP_SLAVE_SECURITY_INITIATED_EVENT
522   - 0x0020: ACI_GAP_BOND_LOST_EVENT
523   - 0x0080: ACI_GAP_PROC_COMPLETE_EVENT
524   - 0x0100: ACI_L2CAP_CONNECTION_UPDATE_REQ_EVENT
525   - 0x0200: ACI_L2CAP_CONNECTION_UPDATE_RESP_EVENT
526   - 0x0400: ACI_L2CAP_PROC_TIMEOUT_EVENT
527   - 0x0800: ACI_GAP_ADDR_NOT_RESOLVED_EVENT
528   * @retval Value indicating success or error code.
529 */
530 tBleStatus aci_gap_set_event_mask(uint16_t GAP_Evt_Mask);
531 
532 /**
533   * @brief Add addresses of bonded devices into the controller's whitelist.
534 The command will return an error if there are no devices in the database or if it was
535 unable to add the device into the whitelist.
536   * @retval Value indicating success or error code.
537 */
538 tBleStatus aci_gap_configure_whitelist(void);
539 
540 /**
541   * @brief Command the controller to terminate the connection.
542 A @ref hci_disconnection_complete_event event will be generated when the link is disconnected. It is important to leave an 100 ms blank window
543 before sending any new command (including system hardware reset), since immediately after @ref hci_disconnection_complete_event event,
544 system could save important information in non volatile memory.
545   * @param Connection_Handle Connection handle for which the command is given.
546   * Values:
547   - 0x0000 ... 0x0EFF
548   * @param Reason The reason for ending the connection.
549   * Values:
550   - 0x05: Authentication Failure
551   - 0x13: Remote User Terminated Connection
552   - 0x14: Remote Device Terminated Connection due to Low Resources
553   - 0x15: Remote Device Terminated Connection due to Power Off
554   - 0x1A: Unsupported Remote Feature
555   - 0x3B: Unacceptable Connection Parameters
556   * @retval Value indicating success or error code.
557 */
558 tBleStatus aci_gap_terminate(uint16_t Connection_Handle,
559                              uint8_t Reason);
560 
561 /**
562   * @brief Clear the security database. All the devices in the security database will be removed.
563   * @retval Value indicating success or error code.
564 */
565 tBleStatus aci_gap_clear_security_db(void);
566 
567 /**
568   * @brief Allows the security manager to complete the pairing procedure and re-bond with the master.
569 This command should be given by the application when it receives the
570 ACI_GAP_BOND_LOST_EVENT if it wants the re-bonding to happen successfully. If this
571 command is not given on receiving the event, the bonding procedure will timeout.
572   * @param Connection_Handle Connection handle for which the command is given.
573   * Values:
574   - 0x0000 ... 0x0EFF
575   * @retval Value indicating success or error code.
576 */
577 tBleStatus aci_gap_allow_rebond(uint16_t Connection_Handle);
578 
579 /**
580   * @brief Start the limited discovery procedure. The controller is commanded to start active scanning.
581 When this procedure is started, only the devices in limited discoverable mode are returned
582 to the upper layers.
583 The procedure is terminated when either the upper layers issue a command to terminate
584 the procedure by issuing the command @ref aci_gap_terminate_gap_proc with the procedure
585 code set to 0x01 or a timeout happens. When the procedure is terminated due to any of the
586 above  reasons, @ref aci_gap_proc_complete_event event is returned with the procedure code
587 set to 0x01.
588 The device found when the procedure is ongoing is returned to the upper layers through the
589 event @ref hci_le_advertising_report_event.
590   * @param LE_Scan_Interval This is defined as the time interval from when the Controller started
591 its last LE scan until it begins the subsequent LE scan.
592 Time = N * 0.625 msec.
593   * Values:
594   - 0x0004 (2.500 ms)  ... 0x4000 (10240.000 ms)
595   * @param LE_Scan_Window Amount of time for the duration of the LE scan. LE_Scan_Window
596 shall be less than or equal to LE_Scan_Interval.
597 Time = N * 0.625 msec.
598   * Values:
599   - 0x0004 (2.500 ms)  ... 0x4000 (10240.000 ms)
600   * @param Own_Address_Type Own address type:
601  - 0x00: Public Device Address (it is allowed only if privacy is disabled)
602  - 0x01: Random Device Address (it is allowed only if privacy is disabled)
603  - 0x02: Resolvable Private Address (it is allowed only if privacy is enabled)
604  - 0x03: Non Resolvable Private Address (it is allowed only if privacy is enabled)
605   * Values:
606   - 0x00: Public Device Address
607   - 0x01: Random Device Address
608   - 0x02: Resolvable Private Address
609   - 0x03: Non Resolvable Private Address
610   * @param Filter_Duplicates Enable/disable duplicate filtering.
611   * Values:
612   - 0x00: Duplicate filtering disabled
613   - 0x01: Duplicate filtering enabled
614   * @retval Value indicating success or error code.
615 */
616 tBleStatus aci_gap_start_limited_discovery_proc(uint16_t LE_Scan_Interval,
617                                                 uint16_t LE_Scan_Window,
618                                                 uint8_t Own_Address_Type,
619                                                 uint8_t Filter_Duplicates);
620 
621 /**
622   * @brief Start the general discovery procedure. The controller is commanded to start active
623 scanning. The procedure is terminated when  either the upper layers issue a command
624 to terminate the procedure by issuing the command @ref aci_gap_terminate_gap_proc
625 with the procedure code set to 0x02 or a timeout happens. When the procedure is
626 terminated due to any of the above reasons, @ref aci_gap_proc_complete_event event
627 is returned with the procedure code set to 0x02. The device found when the procedure
628 is ongoing is returned to @ref hci_le_advertising_report_event.
629   * @param LE_Scan_Interval This is defined as the time interval from when the Controller started
630 its last LE scan until it begins the subsequent LE scan.
631 Time = N * 0.625 msec.
632   * Values:
633   - 0x0004 (2.500 ms)  ... 0x4000 (10240.000 ms)
634   * @param LE_Scan_Window Amount of time for the duration of the LE scan. LE_Scan_Window
635 shall be less than or equal to LE_Scan_Interval.
636 Time = N * 0.625 msec.
637   * Values:
638   - 0x0004 (2.500 ms)  ... 0x4000 (10240.000 ms)
639   * @param Own_Address_Type Own address type:
640  - 0x00: Public Device Address (it is allowed only if privacy is disabled)
641  - 0x01: Random Device Address (it is allowed only if privacy is disabled)
642  - 0x02: Resolvable Private Address (it is allowed only if privacy is enabled)
643  - 0x03: Non Resolvable Private Address (it is allowed only if privacy is enabled)
644   * Values:
645   - 0x00: Public Device Address
646   - 0x01: Random Device Address
647   - 0x02: Resolvable Private Address
648   - 0x03: Non Resolvable Private Address
649   * @param Filter_Duplicates Enable/disable duplicate filtering.
650   * Values:
651   - 0x00: Duplicate filtering disabled
652   - 0x01: Duplicate filtering enabled
653   * @retval Value indicating success or error code.
654 */
655 tBleStatus aci_gap_start_general_discovery_proc(uint16_t LE_Scan_Interval,
656                                                 uint16_t LE_Scan_Window,
657                                                 uint8_t Own_Address_Type,
658                                                 uint8_t Filter_Duplicates);
659 
660 /**
661   * @brief Start the name discovery procedure. A LE_Create_Connection call will be made to the
662 controller by GAP with the initiator filter policy set to "ignore whitelist and process
663 connectable advertising packets only for the specified device". Once a connection is
664 established, GATT procedure is started to read the device name characteristic. When the
665 read is completed (successfully or unsuccessfully), a @ref aci_gap_proc_complete_event
666 event is given to the upper layer. The event also contains the name of the device if the
667 device name was read successfully.
668   * @param LE_Scan_Interval This is defined as the time interval from when the Controller started
669 its last LE scan until it begins the subsequent LE scan.
670 Time = N * 0.625 msec.
671   * Values:
672   - 0x0004 (2.500 ms)  ... 0x4000 (10240.000 ms)
673   * @param LE_Scan_Window Amount of time for the duration of the LE scan. LE_Scan_Window
674 shall be less than or equal to LE_Scan_Interval.
675 Time = N * 0.625 msec.
676   * Values:
677   - 0x0004 (2.500 ms)  ... 0x4000 (10240.000 ms)
678   * @param Peer_Address_Type Address type.
679   * Values:
680   - 0x00: Public Device Address
681   - 0x01: Random Device Address
682   * @param Peer_Address Public Device Address or Random Device Address of the device
683 to be connected.
684   * @param Own_Address_Type Own address type:
685  - 0x00: Public Device Address (it is allowed only if privacy is disabled)
686  - 0x01: Random Device Address (it is allowed only if privacy is disabled)
687  - 0x02: Resolvable Private Address (it is allowed only if privacy is enabled)
688  - 0x03: Non Resolvable Private Address (it is allowed only if privacy is enabled)
689   * Values:
690   - 0x00: Public Device Address
691   - 0x01: Random Device Address
692   - 0x02: Resolvable Private Address
693   - 0x03: Non Resolvable Private Address
694   * @param Conn_Interval_Min Minimum value for the connection event interval. This shall be less
695 than or equal to Conn_Interval_Max.
696 Time = N * 1.25 msec.
697   * Values:
698   - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
699   * @param Conn_Interval_Max Maximum value for the connection event interval. This shall be
700 greater than or equal to Conn_Interval_Min.
701 Time = N * 1.25 msec.
702   * Values:
703   - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
704   * @param Conn_Latency Slave latency for the connection in number of connection events.
705   * Values:
706   - 0x0000 ... 0x01F3
707   * @param Supervision_Timeout Supervision timeout for the LE Link.
708 It shall be a multiple of 10 ms and larger than (1 + connSlaveLatency) * connInterval * 2.
709 Time = N * 10 msec.
710   * Values:
711   - 0x000A (100 ms)  ... 0x0C80 (32000 ms)
712   * @param Minimum_CE_Length Information parameter about the minimum length of connection
713 needed for this LE connection.
714 Time = N * 0.625 msec.
715   * Values:
716   - 0x0000 (0.000 ms)  ... 0xFFFF (40959.375 ms)
717   * @param Maximum_CE_Length Information parameter about the maximum length of connection needed
718 for this LE connection.
719 Time = N * 0.625 msec.
720   * Values:
721   - 0x0000 (0.000 ms)  ... 0xFFFF (40959.375 ms)
722   * @retval Value indicating success or error code.
723 */
724 tBleStatus aci_gap_start_name_discovery_proc(uint16_t LE_Scan_Interval,
725                                              uint16_t LE_Scan_Window,
726                                              uint8_t Peer_Address_Type,
727                                              uint8_t Peer_Address[6],
728                                              uint8_t Own_Address_Type,
729                                              uint16_t Conn_Interval_Min,
730                                              uint16_t Conn_Interval_Max,
731                                              uint16_t Conn_Latency,
732                                              uint16_t Supervision_Timeout,
733                                              uint16_t Minimum_CE_Length,
734                                              uint16_t Maximum_CE_Length);
735 
736 /**
737   * @brief Start the auto connection establishment procedure. The devices specified are added to the
738 white list of the controller and a LE_Create_Connection call will be made to the controller by
739 GAP with the initiator filter policy set to "use whitelist to determine which advertiser to
740 connect to". When a command is issued to terminate the procedure by upper layer, a
741 LE_Create_Connection_Cancel call will be made to the controller by GAP.
742 The procedure is terminated when either a connection is successfully established with one of
743 the specified devices in the white list or the procedure is explicitly terminated by issuing
744 the command @ref aci_gap_terminate_gap_proc with the procedure code set to 0x08. A
745 @ref aci_gap_proc_complete_event event is returned with the procedure code set to 0x08.If controller privacy is enabled and the peer device (advertiser) is in the resolving list then the link layer will generate a RPA, if it is not then the RPA/NRPA generated by the Host will be used;
746   * @param LE_Scan_Interval This is defined as the time interval from when the Controller started
747 its last LE scan until it begins the subsequent LE scan.
748 Time = N * 0.625 msec.
749   * Values:
750   - 0x0004 (2.500 ms)  ... 0x4000 (10240.000 ms)
751   * @param LE_Scan_Window Amount of time for the duration of the LE scan. LE_Scan_Window
752 shall be less than or equal to LE_Scan_Interval.
753 Time = N * 0.625 msec.
754   * Values:
755   - 0x0004 (2.500 ms)  ... 0x4000 (10240.000 ms)
756   * @param Own_Address_Type Own address type:
757  - 0x00: Public Device Address (it is allowed only if privacy is disabled)
758  - 0x01: Random Device Address (it is allowed only if privacy is disabled)
759  - 0x02: Resolvable Private Address (it is allowed only if privacy is enabled)
760  - 0x03: Non Resolvable Private Address (it is allowed only if privacy is enabled)
761   * Values:
762   - 0x00: Public Device Address
763   - 0x01: Random Device Address
764   - 0x02: Resolvable Private Address
765   - 0x03: Non Resolvable Private Address
766   * @param Conn_Interval_Min Minimum value for the connection event interval. This shall be less
767 than or equal to Conn_Interval_Max.
768 Time = N * 1.25 msec.
769   * Values:
770   - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
771   * @param Conn_Interval_Max Maximum value for the connection event interval. This shall be
772 greater than or equal to Conn_Interval_Min.
773 Time = N * 1.25 msec.
774   * Values:
775   - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
776   * @param Conn_Latency Slave latency for the connection in number of connection events.
777   * Values:
778   - 0x0000 ... 0x01F3
779   * @param Supervision_Timeout Supervision timeout for the LE Link.
780 It shall be a multiple of 10 ms and larger than (1 + connSlaveLatency) * connInterval * 2.
781 Time = N * 10 msec.
782   * Values:
783   - 0x000A (100 ms)  ... 0x0C80 (32000 ms)
784   * @param Minimum_CE_Length Information parameter about the minimum length of connection
785 needed for this LE connection.
786 Time = N * 0.625 msec.
787   * Values:
788   - 0x0000 (0.000 ms)  ... 0xFFFF (40959.375 ms)
789   * @param Maximum_CE_Length Information parameter about the maximum length of connection needed
790 for this LE connection.
791 Time = N * 0.625 msec.
792   * Values:
793   - 0x0000 (0.000 ms)  ... 0xFFFF (40959.375 ms)
794   * @param Num_of_Whitelist_Entries Number of devices that have to be added to the whitelist.
795   * @param Whitelist_Entry See @ref Whitelist_Entry_t
796   * @retval Value indicating success or error code.
797 */
798 tBleStatus aci_gap_start_auto_connection_establish_proc(uint16_t LE_Scan_Interval,
799                                                         uint16_t LE_Scan_Window,
800                                                         uint8_t Own_Address_Type,
801                                                         uint16_t Conn_Interval_Min,
802                                                         uint16_t Conn_Interval_Max,
803                                                         uint16_t Conn_Latency,
804                                                         uint16_t Supervision_Timeout,
805                                                         uint16_t Minimum_CE_Length,
806                                                         uint16_t Maximum_CE_Length,
807                                                         uint8_t Num_of_Whitelist_Entries,
808                                                         Whitelist_Entry_t Whitelist_Entry[]);
809 
810 /**
811   * @brief Start a general connection establishment procedure. The host enables scanning in the
812 controller with the scanner filter policy set to "accept all advertising packets" and from the
813 scanning results, all the devices are sent to the upper layer using the event
814 LE_Advertising_Report. The upper layer then has to select one of the devices to which it
815 wants to connect by issuing the command @ref aci_gap_create_connection. If privacy is
816 enabled, then either a private resolvable address or a non resolvable address, based on the
817 address type specified in the command is set as the scanner address but the gap create
818 connection always uses a private resolvable address if the general connection
819 establishment procedure is active.
820 The procedure is terminated when a connection is established or the upper layer terminates
821 the procedure by issuing the command @ref aci_gap_terminate_gap_proc with the procedure
822 code set to 0x10. On completion of the procedure a @ref aci_gap_proc_complete_event event
823 is generated with the procedure code set to 0x10. If controller privacy is enabled and the peer device (advertiser) is in the resolving list then the link layer will generate a RPA, if it is not then the RPA/NRPA generated by the Host will be used;
824   * @param LE_Scan_Type Passive or active scanning. With active scanning SCAN_REQ packets are sent.
825   * Values:
826   - 0x00: Passive Scanning
827   - 0x01: Active scanning
828   * @param LE_Scan_Interval This is defined as the time interval from when the Controller started
829 its last LE scan until it begins the subsequent LE scan.
830 Time = N * 0.625 msec.
831   * Values:
832   - 0x0004 (2.500 ms)  ... 0x4000 (10240.000 ms)
833   * @param LE_Scan_Window Amount of time for the duration of the LE scan. LE_Scan_Window
834 shall be less than or equal to LE_Scan_Interval.
835 Time = N * 0.625 msec.
836   * Values:
837   - 0x0004 (2.500 ms)  ... 0x4000 (10240.000 ms)
838   * @param Own_Address_Type Own address type:
839  - 0x00: Public Device Address (it is allowed only if privacy is disabled)
840  - 0x01: Random Device Address (it is allowed only if privacy is disabled)
841  - 0x02: Resolvable Private Address (it is allowed only if privacy is enabled)
842  - 0x03: Non Resolvable Private Address (it is allowed only if privacy is enabled)
843   * Values:
844   - 0x00: Public Device Address
845   - 0x01: Random Device Address
846   - 0x02: Resolvable Private Address
847   - 0x03: Non Resolvable Private Address
848   * @param Scanning_Filter_Policy Scanning filter policy:
849  - 0x00 Accept all advertisement packets.Directed advertising packets which are not addressed for this device shall be ignored.
850  - 0x01 Ignore advertisement packets from devices not in the White List Only.Directed advertising packets which are not addressed for this device shall be ignored.
851  - 0x02 Accept all undirected advertisement packets (it is allowed only if controller privacy or host privacy is enabled).Directed advertisement packets where initiator address is a RPA and Directed advertisement packets addressed to this device shall be accepted.
852  - 0x03 Accept all undirected advertisement packets from devices that are in the White List.Directed advertisement packets where initiator address is RPA and Directed advertisement packets addressed to this device shall be accepted.
853  - NOTE: if controller privacy is enabled Scanning_Filter_Policy can only assume values 0x00 or 0x02; if Host privacy is enabled Scanning_Filter_Policy can only assume value 0x00.
854   * Values:
855   - 0x00: Accept all
856   - 0x01: Ignore devices not in the White List
857   - 0x02: Accept all (use resolving list)
858   - 0x03: Ignore devices not in the White List (use resolving list)
859   * @param Filter_Duplicates Enable/disable duplicate filtering.
860   * Values:
861   - 0x00: Duplicate filtering disabled
862   - 0x01: Duplicate filtering enabled
863   * @retval Value indicating success or error code.
864 */
865 tBleStatus aci_gap_start_general_connection_establish_proc(uint8_t LE_Scan_Type,
866                                                            uint16_t LE_Scan_Interval,
867                                                            uint16_t LE_Scan_Window,
868                                                            uint8_t Own_Address_Type,
869                                                            uint8_t Scanning_Filter_Policy,
870                                                            uint8_t Filter_Duplicates);
871 
872 /**
873   * @brief Start a selective connection establishment procedure. The GAP adds the specified device
874 addresses into white list and enables scanning in the controller with the scanner filter policy
875 set to "accept packets only from devices in whitelist". All the devices found are sent to the
876 upper layer by the event @ref hci_le_advertising_report_event. The upper layer then has to select one of
877 the devices to which it wants to connect by issuing the command @ref aci_gap_create_connection.
878 On completion of the procedure a @ref aci_gap_proc_complete_event event is generated with
879 the procedure code set to 0x20. The procedure is terminated when a connection is established
880 or the upper layer terminates the procedure by issuing the command
881 @ref aci_gap_terminate_gap_proc with the procedure code set to 0x20.If controller privacy is enabled and the peer device (advertiser) is in the resolving list then the link layer will generate a RPA, if it is not then the RPA/NRPA generated by the Host will be used;
882   * @param LE_Scan_Type Passive or active scanning. With active scanning SCAN_REQ packets are sent.
883   * Values:
884   - 0x00: Passive Scanning
885   - 0x01: Active scanning
886   * @param LE_Scan_Interval This is defined as the time interval from when the Controller started
887 its last LE scan until it begins the subsequent LE scan.
888 Time = N * 0.625 msec.
889   * Values:
890   - 0x0004 (2.500 ms)  ... 0x4000 (10240.000 ms)
891   * @param LE_Scan_Window Amount of time for the duration of the LE scan. LE_Scan_Window
892 shall be less than or equal to LE_Scan_Interval.
893 Time = N * 0.625 msec.
894   * Values:
895   - 0x0004 (2.500 ms)  ... 0x4000 (10240.000 ms)
896   * @param Own_Address_Type Own address type:
897  - 0x00: Public Device Address (it is allowed only if privacy is disabled)
898  - 0x01: Random Device Address (it is allowed only if privacy is disabled)
899  - 0x02: Resolvable Private Address (it is allowed only if privacy is enabled)
900  - 0x03: Non Resolvable Private Address (it is allowed only if privacy is enabled)
901   * Values:
902   - 0x00: Public Device Address
903   - 0x01: Random Device Address
904   - 0x02: Resolvable Private Address
905   - 0x03: Non Resolvable Private Address
906   * @param Scanning_Filter_Policy Scanning filter policy:
907  - 0x00 Accept all advertisement packets.Directed advertising packets which are not addressed for this device shall be ignored.
908  - 0x01 Ignore advertisement packets from devices not in the White List Only.Directed advertising packets which are not addressed for this device shall be ignored.
909  - 0x02 Accept all undirected advertisement packets (it is allowed only if controller privacy or host privacy is enabled).Directed advertisement packets where initiator address is a RPA and Directed advertisement packets addressed to this device shall be accepted.
910  - 0x03 Accept all undirected advertisement packets from devices that are in the White List.Directed advertisement packets where initiator address is RPA and Directed advertisement packets addressed to this device shall be accepted.
911  - NOTE: if controller privacy is enabled Scanning_Filter_Policy can only assume values 0x01 or 0x03; if Host privacy is enabled Scanning_Filter_Policy can only assume value 0x01.
912   * Values:
913   - 0x00: Accept all
914   - 0x01: Ignore devices not in the White List
915   - 0x02: Accept all (use resolving list)
916   - 0x03: Ignore devices not in the White List (use resolving list)
917   * @param Filter_Duplicates Enable/disable duplicate filtering.
918   * Values:
919   - 0x00: Duplicate filtering disabled
920   - 0x01: Duplicate filtering enabled
921   * @param Num_of_Whitelist_Entries Number of devices that have to be added to the whitelist.
922   * @param Whitelist_Entry See @ref Whitelist_Entry_t
923   * @retval Value indicating success or error code.
924 */
925 tBleStatus aci_gap_start_selective_connection_establish_proc(uint8_t LE_Scan_Type,
926                                                              uint16_t LE_Scan_Interval,
927                                                              uint16_t LE_Scan_Window,
928                                                              uint8_t Own_Address_Type,
929                                                              uint8_t Scanning_Filter_Policy,
930                                                              uint8_t Filter_Duplicates,
931                                                              uint8_t Num_of_Whitelist_Entries,
932                                                              Whitelist_Entry_t Whitelist_Entry[]);
933 
934 /**
935   * @brief Start the direct connection establishment procedure. A LE_Create_Connection call will be
936 made to the controller by GAP with the initiator filter policy set to "ignore whitelist and
937 process connectable advertising packets only for the specified device". The procedure can
938 be terminated explicitly by the upper layer by issuing the command
939 @ref aci_gap_terminate_gap_proc. When a command is issued to terminate the
940 procedure by upper layer, a @ref hci_le_create_connection_cancel call will be made to the
941 controller by GAP.
942 On termination of the procedure, a @ref hci_le_connection_complete_event event is returned. The
943 procedure can be explicitly terminated by the upper layer by issuing the command
944 @ref aci_gap_terminate_gap_proc with the procedure_code set to 0x40.If controller privacy is enabled and the peer device (advertiser) is in the resolving list then the link layer will generate a RPA, if it is not then the RPA/NRPA generated by the Host will be used;
945   * @param LE_Scan_Interval This is defined as the time interval from when the Controller started
946 its last LE scan until it begins the subsequent LE scan.
947 Time = N * 0.625 msec.
948   * Values:
949   - 0x0004 (2.500 ms)  ... 0x4000 (10240.000 ms)
950   * @param LE_Scan_Window Amount of time for the duration of the LE scan. LE_Scan_Window
951 shall be less than or equal to LE_Scan_Interval.
952 Time = N * 0.625 msec.
953   * Values:
954   - 0x0004 (2.500 ms)  ... 0x4000 (10240.000 ms)
955   * @param Peer_Address_Type The address type of the peer device.
956   * Values:
957   - 0x00: Public Device Address
958   - 0x01: Random Device Address
959   * @param Peer_Address Public Device Address or Random Device Address of the device
960 to be connected.
961   * @param Own_Address_Type Own address type:
962  - 0x00: Public Device Address (it is allowed only if privacy is disabled)
963  - 0x01: Random Device Address (it is allowed only if privacy is disabled)
964  - 0x02: Resolvable Private Address (it is allowed only if privacy is enabled)
965  - 0x03: Non Resolvable Private Address (it is allowed only if privacy is enabled)
966   * Values:
967   - 0x00: Public Device Address
968   - 0x01: Random Device Address
969   - 0x02: Resolvable Private Address
970   - 0x03: Non Resolvable Private Address
971   * @param Conn_Interval_Min Minimum value for the connection event interval. This shall be less
972 than or equal to Conn_Interval_Max.
973 Time = N * 1.25 msec.
974   * Values:
975   - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
976   * @param Conn_Interval_Max Maximum value for the connection event interval. This shall be
977 greater than or equal to Conn_Interval_Min.
978 Time = N * 1.25 msec.
979   * Values:
980   - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
981   * @param Conn_Latency Slave latency for the connection in number of connection events.
982   * Values:
983   - 0x0000 ... 0x01F3
984   * @param Supervision_Timeout Supervision timeout for the LE Link.
985 It shall be a multiple of 10 ms and larger than (1 + connSlaveLatency) * connInterval * 2.
986 Time = N * 10 msec.
987   * Values:
988   - 0x000A (100 ms)  ... 0x0C80 (32000 ms)
989   * @param Minimum_CE_Length Information parameter about the minimum length of connection
990 needed for this LE connection.
991 Time = N * 0.625 msec.
992   * Values:
993   - 0x0000 (0.000 ms)  ... 0xFFFF (40959.375 ms)
994   * @param Maximum_CE_Length Information parameter about the maximum length of connection needed
995 for this LE connection.
996 Time = N * 0.625 msec.
997   * Values:
998   - 0x0000 (0.000 ms)  ... 0xFFFF (40959.375 ms)
999   * @retval Value indicating success or error code.
1000 */
1001 tBleStatus aci_gap_create_connection(uint16_t LE_Scan_Interval,
1002                                      uint16_t LE_Scan_Window,
1003                                      uint8_t Peer_Address_Type,
1004                                      uint8_t Peer_Address[6],
1005                                      uint8_t Own_Address_Type,
1006                                      uint16_t Conn_Interval_Min,
1007                                      uint16_t Conn_Interval_Max,
1008                                      uint16_t Conn_Latency,
1009                                      uint16_t Supervision_Timeout,
1010                                      uint16_t Minimum_CE_Length,
1011                                      uint16_t Maximum_CE_Length);
1012 
1013 /**
1014   * @brief Terminate the specified GATT procedure. An @ref aci_gap_proc_complete_event event is
1015 returned with the procedure code set to the corresponding procedure.
1016   * @param Procedure_Code GAP procedure bitmap.
1017   * Values:
1018   - 0x00: No events
1019   - 0x01: GAP_LIMITED_DISCOVERY_PROC
1020   - 0x02: GAP_GENERAL_DISCOVERY_PROC
1021   - 0x04: GAP_NAME_DISCOVERY_PROC
1022   - 0x08: GAP_AUTO_CONNECTION_ESTABLISHMENT_PROC
1023   - 0x10: GAP_GENERAL_CONNECTION_ESTABLISHMENT_PROC
1024   - 0x20: GAP_SELECTIVE_CONNECTION_ESTABLISHMENT_PROC
1025   - 0x40: GAP_DIRECT_CONNECTION_ESTABLISHMENT_PROC
1026   - 0x80: GAP_OBSERVATION_PROC
1027   * @retval Value indicating success or error code.
1028 */
1029 tBleStatus aci_gap_terminate_gap_proc(uint8_t Procedure_Code);
1030 
1031 /**
1032   * @brief Start the connection update procedure (only when role is Master). A @ref hci_le_connection_update is called.
1033 On completion of the procedure, an @ref hci_le_connection_update_complete_event event is returned to
1034 the upper layer.
1035   * @param Connection_Handle Connection handle for which the command is given.
1036   * Values:
1037   - 0x0000 ... 0x0EFF
1038   * @param Conn_Interval_Min Minimum value for the connection event interval. This shall be less
1039 than or equal to Conn_Interval_Max.
1040 Time = N * 1.25 msec.
1041   * Values:
1042   - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
1043   * @param Conn_Interval_Max Maximum value for the connection event interval. This shall be
1044 greater than or equal to Conn_Interval_Min.
1045 Time = N * 1.25 msec.
1046   * Values:
1047   - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
1048   * @param Conn_Latency Slave latency for the connection in number of connection events.
1049   * Values:
1050   - 0x0000 ... 0x01F3
1051   * @param Supervision_Timeout Supervision timeout for the LE Link.
1052 It shall be a multiple of 10 ms and larger than (1 + connSlaveLatency) * connInterval * 2.
1053 Time = N * 10 msec.
1054   * Values:
1055   - 0x000A (100 ms)  ... 0x0C80 (32000 ms)
1056   * @param Minimum_CE_Length Information parameter about the minimum length of connection
1057 needed for this LE connection.
1058 Time = N * 0.625 msec.
1059   * Values:
1060   - 0x0000 (0.000 ms)  ... 0xFFFF (40959.375 ms)
1061   * @param Maximum_CE_Length Information parameter about the maximum length of connection needed
1062 for this LE connection.
1063 Time = N * 0.625 msec.
1064   * Values:
1065   - 0x0000 (0.000 ms)  ... 0xFFFF (40959.375 ms)
1066   * @retval Value indicating success or error code.
1067 */
1068 tBleStatus aci_gap_start_connection_update(uint16_t Connection_Handle,
1069                                            uint16_t Conn_Interval_Min,
1070                                            uint16_t Conn_Interval_Max,
1071                                            uint16_t Conn_Latency,
1072                                            uint16_t Supervision_Timeout,
1073                                            uint16_t Minimum_CE_Length,
1074                                            uint16_t Maximum_CE_Length);
1075 
1076 /**
1077   * @brief Send the SM pairing request to start a pairing process. The authentication requirements and
1078 IO capabilities should be set before issuing this command using the
1079 @ref aci_gap_set_io_capability and @ref aci_gap_set_authentication_requirement commands.
1080 A @ref aci_gap_pairing_complete_event event is returned after the pairing process is completed.
1081   * @param Connection_Handle Connection handle for which the command is given.
1082   * Values:
1083   - 0x0000 ... 0x0EFF
1084   * @param Force_Rebond If 1, Pairing request will be sent even if the device was previously bonded,
1085  otherwise pairing request is not sent.
1086   * Values:
1087   - 0x00: NO
1088   - 0x01: YES
1089   * @retval Value indicating success or error code.
1090 */
1091 tBleStatus aci_gap_send_pairing_req(uint16_t Connection_Handle,
1092                                     uint8_t Force_Rebond);
1093 
1094 /**
1095   * @brief This command tries to resolve the address provided with the IRKs present in its database. If
1096 the address is resolved successfully with any one of the IRKs present in the database, it
1097 returns success and also the corresponding public/static random address stored with the
1098 IRK in the database.
1099   * @param Address Address to be resolved
1100   * @param[out] Actual_Address The public or static random address of the peer device, distributed during pairing phase.
1101   * @retval Value indicating success or error code.
1102 */
1103 tBleStatus aci_gap_resolve_private_addr(uint8_t Address[6],
1104                                         uint8_t Actual_Address[6]);
1105 
1106 /**
1107   * @brief This command puts the device into broadcast mode. A privacy enabled device uses either a
1108 resolvable private address or a non-resolvable private address as specified in the
1109 Own_Addr_Type parameter of the command.
1110   * @param Advertising_Interval_Min Minimum advertising interval.
1111 Time = N * 0.625 msec.
1112   * Values:
1113   - 0x0020 (20.000 ms)  ... 0x4000 (10240.000 ms)
1114   * @param Advertising_Interval_Max Maximum advertising interval.
1115 Time = N * 0.625 msec.
1116   * Values:
1117   - 0x0020 (20.000 ms)  ... 0x4000 (10240.000 ms)
1118   * @param Advertising_Type Non connectable advertising type
1119   * Values:
1120   - 0x02: ADV_SCAN_IND (Scannable undirected advertising)
1121   - 0x03: ADV_NONCONN_IND (Non connectable undirected advertising)
1122   * @param Own_Address_Type If Privacy is disabled, then the address can be public or static random.
1123 If Privacy is enabled, then the address can be a resolvable private address or a non-resolvable private address.
1124   * Values:
1125   - 0x00: Public address
1126   - 0x01: Static random address
1127   - 0x02: Resolvable private address
1128   - 0x03: Non-resolvable private address
1129   * @param Adv_Data_Length Length of the advertising data in the advertising packet.
1130   * @param Adv_Data Advertising data used by the device while advertising.
1131   * @param Num_of_Whitelist_Entries Number of devices that have to be added to the whitelist.
1132   * @param Whitelist_Entry See @ref Whitelist_Entry_t
1133   * @retval Value indicating success or error code.
1134 */
1135 tBleStatus aci_gap_set_broadcast_mode(uint16_t Advertising_Interval_Min,
1136                                       uint16_t Advertising_Interval_Max,
1137                                       uint8_t Advertising_Type,
1138                                       uint8_t Own_Address_Type,
1139                                       uint8_t Adv_Data_Length,
1140                                       uint8_t Adv_Data[],
1141                                       uint8_t Num_of_Whitelist_Entries,
1142                                       Whitelist_Entry_t Whitelist_Entry[]);
1143 
1144 /**
1145   * @brief Starts an Observation procedure, when the device is in Observer Role. The host enables
1146 scanning in the controller. The advertising reports are sent to the upper layer using standard
1147 LE Advertising Report Event. (See Bluetooth Core v5.0, Vol. 2, part E, Ch. 7.7.65.2, LE
1148 Advertising Report Event). If controller privacy is enabled and the peer device (advertiser) is in the resolving list then the link layer will generate a RPA, if it is not then the RPA/NRPA generated by the Host will be used;
1149   * @param LE_Scan_Interval This is defined as the time interval from when the Controller started
1150 its last LE scan until it begins the subsequent LE scan.
1151 Time = N * 0.625 msec.
1152   * Values:
1153   - 0x0004 (2.500 ms)  ... 0x4000 (10240.000 ms)
1154   * @param LE_Scan_Window Amount of time for the duration of the LE scan. LE_Scan_Window
1155 shall be less than or equal to LE_Scan_Interval.
1156 Time = N * 0.625 msec.
1157   * Values:
1158   - 0x0004 (2.500 ms)  ... 0x4000 (10240.000 ms)
1159   * @param LE_Scan_Type Passive or active scanning. With active scanning SCAN_REQ packets are sent.
1160   * Values:
1161   - 0x00: Passive Scanning
1162   - 0x01: Active scanning
1163   * @param Own_Address_Type Own address type:
1164  - 0x00: Public Device Address (it is allowed only if privacy is disabled)
1165  - 0x01: Random Device Address (it is allowed only if privacy is disabled)
1166  - 0x02: Resolvable Private Address (it is allowed only if privacy is enabled)
1167  - 0x03: Non Resolvable Private Address (it is allowed only if privacy is enabled)
1168   * Values:
1169   - 0x00: Public Device Address
1170   - 0x01: Random Device Address
1171   - 0x02: Resolvable Private Address
1172   - 0x03: Non Resolvable Private Address
1173   * @param Filter_Duplicates Enable/disable duplicate filtering.
1174   * Values:
1175   - 0x00: Duplicate filtering disabled
1176   - 0x01: Duplicate filtering enabled
1177   * @param Scanning_Filter_Policy Scanning filter policy:
1178  - 0x00 Accept all advertisement packets (it is allowed only if controller privacy is enabled).Directed advertising packets which are not addressed for this device shall be ignored.
1179  - 0x01 Ignore advertisement packets from devices not in the White List Only.Directed advertising packets which are not addressed for this device shall be ignored.
1180  - 0x02 Accept all undirected advertisement packets (it is allowed only if controller privacy or host privacy is enabled).Directed advertisement packets where initiator address is a RPA and Directed advertisement packets addressed to this device shall be accepted.
1181  - 0x03 Accept all undirected advertisement packets from devices that are in the White List.Directed advertisement packets where initiator address is RPA and Directed advertisement packets addressed to this device shall be accepted.
1182  - NOTE: If Host privacy is enabled Scanning_Filter_Policy can only take values 0x00 or 0x01;
1183   * Values:
1184   - 0x00: Accept all
1185   - 0x01: Ignore devices not in the White List
1186   - 0x02: Accept all (use resolving list)
1187   - 0x03: Ignore devices not in the White List (use resolving list)
1188   * @retval Value indicating success or error code.
1189 */
1190 tBleStatus aci_gap_start_observation_proc(uint16_t LE_Scan_Interval,
1191                                           uint16_t LE_Scan_Window,
1192                                           uint8_t LE_Scan_Type,
1193                                           uint8_t Own_Address_Type,
1194                                           uint8_t Filter_Duplicates,
1195                                           uint8_t Scanning_Filter_Policy);
1196 
1197 /**
1198   * @brief This command gets the list of the devices which are bonded. It returns the
1199 number of addresses and the corresponding address types and values.
1200   * @param[out] Num_of_Addresses The number of bonded devices
1201   * @param[out] Bonded_Device_Entry See @ref Bonded_Device_Entry_t
1202   * @retval Value indicating success or error code.
1203 */
1204 tBleStatus aci_gap_get_bonded_devices(uint8_t *Num_of_Addresses,
1205                                       Bonded_Device_Entry_t Bonded_Device_Entry[]);
1206 
1207 /**
1208   * @brief The command finds whether the device, whose address is specified in the command, is
1209 bonded. If the device is using a resolvable private address and it has been bonded, then the
1210 command will return BLE_STATUS_SUCCESS.
1211   * @param Peer_Address_Type Address type.
1212   * Values:
1213   - 0x00: Public Device Address
1214   - 0x01: Random Device Address
1215   * @param Peer_Address Address used by the peer device while advertising
1216   * @retval Value indicating success or error code.
1217 */
1218 tBleStatus aci_gap_is_device_bonded(uint8_t Peer_Address_Type,
1219                                     uint8_t Peer_Address[6]);
1220 
1221 /**
1222   * @brief This command allows the User to validate/confirm or not the Numeric Comparison value showed through the ACI_GAP_Numeric_Comparison_Value_Event.
1223   * @param Connection_Handle Connection handle for which the command is given.
1224   * Values:
1225   - 0x0000 ... 0x0EFF
1226   * @param Confirm_Yes_No 0 : The Numeric Values showed on both local and peer device are different!
1227 1 : The Numeric Values showed on both local and peer device are equal!
1228   * Values:
1229   - 0x00: No
1230   - 0x01: YES
1231   * @retval Value indicating success or error code.
1232 */
1233 tBleStatus aci_gap_numeric_comparison_value_confirm_yesno(uint16_t Connection_Handle,
1234                                                           uint8_t Confirm_Yes_No);
1235 
1236 /**
1237   * @brief This command permits to signal to the Stack the input type detected during Passkey input.
1238   * @param Connection_Handle Connection handle for which the command is given.
1239   * Values:
1240   - 0x0000 ... 0x0EFF
1241   * @param Input_Type Passkey input type detected
1242   * Values:
1243   - 0x00: Passkey entry started
1244   - 0x01: Passkey digit entered
1245   - 0x02: Passkey digit erased
1246   - 0x03: Passkey cleared
1247   - 0x04: Passkey entry completed
1248   * @retval Value indicating success or error code.
1249 */
1250 tBleStatus aci_gap_passkey_input(uint16_t Connection_Handle,
1251                                  uint8_t Input_Type);
1252 
1253 /**
1254   * @brief This command is sent by the User to get (i.e. to extract from the Stack) the OOB data generated by the Stack itself.
1255   * @param OOB_Data_Type OOB Data type
1256   * Values:
1257   - 0x00: TK (LP v.4.1)
1258   - 0x01: Random (SC v.4.2)
1259   - 0x02: Confirm (SC v.4.2)
1260   * @param[out] Address_Type Identity address type.
1261   * Values:
1262   - 0x00: Public Identity Address
1263   - 0x01: Random (static) Identity Address
1264   * @param[out] Address Public or Random (static) address of this  device
1265   * @param[out] OOB_Data_Len Length of OOB Data
1266   * @param[out] OOB_Data Local Pairing Data intended to the remote device to be sent via OOB.
1267   * @retval Value indicating success or error code.
1268 */
1269 tBleStatus aci_gap_get_oob_data(uint8_t OOB_Data_Type,
1270                                 uint8_t *Address_Type,
1271                                 uint8_t Address[6],
1272                                 uint8_t *OOB_Data_Len,
1273                                 uint8_t OOB_Data[16]);
1274 
1275 /**
1276   * @brief This command is sent (by the User) to input the OOB data arrived via OOB communication.
1277   * @param Device_Type OOB Device type
1278   * Values:
1279   - 0x00: Local device
1280   - 0x01: Remote device
1281   * @param Address_Type Identity address type.
1282   * Values:
1283   - 0x00: Public Identity Address
1284   - 0x01: Random (static) Identity Address
1285   * @param Address Public or Random (static) address of the peer device
1286   * @param OOB_Data_Type OOB Data type
1287   * Values:
1288   - 0x00: TK (LP v.4.1)
1289   - 0x01: Random (SC v.4.2)
1290   - 0x02: Confirm (SC v.4.2)
1291   * @param OOB_Data_Len Length of OOB Data
1292   * @param OOB_Data Pairing Data received through OOB from remote device
1293   * @retval Value indicating success or error code.
1294 */
1295 tBleStatus aci_gap_set_oob_data(uint8_t Device_Type,
1296                                 uint8_t Address_Type,
1297                                 uint8_t Address[6],
1298                                 uint8_t OOB_Data_Type,
1299                                 uint8_t OOB_Data_Len,
1300                                 uint8_t OOB_Data[16]);
1301 
1302 /**
1303   * @brief This  command is used to add one device to the list of address translations used to resolve Resolvable Private Addresses in the Controller.
1304   * @param Num_of_Resolving_list_Entries Number of devices that have to be added to the resolving list.
1305   * @param Whitelist_Identity_Entry See @ref Whitelist_Identity_Entry_t
1306   * @param Clear_Resolving_List Clear the resolving list
1307   * @retval Value indicating success or error code.
1308 */
1309 tBleStatus aci_gap_add_devices_to_resolving_list(uint8_t Num_of_Resolving_list_Entries,
1310                                                  Whitelist_Identity_Entry_t Whitelist_Identity_Entry[],
1311                                                  uint8_t Clear_Resolving_List);
1312 
1313 /**
1314   * @brief This command is used to remove a specified device from bonding table
1315   * @param Peer_Identity_Address_Type Identity address type.
1316   * Values:
1317   - 0x00: Public Identity Address
1318   - 0x01: Random (static) Identity Address
1319   * @param Peer_Identity_Address Public or Random (static) Identity address of the peer device
1320   * @retval Value indicating success or error code.
1321 */
1322 tBleStatus aci_gap_remove_bonded_device(uint8_t Peer_Identity_Address_Type,
1323                                         uint8_t Peer_Identity_Address[6]);
1324 
1325 /**
1326      * @}
1327      */
1328 
1329 #endif /* ! BLE_GAP_ACI_H__ */
1330