1 /**
2   ******************************************************************************
3   * @file    ble_api.h
4   * @author  GPM WBL Application Team
5   * @brief   Header file for Bluetooth Low Energy stack APIs.
6   *          Autogenerated files, do not edit!!
7   ******************************************************************************
8   * @attention
9   *
10   * Copyright (c) 2024 STMicroelectronics.
11   * All rights reserved.
12   *
13   * This software is licensed under terms that can be found in the LICENSE file
14   * in the root directory of this software component.
15   * If no LICENSE file comes with this software, it is provided AS-IS.
16   *
17   ******************************************************************************
18   */
19 
20 #ifndef _BLE_API_H_
21 #define _BLE_API_H_
22 
23 #include "ble_gatt.h"
24 #include <stdint.h>
25 #include "ble_status.h"
26 
27 /** Documentation for C struct Advertising_Set_Parameters_t */
28 typedef struct Advertising_Set_Parameters_t_s {
29   /** It is used to identify an advertising set.
30    *  Values:
31    *  - 0x00 ... 0xEF
32    */
33   uint8_t Advertising_Handle;
34   /** The Duration[i] parameter indicates the duration for which that advertising set
35    *  is enabled. The duration begins at the start of the first advertising
36    *  event of this advertising set. The Controller should not start an extended
37    *  advertising event that it cannot complete within the duration. Time = N *
38    *  10 ms 0x00 means no advertising duration: advertising will continue until
39    *  the Host disables it.
40    *  Values:
41    *  - 0x0000 (0 ms) : No advertising duration
42    *  - 0x0001 (10 ms)  ... 0xFFFF (655350 ms)
43    */
44   uint16_t Duration;
45   /** The Max_Extended_Advertising_Events[i] parameter, if non-zero, indicates the
46    *  maximum number of extended advertising events that shall be sent prior to
47    *  disabling the extended advertising set even if the Duration[i] parameter
48    *  has not expired.
49    *  Values:
50    *  - 0x00: No maximum number of advertising events.
51    *  - 0x01 ... 0xFF: Maximum number of extended advertising events.
52    */
53   uint8_t Max_Extended_Advertising_Events;
54 } Advertising_Set_Parameters_t;
55 
56 /** Documentation for C struct Extended_Scan_Parameters_t */
57 typedef struct Extended_Scan_Parameters_t_s {
58   /** The Scan_Type parameter specifies the type of scan to perform. 0: Passive
59    *  Scanning. No scan request PDUs shall be sent. 1: Active Scanning. Scan
60    *  request PDUs may be sent.
61    *  Values:
62    *  - 0x00: Passive Scanning
63    *  - 0x01: Active Scanning
64    */
65   uint8_t Scan_Type;
66   /** Time interval from when the Controller started its last scan until it begins the
67    *  subsequent scan on the primary advertising channel.  Time = N * 0.625 ms
68    *  Values:
69    *  - 0x0004 (2.500 ms)  ... 0xFFFF (40959.375 ms)
70    */
71   uint16_t Scan_Interval;
72   /** Duration of the scan on the primary advertising channel.  Time = N * 0.625 ms
73    *  Values:
74    *  - 0x0004 (2.500 ms)  ... 0xFFFF (40959.375 ms)
75    */
76   uint16_t Scan_Window;
77 } Extended_Scan_Parameters_t;
78 
79 /** Documentation for C struct Extended_Create_Connection_Parameters_t */
80 typedef struct Extended_Create_Connection_Parameters_t_s {
81   /** Time interval from when the Controller started its last scan until it begins the
82    *  subsequent scan on the primary advertising channel. Time = N * 0.625 ms;
83    *  Time Range: 2.5 ms to 40.959375 s.
84    *  Values:
85    *  - 0x0004 (2.500 ms)  ... 0xFFFF (40959.375 ms)
86    */
87   uint16_t Scan_Interval;
88   /** Duration of the scan on the primary advertising channel. Time = N * 0.625 ms;
89    *  Time Range: 2.5 ms to 40.959375 s.
90    *  Values:
91    *  - 0x0004 (2.500 ms)  ... 0xFFFF (40959.375 ms)
92    */
93   uint16_t Scan_Window;
94   /** Minimum value for the connection interval. This shall be less than or equal to
95    *  Connection_Interval_Max[i]. Time = N * 1.25 ms; Time Range: 7.5 ms to 4 s.
96    *  Values:
97    *  - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
98    */
99   uint16_t Connection_Interval_Min;
100   /** Maximum value for the connection interval. This shall be less than or equal to
101    *  Connection_Interval_Max[i]. Time = N * 1.25 ms; Time Range: 7.5 ms to 4 s.
102    *  Values:
103    *  - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
104    */
105   uint16_t Connection_Interval_Max;
106   /** Peripheral latency for the connection in number of connection events
107    *  Values:
108    *  - 0x0000 ... 0x01F3
109    */
110   uint16_t Max_Latency;
111   /** Supervision timeout for the LE Link. (See [Vol 6] Part B, Section 4.5.2) Time =
112    *  N * 10 ms; Time Range: 100 ms to 32 s.
113    *  Values:
114    *  - 0x000A (100 ms)  ... 0x0C80 (32000 ms)
115    */
116   uint16_t Supervision_Timeout;
117   /** Informative parameter recommending the minimum length of connection event needed
118    *  for this LE connection. Time = N * 0.625 ms.
119    *  Values:
120    *  - 0x0000 (0.000 ms)  ... 0xFFFF (40959.375 ms)
121    */
122   uint16_t Min_CE_Length;
123   /** Informative parameter recommending the maximum length of connection event needed
124    *  for this LE connection. Time = N * 0.625 ms.
125    *  Values:
126    *  - 0x0000 (0.000 ms)  ... 0xFFFF (40959.375 ms)
127    */
128   uint16_t Max_CE_Length;
129 } Extended_Create_Connection_Parameters_t;
130 
131 /** Documentation for C struct CIS_Param_t */
132 typedef struct CIS_Param_t_s {
133   /** Used to identify a CIS.
134    *  Values:
135    *  - 0x00 ... 0xEF
136    */
137   uint8_t CIS_ID;
138   /** Maximum size, in octets, of the payload from the Central's Host.
139    *  Values:
140    *  - 0x0000 ... 0x0FFF
141    */
142   uint16_t Max_SDU_C_To_P;
143   /** Maximum size, in octets, of the payload from the Peripheral's Host.
144    *  Values:
145    *  - 0x0000 ... 0x0FFF
146    */
147   uint16_t Max_SDU_P_To_C;
148   /** PHY to use for transmission from the Central to the Peripheral.
149    *  Flags:
150    *  - 0x01: LE_1M_PHY_BIT
151    *  - 0x02: LE_2M_PHY_BIT
152    *  - 0x04: LE_CODED_PHY_BIT
153    */
154   uint8_t PHY_C_To_P;
155   /** PHY to use for transmission from the Peripheral to the Central.
156    *  Flags:
157    *  - 0x01: LE_1M_PHY_BIT
158    *  - 0x02: LE_2M_PHY_BIT
159    *  - 0x04: LE_CODED_PHY_BIT
160    */
161   uint8_t PHY_P_To_C;
162   /** Number of times every CIS Data PDU should be retransmitted from the Central to
163    *  the Peripheral.
164    */
165   uint8_t RTN_C_To_P;
166   /** Number of times every CIS Data PDU should be retransmitted from the Peripheral
167    *  to the Central.
168    */
169   uint8_t RTN_P_To_C;
170 } CIS_Param_t;
171 
172 /** Documentation for C struct CIS_Param_Test_t */
173 typedef struct CIS_Param_Test_t_s {
174   /** Used to identify a CIS.
175    *  Values:
176    *  - 0x00 ... 0xEF
177    */
178   uint8_t CIS_ID;
179   /** Maximum number of subevents in each CIS event.
180    *  Values:
181    *  - 0x01 ... 0x1F
182    */
183   uint8_t NSE;
184   /** Maximum size, in octets, of the payload from the Central's Host.
185    *  Values:
186    *  - 0x0000 ... 0x0FFF
187    */
188   uint16_t Max_SDU_C_To_P;
189   /** Maximum size, in octets, of the payload from the Peripheral's Host.
190    *  Values:
191    *  - 0x0000 ... 0x0FFF
192    */
193   uint16_t Max_SDU_P_To_C;
194   /** Maximum size, in octets, of the payload from the Central's Link Layer to the
195    *  Peripheral's Link Layer.
196    *  Values:
197    *  - 0x0000 ... 0x00FB
198    */
199   uint16_t Max_PDU_C_To_P;
200   /** Maximum size, in octets, of the payload from the Peripheral's Link Layer to the
201    *  Central's Link Layer.
202    *  Values:
203    *  - 0x0000 ... 0x00FB
204    */
205   uint16_t Max_PDU_P_To_C;
206   /** PHY to use for transmission from the Central to the Peripheral.
207    *  Flags:
208    *  - 0x01: LE_1M_PHY_BIT
209    *  - 0x02: LE_2M_PHY_BIT
210    *  - 0x04: LE_CODED_PHY_BIT
211    */
212   uint8_t PHY_C_To_P;
213   /** PHY to use for transmission from the Peripheral to the Central.
214    *  Flags:
215    *  - 0x01: LE_1M_PHY_BIT
216    *  - 0x02: LE_2M_PHY_BIT
217    *  - 0x04: LE_CODED_PHY_BIT
218    */
219   uint8_t PHY_P_To_C;
220   /** The burst number for Central to Peripheral.
221    *  Values:
222    *  - 0x00: No data
223    *  - 0x01 ... 0x0F
224    */
225   uint8_t BN_C_To_P;
226   /** The burst number for Peripheral to Central.
227    *  Values:
228    *  - 0x00: No data
229    *  - 0x01 ... 0x0F
230    */
231   uint8_t BN_P_To_C;
232 } CIS_Param_Test_t;
233 
234 /** Documentation for C struct CIS_Handles_t */
235 typedef struct CIS_Handles_t_s {
236   /** Connection handle of a CIS.
237    *  Values:
238    *  - 0x0000 ... 0x0EFF
239    */
240   uint16_t CIS_Connection_Handle;
241   /** Connection handle of an ACL connection.
242    *  Values:
243    *  - 0x0000 ... 0x0EFF
244    */
245   uint16_t ACL_Connection_Handle;
246 } CIS_Handles_t;
247 
248 /** Documentation for C struct Bonded_Device_Entry_t */
249 typedef struct Bonded_Device_Entry_t_s {
250   /** Address type.
251    *  Values:
252    *  - 0x00: Public Device Address
253    *  - 0x01: Random Device Address
254    */
255   uint8_t Address_Type;
256   /** Identity Address (Public or Random) of the device.
257    */
258   uint8_t Address[6];
259 } Bonded_Device_Entry_t;
260 
261 /** Documentation for C struct List_Entry_t */
262 typedef struct List_Entry_t_s {
263   /** Address type.
264    *  Values:
265    *  - 0x00: Public Device Address
266    *  - 0x01: Random Device Address
267    */
268   uint8_t Peer_Address_Type;
269   /** Public Device Address or Random Device Address of the device to be added to the
270    *  list.
271    */
272   uint8_t Peer_Address[6];
273 } List_Entry_t;
274 
275 /** Documentation for C union UUID_t */
276 typedef union UUID_t_s {
277   /** 16-bit UUID
278    */
279   uint16_t UUID_16;
280   /** 128-bit UUID
281    */
282   uint8_t UUID_128[16];
283 } UUID_t;
284 
285 /** Documentation for C struct Gatt_Srv_Notify_Attr_t */
286 typedef struct Gatt_Srv_Notify_Attr_t_s {
287   /**
288    */
289   uint16_t Handle;
290   /**
291    */
292   uint16_t Val_Length;
293   /**
294    */
295   uint8_t *Val;
296 } Gatt_Srv_Notify_Attr_t;
297 
298 /** Documentation for C struct Subevent_Data_Ptr_Parameters_t */
299 typedef struct Subevent_Data_Ptr_Parameters_t_s {
300   /** The number of octets in the Subevent_Data parameter.
301    *  Values:
302    *  - 0x00 ... 0xFB
303    */
304   uint8_t Subevent;
305   /** The number of response slots to be used.
306    */
307   uint8_t Response_Slot_Start;
308   /** The number of response slots to be used.
309    */
310   uint8_t Response_Slot_Count;
311   /** The number of octets in buffer pointed by Subevent_Data parameter.
312    *  Values:
313    *  - 0x00 ... 0xFB
314    */
315   uint8_t Subevent_Data_Length;
316   /** Pointer to advertising data formatted as defined in [Vol 3] Part C, Section 11.
317    */
318   uint8_t* Subevent_Data;
319 } Subevent_Data_Ptr_Parameters_t;
320 
321 
322 /**
323  *@addtogroup HCI HCI
324  *@brief Host Controller Interface.
325  *@{
326  */
327 /**
328  *@defgroup HCI_Commands HCI Commands
329  *@brief  Standard HCI Commands.
330  *@{
331  */
332 /**
333  * @brief The @ref hci_disconnect is used to terminate an existing connection.
334  *        The Connection_Handle command parameter indicates which connection is
335  *        to be disconnected. The Reason command parameter indicates the reason
336  *        for ending the connection. The remote Controller will receive the
337  *        Reason command parameter in the @ref hci_disconnection_complete_event
338  *        event. All synchronous connections on a physical link should be
339  *        disconnected before the ACL connection on the same physical connection
340  *        is disconnected. (See Bluetooth Specification v.4.1, Vol. 2, Part E,
341  *        7.1.6) It is important to leave an 100 ms blank window before sending
342  *        any new command (including system hardware reset), since immediately
343  *        after @ref hci_disconnection_complete_event event, system could save
344  *        important information in non volatile memory.
345  * @param Connection_Handle Connection handle that identifies the connection.
346  *        Values:
347  *        - 0x0000 ... 0x0EFF
348  * @param Reason The reason for ending the connection.
349  *        Values:
350  *        - 0x05: Authentication Failure
351  *        - 0x13: Remote User Terminated Connection
352  *        - 0x14: Remote Device Terminated Connection due to Low Resources
353  *        - 0x15: Remote Device Terminated Connection due to Power Off
354  *        - 0x1A: Unsupported Remote Feature
355  *        - 0x3B: Unacceptable Connection Parameters
356  * @retval Value indicating success or error code.
357  */
358 tBleStatus hci_disconnect(uint16_t Connection_Handle,
359                           uint8_t Reason);
360 /**
361  * @brief This command will obtain the values for the version information for
362  *        the remote device identified by the Connection_Handle parameter. The
363  *        Connection_Handle must be a Connection_Handle for an ACL or LE
364  *        connection. (See Bluetooth Specification v.4.1, Vol. 2, Part E,
365  *        7.1.23)
366  * @param Connection_Handle Specifies which Connection_Handle's version
367  *        information to get.
368  *        Values:
369  *        - 0x0000 ... 0x0EFF
370  * @retval Value indicating success or error code.
371  */
372 tBleStatus hci_read_remote_version_information(uint16_t Connection_Handle);
373 /**
374  * @brief The Set_Event_Mask command is used to control which events are
375  *        generated by the HCI for the Host.  If the bit in the Event_Mask is
376  *        set to a one, then the event associated with that bit will be enabled.
377  *        For an LE Controller, the LE Meta Event bit in the Event_Mask shall
378  *        enable or disable all LE events in the LE Meta Event (see Section
379  *        7.7.65). The Host has to deal with each event that occurs. The event
380  *        mask allows the Host to control how much it is interrupted. (See
381  *        Bluetooth Specification v.4.1, Vol. 2, Part E, 7.3.1)
382  * @param Event_Mask Event mask. Default: 0x00001FFFFFFFFFFF
383  *        Flags:
384  *        - 0x0000000000000000: No events specified
385  *        - 0x0000000000000001: Inquiry Complete Event
386  *        - 0x0000000000000002: Inquiry Result Event
387  *        - 0x0000000000000004: Connection Complete Event
388  *        - 0x0000000000000008: Connection Request Event
389  *        - 0x0000000000000010: Disconnection Complete Event
390  *        - 0x0000000000000020: Authentication Complete Event
391  *        - 0x0000000000000040: Remote Name Request Complete Event
392  *        - 0x0000000000000080: Encryption Change Event
393  *        - 0x0000000000000100: Change Connection Link Key Complete Event
394  *        - 0x0000000000000200: Central Link Key Complete Event
395  *        - 0x0000000000000400: Read Remote Supported Features Complete Event
396  *        - 0x0000000000000800: Read Remote Version Information Complete Event
397  *        - 0x0000000000001000: QoS Setup Complete Event
398  *        - 0x0000000000008000: Hardware Error Event
399  *        - 0x0000000000010000: Flush Occurred Event
400  *        - 0x0000000000020000: Role Change Event
401  *        - 0x0000000000080000: Mode Change Event
402  *        - 0x0000000000100000: Return Link Keys Event
403  *        - 0x0000000000200000: PIN Code Request Event
404  *        - 0x0000000000400000: Link Key Request Event
405  *        - 0x0000000000800000: Link Key Notification Event
406  *        - 0x0000000001000000: Loopback Command Event
407  *        - 0x0000000002000000: Data Buffer Overflow Event
408  *        - 0x0000000004000000: Max Slots Change Event
409  *        - 0x0000000008000000: Read Clock Offset Complete Event
410  *        - 0x0000000010000000: Connection Packet Type Changed Event
411  *        - 0x0000000020000000: QoS Violation Event
412  *        - 0x0000000040000000: Page Scan Mode Change Event
413  *        - 0x0000000080000000: Page Scan Repetition Mode Change Event
414  *        - 0x0000000100000000: Flow Specification Complete Event
415  *        - 0x0000000200000000: Inquiry Result with RSSI Event
416  *        - 0x0000000400000000: Read Remote Extended Features Complete Event
417  *        - 0x0000080000000000: Synchronous Connection Complete Event
418  *        - 0x0000100000000000: Synchronous Connection Changed Event
419  *        - 0x0000200000000000: Sniff Subrating Event
420  *        - 0x0000400000000000: Extended Inquiry Result Event
421  *        - 0x0000800000000000: Encryption Key Refresh Complete Event
422  *        - 0x0001000000000000: IO Capability Request Event
423  *        - 0x0002000000000000: IO Capability Request Reply Event
424  *        - 0x0004000000000000: User Confirmation Request Event
425  *        - 0x0008000000000000: User Passkey Request Event
426  *        - 0x0010000000000000: Remote OOB Data Request Event
427  *        - 0x0020000000000000: Simple Pairing Complete Event
428  *        - 0x0080000000000000: Link Supervision Timeout Changed Event
429  *        - 0x0100000000000000: Enhanced Flush Complete Event
430  *        - 0x0400000000000000: User Passkey Notification Event
431  *        - 0x0800000000000000: Keypress Notification Event
432  *        - 0x1000000000000000: Remote Host Supported Features Notification Event
433  *        - 0x2000000000000000: LE Meta-Event
434  * @retval Value indicating success or error code.
435  */
436 tBleStatus hci_set_event_mask(uint8_t Event_Mask[8]);
437 /**
438  * @brief The HCI_Read_Connection_Accept_Timeout command will read the value for
439  *        the Connection Accept Timeout configuration parameter, which allows
440  *        the Controller to automatically deny a connection request after a
441  *        specified period has occurred, and to refuse a new connection.
442  * @param[out] Connection_Accept_Timeout Connection Accept Timeout. Interval
443  *             Length = N * 0.625 ms
444  *             Values:
445  *             - 0x0001 (0.625 ms)  ... 0xB540 (29000.000 ms)
446  * @retval Value indicating success or error code.
447  */
448 tBleStatus hci_read_connection_accept_timeout(uint16_t *Connection_Accept_Timeout);
449 /**
450  * @brief The HCI_Write_Connection_Accept_Timeout command will write the value
451  *        for the Connection Accept Timeout configuration parameter, which
452  *        allows the Controller to automatically deny a connection request after
453  *        a specified period has occurred, and to refuse a new connection.
454  * @param Connection_Accept_Timeout Connection Accept Timeout. Interval Length =
455  *        N * 0.625 ms Default: 0x1FA0 Time = 5.06 s Mandatory Range for
456  *        Controller: 0x00A0 to 0xB540
457  *        Values:
458  *        - 0x0001 (0.625 ms)  ... 0xB540 (29000.000 ms)
459  * @retval Value indicating success or error code.
460  */
461 tBleStatus hci_write_connection_accept_timeout(uint16_t Connection_Accept_Timeout);
462 /**
463  * @brief This command reads the values for the Transmit_Power_Level parameter
464  *        for the specified Connection_Handle. The Connection_Handle shall be a
465  *        Connection_Handle for an ACL connection. (See Bluetooth Specification
466  *        v.4.1, Vol. 2, Part E, 7.3.35)
467  * @param Connection_Handle Specifies which Connection_Handle's Transmit Power
468  *        Level setting to read.
469  *        Values:
470  *        - 0x0000 ... 0x0EFF
471  * @param Type Current or maximum transmit power level.
472  *        Values:
473  *        - 0x00: Read Current Transmit Power Level.
474  *        - 0x01: Read Maximum Transmit Power Level.
475  * @param[out] Transmit_Power_Level Size: 1 Octet (signed integer) Units: dBm
476  *             Values:
477  *             - -30 ... 20
478  * @retval Value indicating success or error code.
479  */
480 tBleStatus hci_read_transmit_power_level(uint16_t Connection_Handle,
481                                          uint8_t Type,
482                                          int8_t *Transmit_Power_Level);
483 /**
484  * @brief The HCI_Read_AFH_Channel_Assessment_Mode command reads the value for
485  *        the AFH_Channel_Assessment_Mode parameter. The
486  *        AFH_Channel_Assessment_Mode parameter controls whether the
487  *        Controller's channel assessment scheme is enabled or disabled.
488  * @param[out] AFH_Channel_Assessment_Mode Enable or disable channel assessment
489  *             scheme.
490  *             Values:
491  *             - 0x00: DISABLED
492  *             - 0x01: ENABLED
493  * @retval Value indicating success or error code.
494  */
495 tBleStatus hci_read_afh_channel_assessment_mode(uint8_t *AFH_Channel_Assessment_Mode);
496 /**
497  * @brief The HCI_Write_AFH_Channel_Assessment_Mode command writes the value for
498  *        the AFH_Channel_Assessment_Mode parameter. The
499  *        AFH_Channel_Assessment_Mode parameter controls whether the
500  *        Controller's channel assessment scheme is enabled or disabled.
501  * @param AFH_Channel_Assessment_Mode
502  *        Values:
503  *        - 0x00: DISABLED
504  *        - 0x01: ENABLED
505  * @retval Value indicating success or error code.
506  */
507 tBleStatus hci_write_afh_channel_assessment_mode(uint8_t AFH_Channel_Assessment_Mode);
508 /**
509  * @brief The HCI_Set_Event_Mask_Page_2 command is used to control which events
510  *        are generated by the HCI for the Host. The Event_Mask_Page_2 is a
511  *        logical extension to the Event_Mask parameter of the
512  *        HCI_Set_Event_Mask command. If the bit in the Event_Mask_Page_2 is set
513  *        to a one, then the event associated with that bit shall be enabled.
514  *        The event mask allows the Host to control how much it is interrupted.
515  *        The Controller shall ignore those bits which are reserved for future
516  *        use or represent events which it does not support. If the Host sets
517  *        any of these bits to 1, the Controller shall act as if they were set
518  *        to 0.
519  * @param Event_Mask_Page_2 For the complete list of bits that can be set, see
520  *        Core v5.1, Vol 2, part E, chapter 7.3.69. The only bit that is not
521  *        ignored is: Bit 23: Authenticated Payload Timeout Expired event.
522  *        Flags:
523  *        - 0x0000000000800000: AUTHENTICATED_PAYLOAD_TIMEOUT_EXPIRED_EVENT
524  * @retval Value indicating success or error code.
525  */
526 tBleStatus hci_set_event_mask_page_2(uint8_t Event_Mask_Page_2[8]);
527 /**
528  * @brief This command reads the Authenticated_Payload_Timeout parameter in the
529  *        Primary Controller on the specified Connection_Handle.
530  * @param Connection_Handle Connection handle that identifies the connection.
531  *        Values:
532  *        - 0x0000 ... 0x0EFF
533  * @param[out] Authenticated_Payload_Timeout Maximum amount of time specified
534  *             between packets authenticated by a MIC. Time = N * 10 ms.
535  *             Values:
536  *             - 0x0001 (10 ms)  ... 0xFFFF (655350 ms)
537  * @retval Value indicating success or error code.
538  */
539 tBleStatus hci_read_authenticated_payload_timeout(uint16_t Connection_Handle,
540                                                   uint16_t *Authenticated_Payload_Timeout);
541 /**
542  * @brief This command writes the Authenticated_Payload_Timeout parameter in the
543  *        Primary Controller for the specified Connection_Handle. The
544  *        Authenticated_Payload_Timeout shall be equal to or greater than
545  *        connInterval * (1 + connPeripheralLatency). The Link Layer will use
546  *        this parameter to determine when to use the LE ping sequence.
547  * @param Connection_Handle Connection handle that identifies the connection.
548  *        Values:
549  *        - 0x0000 ... 0x0EFF
550  * @param Authenticated_Payload_Timeout Maximum amount of time specified between
551  *        packets authenticated by a valid MIC. Time = N * 10 ms.
552  *        Values:
553  *        - 0x0001 (10 ms)  ... 0xFFFF (655350 ms)
554  * @retval Value indicating success or error code.
555  */
556 tBleStatus hci_write_authenticated_payload_timeout(uint16_t Connection_Handle,
557                                                    uint16_t Authenticated_Payload_Timeout);
558 /**
559  * @brief This command reads the values for the version information for the
560  *        local Controller. The HCI Version information defines the version
561  *        information of the HCI layer. The LMP/PAL Version information defines
562  *        the version of the LMP or PAL. The Manufacturer_Name information
563  *        indicates the manufacturer of the local device. The HCI Revision and
564  *        LMP/PAL Subversion are implementation dependent. (See Bluetooth
565  *        Specification v.4.1, Vol. 2, Part E, 7.4.1)
566  * @param[out] HCI_Version See Bluetooth Assigned Numbers
567  *             (https://www.bluetooth.org/en-us/specification/assigned-numbers)
568  * @param[out] HCI_Revision Revision of the Current HCI in the BR/EDR
569  *             Controller.
570  * @param[out] LMP_PAL_Version Version of the Current LMP or PAL in the
571  *             Controller. See Bluetooth Assigned Numbers
572  *             (https://www.bluetooth.org/en-us/specification/assigned-numbers)
573  * @param[out] Manufacturer_Name Manufacturer Name of the BR/EDR Controller. See
574  *             Bluetooth Assigned Numbers (https://www.bluetooth.org/en-
575  *             us/specification/assigned-numbers)
576  * @param[out] LMP_PAL_Subversion Subversion of the Current LMP or PAL in the
577  *             Controller. This value is implementation dependent.
578  * @retval Value indicating success or error code.
579  */
580 tBleStatus hci_read_local_version_information(uint8_t *HCI_Version,
581                                               uint16_t *HCI_Revision,
582                                               uint8_t *LMP_PAL_Version,
583                                               uint16_t *Manufacturer_Name,
584                                               uint16_t *LMP_PAL_Subversion);
585 /**
586  * @brief This command reads the list of HCI commands supported for the local
587  *        Controller. This command shall return the Supported_Commands
588  *        configuration parameter. It is implied that if a command is listed as
589  *        supported, the feature underlying that command is also supported. (See
590  *        Bluetooth Specification v.4.1, Vol. 2, Part E, 7.4.2)
591  * @param[out] Supported_Commands Bit mask for each HCI Command. If a bit is 1,
592  *             the Controller supports the corresponding command and the
593  *             features required for the command. Unsupported or undefined
594  *             commands shall be set to 0.
595  * @retval Value indicating success or error code.
596  */
597 tBleStatus hci_read_local_supported_commands(uint8_t Supported_Commands[64]);
598 /**
599  * @brief This command requests a list of the supported features for the local
600  *        Controller. This command will return a list of the LMP features. For
601  *        details see Part C, Link Manager Protocol Specification on page 227.
602  *        (See Bluetooth Specification v.4.1, Vol. 2, Part E, 7.4.3)
603  * @param[out] LMP_Features Bit Mask List of LMP features.
604  * @retval Value indicating success or error code.
605  */
606 tBleStatus hci_read_local_supported_features(uint8_t LMP_Features[8]);
607 /**
608  * @brief On an LE Controller, this command shall read the Public Device Address
609  *        as defined in [Vol 6] Part B, Section 1.3, Device Address. If this
610  *        Controller does not have a Public Device Address, the value
611  *        0x000000000000 shall be returned. On an LE Controller, the public
612  *        address shall be the same as the BD_ADDR. (See Bluetooth Specification
613  *        v.4.1, Vol. 2, Part E, 7.4.6)
614  * @param[out] BD_ADDR BD_ADDR ( Bluetooth Device Address) of the Device.
615  * @retval Value indicating success or error code.
616  */
617 tBleStatus hci_read_bd_addr(uint8_t BD_ADDR[6]);
618 /**
619  * @brief This command reads the Received Signal Strength Indication (RSSI)
620  *        value from a Controller. For an LE transport, a Connection_Handle is
621  *        used as the Handle command parameter and return parameter. The meaning
622  *        of the RSSI metric is an absolute receiver signal strength value in
623  *        dBm to +/- 6 dB accuracy. If the RSSI cannot be read, the RSSI metric
624  *        shall be set to 127. (See Bluetooth Specification v.4.1, Vol. 2, Part
625  *        E, 7.5.4)
626  * @param Connection_Handle Connection handle that identifies the connection.
627  *        Values:
628  *        - 0x0000 ... 0x0EFF
629  * @param[out] RSSI N Size: 1 Octet (signed integer) Units: dBm
630  *             Values:
631  *             - -127 ... 20
632  *             - 127: RSSI not available
633  * @retval Value indicating success or error code.
634  */
635 tBleStatus hci_read_rssi(uint16_t Connection_Handle,
636                          int8_t *RSSI);
637 /**
638  * @brief The LE_Set_Event_Mask command is used to control which LE events are
639  *        generated by the HCI for the Host. If the bit in the LE_Event_Mask is
640  *        set to a one, then the event associated with that bit will be enabled.
641  *        The Host has to deal with each event that is generated by an LE
642  *        Controller. The event mask allows the Host to control which events
643  *        will interrupt it. For LE events to be generated, the LE Meta-Event
644  *        bit in the Event_Mask shall also be set. If that bit is not set, then
645  *        LE events shall not be generated, regardless of how the LE_Event_Mask
646  *        is set. (See Bluetooth Specification v.4.1, Vol. 2, Part E, 7.8.1)
647  * @param LE_Event_Mask LE event mask. Default: 0x000000000000001F.
648  *        Flags:
649  *        - 0x0000000000000000: No LE events specified
650  *        - 0x0000000000000001: LE Connection Complete Event
651  *        - 0x0000000000000002: LE Advertising Report Event
652  *        - 0x0000000000000004: LE Connection Update Complete Event
653  *        - 0x0000000000000008: LE Read Remote Used Features Complete Event
654  *        - 0x0000000000000010: LE Long Term Key Request Event
655  *        - 0x0000000000000020: LE Remote Connection Parameter Request Event
656  *        - 0x0000000000000040: LE Data Length Change Event
657  *        - 0x0000000000000080: LE Read Local P-256 Public Key Complete Event
658  *        - 0x0000000000000100: LE Generate DHKey Complete Event
659  *        - 0x0000000000000200: LE Enhanced Connection Complete Event
660  *        - 0x0000000000000400: LE Directed Advertising Report Event
661  *        - 0x0000000000000800: LE PHY Update Complete event
662  *        - 0x0000000000001000: LE Extended Advertising Report event
663  *        - 0x0000000000002000: LE Periodic Advertising Sync Established event
664  *        - 0x0000000000004000: LE Periodic Advertising Report event
665  *        - 0x0000000000008000: LE Periodic Advertising Sync Lost event
666  *        - 0x0000000000010000: LE Scan Timeout event
667  *        - 0x0000000000020000: LE Advertising Set Terminated event
668  *        - 0x0000000000040000: LE Scan Request Received event
669  *        - 0x0000000000080000: LE Channel Selection Algorithm event
670  *        - 0x0000000000100000: LE Connectionless IQ Report event
671  *        - 0x0000000000200000: LE Connection IQ Report event
672  *        - 0x0000000000400000: LE CTE Request Failed event
673  *        - 0x0000000000800000: LE Periodic Advertising Sync Transfer Received event
674  *        - 0x0000000001000000: LE CIS Established event
675  *        - 0x0000000002000000: LE CIS Request event
676  *        - 0x0000000004000000: LE Create BIG Complete event
677  *        - 0x0000000008000000: LE Terminate BIG Complete event
678  *        - 0x0000000010000000: LE BIG Sync Established event
679  *        - 0x0000000020000000: LE BIG Sync Lost event
680  *        - 0x0000000040000000: LE Request Peer SCA Complete event
681  *        - 0x0000000080000000: LE Path Loss Threshold event
682  *        - 0x0000000100000000: LE Transmit Power Reporting event
683  *        - 0x0000000200000000: LE BIGInfo Advertising Report event
684  *        - 0x0000000400000000: LE Subrate Change event
685  *        - 0x0000000800000000: LE Periodic Advertising Sync Established event [v2]
686  *        - 0x0000001000000000: LE Periodic Advertising Report event [v2]
687  *        - 0x0000002000000000: LE Periodic Advertising Sync Transfer Received event [v2]
688  *        - 0x0000004000000000: LE Periodic Advertising Subevent Data Request event
689  *        - 0x0000008000000000: LE Periodic Advertising Response Report event
690  *        - 0x0000010000000000: LE Enhanced Connection Complete event [v2]
691  * @retval Value indicating success or error code.
692  */
693 tBleStatus hci_le_set_event_mask(uint8_t LE_Event_Mask[8]);
694 /**
695  * @brief The LE_Read_Buffer_Size command is used to read the maximum size of
696  *        the data portion of HCI LE ACL Data Packets sent from the Host to the
697  *        Controller. The Host will segment the data transmitted to the
698  *        Controller according to these values, so that the HCI Data Packets
699  *        will contain data with up to this size. The LE_Read_Buffer_Size
700  *        command also returns the total number of HCI LE ACL Data Packets that
701  *        can be stored in the data buffers of the Controller. The
702  *        LE_Read_Buffer_Size command must be issued by the Host before it sends
703  *        any data to an LE Controller (see Section 4.1.1). If the Controller
704  *        returns a length value of zero, the Host shall use the
705  *        Read_Buffer_Size command to determine the size of the data buffers
706  *        Note: Both the Read_Buffer_Size and LE_Read_Buffer_Size commands may
707  *        return buffer length and number of packets parameter values that are
708  *        nonzero. The HC_LE_ACL_Data_Packet_Length return parameter shall be
709  *        used to determine the size of the L2CAP PDU segments contained in ACL
710  *        Data Packets, which are transferred from the Host to the Controller to
711  *        be broken up into packets by the Link Layer. Both the Host and the
712  *        Controller shall support command and event packets, where the data
713  *        portion (excluding header) contained in the packets is 255 octets in
714  *        size. The HC_Total_Num_LE_ACL_Data_Packets return parameter contains
715  *        the total number of HCI ACL Data Packets that can be stored in the
716  *        data buffers of the Controller. The Host determines how the buffers
717  *        are to be divided between different Connection Handles. Note: The
718  *        HC_LE_ACL_Data_Packet_Length return parameter does not include the
719  *        length of the HCI Data Packet header. (See Bluetooth Specification
720  *        v.4.1, Vol. 2, Part E, 7.8.2)
721  * @param[out] HC_LE_ACL_Data_Packet_Length 0x0000: No dedicated LE Buffer
722  *             exists. Use the HCI_Read_Buffer_Size command. 0x001B - 0xFFFF
723  *             Maximum length (in octets) of the data portion of each HCI ACL
724  *             data packet.
725  *             Values:
726  *             - 0x0000: NO_BUFFER
727  *             - 0x001B ... 0xFFFF
728  * @param[out] HC_Total_Num_LE_ACL_Data_Packets 0x00: No dedicated LE Buffer
729  *             exists. Use the HCI_Read_Buffer_Size command. 0x01 - 0xFF: Total
730  *             number of HCI ACL Data Packets that can be stored in the data
731  *             buffers of the Controller.
732  *             Values:
733  *             - 0x00: NO_BUFFER
734  *             - 0x01 ... 0xFF
735  * @retval Value indicating success or error code.
736  */
737 tBleStatus hci_le_read_buffer_size(uint16_t *HC_LE_ACL_Data_Packet_Length,
738                                    uint8_t *HC_Total_Num_LE_ACL_Data_Packets);
739 /**
740  * @brief This command requests the list of the supported LE features for the
741  *        Controller. (See Bluetooth Specification v.4.1, Vol. 2, Part E, 7.8.3)
742  * @param[out] LE_Features Bit Mask List of LE features. See Core v4.1, Vol. 6,
743  *             Part B, Section 4.6.
744  * @retval Value indicating success or error code.
745  */
746 tBleStatus hci_le_read_local_supported_features(uint8_t LE_Features[8]);
747 /**
748  * @brief The LE_Set_Random_Address command is used by the Host to set the LE
749  *        Random Device Address in the Controller (see [Vol 6] Part B, Section
750  *        1.3). (See Bluetooth Specification v.4.1, Vol. 2, Part E, 7.8.4)
751  * @param Random_Address Random Device Address.
752  * @retval Value indicating success or error code.
753  */
754 tBleStatus hci_le_set_random_address(uint8_t Random_Address[6]);
755 /**
756  * @brief The LE_Set_Advertising_Parameters command is used by the Host to set
757  *        the advertising parameters. The Advertising_Interval_Min shall be less
758  *        than or equal to the Advertising_Interval_Max. The
759  *        Advertising_Interval_Min and Advertising_Interval_Max should not be
760  *        the same value to enable the Controller to determine the best
761  *        advertising interval given other activities. For high duty cycle
762  *        directed advertising, i.e. when Advertising_Type is 0x01
763  *        (ADV_DIRECT_IND, high duty cycle), the Advertising_Interval_Min and
764  *        Advertising_Interval_Max parameters are not used and shall be ignored.
765  *        The Advertising_Type is used to determine the packet type that is used
766  *        for advertising when advertising is enabled. Own_Address_Type
767  *        parameter indicates the type of address being used in the advertising
768  *        packets. If Own_Address_Type equals 0x02 or 0x03, the Peer_Address
769  *        parameter contains the peer's Identity Address and the
770  *        Peer_Address_Type parameter contains the Peer's Identity Type (i.e.
771  *        0x00 or 0x01). These parameters are used to locate the corresponding
772  *        local IRK in the resolving list; this IRK is used to generate the own
773  *        address used in the advertisement. If directed advertising is
774  *        performed, i.e. when Advertising_Type is set to 0x01 (ADV_DIRECT_IND,
775  *        high duty cycle) or 0x04 (ADV_DIRECT_IND, low duty cycle mode), then
776  *        the Peer_Address_Type and Peer_Address shall be valid. If
777  *        Own_Address_Type equals 0x02 or 0x03, the Controller generates the
778  *        peer's Resolvable Private Address using the peer's IRK corresponding
779  *        to the peer's Identity Address contained in the Peer_Address parameter
780  *        and peer's Identity Address Type (i.e. 0x00 or 0x01) contained in the
781  *        Peer_Address_Type parameter. The Advertising_Channel_Map is a bit
782  *        field that indicates the advertising channels that shall be used when
783  *        transmitting advertising packets. At least one channel bit shall be
784  *        set in the Advertising_Channel_Map parameter. The
785  *        Advertising_Filter_Policy parameter shall be ignored when directed
786  *        advertising is enabled. The Host shall not issue this command when
787  *        advertising is enabled in the Controller; if it is the Command
788  *        Disallowed error code shall be used. If the advertising interval range
789  *        provided by the Host (Advertising_Interval_Min,
790  *        Advertising_Interval_Max) is outside the advertising interval range
791  *        supported by the Controller, then the Controller shall return the
792  *        Unsupported Feature or Parameter Value (0x11) error code.
793  * @param Advertising_Interval_Min Minimum advertising interval for undirected
794  *        and low duty cycle directed advertising. Time = N * 0.625 msec.
795  *        Values:
796  *        - 0x0020 (20.000 ms)  ... 0x4000 (10240.000 ms)
797  * @param Advertising_Interval_Max Maximum advertising interval. Time = N *
798  *        0.625 msec.
799  *        Values:
800  *        - 0x0020 (20.000 ms)  ... 0x4000 (10240.000 ms)
801  * @param Advertising_Type Advertising type.
802  *        Values:
803  *        - 0x00: ADV_IND (Connectable undirected advertising)
804  *        - 0x01: ADV_DIRECT_IND, high duty cycle (Connectable high duty cycle directed advertising)
805  *        - 0x02: ADV_SCAN_IND (Scannable undirected advertising)
806  *        - 0x03: ADV_NONCONN_IND (Non connectable undirected advertising)
807  *        - 0x04: ADV_DIRECT_IND, low duty cycle (Connectable low duty cycle directed advertising)
808  * @param Own_Address_Type Own address type.  - 0x00: Public Device Address  -
809  *        0x01 Random Device Address  - 0x02: Controller generates Resolvable
810  *        Private Address based on the local          IRK from resolving list.
811  *        If resolving list contains no matching entry,          use public
812  *        address.  - 0x03: Controller generates Resolvable Private Address
813  *        based on the local          IRK from resolving list. If resolving list
814  *        contains no matching entry,          use random address from
815  *        LE_Set_Random_Address.
816  *        Values:
817  *        - 0x00: Public Device Address
818  *        - 0x01: Random Device Address
819  *        - 0x02: Resolvable Private Address or Public Address
820  *        - 0x03: Resolvable Private Address or Random Address
821  * @param Peer_Address_Type Peer Address type.
822  *        Values:
823  *        - 0x00: Public Device Address or Public Identity Address
824  *        - 0x01: Random Device Address or Random (static) Identity Address
825  * @param Peer_Address Public Device Address, Random Device Address, Public
826  *        Identity Address or Random (static) Identity Address of the device to
827  *        be connected.
828  * @param Advertising_Channel_Map Advertising channel map. Default: 00000111b
829  *        (all channels enabled).
830  *        Flags:
831  *        - 0x01: ch 37
832  *        - 0x02: ch 38
833  *        - 0x04: ch 39
834  * @param Advertising_Filter_Policy Advertising Filter Policy. This parameter is
835  *        ignored when directed advertising is enabled.  0x00 Process scan and
836  *        connection requests from all devices (i.e., the Filter Accept List is
837  *        not in use) 0x01 Process connection requests from all devices and scan
838  *        requests only from devices that are in the Filter Accept List 0x02
839  *        Process scan requests from all devices and connection requests only
840  *        from devices that are in the Filter Accept List. 0x03 Process scan and
841  *        connection requests only from devices in the Filter Accept List. All
842  *        other values are reserved for future use
843  *        Values:
844  *        - 0x00: HCI_ADV_FILTER_NONE
845  *        - 0x01: HCI_ADV_FILTER_ACCEPT_LIST_SCAN
846  *        - 0x02: HCI_ADV_FILTER_ACCEPT_LIST_CONNECT
847  *        - 0x03: HCI_ADV_FILTER_ACCEPT_LIST_SCAN_CONNECT
848  * @retval Value indicating success or error code.
849  */
850 tBleStatus hci_le_set_advertising_parameters(uint16_t Advertising_Interval_Min,
851                                              uint16_t Advertising_Interval_Max,
852                                              uint8_t Advertising_Type,
853                                              uint8_t Own_Address_Type,
854                                              uint8_t Peer_Address_Type,
855                                              uint8_t Peer_Address[6],
856                                              uint8_t Advertising_Channel_Map,
857                                              uint8_t Advertising_Filter_Policy);
858 /**
859  * @brief The LE_Read_Advertising_Physical_Channel_Tx_Power command is used by
860  *        the Host to read the transmit power level used for LE advertising
861  *        channel packets. (See Bluetooth Specification v.4.1, Vol. 2, Part E,
862  *        7.8.6)
863  * @param[out] Transmit_Power_Level Size: 1 Octet (signed integer) Units: dBm
864  *             Accuracy: +/- 4 dBm
865  *             Values:
866  *             - -20 ... 10
867  * @retval Value indicating success or error code.
868  */
869 tBleStatus hci_le_read_advertising_physical_channel_tx_power(int8_t *Transmit_Power_Level);
870 /**
871  * @brief The LE_Set_Advertise_Enable command is used to request the Controller
872  *        to start or stop advertising. The Controller manages the timing of
873  *        advertisements as per the advertising parameters given in the
874  *        LE_Set_Advertising_Parameters command. The Controller shall continue
875  *        advertising until the Host issues an LE_Set_Advertise_Enable command
876  *        with Advertising_Enable set to 0x00 (Advertising is disabled) or until
877  *        a connection is created or until the Advertising is timed out due to
878  *        high duty cycle Directed Advertising. In these cases, advertising is
879  *        then disabled. (See Bluetooth Specification v.4.1, Vol. 2, Part E,
880  *        7.8.9)
881  * @param Advertising_Enable Enable/disable advertise. Default is 0 (disabled).
882  *        Values:
883  *        - 0x00: Disable
884  *        - 0x01: Enable
885  * @retval Value indicating success or error code.
886  */
887 tBleStatus hci_le_set_advertising_enable(uint8_t Advertising_Enable);
888 /**
889  * @brief The LE_Set_Scan_Parameters command is used to set the scan parameters.
890  *        The LE_Scan_Type parameter controls the type of scan to perform. The
891  *        LE_Scan_Interval and LE_Scan_Window parameters are recommendations
892  *        from the Host on how long (LE_Scan_Window) and how frequently
893  *        (LE_Scan_Interval) the Controller should scan (See [Vol 6] Part B,
894  *        Section 4.5.3). The LE_Scan_Window parameter shall always be set to a
895  *        value smaller or equal to the value set for the LE_Scan_Interval
896  *        parameter. If they are set to the same value scanning should be run
897  *        continuously. The Own_Address_Type parameter determines the address
898  *        used (Public or Random Device Address) when performing active scan.
899  *        The Host shall not issue this command when scanning is enabled in the
900  *        Controller; if it is the Command Disallowed error code shall be used.
901  *        (See Bluetooth Specification v.4.1, Vol. 2, Part E, 7.8.10)
902  * @param LE_Scan_Type Passive or active scanning. With active scanning SCAN_REQ
903  *        packets are sent.
904  *        Values:
905  *        - 0x00: Passive Scanning
906  *        - 0x01: Active scanning
907  * @param LE_Scan_Interval This is defined as the time interval from when the
908  *        Controller started its last LE scan until it begins the subsequent LE
909  *        scan. Time = N * 0.625 msec.
910  *        Values:
911  *        - 0x0004 (2.500 ms)  ... 0x4000 (10240.000 ms)
912  * @param LE_Scan_Window The duration of the LE scan. LE_Scan_Window shall be
913  *        less than or equal to LE_Scan_Interval. Time = N * 0.625 msec.
914  *        Values:
915  *        - 0x0004 (2.500 ms)  ... 0x4000 (10240.000 ms)
916  * @param Own_Address_Type Own address type.  - 0x00: Public Device Address  -
917  *        0x01 Random Device Address  - 0x02: Controller generates Resolvable
918  *        Private Address based on the local          IRK from resolving list.
919  *        If resolving list contains no matching entry,          use public
920  *        address.  - 0x03: Controller generates Resolvable Private Address
921  *        based on the local          IRK from resolving list. If resolving list
922  *        contains no matching entry,          use random address from
923  *        LE_Set_Random_Address.
924  *        Values:
925  *        - 0x00: Public Device Address
926  *        - 0x01: Random Device Address
927  *        - 0x02: Resolvable Private Address or Public Address
928  *        - 0x03: Resolvable Private Address or Random Address
929  * @param Scanning_Filter_Policy See Scanning filter policy in Bluetooth Core
930  *        specification.
931  *        Values:
932  *        - 0x00: Basic unfiltered scanning filter policy
933  *        - 0x01: Basic filtered scanning filter policy
934  *        - 0x02: Extended unfiltered scanning filter policy
935  *        - 0x03: Extended filtered scanning filter policy
936  * @retval Value indicating success or error code.
937  */
938 tBleStatus hci_le_set_scan_parameters(uint8_t LE_Scan_Type,
939                                       uint16_t LE_Scan_Interval,
940                                       uint16_t LE_Scan_Window,
941                                       uint8_t Own_Address_Type,
942                                       uint8_t Scanning_Filter_Policy);
943 /**
944  * @brief The LE_Set_Scan_Enable command is used to start scanning. Scanning is
945  *        used to discover advertising devices nearby. The Filter_Duplicates
946  *        parameter controls whether the Link Layer shall filter duplicate
947  *        advertising reports to the Host, or if the Link Layer should generate
948  *        advertising reports for each packet received. (See Bluetooth
949  *        Specification v.4.1, Vol. 2, Part E, 7.8.11)
950  * @param LE_Scan_Enable Enable/disable scan. Default is 0 (disabled).
951  *        Values:
952  *        - 0x00: Scanning disabled
953  *        - 0x01: Scanning enabled
954  * @param Filter_Duplicates Enable/disable duplicate filtering.
955  *        Values:
956  *        - 0x00: Duplicate filtering disabled
957  *        - 0x01: Duplicate filtering enabled
958  * @retval Value indicating success or error code.
959  */
960 tBleStatus hci_le_set_scan_enable(uint8_t LE_Scan_Enable,
961                                   uint8_t Filter_Duplicates);
962 /**
963  * @brief The LE_Create_Connection command is used to create a Link Layer
964  *        connection to a connectable advertiser. The LE_Scan_Interval and
965  *        LE_Scan_Window parameters are recommendations from the Host on how
966  *        long (LE_Scan_Window) and how frequently (LE_Scan_Interval) the
967  *        Controller should scan. The LE_Scan_Window parameter shall be set to a
968  *        value smaller or equal to the value set for the LE_Scan_Interval
969  *        parameter. If both are set to the same value, scanning should run
970  *        continuously. The Initiator_Filter_Policy is used to determine whether
971  *        the Filter Accept List is used. If the Filter Accept List is not used,
972  *        the Peer_Address_Type and the Peer_Address parameters specify the
973  *        address type and address of the advertising device to connect to. The
974  *        Link Layer shall set the address in the CONNECT_REQ packets to either
975  *        the Public Device Address or the Random Device Addressed based on the
976  *        Own_Address_Type parameter. The Connection_Interval_Min and
977  *        Connection_Interval_Max parameters define the minimum and maximum
978  *        allowed connection interval. The Connection_Interval_Min parameter
979  *        shall not be greater than the Connection_Interval_Max parameter. The
980  *        Max_Latency parameter defines the maximum allowed connection latency
981  *        (see [Vol 6] Part B, Section 4.5.1). The Supervision_Timeout parameter
982  *        defines the link supervision timeout for the connection. The
983  *        Supervision_Timeout in milliseconds shall be larger than (1 +
984  *        Max_Latency) * Connection_Interval_Max * 2, where
985  *        Connection_Interval_Max is given in milliseconds. (See [Vol 6] Part B,
986  *        Section 4.5.2). The Min_CE_Length and Max_CE_Length parameters are
987  *        informative parameters providing the Controller with the expected
988  *        minimum and maximum length of the connection events. The Min_CE_Length
989  *        parameter shall be less than or equal to the Max_CE_Length parameter.
990  *        The Host shall not issue this command when another
991  *        LE_Create_Connection is pending in the Controller; if this does occur
992  *        the Controller shall return the Command Disallowed error code shall be
993  *        used. (See Bluetooth Specification v.4.1, Vol. 2, Part E, 7.8.12)
994  * @param LE_Scan_Interval This is defined as the time interval from when the
995  *        Controller started its last LE scan until it begins the subsequent LE
996  *        scan. Time = N * 0.625 msec.
997  *        Values:
998  *        - 0x0004 (2.500 ms)  ... 0x4000 (10240.000 ms)
999  * @param LE_Scan_Window The duration of the LE scan. LE_Scan_Window shall be
1000  *        less than or equal to LE_Scan_Interval. Time = N * 0.625 msec.
1001  *        Values:
1002  *        - 0x0004 (2.500 ms)  ... 0x4000 (10240.000 ms)
1003  * @param Initiator_Filter_Policy 0x00 Filter Accept List is not used to
1004  *        determine which advertiser to connect to. Peer_Address_Type and
1005  *        Peer_Address shall be used. 0x01 Filter Accept List is used to
1006  *        determine which advertiser to connect to. Peer_Address_Type and
1007  *        Peer_Address shall be ignored.
1008  *        Values:
1009  *        - 0x00: Filter Accept List not used
1010  *        - 0x01: Filter Accept List used
1011  * @param Peer_Address_Type 0x00 Public Device Address 0x01 Random Device
1012  *        Address 0x02 Public Identity Address (Corresponds to Resolved Private
1013  *        Address) 0x03 Random (Static) Identity Address (Corresponds to
1014  *        Resolved Private Address)
1015  *        Values:
1016  *        - 0x00: Public Device Address
1017  *        - 0x01: Random Device Address
1018  *        - 0x02: Public Identity Address
1019  *        - 0x03: Random (Static) Identity Address
1020  * @param Peer_Address Public Device Address, Random Device Address, Public
1021  *        Identity Address or Random (static) Identity Address of the
1022  *        advertising device.
1023  * @param Own_Address_Type Own address type.  - 0x00: Public Device Address  -
1024  *        0x01 Random Device Address  - 0x02: Controller generates Resolvable
1025  *        Private Address based on the local          IRK from resolving list.
1026  *        If resolving list contains no matching entry,          use public
1027  *        address.  - 0x03: Controller generates Resolvable Private Address
1028  *        based on the local          IRK from resolving list. If resolving list
1029  *        contains no matching entry,          use random address from
1030  *        LE_Set_Random_Address.
1031  *        Values:
1032  *        - 0x00: Public Device Address
1033  *        - 0x01: Random Device Address
1034  *        - 0x02: Resolvable Private Address or Public Address
1035  *        - 0x03: Resolvable Private Address or Random Address
1036  * @param Connection_Interval_Min Minimum value for the connection event
1037  *        interval. This shall be less than or equal to Connection_Interval_Max.
1038  *        Time = N * 1.25 msec.
1039  *        Values:
1040  *        - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
1041  * @param Connection_Interval_Max Maximum value for the connection event
1042  *        interval. This shall be greater than or equal to
1043  *        Connection_Interval_Min. Time = N * 1.25 msec.
1044  *        Values:
1045  *        - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
1046  * @param Max_Latency Maximum Peripheral latency for the connection in number of
1047  *        connection events.
1048  *        Values:
1049  *        - 0x0000 ... 0x01F3
1050  * @param Supervision_Timeout Supervision timeout for the LE Link. It shall be a
1051  *        multiple of 10 ms and larger than (1 + connPeripheralLatency) *
1052  *        connInterval * 2. Time = N * 10 msec.
1053  *        Values:
1054  *        - 0x000A (100 ms)  ... 0x0C80 (32000 ms)
1055  * @param Min_CE_Length The minimum length of connection event recommended for
1056  *        this LE connection. Time = N * 0.625 msec.
1057  * @param Max_CE_Length The maximum length of connection event recommended for
1058  *        this LE connection. Time = N * 0.625 msec.
1059  * @retval Value indicating success or error code.
1060  */
1061 tBleStatus hci_le_create_connection(uint16_t LE_Scan_Interval,
1062                                     uint16_t LE_Scan_Window,
1063                                     uint8_t Initiator_Filter_Policy,
1064                                     uint8_t Peer_Address_Type,
1065                                     uint8_t Peer_Address[6],
1066                                     uint8_t Own_Address_Type,
1067                                     uint16_t Connection_Interval_Min,
1068                                     uint16_t Connection_Interval_Max,
1069                                     uint16_t Max_Latency,
1070                                     uint16_t Supervision_Timeout,
1071                                     uint16_t Min_CE_Length,
1072                                     uint16_t Max_CE_Length);
1073 /**
1074  * @brief The LE_Create_Connection_Cancel command is used to cancel the
1075  *        LE_Create_Connection command. This command shall only be issued after
1076  *        the LE_Create_Connection command has been issued, a Command Status
1077  *        event has been received for the LE Create Connection command and
1078  *        before the LE Connection Complete event. (See Bluetooth Specification
1079  *        v.4.1, Vol. 2, Part E, 7.8.13)
1080  * @retval Value indicating success or error code.
1081  */
1082 tBleStatus hci_le_create_connection_cancel(void);
1083 /**
1084  * @brief The LE_Read_Filter_Accept_List_Size command is used to read the total
1085  *        number of Filter Accept list entries that can be stored in the
1086  *        Controller.
1087  * @param[out] Filter_Accept_List_Size Total number of Filter Accept List
1088  *             entries that can be stored in the Controller.
1089  * @retval Value indicating success or error code.
1090  */
1091 tBleStatus hci_le_read_filter_accept_list_size(uint8_t *Filter_Accept_List_Size);
1092 /**
1093  * @brief The LE_Clear_Filter_Accept_List command is used to clear the Filter
1094  *        Accept list stored in the Controller. This command can be used at any
1095  *        time except when: - the advertising filter policy uses the Filter
1096  *        Accept list and advertising is enabled. - the scanning filter policy
1097  *        uses the Filter Accept list and scanning is enabled. - the initiator
1098  *        filter policy uses the Filter Accept list and an LE_Create_Connection
1099  *        command is outstanding.
1100  * @retval Value indicating success or error code.
1101  */
1102 tBleStatus hci_le_clear_filter_accept_list(void);
1103 /**
1104  * @brief The LE_Add_Device_To_Filter_Accept_List command is used to add a
1105  *        single device to the Filter Accept list stored in the Controller. This
1106  *        command can be used at any time except when: - the advertising filter
1107  *        policy uses the Filter Accept list and advertising is enabled. - the
1108  *        scanning filter policy uses the Filter Accept list and scanning is
1109  *        enabled. - the initiator filter policy uses the Filter Accept list and
1110  *        a create connection command is outstanding.
1111  * @param Address_Type Address type.
1112  *        Values:
1113  *        - 0x00: Public Device Address
1114  *        - 0x01: Random Device Address
1115  * @param Address Public Device Address or Random Device Address of the device
1116  *        to be added to the list.
1117  * @retval Value indicating success or error code.
1118  */
1119 tBleStatus hci_le_add_device_to_filter_accept_list(uint8_t Address_Type,
1120                                                    uint8_t Address[6]);
1121 /**
1122  * @brief The LE_Remove_Device_From_Filter_Accept_List command is used to remove
1123  *        a single device from the Filter Accept list stored in the Controller.
1124  *        This command can be used at any time except when: - the advertising
1125  *        filter policy uses the Filter Accept list and advertising is enabled.
1126  *        - the scanning filter policy uses the Filter Accept list and scanning
1127  *        is enabled. - the initiator filter policy uses the Filter Accept list
1128  *        and a create connection command is outstanding.
1129  * @param Address_Type Address type.
1130  *        Values:
1131  *        - 0x00: Public Device Address
1132  *        - 0x01: Random Device Address
1133  * @param Address Public Device Address or Random Device Address of the device
1134  *        to be removed from the Filter Accept List.
1135  * @retval Value indicating success or error code.
1136  */
1137 tBleStatus hci_le_remove_device_from_filter_accept_list(uint8_t Address_Type,
1138                                                         uint8_t Address[6]);
1139 /**
1140  * @brief The LE_Connection_Update command is used to change the Link Layer
1141  *        connection parameters of a connection. This command is supported only
1142  *        on central side. The Connection_Interval_Min and
1143  *        Connection_Interval_Max parameters are used to define the minimum and
1144  *        maximum allowed connection interval. The Connection_Interval_Min
1145  *        parameter shall not be greater than the Connection_Interval_Max
1146  *        parameter. The Max_Latency parameter shall define the maximum allowed
1147  *        connection latency. The Supervision_Timeout parameter shall define the
1148  *        link supervision timeout for the LE link. The Supervision_Timeout in
1149  *        milliseconds shall be larger than (1 + Max_Latency) *
1150  *        Connection_Interval_Max * 2, where Connection_Interval_Max is given in
1151  *        milliseconds. The Min_CE_Length and Max_CE_Length are information
1152  *        parameters providing the Controller with a hint about the expected
1153  *        minimum and maximum length of the connection events. The Min_CE_Length
1154  *        shall be less than or equal to the Max_CE_Length. The actual parameter
1155  *        values selected by the Link Layer may be different from the parameter
1156  *        values provided by the Host through this command. (See Bluetooth
1157  *        Specification v.4.1, Vol. 2, Part E, 7.8.18)
1158  * @param Connection_Handle Connection handle that identifies the connection.
1159  *        Values:
1160  *        - 0x0000 ... 0x0EFF
1161  * @param Connection_Interval_Min Minimum value for the connection event
1162  *        interval. This shall be less than or equal to Connection_Interval_Max.
1163  *        Time = N * 1.25 msec.
1164  *        Values:
1165  *        - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
1166  * @param Connection_Interval_Max Maximum value for the connection event
1167  *        interval. This shall be greater than or equal to
1168  *        Connection_Interval_Min. Time = N * 1.25 msec.
1169  *        Values:
1170  *        - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
1171  * @param Max_Latency Maximum Peripheral latency for the connection in number of
1172  *        connection events.
1173  *        Values:
1174  *        - 0x0000 ... 0x01F3
1175  * @param Supervision_Timeout Supervision timeout for the LE Link. It shall be a
1176  *        multiple of 10 ms and larger than (1 + connPeripheralLatency) *
1177  *        connInterval * 2. Time = N * 10 msec.
1178  *        Values:
1179  *        - 0x000A (100 ms)  ... 0x0C80 (32000 ms)
1180  * @param Min_CE_Length The minimum length of connection event recommended for
1181  *        this LE connection. Time = N * 0.625 msec.
1182  * @param Max_CE_Length The maximum length of connection event recommended for
1183  *        this LE connection. Time = N * 0.625 msec.
1184  * @retval Value indicating success or error code.
1185  */
1186 tBleStatus hci_le_connection_update(uint16_t Connection_Handle,
1187                                     uint16_t Connection_Interval_Min,
1188                                     uint16_t Connection_Interval_Max,
1189                                     uint16_t Max_Latency,
1190                                     uint16_t Supervision_Timeout,
1191                                     uint16_t Min_CE_Length,
1192                                     uint16_t Max_CE_Length);
1193 /**
1194  * @brief The HCI_LE_Set_Host_Channel_Classification command allows the Host to
1195  *        specify a channel classification for the data, secondary advertising,
1196  *        periodic, and isochronous physical channels based on its local
1197  *        information. This classification persists until overwritten with a
1198  *        subsequent HCI_LE_Set_Host_Channel_Classification command or until the
1199  *        Controller is reset using the HCI_Reset command. If this command is
1200  *        used, the Host should send it within 10 seconds of knowing that the
1201  *        channel classification has changed. The interval between two
1202  *        successive commands sent shall be at least one second.
1203  * @param LE_Channel_Map This parameter contains 37 1-bit fields. The nth such
1204  *        field (in the range 0 to 36) contains the value for the link layer
1205  *        channel index n. Channel n is bad = 0. Channel n is unknown = 1. The
1206  *        most significant bits are reserved and shall be set to 0. At least one
1207  *        channel shall be marked as unknown.
1208  *        Flags:
1209  *        - 0x0000000000 ... 0x1FFFFFFFFF
1210  * @retval Value indicating success or error code.
1211  */
1212 tBleStatus hci_le_set_host_channel_classification(uint8_t LE_Channel_Map[5]);
1213 /**
1214  * @brief The LE_Read_Channel_Map command returns the current Channel_Map for
1215  *        the specified Connection_Handle. The returned value indicates the
1216  *        state of the Channel_Map specified by the last transmitted or received
1217  *        Channel_Map (in a CONNECT_REQ or LL_CHANNEL_MAP_REQ message) for the
1218  *        specified Connection_Handle, regardless of whether the Central has
1219  *        received an acknowledgement. (See Bluetooth Specification v.4.1, Vol.
1220  *        2, Part E, 7.8.20)
1221  * @param Connection_Handle Connection handle that identifies the connection.
1222  *        Values:
1223  *        - 0x0000 ... 0x0EFF
1224  * @param[out] LE_Channel_Map This parameter contains 37 1-bit fields. The nth
1225  *             such field (in the range 0 to 36) contains the value for the link
1226  *             layer channel index n. Channel n is unused = 0. Channel n is used
1227  *             = 1. The most significant bits are reserved and shall be set to
1228  *             0.
1229  * @retval Value indicating success or error code.
1230  */
1231 tBleStatus hci_le_read_channel_map(uint16_t Connection_Handle,
1232                                    uint8_t LE_Channel_Map[5]);
1233 /**
1234  * @brief This command requests a list of the used LE features from the remote
1235  *        device. This command shall return a list of the used LE features. For
1236  *        details see [Vol 6] Part B, Section 4.6. This command may be issued on
1237  *        both the central and peripheral. (See Bluetooth Specification v.4.1,
1238  *        Vol. 2, Part E, 7.8.21)
1239  * @param Connection_Handle Connection handle that identifies the connection.
1240  *        Values:
1241  *        - 0x0000 ... 0x0EFF
1242  * @retval Value indicating success or error code.
1243  */
1244 tBleStatus hci_le_read_remote_features(uint16_t Connection_Handle);
1245 /**
1246  * @brief The LE_Encrypt command is used to request the Controller to encrypt
1247  *        the Plaintext_Data in the command using the Key given in the command
1248  *        and returns the Encrypted_Data to the Host. The AES-128 bit block
1249  *        cypher is defined in NIST Publication FIPS-197
1250  *        (http://csrc.nist.gov/publications/fips/ fips197/fips-197.pdf). (See
1251  *        Bluetooth Specification v.4.1, Vol. 2, Part E, 7.8.22)
1252  * @param Key 128 bit key for the encryption of the data given in the command.
1253  * @param Plaintext_Data 128 bit data block that is requested to be encrypted.
1254  * @param[out] Encrypted_Data 128 bit encrypted data block.
1255  * @retval Value indicating success or error code.
1256  */
1257 tBleStatus hci_le_encrypt(uint8_t Key[16],
1258                           uint8_t Plaintext_Data[16],
1259                           uint8_t Encrypted_Data[16]);
1260 /**
1261  * @brief The LE_Rand command is used to request the Controller to generate 8
1262  *        octets of random data to be sent to the Host. The Random_Number shall
1263  *        be generated according to [Vol 2] Part H, Section 2 if the LE Feature
1264  *        (LL Encryption) is supported. (See Bluetooth Specification v.4.1, Vol.
1265  *        2, Part E, 7.8.23)
1266  * @param[out] Random_Number Random Number
1267  * @retval Value indicating success or error code.
1268  */
1269 tBleStatus hci_le_rand(uint8_t Random_Number[8]);
1270 /**
1271  * @brief The LE_Enable_Encryption command is used to authenticate the given
1272  *        encryption key associated with the remote device specified by the
1273  *        connection handle, and once authenticated will encrypt the connection.
1274  *        The parameters are as defined in [Vol 3] Part H, Section 2.4.4. If the
1275  *        connection is already encrypted then the Controller shall pause
1276  *        connection encryption before attempting to authenticate the given
1277  *        encryption key, and then re-encrypt the connection. While encryption
1278  *        is paused no user data shall be transmitted. On an authentication
1279  *        failure, the connection shall be automatically disconnected by the
1280  *        Link Layer. If this command succeeds, then the connection shall be
1281  *        encrypted. This command shall only be used when the local device's
1282  *        role is Central.
1283  * @param Connection_Handle Connection handle that identifies the connection.
1284  *        Values:
1285  *        - 0x0000 ... 0x0EFF
1286  * @param Random_Number 64 bit random number.
1287  * @param Encrypted_Diversifier 16 bit encrypted diversifier.
1288  * @param Long_Term_Key 128 bit long term key.
1289  * @retval Value indicating success or error code.
1290  */
1291 tBleStatus hci_le_enable_encryption(uint16_t Connection_Handle,
1292                                     uint8_t Random_Number[8],
1293                                     uint16_t Encrypted_Diversifier,
1294                                     uint8_t Long_Term_Key[16]);
1295 /**
1296  * @brief The LE_Long_Term_Key_Request_Reply command is used to reply to an LE
1297  *        Long Term Key Request event from the Controller, and specifies the
1298  *        Long_Term_Key parameter that shall be used for this Connection_Handle.
1299  *        The Long_Term_Key is used as defined in [Vol 6] Part B, Section 5.1.3.
1300  *        (See Bluetooth Specification v.4.1, Vol. 2, Part E, 7.8.25)
1301  * @param Connection_Handle Connection handle that identifies the connection.
1302  *        Values:
1303  *        - 0x0000 ... 0x0EFF
1304  * @param Long_Term_Key 128 bit long term key.
1305  * @retval Value indicating success or error code.
1306  */
1307 tBleStatus hci_le_long_term_key_request_reply(uint16_t Connection_Handle,
1308                                               uint8_t Long_Term_Key[16]);
1309 /**
1310  * @brief The LE_Long_Term_Key_Request_Negative_Reply command is used to reply
1311  *        to an LE Long Term Key Request event from the Controller if the Host
1312  *        cannot provide a Long Term Key for this Connection_Handle. (See
1313  *        Bluetooth Specification v.4.1, Vol. 2, Part E, 7.8.26)
1314  * @param Connection_Handle Connection handle that identifies the connection.
1315  *        Values:
1316  *        - 0x0000 ... 0x0EFF
1317  * @retval Value indicating success or error code.
1318  */
1319 tBleStatus hci_le_long_term_key_request_negative_reply(uint16_t Connection_Handle);
1320 /**
1321  * @brief The LE_Read_Supported_States command reads the states and state
1322  *        combinations that the link layer supports. See [Vol 6] Part B, Section
1323  *        1.1.1. LE_States is an 8-octet bit field. If a bit is set to 1 then
1324  *        this state or state combination is supported by the Controller.
1325  *        Multiple bits in LE_States may be set to 1 to indicate support for
1326  *        multiple state and state combinations. All the Advertising type with
1327  *        the Initiate State combinations shall be set only if the corresponding
1328  *        Advertising types and Central Role combination are set. All the
1329  *        Scanning types and the Initiate State combinations shall be set only
1330  *        if the corresponding Scanning types and Central Role combination are
1331  *        set. (See Bluetooth Specification v.4.1, Vol. 2, Part E, 7.8.27)
1332  * @param[out] LE_States State or state combination is supported by the
1333  *             Controller. See Core v4.1, Vol.2, part E, Ch. 7.8.27.
1334  * @retval Value indicating success or error code.
1335  */
1336 tBleStatus hci_le_read_supported_states(uint8_t LE_States[8]);
1337 /**
1338  * @brief The LE_Set_Data_Length command allows the Host to suggest maximum
1339  *        transmission packet size and maximum packet transmission time
1340  *        (connMaxTxOctets and connMaxTxTime - see [Vol 6] Part B, Section
1341  *        4.5.10) to be used for a given connection. The Controller may use
1342  *        smaller or larger values based on local information.
1343  * @param Connection_Handle Connection handle that identifies the connection.
1344  *        Values:
1345  *        - 0x0000 ... 0x0EFF
1346  * @param TxOctets Preferred maximum number of payload octets that the local
1347  *        Controller should include in a single Link Layer Data Channel PDU.
1348  *        Range 0x001B-0x00FB (0x0000 - 0x001A and 0x00FC - 0xFFFF) Reserved for
1349  *        future use). Default: 27 bytes.
1350  *        Values:
1351  *        - 0x001B ... 0x00FB
1352  * @param TxTime Preferred maximum number of microseconds that the local
1353  *        Controller should use to transmit a single Link Layer Data Channel
1354  *        PDU. Range 0x0148-0x0848 (0x0000 - 0x0147 and 0x0849 - 0xFFFF Reserved
1355  *        for future use). Default: 328 bytes.
1356  *        Values:
1357  *        - 0x0148 ... 0x0848
1358  * @retval Value indicating success or error code.
1359  */
1360 tBleStatus hci_le_set_data_length(uint16_t Connection_Handle,
1361                                   uint16_t TxOctets,
1362                                   uint16_t TxTime);
1363 /**
1364  * @brief The LE_Read_Suggested_Default_Data_Length command allows the Host to
1365  *        read the Host preferred values for the Controller maximum transmitted
1366  *        number of payload octets and maximum packet transmission time to be
1367  *        used for new connections (connInitialMaxTxOctets and
1368  *        connInitialMaxTxTime - see ([Vol 6] Part B, Section 4.5.10).
1369  * @param[out] SuggestedMaxTxOctets The Host suggested value for the Controller
1370  *             maximum transmitted number of payload octets to be used for new
1371  *             connections - connInitialMaxTxOctets. Range 0x001B-0x00FB (0x0000
1372  *             - 0x001A and 0x00FC - 0xFFFF Reserved for future use) Default:
1373  *             0x001B
1374  * @param[out] SuggestedMaxTxTime The Host suggested value for the Controller
1375  *             maximum packet transmission time to be used for new connections -
1376  *             connInitialMaxTx-Time. Range 0x0148-0x0848 (0x0000 - 0x0147 and
1377  *             0x0849 - 0xFFFF Reserved for future use) Default: 0x0148
1378  * @retval Value indicating success or error code.
1379  */
1380 tBleStatus hci_le_read_suggested_default_data_length(uint16_t *SuggestedMaxTxOctets,
1381                                                      uint16_t *SuggestedMaxTxTime);
1382 /**
1383  * @brief The LE_Write_Suggested_Default_Data_Length command allows the Host to
1384  *        specify its preferred values for the Controller maximum transmission
1385  *        number of payload octets and maximum packet transmission time to be
1386  *        used for new connections (connInitialMaxTxOctets and
1387  *        connInitialMaxTxTime - see [Vol 6] Part B, Section 4.5.10). The
1388  *        Controller may use smaller or larger values based on local
1389  *        information.
1390  * @param SuggestedMaxTxOctets The Host suggested value for the Controller
1391  *        maximum transmitted number of payload octets to be used for new
1392  *        connections - connInitialMaxTxOctets. Range 0x001B-0x00FB (0x0000 -
1393  *        0x001A and 0x00FC - 0xFFFF Reserved for future use)
1394  *        Values:
1395  *        - 0x001B ... 0x00FB
1396  * @param SuggestedMaxTxTime The Host suggested value for the Controller maximum
1397  *        packet transmission time to be used for new connections -
1398  *        connInitialMaxTx-Time. Range 0x0148-0x0848 (0x0000 - 0x0147 and 0x0849
1399  *        - 0xFFFF Reserved for future use)
1400  *        Values:
1401  *        - 0x0148 ... 0x0848
1402  * @retval Value indicating success or error code.
1403  */
1404 tBleStatus hci_le_write_suggested_default_data_length(uint16_t SuggestedMaxTxOctets,
1405                                                       uint16_t SuggestedMaxTxTime);
1406 /**
1407  * @brief The LE_Read_Local_P-256_Public_Key command is used to return the local
1408  *        P-256 public key from the Controller. The Controller shall generate a
1409  *        new P-256 public/private key pair upon receipt of this command. (See
1410  *        Bluetooth Specification v.4.2, Vol. 2, Part E, 7.8.36)
1411  * @retval Value indicating success or error code.
1412  */
1413 tBleStatus hci_le_read_local_p256_public_key(void);
1414 /**
1415  * @brief The LE_Generate_DHKey command is used to initiate generation of a
1416  *        Diffie- Hellman key in the Controller for use over the LE transport.
1417  *        This command takes the remote P-256 public key as input. The Diffie-
1418  *        Hellman key generation uses the private key generated by
1419  *        LE_Read_Local_P256_Public_Key command. (See Bluetooth Specification
1420  *        v.4.2, Vol. 2, Part E, 7.8.37)
1421  * @param Remote_P256_Public_Key The remote P-256 public key: X, Y format Octets
1422  *        31-0: X coordinate Octets 63-32: Y coordinate Little Endian Format
1423  * @retval Value indicating success or error code.
1424  */
1425 tBleStatus hci_le_generate_dhkey(uint8_t Remote_P256_Public_Key[64]);
1426 /**
1427  * @brief The LE_Add_Device_To_Resolving_List command is used to add one device
1428  *        to the list of address translations used to resolve Resolvable Private
1429  *        Addresses in the Controller. This command cannot be used when address
1430  *        translation is enabled in the Controller and: - Advertising is enabled
1431  *        - Scanning is enabled - Create connection command is outstanding This
1432  *        command can be used at any time when address translation is disabled
1433  *        in the Controller. When a Controller cannot add a device to the
1434  *        resolving list because the list is full, it shall respond with error
1435  *        code 0x07 (Memory Capacity Exceeded). (See Bluetooth Specification
1436  *        v.4.2, Vol. 2, Part E, 7.8.38)
1437  * @param Peer_Identity_Address_Type Identity address type.
1438  *        Values:
1439  *        - 0x00: Public Identity Address
1440  *        - 0x01: Random (static) Identity Address
1441  * @param Peer_Identity_Address Public or Random (static) Identity address of
1442  *        the peer device
1443  * @param Peer_IRK IRK of the peer device
1444  * @param Local_IRK IRK of the local device
1445  * @retval Value indicating success or error code.
1446  */
1447 tBleStatus hci_le_add_device_to_resolving_list(uint8_t Peer_Identity_Address_Type,
1448                                                uint8_t Peer_Identity_Address[6],
1449                                                uint8_t Peer_IRK[16],
1450                                                uint8_t Local_IRK[16]);
1451 /**
1452  * @brief The LE_Remove_Device_From_Resolving_List command is used to remove one
1453  *        device from the list of address translations used to resolve
1454  *        Resolvable Private Addresses in the controller. This command cannot be
1455  *        used when address translation is enabled in the Controller and: -
1456  *        Advertising is enabled - Scanning is enabled - Create connection
1457  *        command is outstanding This command can be used at any time when
1458  *        address translation is disabled in the Controller. When a Controller
1459  *        cannot remove a device from the resolving list because it is not
1460  *        found, it shall respond with error code 0x02 (Unknown Connection
1461  *        Identifier). (See Bluetooth Specification v.4.2, Vol. 2, Part E,
1462  *        7.8.39)
1463  * @param Peer_Identity_Address_Type Identity address type.
1464  *        Values:
1465  *        - 0x00: Public Identity Address
1466  *        - 0x01: Random (static) Identity Address
1467  * @param Peer_Identity_Address Public or Random (static) Identity address of
1468  *        the peer device
1469  * @retval Value indicating success or error code.
1470  */
1471 tBleStatus hci_le_remove_device_from_resolving_list(uint8_t Peer_Identity_Address_Type,
1472                                                     uint8_t Peer_Identity_Address[6]);
1473 /**
1474  * @brief The LE_Clear_Resolving_List command is used to remove all devices from
1475  *        the list of address translations used to resolve Resolvable Private
1476  *        Addresses in the Controller. This command cannot be used when address
1477  *        translation is enabled in the Controller and: - Advertising is enabled
1478  *        - Scanning is enabled - Create connection command is outstanding This
1479  *        command can be used at any time when address translation is disabled
1480  *        in the Controller. (See Bluetooth Specification v.4.2, Vol. 2, Part E,
1481  *        7.8.40)
1482  * @retval Value indicating success or error code.
1483  */
1484 tBleStatus hci_le_clear_resolving_list(void);
1485 /**
1486  * @brief The LE_Read_Resolving_List_Size command is used to read the total
1487  *        number of address translation entries in the resolving list that can
1488  *        be stored in the Controller. (See Bluetooth Specification v.4.2, Vol.
1489  *        2, Part E, 7.8.41)
1490  * @param[out] Resolving_List_Size Number of address translation entries in the
1491  *             resolving list
1492  * @retval Value indicating success or error code.
1493  */
1494 tBleStatus hci_le_read_resolving_list_size(uint8_t *Resolving_List_Size);
1495 /**
1496  * @brief The LE_Read_Peer_Resolvable_Address command is used to get the current
1497  *        peer Resolvable Private Address being used for the corresponding peer
1498  *        Public and Random (static) Identity Address. The peer's resolvable
1499  *        address being used may change after the command is called. This
1500  *        command can be used at any time. When a Controller cannot find a
1501  *        Resolvable Private Address associated with the Peer Identity Address,
1502  *        it shall respond with error code 0x02 (Unknown Connection Identifier).
1503  *        (See Bluetooth Specification v.4.2, Vol. 2, Part E, 7.8.42)
1504  * @param Peer_Identity_Address_Type Identity address type.
1505  *        Values:
1506  *        - 0x00: Public Identity Address
1507  *        - 0x01: Random (static) Identity Address
1508  * @param Peer_Identity_Address Public or Random (static) Identity address of
1509  *        the peer device
1510  * @param[out] Peer_Resolvable_Address Resolvable Private Address being used by
1511  *             the peer device
1512  * @retval Value indicating success or error code.
1513  */
1514 tBleStatus hci_le_read_peer_resolvable_address(uint8_t Peer_Identity_Address_Type,
1515                                                uint8_t Peer_Identity_Address[6],
1516                                                uint8_t Peer_Resolvable_Address[6]);
1517 /**
1518  * @brief The LE_Read_Local_Resolvable_Address command is used to get the
1519  *        current local Resolvable Private Address being used for the
1520  *        corresponding peer Identity Address. The local's resolvable address
1521  *        being used may change after the command is called. This command can be
1522  *        used at any time. When a Controller cannot find a Resolvable Private
1523  *        Address associated with the Peer Identity Address, it shall respond
1524  *        with error code 0x02 (Unknown Connection Identifier). (See Bluetooth
1525  *        Specification v.4.2, Vol. 2, Part E, 7.8.43)
1526  * @param Peer_Identity_Address_Type Identity address type.
1527  *        Values:
1528  *        - 0x00: Public Identity Address
1529  *        - 0x01: Random (static) Identity Address
1530  * @param Peer_Identity_Address Public or Random (static) Identity address of
1531  *        the peer device
1532  * @param[out] Local_Resolvable_Address Resolvable Private Address being used by
1533  *             the local device
1534  * @retval Value indicating success or error code.
1535  */
1536 tBleStatus hci_le_read_local_resolvable_address(uint8_t Peer_Identity_Address_Type,
1537                                                 uint8_t Peer_Identity_Address[6],
1538                                                 uint8_t Local_Resolvable_Address[6]);
1539 /**
1540  * @brief The LE_Set_Address_Resolution_Enable command is used to enable
1541  *        resolution of Resolvable Private Addresses in the Controller. This
1542  *        causes the Controller to use the resolving list whenever the
1543  *        Controller receives a local or peer Resolvable Private Address. This
1544  *        command can be used at any time except when: - Advertising is enabled
1545  *        - Scanning is enabled - Create connection command is outstanding (See
1546  *        Bluetooth Specification v.4.2, Vol. 2, Part E, 7.8.44)
1547  * @param Address_Resolution_Enable Enable/disable address resolution in the
1548  *        controller. 0x00: Address Resolution in controller disabled (default),
1549  *        0x01: Address Resolution in controller enabled
1550  *        Values:
1551  *        - 0x00: Address Resolution in controller disabled (default)
1552  *        - 0x01: Address Resolution in controller enabled
1553  * @retval Value indicating success or error code.
1554  */
1555 tBleStatus hci_le_set_address_resolution_enable(uint8_t Address_Resolution_Enable);
1556 /**
1557  * @brief The LE_Set_Resolvable_Private_Address_Timeout command set the length
1558  *        of time the controller uses a Resolvable Private Address before a new
1559  *        resolvable private address is generated and starts being used. This
1560  *        timeout applies to all addresses generated by the controller. (See
1561  *        Bluetooth Specification v.4.2, Vol. 2, Part E, 7.8.45)
1562  * @param RPA_Timeout RPA_Timeout measured in seconds. Range for N: 0x0001 -
1563  *        0xA1B8 (1 sec - approximately 11.5 hours) Default: N= 0x0384 (900 secs
1564  *        or 15 minutes)
1565  *        Values:
1566  *        - 0x0001 ... 0xA1B8
1567  * @retval Value indicating success or error code.
1568  */
1569 tBleStatus hci_le_set_resolvable_private_address_timeout(uint16_t RPA_Timeout);
1570 /**
1571  * @brief The LE_Read_Maximum_Data_Length command allows the Host to read the
1572  *        Controller  maximum supported payload octets and packet duration times
1573  *        for transmission and reception (supportedMaxTxOctets and
1574  *        supportedMaxTxTime, supportedMaxRxOctets, and supportedMaxRxTime, see
1575  *        [Vol 6] Part B, Section 4.5.10).
1576  * @param[out] supportedMaxTxOctets Maximum number of payload octets that the
1577  *             local Controller supports for transmission of a single Link Layer
1578  *             Data Channel PDU. Range 0x001B-0x00FB (0x0000 - 0x001A and 0x00FC
1579  *             - 0xFFFF Reserved for future use)
1580  * @param[out] supportedMaxTxTime Maximum time, in microseconds, that the local
1581  *             Controller supports for transmission of a single Link Layer Data
1582  *             Channel PDU. Range 0x0148-0x0848 (0x0000 - 0x0147 and 0x0849 -
1583  *             0xFFFF Reserved for future use)
1584  * @param[out] supportedMaxRxOctets Maximum number of payload octets that the
1585  *             local Controller supports for reception of a single Link Layer
1586  *             Data Channel PDU. Range 0x001B-0x00FB (0x0000 - 0x001A and 0x00FC
1587  *             - 0xFFFF Reserved for future use)
1588  * @param[out] supportedMaxRxTime Maximum time, in microseconds, that the local
1589  *             Controller supports for reception of a single Link Layer Data
1590  *             Channel PDU. Range 0x0148-0x0848 (0x0000 - 0x0147 and 0x0849 -
1591  *             0xFFFF Reserved for future use)
1592  * @retval Value indicating success or error code.
1593  */
1594 tBleStatus hci_le_read_maximum_data_length(uint16_t *supportedMaxTxOctets,
1595                                            uint16_t *supportedMaxTxTime,
1596                                            uint16_t *supportedMaxRxOctets,
1597                                            uint16_t *supportedMaxRxTime);
1598 /**
1599  * @brief The LE_Read_PHY command is used to read the current transmitter PHY
1600  *        and receiver PHY on the connection identified by the
1601  *        Connection_Handle.
1602  * @param Connection_Handle Connection handle that identifies the connection.
1603  *        Values:
1604  *        - 0x0000 ... 0x0EFF
1605  * @param[out] TX_PHY Transmitter PHY for the connection 0x01: The transmitter
1606  *             PHY for the connection is LE 1M 0x02: The transmitter PHY for the
1607  *             connection is LE 2M 0x03: The transmitter PHY for the connection
1608  *             is LE Coded
1609  *             Values:
1610  *             - 0x01: LE_1M_PHY
1611  *             - 0x02: LE_2M_PHY
1612  *             - 0x03: LE_CODED_PHY
1613  * @param[out] RX_PHY Receiver PHY for the connection. 0x01: The receiver PHY
1614  *             for the connection is LE 1M 0x02: The receiver PHY for the
1615  *             connection is LE 2M 0x03: The receiver PHY for the connection is
1616  *             LE Coded All other values: Reserved for future use
1617  *             Values:
1618  *             - 0x01: The receiver PHY for the connection is LE 1M
1619  *             - 0x02: The receiver PHY for the connection is LE 2M
1620  *             - 0x03: The receiver PHY for the connection is LE Coded
1621  * @retval Value indicating success or error code.
1622  */
1623 tBleStatus hci_le_read_phy(uint16_t Connection_Handle,
1624                            uint8_t *TX_PHY,
1625                            uint8_t *RX_PHY);
1626 /**
1627  * @brief The LE_Set_Default_PHY command allows the Host to specify its
1628  *        preferred values for the transmitter PHY and receiver PHY to be used
1629  *        for all subsequent connections over the LE transport.
1630  * @param ALL_PHYS The ALL_PHYS parameter is a bit field that allows the Host to
1631  *        specify, for each direction, whether it has no preference among the
1632  *        PHYs that the Controller supports in a given direction or whether it
1633  *        has specified particular PHYs that it prefers in the TX_PHYS or
1634  *        RX_PHYS parameter. Bits: 0: The Host has no preference among the
1635  *        transmitter PHYs supported by the Controller 1: The Host has no
1636  *        preference among the receiver PHYs supported by the Controller
1637  *        Flags:
1638  *        - 0x01: No preference for TX
1639  *        - 0x02: No preference for RX
1640  * @param TX_PHYS The TX_PHYS parameter is a bit field that indicates the
1641  *        transmitter PHYs that the Host prefers the Controller to use. If the
1642  *        ALL_PHYS parameter specifies that the Host has no preference, the
1643  *        TX_PHYS parameter is ignored; otherwise at least one bit shall be set
1644  *        to 1. Bits: 0: The Host prefers to use the LE 1M transmitter PHY
1645  *        (possibly among others) 1: The Host prefers to use the LE 2M
1646  *        transmitter PHY (possibly among others) 2: The Host prefers to use the
1647  *        LE Coded transmitter PHY (possibly among others) 3-7: Reserved for
1648  *        future use
1649  *        Flags:
1650  *        - 0x01: LE_1M_PHY_BIT
1651  *        - 0x02: LE_2M_PHY_BIT
1652  *        - 0x04: LE_CODED_PHY_BIT
1653  * @param RX_PHYS The RX_PHYS parameter is a bit field that indicates the
1654  *        receiver PHYs that the Host prefers the Controller to use. If the
1655  *        ALL_PHYS parameter specifies that the Host has no preference, the
1656  *        RX_PHYS parameter is ignored; otherwise at least one bit shall be set
1657  *        to 1. Bits: 0: The Host prefers to use the LE 1M receiver PHY
1658  *        (possibly among others) 1: The Host prefers to use the LE 2M receiver
1659  *        PHY (possibly among others) 2: The Host prefers to use the LE Coded
1660  *        receiver PHY (possibly among others) 3-7: Reserved for future use
1661  *        Flags:
1662  *        - 0x01: LE_1M_PHY_BIT
1663  *        - 0x02: LE_2M_PHY_BIT
1664  *        - 0x04: LE_CODED_PHY_BIT
1665  * @retval Value indicating success or error code.
1666  */
1667 tBleStatus hci_le_set_default_phy(uint8_t ALL_PHYS,
1668                                   uint8_t TX_PHYS,
1669                                   uint8_t RX_PHYS);
1670 /**
1671  * @brief The LE_Set_PHY command is used to set the PHY preferences for the
1672  *        connection identified by the Connection_Handle. The Controller might
1673  *        not be able to make the change (e.g. because the peer does not support
1674  *        the requested PHY) or may decide that the current PHY is preferable.
1675  * @param Connection_Handle Connection handle that identifies the connection.
1676  *        Values:
1677  *        - 0x0000 ... 0x0EFF
1678  * @param ALL_PHYS The ALL_PHYS parameter is a bit field that allows the Host to
1679  *        specify, for each direction, whether it has no preference among the
1680  *        PHYs that the Controller supports in a given direction or whether it
1681  *        has specified particular PHYs that it prefers in the TX_PHYS or
1682  *        RX_PHYS parameter. Bits: 0: The Host has no preference among the
1683  *        transmitter PHYs supported by the Controller 1: The Host has no
1684  *        preference among the receiver PHYs supported by the Controller
1685  *        Flags:
1686  *        - 0x01: No preference for TX
1687  *        - 0x02: No preference for RX
1688  * @param TX_PHYS The TX_PHYS parameter is a bit field that indicates the
1689  *        transmitter PHYs that the Host prefers the Controller to use. If the
1690  *        ALL_PHYS parameter specifies that the Host has no preference, the
1691  *        TX_PHYS parameter is ignored; otherwise at least one bit shall be set
1692  *        to 1. Bits: 0: The Host prefers to use the LE 1M transmitter PHY
1693  *        (possibly among others) 1: The Host prefers to use the LE 2M
1694  *        transmitter PHY (possibly among others) 2: The Host prefers to use the
1695  *        LE Coded transmitter PHY (possibly among others) 3-7: Reserved for
1696  *        future use
1697  *        Flags:
1698  *        - 0x01: LE_1M_PHY_BIT
1699  *        - 0x02: LE_2M_PHY_BIT
1700  *        - 0x04: LE_CODED_PHY_BIT
1701  * @param RX_PHYS The RX_PHYS parameter is a bit field that indicates the
1702  *        receiver PHYs that the Host prefers the Controller to use. If the
1703  *        ALL_PHYS parameter specifies that the Host has no preference, the
1704  *        RX_PHYS parameter is ignored; otherwise at least one bit shall be set
1705  *        to 1. Bits: 0: The Host prefers to use the LE 1M receiver PHY
1706  *        (possibly among others) 1: The Host prefers to use the LE 2M receiver
1707  *        PHY (possibly among others) 2: The Host prefers to use the LE Coded
1708  *        receiver PHY (possibly among others) 3-7: Reserved for future use
1709  *        Flags:
1710  *        - 0x01: LE_1M_PHY_BIT
1711  *        - 0x02: LE_2M_PHY_BIT
1712  *        - 0x04: LE_CODED_PHY_BIT
1713  * @param PHY_options The PHY_options parameter is a bit field that allows the
1714  *        Host to specify options for PHYs. The default value for a new
1715  *        connection shall be all zero bits. The Controller may override any
1716  *        preferred coding for transmitting on the LE Coded PHY. The Host may
1717  *        specify a preferred coding even if it prefers not to use the LE Coded
1718  *        transmitter PHY since the Controller may override the PHY preference.
1719  *        0 = the Host has no preferred coding when transmitting on the LE Coded
1720  *        PHY 1 = the Host prefers that S=2 coding be used when transmitting on
1721  *        the LE Coded PHY 2 = the Host prefers that S=8 coding be used when
1722  *        transmitting on the LE Coded PHY
1723  *        Values:
1724  *        - 0: No preferred LE Coded PHY
1725  *        - 1: S=2 preferred on LE Coded PHY
1726  *        - 2: S=8 preferred on LE Coded PHY
1727  * @retval Value indicating success or error code.
1728  */
1729 tBleStatus hci_le_set_phy(uint16_t Connection_Handle,
1730                           uint8_t ALL_PHYS,
1731                           uint8_t TX_PHYS,
1732                           uint8_t RX_PHYS,
1733                           uint16_t PHY_options);
1734 /**
1735  * @brief The LE_Set_Advertising_Set_Random_Address command is used by the Host
1736  *        to set the random device address specified by the Random_Address
1737  *        parameter. This address is used in the Controller (see [Vol 6] Part B,
1738  *        Section 1.3.2) for the advertiser's address contained in the
1739  *        advertising PDUs for the advertising set specified by the
1740  *        Advertising_Handle parameter. If the Host issues this command while an
1741  *        advertising set using connectable advertising is enabled, the
1742  *        Controller shall return the error code Command Disallowed (0x0C). The
1743  *        Host may issue this command at any other time. If this command is used
1744  *        to change the address, the new random address shall take effect for
1745  *        advertising no later than the next successful LE Extended Set
1746  *        Advertising Enable Command and for periodic advertising no later than
1747  *        the next successful LE Periodic Advertising Enable Command.
1748  * @param Advertising_Handle It is used to identify an advertising set
1749  *        Values:
1750  *        - 0x00 ... 0xEF
1751  * @param Advertising_Random_Address Random Device Address as defined by [Vol 6]
1752  *        Part B, Section 1.3.2
1753  * @retval Value indicating success or error code.
1754  */
1755 tBleStatus hci_le_set_advertising_set_random_address(uint8_t Advertising_Handle,
1756                                                      uint8_t Advertising_Random_Address[6]);
1757 /**
1758  * @brief The LE_Set_Extended_Advertising_Parameters command is used by the Host
1759  *        to set the advertising parameters. The Advertising_Handle parameter
1760  *        identifies the advertising set whose parameters are being configured.
1761  *        The Advertising_Event_Properties parameter describes the type of
1762  *        advertising event that is being configured and its basic properties.
1763  *        The type shall be one supported by the Controller.
1764  * @param Advertising_Handle The Advertising_Handle parameter identifies the
1765  *        advertising set whose parameters are being configured.
1766  *        Values:
1767  *        - 0x00 ... 0xEF
1768  * @param Advertising_Event_Properties The Advertising_Event_Properties
1769  *        parameter describes the type of advertising event that is being
1770  *        configured and its basic properties. The type shall be one supported
1771  *        by the Controller. Bits: 0 Connectable advertising 1 Scannable
1772  *        advertising 2 Directed advertising 3 High Duty Cycle Directed
1773  *        Connectable advertising (<= 3.75 ms Advertising Interval) 4 Use legacy
1774  *        advertising PDUs 5 Omit advertiser's address from all PDUs ("anonymous
1775  *        advertising") 6 Include TxPower in the extended header of the
1776  *        advertising PDU
1777  *        Flags:
1778  *        - 0x0001: Connectable
1779  *        - 0x0002: Scannable
1780  *        - 0x0004: Directed
1781  *        - 0x0008: HDC Directed Connectable
1782  *        - 0x0010: Legacy
1783  *        - 0x0020: Anonymous
1784  *        - 0x0040: TxPower in ext header
1785  * @param Primary_Advertising_Interval_Min Minimum advertising interval for
1786  *        undirected and low duty cycle directed advertising. Time = N * 0.625
1787  *        ms; Time Range: 20 ms to 10,485.759375 s.
1788  *        Values:
1789  *        - 0x000020 (20.000 ms)  ... 0xFFFFFF (10485759.375 ms)
1790  * @param Primary_Advertising_Interval_Max Maximum advertising interval for
1791  *        undirected and low duty cycle directed advertising. Time = N * 0.625
1792  *        ms; Time Range: 20 ms to 10,485.759375 s.
1793  *        Values:
1794  *        - 0x000020 (20.000 ms)  ... 0xFFFFFF (10485759.375 ms)
1795  * @param Primary_Advertising_Channel_Map The Primary_Advertising_Channel_Map is
1796  *        a bit field that indicates the advertising channels that shall be used
1797  *        when transmitting advertising packets. At least one channel bit shall
1798  *        be set in the Primary_Advertising_Channel_Map parameter.
1799  *        Flags:
1800  *        - 0x01: CH_37
1801  *        - 0x02: CH_38
1802  *        - 0x04: CH_39
1803  * @param Own_Address_Type The Own_Address_Type parameter specifies the type of
1804  *        address being used in the advertising packets. For random addresses,
1805  *        the address is specified by the LE_Set_Advertising_Set_Random_Address
1806  *        command.  0x00 Public Device Address 0x01 Random Device Address 0x02
1807  *        Controller generates the Resolvable Private Address based on the local
1808  *        IRK from the resolving list. If the resolving list contains no
1809  *        matching entry, use the public address. 0x03 Controller generates the
1810  *        Resolvable Private Address based on the local IRK from the resolving
1811  *        list. If the resolving list contains no matching entry, use the random
1812  *        address from LE_Set_Advertising_Set_Random_Address. All other values
1813  *        Reserved for future use
1814  *        Values:
1815  *        - 0x00: Public Device Address
1816  *        - 0x01: Random Device Address
1817  *        - 0x02: Resolvable Private Address / Public Address
1818  *        - 0x03: Resolvable Private Address / Random Address
1819  * @param Peer_Address_Type Peer Address type
1820  *        Values:
1821  *        - 0x00: Public Device Address or Public Identity Address
1822  *        - 0x01: Random Device Address or Random (static) Identity Address
1823  * @param Peer_Address Public Device Address, Random Device Address, Public
1824  *        Identity Address, or Random (static) Identity Address of the device to
1825  *        be connected.
1826  * @param Advertising_Filter_Policy Advertising Filter Policy. This parameter is
1827  *        ignored when directed advertising is enabled.  0x00 Process scan and
1828  *        connection requests from all devices (i.e., the Filter Accept List is
1829  *        not in use) 0x01 Process connection requests from all devices and scan
1830  *        requests only from devices that are in the Filter Accept List 0x02
1831  *        Process scan requests from all devices and connection requests only
1832  *        from devices that are in the Filter Accept List. 0x03 Process scan and
1833  *        connection requests only from devices in the Filter Accept List. All
1834  *        other values are reserved for future use
1835  *        Values:
1836  *        - 0x00: HCI_ADV_FILTER_NONE
1837  *        - 0x01: HCI_ADV_FILTER_ACCEPT_LIST_SCAN
1838  *        - 0x02: HCI_ADV_FILTER_ACCEPT_LIST_CONNECT
1839  *        - 0x03: HCI_ADV_FILTER_ACCEPT_LIST_SCAN_CONNECT
1840  * @param Advertising_Tx_Power Units: dBm  The Advertising_Tx_Power parameter
1841  *        indicates the maximum power level at which the advertising packets are
1842  *        to be transmitted on the advertising channels. The Controller shall
1843  *        choose a power level lower than or equal to the one specified by the
1844  *        Host.
1845  *        Values:
1846  *        - -127 ... 126
1847  *        - 127: No preference
1848  * @param Primary_Advertising_PHY The Primary_Advertising_PHY parameter
1849  *        indicates the PHY on which the advertising packets are transmitted on
1850  *        the primary advertising channel. If legacy advertising PDUs are being
1851  *        used, the Primary_Advertising_PHY shall indicate the LE 1M PHY.
1852  *        Values:
1853  *        - 0x01: LE_1M_PHY
1854  *        - 0x03: LE_CODED_PHY
1855  * @param Secondary_Advertising_Max_Skip The Secondary_Advertising_Max_Skip
1856  *        parameter is the maximum number of advertising events that can be
1857  *        skipped before the AUX_ADV_IND can be sent. 0x00 AUX_ADV_IND shall be
1858  *        sent prior to the next advertising event 0x01-0xFF Maximum advertising
1859  *        events the Controller can skip before sending the AUX_ADV_IND packets
1860  *        on the secondary advertising channel
1861  *        Values:
1862  *        - 0x00 ... 0xFF
1863  * @param Secondary_Advertising_PHY The Secondary_Advertising_PHY parameter
1864  *        indicates the PHY on which the advertising packets are transmitted on
1865  *        the secondary advertising channel.
1866  *        Values:
1867  *        - 0x01: LE_1M_PHY
1868  *        - 0x02: LE_2M_PHY
1869  *        - 0x03: LE_CODED_PHY
1870  * @param Advertising_SID The Advertising_SID parameter specifies the value to
1871  *        be transmitted in the Advertising SID subfield of the ADI field of the
1872  *        Extended Header of those advertising channel PDUs that have an ADI
1873  *        field. If the advertising set only uses PDUs that do not contain an
1874  *        ADI field, Advertising_SID is ignored.
1875  *        Values:
1876  *        - 0x00 ... 0x0F
1877  * @param Scan_Request_Notification_Enable The Scan_Request_Notification_Enable
1878  *        parameter indicates whether the Controller shall send notifications
1879  *        upon the receipt of a scan request PDU that is in response to an
1880  *        advertisement from the specified advertising set that contains its
1881  *        device address and is from a scanner that is allowed by the
1882  *        advertising filter policy.
1883  *        Values:
1884  *        - 0x00: Scan request notifications disabled
1885  *        - 0x01: Scan request notifications enabled
1886  * @param[out] Selected_Tx_Power Units: dBm. The Selected_Tx_Power return
1887  *             parameter indicates the transmit power selected by the
1888  *             Controller. The Controller shall not change the transmit power
1889  *             for this advertising set without being directed to by the Host.
1890  *             Values:
1891  *             - -127 ... 126
1892  * @retval Value indicating success or error code.
1893  */
1894 tBleStatus hci_le_set_extended_advertising_parameters(uint8_t Advertising_Handle,
1895                                                       uint16_t Advertising_Event_Properties,
1896                                                       uint8_t Primary_Advertising_Interval_Min[3],
1897                                                       uint8_t Primary_Advertising_Interval_Max[3],
1898                                                       uint8_t Primary_Advertising_Channel_Map,
1899                                                       uint8_t Own_Address_Type,
1900                                                       uint8_t Peer_Address_Type,
1901                                                       uint8_t Peer_Address[6],
1902                                                       uint8_t Advertising_Filter_Policy,
1903                                                       int8_t Advertising_Tx_Power,
1904                                                       uint8_t Primary_Advertising_PHY,
1905                                                       uint8_t Secondary_Advertising_Max_Skip,
1906                                                       uint8_t Secondary_Advertising_PHY,
1907                                                       uint8_t Advertising_SID,
1908                                                       uint8_t Scan_Request_Notification_Enable,
1909                                                       int8_t *Selected_Tx_Power);
1910 /**
1911  * @brief The LE_Set_Extended_Advertising_Enable command is used to request the
1912  *        Controller to enable or disable one or more advertising sets using the
1913  *        advertising sets identified by the Advertising_Handle[i] parameter.
1914  *        The Controller manages the timing of advertisements in accordance with
1915  *        the advertising parameters given in the
1916  *        LE_Set_Extended_Advertising_Parameters command.
1917  * @param Enable It allows to enable or disable one or more advertising sets
1918  *        using the advertising sets identified by the Advertising_Handle[i]
1919  *        parameter.
1920  *        Values:
1921  *        - 0x00: Disable
1922  *        - 0x01: Enable
1923  * @param Number_of_Sets The Number_of_Sets parameter is the number of
1924  *        advertising sets contained in the parameter arrays.
1925  *        Values:
1926  *        - 0x00: Disable all advertising sets
1927  *        - 0x01 ... 0x3F: Number of advertising sets to enable or disable
1928  * @param Advertising_Set_Parameters See @ref Advertising_Set_Parameters_t
1929  * @retval Value indicating success or error code.
1930  */
1931 tBleStatus hci_le_set_extended_advertising_enable(uint8_t Enable,
1932                                                   uint8_t Number_of_Sets,
1933                                                   Advertising_Set_Parameters_t Advertising_Set_Parameters[]);
1934 /**
1935  * @brief The LE_Read_Number_of_Supported_Advertising_Sets command is used to
1936  *        read the maximum number of advertising sets supported by the
1937  *        advertising Controller at the same time. Note: The number of
1938  *        advertising sets that can be supported is not fixed and the Controller
1939  *        can change it at any time because the memory used to store advertising
1940  *        sets can also be used for other purposes.
1941  * @param[out] Num_Supported_Advertising_Sets Maximum number of advertising sets
1942  *             supported by the advertising Controller at the same time.
1943  *             Values:
1944  *             - 0x01 ... 0xF0: Number of advertising sets supported at the same time
1945  * @retval Value indicating success or error code.
1946  */
1947 tBleStatus hci_le_read_number_of_supported_advertising_sets(uint8_t *Num_Supported_Advertising_Sets);
1948 /**
1949  * @brief The LE_Remove_Advertising_Set command is used to remove an advertising
1950  *        set from the Controller. If the advertising set corresponding to the
1951  *        Advertising_Handle parameter does not exist, then the Controller shall
1952  *        return the error code Unknown Advertising Identifier (0x42). If
1953  *        advertising on the advertising set is enabled, then the Controller
1954  *        shall return the error code Command Disallowed (0x0C).
1955  * @param Advertising_Handle It is used to identify an advertising set
1956  *        Values:
1957  *        - 0x00 ... 0xEF: Used to identify an advertising set
1958  * @retval Value indicating success or error code.
1959  */
1960 tBleStatus hci_le_remove_advertising_set(uint8_t Advertising_Handle);
1961 /**
1962  * @brief The LE_Clear_Advertising_Sets command is used to remove all existing
1963  *        advertising sets from the Controller. If advertising is enabled on any
1964  *        advertising set, then the Controller shall return the error code
1965  *        Command Disallowed (0x0C). Note: All advertising sets are cleared on
1966  *        HCI reset.
1967  * @retval Value indicating success or error code.
1968  */
1969 tBleStatus hci_le_clear_advertising_sets(void);
1970 /**
1971  * @brief The LE_Set_Periodic_Advertising_Parameters command is used by the Host
1972  *        to set the parameters for periodic advertising. The Advertising_Handle
1973  *        parameter identifies the advertising set whose periodic advertising
1974  *        parameters are being configured. If the corresponding advertising set
1975  *        does not already exist, then the Controller shall return the error
1976  *        code Unknown Advertising Identifier (0x42). The
1977  *        Periodic_Advertising_Interval_Min parameter shall be less than or
1978  *        equal to the Periodic_Advertising_Interval_Max parameter. The
1979  *        Periodic_Advertising_Interval_Min and
1980  *        Periodic_Advertising_Interval_Max parameters should not be the same
1981  *        value to enable the Controller to determine the best advertising
1982  *        interval given other activities. The Periodic_Advertising_Properties
1983  *        parameter indicates which fields should be included in the advertising
1984  *        packet. If the advertising set identified by the Advertising_Handle
1985  *        specified anonymous advertising, the Controller shall return the error
1986  *        code Invalid HCI Parameters (0x12). If the Host issues this command
1987  *        when periodic advertising is enabled for the specified advertising
1988  *        set, the Controller shall return the error code Command Disallowed
1989  *        (0x0C). If the Advertising_Handle does not identify an advertising set
1990  *        that is already configured for periodic advertising and the Controller
1991  *        is unable to support more periodic advertising at present, the
1992  *        Controller shall return the error code Memory Capacity Exceeded (0x07)
1993  * @param Advertising_Handle It is used to identify an advertising set
1994  *        Values:
1995  *        - 0x00 ... 0xEF: Used to identify a periodic advertisement
1996  * @param Periodic_Advertising_Interval_Min Minimum advertising interval for
1997  *        periodic advertising. Time = N * 1.25 ms; Time Range: 7.5ms to
1998  *        81.91875 s.
1999  *        Values:
2000  *        - 0x0006 (7.50 ms)  ... 0xFFFF (NaN)
2001  * @param Periodic_Advertising_Interval_Max Maximum advertising interval for
2002  *        periodic advertising. Time = N * 1.25 ms; Time Range: 7.5ms to
2003  *        81.91875 s.
2004  *        Values:
2005  *        - 0x0006 (7.50 ms)  ... 0xFFFF (NaN)
2006  * @param Periodic_Advertising_Properties The Periodic_Advertising_Properties
2007  *        parameter indicates which fields should be included in the advertising
2008  *        packet.
2009  *        Flags:
2010  *        - 0x0040: Include TxPower in the advertising PDU
2011  * @retval Value indicating success or error code.
2012  */
2013 tBleStatus hci_le_set_periodic_advertising_parameters(uint8_t Advertising_Handle,
2014                                                       uint16_t Periodic_Advertising_Interval_Min,
2015                                                       uint16_t Periodic_Advertising_Interval_Max,
2016                                                       uint16_t Periodic_Advertising_Properties);
2017 /**
2018  * @brief The HCI_LE_Set_Periodic_Advertising_Enable command is used to request
2019  *        the Controller to enable or disable the periodic advertising for the
2020  *        advertising set specified by the Advertising_Handle parameter
2021  *        (ordinary advertising is not affected). If the advertising set is not
2022  *        currently enabled (see the HCI_LE_Set_Extended_Advertising_Enable
2023  *        command), the periodic advertising is not started until the
2024  *        advertising set is enabled. Once the advertising set has been enabled,
2025  *        the Controller shall continue periodic advertising until the Host
2026  *        issues an HCI_LE_Set_Periodic_Advertising_Enable command with bit 0 of
2027  *        Enable set to 0 (periodic advertising is disabled). Disabling the
2028  *        advertising set has no effect on the periodic advertising once the
2029  *        advertising set has been enabled. The Controller manages the timing of
2030  *        advertisements in accordance with the advertising parameters given in
2031  *        the HCI_LE_Set_Periodic_Advertising_Parameters command. If the
2032  *        advertising set corresponding to the Advertising_Handle parameter does
2033  *        not exist, the Controller shall return the error code Unknown
2034  *        Advertising Identifier (0x42). If bit 0 of Enable is set to 1
2035  *        (periodic advertising is enabled) and the advertising set contains
2036  *        partial periodic advertising data, the Controller shall return the
2037  *        error code Command Disallowed (0x0C). If bit 0 of Enable is set to 1
2038  *        and the Host has not issued the
2039  *        HCI_LE_Set_Periodic_Advertising_Parameters command for the advertising
2040  *        set, the Controller shall either use vendor-specified parameters or
2041  *        return the error code Command Disallowed (0x0C). If bit 0 of Enable is
2042  *        set to 1 and the length of the periodic advertising data is greater
2043  *        than the maximum that the Controller can transmit within the chosen
2044  *        periodic advertising interval, the Controller shall return the error
2045  *        code Packet Too Long (0x45). If advertising on the LE Coded PHY, the
2046  *        S=8 coding shall be assumed. If bit 0 of Enable is set to 1 and the
2047  *        advertising set identified by the Advertising_Handle specified
2048  *        scannable, connectable, legacy, or anonymous (0x0C). If bit 0 of
2049  *        Enable is set to 0 and the Controller supports the Periodic
2050  *        Advertising ADI Support feature, then the Controller shall ignore bit
2051  *        1. If bit 1 of Enable is set to 1 and the Controller does not support
2052  *        the Periodic Advertising ADI Support feature, the Controller shall
2053  *        return an error which should use the error code Unsupported Feature or
2054  *        Parameter Value (0x11). Enabling periodic advertising when it is
2055  *        already enabled can cause the random address to change. Disabling
2056  *        periodic advertising when it is already disabled has no effect.
2057  * @param Enable It is used to enabled advertising and include ADI field. If bit
2058  *        0 is set, enable periodic advertising. if bit 1 is set, Include the
2059  *        ADI field in AUX_SYNC_IND PDUs.
2060  *        Flags:
2061  *        - 0x01: ENABLE_PERIODIC_ADV
2062  *        - 0x02: INCLUDE_ADI_FIELD
2063  * @param Advertising_Handle Used to identify an advertising set.
2064  *        Values:
2065  *        - 0x00 ... 0xEF
2066  * @retval Value indicating success or error code.
2067  */
2068 tBleStatus hci_le_set_periodic_advertising_enable(uint8_t Enable,
2069                                                   uint8_t Advertising_Handle);
2070 /**
2071  * @brief The LE_Set_Extended_Scan_Parameters command is used to set the
2072  *        extended scan parameters to be used on the advertising channels. The
2073  *        Scanning_PHYs parameter indicates the PHY(s) on which the advertising
2074  *        packets should be received on the primary advertising channel. The
2075  *        Host may enable one or more scanning PHYs. The Scan_Type[i],
2076  *        Scan_Interval[i], and Scan_Window[i] parameters array elements are
2077  *        ordered in the same order as the set bits in the Scanning_PHY
2078  *        parameter, starting from bit 0. The number of array elements is
2079  *        determined by the number of bits set in the Scanning_PHY parameter.
2080  *        The Scan_Type[i] parameter specifies the type of scan to perform. The
2081  *        Scan_Interval[i] and Scan_Window[i] parameters are recommendations
2082  *        from the Host on how long (Scan_Window[i]) and how frequently
2083  *        (Scan_Interval[i]) the Controller should scan (see [Vol 6] Part B,
2084  *        Section 4.5.3); however the frequency and length of the scan is
2085  *        implementation specific. If the requested scan cannot be supported by
2086  *        the implementation, the Controller shall return the error code Invalid
2087  *        HCI Command Parameters (0x12). The Own_Address_Type parameter
2088  *        indicates the type of address being used in the scan request packets.
2089  *        If the Host issues this command when scanning is enabled in the
2090  *        Controller, the Controller shall return the error code Command
2091  *        Disallowed (0x0C).
2092  * @param Own_Address_Type The Own_Address_Type parameter indicates the type of
2093  *        address being used in the scan request packets.
2094  *        Values:
2095  *        - 0x00: Public Device Address
2096  *        - 0x01: Random Device Address
2097  *        - 0x02: Controller generates the Resolvable Private Address based on the local
2098 IRK from the resolving list. If the resolving list contains no matching
2099 entry, then use the public address.
2100  *        - 0x03: Controller generates the Resolvable Private Address based on the local
2101 IRK from the resolving list. If the resolving list contains no matching
2102 entry, then use the random address from LE_Set_Random_Address.
2103  * @param Scanning_Filter_Policy 0x00 Accept all advertisement packets. Directed
2104  *        advertising packets which are not addressed for this device shall be
2105  *        ignored. 0x01 Ignore advertisement packets from devices not in the
2106  *        Filter Accept List Only. Directed advertising packets which are not
2107  *        addressed for this device shall be ignored 0x02 Accept all undirected
2108  *        advertisement packets. Directed advertisement packets where initiator
2109  *        address is a RPA and  Directed advertisement packets addressed to this
2110  *        device shall be accepted. 0x03 Accept all undirected advertisement
2111  *        packets from devices that are in the Filter Accept List.Directed
2112  *        advertisement packets where initiator address is RPA and Directed
2113  *        advertisement packets addressed to this device shall be accepted.
2114  *        Values:
2115  *        - 0x00: Accept all
2116  *        - 0x01: Ignore devices not in the Filter Accept List
2117  *        - 0x02: Accept all (use resolving list)
2118  *        - 0x03: Ignore devices not in the Filter Accept List (use resolving list)
2119  * @param Scanning_PHYs The Scanning_PHYs parameter indicates the PHY(s) on
2120  *        which the advertising packets should be received on the primary
2121  *        advertising channel. The Host may enable one or more scanning PHYs.
2122  *        Flags:
2123  *        - 0x01: LE_1M_PHY_BIT
2124  *        - 0x04: LE_CODED_PHY_BIT
2125  * @param Extended_Scan_Parameters See @ref Extended_Scan_Parameters_t
2126  * @retval Value indicating success or error code.
2127  */
2128 tBleStatus hci_le_set_extended_scan_parameters(uint8_t Own_Address_Type,
2129                                                uint8_t Scanning_Filter_Policy,
2130                                                uint8_t Scanning_PHYs,
2131                                                Extended_Scan_Parameters_t Extended_Scan_Parameters[]);
2132 /**
2133  * @brief The LE_Set_Extended_Scan_Enable command is used to enable or disable
2134  *        scanning. The Enable parameter determines whether scanning is enabled
2135  *        or disabled. If it is disabled, the remaining parameters are ignored.
2136  *        The Filter_Duplicates parameter controls whether the Link Layer should
2137  *        filter out duplicate advertising reports (filtering duplicates
2138  *        enabled) to the Host or if the Link Layer should generate advertising
2139  *        reports for each packet received (filtering duplicates disabled). See
2140  *        [Vol 6] Part B, Section 4.4.3.5. If the Filter_Duplicates parameter is
2141  *        set to 0x00, all advertisements received from advertisers shall be
2142  *        sent to the Host in advertising report events. If the
2143  *        Filter_Duplicates parameter is set to 0x01, duplicate advertisements
2144  *        should not be sent to the Host in advertising report events until
2145  *        scanning is disabled. If the Filter_Duplicates parameter is set to
2146  *        0x02, duplicate advertisements in a single scan period should not be
2147  *        sent to the Host in advertising report events; this setting shall only
2148  *        be used if Period is non-zero. If Filter_Duplicates is set to 0x2 and
2149  *        Period to zero, the Controller shall return the Invalid error code HCI
2150  *        Command Parameters (0x12). If the Duration parameter is zero or both
2151  *        the Duration parameter and Period parameter are non-zero, the
2152  *        Controller shall continue scanning until scanning is disabled by the
2153  *        Host issuing an LE_Set_Extended_Scan_Enable command with the Enable
2154  *        parameter set to 0x00 (Scanning is disabled). The Period parameter is
2155  *        ignored when the Duration parameter is zero. If the Duration parameter
2156  *        is non-zero and the Period parameter is zero, the Controller shall
2157  *        continue scanning until the duration specified in the Duration
2158  *        parameter has expired. If both the Duration and Period parameters are
2159  *        non-zero and the Duration parameter is greater than or equal to the
2160  *        Period parameter, the Controller shall return the error code Invalid
2161  *        HCI Command Parameters (0x12). When the Duration and Period parameters
2162  *        are non-zero, the Controller shall scan for the duration of the
2163  *        Duration parameter within a scan period specified by the Period
2164  *        parameter. After the scan period has expired, a new scan period shall
2165  *        begin and scanning shall begin again for the duration specified. The
2166  *        scan periods continue until the Host disables scanning. If the
2167  *        LE_Set_Extended_Scan_Enable command is sent while scanning is enabled,
2168  *        the timers used for duration and period are reset to the new parameter
2169  *        values and a new scan period is started. Any change to the
2170  *        Filter_Duplicates setting or the random address shall take effect.
2171  *        Note: Disabling scanning when it is disabled has no effect. Note: The
2172  *        duration of a scan period refers to the time spent scanning on both
2173  *        the primary and secondary advertising channels. However, expiry of the
2174  *        duration does not prevent the Link Layer from scanning for and
2175  *        receiving auxiliary packets of received advertisements. If the
2176  *        scanning parameters' Own_Address_Type parameter is set to 0x01 or 0x03
2177  *        and the random address for the device has not been initialized, the
2178  *        Controller shall return the error code Invalid HCI Command Parameters
2179  *        (0x12).
2180  * @param Enable The Enable parameter determines whether scanning is enabled or
2181  *        disabled. If it is disabled, the remaining parameters are ignored.
2182  *        Values:
2183  *        - 0x00: Scanning disabled
2184  *        - 0x01: Scanning enabled
2185  * @param Filter_Duplicates The Filter_Duplicates parameter controls whether the
2186  *        Link Layer should filter out duplicate advertising reports (filtering
2187  *        duplicates enabled) to the Host or if the Link Layer should generate
2188  *        advertising reports for each packet received (filtering duplicates
2189  *        disabled). See [Vol 6] Part B, Section 4.4.3.5.
2190  *        Values:
2191  *        - 0x00: Duplicate filtering disabled
2192  *        - 0x01: Duplicate filtering enabled
2193  *        - 0x02: Duplicate filtering enabled, reset for each scan period
2194  * @param Duration Scan duration. Time = N * 10 ms; Time Range: 10 ms to 655.35
2195  *        s.
2196  *        Values:
2197  *        - 0x0000 (0.000 ms) : Scan continuously until explicitly disable
2198  *        - 0x0001 (0.625 ms)  ... 0xFFFF (40959.375 ms) : Scan duration
2199  * @param Period Time interval from when the Controller started its last
2200  *        Scan_Duration until it begins the subsequent Scan_Duration. Time = N *
2201  *        1.28 sec; Time Range: 1.28 s to 83,884.8 s.
2202  *        Values:
2203  *        - 0x0000: Periodic scanning disabled
2204  *        - 0x0001 ... 0xFFFF: Time interval from when the Controller started its last Scan_Duration
2205 until it begins the subsequent Scan_Duration
2206  * @retval Value indicating success or error code.
2207  */
2208 tBleStatus hci_le_set_extended_scan_enable(uint8_t Enable,
2209                                            uint8_t Filter_Duplicates,
2210                                            uint16_t Duration,
2211                                            uint16_t Period);
2212 /**
2213  * @brief The LE_Extended_Create_Connection command is used to create a Link
2214  *        Layer connection to a connectable advertiser.
2215  *        LE_Extended_Create_Connection command can be used in place of
2216  *        LE_Create_Connection command.
2217  * @param Initiator_Filter_Policy The Initiator_Filter_Policy parameter is used
2218  *        to determine whether the Filter Accept List is used. If the Filter
2219  *        Accept List is not used, the Peer_Address_Type and the Peer_Address
2220  *        parameters specify the address type and address of the advertising
2221  *        device to connect to. 0x00 - Filter Accept List is not used to
2222  *        determine which advertiser to connect to. Peer_Address_Type and
2223  *        Peer_Address shall be used. 0x01 - Filter Accept List is used to
2224  *        determine which advertiser to connect to. Peer_Address_Type and
2225  *        Peer_Address shall be ignored.
2226  *        Values:
2227  *        - 0x00: FILTER_ACCEPT_LIST_NOT_USED
2228  *        - 0x01: FILTER_ACCEPT_LIST_USED
2229  * @param Own_Address_Type The Own_Address_Type parameter indicates the type of
2230  *        address being used in the connection request packets.
2231  *        Values:
2232  *        - 0x00: Public Device Address
2233  *        - 0x01: Random Device Address
2234  *        - 0x02: Controller generates the Resolvable Private Address based on the local
2235 IRK from the resolving list. If the resolving list contains no matching
2236 entry, then use the public address.
2237  *        - 0x03: Controller generates the Resolvable Private Address based on the local
2238 IRK from the resolving list. If the resolving list contains no matching
2239 entry, then use the random address from the most recent successful
2240 LE_Set_Random_Address Command.
2241  * @param Peer_Address_Type The Peer_Address_Type parameter indicates the type
2242  *        of address used in the connectable advertisement sent by the peer.
2243  *        0x00: Public Device Address or Public Identity Address 0x01: Random
2244  *        Device Address or Random (static) Identity Address
2245  *        Values:
2246  *        - 0x00: Public Address
2247  *        - 0x01: Random Address
2248  * @param Peer_Address Public Device Address, Random Device Address, Public
2249  *        Identity Address, or Random (static) Identity Address of the device to
2250  *        be connected.
2251  * @param Initiating_PHYs The Initiating_PHYs parameter indicates the PHY(s) on
2252  *        which the advertising packets should be received on the primary
2253  *        advertising channel and the PHYs for which connection parameters have
2254  *        been specified. The Host may enable one or more initiating PHYs. 0x01:
2255  *        Scan connectable advertisements on the LE 1M PHY. Connection
2256  *        parameters for the LE 1M PHY are provided. 0x02: Connection parameters
2257  *        for the LE 2M PHY are provided 0x04: Scan connectable advertisements
2258  *        on the LE Coded PHY. Connection parameters for the LE Coded PHY are
2259  *        provided.
2260  *        Flags:
2261  *        - 0x01: LE_1M_PHY_BIT
2262  *        - 0x02: LE_2M_PHY_BIT
2263  *        - 0x04: LE_CODED_PHY_BIT
2264  * @param Extended_Create_Connection_Parameters See @ref
2265  *        Extended_Create_Connection_Parameters_t
2266  * @retval Value indicating success or error code.
2267  */
2268 tBleStatus hci_le_extended_create_connection(uint8_t Initiator_Filter_Policy,
2269                                              uint8_t Own_Address_Type,
2270                                              uint8_t Peer_Address_Type,
2271                                              uint8_t Peer_Address[6],
2272                                              uint8_t Initiating_PHYs,
2273                                              Extended_Create_Connection_Parameters_t Extended_Create_Connection_Parameters[]);
2274 /**
2275  * @brief The HCI_LE_Periodic_Advertising_Create_Sync command is used to
2276  *        synchronize with a periodic advertising train from an advertiser and
2277  *        begin receiving periodic advertising packets. This command may be
2278  *        issued whether or not scanning is enabled and scanning may be enabled
2279  *        and disabled (see the LE Set Extended Scan Enable command) while this
2280  *        command is pending. However, synchronization can only occur when
2281  *        scanning is enabled. While scanning is disabled, no attempt to
2282  *        synchronize will take place. The Options parameter is used to
2283  *        determine whether the Periodic Advertiser List is used, whether
2284  *        HCI_LE_Periodic_Advertising_Report events for this periodic
2285  *        advertising train are initially enabled or disabled, and whether
2286  *        duplicate reports are filtered or not. If the Periodic Advertiser List
2287  *        is not used, the Advertising_SID, Advertiser Address_Type, and
2288  *        Advertiser Address parameters specify the periodic advertising device
2289  *        to listen to; otherwise they shall be ignored. The Advertising_SID
2290  *        parameter, if used, specifies the value that must match the
2291  *        Advertising SID subfield in the ADI field of the received
2292  *        advertisement for it to be used to synchronize. The Skip parameter
2293  *        specifies the maximum number of consecutive periodic advertising
2294  *        events that the receiver may skip after successfully receiving a
2295  *        periodic advertising packet. The Sync_Timeout parameter specifies the
2296  *        maximum permitted time between successful receives. If this time is
2297  *        exceeded, synchronization is lost. The Sync_CTE_Type parameter
2298  *        specifies whether to only synchronize to periodic advertising with
2299  *        certain types of Constant Tone Extension (a value of 0 indicates that
2300  *        the presence or absence of a Constant Tone Extension is irrelevant).
2301  *        If the periodic advertising has the wrong type of Constant Tone
2302  *        Extension then: - If bit 0 of Options is set, the Controller shall
2303  *        ignore this address and SID and continue to search for other periodic
2304  *        advertisements. - Otherwise, the Controller shall cancel the
2305  *        synchronization with the error code Unsupported Remote Feature (0x1A).
2306  *        If the periodic advertiser changes the type of Constant Tone Extension
2307  *        after the scanner has synchronized with the periodic advertising, the
2308  *        scanner's Link Layer shall remain synchronized. If the Host sets all
2309  *        the non-reserved bits of the Sync_CTE_Type parameter to 1, the
2310  *        Controller shall return the error code Command Disallowed (0x0C).
2311  *        Irrespective of the value of the Skip parameter, the Controller should
2312  *        stop skipping packets before the Sync_Timeout would be exceeded. If
2313  *        the Host issues this command when another
2314  *        HCI_LE_Periodic_Advertising_- Create_Sync command is pending, the
2315  *        Controller shall return the error code Command Disallowed (0x0C). If
2316  *        the Host issues this command with bit 0 of Options not set and with
2317  *        Advertising_SID, Advertiser_Address_Type, and Advertiser_Address the
2318  *        same as those of a periodic advertising train that the Controller is
2319  *        already synchronized to, the Controller shall return the error code
2320  *        Connection Already Exists (0x0B). If the Host issues this command and
2321  *        the Controller has insufficient resources to handle any more periodic
2322  *        advertising trains, the Controller shall return the error code Memory
2323  *        Capacity Exceeded (0x07). If bit 1 of Options is set to 1 and the
2324  *        Controller supports the Periodic Advertising ADI Support feature, then
2325  *        the Controller shall ignore bit 2. If bit 1 of Options is set to 0,
2326  *        bit 2 is set to 1, and the Controller does not support the Periodic
2327  *        Advertising ADI Support feature, then the Controller shall return an
2328  *        error which should use the error code Unsupported Feature or Parameter
2329  *        Value (0x11). If bit 1 of the Options parameter is set to 1 and the
2330  *        Controller does not support the
2331  *        HCI_LE_Set_Periodic_Advertising_Receive_Enable command, the Controller
2332  *        shall return the error code Connection Failed to be Established /
2333  *        Synchronization Timeout (0x3E).
2334  * @param Options The Options parameter is a bitmask used to determine whether
2335  *        the Periodic Advertiser List is used, whether
2336  *        HCI_LE_Periodic_Advertising_Report events for this periodic
2337  *        advertising train are initially enabled or disabled, and whether
2338  *        duplicate reports are filtered or not. If bit 0 is 0: use the
2339  *        Advertising_SID, Advertiser_Address_Type, and Advertiser_Address
2340  *        parameters to determine which advertiser to listen to. If bit 0 is 1:
2341  *        use the Periodic Advertiser List to determine which advertiser to
2342  *        listen to. If bit 1 is 0, reporting is initially enabled, otherwise it
2343  *        is enabled. If bit 2 is 0, duplicate filtering is initially disabled,
2344  *        otherwise it is enabled.
2345  *        Flags:
2346  *        - 0x01: USE_PERIODIC_ADV_LIST
2347  *        - 0x02: DISABLE_REPORTING
2348  *        - 0x04: ENABLE_DUPLICATE_FILTERING
2349  * @param Advertising_SID The Advertising_SID parameter, if used, specifies the
2350  *        value that must match the Advertising SID subfield in the ADI field of
2351  *        the received advertisement for it to be used to synchronize.
2352  *        Values:
2353  *        - 0x00 ... 0x0F: Advertising SID subfield in the ADI field used to identify the Periodic
2354 Advertising
2355  * @param Advertiser_Address_Type Advertising address type
2356  *        Values:
2357  *        - 0x00: Public Device Address
2358  *        - 0x01: Random Device Address
2359  * @param Advertiser_Address Public Device Address, Random Device Address,
2360  *        Public Identity Address, or Random (static) Identity Address of the
2361  *        advertiser
2362  * @param Skip The Skip parameter specifies the number of consecutive periodic
2363  *        advertising packets that the receiver may skip after successfully
2364  *        receiving a periodic advertising packet.
2365  *        Values:
2366  *        - 0x0000 ... 0x01F3
2367  * @param Sync_Timeout Synchronization timeout for the periodic advertising
2368  *        train. Time = N*10 ms.
2369  *        Values:
2370  *        - 0x000A (100 ms)  ... 0x4000 (163840 ms)
2371  * @param Sync_CTE_Type The Sync_CTE_Type parameter specifies whether to only
2372  *        synchronize to periodic advertising with certain types of Constant
2373  *        Tone Extension (a value of 0 indicates that the presence or absence of
2374  *        a Constant Tone Extension is irrelevant). If the periodic advertising
2375  *        has the wrong type of Constant Tone Extension then: - If bit 0 of
2376  *        Options is set, the Controller shall ignore this address and SID and
2377  *        continue to search for other periodic advertisements. - Otherwise, the
2378  *        Controller shall cancel the synchronization with the error code
2379  *        Unsupported Remote Feature/Unsupported LMP Feature (0x1A).
2380  *        Flags:
2381  *        - 0x01: Do not sync to packets with an AoA Constant Tone Extension
2382  *        - 0x02: Do not sync to packets with an AoD Constant Tone Extension with 1 microsecondslots
2383  *        - 0x04: Do not sync to packets with an AoD Constant Tone Extension with 2 microsecondsslots
2384  *        - 0x08: Do not sync to packets with a type 3 Constant Tone Extension (currentlyreserved for future use)
2385  *        - 0x10: Do not sync to packets without a Constant Tone Extension
2386  * @retval Value indicating success or error code.
2387  */
2388 tBleStatus hci_le_periodic_advertising_create_sync(uint8_t Options,
2389                                                    uint8_t Advertising_SID,
2390                                                    uint8_t Advertiser_Address_Type,
2391                                                    uint8_t Advertiser_Address[6],
2392                                                    uint16_t Skip,
2393                                                    uint16_t Sync_Timeout,
2394                                                    uint8_t Sync_CTE_Type);
2395 /**
2396  * @brief The LE_Periodic_Advertising_Create_Sync_Cancel command is used to
2397  *        cancel the LE_Periodic_Advertising_Create_Sync command while it is
2398  *        pending. If the Host issues this command while no
2399  *        LE_Periodic_Advertising_Create_Sync command is pending, the Controller
2400  *        shall return the error code Command Disallowed (0x0C).
2401  * @retval Value indicating success or error code.
2402  */
2403 tBleStatus hci_le_periodic_advertising_create_sync_cancel(void);
2404 /**
2405  * @brief The LE_Periodic_Advertising_Terminate_Sync command is used to stop
2406  *        reception of the periodic advertising identified by the Sync_Handle
2407  *        parameter. If the Host issues this command when another
2408  *        LE_Periodic_Advertising_Create_Sync command is pending (see below),
2409  *        the Controller shall return the error code Command Disallowed (0x0C).
2410  *        If the periodic advertising corresponding to the Sync_Handle parameter
2411  *        does not exist, then the Controller shall return the error code
2412  *        Unknown Advertising Identifier (0x42).
2413  * @param Sync_Handle It is used to identify the periodic advertiser
2414  *        Values:
2415  *        - 0x0000 ... 0x0EFF: Sync_Handle to be used to identify the periodic advertiser
2416  * @retval Value indicating success or error code.
2417  */
2418 tBleStatus hci_le_periodic_advertising_terminate_sync(uint16_t Sync_Handle);
2419 /**
2420  * @brief The LE_Add_Device_To_Periodic_Advertiser_List command is used to add a
2421  *        single device to the Periodic Advertiser list stored in the
2422  *        Controller. Any additions to the Periodic Advertiser list take effect
2423  *        immediately. If the device is already on the list, the Controller
2424  *        shall return the error code Invalid HCI Command Parameters (0x12). If
2425  *        the Host issues this command when an
2426  *        LE_Periodic_Advertising_Create_Sync command is pending, the Controller
2427  *        shall return the error code Command Disallowed (0x0C). When a
2428  *        Controller cannot add a device to the Periodic Advertiser list because
2429  *        the list is full, the Controller shall return the error code Memory
2430  *        Capacity Exceeded (0x07).
2431  * @param Advertiser_Address_Type Advertiser Address Type
2432  *        Values:
2433  *        - 0x00: Public Device Address or Public Identity Address
2434  *        - 0x01: Random Device Address or Random (static) Identity Address
2435  * @param Advertiser_Address Public Device Address, Random Device Address,
2436  *        Public Identity Address, or Random (static) Identity Address of the
2437  *        advertiser
2438  * @param Advertising_SID Advertising SID subfield in the ADI field used to
2439  *        identify the Periodic Advertising
2440  *        Values:
2441  *        - 0x00 ... 0x0F: Advertising SID subfield in the ADI field used to identify the Periodic
2442 Advertising
2443  * @retval Value indicating success or error code.
2444  */
2445 tBleStatus hci_le_add_device_to_periodic_advertiser_list(uint8_t Advertiser_Address_Type,
2446                                                          uint8_t Advertiser_Address[6],
2447                                                          uint8_t Advertising_SID);
2448 /**
2449  * @brief The LE_Remove_Device_From_Periodic_Advertiser_List command is used to
2450  *        remove one device from the list of Periodic Advertisers stored in the
2451  *        Controller. Removals from the Periodic Advertisers List take effect
2452  *        immediately. If the Host issues this command when an
2453  *        LE_Periodic_Advertising_Create_Sync command is pending, the Controller
2454  *        shall return the error code Command Disallowed (0x0C). When a
2455  *        Controller cannot remove a device from the Periodic Advertiser list
2456  *        because it is not found, the Controller shall return the error code
2457  *        Unknown Advertising Identifier (0x42).
2458  * @param Advertiser_Address_Type Advertising Address type
2459  *        Values:
2460  *        - 0x00: Public Device Address or Public Identity Address
2461  *        - 0x01: Random Device Address or Random (static) Identity Address
2462  * @param Advertiser_Address Public Device Address, Random Device Address,
2463  *        Public Identity Address, or Random (static) Identity Address of the
2464  *        advertiser
2465  * @param Advertising_SID It is used to  identify the Periodic Advertising
2466  *        Values:
2467  *        - 0x00 ... 0x0F: Advertising SID subfield in the ADI field used to identify the Periodic
2468 Advertising
2469 All other values Reserved for future
2470  * @retval Value indicating success or error code.
2471  */
2472 tBleStatus hci_le_remove_device_from_periodic_advertiser_list(uint8_t Advertiser_Address_Type,
2473                                                               uint8_t Advertiser_Address[6],
2474                                                               uint8_t Advertising_SID);
2475 /**
2476  * @brief The LE_Clear_Periodic_Advertiser_List command is used to remove all
2477  *        devices from the list of Periodic Advertisers in the Controller. If
2478  *        this command is used when an LE_Periodic_Advertising_Create_Sync
2479  *        command is pending, the Controller shall return the error code Command
2480  *        Disallowed (0x0C).
2481  * @retval Value indicating success or error code.
2482  */
2483 tBleStatus hci_le_clear_periodic_advertiser_list(void);
2484 /**
2485  * @brief The LE_Read_Periodic_Advertiser_List_Size command is used to read the
2486  *        total number of Periodic Advertiser list entries that can be stored in
2487  *        the Controller. Note: The number of entries that can be stored is not
2488  *        fixed and the Controller can change it at any time (e.g., because the
2489  *        memory used to store the list can also be used for other purposes).
2490  * @param[out] Periodic_Advertiser_List_Size Total number of Periodic Advertiser
2491  *             list entries that can be stored in the Controller
2492  *             Values:
2493  *             - 0x1F ... 0xFF: Total number of Periodic Advertiser list entries that can be stored in the
2494 Controller
2495  * @retval Value indicating success or error code.
2496  */
2497 tBleStatus hci_le_read_periodic_advertiser_list_size(uint8_t *Periodic_Advertiser_List_Size);
2498 /**
2499  * @brief The HCI_LE_Read_Transmit_Power command is used to read the minimum and
2500  *        maximum transmit powers supported by the Controller.
2501  * @param[out] Min_Tx_Power Minimum supported TX power (units: dBm).
2502  *             Values:
2503  *             - -127 ... 20
2504  * @param[out] Max_Tx_Power Maximum supported TX power (units: dBm).
2505  *             Values:
2506  *             - -127 ... 20
2507  * @retval Value indicating success or error code.
2508  */
2509 tBleStatus hci_le_read_transmit_power(int8_t *Min_Tx_Power,
2510                                       int8_t *Max_Tx_Power);
2511 /**
2512  * @brief The HCI_LE_Read_RF_Path_Compensation command is used to read the RF
2513  *        Path Compensation Values parameter used in the Tx Power Level and RSSI
2514  *        calculation.
2515  * @param[out] RF_TX_Path_Compensation_Value
2516  * @param[out] RF_RX_Path_Compensation_Value
2517  * @retval Value indicating success or error code.
2518  */
2519 tBleStatus hci_le_read_rf_path_compensation(int16_t *RF_TX_Path_Compensation_Value,
2520                                             int16_t *RF_RX_Path_Compensation_Value);
2521 /**
2522  * @brief The HCI_LE_Write_RF_Path_Compensation command is used to indicate the
2523  *        RF path gain or loss between the RF transceiver and the antenna
2524  *        contributed by intermediate components. A positive value means a net
2525  *        RF path gain and a negative value means a net RF path loss. The RF Tx
2526  *        Path Compensation Value parameter shall be used by the Controller to
2527  *        calculate radiative Tx Power Level used in HCI commands, HCI events,
2528  *        Advertising physical channel PDUs, and Link Layer Control PDUs using
2529  *        the following equation: Radiative Tx Power Level = Tx Power Level at
2530  *        RF transceiver output + RF Tx Path Compensation Value. For example, if
2531  *        the Tx Power Level is +4 (dBm) at RF transceiver output and the RF
2532  *        Path Compensation Value is -1.5 (dB), the radiative Tx Power Level is
2533  *        +4+(-1.5) = 2.5 (dBm). The RF Rx Path Compensation Value parameter
2534  *        shall be used by the Controller to calculate the RSSI value reported
2535  *        to the Host.
2536  * @param RF_TX_Path_Compensation_Value
2537  * @param RF_RX_Path_Compensation_Value
2538  * @retval Value indicating success or error code.
2539  */
2540 tBleStatus hci_le_write_rf_path_compensation(int16_t RF_TX_Path_Compensation_Value,
2541                                              int16_t RF_RX_Path_Compensation_Value);
2542 /**
2543  * @brief The HCI_LE_Set_Privacy_Mode command is used to allow the Host to
2544  *        specify the privacy mode to be used for a given entry on the resolving
2545  *        list. The effect of this setting is specified in [Vol 6] Part B,
2546  *        Section 4.7. When an entry on the resolving list is removed, the mode
2547  *        associated with that entry shall also be removed. This command cannot
2548  *        be used when address translation is enabled in the Controller and:
2549  *        Advertising is enabled Scanning is enabled Create connection command
2550  *        is outstanding This command can be used at any time when address
2551  *        translation is disabled in the Controller. If the device is not on the
2552  *        resolving list, the Controller shall return the error code Unknown
2553  *        Connection Identifier (0x02).
2554  * @param Peer_Identity_Address_Type Peer Address type
2555  *        Values:
2556  *        - 0x00: Public Identity Address
2557  *        - 0x01: Random (static) Identity Address
2558  * @param Peer_Identity_Address Public Identity Address or Random (static)
2559  *        Identity Address of the advertiser
2560  * @param Privacy_Mode 0x00 Use Network Privacy Mode for this peer device
2561  *        (default) 0x01 Use Device Privacy Mode for this peer device
2562  *        Values:
2563  *        - 0x00: Network Privacy Mode
2564  *        - 0x01: Device Privacy Mode
2565  * @retval Value indicating success or error code.
2566  */
2567 tBleStatus hci_le_set_privacy_mode(uint8_t Peer_Identity_Address_Type,
2568                                    uint8_t Peer_Identity_Address[6],
2569                                    uint8_t Privacy_Mode);
2570 /**
2571  * @brief The HCI_LE_Set_Connectionless_CTE_Transmit_Parameters command is used
2572  *        to set the type, length, and antenna switching pattern for the
2573  *        transmission of Constant Tone Extensions in any periodic advertising
2574  *        on the advertising set identified by the Advertising_Handle parameter.
2575  *        The CTE_Count parameter specifies how many packets with a Constant
2576  *        Tone Extension are to be transmitted in each periodic advertising
2577  *        event. If the number of packets that would otherwise be transmitted is
2578  *        less than this, the Controller shall transmit sufficient AUX_CHAIN_IND
2579  *        PDUs with no AdvData to make up the number. However, if a change in
2580  *        circumstances since this command was issued means that the Controller
2581  *        can no longer schedule all of these packets, it should transmit as
2582  *        many as possible. If the Host issues this command when Constant Tone
2583  *        Extensions have been enabled in the advertising set, the Controller
2584  *        shall return the error code Command Disallowed (0x0C). The
2585  *        Switching_Pattern_Length and Antenna_IDs[i] parameters are only used
2586  *        when transmitting an AoD Constant Tone Extension and shall be ignored
2587  *        if CTE_Type specifies an AoA Constant Tone Extension. If the
2588  *        CTE_Length parameter is greater than the maximum length of Constant
2589  *        Tone Extension supported, the Controller shall return the error code
2590  *        Unsupported Feature or Parameter Value (0x11). If the Host requests a
2591  *        type of Constant Tone Extension that the Controller does not support,
2592  *        the Controller shall return the error code Unsupported Feature or
2593  *        Parameter Value (0x11). If the Controller is unable to schedule
2594  *        CTE_Count packets in each event, the Controller shall return the error
2595  *        code Unsupported Feature or Parameter Value (0x11). If the advertising
2596  *        set corresponding to the Advertising_Handle parameter does not exist,
2597  *        the Controller shall return the error code Unknown Advertising
2598  *        Identifier (0x42). If Switching_Pattern_Length is greater than the
2599  *        maximum length of switching pattern supported by the Controller (see
2600  *        Section 7.8.87), the Controller shall return the error code
2601  *        Unsupported Feature or Parameter Value (0x11). If the Controller
2602  *        determines that any of the Antenna_IDs[i] values do not identify an
2603  *        antenna in the device's antenna array, it shall return the error code
2604  *        Unsupported Feature or Parameter Value (0x11). Note: Some Controllers
2605  *        may be unable to determine which values do or do not identify an
2606  *        antenna.
2607  * @param Advertising_Handle It is used to identify an advertising set
2608  *        Values:
2609  *        - 0x00 ... 0xEF
2610  * @param CTE_Length
2611  *        Values:
2612  *        - 0x02 ... 0x14: Constant Tone Extension length in 8 microseconds units
2613  * @param CTE_Type
2614  *        Values:
2615  *        - 0x00: AoA Constant Tone Extension
2616  *        - 0x01: AoD Constant Tone Extension with 1 microsecond slots
2617  *        - 0x02: AoD Constant Tone Extension with 2 microseconds slots
2618  * @param CTE_Count The CTE_Count parameter specifies how many packets with a
2619  *        Constant Tone Extension are to be transmitted in each periodic
2620  *        advertising event. If the number of packets that would otherwise be
2621  *        transmitted is less than this, the Controller shall transmit
2622  *        sufficient AUX_CHAIN_IND PDUs with no AdvData to make up the number.
2623  *        However, if a change in circumstances since this command was issued
2624  *        means that the Controller can no longer schedule all of these packets,
2625  *        it should transmit as many as possible.
2626  *        Values:
2627  *        - 0x01 ... 0x10: The number of Constant Tone Extensions to transmit in each periodic advertising interval
2628  * @param Switching_Pattern_Length
2629  *        Values:
2630  *        - 0x02 ... 0x4B: The number of Antenna IDs in the pattern.
2631  * @param Antenna_IDs List of Antenna IDs in the pattern
2632  * @retval Value indicating success or error code.
2633  */
2634 tBleStatus hci_le_set_connectionless_cte_transmit_parameters(uint8_t Advertising_Handle,
2635                                                              uint8_t CTE_Length,
2636                                                              uint8_t CTE_Type,
2637                                                              uint8_t CTE_Count,
2638                                                              uint8_t Switching_Pattern_Length,
2639                                                              uint8_t Antenna_IDs[]);
2640 /**
2641  * @brief The HCI_LE_Set_Connectionless_CTE_Transmit_Enable command is used to
2642  *        request that the Controller enables or disables the use of Constant
2643  *        Tone Extensions in any periodic advertising on the advertising set
2644  *        identified by Advertising_Handle. In order to start sending periodic
2645  *        advertisements containing a Constant Tone Extension, the Host must
2646  *        also enable periodic advertising using the
2647  *        HCI_LE_Set_Periodic_Advertising_Enable command (see Section 7.8.63).
2648  *        Note: Periodic advertising can only be enabled when advertising is
2649  *        enabled on the same advertising set, but can continue after
2650  *        advertising has been disabled. If the Host issues this command before
2651  *        it has issued the HCI_LE_Set_Periodic_Advertising_Parameters command
2652  *        (see Section 7.8.61) for the advertising set, the Controller shall
2653  *        return the error code Command Disallowed (0x0C). Once enabled, the
2654  *        Controller shall continue advertising with Constant Tone Extensions
2655  *        until either one of the following occurs: - The Host issues an
2656  *        HCI_LE_Set_Connectionless_CTE_Transmit_Enable command with CTE_Enable
2657  *        set to 0x00 (disabling Constant Tone Extensions but allowing periodic
2658  *        advertising to continue). - The Host issues an
2659  *        HCI_LE_Set_Periodic_Advertising_Enable command (see Section 7.8.63)
2660  *        with Enable set to 0x00 (disabling periodic advertising). If periodic
2661  *        advertising is re-enabled then it shall continue to contain Constant
2662  *        Tone Extensions. If the Host issues this command before it has issued
2663  *        the HCI_LE_Set_Connectionless_CTE_Transmit_Parameters command for the
2664  *        advertising set, the Controller shall return the error code Command
2665  *        Disallowed (0x0C). If the periodic advertising is on a PHY that does
2666  *        not allow Constant Tone Extensions, the Controller shall return the
2667  *        error code Command Disallowed (0x0C).
2668  * @param Advertising_Handle Identifier for the advertising set in which
2669  *        Constant Tone Extension is being enabled or disabled
2670  *        Values:
2671  *        - 0x00 ... 0xEF
2672  * @param CTE_Enable It enables or disables the use of Constant Tone Extensions.
2673  *        Values:
2674  *        - 0x00: Advertising with Constant Tone Extension is disabled (default)
2675  *        - 0x01: Advertising with Constant Tone Extension is enabled
2676  * @retval Value indicating success or error code.
2677  */
2678 tBleStatus hci_le_set_connectionless_cte_transmit_enable(uint8_t Advertising_Handle,
2679                                                          uint8_t CTE_Enable);
2680 /**
2681  * @brief The HCI_LE_Set_Connectionless_IQ_Sampling_Enable command is used to
2682  *        request that the Controller enables or disables capturing IQ samples
2683  *        from the Constant Tone Extension of periodic advertising packets in
2684  *        the periodic advertising train identified by the Sync_Handle
2685  *        parameter. If that periodic advertising train does not exist, then the
2686  *        Controller shall return the error code Unknown Advertising Identifier
2687  *        (0x42). The Max_Sampled_CTEs parameter specifies the maximum number of
2688  *        Constant Tone Extensions in each periodic advertising event that the
2689  *        Controller should collect and report IQ samples from. The Controller
2690  *        should sample all Constant Tone Extensions up to this number. If the
2691  *        Sampling_Enable parameter is set to 0x01 (sampling is enabled), the
2692  *        Controller starts attempting to capture IQ samples from the periodic
2693  *        advertisements. Once sampling has been enabled, the Controller shall
2694  *        continue taking IQ samples until the Host issues an
2695  *        HCI_LE_Set_Connectionless_IQ_Enable command with Sampling_Enable set
2696  *        to 0x00 (sampling is disabled) or synchronization with the periodic
2697  *        advertising train is lost. If Sampling_Enable is set to 0x00,
2698  *        Slot_Durations, Max_Sampled_CTEs, Switching_Pattern_Length, and
2699  *        Antenna_IDs shall be ignored. The command is also used to set the
2700  *        antenna switching pattern and switching and sampling slot durations to
2701  *        be used while receiving the Constant Tone Extension. If Slot_Durations
2702  *        is set to 0x01 and the Controller does not support 1 microsecond
2703  *        switching and sampling, the Controller shall return the error code
2704  *        Unsupported Feature or Parameter Value (0x11). The Slot_Durations,
2705  *        Switching_Pattern_Length, and Antenna_IDs parameters are only used
2706  *        when receiving an AoA Constant Tone Extension and do not affect the
2707  *        reception of an AoD Constant Tone Extension. If
2708  *        Switching_Pattern_Length is greater than the maximum length of
2709  *        switching pattern supported by the Controller, the Controller shall
2710  *        return the error code Unsupported Feature or Parameter Value (0x11).
2711  *        If the Controller determines that any of the Antenna_IDs[i] values do
2712  *        not identify an antenna in the device's antenna array, it shall return
2713  *        the error code Unsupported Feature or Parameter Value (0x11). Note:
2714  *        Some Controllers may be unable to determine which values do or do not
2715  *        identify an antenna. If Sampling_Enable is set to 0x01 and the
2716  *        periodic advertising is on a PHY that does not allow Constant Tone
2717  *        Extensions, the Controller shall return the error code Command
2718  *        Disallowed (0x0C).
2719  * @param Sync_Handle Sync handle that identifies the synchronization
2720  *        information about the periodic advertising train.
2721  *        Values:
2722  *        - 0x0000 ... 0x0EFF
2723  * @param Sampling_Enable If the Sampling_Enable parameter is set to 0x01
2724  *        (sampling is enabled), the Controller starts attempting to capture IQ
2725  *        samples from the periodic advertisements.
2726  *        Values:
2727  *        - 0x00: DISABLE
2728  *        - 0x01: ENABLE
2729  * @param Slot_Durations Sampling rate used by the Controller.
2730  *        Values:
2731  *        - 0x01: CTE_SLOT_1us
2732  *        - 0x02: CTE_SLOT_2us
2733  * @param Max_Sampled_CTEs It specifies the maximum number of Constant Tone
2734  *        Extensions in each periodic advertising event that the Controller
2735  *        should collect and report IQ samples from. The Controller should
2736  *        sample all Constant Tone Extensions up to this number.
2737  *        Values:
2738  *        - 0x00: REPORT_ALL_CTES
2739  *        - 0x01 ... 0x10
2740  * @param Switching_Pattern_Length The number of Antenna IDs in the pattern.
2741  *        Values:
2742  *        - 0x02 ... 0x4B
2743  * @param Antenna_IDs List of Antenna IDs in the pattern
2744  * @retval Value indicating success or error code.
2745  */
2746 tBleStatus hci_le_set_connectionless_iq_sampling_enable(uint16_t Sync_Handle,
2747                                                         uint8_t Sampling_Enable,
2748                                                         uint8_t Slot_Durations,
2749                                                         uint8_t Max_Sampled_CTEs,
2750                                                         uint8_t Switching_Pattern_Length,
2751                                                         uint8_t Antenna_IDs[]);
2752 /**
2753  * @brief The HCI_LE_Set_Connection_CTE_Receive_Parameters command is used to
2754  *        enable or disable sampling received Constant Tone Extension fields on
2755  *        the connection identified by the Connection_Handle parameter and to
2756  *        set the antenna switching pattern and switching and sampling slot
2757  *        durations to be used. If the Sampling_Enable parameter is set to 0x01,
2758  *        the Controller shall sample Constant Tone Extensions on the specified
2759  *        connection and report the samples to the Host. If it is set to 0x00,
2760  *        the Controller shall cease sampling on the specified connection; the
2761  *        remaining parameters shall be ignored. If Slot_Durations is set to
2762  *        0x01 and the Controller does not support 1 microsecond switching and
2763  *        sampling, the Controller shall return the error code Unsupported
2764  *        Feature or Parameter Value (0x11). The Slot_Durations,
2765  *        Switching_Pattern_Length, and Antenna_IDs parameters are only used
2766  *        when receiving an AoA Constant Tone Extension and do not affect the
2767  *        reception of an AoD Constant Tone Extension. If
2768  *        Switching_Pattern_Length is greater than the maximum length of
2769  *        switching pattern supported by the Controller, the Controller shall
2770  *        return the error code Unsupported Feature or Parameter Value (0x11).
2771  *        If the Controller determines that any of the Antenna_IDs[i] values do
2772  *        not identify an antenna in the device's antenna array, it shall return
2773  *        the error code Unsupported Feature or Parameter Value (0x11). Note:
2774  *        Some Controllers may be unable to determine which values do or do not
2775  *        identify an antenna.
2776  * @param Connection_Handle Connection handle that identifies the connection.
2777  *        Values:
2778  *        - 0x0000 ... 0x0EFF
2779  * @param Sampling_Enable
2780  *        Values:
2781  *        - 0x00: Connection IQ sampling is disabled (default)
2782  *        - 0x01: Connection IQ sampling is enabled
2783  * @param Slot_Durations Sampling rate used by the Controller.
2784  *        Values:
2785  *        - 0x01: CTE_SLOT_1us
2786  *        - 0x02: CTE_SLOT_2us
2787  * @param Switching_Pattern_Length
2788  *        Values:
2789  *        - 0x02 ... 0x4B: The number of Antenna IDs in the pattern.
2790  * @param Antenna_IDs List of Antenna IDs in the pattern
2791  * @retval Value indicating success or error code.
2792  */
2793 tBleStatus hci_le_set_connection_cte_receive_parameters(uint16_t Connection_Handle,
2794                                                         uint8_t Sampling_Enable,
2795                                                         uint8_t Slot_Durations,
2796                                                         uint8_t Switching_Pattern_Length,
2797                                                         uint8_t Antenna_IDs[]);
2798 /**
2799  * @brief The HCI_LE_Set_Connection_CTE_Transmit_Parameters command is used to
2800  *        set the antenna switching pattern and permitted Constant Tone
2801  *        Extension types used for transmitting Constant Tone Extensions
2802  *        requested by the peer device on the connection identified by the
2803  *        Connection_Handle parameter. If the Host issues this command when
2804  *        Constant Tone Extension responses have been enabled on the connection,
2805  *        the Controller shall return the error code Command Disallowed (0x0C).
2806  *        If the CTE_Types parameter has a bit set for a type of Constant Tone
2807  *        Extension that the Controller does not support, the Controller shall
2808  *        return the error code Unsupported Feature or Parameter Value (0x11).
2809  *        The Switching_Pattern_Length and Antenna_IDs[i] parameters are only
2810  *        used when transmitting an AoD Constant Tone Extension and shall be
2811  *        ignored when CTE_Types does not have a bit set for an AoD Constant
2812  *        Tone Extension; they do not affect the transmission of an AoA Constant
2813  *        Tone Extension. If Switching_Pattern_Length is greater than the
2814  *        maximum length of switching pattern supported by the Controller, the
2815  *        Controller shall return the error code Unsupported Feature or
2816  *        Parameter Value (0x11). If the Controller determines that any of the
2817  *        Antenna_IDs[i] values do not identify an antenna in the device's
2818  *        antenna array, it shall return the error code Unsupported Feature or
2819  *        Parameter Value (0x11). Note: Some Controllers may be unable to
2820  *        determine which values do or do not identify an antenna.
2821  * @param Connection_Handle Connection handle that identifies the connection.
2822  *        Values:
2823  *        - 0x0000 ... 0x0EFF
2824  * @param CTE_Type
2825  *        Flags:
2826  *        - 0x01: Allow AoA Constant Tone Extension Response
2827  *        - 0x02: Allow AoD Constant Tone Extension Response with 1 microsecond slots
2828  *        - 0x04: Allow AoD Constant Tone Extension Response with 2 microseconds slots
2829  * @param Switching_Pattern_Length
2830  *        Values:
2831  *        - 0x02 ... 0x4B: The number of Antenna IDs in the pattern.
2832  * @param Antenna_IDs List of Antenna IDs in the pattern
2833  * @retval Value indicating success or error code.
2834  */
2835 tBleStatus hci_le_set_connection_cte_transmit_parameters(uint16_t Connection_Handle,
2836                                                          uint8_t CTE_Type,
2837                                                          uint8_t Switching_Pattern_Length,
2838                                                          uint8_t Antenna_IDs[]);
2839 /**
2840  * @brief The HCI_LE_Connection_CTE_Request_Enable command is used to request
2841  *        the Controller to start or stop initiating the Constant Tone Extension
2842  *        Request procedure (see [Vol 6] Part B, Section 5.1.12) on a connection
2843  *        identified by the Connection_Handle parameter. If the Host issues this
2844  *        command when the Controller is aware (e.g. through a previous feature
2845  *        exchange) that the peer device's Link Layer does not support the
2846  *        Connection CTE Response feature, the Controller shall return the error
2847  *        code Unsupported Remote Feature / Unsupported LMP Feature (0x1A). If
2848  *        the Host issues this command when the Controller is aware that the
2849  *        peer device's Link Layer does not support the requested CTE type, the
2850  *        Controller should return the error code Unsupported Remote Feature /
2851  *        Unsupported LMP Feature (0x1A). If Enable is set to 0x00, the
2852  *        remaining parameters shall be ignored. The CTE_Request_Interval
2853  *        parameter defines whether the Constant Tone Extension Request
2854  *        procedure is initiated only once or periodically. In the case of
2855  *        periodic operation, the procedure is initiated every
2856  *        CTE_Request_Interval. However, the Controller may delay initiating the
2857  *        procedure beyond the requested interval (e.g., in order to prioritize
2858  *        other activities). The Requested_CTE_Length parameter indicates the
2859  *        minimum length of the Constant Tone Extension and the
2860  *        Requested_CTE_Type parameter indicates the type of Constant Tone
2861  *        Extension that the Controller shall request from the remote device. A
2862  *        request is active on a connection from when the Host issues a
2863  *        successful command with Enable set to 0x01 until the single procedure
2864  *        has been performed, the period specified by CTE_Request_Interval has
2865  *        ended, or a command with Enable set to 0x00 has succeeded, whichever
2866  *        happens first. If the Host issues this command with Enable set to 0x01
2867  *        while a request is active for the specified connection, the Controller
2868  *        shall return the error code Command Disallowed (0x0C). Note: The
2869  *        failed command will not affect the behavior of the Link Layer in
2870  *        respect of the currently-active request. If the Host issues this
2871  *        command before issuing the
2872  *        HCI_LE_Set_Connection_CTE_Receive_Parameters command at least once on
2873  *        the connection, the Controller shall return the error code Command
2874  *        Disallowed (0x0C). If the Host issues this command when the receiver
2875  *        PHY for the connection is not a PHY that allows Constant Tone
2876  *        Extensions, the Controller shall return the error code Command
2877  *        Disallowed (0x0C). If the Host sets CTE_Request_Interval to a non-zero
2878  *        value less than or equal to connPeripheralLatency, the Controller
2879  *        shall return the error code Command Disallowed (0x0C). If Enable is
2880  *        set to 0x01 and the receiver PHY for the connection changes to a PHY
2881  *        that does not allow Constant Tone Extensions, then the Controller
2882  *        shall automatically disable Constant Tone Extension requests as if the
2883  *        Host had issued this command with Enable set to 0x00. Note: If the PHY
2884  *        changes back to a PHY that allows Constant Tone Extensions, then the
2885  *        Controller will not automatically re-enable Constant Tone Extension
2886  *        requests.
2887  * @param Connection_Handle Connection handle that identifies the connection.
2888  *        Values:
2889  *        - 0x0000 ... 0x0EFF
2890  * @param Enable If it is set to 0x00, the remaining parameters shall be
2891  *        ignored.
2892  *        Values:
2893  *        - 0x00: Disable Constant Tone Extension Request for the connection (default)
2894  *        - 0x01: Enable Constant Tone Extension Request for the connection
2895  * @param CTE_Request_Interval It defines whether the Constant Tone Extension
2896  *        Request procedure is initiated only once or periodically. In the case
2897  *        of periodic operation, the procedure is initiated every
2898  *        CTE_Request_Interval. However, the Controller may delay initiating the
2899  *        procedure beyond the requested interval (e.g., in order to prioritize
2900  *        other activities).
2901  *        Values:
2902  *        - 0x0000: Initiate the Constant Tone Extension Request procedure once, at the nearliest practical opportunity.
2903  *        - 0x0001 ... 0xFFFF: Requested interval for initiating the Constant Tone Extension Request procedure in number of connection events.
2904  * @param Requested_CTE_Length It indicates the minimum length of the Constant
2905  *        Tone Extension and the Requested_CTE_Type parameter indicates the type
2906  *        of Constant Tone Extension that the Controller shall request from the
2907  *        remote device.
2908  *        Values:
2909  *        - 0x02 ... 0x14: Minimum length of the Constant Tone Extension being requested in 8 nmicroseconds units
2910  * @param Requested_CTE_Type
2911  *        Flags:
2912  *        - 0x00: AoA Constant Tone Extension
2913  *        - 0x01: AoD Constant Tone Extension with 1 microsecond slots
2914  *        - 0x02: AoD Constant Tone Extension with 2 microseconds slots
2915  * @retval Value indicating success or error code.
2916  */
2917 tBleStatus hci_le_connection_cte_request_enable(uint16_t Connection_Handle,
2918                                                 uint8_t Enable,
2919                                                 uint16_t CTE_Request_Interval,
2920                                                 uint8_t Requested_CTE_Length,
2921                                                 uint8_t Requested_CTE_Type);
2922 /**
2923  * @brief The HCI_LE_Connection_CTE_Response_Enable command is used to request
2924  *        the Controller to respond to LL_CTE_REQ PDUs with LL_CTE_RSP PDUs on
2925  *        the specified connection. If the Host issues this command before
2926  *        issuing the HCI_LE_Set_Connection_CTE_Transmit_Parameters command at
2927  *        least once on the connection, the Controller shall return the error
2928  *        code Command Disallowed (0x0C). If the Host issues this command when
2929  *        the transmitter PHY for the connection is not a PHY that allows
2930  *        Constant Tone Extensions, the Controller shall return the error code
2931  *        Command Disallowed (0x0C). If the transmitter PHY for the connection
2932  *        changes to a PHY that does not allow Constant Tone Extensions, then
2933  *        the Controller shall automatically disable Constant Tone Extension
2934  *        responses.
2935  * @param Connection_Handle Connection handle that identifies the connection.
2936  *        Values:
2937  *        - 0x0000 ... 0x0EFF
2938  * @param Enable
2939  *        Values:
2940  *        - 0x00: Disable Constant Tone Extension Response for the connection (default)
2941  *        - 0x01: Enable Constant Tone Extension Response for the connection
2942  * @retval Value indicating success or error code.
2943  */
2944 tBleStatus hci_le_connection_cte_response_enable(uint16_t Connection_Handle,
2945                                                  uint8_t Enable);
2946 /**
2947  * @brief The HCI_LE_Read_Antenna_Information command allows the Host to read
2948  *        the switching rates, the sampling rates, the number of antennae, and
2949  *        the maximum length of a transmitted Constant Tone Extension supported
2950  *        by the Controller.
2951  * @param[out] Supported_Switching_Sampling_Rates
2952  *             Flags:
2953  *             - 0x00: 1 microsecond switching supported for AoD transmission
2954  *             - 0x02: 1 microsecond switching supported for AoD reception
2955  *             - 0x04: 1 microsecond switching and sampling supported for AoA reception
2956  * @param[out] Num_Antennae
2957  *             Values:
2958  *             - 0x01 ... 0x4B: The number of antennae supported by the Controller
2959  * @param[out] Max_Switching_Pattern_Length
2960  *             Values:
2961  *             - 0x02 ... 0x4B: Maximum length of antenna switching pattern supported by the Controller
2962  * @param[out] Max_CTE_Length
2963  *             Values:
2964  *             - 0x02 ... 0x14: Maximum length of a transmitted Constant Tone Extension supported in 8 microseconds units
2965  * @retval Value indicating success or error code.
2966  */
2967 tBleStatus hci_le_read_antenna_information(uint8_t *Supported_Switching_Sampling_Rates,
2968                                            uint8_t *Num_Antennae,
2969                                            uint8_t *Max_Switching_Pattern_Length,
2970                                            uint8_t *Max_CTE_Length);
2971 /**
2972  * @brief The HCI_LE_Set_Periodic_Advertising_Receive_Enable command will enable
2973  *        or disable reports for the periodic advertising train identified by
2974  *        the Sync_Handle parameter. The Enable parameter determines whether
2975  *        reporting and duplicate filtering are enabled or disabled. If the
2976  *        value is the same as the current state, the command has no effect. If
2977  *        the periodic advertising train corresponding to the Sync_Handle
2978  *        parameter does not exist, the Controller shall return the error code
2979  *        Unknown Advertising Identifier (0x42).
2980  * @param Sync_Handle Sync_Handle identifying the periodic advertising train.
2981  *        Values:
2982  *        - 0x0000 ... 0x0EFF
2983  * @param Enable Bit 0 to enable reporting. Bit 1 to enable duplicate filtering.
2984  *        Flags:
2985  *        - 0x01: ENABLE_REPORTING
2986  *        - 0x02: ENABLE_DUPLICATE_FILTERING
2987  * @retval Value indicating success or error code.
2988  */
2989 tBleStatus hci_le_set_periodic_advertising_receive_enable(uint16_t Sync_Handle,
2990                                                           uint8_t Enable);
2991 /**
2992  * @brief The HCI_LE_Periodic_Advertising_Sync_Transfer command is used to
2993  *        instruct the Controller to send synchronization information about the
2994  *        periodic advertising train identified by the Sync_Handle parameter to
2995  *        a connected device. The Service_Data parameter is a value provided by
2996  *        the Host for use by the Host of the peer device. It is not used by the
2997  *        Controller. The connected device is identified by the
2998  *        Connection_Handle parameter. If the periodic advertising train
2999  *        corresponding to the Sync_Handle parameter does not exist, the
3000  *        Controller shall return the error code Unknown Advertising Identifier
3001  *        (0x42). If the Connection_Handle parameter does not identify a current
3002  *        connection, the Controller shall return the error code Unknown
3003  *        Connection Identifier (0x02). If the remote device has not indicated
3004  *        support for the Periodic Advertising Sync Transfer - Recipient
3005  *        feature, the Controller shall return the error code Unsupported Remote
3006  *        Feature / Unsupported LMP Feature (0x1A). Note: This command may
3007  *        complete before the periodic advertising synchronization information
3008  *        is sent. No indication is given as to how the recipient handled the
3009  *        information.
3010  * @param Connection_Handle Connection handle that identifies the connection.
3011  *        Values:
3012  *        - 0x0000 ... 0x0EFF
3013  * @param Service_Data The Service_Data parameter is a value provided by the
3014  *        Host for use by the Host of the peer device. It is not used by the
3015  *        Controller.
3016  * @param Sync_Handle Sync handle that identifies the synchronization
3017  *        information about the periodic advertising train.
3018  *        Values:
3019  *        - 0x0000 ... 0x0EFF
3020  * @retval Value indicating success or error code.
3021  */
3022 tBleStatus hci_le_periodic_advertising_sync_transfer(uint16_t Connection_Handle,
3023                                                      uint16_t Service_Data,
3024                                                      uint16_t Sync_Handle);
3025 /**
3026  * @brief The HCI_LE_Periodic_Advertising_Set_Info_Transfer command is used to
3027  *        instruct the Controller to send synchronization information about the
3028  *        periodic advertising in an advertising set to a connected device. The
3029  *        Advertising_Handle parameter identifies the advertising set. If the
3030  *        parameters in the advertising set have changed since the periodic
3031  *        advertising was first enabled, the current parameters - not the
3032  *        original ones - are sent. The Service_Data parameter is a value
3033  *        provided by the Host to identify the periodic advertising train to the
3034  *        peer device. It is not used by the Controller. The connected device is
3035  *        identified by the Connection_Handle parameter. If the advertising set
3036  *        corresponding to the Advertising_Handle parameter does not exist, the
3037  *        Controller shall return the error code Unknown Advertising Identifier
3038  *        (0x42). If periodic advertising is not currently in progress for the
3039  *        advertising set, the Controller shall return the error code Command
3040  *        Disallowed (0x0C). If the Connection_Handle parameter does not
3041  *        identify a current connection, the Controller shall return the error
3042  *        code Unknown Connection Identifier (0x02). If the remote device has
3043  *        not indicated support for the Periodic Advertising Sync Transfer -
3044  *        Recipient feature, the Controller shall return the error code
3045  *        Unsupported Remote Feature / Unsupported LMP Feature (0x1A). Note:
3046  *        This command may complete before the periodic advertising
3047  *        synchronization information is sent. No indication is given as to how
3048  *        the recipient handled the information.
3049  * @param Connection_Handle Connection handle that identifies the connection.
3050  *        Values:
3051  *        - 0x0000 ... 0x0EFF
3052  * @param Service_Data It is a value provided by the Host to identify the
3053  *        periodic advertising train to the peer device. It is not used by the
3054  *        Controller.
3055  * @param Advertising_Handle It is used to identify an advertising set
3056  *        Values:
3057  *        - 0x00 ... 0xEF
3058  * @retval Value indicating success or error code.
3059  */
3060 tBleStatus hci_le_periodic_advertising_set_info_transfer(uint16_t Connection_Handle,
3061                                                          uint16_t Service_Data,
3062                                                          uint8_t Advertising_Handle);
3063 /**
3064  * @brief The HCI_LE_Set_Periodic_Advertising_Sync_Transfer_Parameters command
3065  *        is used to specify how the Controller will process periodic
3066  *        advertising synchronization information received from the device
3067  *        identified by the Connection_Handle parameter (the "transfer mode").
3068  *        The Mode parameter specifies the action to be taken when periodic
3069  *        advertising synchronization information is received. If Mode is 0x00,
3070  *        the Controller will ignore the information. Otherwise it will notify
3071  *        the Host and synchronize to the periodic advertising. Mode also
3072  *        specifies whether periodic advertising reports are initially enabled
3073  *        or disabled and whether duplicates are filtered. The Skip parameter
3074  *        specifies the number of consecutive periodic advertising packets that
3075  *        the receiver may skip after successfully receiving a periodic
3076  *        advertising packet. The Sync_Timeout parameter specifies the maximum
3077  *        permitted time between successful receives. If this time is exceeded,
3078  *        synchronization is lost. Irrespective of the value of the Skip
3079  *        parameter, the Controller should stop skipping packets before the
3080  *        Sync_Timeout would be exceeded. The CTE_Type parameter specifies
3081  *        whether to only synchronize to periodic advertising with certain types
3082  *        of Constant Tone Extension. If the periodic advertiser changes the
3083  *        type of the Constant Tone Extension after the Controller has
3084  *        synchronized with the periodic advertising, it shall remain
3085  *        synchronized. Note: A value of 0 (i.e. all bits clear) indicates that
3086  *        the presence or absence of a Constant Tone Extension is irrelevant.
3087  *        This command does not affect any processing of any periodic
3088  *        advertising synchronization information already received from the peer
3089  *        device, whether or not the Controller has yet synchronized to the
3090  *        periodic advertising train it describes. The parameter values provided
3091  *        by this command override those provided via the HCI_LE_Set_Default_Per
3092  *        iodic_Advertising_Sync_Transfer_Parameterscommand or any preferences
3093  *        previously set using the
3094  *        HCI_LE_Set_Periodic_Advertising_Sync_Transfer_Parameters command on
3095  *        the same connection. If the Connection_Handle parameter does not
3096  *        identify a current connection, the Controller shall return the error
3097  *        code Unknown Connection Identifier (0x02).
3098  * @param Connection_Handle Connection handle that identifies the connection.
3099  *        Values:
3100  *        - 0x0000 ... 0x0EFF
3101  * @param Mode The action to be taken when periodic advertising synchronization
3102  *        information is received. If 0, no attempt is made to synchronize to
3103  *        the periodic advertising and no
3104  *        HCI_LE_Periodic_Advertising_Sync_Transfer_Received event is sent to
3105  *        the Host. If 1, an HCI_LE_Periodic_Advertising_Sync_Transfer_Received
3106  *        event is sent to the Host. HCI_LE_Periodic_Advertising_Report events
3107  *        will be disabled. If 2, an
3108  *        HCI_LE_Periodic_Advertising_Sync_Transfer_Received event is sent to
3109  *        the Host. HCI_LE_Periodic_Advertising_Report events will be enabled
3110  *        with duplicate filtering disabled. If 3, an
3111  *        HCI_LE_Periodic_Advertising_Sync_Transfer_Received event is sent to
3112  *        the Host. HCI_LE_Periodic_Advertising_Report events will be enabled
3113  *        with duplicate filtering enabled.
3114  *        Values:
3115  *        - 0x00: NO_SYNC
3116  *        - 0x01: REPORTS_DISABLED
3117  *        - 0x02: REPORTS_ENABLED
3118  *        - 0x03: REPORTS_ENABLED_WITH_DUPLICATE_FILTERING
3119  * @param Skip The number of periodic advertising packets that can be skipped
3120  *        after a successful receive.
3121  *        Values:
3122  *        - 0x0000 ... 0x01F3
3123  * @param Sync_Timeout Synchronization timeout for the periodic advertising
3124  *        train. Time = N*10 ms.
3125  *        Values:
3126  *        - 0x000A (100 ms)  ... 0x4000 (163840 ms)
3127  * @param CTE_Type It specifies whether to only synchronize to periodic
3128  *        advertising with certain types of Constant Tone Extension.  If bit 0
3129  *        is set: do not sync to packets with an AoA Constant Tone Extension. If
3130  *        bit 1 is set: Do not sync to packets with an AoD Constant Tone
3131  *        Extension with 1 us slots. If bit 2 is set: Do not sync to packets
3132  *        with an AoD Constant Tone Extension with 2 us slots. If bit 3 is set:
3133  *        Do not sync to packets without a Constant Tone Extension.
3134  *        Flags:
3135  *        - 0x01: DO_NOT_SYNC_WITH_AOA
3136  *        - 0x02: DO_NOT_SYNC_WITH_AOD_1US
3137  *        - 0x04: DO_NOT_SYNC_WITH_AOD_2US
3138  *        - 0x10: DO_NOT_SYNC_WITHOUT_CTE
3139  * @retval Value indicating success or error code.
3140  */
3141 tBleStatus hci_le_set_periodic_advertising_sync_transfer_parameters(uint16_t Connection_Handle,
3142                                                                     uint8_t Mode,
3143                                                                     uint16_t Skip,
3144                                                                     uint16_t Sync_Timeout,
3145                                                                     uint8_t CTE_Type);
3146 /**
3147  * @brief The HCI_LE_Set_Default_Periodic_Advertising_Sync_Transfer_Parameters
3148  *        command is used to specify the initial value for the mode, skip,
3149  *        timeout, and Constant Tone Extension type (set by the
3150  *        HCI_LE_Set_Periodic_Advertising_Sync_Transfer_Parameters command; see
3151  *        Section 7.8.91) to be used for all subsequent connections over the LE
3152  *        transport. The Mode parameter specifies the initial action to be
3153  *        taken. If Mode is 0x00, the Controller will ignore the information.
3154  *        Otherwise it will notify the Host and synchronize to the periodic
3155  *        advertising. Mode also specifies whether periodic advertising reports
3156  *        are initially enabled or disabled. The Skip parameter specifies the
3157  *        number of consecutive periodic advertising packets that the receiver
3158  *        may skip after successfully receiving a periodic advertising packet.
3159  *        The Sync_Timeout parameter specifies the maximum permitted time
3160  *        between successful receives. If this time is exceeded, synchronization
3161  *        is lost. The CTE_Type parameter specifies whether to only synchronize
3162  *        to periodic advertising with certain types of Constant Tone Extension.
3163  *        If the periodic advertiser changes the type of the Constant Tone
3164  *        Extension after the Controller has synchronized with the periodic
3165  *        advertising, it shall remain synchronized. Note: A value of 0 (i.e.
3166  *        all bits clear) indicates that the presence or absence of a Constant
3167  *        Tone Extension is irrelevant. This command does not affect any
3168  *        existing connection.
3169  * @param Mode The action to be taken when periodic advertising synchronization
3170  *        information is received. If 0, no attempt is made to synchronize to
3171  *        the periodic advertising and no
3172  *        HCI_LE_Periodic_Advertising_Sync_Transfer_Received event is sent to
3173  *        the Host. If 1, an HCI_LE_Periodic_Advertising_Sync_Transfer_Received
3174  *        event is sent to the Host. HCI_LE_Periodic_Advertising_Report events
3175  *        will be disabled. If 2, an
3176  *        HCI_LE_Periodic_Advertising_Sync_Transfer_Received event is sent to
3177  *        the Host. HCI_LE_Periodic_Advertising_Report events will be enabled
3178  *        with duplicate filtering disabled. If 3, an
3179  *        HCI_LE_Periodic_Advertising_Sync_Transfer_Received event is sent to
3180  *        the Host. HCI_LE_Periodic_Advertising_Report events will be enabled
3181  *        with duplicate filtering enabled.
3182  *        Values:
3183  *        - 0x00: NO_SYNC
3184  *        - 0x01: REPORTS_DISABLED
3185  *        - 0x02: REPORTS_ENABLED
3186  *        - 0x03: REPORTS_ENABLED_WITH_DUPLICATE_FILTERING
3187  * @param Skip The number of periodic advertising packets that can be skipped
3188  *        after a successful receive.
3189  *        Values:
3190  *        - 0x0000 ... 0x01F3
3191  * @param Sync_Timeout Synchronization timeout for the periodic advertising
3192  *        train. Time = N*10 ms.
3193  *        Values:
3194  *        - 0x000A (100 ms)  ... 0x4000 (163840 ms)
3195  * @param CTE_Type It specifies whether to only synchronize to periodic
3196  *        advertising with certain types of Constant Tone Extension.  If bit 0
3197  *        is set: do not sync to packets with an AoA Constant Tone Extension. If
3198  *        bit 1 is set: Do not sync to packets with an AoD Constant Tone
3199  *        Extension with 1 us slots. If bit 2 is set: Do not sync to packets
3200  *        with an AoD Constant Tone Extension with 2 us slots. If bit 3 is set:
3201  *        Do not sync to packets without a Constant Tone Extension.
3202  *        Flags:
3203  *        - 0x01: DO_NOT_SYNC_WITH_AOA
3204  *        - 0x02: DO_NOT_SYNC_WITH_AOD_1US
3205  *        - 0x04: DO_NOT_SYNC_WITH_AOD_2US
3206  *        - 0x10: DO_NOT_SYNC_WITHOUT_CTE
3207  * @retval Value indicating success or error code.
3208  */
3209 tBleStatus hci_le_set_default_periodic_advertising_sync_transfer_parameters(uint8_t Mode,
3210                                                                             uint16_t Skip,
3211                                                                             uint16_t Sync_Timeout,
3212                                                                             uint8_t CTE_Type);
3213 /**
3214  * @brief This command is used to read the maximum size of the data portion of
3215  *        ACL data packets and isochronous data packets sent from the Host to
3216  *        the Controller. The Host shall segment the data transmitted to the
3217  *        Controller according to these values so that the HCI Data packets and
3218  *        isochronous data packets will contain data up to this size. The
3219  *        HCI_LE_Read_Buffer_Size command also returns the total number of HCI
3220  *        LE ACL Data packets and isochronous data packets that can be stored in
3221  *        the data buffers of the Controller. The HCI_LE_Read_Buffer_Size
3222  *        command shall be issued by the Host before it sends any data to an LE
3223  *        Controller (see Section 4.1.1). If the Controller supports HCI ISO
3224  *        Data packets, it shall return non-zero values for the
3225  *        ISO_Data_Packet_Length and Total_Num_ISO_Data_Packets parameters.
3226  * @param[out] HC_LE_ACL_Data_Packet_Length 0x0000: No dedicated LE Buffer
3227  *             exists. Use the HCI_Read_Buffer_Size command. 0x001B - 0xFFFF
3228  *             Maximum length (in octets) of the data portion of each HCI ACL
3229  *             data packet.
3230  *             Values:
3231  *             - 0x0000: NO_BUFFER
3232  *             - 0x001B ... 0xFFFF
3233  * @param[out] HC_Total_Num_LE_ACL_Data_Packets 0x00: No dedicated LE Buffer
3234  *             exists. Use the HCI_Read_Buffer_Size command. 0x01 - 0xFF: Total
3235  *             number of HCI ACL Data Packets that can be stored in the data
3236  *             buffers of the Controller.
3237  *             Values:
3238  *             - 0x00: NO_BUFFER
3239  *             - 0x01 ... 0xFF
3240  * @param[out] ISO_Data_Packet_Length 0x0000: No dedicated ISO Buffer exists.
3241  *             0x0001 to 0xFFFF: The maximum length (in octets) of the data
3242  *             portion of each HCI ISO data packet.
3243  *             Values:
3244  *             - 0x0000: NO_BUFFER
3245  *             - 0x0001 ... 0xFFFF
3246  * @param[out] Total_Num_ISO_Data_Packets 0x00: No dedicated ISO Buffer exists.
3247  *             0x01 to 0xFF: The total number of HCI ISO data packets that can
3248  *             be stored in the ISO buffers of the Controller.
3249  *             Values:
3250  *             - 0x00: NO_BUFFER
3251  *             - 0x01 ... 0xFF
3252  * @retval Value indicating success or error code.
3253  */
3254 tBleStatus hci_le_read_buffer_size_v2(uint16_t *HC_LE_ACL_Data_Packet_Length,
3255                                       uint8_t *HC_Total_Num_LE_ACL_Data_Packets,
3256                                       uint16_t *ISO_Data_Packet_Length,
3257                                       uint8_t *Total_Num_ISO_Data_Packets);
3258 /**
3259  * @brief transmitted SDU identified by the Packet_Sequence_Number on a CIS or
3260  *        BIS identified by the Connection_Handle parameter on the Central or
3261  *        Peripheral. The Packet_Sequence_Number parameter contains the sequence
3262  *        number of a transmitted SDU. The TX_Time_Stamp and Time_Offset
3263  *        parameters are described in [Vol 6] Part G, Section 3.3 and [Vol 6]
3264  *        Part G, Section 3.1 respectively. When the Connection_Handle
3265  *        identifies a CIS or BIS that is transmitting unframed PDUs, the value
3266  *        of Time_Offset returned shall be zero. If the Host issues this command
3267  *        with a connection handle that does not exist, or the connection handle
3268  *        is not associated with a CIS or BIS, the Controller shall return the
3269  *        error code Unknown Connection Identifier (0x02). If the Host issues
3270  *        this command on an existing connection handle for a CIS or BIS that is
3271  *        not configured for transmitting SDUs, the Controller shall return the
3272  *        error code Command Disallowed (0x0C). If the Host issues this command
3273  *        before an SDU has been transmitted by the Controller, the Controller
3274  *        shall return the error code Command Disallowed (0x0C).
3275  * @param Connection_Handle Connection handle of the CIS or BIS.
3276  *        Values:
3277  *        - 0x0000 ... 0x0EFF
3278  * @param[out] Packet_Sequence_Number The packet sequence number of an SDU.
3279  * @param[out] TX_Time_Stamp The CIG reference point or BIG anchor point of a
3280  *             transmitted SDU derived using the Controller's free running
3281  *             reference clock (in microseconds).
3282  * @param[out] Time_Offset The time offset, in microseconds, that is associated
3283  *             with a transmitted SDU.
3284  * @retval Value indicating success or error code.
3285  */
3286 tBleStatus hci_le_read_iso_tx_sync(uint16_t Connection_Handle,
3287                                    uint16_t *Packet_Sequence_Number,
3288                                    uint32_t *TX_Time_Stamp,
3289                                    uint8_t Time_Offset[3]);
3290 /**
3291  * @brief The HCI_LE_Set_CIG_Parameters command is used by a Central's Host to
3292  *        create a CIG and to set the parameters of one or more CISes that are
3293  *        associated with a CIG in the Controller. The CIG_ID parameter
3294  *        identifies a CIG. This parameter is allocated by the Central's Host
3295  *        and passed to the Peripheral's Host through the Link Layers during the
3296  *        process of creating a CIS. If the CIG_ID does not exist, then the
3297  *        Controller shall first create a new CIG. Once the CIG is created
3298  *        (whether through this command or previously), the Controller shall
3299  *        modify or add CIS configurations in the CIG that is identified by the
3300  *        CIG_ID and update all the parameters that apply to the CIG. The
3301  *        SDU_Interval_C_To_P parameter specifies the time interval between the
3302  *        start of consecutive SDUs from the Central's Host for all the CISes in
3303  *        the CIG. This parameter shall be ignored for all CISes that are
3304  *        unidirectional from Peripheral to Central. The SDU_Interval_P_To_C
3305  *        parameter specifies the time interval between the start of consecutive
3306  *        SDUs from the Peripheral's Host for all the CISes in the CIG. This
3307  *        parameter shall be ignored for all CISes that are unidirectional from
3308  *        Central to Peripheral. The Worst_Case_SCA parameter shall be the
3309  *        worst-case sleep clock accuracy of all the Peripherals that will
3310  *        participate in the CIG. The Host should get the sleep clock accuracy
3311  *        from all the Peripherals before issuing this command. If the Host
3312  *        cannot get the sleep clock accuracy from all the Peripherals, it shall
3313  *        set the Worst_Case_SCA parameter to zero. Note: The Worst_Case_SCA
3314  *        parameter can be used by the Link Layer to better allow for clock
3315  *        drift when scheduling the CISes in the CIG. For example, if a CIS has
3316  *        more than two subevents, the Link Layer of the Central can set the
3317  *        timing of the subevents such that the worst case drift in the
3318  *        Peripheral's clock will not exceed 2 x Sub_Interval. This prevents the
3319  *        Peripheral from synchronizing its timing to the wrong subevent
3320  *        (adjacent subevents cannot be on the same channel). The Packing
3321  *        parameter indicates the preferred method of arranging subevents of
3322  *        multiple CISes. The subevents can be arranged in Sequential or
3323  *        Interleaved arrangement (see [Vol 6] Part B, Section 4.5.14.2). This
3324  *        is a recommendation to the Controller which the Controller may ignore.
3325  *        This parameter shall be ignored when there is only one CIS in the CIG.
3326  *        The Framing parameter indicates the format of the CIS Data PDUs of the
3327  *        specified CISes. If the Framing parameter is set to 1 then the CIS
3328  *        Data PDUs of the specified CISes shall be framed. If the Framing
3329  *        parameter is set to 0 the CIS Data PDUs of a given CIS may be either
3330  *        unframed or framed (determined separately for each specified CIS) (see
3331  *        [Vol 6] Part G, Section 1). The Max_Transport_Latency_C_To_P parameter
3332  *        contains the maximum transport latency from the Central to the
3333  *        Peripheral, in milliseconds, as described in [Vol 6] Part G, Section
3334  *        3.2.1 and [Vol 6] Part G, Section 3.2.2. This parameter shall be
3335  *        ignored for all CISes that are unidirectional from Peripheral to
3336  *        Central. The Max_Transport_Latency_P_To_C parameter contains the
3337  *        maximum transport latency from the Peripheral to the Central, in
3338  *        milliseconds, as described in [Vol 6] Part G, Section 3.2.1 and [Vol
3339  *        6] Part G, Section 3.2.2. This parameter shall be ignored for all
3340  *        CISes that are unidirectional from Central to Peripheral. The
3341  *        CIS_Count parameter indicates the number of CIS configurations being
3342  *        modified or added by this command. The Controller shall set the
3343  *        CIS_Count return parameter equal to this. The CIS_ID[i] parameter
3344  *        identifies a CIS and is set by the Central's Host and passed to the
3345  *        Peripheral's Host through the Link Layers during the process of
3346  *        establishing a CIS. The Max_SDU_C_To_P[i] parameter identifies the
3347  *        maximum size of an SDU from the Central's Host. If the CIS is
3348  *        unidirectional from Peripheral to Central, this parameter shall be set
3349  *        to 0. If a CIS configuration that is being modified has a data path
3350  *        set in the Central to Peripheral direction and the Host has specified
3351  *        that Max_SDU_C_To_P[i] shall be set to zero, the Controller shall
3352  *        return the error code Command Disallowed (0x0C). The Max_SDU_P_To_C[i]
3353  *        parameter identifies the maximum size of an SDU from the Peripheral's
3354  *        Host. If the CIS is unidirectional from Central to Peripheral, this
3355  *        parameter shall be set to 0. If a CIS configuration that is being
3356  *        modified has a data path set in the Peripheral to Central direction
3357  *        and the Host has specified that Max_SDU_P_To_C[i] shall be set to
3358  *        zero, the Controller shall return the error code Command Disallowed
3359  *        (0x0C). The PHY_C_To_P[i] parameter identifies which PHY to use for
3360  *        transmission from the Central to the Peripheral. The Host shall set at
3361  *        least one bit in this parameter and the Controller shall pick a PHY
3362  *        from the bits that are set. The PHY_P_To_C[i] parameter identifies
3363  *        which PHY to use for transmission from the Peripheral to the Central.
3364  *        The Host shall set at least one bit in this parameter and the
3365  *        Controller shall pick a PHY from the bits that are set. The
3366  *        RTN_C_To_P[i] (Retransmission Number) parameter contains the number of
3367  *        times that a CIS Data PDU should be retransmitted from the Central to
3368  *        Peripheral before being acknowledged or flushed (irrespective of which
3369  *        isochronous events the retransmission opportunities occur in). If the
3370  *        CIS is unidirectional from Peripheral to Central, this parameter shall
3371  *        be ignored. Otherwise, this parameter is a recommendation to the
3372  *        Controller which the Controller may ignore. The RTN_P_To_C[i]
3373  *        parameter contains the number of times that a CIS Data PDU should be
3374  *        retransmitted from the Peripheral to Central before being acknowledged
3375  *        or flushed (irrespective of which isochronous events the
3376  *        retransmission opportunities occur in). If the CIS is unidirectional
3377  *        from Central to Peripheral, this parameter shall be ignored.
3378  *        Otherwise, this parameter is a recommendation to the Controller which
3379  *        the Controller may ignore. If the Status return parameter is non-zero,
3380  *        then the state of the CIG and its CIS configurations shall not be
3381  *        changed by the command. If the CIG did not already exist, it shall not
3382  *        be created. If the Status return parameter is zero, then the
3383  *        Controller shall set the Connection_Handle arrayed return parameter to
3384  *        the connection handle(s) corresponding to the CIS configurations
3385  *        specified in the CIS_IDs command parameter, in the same order. If the
3386  *        same CIS_ID is being reconfigured, the same connection handle shall be
3387  *        returned. The connection handle of a CIS shall refer to the CIS when
3388  *        it exists and to the configuration of the CIS stored in a CIG when the
3389  *        CIG exists but the CIS with that CIS_ID does not. If the Host issues
3390  *        this command when the CIG is not in the configurable state, the
3391  *        Controller shall return the error code Command Disallowed (0x0C). If
3392  *        the Host attempts to create a CIG or set parameters that exceed the
3393  *        maximum supported resources in the Controller, the Controller shall
3394  *        return the error code Memory Capacity Exceeded (0x07). If the Host
3395  *        attempts to set CIS parameters that exceed the maximum supported
3396  *        connections in the Controller, the Controller shall return the error
3397  *        code Connection Limit Exceeded (0x09). If the Host sets, in the
3398  *        PHY_C_To_P[i] or PHY_P_To_C[i] parameters, a bit for a PHY that the
3399  *        Controller does not support, including a bit that is reserved for
3400  *        future use, the Controller shall return the error code Unsupported
3401  *        Feature or Parameter Value (0x11). If the Controller does not support
3402  *        asymmetric PHYs and the Host sets PHY_C_To_P[i] to a different value
3403  *        than PHY_P_To_C[i], the Controller shall return the error code
3404  *        Unsupported Feature or Parameter Value (0x11). If the Host specifies
3405  *        an invalid combination of CIS parameters, the Controller shall return
3406  *        the error code Unsupported Feature or Parameter Value (0x11).
3407  * @param CIG_ID Used to identify the CIG.
3408  *        Values:
3409  *        - 0x00 ... 0xEF
3410  * @param SDU_Interval_C_To_P The interval, in microseconds, of periodic SDUs.
3411  *        Values:
3412  *        - 0x0000FF ... 0x0FFFFF
3413  * @param SDU_Interval_P_To_C The interval, in microseconds, of periodic SDUs.
3414  *        Values:
3415  *        - 0x0000FF ... 0x0FFFFF
3416  * @param Worst_Case_SCA Worst-case sleep clock accuracy of all the Peripherals.
3417  *        Values:
3418  *        - 0x00: 251 ppm to 500 ppm
3419  *        - 0x01: 151 ppm to 250 ppm
3420  *        - 0x02: 101 ppm to 150 ppm
3421  *        - 0x03: 76 ppm to 100 ppm
3422  *        - 0x04: 51 ppm to 75 ppm
3423  *        - 0x05: 31 ppm to 50 ppm
3424  *        - 0x06: 21 ppm to 30 ppm
3425  *        - 0x07: 0 ppm to 20 ppm
3426  * @param Packing Preferred method of arranging subevents of multiple CISes.
3427  *        Values:
3428  *        - 0x00: Sequential
3429  *        - 0x01: Interleaved
3430  * @param Framing Format of the CIS Data PDUs of the specified CISes.
3431  *        Values:
3432  *        - 0x00: Unframed
3433  *        - 0x01: Framed
3434  * @param Max_Transport_Latency_C_To_P Maximum transport latency, in
3435  *        milliseconds, from the Central's Controller to the Peripheral's
3436  *        Controller.
3437  *        Values:
3438  *        - 0x0005 ... 0x0FA0
3439  * @param Max_Transport_Latency_P_To_C Maximum transport latency, in
3440  *        milliseconds, from the Peripheral's Controller to the Central's
3441  *        Controller.
3442  *        Values:
3443  *        - 0x0005 ... 0x0FA0
3444  * @param CIS_Count Total number of CIS configurations in the CIG being added or
3445  *        modified.
3446  *        Values:
3447  *        - 0x00 ... 0x1F
3448  * @param CIS_Param See @ref CIS_Param_t
3449  * @param[out] Connection_Handle Connection handle of the CIS in the CIG.
3450  * @retval Value indicating success or error code.
3451  */
3452 tBleStatus hci_le_set_cig_parameters(uint8_t CIG_ID,
3453                                      uint8_t SDU_Interval_C_To_P[3],
3454                                      uint8_t SDU_Interval_P_To_C[3],
3455                                      uint8_t Worst_Case_SCA,
3456                                      uint8_t Packing,
3457                                      uint8_t Framing,
3458                                      uint16_t Max_Transport_Latency_C_To_P,
3459                                      uint16_t Max_Transport_Latency_P_To_C,
3460                                      uint8_t CIS_Count,
3461                                      CIS_Param_t CIS_Param[],
3462                                      uint16_t Connection_Handle[]);
3463 /**
3464  * @brief The HCI_LE_Set_CIG_Parameters_Test command should only be used for
3465  *        testing purposes. The command is used by a Central's Host to create a
3466  *        CIG and to set the parameters of one or more CISes that are associated
3467  *        with a CIG in the Controller. The CIG_ID parameter identifies a CIG.
3468  *        This parameter is allocated by the Central's Host and passed to the
3469  *        Peripheral's Host through the Link Layers during the process of
3470  *        creating a CIS. If the CIG_ID does not exist, then the Controller
3471  *        shall first create a new CIG. Once the CIG is created (whether through
3472  *        this command or previously), the Controller shall modify or add CIS
3473  *        configurations in the CIG that is identified by the CIG_ID and update
3474  *        all the parameters that apply to the CIG. The SDU_Interval_C_To_P
3475  *        parameter specifies the time interval of periodic SDUs from the
3476  *        Central's Host. The SDU_Interval_P_To_C parameter specifies the time
3477  *        interval of periodic SDUs from the Peripheral's Host. The FT_C_To_P
3478  *        parameter identifies the maximum time for a payload from the Central
3479  *        to Peripheral to be transmitted and re-transmitted, after which it is
3480  *        flushed (see [Vol 6] Part B, Section 4.5.13.5). This parameter is
3481  *        expressed in multiples of ISO_Interval. The FT_P_To_C parameter
3482  *        identifies the maximum time for a payload from the Peripheral to
3483  *        Central to be transmitted and re-transmitted, after which it is
3484  *        flushed (see[Vol 6] Part B, Section 4.5.13.5). This parameter is
3485  *        expressed in multiples of ISO_Interval. The ISO_Interval parameter
3486  *        specifies the time between two consecutive CIS anchor points. The
3487  *        CIS_Count parameter contains the number of CIS configurations being
3488  *        added or modified by this command. The Controller shall set the
3489  *        CIS_Count return parameter equal to this. The CIS_ID[i] parameter
3490  *        identifies the CIS and is set by the Central's Host and passed to the
3491  *        Peripheral's Host through the Link Layers during the process of
3492  *        establishing a CIS. The Worst_Case_SCA parameter is the worst-case
3493  *        sleep clock accuracy of all the Peripherals that will participate in
3494  *        the CIG. The Host should get the sleep clock accuracy from all the
3495  *        Peripherals before issuing this command. In case the Host cannot get
3496  *        the sleep clock accuracy from all the Peripherals, it shall set the
3497  *        Worst_Case_SCA parameter to zero. Note: The Worst_Case_SCA parameter
3498  *        can be used by the Link Layer to better allow for clock drift when
3499  *        scheduling the CISes in the CIG. For example, if a CIS has more than
3500  *        two subevents, the Link Layer of the Central can set the timing of the
3501  *        subevents such that the worst case drift in the Peripheral's clock
3502  *        will not exceed 2 x Sub_Interval. This prevents the Peripheral from
3503  *        synchronizing its timing to the wrong subevent (adjacent subevents
3504  *        cannot be on the same channel). The Packing parameter is used to
3505  *        indicate the preferred method of arranging subevents of multiple
3506  *        CISes. The subevents can be arranged in Sequential or Interleaved
3507  *        arrangement. This is a recommendation to the Controller which it may
3508  *        ignore. This parameter shall be ignored when there is only one CIS in
3509  *        the CIG. The Framing parameter indicates the format of the CIS Data
3510  *        PDUs of all the CISes. If the Framing parameter is set to 1 then the
3511  *        CIS Data PDUs of the specified CISes shall be framed, and when set to
3512  *        0 they shall be unframed (see [Vol 6] Part G, Section 1). The
3513  *        CIS_ID[i] parameter is used to identify a CIS. The NSE[i] parameter
3514  *        identifies the maximum number of subevents for each CIS in a CIG
3515  *        event. The Max_SDU_C_To_P[i] parameter identifies the maximum size of
3516  *        SDU from the Central's Host. If the CIS is unidirectional from
3517  *        Peripheral to Central, this parameter shall be set to 0. If a CIS
3518  *        configuration that is being modified has a data path set in the
3519  *        Central to Peripheral direction and the Host has specified that
3520  *        Max_SDU_C_To_P[i] shall be set to zero, the Controller shall return
3521  *        the error code Command Disallowed (0x0C). The minimum value of the
3522  *        Max_SDU_Size parameter in the ISO Transmit Test mode when the
3523  *        Payload_Type = 1 or 2 shall be 4 octets. The Max_SDU_P_To_C[i]
3524  *        parameter identifies the maximum size of SDU from the Peripheral's
3525  *        Host. If the CIS is unidirectional from Central to Peripheral, this
3526  *        parameter shall be set to 0. If a CIS configuration that is being
3527  *        modified has a data path set in the Peripheral to Central direction
3528  *        and the Host has specified that Max_SDU_P_To_C[i] shall be set to
3529  *        zero, the Controller shall return the error code Command Disallowed
3530  *        (0x0C).The minimum value of the Max_SDU parameter in the ISO Transmit
3531  *        Test mode when the Payload_Type = 1 or 2 shall be 4 octets. The
3532  *        Max_PDU_C_To_P[i] parameter identifies the maximum size PDU from the
3533  *        Central to Peripheral. The Max_PDU_P_To_C[i] parameter identifies the
3534  *        maximum size PDU from the Peripheral to Central. The PHY_C_To_P[i]
3535  *        parameter identifies the PHY to be used for transmission of packets
3536  *        from the Central to the Peripheral. The Host shall set only one bit in
3537  *        this parameter and the Controller shall use the PHY set by the Host.
3538  *        The PHY_P_To_C[i] parameter identifies the PHY to be used for
3539  *        transmission of packets from the Peripheral to the Central. The Host
3540  *        shall set only one bit in this parameter and the Controller shall use
3541  *        the PHY set by the Host. The BN_C_To_P[i] parameter identifies the
3542  *        burst number for Central to Peripheral (see [Vol 6] Part B, Section
3543  *        4.5.13). If the CIS is unidirectional from Peripheral to Central, this
3544  *        parameter shall be set to zero. The BN_P_To_C[i] parameter identifies
3545  *        the burst number for Peripheral to Central (see [Vol 6] Part B,
3546  *        Section 4.5.13). If the CIS is unidirectional from Central to
3547  *        Peripheral, this parameter shall be set to zero. If the Status return
3548  *        parameter is non-zero, then the state of the CIG and its CIS
3549  *        configurations shall not be changed by the command. If the CIG did not
3550  *        already exist, it shall not be created. If the Status return parameter
3551  *        is zero, then the Controller shall set the Connection_Handle arrayed
3552  *        return parameter to the connection handle(s) corresponding to the CIS
3553  *        configurations specified in the CIS_IDs command parameter, in the same
3554  *        order. If the same CIS_ID is being reconfigured, the same connection
3555  *        handle shall be returned. If the Host issues this command when the CIG
3556  *        is not in the configurable state, the Controller shall return the
3557  *        error code Command Disallowed (0x0C). If the Host attempts to create a
3558  *        CIG or set parameters that exceed the maximum supported resources in
3559  *        the Controller, the Controller shall return the error code Memory
3560  *        Capacity Exceeded (0x07). If the Host attempts to set CIS parameters
3561  *        that exceed the maximum supported connections in the Controller, the
3562  *        Controller shall return the error code Connection Limit Exceeded
3563  *        (0x09). If the Host attempts to set an invalid combination of CIS
3564  *        parameters, the Controller shall return the error code Unsupported
3565  *        Feature or Parameter Value (0x11). If the Host sets, in the
3566  *        PHY_C_To_P[i] or PHY_P_To_C[i] parameters, a bit for a PHY that the
3567  *        Controller does not support, including a bit that is reserved for
3568  *        future use, the Controller shall return the error code Unsupported
3569  *        Feature or Parameter Value (0x11). If the Controller does not support
3570  *        asymmetric PHYs and the Host sets PHY_C_To_P[i] to a different value
3571  *        than PHY_P_To_C[i], the Controller shall return the error code
3572  *        Unsupported Feature or Parameter Value (0x11).
3573  * @param CIG_ID Used to identify the CIG.
3574  *        Values:
3575  *        - 0x00 ... 0xEF
3576  * @param SDU_Interval_C_To_P The interval, in microseconds, of periodic SDUs.
3577  *        Values:
3578  *        - 0x0000FF ... 0x0FFFFF
3579  * @param SDU_Interval_P_To_C The interval, in microseconds, of periodic SDUs.
3580  *        Values:
3581  *        - 0x0000FF ... 0x0FFFFF
3582  * @param FT_C_To_P The flush timeout in multiples of ISO_Interval for each
3583  *        payload sent from the Central to Peripheral.
3584  *        Values:
3585  *        - 0x01 ... 0xFF
3586  * @param FT_P_To_C The flush timeout in multiples of ISO_Interval for each
3587  *        payload sent from the Peripheral to Central.
3588  *        Values:
3589  *        - 0x01 ... 0xFF
3590  * @param ISO_Interval Time between consecutive CIS anchor points. Time = N *
3591  *        1.25 ms
3592  *        Values:
3593  *        - 0x0004 (5.00 ms)  ... 0x0C80 (4000.00 ms)
3594  * @param Worst_Case_SCA Worst-case sleep clock accuracy of all the Peripherals.
3595  *        Values:
3596  *        - 0x00: 251 ppm to 500 ppm
3597  *        - 0x01: 151 ppm to 250 ppm
3598  *        - 0x02: 101 ppm to 150 ppm
3599  *        - 0x03: 76 ppm to 100 ppm
3600  *        - 0x04: 51 ppm to 75 ppm
3601  *        - 0x05: 31 ppm to 50 ppm
3602  *        - 0x06: 21 ppm to 30 ppm
3603  *        - 0x07: 0 ppm to 20 ppm
3604  * @param Packing Preferred method of arranging subevents of multiple CISes.
3605  *        Values:
3606  *        - 0x00: Sequential
3607  *        - 0x01: Interleaved
3608  * @param Framing Format of the CIS Data PDUs of the specified CISes.
3609  *        Values:
3610  *        - 0x00: Unframed
3611  *        - 0x01: Framed
3612  * @param CIS_Count Total number of CIS configurations in the CIG being added or
3613  *        modified.
3614  *        Values:
3615  *        - 0x00 ... 0x1F
3616  * @param CIS_Param_Test See @ref CIS_Param_Test_t
3617  * @param[out] Connection_Handle Connection handle of the CIS in the CIG.
3618  * @retval Value indicating success or error code.
3619  */
3620 tBleStatus hci_le_set_cig_parameters_test(uint8_t CIG_ID,
3621                                           uint8_t SDU_Interval_C_To_P[3],
3622                                           uint8_t SDU_Interval_P_To_C[3],
3623                                           uint8_t FT_C_To_P,
3624                                           uint8_t FT_P_To_C,
3625                                           uint16_t ISO_Interval,
3626                                           uint8_t Worst_Case_SCA,
3627                                           uint8_t Packing,
3628                                           uint8_t Framing,
3629                                           uint8_t CIS_Count,
3630                                           CIS_Param_Test_t CIS_Param_Test[],
3631                                           uint16_t Connection_Handle[]);
3632 /**
3633  * @brief The HCI_LE_Create_CIS command is used by the Central's Host to create
3634  *        one or more CISes using the connections identified by the
3635  *        ACL_Connection_Handle arrayed parameter. The CIS_Count parameter is
3636  *        the total number of CISes created by this command. The
3637  *        CIS_Connection_Handle[i] parameter specifies the connection handle
3638  *        corresponding to the configuration of the CIS to be created and whose
3639  *        configuration is already stored in a CIG. The ACL_Connection_Handle[i]
3640  *        parameter specifies the connection handle of the ACL connection
3641  *        associated with each CIS to be created. The list of the
3642  *        ACL_Connection_Handles shall be in the same order as the list of the
3643  *        CIS_Connection_Handles e.g., CIS_Connection_Handle[1] will connect to
3644  *        the Peripheral associated with the ACL_Connection_Handle[1]. If any
3645  *        ACL_Connection_Handle[i] is not the handle of an existing ACL
3646  *        connection or any CIS_Connection_Handle[i] is not the handle of a CIS
3647  *        or CIS configuration, the Controller shall return the error code
3648  *        Unknown Connection Identifier (0x02). If the Host attempts to create a
3649  *        CIS that has already been created, the Controller shall return the
3650  *        error code Connection Already Exists (0x0B). If two different elements
3651  *        of the CIS_Connection_Handle arrayed parameter identify the same CIS,
3652  *        the Controller shall return the error code Invalid HCI Command
3653  *        Parameters (0x12). If the Host issues this command before all the
3654  *        HCI_LE_CIS_Established events from the previous use of the command
3655  *        have been generated, the Controller shall return the error code
3656  *        Command Disallowed (0x0C). If the Host issues this command on an
3657  *        ACL_Connection_Handle where the Controller is the Peripheral, the
3658  *        Controller shall return the error code Command Disallowed (0x0C).
3659  *        Note: The order of the CIS connection handles in this command does not
3660  *        relate to the order of connection handles in the return parameters of
3661  *        the HCI_LE_Set_CIG_Parameters command or the
3662  *        HCI_LE_Set_CIG_Parameters_Test command. If the Host issues this
3663  *        command when the Connected Isochronous Stream (Host Support) feature
3664  *        bit (see [Vol 6] Part B, Section 4.6.27) is not set, the Controller
3665  *        shall return the error code Command Disallowed (0x0C).
3666  * @param CIS_Count Total number of CISes to be created.
3667  *        Values:
3668  *        - 0x01 ... 0x1F
3669  * @param CIS_Handles See @ref CIS_Handles_t
3670  * @retval Value indicating success or error code.
3671  */
3672 tBleStatus hci_le_create_cis(uint8_t CIS_Count,
3673                              CIS_Handles_t CIS_Handles[]);
3674 /**
3675  * @brief The HCI_LE_Remove_CIG command is used by the Central's Host to remove
3676  *        the CIG identified by CIG_ID. The CIG_ID parameter contains the
3677  *        identifier of the CIG. This command shall delete the CIG_ID and also
3678  *        delete the Connection_Handles of the CIS configurations stored in the
3679  *        CIG. This command shall also remove the isochronous data paths that
3680  *        are associated with the Connection_Handles of the CIS configurations,
3681  *        which is equivalent to issuing the HCI_LE_Remove_ISO_Data_Path command
3682  *        (see Section 7.8.109). If the Host tries to remove a CIG which is in
3683  *        the active state, then the Controller shall return the error code
3684  *        Command Disallowed (0x0C). If the Host issues this command with a
3685  *        CIG_ID that does not exist, the Controller shall return the error code
3686  *        Unknown Connection Identifier (0x02).
3687  * @param CIG_ID Identifier of a CIG.
3688  *        Values:
3689  *        - 0x00 ... 0xEF
3690  * @retval Value indicating success or error code.
3691  */
3692 tBleStatus hci_le_remove_cig(uint8_t CIG_ID);
3693 /**
3694  * @brief The HCI_LE_Accept_CIS_Request command is used by the Peripheral's Host
3695  *        to inform the Controller to accept the request for the CIS that is
3696  *        identified by the Connection_Handle. The command shall only be issued
3697  *        after an HCI_LE_CIS_Request event has occurred. The event contains the
3698  *        Connection_Handle of the CIS. If the Peripheral's Host issues this
3699  *        command with a Connection_Handle that does not exist, or the
3700  *        Connection_Handle is not for a CIS, the Controller shall return the
3701  *        error code Unknown Connection Identifier (0x02). If the Peripheral's
3702  *        Host issues this command with a Connection_Handle for a CIS that has
3703  *        already been established or that already has an
3704  *        HCI_LE_Accept_CIS_Request or HCI_LE_Reject_CIS_Request command in
3705  *        progress, the Controller shall return the error code Command
3706  *        Disallowed (0x0C). If the Central's Host issues this command, the
3707  *        Controller shall return the error code Command Disallowed (0x0C).
3708  * @param Connection_Handle Connection handle of the CIS.
3709  *        Values:
3710  *        - 0x0000 ... 0x0EFF
3711  * @retval Value indicating success or error code.
3712  */
3713 tBleStatus hci_le_accept_cis_request(uint16_t Connection_Handle);
3714 /**
3715  * @brief The HCI_LE_Reject_CIS_Request command is used by the Peripheral's Host
3716  *        to inform the Controller to reject the request for the CIS that is
3717  *        identified by the Connection_Handle. The command shall only be issued
3718  *        after an HCI_LE_CIS_Request event has occurred. The event contains the
3719  *        Connection_Handle of the CIS. When this command succeeds, the
3720  *        Controller shall delete the Connection_Handle of the requested CIS.
3721  *        The Reason command parameter indicates the reason for rejecting the
3722  *        CIS request. If the Peripheral's Host issues this command with a
3723  *        Connection_Handle that is not for a CIS, the Controller shall return
3724  *        the error code Unknown Connection Identifier (0x02). If the
3725  *        Peripheral's Host issues this command with a Connection_Handle for a
3726  *        CIS that has already been established or that already has an HCI_LE_-
3727  *        Accept_CIS_Request or HCI_LE_Reject_CIS_Request command in progress,
3728  *        the Controller shall return the error code Command Disallowed (0x0C).
3729  *        If the Central's Host issues this command, the Controller shall return
3730  *        the error code Command Disallowed (0x0C).
3731  * @param Connection_Handle Reason the CIS request was rejected. See [Vol 1]
3732  *        Part F, Controller Error Codes for a list of error codes and
3733  *        descriptions.
3734  * @param Reason Reason the CIS request was rejected. See [Vol 1] Part F,
3735  *        Controller Error Codes for a list of error codes and descriptions.
3736  * @retval Value indicating success or error code.
3737  */
3738 tBleStatus hci_le_reject_cis_request(uint16_t Connection_Handle,
3739                                      uint8_t Reason);
3740 /**
3741  * @brief The HCI_LE_Create_BIG command is used to create a BIG with one or more
3742  *        BISes (see [Vol 6] Part B, Section 4.4.6). All BISes in a BIG have the
3743  *        same value for all parameters. The BIG_Handle contains the identifier
3744  *        of the BIG. This parameter is allocated by the Host and used by the
3745  *        Controller and the Host to identify a BIG. The Advertising_Handle
3746  *        identifies the associated periodic advertising train of the BIG (see
3747  *        [Vol 6] Part B, Section 4.4.5.1). The Num_BIS parameter contains the
3748  *        total number of BISes in the BIG. The SDU_Interval parameter contains
3749  *        the time interval of the periodic SDUs. The Max_SDU parameter contains
3750  *        the maximum size of an SDU. The Max_Transport_Latency parameter is the
3751  *        maximum transport latency (in milliseconds) as described in [Vol 6]
3752  *        Part G, Section 3.2.1 and [Vol 6] Part G, Section 3.2.2. This includes
3753  *        pre-transmissions. The RTN (Retransmission Number) parameter contains
3754  *        the number of times every PDU should be retransmitted, irrespective of
3755  *        which isochronous events the retransmissions occur in. This is a
3756  *        recommendation to the Controller which the Controller may ignore. The
3757  *        PHY parameter is a bit field that indicates the PHY used for
3758  *        transmission of PDUs of BISes in the BIG. The Host shall set at least
3759  *        one bit in this parameter and the Controller shall pick a PHY from the
3760  *        bits set. If the Host sets, in the PHY parameter, a bit for a PHY that
3761  *        the Controller does not support, including a bit that is reserved for
3762  *        future use, the Controller shall return the error code Unsupported
3763  *        Feature or Parameter Value (0x11). The Packing parameter is used to
3764  *        indicate the preferred method of arranging subevents of multiple
3765  *        BISes. The subevents can be arranged in Sequential or Interleaved
3766  *        arrangement. This is a recommendation to the Controller which it may
3767  *        ignore. This parameter shall be ignored when there is only one BIS in
3768  *        the BIG. The Framing parameter indicates the format for sending BIS
3769  *        Data PDUs. If the Framing parameter is set to 1 then BIS Data PDUs
3770  *        shall be Framed and when set to 0 they may be unframed (see [Vol 6]
3771  *        Part G, Section 1). The Encryption parameter identifies the encryption
3772  *        mode of the BISes. If the Encryption parameter is set to 1
3773  *        (encrypted), the Broadcast_Code is used in the encryption of payloads
3774  *        (see [Vol 6] Part B, Section 4.4.6.10). The Broadcast_Code parameter
3775  *        is used to generate the encryption key for encrypting payloads of all
3776  *        BISes. When the Encryption parameter is set to 0 (unencrypted), the
3777  *        Broadcast_Code parameter shall be set to zero by the Host and ignored
3778  *        by the Controller. If the Controller cannot create all BISes of the
3779  *        BIG or if Num_BIS exceeds the maximum value supported by the
3780  *        Controller, it shall return the error code Connection Rejected due to
3781  *        Limited Resources (0x0D). If the Advertising_Handle does not identify
3782  *        a periodic advertising train or the periodic advertising train is
3783  *        associated with another BIG, the Controller shall return the error
3784  *        code Unknown Advertising Identifier (0x42). If the Host issues this
3785  *        command with a BIG_Handle for a BIG that is already created, the
3786  *        Controller shall return the error code Command Disallowed (0x0C). If
3787  *        the Host specifies an invalid combination of BIG parameters, the
3788  *        Controller shall return an error which should use the error code
3789  *        Unsupported Feature or Parameter Value (0x11).
3790  * @param BIG_Handle Used to identify the BIG.
3791  *        Values:
3792  *        - 0x00 ... 0xEF
3793  * @param Advertising_Handle Used to identify the periodic advertising train.
3794  *        Values:
3795  *        - 0x00 ... 0xEF
3796  * @param Num_BIS Total number of BISes in the BIG.
3797  *        Values:
3798  *        - 0x01 ... 0x1F
3799  * @param SDU_Interval The interval, in microseconds, of periodic SDUs.
3800  *        Values:
3801  *        - 0x0000FF ... 0x0FFFFF
3802  * @param Max_SDU Maximum size of an SDU, in octets.
3803  *        Values:
3804  *        - 0x0001 ... 0x0FFF
3805  * @param Max_Transport_Latency Maximum transport latency, in milliseconds.
3806  *        Values:
3807  *        - 0x0005 ... 0x0FA0
3808  * @param RTN The number of times that every BIS Data PDU should be
3809  *        retransmitted.
3810  *        Values:
3811  *        - 0x00 ... 0x1E
3812  * @param PHY Transmitter PHY of packets.
3813  *        Flags:
3814  *        - 0x01: LE_1M_PHY_BIT
3815  *        - 0x02: LE_2M_PHY_BIT
3816  *        - 0x04: LE_CODED_PHY_BIT
3817  * @param Packing Used to indicate the preferred method of arranging subevents
3818  *        of multiple BISes.
3819  *        Values:
3820  *        - 0x00: Sequential
3821  *        - 0x01: Interleaved
3822  * @param Framing The format for sending BIS Data PDUs.
3823  *        Values:
3824  *        - 0x00: Unframed
3825  *        - 0x01: Framed
3826  * @param Encryption The encryption mode of the BISes.
3827  *        Values:
3828  *        - 0x00: Unencrypted
3829  *        - 0x01: Encrypted
3830  * @param Broadcast_Code 128-bit code used for deriving the session key for
3831  *        decrypting payloads of BISes in the BIG.
3832  * @retval Value indicating success or error code.
3833  */
3834 tBleStatus hci_le_create_big(uint8_t BIG_Handle,
3835                              uint8_t Advertising_Handle,
3836                              uint8_t Num_BIS,
3837                              uint8_t SDU_Interval[3],
3838                              uint16_t Max_SDU,
3839                              uint16_t Max_Transport_Latency,
3840                              uint8_t RTN,
3841                              uint8_t PHY,
3842                              uint8_t Packing,
3843                              uint8_t Framing,
3844                              uint8_t Encryption,
3845                              uint8_t Broadcast_Code[16]);
3846 /**
3847  * @brief The HCI_LE_Create_BIG_Test command should only be used for testing
3848  *        purposes. The command is used to create one or more BISes of a BIG.
3849  *        All BISes in the BIG have the same values for all parameters.
3850  * @param BIG_Handle Used to identify the BIG.
3851  *        Values:
3852  *        - 0x00 ... 0xEF
3853  * @param Advertising_Handle Used to identify the periodic advertising train.
3854  *        Values:
3855  *        - 0x00 ... 0xEF
3856  * @param Num_BIS Total number of BISes in the BIG.
3857  *        Values:
3858  *        - 0x01 ... 0x1F
3859  * @param SDU_Interval The interval, in microseconds, of periodic SDUs.
3860  *        Values:
3861  *        - 0x0000FF ... 0x0FFFFF
3862  * @param ISO_Interval The time between consecutive BIG anchor points. Time = N
3863  *        * 1.25 ms Time Range: 5 ms to 4 s
3864  *        Values:
3865  *        - 0x0004 (5.00 ms)  ... 0x0C80 (4000.00 ms)
3866  * @param NSE The total number of subevents in each interval of each BIS in the
3867  *        BIG.
3868  *        Values:
3869  *        - 0x01 ... 0x1F
3870  * @param Max_SDU Maximum size of an SDU, in octets.
3871  *        Values:
3872  *        - 0x0001 ... 0x0FFF
3873  * @param Max_PDU Maximum size, in octets, of payload
3874  *        Values:
3875  *        - 0x0001 ... 0x00FB
3876  * @param PHY Transmitter PHY of packets.
3877  *        Flags:
3878  *        - 0x01: LE_1M_PHY_BIT
3879  *        - 0x02: LE_2M_PHY_BIT
3880  *        - 0x04: LE_CODED_PHY_BIT
3881  * @param Packing Used to indicate the preferred method of arranging subevents
3882  *        of multiple BISes.
3883  *        Values:
3884  *        - 0x00: Sequential
3885  *        - 0x01: Interleaved
3886  * @param Framing The format for sending BIS Data PDUs.
3887  *        Values:
3888  *        - 0x00: Unframed
3889  *        - 0x01: Framed
3890  * @param BN The number of new payloads in each interval for each BIS.
3891  *        Values:
3892  *        - 0x01 ... 0x07
3893  * @param IRC The number of times the scheduled payload(s) are transmitted in a
3894  *        given event.
3895  *        Values:
3896  *        - 0x01 ... 0x0F
3897  * @param PTO Offset used for pre-transmissions.
3898  *        Values:
3899  *        - 0x00 ... 0x0F
3900  * @param Encryption The encryption mode of the BISes.
3901  *        Values:
3902  *        - 0x00: Unencrypted
3903  *        - 0x01: Encrypted
3904  * @param Broadcast_Code 128-bit code used for deriving the session key for
3905  *        decrypting payloads of BISes in the BIG.
3906  * @retval Value indicating success or error code.
3907  */
3908 tBleStatus hci_le_create_big_test(uint8_t BIG_Handle,
3909                                   uint8_t Advertising_Handle,
3910                                   uint8_t Num_BIS,
3911                                   uint8_t SDU_Interval[3],
3912                                   uint16_t ISO_Interval,
3913                                   uint8_t NSE,
3914                                   uint16_t Max_SDU,
3915                                   uint16_t Max_PDU,
3916                                   uint8_t PHY,
3917                                   uint8_t Packing,
3918                                   uint8_t Framing,
3919                                   uint8_t BN,
3920                                   uint8_t IRC,
3921                                   uint8_t PTO,
3922                                   uint8_t Encryption,
3923                                   uint8_t Broadcast_Code[16]);
3924 /**
3925  * @brief The HCI_LE_Terminate_BIG command is used to terminate a BIG identified
3926  *        by the BIG_Handle parameter. The command also terminates the
3927  *        transmission of all BISes of the BIG, destroys the associated
3928  *        connection handles of the BISes in the BIG and removes the data paths
3929  *        for all BISes in the BIG.
3930  * @param BIG_Handle Used to identify the BIG.
3931  *        Values:
3932  *        - 0x00 ... 0xEF
3933  * @param Reason Reason for disconnection. See Error Codes.
3934  * @retval Value indicating success or error code.
3935  */
3936 tBleStatus hci_le_terminate_big(uint8_t BIG_Handle,
3937                                 uint8_t Reason);
3938 /**
3939  * @brief The HCI_LE_BIG_Create_Sync command is used to synchronize to a BIG
3940  *        described in the periodic advertising train specified by the
3941  *        Sync_Handle parameter.
3942  * @param BIG_Handle Used to identify the BIG.
3943  *        Values:
3944  *        - 0x00 ... 0xEF
3945  * @param Sync_Handle Identifier of the periodic advertising train.
3946  *        Values:
3947  *        - 0x0000 ... 0x00EF
3948  * @param Encryption The encryption mode of the BIG.
3949  *        Values:
3950  *        - 0x00: Unencrypted
3951  *        - 0x01: Encrypted
3952  * @param Broadcast_Code 128-bit code used for deriving the session key for
3953  *        decrypting payloads of BISes in the BIG.
3954  * @param MSE The MSE (Maximum Subevents) parameter is the maximum number of
3955  *        subevents that a Controller should use to receive data payloads in
3956  *        each interval for a BIS. The Host should set MSE to reduce the maximum
3957  *        continuous radio receiving time for a Synchronized Receiver with
3958  *        limited battery capacity.
3959  *        Values:
3960  *        - 0x00: Any number of subevents
3961  *        - 0x01 ... 0x1F
3962  * @param BIG_Sync_Timeout The BIG_Sync_Timeout parameter specifies the maximum
3963  *        permitted time between successful receptions of BIS PDUs. If this time
3964  *        is exceeded, synchronization is lost. When the Controller establishes
3965  *        synchronization and if the BIG_Sync_Timeout set by the Host is less
3966  *        than 6 * ISO_Interval, the Controller shall set the timeout to 6 *
3967  *        ISO_Interval.
3968  *        Values:
3969  *        - 0x000A (100 ms)  ... 0x4000 (163840 ms)
3970  * @param Num_BIS Total number of BISes to synchronize.
3971  *        Values:
3972  *        - 0x01 ... 0x1F
3973  * @param BIS List of indices of BISes.
3974  * @retval Value indicating success or error code.
3975  */
3976 tBleStatus hci_le_big_create_sync(uint8_t BIG_Handle,
3977                                   uint16_t Sync_Handle,
3978                                   uint8_t Encryption,
3979                                   uint8_t Broadcast_Code[16],
3980                                   uint8_t MSE,
3981                                   uint16_t BIG_Sync_Timeout,
3982                                   uint8_t Num_BIS,
3983                                   uint8_t BIS[]);
3984 /**
3985  * @brief The HCI_LE_BIG_Terminate_Sync command is used to stop synchronizing or
3986  *        cancel the process of synchronizing to the BIG identified by the
3987  *        BIG_Handle parameter. The command also terminates the reception of
3988  *        BISes in the BIG specified in the HCI_LE_BIG_Create_Sync command,
3989  *        destroys the associated connection handles of the BISes in the BIG and
3990  *        removes the data paths for all BISes in the BIG.
3991  * @param BIG_Handle Used to identify the BIG.
3992  *        Values:
3993  *        - 0x00 ... 0xEF
3994  * @retval Value indicating success or error code.
3995  */
3996 tBleStatus hci_le_big_terminate_sync(uint8_t BIG_Handle);
3997 /**
3998  * @brief This command is used to read the Sleep Clock Accuracy (SCA) of the
3999  *        peer device. The Connection_Handle parameter is the connection handle
4000  *        of the ACL connection. If the Host sends this command with a
4001  *        Connection_Handle that does not exist, or the Connection_Handle is not
4002  *        for an ACL the Controller shall return the error code Unknown
4003  *        Connection Identifier (0x02). If the Host sends this command and the
4004  *        peer device does not support the Sleep Clock Accuracy Updates feature,
4005  *        the Controller shall return the error code Unsupported Feature or
4006  *        Parameter Value (0x11) in the  HCI_LE_Request_Peer_SCA_Complete event.
4007  *        If the Host issues this command when the Controller is aware (e.g.,
4008  *        through a previous feature exchange) that the peer device's Link Layer
4009  *        does not support the Sleep Clock Accuracy Updates feature, the
4010  *        Controller shall return the error code Unsupported Remote Feature
4011  *        (0x1A). When the HCI_LE_Request_Peer_SCA command has completed, the
4012  *        HCI_LE_Request_Peer_SCA_Complete event shall be generated.
4013  * @param Connection_Handle Connection handle of the ACL.
4014  *        Values:
4015  *        - 0x0000 ... 0x0EFF
4016  * @retval Value indicating success or error code.
4017  */
4018 tBleStatus hci_le_request_peer_sca(uint16_t Connection_Handle);
4019 /**
4020  * @brief The HCI_LE_Setup_ISO_Data_Path command is used to identify and create
4021  *        the isochronous data path between the Host and the Controller for an
4022  *        established CIS or BIS identified by the Connection_Handle parameter.
4023  *        This command can also be used to configure a codec for each data path.
4024  * @param Connection_Handle Connection handle of the CIS or BIS.
4025  *        Values:
4026  *        - 0x0000 ... 0x0EFF
4027  * @param Data_Path_Direction The Data_Path_Direction parameter specifies the
4028  *        direction for which the data path is being configured. The input and
4029  *        output directions are defined from the perspective of the Controller,
4030  *        so "input" refers to data flowing from the Host to the Controller.
4031  *        Values:
4032  *        - 0x00: Input
4033  *        - 0x01: Output
4034  * @param Data_Path_ID The Data_Path_ID parameter specifies the data transport
4035  *        path used. When set to 0x00, the data path shall be over the HCI
4036  *        transport. When set to 0xFF the path shall be disabled. When set to a
4037  *        value in the range 0x01 to 0xFE, the data path shall use a vendor-
4038  *        specific transport interface (e.g., a PCM interface) with logical
4039  *        transport numbers. The meanings of these logical transport numbers are
4040  *        vendor-specific.
4041  *        Values:
4042  *        - 0x00: HCI
4043  *        - 0x01 ... 0xFE
4044  *        - 0xFF: Disabled
4045  * @param Codec_ID The Codec_ID parameter specifies the coding format used over
4046  *        the air. Octet 0: See Assigned Numbers for Coding Format. Octets 1 to
4047  *        2: Company ID, see Assigned Numbers for Company Identifier. Shall be
4048  *        ignored if octet 0 is not 0xFF. Octets 3 to 4: Vendor-defined codec
4049  *        ID. Shall be ignored if octet 0 is not 0xFF.
4050  * @param Controller_Delay Controller delay in microseconds. When
4051  *        Data_Path_Direction is set to 0x00 (input), the Controller_Delay
4052  *        parameter specifies the delay at the data source from the reference
4053  *        time of an SDU to the CIG reference point (see Bluetooth Core v5.2
4054  *        [Vol 6] Part B, Section 4.5.14.1) or BIG anchor point (see Core v5.2
4055  *        [Vol 6] Part B, Section 4.4.6.4). When Data_Path_Direction is set to
4056  *        0x01 (output), Controller_Delay specifies the delay from the CIG
4057  *        synchronization point or BIG synchronization point to the point in
4058  *        time at which the Controller begins to transfer the corresponding data
4059  *        to the data path interface.
4060  *        Values:
4061  *        - 0x000000 ... 0x3D0900
4062  * @param Codec_Configuration_Length Length of codec configuration.
4063  * @param Codec_Configuration The Codec_Configuration parameter specifies codec-
4064  *        specific configuration information for the specified direction.
4065  * @retval Value indicating success or error code.
4066  */
4067 tBleStatus hci_le_setup_iso_data_path(uint16_t Connection_Handle,
4068                                       uint8_t Data_Path_Direction,
4069                                       uint8_t Data_Path_ID,
4070                                       uint8_t Codec_ID[5],
4071                                       uint8_t Controller_Delay[3],
4072                                       uint8_t Codec_Configuration_Length,
4073                                       uint8_t Codec_Configuration[]);
4074 /**
4075  * @brief The HCI_LE_Remove_ISO_Data_Path command is used to remove the input
4076  *        and/or output data path(s) associated with a CIS or BIS identified by
4077  *        the Connection_Handle parameter.
4078  * @param Connection_Handle Connection handle of the CIS or BIS.
4079  *        Values:
4080  *        - 0x0000 ... 0x0EFF
4081  * @param Data_Path_Direction The Data_Path_Direction parameter specifies which
4082  *        directions are to have the data path removed.
4083  *        Flags:
4084  *        - 0x01: Input
4085  *        - 0x02: Output
4086  * @retval Value indicating success or error code.
4087  */
4088 tBleStatus hci_le_remove_iso_data_path(uint16_t Connection_Handle,
4089                                        uint8_t Data_Path_Direction);
4090 /**
4091  * @brief The HCI_LE_ISO_Transmit_Test command should only be used in the ISO
4092  *        Test mode and only for testing purposes. The command is used to
4093  *        configure an established CIS or BIS specified by the Connection_Handle
4094  *        parameter, and transmit test payloads which are generated by the
4095  *        Controller. When using this command for a CIS, the Host shall set up a
4096  *        CIG before invoking this command. When using this command for a BIS,
4097  *        the Host shall create the BIG before invoking this command. This
4098  *        command applies to all BISes in the BIG.
4099  * @param Connection_Handle Connection handle of the CIS or BIS.
4100  *        Values:
4101  *        - 0x0000 ... 0x0EFF
4102  * @param Payload_Type The Payload_Type parameter defines the configuration of
4103  *        SDUs in the payload.
4104  *        Values:
4105  *        - 0x00: ZERO_LENGTH_PAYLOAD
4106  *        - 0x01: VARIABLE_LENGTH_PAYLOAD
4107  *        - 0x02: MAXIMUM_LENGTH_PAYLOAD
4108  * @retval Value indicating success or error code.
4109  */
4110 tBleStatus hci_le_iso_transmit_test(uint16_t Connection_Handle,
4111                                     uint8_t Payload_Type);
4112 /**
4113  * @brief The HCI_LE_ISO_Receive_Test command should only be used in the ISO
4114  *        Test mode and only for testing purposes. The command is used to
4115  *        configure an established CIS or a synchronized BIG specified by the
4116  *        Connection_Handle parameter to receive payloads. When using this
4117  *        command for a BIS, the Host shall synchronize with a BIG using the
4118  *        HCI_LE_BIG_Create_Sync command before invoking this command.
4119  * @param Connection_Handle Connection handle of the CIS or BIS.
4120  *        Values:
4121  *        - 0x0000 ... 0x0EFF
4122  * @param Payload_Type The Payload_Type parameter defines the configuration of
4123  *        SDUs in the payload.
4124  *        Values:
4125  *        - 0x00: ZERO_LENGTH_PAYLOAD
4126  *        - 0x01: VARIABLE_LENGTH_PAYLOAD
4127  *        - 0x02: MAXIMUM_LENGTH_PAYLOAD
4128  * @retval Value indicating success or error code.
4129  */
4130 tBleStatus hci_le_iso_receive_test(uint16_t Connection_Handle,
4131                                    uint8_t Payload_Type);
4132 /**
4133  * @brief The HCI_LE_ISO_Read_Test_Counters command should only be used in the
4134  *        ISO Test mode and only for testing purposes. The command is used to
4135  *        read the test counters (see Core 5.2 [Vol 6] Part B, Section 7) in the
4136  *        Controller which is configured in ISO Receive Test mode for a CIS or
4137  *        BIS specified by the Connection_Handle. Reading the test counters does
4138  *        not reset the test counters.
4139  * @param Connection_Handle Connection handle of the CIS or BIS.
4140  *        Values:
4141  *        - 0x0000 ... 0x0EFF
4142  * @param[out] Received_Packet_Count Number in the Received_Packet_Count.
4143  * @param[out] Missed_Packet_Count Number in the Missed_Packet_Count.
4144  * @param[out] Failed_Packet_Count Number in the Failed_Packet_Count.
4145  * @retval Value indicating success or error code.
4146  */
4147 tBleStatus hci_le_iso_read_test_counters(uint16_t Connection_Handle,
4148                                          uint32_t *Received_Packet_Count,
4149                                          uint32_t *Missed_Packet_Count,
4150                                          uint32_t *Failed_Packet_Count);
4151 /**
4152  * @brief The HCI_LE_ISO_Test_End command should only be used in the ISO Test
4153  *        mode and only for testing purposes. The command is used to terminate
4154  *        the ISO Transmit and/or Receive Test mode for a CIS or BIS specified
4155  *        by the Connection_Handle parameter but does not terminate the CIS or
4156  *        BIS. When the Host terminates the ISO Test mode for a CIS or BIS that
4157  *        is set to ISO Transmit Test mode only, the test counters in the return
4158  *        parameters shall be set to zero. When the Host terminates the ISO Test
4159  *        mode for a CIS or BIS that is set to the ISO Receive Test mode, the
4160  *        return parameters contain the values of the test counters as defined
4161  *        in [Vol 6] Part B, Section 7.
4162  * @param Connection_Handle Connection handle of the CIS or BIS.
4163  *        Values:
4164  *        - 0x0000 ... 0x0EFF
4165  * @param[out] Received_Packet_Count Number in the Received_Packet_Count.
4166  * @param[out] Missed_Packet_Count Number in the Missed_Packet_Count.
4167  * @param[out] Failed_Packet_Count Number in the Failed_Packet_Count.
4168  * @retval Value indicating success or error code.
4169  */
4170 tBleStatus hci_le_iso_test_end(uint16_t Connection_Handle,
4171                                uint32_t *Received_Packet_Count,
4172                                uint32_t *Missed_Packet_Count,
4173                                uint32_t *Failed_Packet_Count);
4174 /**
4175  * @brief The HCI_LE_Set_Host_Feature command is used by the Host to set or
4176  *        clear a bit controlled by the Host in the Link Layer FeatureSet stored
4177  *        in the Controller (see [Vol 6] Part B, Section 4.6). The Bit_Number
4178  *        parameter specifies the bit position in the FeatureSet. The Bit_Value
4179  *        parameter specifies whether the feature is enabled or disabled. If
4180  *        Bit_Number specifies a feature bit that is not controlled by the Host,
4181  *        the Controller shall return the error code Unsupported Feature or
4182  *        Parameter Value (0x11). If Bit_Value is set to 0x01 and Bit_Number
4183  *        specifies a feature bit that requires support of a feature that the
4184  *        Controller does not support, the Controller shall return the error
4185  *        code Unsupported Feature or Parameter Value (0x11). If the Host issues
4186  *        this command while the Controller has a connection to another device,
4187  *        the Controller shall return the error code Command Disallowed (0x0C).
4188  * @param Bit_Number Bit position in the FeatureSet.
4189  *        Values:
4190  *        - 0x00 ... 0x3F
4191  * @param Bit_Value If 0, the Host feature is disabled, if 1 the Host feature is
4192  *        enablded.
4193  *        Values:
4194  *        - 0x00: DISABLED
4195  *        - 0x01: ENABLED
4196  * @retval Value indicating success or error code.
4197  */
4198 tBleStatus hci_le_set_host_feature(uint8_t Bit_Number,
4199                                    uint8_t Bit_Value);
4200 /**
4201  * @brief This command returns the values of various counters related to link
4202  *        quality that are associated with the isochronous stream specified by
4203  *        the Connection_Handle parameter. This command may be issued on both
4204  *        the central and peripheral if the connection handle identifies a CIS
4205  *        and on the Synchronized Receiver if the connection handle identifies a
4206  *        BIS.
4207  * @param Connection_Handle Connection handle of the CIS or BIS.
4208  *        Values:
4209  *        - 0x0000 ... 0x0EFF
4210  * @param[out] Tx_UnACKed_Packets Value of the Tx_UnACKed_Packets counter.
4211  *             Incremented when the Link Layer does not receive an
4212  *             acknowledgment for a CIS Data PDU that it transmitted at least
4213  *             once by its flush point (see Core 5.2 [Vol 6] Part B, Section
4214  *             4.5.13.5).
4215  * @param[out] Tx_Flushed_Packets Value of the Tx_Flushed_Packets counter.
4216  *             Incremented when the Link Layer does not transmit a specific
4217  *             payload by its flush point.
4218  * @param[out] Tx_Last_Subevent_Packets Value of the Tx_Last_Subevent_Packets
4219  *             counter. Incremented when the Link Layer transmits a CIS Data PDU
4220  *             in the last subevent of a CIS event.
4221  * @param[out] Retransmitted_Packets Value of the Retransmitted_Packets counter.
4222  *             Incremented when the Link Layer retransmits a CIS Data PDU.
4223  * @param[out] CRC_Error_Packets Value of the CRC_Error_Packets counter.
4224  *             Incremented when the Link Layer receives a packet with a CRC
4225  *             error.
4226  * @param[out] Rx_Unreceived_Packets Value of the Rx_Unreceived_Packets counter.
4227  *             Incremented when the Link Layer does not receive a specific
4228  *             payload by its flush point (on a CIS) or the end of the event it
4229  *             is associated with (on a BIS; see Core v5.2 [Vol 6] Part B,
4230  *             Section 4.4.6.6).
4231  * @param[out] Duplicate_Packets Value of the Duplicate_Packets counter.
4232  *             Incremented when the Link Layer receives a retransmission of a
4233  *             CIS Data PDU.
4234  * @retval Value indicating success or error code.
4235  */
4236 tBleStatus hci_le_read_iso_link_quality(uint16_t Connection_Handle,
4237                                         uint32_t *Tx_UnACKed_Packets,
4238                                         uint32_t *Tx_Flushed_Packets,
4239                                         uint32_t *Tx_Last_Subevent_Packets,
4240                                         uint32_t *Retransmitted_Packets,
4241                                         uint32_t *CRC_Error_Packets,
4242                                         uint32_t *Rx_Unreceived_Packets,
4243                                         uint32_t *Duplicate_Packets);
4244 /**
4245  * @brief Read the current and maximum transmit power levels of the local
4246  *        Controller on the ACL connection identified by the Connection_Handle
4247  *        parameter and the PHY indicated by the PHY parameter.
4248  * @param Connection_Handle Connection handle that identifies the connection.
4249  *        Values:
4250  *        - 0x0000 ... 0x0EFF
4251  * @param PHY PHY associated with the connection  (not necessarily the currently
4252  *        used one).
4253  *        Values:
4254  *        - 0x01: LE_1M_PHY
4255  *        - 0x02: LE_2M_PHY
4256  *        - 0x03: LE_CODED_PHY_S8
4257  *        - 0x04: LE_CODED_PHY_S2
4258  * @param[out] Current_Transmit_Power_Level Current TX power level (dBm).
4259  *             Values:
4260  *             - -127 ... 20
4261  *             - 127: NA
4262  * @param[out] Max_Transmit_Power_Level Maximum TX power level (dBm).
4263  *             Values:
4264  *             - -127 ... 20
4265  * @retval Value indicating success or error code.
4266  */
4267 tBleStatus hci_le_enhanced_read_transmit_power_level(uint16_t Connection_Handle,
4268                                                      uint8_t PHY,
4269                                                      int8_t *Current_Transmit_Power_Level,
4270                                                      int8_t *Max_Transmit_Power_Level);
4271 /**
4272  * @brief Read the transmit power level used by the remote Controller on the ACL
4273  *        connection that is identified by the Connection_Handle parameter and
4274  *        the PHY indicated by the PHY parameter. Initiate a Power Control
4275  *        Request procedure to obtain the remote transmit power level if no
4276  *        prior value is available or used.
4277  * @param Connection_Handle Connection handle that identifies the connection.
4278  *        Values:
4279  *        - 0x0000 ... 0x0EFF
4280  * @param PHY PHY associated with the connection  (not necessarily the currently
4281  *        used one).
4282  *        Values:
4283  *        - 0x01: LE_1M_PHY
4284  *        - 0x02: LE_2M_PHY
4285  *        - 0x03: LE_CODED_PHY_S8
4286  *        - 0x04: LE_CODED_PHY_S2
4287  * @retval Value indicating success or error code.
4288  */
4289 tBleStatus hci_le_read_remote_transmit_power_level(uint16_t Connection_Handle,
4290                                                    uint8_t PHY);
4291 /**
4292  * @brief Set the path loss threshold reporting parameters for the ACL
4293  *        connection identified by the Connection_Handle parameter.
4294  * @param Connection_Handle Connection handle that identifies the connection.
4295  *        Values:
4296  *        - 0x0000 ... 0x0EFF
4297  * @param High_Threshold High threshold for the path loss. Units: dB.
4298  *        Values:
4299  *        - 0 ... 254
4300  *        - 255: UNUSED
4301  * @param High_Hysteresis Hysteresis value for the high threshold. Units: dB.
4302  * @param Low_Threshold Low threshold for the path loss. Units: dB.
4303  * @param Low_Hysteresis Hysteresis value for the low threshold. Units: dB.
4304  * @param Min_Time_Spent Minimum time in number of connection events to be
4305  *        observed once the path crosses the threshold before an event is
4306  *        generated.
4307  * @retval Value indicating success or error code.
4308  */
4309 tBleStatus hci_le_set_path_loss_reporting_parameters(uint16_t Connection_Handle,
4310                                                      uint8_t High_Threshold,
4311                                                      uint8_t High_Hysteresis,
4312                                                      uint8_t Low_Threshold,
4313                                                      uint8_t Low_Hysteresis,
4314                                                      uint16_t Min_Time_Spent);
4315 /**
4316  * @brief Enable or disable path loss reporting for the ACL connection
4317  *        identified by the Connection_Handle parameter. Initiate a new Power
4318  *        Control Request procedure to obtain the remote transmit power level if
4319  *        no prior value is available or used and no prior Power Control Request
4320  *        procedure has been initiated. Path loss reporting is disabled when the
4321  *        connection is first created.
4322  * @param Connection_Handle Connection handle that identifies the connection.
4323  *        Values:
4324  *        - 0x0000 ... 0x0EFF
4325  * @param Enable Enable (1) or disable (0) reportinig.
4326  *        Values:
4327  *        - 0x00: DISABLE
4328  *        - 0x01: ENABLE
4329  * @retval Value indicating success or error code.
4330  */
4331 tBleStatus hci_le_set_path_loss_reporting_enable(uint16_t Connection_Handle,
4332                                                  uint8_t Enable);
4333 /**
4334  * @brief Enable or disable the reporting of transmit power level changes in the
4335  *        local and remote Controllers for the ACL connection identified by the
4336  *        Connection_Handle parameter. Initiate a new Power Control Request
4337  *        procedure to obtain the remote transmit power level if Remote_Enable
4338  *        is 0x01, and no prior value is available or used, and no prior Power
4339  *        Control Request procedure has been initiated.
4340  * @param Connection_Handle Connection handle that identifies the connection.
4341  *        Values:
4342  *        - 0x0000 ... 0x0EFF
4343  * @param Local_Enable Enable (1) or disable (0) local transmit power reports.
4344  *        Values:
4345  *        - 0x00: DISABLE
4346  *        - 0x01: ENABLE
4347  * @param Remote_Enable Enable (1) or disable (0) remote transmit power reports.
4348  *        Values:
4349  *        - 0x00: DISABLE
4350  *        - 0x01: ENABLE
4351  * @retval Value indicating success or error code.
4352  */
4353 tBleStatus hci_le_set_transmit_power_reporting_enable(uint16_t Connection_Handle,
4354                                                       uint8_t Local_Enable,
4355                                                       uint8_t Remote_Enable);
4356 /**
4357  * @brief The HCI_LE_Set_Data_Related_Address_Changes command specifies
4358  *        circumstances when the Controller shall refresh any Resolvable Private
4359  *        Address used by the advertising set identified by the
4360  *        Advertising_Handle parameter, whether or not the address timeout
4361  *        period has been reached. This command may be used while advertising is
4362  *        enabled. The Change_Reasons parameter specifies the reason(s) for
4363  *        refreshing addresses. The default when an advertising set is created,
4364  *        or if legacy advertising commands (see Section 3.1.1) are used, is for
4365  *        all bits to be clear. If extended advertising commands (see Section
4366  *        3.1.1) are being used and the advertising set corresponding to the
4367  *        Advertising_Handle parameter does not exist, or if no command
4368  *        specified in Table 3.2 has been used, then the Controller shall return
4369  *        the error code Unknown Advertising Identifier (0x42). If legacy
4370  *        advertising commands are being used, the Controller shall ignore the
4371  *        Advertising_Handle parameter.
4372  * @param Advertising_Handle Used to identify an advertising set.
4373  *        Values:
4374  *        - 0x00 ... 0xEF
4375  * @param Change_Reasons Bitmap associated with the reasons to refresh the
4376  *        Resolvable Private Addresses used by the advertising set. If bit 0 is
4377  *        set, change the address whenever the advertising data changes. If bit
4378  *        1 is set, change the address whenever the scan response data changes.
4379  *        Flags:
4380  *        - 0x01: ADV_DATA_CHANGES
4381  *        - 0x02: SCAN_RESP_DATA_CHANGES
4382  * @retval Value indicating success or error code.
4383  */
4384 tBleStatus hci_le_set_data_related_address_changes(uint8_t Advertising_Handle,
4385                                                    uint8_t Change_Reasons);
4386 /**
4387  * @brief The HCI_LE_Set_Default_Subrate command is used by the Host to set the
4388  *        initial values for the acceptable parameters for subrating requests,
4389  *        as defined by the HCI_LE Subrate_Request command, for all future ACL
4390  *        connections where the Controller is the Central. This command does not
4391  *        affect any existing connection. The parameters have the same meanings
4392  *        and restrictions as those in the HCI_LE_Subrate_Request command.
4393  * @param Subrate_Min Minimum subrate factor allowed in requests by a
4394  *        Peripheral.
4395  *        Values:
4396  *        - 0x0001 ... 0x01F4
4397  * @param Subrate_Max Maximum subrate factor allowed in requests by a
4398  *        Peripheral.
4399  *        Values:
4400  *        - 0x0001 ... 0x01F4
4401  * @param Max_Latency Maximum Peripheral latency allowed in requests by a
4402  *        Peripheral, in units of subrated connection intervals.
4403  *        Values:
4404  *        - 0x0000 ... 0x01F3
4405  * @param Continuation_Number Minimum number of underlying connection events to
4406  *        remain active after a packet containing a Link Layer PDU with a non-
4407  *        zero Length field is sent or received in requests by a Peripheral.
4408  *        Values:
4409  *        - 0x0000 ... 0x01F3
4410  * @param Supervision_Timeout Maximum supervision timeout allowed in requests by
4411  *        a Peripheral. Time = N x 10 ms.
4412  *        Values:
4413  *        - 0x000A (100 ms)  ... 0x0C80 (32000 ms)
4414  * @retval Value indicating success or error code.
4415  */
4416 tBleStatus hci_le_set_default_subrate(uint16_t Subrate_Min,
4417                                       uint16_t Subrate_Max,
4418                                       uint16_t Max_Latency,
4419                                       uint16_t Continuation_Number,
4420                                       uint16_t Supervision_Timeout);
4421 /**
4422  * @brief The HCI_LE_Subrate_Request command is used by a Central or a
4423  *        Peripheral to request a change to the subrating factor and/or other
4424  *        parameters (see Core Vol 6 Part B, Section 4.5.1) applied to an
4425  *        existing connection using the Connection Subrate Update procedure. The
4426  *        Subrate_Min and Subrate_Max parameters specify the range of acceptable
4427  *        subrating factors being requested. The Max_Latency parameter specifies
4428  *        the maximum Peripheral latency in units of subrated connection events.
4429  *        The same maximum shall apply irrespective of the subrating factor
4430  *        actually chosen. The Continuation_Number parameter specifies the
4431  *        number of underlying connection intervals to remain active after a
4432  *        packet (other than an empty packet) is transmitted or received. The
4433  *        Supervision_Timeout parameter specifies the link supervision timeout
4434  *        for the connection. The Supervision_Timeout, in milliseconds, shall be
4435  *        greater than 2 x current connection interval x Subrate_Max x
4436  *        (Max_Latency + 1). If this command is issued on the Central, the
4437  *        following rules shall apply when the Controller initiates the
4438  *        Connection Subrate Update procedure (see Core Vol 6 Part B, Section
4439  *        5.1.19): * The Peripheral latency shall be less than or equal to
4440  *        Max_Latency. * The subrate factor shall be between Subrate_Min and
4441  *        Subrate_Max. * The continuation number shall be equal to the lesser of
4442  *        Continuation_- Number and (subrate factor - 1). * The connection
4443  *        supervision timeout shall be equal to Supervision_Timeout. If this
4444  *        command is issued on the Central, it also sets the acceptable
4445  *        parameters for requests from the Peripheral (see Core Vol 6 Part B,
4446  *        Section 5.1.20). The acceptable parameters set by this command
4447  *        override those provided via the HCI_LE_Set_Default_Subrate command or
4448  *        any values set by previous uses of this command on the same
4449  *        connection.  If this command is issued on the Peripheral, the
4450  *        following rules shall apply when the Controller initiates the
4451  *        Connection Subrate Request procedure: * The Peripheral latency shall
4452  *        be less than or equal to Max_Latency. * The minimum and maximum
4453  *        subrate factors shall be between Subrate_Min and Subrate_Max. * The
4454  *        continuation number shall be equal to the lesser of
4455  *        Continuation_Number and (maximum subrate factor - 1). * The connection
4456  *        supervision timeout shall be equal to Supervision_Timeout. If the
4457  *        Connection_Handle parameter does not identify a current ACL
4458  *        connection, the Controller shall return the error code Unknown
4459  *        Connection Identifier (0x02). If the Host issues this command with
4460  *        parameters such that Subrate_Max x (Max_Latency + 1) is greater than
4461  *        500 or the current connection interval x Subrate_ Max x (Max_Latency +
4462  *        1) is greater than or equal to half the Supervision_ Timeout
4463  *        parameter, the Controller shall return the error code Invalid HCI
4464  *        Command Parameters (0x12). If the Host issues this command with
4465  *        Subrate_Max less than Subrate_Min, the Controller shall return the
4466  *        error code Invalid HCI Command Parameters (0x12). If the Host issues
4467  *        this command with Continuation_Number greater than or equal to
4468  *        Subrate_Max, then the Controller shall return the error code Invalid
4469  *        HCI Command Parameters (0x12). If the Central's Host issues this
4470  *        command when the Connection Subrating (Host Support) bit is not set in
4471  *        the Peripheral's FeatureSet, the Controller shall return the error
4472  *        code Unsupported Remote Feature (0x1A).
4473  * @param Connection_Handle Connection handle of the ACL.
4474  *        Values:
4475  *        - 0x0000 ... 0x0EFF
4476  * @param Subrate_Min Minimum subrate factor to be applied to the underlying
4477  *        connection interval.
4478  *        Values:
4479  *        - 0x0001 ... 0x01F4
4480  * @param Subrate_Max Maximum subrate factor to be applied to the underlying
4481  *        connection interval.
4482  *        Values:
4483  *        - 0x0001 ... 0x01F4
4484  * @param Max_Latency Maximum Peripheral latency for the connection in units of
4485  *        subrated connection intervals.
4486  *        Values:
4487  *        - 0x0000 ... 0x01F3
4488  * @param Continuation_Number Minimum number of underlying connection events to
4489  *        remain active after a packet containing a Link Layer PDU with a non-
4490  *        zero Length field is sent or received.
4491  *        Values:
4492  *        - 0x0000 ... 0x01F3
4493  * @param Supervision_Timeout Supervision timeout for this connection. Time = N
4494  *        x 10 ms.
4495  *        Values:
4496  *        - 0x000A (100 ms)  ... 0x0C80 (32000 ms)
4497  * @retval Value indicating success or error code.
4498  */
4499 tBleStatus hci_le_subrate_request(uint16_t Connection_Handle,
4500                                   uint16_t Subrate_Min,
4501                                   uint16_t Subrate_Max,
4502                                   uint16_t Max_Latency,
4503                                   uint16_t Continuation_Number,
4504                                   uint16_t Supervision_Timeout);
4505 /**
4506  * @brief The LE_Set_Extended_Advertising_Parameters command is used by the Host
4507  *        to set the advertising parameters. The Advertising_Handle parameter
4508  *        identifies the advertising set whose parameters are being configured.
4509  *        The Advertising_Event_Properties parameter describes the type of
4510  *        advertising event that is being configured and its basic properties.
4511  *        The type shall be one supported by the Controller.
4512  * @param Advertising_Handle The Advertising_Handle parameter identifies the
4513  *        advertising set whose parameters are being configured.
4514  *        Values:
4515  *        - 0x00 ... 0xEF
4516  * @param Advertising_Event_Properties The Advertising_Event_Properties
4517  *        parameter describes the type of advertising event that is being
4518  *        configured and its basic properties. The type shall be one supported
4519  *        by the Controller. Bits: 0 Connectable advertising 1 Scannable
4520  *        advertising 2 Directed advertising 3 High Duty Cycle Directed
4521  *        Connectable advertising (<= 3.75 ms Advertising Interval) 4 Use legacy
4522  *        advertising PDUs 5 Omit advertiser's address from all PDUs ("anonymous
4523  *        advertising") 6 Include TxPower in the extended header of the
4524  *        advertising PDU
4525  *        Flags:
4526  *        - 0x0001: Connectable
4527  *        - 0x0002: Scannable
4528  *        - 0x0004: Directed
4529  *        - 0x0008: HDC Directed Connectable
4530  *        - 0x0010: Legacy
4531  *        - 0x0020: Anonymous
4532  *        - 0x0040: TxPower in ext header
4533  * @param Primary_Advertising_Interval_Min Minimum advertising interval for
4534  *        undirected and low duty cycle directed advertising. Time = N * 0.625
4535  *        ms; Time Range: 20 ms to 10,485.759375 s.
4536  *        Values:
4537  *        - 0x000020 (20.000 ms)  ... 0xFFFFFF (10485759.375 ms)
4538  * @param Primary_Advertising_Interval_Max Maximum advertising interval for
4539  *        undirected and low duty cycle directed advertising. Time = N * 0.625
4540  *        ms; Time Range: 20 ms to 10,485.759375 s.
4541  *        Values:
4542  *        - 0x000020 (20.000 ms)  ... 0xFFFFFF (10485759.375 ms)
4543  * @param Primary_Advertising_Channel_Map The Primary_Advertising_Channel_Map is
4544  *        a bit field that indicates the advertising channels that shall be used
4545  *        when transmitting advertising packets. At least one channel bit shall
4546  *        be set in the Primary_Advertising_Channel_Map parameter.
4547  *        Flags:
4548  *        - 0x01: CH_37
4549  *        - 0x02: CH_38
4550  *        - 0x04: CH_39
4551  * @param Own_Address_Type The Own_Address_Type parameter specifies the type of
4552  *        address being used in the advertising packets. For random addresses,
4553  *        the address is specified by the LE_Set_Advertising_Set_Random_Address
4554  *        command.  0x00 Public Device Address 0x01 Random Device Address 0x02
4555  *        Controller generates the Resolvable Private Address based on the local
4556  *        IRK from the resolving list. If the resolving list contains no
4557  *        matching entry, use the public address. 0x03 Controller generates the
4558  *        Resolvable Private Address based on the local IRK from the resolving
4559  *        list. If the resolving list contains no matching entry, use the random
4560  *        address from LE_Set_Advertising_Set_Random_Address. All other values
4561  *        Reserved for future use
4562  *        Values:
4563  *        - 0x00: Public Device Address
4564  *        - 0x01: Random Device Address
4565  *        - 0x02: Resolvable Private Address / Public Address
4566  *        - 0x03: Resolvable Private Address / Random Address
4567  * @param Peer_Address_Type Peer Address type
4568  *        Values:
4569  *        - 0x00: Public Device Address or Public Identity Address
4570  *        - 0x01: Random Device Address or Random (static) Identity Address
4571  * @param Peer_Address Public Device Address, Random Device Address, Public
4572  *        Identity Address, or Random (static) Identity Address of the device to
4573  *        be connected.
4574  * @param Advertising_Filter_Policy Advertising Filter Policy. This parameter is
4575  *        ignored when directed advertising is enabled.  0x00 Process scan and
4576  *        connection requests from all devices (i.e., the Filter Accept List is
4577  *        not in use) 0x01 Process connection requests from all devices and scan
4578  *        requests only from devices that are in the Filter Accept List 0x02
4579  *        Process scan requests from all devices and connection requests only
4580  *        from devices that are in the Filter Accept List. 0x03 Process scan and
4581  *        connection requests only from devices in the Filter Accept List. All
4582  *        other values are reserved for future use
4583  *        Values:
4584  *        - 0x00: HCI_ADV_FILTER_NONE
4585  *        - 0x01: HCI_ADV_FILTER_ACCEPT_LIST_SCAN
4586  *        - 0x02: HCI_ADV_FILTER_ACCEPT_LIST_CONNECT
4587  *        - 0x03: HCI_ADV_FILTER_ACCEPT_LIST_SCAN_CONNECT
4588  * @param Advertising_Tx_Power Units: dBm  The Advertising_Tx_Power parameter
4589  *        indicates the maximum power level at which the advertising packets are
4590  *        to be transmitted on the advertising channels. The Controller shall
4591  *        choose a power level lower than or equal to the one specified by the
4592  *        Host.
4593  *        Values:
4594  *        - -127 ... 126
4595  *        - 127: No preference
4596  * @param Primary_Advertising_PHY The Primary_Advertising_PHY parameter
4597  *        indicates the PHY on which the advertising packets are transmitted on
4598  *        the primary advertising channel. If legacy advertising PDUs are being
4599  *        used, the Primary_Advertising_PHY shall indicate the LE 1M PHY.
4600  *        Values:
4601  *        - 0x01: LE_1M_PHY
4602  *        - 0x03: LE_CODED_PHY
4603  * @param Secondary_Advertising_Max_Skip The Secondary_Advertising_Max_Skip
4604  *        parameter is the maximum number of advertising events that can be
4605  *        skipped before the AUX_ADV_IND can be sent. 0x00 AUX_ADV_IND shall be
4606  *        sent prior to the next advertising event 0x01-0xFF Maximum advertising
4607  *        events the Controller can skip before sending the AUX_ADV_IND packets
4608  *        on the secondary advertising channel
4609  *        Values:
4610  *        - 0x00 ... 0xFF
4611  * @param Secondary_Advertising_PHY The Secondary_Advertising_PHY parameter
4612  *        indicates the PHY on which the advertising packets are transmitted on
4613  *        the secondary advertising channel.
4614  *        Values:
4615  *        - 0x01: LE_1M_PHY
4616  *        - 0x02: LE_2M_PHY
4617  *        - 0x03: LE_CODED_PHY
4618  * @param Advertising_SID The Advertising_SID parameter specifies the value to
4619  *        be transmitted in the Advertising SID subfield of the ADI field of the
4620  *        Extended Header of those advertising channel PDUs that have an ADI
4621  *        field. If the advertising set only uses PDUs that do not contain an
4622  *        ADI field, Advertising_SID is ignored.
4623  *        Values:
4624  *        - 0x00 ... 0x0F
4625  * @param Scan_Request_Notification_Enable The Scan_Request_Notification_Enable
4626  *        parameter indicates whether the Controller shall send notifications
4627  *        upon the receipt of a scan request PDU that is in response to an
4628  *        advertisement from the specified advertising set that contains its
4629  *        device address and is from a scanner that is allowed by the
4630  *        advertising filter policy.
4631  *        Values:
4632  *        - 0x00: Scan request notifications disabled
4633  *        - 0x01: Scan request notifications enabled
4634  * @param Primary_Advertising_PHY_Options Preference or requirements on coding
4635  *        scheme when transmitting on Primary Advertising Physical Channel.
4636  *        Values:
4637  *        - 0x00: CODED_PHY_NO_PREFERENCE
4638  *        - 0x01: CODED_PHY_S2_PREFERRED
4639  *        - 0x02: CODED_PHY_S8_PREFERRED
4640  *        - 0x03: CODED_PHY_S2_REQUIRED
4641  *        - 0x04: CODED_PHY_S8_REQUIRED
4642  * @param Secondary_Advertising_PHY_Options Preference or requirements on coding
4643  *        scheme when transmitting on Secondary Advertising Physical Channel.
4644  *        Values:
4645  *        - 0x00: CODED_PHY_NO_PREFERENCE
4646  *        - 0x01: CODED_PHY_S2_PREFERRED
4647  *        - 0x02: CODED_PHY_S8_PREFERRED
4648  *        - 0x03: CODED_PHY_S2_REQUIRED
4649  *        - 0x04: CODED_PHY_S8_REQUIRED
4650  * @param[out] Selected_Tx_Power Units: dBm. The Selected_Tx_Power return
4651  *             parameter indicates the transmit power selected by the
4652  *             Controller. The Controller shall not change the transmit power
4653  *             for this advertising set without being directed to by the Host.
4654  *             Values:
4655  *             - -127 ... 126
4656  * @retval Value indicating success or error code.
4657  */
4658 tBleStatus hci_le_set_extended_advertising_parameters_v2(uint8_t Advertising_Handle,
4659                                                          uint16_t Advertising_Event_Properties,
4660                                                          uint8_t Primary_Advertising_Interval_Min[3],
4661                                                          uint8_t Primary_Advertising_Interval_Max[3],
4662                                                          uint8_t Primary_Advertising_Channel_Map,
4663                                                          uint8_t Own_Address_Type,
4664                                                          uint8_t Peer_Address_Type,
4665                                                          uint8_t Peer_Address[6],
4666                                                          uint8_t Advertising_Filter_Policy,
4667                                                          int8_t Advertising_Tx_Power,
4668                                                          uint8_t Primary_Advertising_PHY,
4669                                                          uint8_t Secondary_Advertising_Max_Skip,
4670                                                          uint8_t Secondary_Advertising_PHY,
4671                                                          uint8_t Advertising_SID,
4672                                                          uint8_t Scan_Request_Notification_Enable,
4673                                                          uint8_t Primary_Advertising_PHY_Options,
4674                                                          uint8_t Secondary_Advertising_PHY_Options,
4675                                                          int8_t *Selected_Tx_Power);
4676 /**
4677  * @brief The HCI_LE_Set_Periodic_Sync_Subevent command is used to instruct the
4678  *        Controller to synchronize with a subset of the subevents within a PAwR
4679  *        train identified by the Sync_Handle parameter, listen for packets sent
4680  *        by the peer device and pass any received data up to the Host. If the
4681  *        Controller is synchronized with any subevents that are not in the
4682  *        subset of subevents in this command, then the Controller shall no
4683  *        longer synchronize with those subevents. The
4684  *        Periodic_Advertising_Properties parameter indicates which fields
4685  *        should be included in the AUX_SYNC_SUBEVENT_RSP PDUs. The
4686  *        Num_Subevents parameter identifies the number of values in the
4687  *        subevents parameter. The Subevents arrayed parameter identifies the
4688  *        subevents that the Controller shall synchronize with.
4689  * @param Sync_Handle Sync_Handle identifying the PAwR train.
4690  *        Values:
4691  *        - 0x0000 ... 0x0EFF
4692  * @param Periodic_Advertising_Properties If bit 6 is set, include TxPower in
4693  *        the advertising PDU.
4694  *        Flags:
4695  *        - 0x0040: TX_POWER
4696  * @param Num_Subevents Number of subevent data in the command.
4697  *        Values:
4698  *        - 0x01 ... 0x0F
4699  * @param Subevent The subevent to synchronize with.
4700  * @retval Value indicating success or error code.
4701  */
4702 tBleStatus hci_le_set_periodic_sync_subevent(uint16_t Sync_Handle,
4703                                              uint16_t Periodic_Advertising_Properties,
4704                                              uint8_t Num_Subevents,
4705                                              uint8_t Subevent[]);
4706 /**
4707  * @brief The LE_Extended_Create_Connection command is used to create a Link
4708  *        Layer connection to a connectable advertiser.
4709  *        LE_Extended_Create_Connection command can be used in place of
4710  *        LE_Create_Connection command.
4711  * @param Advertising_Handle Advertising_Handle identifying the periodic
4712  *        advertising train.
4713  *        Values:
4714  *        - 0x00 ... 0xEF
4715  *        - 0xFF: Not specified
4716  * @param Subevent Subevent where the connection request is to be sent.
4717  *        Values:
4718  *        - 0x00 ... 0x7F
4719  *        - 0xFF: Not specified
4720  * @param Initiator_Filter_Policy The Initiator_Filter_Policy parameter is used
4721  *        to determine whether the Filter Accept List is used. If the Filter
4722  *        Accept List is not used, the Peer_Address_Type and the Peer_Address
4723  *        parameters specify the address type and address of the advertising
4724  *        device to connect to. 0x00 - Filter Accept List is not used to
4725  *        determine which advertiser to connect to. Peer_Address_Type and
4726  *        Peer_Address shall be used. 0x01 - Filter Accept List is used to
4727  *        determine which advertiser to connect to. Peer_Address_Type and
4728  *        Peer_Address shall be ignored.
4729  *        Values:
4730  *        - 0x00: FILTER_ACCEPT_LIST_NOT_USED
4731  *        - 0x01: FILTER_ACCEPT_LIST_USED
4732  * @param Own_Address_Type The Own_Address_Type parameter indicates the type of
4733  *        address being used in the connection request packets.
4734  *        Values:
4735  *        - 0x00: Public Device Address
4736  *        - 0x01: Random Device Address
4737  *        - 0x02: Controller generates the Resolvable Private Address based on the local
4738 IRK from the resolving list. If the resolving list contains no matching
4739 entry, then use the public address.
4740  *        - 0x03: Controller generates the Resolvable Private Address based on the local
4741 IRK from the resolving list. If the resolving list contains no matching
4742 entry, then use the random address from the most recent successful
4743 LE_Set_Random_Address Command.
4744  * @param Peer_Address_Type The Peer_Address_Type parameter indicates the type
4745  *        of address used in the connectable advertisement sent by the peer.
4746  *        0x00: Public Device Address or Public Identity Address 0x01: Random
4747  *        Device Address or Random (static) Identity Address
4748  *        Values:
4749  *        - 0x00: Public Address
4750  *        - 0x01: Random Address
4751  * @param Peer_Address Public Device Address, Random Device Address, Public
4752  *        Identity Address, or Random (static) Identity Address of the device to
4753  *        be connected.
4754  * @param Initiating_PHYs The Initiating_PHYs parameter indicates the PHY(s) on
4755  *        which the advertising packets should be received on the primary
4756  *        advertising channel and the PHYs for which connection parameters have
4757  *        been specified. The Host may enable one or more initiating PHYs. 0x01:
4758  *        Scan connectable advertisements on the LE 1M PHY. Connection
4759  *        parameters for the LE 1M PHY are provided. 0x02: Connection parameters
4760  *        for the LE 2M PHY are provided 0x04: Scan connectable advertisements
4761  *        on the LE Coded PHY. Connection parameters for the LE Coded PHY are
4762  *        provided.
4763  *        Flags:
4764  *        - 0x01: LE_1M_PHY_BIT
4765  *        - 0x02: LE_2M_PHY_BIT
4766  *        - 0x04: LE_CODED_PHY_BIT
4767  * @param Extended_Create_Connection_Parameters See @ref
4768  *        Extended_Create_Connection_Parameters_t
4769  * @retval Value indicating success or error code.
4770  */
4771 tBleStatus hci_le_extended_create_connection_v2(uint8_t Advertising_Handle,
4772                                                 uint8_t Subevent,
4773                                                 uint8_t Initiator_Filter_Policy,
4774                                                 uint8_t Own_Address_Type,
4775                                                 uint8_t Peer_Address_Type,
4776                                                 uint8_t Peer_Address[6],
4777                                                 uint8_t Initiating_PHYs,
4778                                                 Extended_Create_Connection_Parameters_t Extended_Create_Connection_Parameters[]);
4779 /**
4780  * @brief The HCI_LE_Set_Periodic_Advertising_Parameters command is used by the
4781  *        Host to set the parameters for periodic advertising. The
4782  *        Advertising_Handle parameter identifies the advertising set whose
4783  *        periodic advertising parameters are being configured. If the
4784  *        corresponding advertising set does not already exist, then the
4785  *        Controller shall return the error code Unknown Advertising Identifier
4786  *        (0x42). The Periodic_Advertising_Interval_Min parameter shall be less
4787  *        than or equal to the Periodic_Advertising_Interval_Max parameter. The
4788  *        Periodic_Advertising_- Interval_Min and
4789  *        Periodic_Advertising_Interval_Max parameters should not be the same
4790  *        value to enable the Controller to determine the best advertising
4791  *        interval given other activities. If the periodic advertising interval
4792  *        range provided by the Host (Periodic_Advertising_Interval_Min,
4793  *        Periodic_Advertising_Interval_Max) does not overlap with the periodic
4794  *        advertising interval range supported by the Controller, then the
4795  *        Controller shall return an error which should use the error code
4796  *        Unsupported Feature or Parameter Value (0x11). The
4797  *        Periodic_Advertising_Properties parameter indicates which fields
4798  *        should be included in the advertising packet. The Num_Subevents
4799  *        parameter identifies the number of subevents that shall be transmitted
4800  *        for each periodic advertising event. If the Num_Subevents parameter
4801  *        value is 0x00, then the Subevent_Interval, Response_Slot_Delay,
4802  *        Response_Slot_Spacing, and Num_Response_Slots parameters shall be
4803  *        ignored. The Subevent_Interval parameter identifies the time between
4804  *        the subevents of PAwR. The Subevent_Interval shall be less than or
4805  *        equal to the Periodic_Advertising_Interval_Min divided by the
4806  *        Num_Subevents of the advertising set. The Response_Slot_Delay
4807  *        parameter identifies the time between the start of the advertising
4808  *        packet at the start of a subevent and the start of the first response
4809  *        slot. The Response_Slot_Delay shall be less than the
4810  *        Subevent_Interval. The Response_Slot_Spacing parameter identifies the
4811  *        time between the start of two consecutive response slots. The
4812  *        Response_Slot_Spacing shall be less than or equal to 10 x
4813  *        (Subevent_Interval - Response_Slot_Delay) / Num_Response_Slots. If the
4814  *        Num_Response_Slots parameter is set to 1, then the Controller shall
4815  *        ignore the Response_Slot_Spacing parameter. The Num_Response_Slots
4816  *        parameter identifies the number of response slots in a subevent. If
4817  *        the Num_Response_Slots parameter value is 0x00, then the
4818  *        Response_Slot_Delay and Response_Slot_Spacing parameters shall be
4819  *        ignored. If the advertising set identified by the Advertising_Handle
4820  *        specified scannable, connectable, legacy, or anonymous advertising,
4821  *        the Controller shall return the error code Invalid HCI Command
4822  *        Parameters (0x12). If the Host issues this command when periodic
4823  *        advertising is enabled for the specified advertising set, the
4824  *        Controller shall return the error code Command Disallowed (0x0C). If
4825  *        the Advertising_Handle does not identify an advertising set that is
4826  *        already configured for periodic advertising and the Controller is
4827  *        unable to support more periodic advertising at present, the Controller
4828  *        shall return the error code Memory Capacity Exceeded (0x07). If the
4829  *        advertising set already contains periodic advertising data and the
4830  *        length of the data is greater than the maximum that the Controller can
4831  *        transmit within a periodic advertising interval of
4832  *        Periodic_Advertising_Interval_Max, the Controller shall return the
4833  *        error code Packet Too Long (0x45). If advertising on the LE Coded PHY,
4834  *        the S=8 coding shall be assumed unless the current advertising
4835  *        parameters require the use of S=2 for an advertising physical channel,
4836  *        in which case the S=2 coding shall be assumed for that advertising
4837  *        physical channel.
4838  * @param Advertising_Handle Used to identify a periodic advertising train.
4839  *        Values:
4840  *        - 0x00 ... 0xEF
4841  * @param Periodic_Advertising_Interval_Min Minimum advertising interval for
4842  *        periodic advertising. Time = N * 1.25 ms; Time Range: 7.5ms to
4843  *        81.91875 s.
4844  *        Values:
4845  *        - 0x0006 (7.50 ms)  ... 0xFFFF (NaN)
4846  * @param Periodic_Advertising_Interval_Max Maximum advertising interval for
4847  *        periodic advertising. Time = N * 1.25 ms; Time Range: 7.5ms to
4848  *        81.91875 s.
4849  *        Values:
4850  *        - 0x0006 (7.50 ms)  ... 0xFFFF (NaN)
4851  * @param Periodic_Advertising_Properties The Periodic_Advertising_Properties
4852  *        parameter indicates which fields should be included in the advertising
4853  *        packet.
4854  *        Flags:
4855  *        - 0x0040
4856  * @param Num_Subevents Number of subevents.
4857  *        Values:
4858  *        - 0x00 ... 0x80
4859  * @param Subevent_Interval Interval between subevents. Time = N x 1.25 ms.
4860  *        Values:
4861  *        - 0x06 (7.50 ms)  ... 0xFF (318.75 ms)
4862  * @param Response_Slot_Delay Time between the advertising packet in a subevent
4863  *        and the first response slot. Time = N x 1.25 ms.
4864  *        Values:
4865  *        - 0x00 (NaN) : No response slots
4866  *        - 0x01 (1.25 ms)  ... 0xFE (317.50 ms)
4867  * @param Response_Slot_Spacing Time between response slots. Time = N x 0.125 ms
4868  *        Values:
4869  *        - 0x00 (0.000 ms) : No response slots
4870  *        - 0x02 (0.250 ms)  ... 0xFF (31.875 ms)
4871  * @param Num_Response_Slots Number of subevent response slots.
4872  *        Values:
4873  *        - 0x00 ... 0xFF
4874  * @retval Value indicating success or error code.
4875  */
4876 tBleStatus hci_le_set_periodic_advertising_parameters_v2(uint8_t Advertising_Handle,
4877                                                          uint16_t Periodic_Advertising_Interval_Min,
4878                                                          uint16_t Periodic_Advertising_Interval_Max,
4879                                                          uint16_t Periodic_Advertising_Properties,
4880                                                          uint8_t Num_Subevents,
4881                                                          uint8_t Subevent_Interval,
4882                                                          uint8_t Response_Slot_Delay,
4883                                                          uint8_t Response_Slot_Spacing,
4884                                                          uint8_t Num_Response_Slots);
4885 /**
4886  * @brief API used to send HCI ACL Data Packets to exchange data between the Host and Controller.
4887  *
4888  * @note The API name is only available in link layer only mode.
4889  *
4890  * @param      Connection_Handle  Connection handle for which the command is given. Range: 0x0000-0x0EFF (0x0F00 - 0x0FFF Reserved for future use)
4891  * @param      PB_Flag            Packet boundary flag
4892  * @param      BC_Flag            Broadcast flag
4893  * @param      Data_Length        Length of PDU data in octets.
4894  * @param[in]  PDU_Data           PDU data pointer
4895  *
4896  * @return  Error code
4897  */
4898 tBleStatus hci_tx_acl_data(uint16_t Connection_Handle,
4899                            uint8_t  PB_Flag,
4900                            uint8_t  BC_Flag,
4901                            uint16_t  Data_Length,
4902                            uint8_t*  PDU_Data);
4903 /**
4904 * @brief Function to send isochronous data to the Controller.
4905  *
4906  * @param      Connection_Handle    Connection handle. Range: 0x0000-0x0EFF (0x0F00 - 0x0FFF Reserved for future use)
4907  * @param      PB_Flag              Packet boundary flag
4908  * @param      TS_Flag              Timestamp flag. Set if the ISO_Data_Load field contains a Time_Stamp field.
4909  * @param      ISO_Data_Load_Length Length of ISO_Data_Load in octets.
4910  * @param[in]  ISO_Data_Load        The format of the ISO_Data_Load is described in Core v5.3 Vol. 4, part E, section 5.4.5
4911  *
4912  * @return  Error code
4913  */
4914 tBleStatus hci_tx_iso_data(uint16_t Connection_Handle,
4915                            uint8_t  PB_Flag,
4916                            uint8_t  TS_Flag,
4917                            uint16_t ISO_Data_Load_Length,
4918                            uint8_t *ISO_Data_Load);
4919 /**
4920  * @}
4921  */
4922 
4923 /**
4924  * @}
4925  */
4926 
4927 
4928 /**
4929  *@addtogroup HCI HCI
4930  *@brief Host Controller Interface.
4931  *@{
4932  */
4933 /**
4934  *@defgroup HCI_Test_Commands HCI Test Commands
4935  *@brief Standard HCI commands for testing.
4936  *@{
4937  */
4938 /**
4939  * @brief This command is used to start a test where the DUT receives test
4940  *        reference packets at a fixed interval. The tester generates the test
4941  *        reference packets. (See Bluetooth Specification v.4.1, Vol. 2, Part E,
4942  *        7.8.28)
4943  * @param RX_Frequency
4944  *        Values:
4945  *        - 0x00 ... 0x27: N = (F - 2402) / 2.Frequency Range : 2402 MHz to 2480 MHz
4946  * @retval Value indicating success or error code.
4947  */
4948 tBleStatus hci_le_receiver_test(uint8_t RX_Frequency);
4949 /**
4950  * @brief This command is used to start a test where the DUT generates test
4951  *        reference packets at a fixed interval. The Controller shall transmit
4952  *        at maximum power. An LE Controller supporting the LE_Transmitter_Test
4953  *        command shall support Packet_Payload values 0x00, 0x01 and 0x02. An LE
4954  *        Controller may support other values of Packet_Payload. (See Bluetooth
4955  *        Specification v.4.1, Vol. 2, Part E, 7.8.29)
4956  * @param TX_Frequency N = (F - 2402) / 2. Frequency Range : 2402 MHz to 2480
4957  *        MHz
4958  *        Values:
4959  *        - 0x00 ... 0x27
4960  * @param Length_Of_Test_Data Length in bytes of payload data in each packet.
4961  *        Supported ranges:       - (0x00,0x25) if data length extension is
4962  *        disabled.       - (0x00,0xFF) if data length extension is enabled.
4963  *        Values:
4964  *        - 0x00 ... 0xFF
4965  * @param Packet_Payload Content of the Payload of the test reference packets.
4966  *        0: PRBS9 sequence '11111111100000111101...' (in transmission order) 1:
4967  *        Repeated '11110000' (in transmission order) sequence 2: Repeated
4968  *        '10101010' (in transmission order) sequence 3: PRBS15 sequence 4:
4969  *        Repeated '11111111' (in transmission order) sequence 5: Repeated
4970  *        '00000000' (in transmission order) sequence 6: Repeated '00001111' (in
4971  *        transmission order) sequence 7: Repeated '01010101' (in transmission
4972  *        order) sequence
4973  *        Values:
4974  *        - 0x00: PRBS9
4975  *        - 0x01: Repeated '11110000'
4976  *        - 0x02: Repeated '10101010'
4977  *        - 0x03: PRBS15
4978  *        - 0x04: Repeated '11111111'
4979  *        - 0x05: Repeated '00000000'
4980  *        - 0x06: Repeated '00001111'
4981  *        - 0x07: Repeated '01010101'
4982  * @retval Value indicating success or error code.
4983  */
4984 tBleStatus hci_le_transmitter_test(uint8_t TX_Frequency,
4985                                    uint8_t Length_Of_Test_Data,
4986                                    uint8_t Packet_Payload);
4987 /**
4988  * @brief This command is used to stop any test which is in progress. The
4989  *        Number_Of_Packets for a transmitter test shall be reported as 0x0000.
4990  *        The Number_Of_Packets is an unsigned number and contains the number of
4991  *        received packets. (See Bluetooth Specification v.4.1, Vol. 2, Part E,
4992  *        7.8.30)
4993  * @param[out] Number_Of_Packets Number of packets received.
4994  * @retval Value indicating success or error code.
4995  */
4996 tBleStatus hci_le_test_end(uint16_t *Number_Of_Packets);
4997 /**
4998  * @brief This command is used to start a test where the DUT receives test
4999  *        reference packets at a fixed interval. The tester generates the test
5000  *        reference packets.
5001  * @param RX_Channel Frequency Range : 2402 MHz to 2480 MHz N = (F - 2402) / 2.
5002  *        Values:
5003  *        - 0x00 ... 0x27: Frequency Range : 2402 MHz to 2480 MHz
5004  * @param PHY PHY to be used by the receiver.
5005  *        Values:
5006  *        - 0x01: LE_1M_PHY
5007  *        - 0x02: LE_2M_PHY
5008  *        - 0x03: LE_CODED_PHY
5009  * @param Modulation_index The Modulation_Index parameter specifies whether or
5010  *        not the Controller should assume the receiver has a stable modulation
5011  *        index.
5012  *        Values:
5013  *        - 0x00: Standard modulation index
5014  *        - 0x01: Stable modulation index
5015  * @retval Value indicating success or error code.
5016  */
5017 tBleStatus hci_le_receiver_test_v2(uint8_t RX_Channel,
5018                                    uint8_t PHY,
5019                                    uint8_t Modulation_index);
5020 /**
5021  * @brief This command is used to start a test where the DUT generates test
5022  *        reference packets at a fixed interval. The Controller shall transmit
5023  *        at maximum power. An LE Controller supporting the LE_Enhanced
5024  *        Transmitter_Test command shall support Packet_Payload values 0x00,
5025  *        0x01 and 0x02. An LE Controller supporting the LE Coded PHY shall also
5026  *        support Packet_Payload value 0x04. An LE Controller may support other
5027  *        values of Packet_Payload.
5028  * @param TX_Channel Frequency Range: 2402 MHz to 2480 MHz N = (F-2402) / 2
5029  *        Values:
5030  *        - 0x00 ... 0x27: Frequency Range: 2402 MHz to 2480 MHz
5031  * @param Length_Of_Test_Data Length in bytes of payload data in each packet.
5032  *        Supported ranges:       - (0x00,0x25) if data length extension is
5033  *        disabled.       - (0x00,0xFF) if data length extension is enabled.
5034  *        Values:
5035  *        - 0x00 ... 0xFF
5036  * @param Packet_Payload Content of the Payload of the test reference packets.
5037  *        0: PRBS9 sequence '11111111100000111101...' (in transmission order) 1:
5038  *        Repeated '11110000' (in transmission order) sequence 2: Repeated
5039  *        '10101010' (in transmission order) sequence 3: PRBS15 sequence 4:
5040  *        Repeated '11111111' (in transmission order) sequence 5: Repeated
5041  *        '00000000' (in transmission order) sequence 6: Repeated '00001111' (in
5042  *        transmission order) sequence 7: Repeated '01010101' (in transmission
5043  *        order) sequence
5044  *        Values:
5045  *        - 0x00: PRBS9
5046  *        - 0x01: Repeated '11110000'
5047  *        - 0x02: Repeated '10101010'
5048  *        - 0x03: PRBS15
5049  *        - 0x04: Repeated '11111111'
5050  *        - 0x05: Repeated '00000000'
5051  *        - 0x06: Repeated '00001111'
5052  *        - 0x07: Repeated '01010101'
5053  * @param PHY PHY to be used by the transmitter.
5054  *        Values:
5055  *        - 0x01: LE_1M_PHY
5056  *        - 0x02: LE_2M_PHY
5057  *        - 0x03: LE_CODED_PHY_S8
5058  *        - 0x04: LE_CODED_PHY_S2
5059  * @retval Value indicating success or error code.
5060  */
5061 tBleStatus hci_le_transmitter_test_v2(uint8_t TX_Channel,
5062                                       uint8_t Length_Of_Test_Data,
5063                                       uint8_t Packet_Payload,
5064                                       uint8_t PHY);
5065 /**
5066  * @brief This command is used to start a test where the DUT receives test
5067  *        reference packets at a fixed interval. The tester generates the test
5068  *        reference packets. The RX_Channel and PHY parameters specify the RF
5069  *        channel and PHY to be used by the receiver. If the Host sets the PHY
5070  *        parameter to a PHY that the Controller does not support, including a
5071  *        value that is reserved for future use, the Controller shall return the
5072  *        error code Unsupported Feature or Parameter Value (0x11). The
5073  *        Modulation_Index parameter specifies whether or not the Controller
5074  *        should assume the receiver has a stable modulation index. The
5075  *        Expected_CTE_Length and Expected_CTE_Type parameters specify the
5076  *        expected length and type of the Constant Tone Extensions in received
5077  *        test reference packets. When receiving on a PHY that allows Constant
5078  *        Tone Extensions, if the Constant Tone Extension in a received test
5079  *        reference packet does not match both of these, the DUT shall discard
5080  *        that packet. If Expected_CTE_Length is not zero and PHY specifies a
5081  *        PHY that does not allow Constant Tone Extensions, the Controller shall
5082  *        return the error code Command Disallowed (0x0C). If the Slot_Durations
5083  *        parameter is set to 0x01 and the Controller does not support 1
5084  *        microsecond switching and sampling, the Controller shall return the
5085  *        error code Unsupported Feature or Parameter Value (0x11).
5086  *        Slot_Durations, Switching_Pattern_Length, and Antenna_IDs[i] are only
5087  *        used when expecting an AoA Constant Tone Extension and shall be
5088  *        ignored when expecting an AoD Constant Tone Extension. If the
5089  *        Controller determines that any of the Antenna_IDs[i] values do not
5090  *        identify an antenna in the device's antenna array, it shall return the
5091  *        error code Unsupported Feature or Parameter Value (0x11). Note: Some
5092  *        Controllers may be unable to determine which values do or do not
5093  *        identify an antenna.
5094  * @param RX_Channel
5095  *        Values:
5096  *        - 0x00 ... 0x27: N = (F - 2402) / 2.Frequency Range : 2402 MHz to 2480 MHz
5097  * @param PHY PHY to be used by the receiver.
5098  *        Values:
5099  *        - 0x01: LE_1M_PHY
5100  *        - 0x02: LE_2M_PHY
5101  *        - 0x03: LE_CODED_PHY
5102  * @param Modulation_Index
5103  *        Values:
5104  *        - 0x00: Assume transmitter will have a standard modulation index
5105  *        - 0x01: Assume transmitter will have a stable modulation index
5106  * @param Expected_CTE_Length
5107  *        Values:
5108  *        - 0x00: No Constant Tone Extension expected (default)
5109  *        - 0x02 ... 0x14: Expected length of the Constant Tone Extension in 8 microseconds units.
5110  * @param Expected_CTE_Type
5111  *        Values:
5112  *        - 0x00: Expect AoA Constant Tone Extension
5113  *        - 0x01: Expect AoD Constant Tone Extension with 1 microsecond slots
5114  *        - 0x02: Expect AoD Constant Tone Extension with 2 microseconds slots
5115  * @param Slot_Durations Sampling rate used by the Controller.
5116  *        Values:
5117  *        - 0x01: CTE_SLOT_1us
5118  *        - 0x02: CTE_SLOT_2us
5119  * @param Switching_Pattern_Length
5120  *        Values:
5121  *        - 0x02 ... 0x4B: The number of Antenna IDs in the pattern.
5122  * @param Antenna_IDs List of Antenna IDs in the pattern
5123  * @retval Value indicating success or error code.
5124  */
5125 tBleStatus hci_le_receiver_test_v3(uint8_t RX_Channel,
5126                                    uint8_t PHY,
5127                                    uint8_t Modulation_Index,
5128                                    uint8_t Expected_CTE_Length,
5129                                    uint8_t Expected_CTE_Type,
5130                                    uint8_t Slot_Durations,
5131                                    uint8_t Switching_Pattern_Length,
5132                                    uint8_t Antenna_IDs[]);
5133 /**
5134  * @brief This command is used to start a test where the DUT generates test
5135  *        reference packets at a fixed interval. The Controller shall transmit
5136  *        at the power level indicated by the Transmit_Power_Level parameter.
5137  *        The TX_Channel and PHY parameters specify the RF channel and PHY to be
5138  *        used by the transmitter. If the Host sets the PHY parameter to a PHY
5139  *        that the Controller does not support, including a value that is
5140  *        reserved for future use, the Controller shall return the error code
5141  *        Unsupported Feature or Parameter Value (0x11). The Test_Data_Length
5142  *        and Packet_Payload parameters specify the length and contents of the
5143  *        Payload of the test reference packets. An LE Controller supporting the
5144  *        HCI_LE_Transmitter_Test command shall support Packet_Payload values
5145  *        0x00, 0x01 and 0x02. An LE Controller supporting the LE Coded PHY
5146  *        shall also support Packet_Payload value 0x04. An LE Controller may
5147  *        support other values of Packet_Payload. The CTE_Length and CTE_Type
5148  *        parameters specify the length and type of the Constant Tone Extension
5149  *        in the test reference packets. If the CTE_Type parameter is set to
5150  *        0x01 and the Controller does not support 1 microsecond switching, the
5151  *        Controller shall return the error code Unsupported Feature or
5152  *        Parameter Value (0x11). If CTE_Length is not zero and PHY specifies a
5153  *        PHY that does not allow Constant Tone Extensions, the Controller shall
5154  *        return the error code Command Disallowed (0x0C). The
5155  *        Switching_Pattern_Length and Antenna_IDs[i] parameters specify the
5156  *        antenna switching pattern. They are only used when transmitting an AoD
5157  *        Constant Tone Extension and shall be ignored when transmitting an AoA
5158  *        Constant Tone Extension. If the Controller determines that any of the
5159  *        Antenna_IDs[i] values do not identify an antenna in the device's
5160  *        antenna array, it shall return the error code Unsupported Feature or
5161  *        Parameter Value (0x11). Note: Some Controllers may be unable to
5162  *        determine which values do or do not identify an antenna. The
5163  *        Transmit_Power_Level parameter specifies the transmit power level to
5164  *        be used by the transmitter. If the parameter is set to a value other
5165  *        than 0x7E or 0x7F, then the Controller shall make the requested change
5166  *        or shall make the nearest change that it is capable of doing.
5167  * @param TX_Channel N = (F - 2402) / 2. Frequency Range : 2402 MHz to 2480 MHz
5168  *        Values:
5169  *        - 0x00 ... 0x27
5170  * @param Test_Data_Length Length in bytes of payload data in each packet.
5171  *        Supported ranges:       - (0x00,0x25) if data length extension is
5172  *        disabled.       - (0x00,0xFF) if data length extension is enabled.
5173  *        Values:
5174  *        - 0x00 ... 0xFF
5175  * @param Packet_Payload Content of the Payload of the test reference packets.
5176  *        0: PRBS9 sequence '11111111100000111101...' (in transmission order) 1:
5177  *        Repeated '11110000' (in transmission order) sequence 2: Repeated
5178  *        '10101010' (in transmission order) sequence 3: PRBS15 sequence 4:
5179  *        Repeated '11111111' (in transmission order) sequence 5: Repeated
5180  *        '00000000' (in transmission order) sequence 6: Repeated '00001111' (in
5181  *        transmission order) sequence 7: Repeated '01010101' (in transmission
5182  *        order) sequence
5183  *        Values:
5184  *        - 0x00: PRBS9
5185  *        - 0x01: Repeated '11110000'
5186  *        - 0x02: Repeated '10101010'
5187  *        - 0x03: PRBS15
5188  *        - 0x04: Repeated '11111111'
5189  *        - 0x05: Repeated '00000000'
5190  *        - 0x06: Repeated '00001111'
5191  *        - 0x07: Repeated '01010101'
5192  * @param PHY PHY to be used by the transmitter.
5193  *        Values:
5194  *        - 0x01: LE_1M_PHY
5195  *        - 0x02: LE_2M_PHY
5196  *        - 0x03: LE_CODED_PHY_S8
5197  *        - 0x04: LE_CODED_PHY_S2
5198  * @param CTE_Length
5199  *        Values:
5200  *        - 0x00: No Constant Tone Extension expected (default)
5201  *        - 0x02 ... 0x14: Expected length of the Constant Tone Extension in 8 microseconds units.
5202  * @param CTE_Type
5203  *        Values:
5204  *        - 0x00: Expect AoA Constant Tone Extension
5205  *        - 0x01: Expect AoD Constant Tone Extension with 1 microsecond slots
5206  *        - 0x02: Expect AoD Constant Tone Extension with 2 microseconds slots
5207  * @param Switching_Pattern_Length The number of Antenna IDs in the pattern.
5208  *        Values:
5209  *        - 0x02 ... 0x4B
5210  * @param Antenna_IDs List of Antenna IDs in the pattern
5211  * @retval Value indicating success or error code.
5212  */
5213 tBleStatus hci_le_transmitter_test_v3(uint8_t TX_Channel,
5214                                       uint8_t Test_Data_Length,
5215                                       uint8_t Packet_Payload,
5216                                       uint8_t PHY,
5217                                       uint8_t CTE_Length,
5218                                       uint8_t CTE_Type,
5219                                       uint8_t Switching_Pattern_Length,
5220                                       uint8_t Antenna_IDs[]);
5221 /**
5222  * @brief This command is used to start a test where the DUT generates test
5223  *        reference packets at a fixed interval. The Controller shall transmit
5224  *        at the power level indicated by the Transmit_Power_Level parameter.
5225  *        The TX_Channel and PHY parameters specify the RF channel and PHY to be
5226  *        used by the transmitter. If the Host sets the PHY parameter to a PHY
5227  *        that the Controller does not support, including a value that is
5228  *        reserved for future use, the Controller shall return the error code
5229  *        Unsupported Feature or Parameter Value (0x11). The Test_Data_Length
5230  *        and Packet_Payload parameters specify the length and contents of the
5231  *        Payload of the test reference packets. An LE Controller supporting the
5232  *        HCI_LE_Transmitter_Test command shall support Packet_Payload values
5233  *        0x00, 0x01 and 0x02. An LE Controller supporting the LE Coded PHY
5234  *        shall also support Packet_Payload value 0x04. An LE Controller may
5235  *        support other values of Packet_Payload. The CTE_Length and CTE_Type
5236  *        parameters specify the length and type of the Constant Tone Extension
5237  *        in the test reference packets. If the CTE_Type parameter is set to
5238  *        0x01 and the Controller does not support 1 microsecond switching, the
5239  *        Controller shall return the error code Unsupported Feature or
5240  *        Parameter Value (0x11). If CTE_Length is not zero and PHY specifies a
5241  *        PHY that does not allow Constant Tone Extensions, the Controller shall
5242  *        return the error code Command Disallowed (0x0C). The
5243  *        Switching_Pattern_Length and Antenna_IDs[i] parameters specify the
5244  *        antenna switching pattern. They are only used when transmitting an AoD
5245  *        Constant Tone Extension and shall be ignored when transmitting an AoA
5246  *        Constant Tone Extension. If the Controller determines that any of the
5247  *        Antenna_IDs[i] values do not identify an antenna in the device's
5248  *        antenna array, it shall return the error code Unsupported Feature or
5249  *        Parameter Value (0x11). Note: Some Controllers may be unable to
5250  *        determine which values do or do not identify an antenna. The
5251  *        Transmit_Power_Level parameter specifies the transmit power level to
5252  *        be used by the transmitter. If the parameter is set to a value other
5253  *        than 0x7E or 0x7F, then the Controller shall make the requested change
5254  *        or shall make the nearest change that it is capable of doing.
5255  * @param TX_Channel N = (F - 2402) / 2. Frequency Range : 2402 MHz to 2480 MHz
5256  *        Values:
5257  *        - 0x00 ... 0x27
5258  * @param Test_Data_Length Length in bytes of payload data in each packet.
5259  *        Supported ranges:       - (0x00,0x25) if data length extension is
5260  *        disabled.       - (0x00,0xFF) if data length extension is enabled.
5261  *        Values:
5262  *        - 0x00 ... 0xFF
5263  * @param Packet_Payload Content of the Payload of the test reference packets.
5264  *        0: PRBS9 sequence '11111111100000111101...' (in transmission order) 1:
5265  *        Repeated '11110000' (in transmission order) sequence 2: Repeated
5266  *        '10101010' (in transmission order) sequence 3: PRBS15 sequence 4:
5267  *        Repeated '11111111' (in transmission order) sequence 5: Repeated
5268  *        '00000000' (in transmission order) sequence 6: Repeated '00001111' (in
5269  *        transmission order) sequence 7: Repeated '01010101' (in transmission
5270  *        order) sequence
5271  *        Values:
5272  *        - 0x00: PRBS9
5273  *        - 0x01: Repeated '11110000'
5274  *        - 0x02: Repeated '10101010'
5275  *        - 0x03: PRBS15
5276  *        - 0x04: Repeated '11111111'
5277  *        - 0x05: Repeated '00000000'
5278  *        - 0x06: Repeated '00001111'
5279  *        - 0x07: Repeated '01010101'
5280  * @param PHY PHY to be used by the transmitter.
5281  *        Values:
5282  *        - 0x01: LE_1M_PHY
5283  *        - 0x02: LE_2M_PHY
5284  *        - 0x03: LE_CODED_PHY_S8
5285  *        - 0x04: LE_CODED_PHY_S2
5286  * @param CTE_Length
5287  *        Values:
5288  *        - 0x00: No Constant Tone Extension expected (default)
5289  *        - 0x02 ... 0x14: Expected length of the Constant Tone Extension in 8 microseconds units.
5290  * @param CTE_Type
5291  *        Values:
5292  *        - 0x00: Expect AoA Constant Tone Extension
5293  *        - 0x01: Expect AoD Constant Tone Extension with 1 microsecond slots
5294  *        - 0x02: Expect AoD Constant Tone Extension with 2 microseconds slots
5295  * @param Switching_Pattern_Length
5296  *        Values:
5297  *        - 0x02 ... 0x4B: The number of Antenna IDs in the pattern.
5298  * @param Antenna_IDs List of Antenna IDs in the pattern
5299  * @param Transmit_Power_Level
5300  *        Values:
5301  *        - -127 ... 20: Set transmitter to the specified or the nearest transmit power level.
5302  *        - 126: Set transmitter to minimum transmit power level
5303  *        - 127: Set transmitter to maximum transmit power level
5304  * @retval Value indicating success or error code.
5305  */
5306 tBleStatus hci_le_transmitter_test_v4(uint8_t TX_Channel,
5307                                       uint8_t Test_Data_Length,
5308                                       uint8_t Packet_Payload,
5309                                       uint8_t PHY,
5310                                       uint8_t CTE_Length,
5311                                       uint8_t CTE_Type,
5312                                       uint8_t Switching_Pattern_Length,
5313                                       uint8_t Antenna_IDs[],
5314                                       int8_t Transmit_Power_Level);
5315 /**
5316  * @}
5317  */
5318 
5319 /**
5320  * @}
5321  */
5322 
5323 
5324 /**
5325  *@addtogroup HAL_LL HAL/LL
5326  *@brief HAL and proprietary LL API layer.
5327  *@{
5328  */
5329 /**
5330  *@defgroup ACI_HAL_Commands ACI HAL Commands
5331  *@brief Commands for HAL and proprietary LL.
5332  *@{
5333  */
5334 /**
5335  * @brief This command returns the build number associated with the firmware
5336  *        version currently running
5337  * @param[out] Build_Number Build number of the firmware.
5338  * @retval Value indicating success or error code.
5339  */
5340 tBleStatus aci_hal_get_fw_build_number(uint16_t *Build_Number);
5341 /**
5342  * @brief This command writes a value to a low level configure data structure.
5343  *        It is useful to setup directly some low level parameters for the
5344  *        system in the runtime.NOTE: This command shall not be called if a
5345  *        command different than Stack Init, HCI_RESET,
5346  *        ACI_HAL_WRITE_CONFIG_DATA or ACI_HAL_READ_CONFIG_DATA has already been
5347  *        called.
5348  * @param Offset Offset of the element in the configuration data structure which
5349  *        has to be written. The valid offsets are:  - 0x00: Bluetooth public
5350  *        address, Value length to be written: 6 bytes - 0x08: Encryption root
5351  *        key used to derive LTK and CSRK, Value length to be written: 16 bytes
5352  *        - 0x18: Identity root key used to derive LTK and CSRK, Value length to
5353  *        be written: 16 bytes - 0x2C: Link layer without host (for
5354  *        certification purposes), Value length to be written: 1 byte - 0x2E: If
5355  *        set, the stack uses this address as the static random address instead
5356  *        of the one stored in NVM. - 0x2F: Value is a bit field that indicates
5357  *        the advertising channel indices that shall be used when scanning. At
5358  *        least one channel bit shall be set. Bit 0: ch. 37; bit 1: ch. 38; bit
5359  *        2: ch 39. - 0xD0: Use debug key for Secure connection: 1 byte - 0xD1:
5360  *        Set the maximum allowed parameter values for Data Length Extension: 8
5361  *        bytes, 2 bytes for each of the following parameters:
5362  *        supportedMaxTxOctets, supportedMaxTxTime, supportedMaxRxOctets,
5363  *        supportedMaxRxTime, in little-endian order.         (default
5364  *        251,2120,251,2120).
5365  *        Values:
5366  *        - 0x00: CONFIG_DATA_PUBADDR_OFFSET
5367  *        - 0x08: CONFIG_DATA_ER_OFFSET
5368  *        - 0x18: CONFIG_DATA_IR_OFFSET
5369  *        - 0x2C: LL_WITHOUT_HOST
5370  *        - 0x2E: CONFIG_DATA_STATIC_RANDOM_ADDRESS
5371  *        - 0x2F: CONFIG_DATA_SCAN_CH_MAP
5372  *        - 0xD0: CONFIG_DATA_DEBUG_KEY
5373  *        - 0xD1: CONFIG_DATA_DLE
5374  * @param Length Length of data to be written
5375  * @param Value Data to be written
5376  * @retval Value indicating success or error code.
5377  */
5378 tBleStatus aci_hal_write_config_data(uint8_t Offset,
5379                                      uint8_t Length,
5380                                      uint8_t Value[]);
5381 /**
5382  * @brief This command requests the value in the low level configure data
5383  *        structure. The number of read bytes changes for different Offset.
5384  * @param Offset Offset of the element in the configuration data structure which
5385  *        has to be read. The valid offsets are:  - 0x00: Bluetooth public
5386  *        address, Value length returned: 6 bytes - 0x08: Encryption root key
5387  *        used to derive LTK and CSRK, Value length returned: 16 bytes - 0x18:
5388  *        Identity root key used to derive LTK and CSRK, Value length returned:
5389  *        16 bytes - 0x2C: Link layer without host (for certification purposes),
5390  *        Value length returned: 1 byte - 0x80: The static random address stored
5391  *        in NVM. Value length returned: 6 bytes (read-only)
5392  *        Values:
5393  *        - 0x00: CONFIG_DATA_PUBADDR_OFFSET
5394  *        - 0x08: CONFIG_DATA_ER_OFFSET
5395  *        - 0x18: CONFIG_DATA_IR_OFFSET
5396  *        - 0x2C: LL_WITHOUT_HOST
5397  *        - 0x80: CONFIG_DATA_STORED_STATIC_RANDOM_ADDRESS
5398  * @param[out] Data_Length Length of Data in octets
5399  * @param[out] Data Data field associated with Offset parameter
5400  * @retval Value indicating success or error code.
5401  */
5402 tBleStatus aci_hal_read_config_data(uint8_t Offset,
5403                                     uint8_t *Data_Length,
5404                                     uint8_t Data[]);
5405 /**
5406  * @brief This command sets the TX power level of the device for all the radio
5407  *        activities, unless explicitly defined by other commands. The
5408  *        combination of En_High_Power and PA_Level parameters determines the
5409  *        output power level (dBm).  When the system starts up or reboots, the
5410  *        default TX power level will be used, which is En_High_Power = 0 and
5411  *        PA_Level = 31.  The En_High_Power is used to change the SMPS level.
5412  *        When the parameter is set to 0, SMPS level is set to 1.4V. When the
5413  *        parameter is set to 1, SMPS level is set to 1.9V. However, if SMPS is
5414  *        disabled, no action is done on the SMPS level, since the voltage must
5415  *        be applied externally on the VFBSD pin. To reach 8 dBm of TX power,
5416  *        En_High_Power must be set to 1. If SMPS is not used, this voltage
5417  *        level must be applied to the VFBSD pin. On devices other then
5418  *        STM32WB09, setting En_High_Power to 1 also bypasses the LDO_TRANSFO
5419  *        during transmission.  On STM32WB09 device, PA_Level 32 is used to
5420  *        specify the configuration to reach 8 dBm, to be used only when
5421  *        En_High_Power is set to 1. In this configuration, LDO_TRANSFO is
5422  *        bypassed during transmission, by setting TxHp bit. The output power
5423  *        for other PA levels will remain almost equal to the case when
5424  *        En_High_Power is set to 0, since LDO_TRANSFO is not bypassed (TxHp bit
5425  *        set to 0).  On devices other than STM32WB09, (i.e. where TxHp bit is
5426  *        not present), PA level 32 cannot be used. The 8 dBm configuration can
5427  *        be selected by using PA_Level 31, with En_High_Power set to 1.
5428  *        However, when setting En_High_Power to 1, also the output power of
5429  *        other PA levels less than 31 will change (especially for the higher
5430  *        ones) since LDO_TRANSFO is always bypassed during transmission for all
5431  *        the PA levels.  Note that, if En_High_Power = 1 and SMPS is disabled,
5432  *        when LDO_TRANSFO is bypassed the actual output power will depend on
5433  *        the voltage applied to the VFBSD pin. In case the voltage is not 1.9V,
5434  *        it is recommended to change the TX output levels specified in the
5435  *        high_power_pa_level_table. The real output power may also depend on
5436  *        PCB layout and associated components.  After this command is given,
5437  *        the new output power will be used only for new Link Layer state
5438  *        machines, i.e. for new Bluetooth activities, i.e. new advertising
5439  *        sets, new connections, new scanning procedures. For current activities
5440  *        the output power will not change. The only exception is for
5441  *        AUX_SCAN_REQ and AUX_CONNECT_REQ PDUs, for which the new output power
5442  *        will immediately take effect also for the current scanning procedure.
5443  * @param En_High_Power Enable High Power mode, by changing SMPS level. High
5444  *        power mode should be enabled only to reach the maximum output power.
5445  *        Normal power (0x00) is the default.
5446  *        Values:
5447  *        - 0x00: Normal Power
5448  *        - 0x01: High Power
5449  * @param PA_Level Power amplifier output level. PA_Level 32 is available only
5450  *        for STM32WB09, to select 8 dBm of output power.
5451  *        Values:
5452  *        - 0: -54/-54 dBm
5453  *        - 1: -21/-19 dBm
5454  *        - 2: -20/-18 dBm
5455  *        - 3: -19/-17 dBm
5456  *        - 4: -17/-16 dBm
5457  *        - 5: -16/-15 dBm
5458  *        - 6: -15/-14 dBm
5459  *        - 7: -14/-13 dBm
5460  *        - 8: -13/-12 dBm
5461  *        - 9: -12/-11 dBm
5462  *        - 10: -11/-10 dBm
5463  *        - 11: -10/-9 dBm
5464  *        - 12: -9/-8 dBm
5465  *        - 13: -8/-7 dBm
5466  *        - 14: -7/-6 dBm
5467  *        - 15: -6/-5 dBm
5468  *        - 16: -6/-4 dBm
5469  *        - 17: -4/-3 dBm
5470  *        - 18: -3/-3 dBm
5471  *        - 19: -3/-2 dBm
5472  *        - 20: -2/-1 dBm
5473  *        - 21: -2/+0 dBm
5474  *        - 22: -1/+1 dBm
5475  *        - 23: -1/+2 dBm
5476  *        - 24: +0/+3 dBm
5477  *        - 25: +0/+8 dBm
5478  *        - 26: +1/+8 dBm
5479  *        - 27: +2/+8 dBm
5480  *        - 28: +3/+8 dBm
5481  *        - 29: +4/+8 dBm
5482  *        - 30: +5/+8 dBm
5483  *        - 31: +6/+8 dBm
5484  *        - 32: +8 dBm
5485  * @retval Value indicating success or error code.
5486  */
5487 tBleStatus aci_hal_set_tx_power_level(uint8_t En_High_Power,
5488                                       uint8_t PA_Level);
5489 /**
5490  * @brief This command returns the number of packets sent in Direct Test Mode.
5491  *        When the Direct TX test is started, a 32-bit counter is used to count
5492  *        how many packets have been transmitted.  This command can be used to
5493  *        check how many packets have been sent during the Direct TX test. The
5494  *        counter starts from 0 and counts upwards. The counter can wrap and
5495  *        start from 0 again.  The counter is not cleared until the next Direct
5496  *        TX test starts.
5497  * @param[out] Number_Of_Packets Number of packets sent during the last Direct
5498  *             TX test.
5499  * @retval Value indicating success or error code.
5500  */
5501 tBleStatus aci_hal_le_tx_test_packet_number(uint32_t *Number_Of_Packets);
5502 /**
5503  * @brief This command returns the status of the Bluetooth low energy links
5504  *        managed by the device.
5505  * @param Bank_index Index that identifies the link bank. Each bank is made by 8
5506  *        links. Set Bank_Index to 0 to retrieve the status of the first 8
5507  *        links, Bank_Index 1 to retrieve the status of the second 8 links and
5508  *        so on.
5509  *        Values:
5510  *        - 0x00 ... 0x15
5511  * @param[out] Link_Status Array of link status (8 links). Each link status is 1
5512  *             byte. - 0x00: Idle - 0x01: Advertising - 0x02: Connected as
5513  *             peripheral - 0x03: Scanning - 0x04: Initiating - 0x05: Connected
5514  *             as central - 0x06: TX test mode - 0x07: RX test mode
5515  * @param[out] Link_Connection_Handle Array of connection handles (2 bytes) for
5516  *             8 links.
5517  * @retval Value indicating success or error code.
5518  */
5519 tBleStatus aci_hal_get_link_status(uint8_t Bank_index,
5520                                    uint8_t Link_Status[8],
5521                                    uint16_t Link_Connection_Handle[16 / 2]);
5522 /**
5523  * @brief This command set the bitmask associated to @ref
5524  *        aci_hal_end_of_radio_activity_event.  Only the radio activities
5525  *        enabled in the mask will be reported to application by @ref
5526  *        aci_hal_end_of_radio_activity_event
5527  * @param Radio_Activity_Mask Bitmask of radio events
5528  *        Flags:
5529  *        - 0x0001: Idle
5530  *        - 0x0002: Advertising
5531  *        - 0x0004: Connection event peripheral
5532  *        - 0x0008: Scanning
5533  *        - 0x0010: Connection request
5534  *        - 0x0020: Connection event central
5535  *        - 0x0040: TX test mode
5536  *        - 0x0080: RX test mode
5537  * @retval Value indicating success or error code.
5538  */
5539 tBleStatus aci_hal_set_radio_activity_mask(uint16_t Radio_Activity_Mask);
5540 /**
5541  * @brief This command is used to enable or disable the LE Power Control feature
5542  *        and procedure for a given PHY on the later established connections. It
5543  *        also provides the parameters that let the Controller initiate the LE
5544  *        Power Control procedure. In particular, the procedure will be
5545  *        initiated when the current (average) RSSI (say Curr_Avg_RSSI) gets: 1)
5546  *        less than (RSSI_Target - RSSI_Hysteresis) and the Controller will
5547  *        request the peer to increase its TX power level for the given PHY by
5548  *        (RSSI_Target - Curr_Avg_RSSI); 2) greater than (RSSI_Target +
5549  *        RSSI_Hysteresis) and the Controller will request the peer to decrease
5550  *        its TX power level for the given PHY by (Curr_Avg_RSSI - RSSI_Target).
5551  *        The Controller will start transmitting on the connections for which
5552  *        the power control is enabled and for the given PHY using the
5553  *        Initial_Tx_Power value. It will change its TX power based on the
5554  *        requests or feedbacks from the peer: 1) if the peer initiates an LE
5555  *        Power Control procedure and requests to increase or decrease the TX
5556  *        power of a given delta, the TX power will be increased or reduced by
5557  *        the requested delta within the acceptable limits; 2) if the peer
5558  *        reports that it can accept a TX power reduction of a given delta, the
5559  *        TX power will be reduced by the reported delta within the acceptable
5560  *        limits. If this command is not issued, the Controller will use the
5561  *        parameter default values.
5562  * @param Enable Enable (1) or disable (0) LE power control on following
5563  *        connections. Default: 1.
5564  *        Values:
5565  *        - 0x00: DISABLE
5566  *        - 0x01: ENABLE
5567  * @param PHY PHY on which the power control must be enabled or disabled.
5568  *        Values:
5569  *        - 0x01: LE_1M_PHY
5570  *        - 0x02: LE_2M_PHY
5571  *        - 0x03: LE_CODED_PHY_S8
5572  *        - 0x04: LE_CODED_PHY_S2
5573  * @param RSSI_Target Target RSSI in dBm. Default: -55 dBm.
5574  * @param RSSI_Hysteresis Hysteresis applied on the target RSSI in dB. Default:
5575  *        15 dB.
5576  * @param Initial_TX_Power Initial TX power in dBm. Default: max TX power
5577  *        supported by the platform.
5578  * @param RSSI_Filtering_Coefficient Coefficient used for the filtering of the
5579  *        RSSI samples and the calculation of the average RSSI. Allowed values
5580  *        are from 0 (fast moving average, low accuracy, max weight of last
5581  *        RSSI) to 4 (slow moving average, high accuracy, min weight of last
5582  *        RSSI). Default: 2.
5583  *        Values:
5584  *        - 0x00 ... 0x04
5585  * @retval Value indicating success or error code.
5586  */
5587 tBleStatus aci_hal_set_le_power_control(uint8_t Enable,
5588                                         uint8_t PHY,
5589                                         int8_t RSSI_Target,
5590                                         uint8_t RSSI_Hysteresis,
5591                                         int8_t Initial_TX_Power,
5592                                         uint8_t RSSI_Filtering_Coefficient);
5593 /**
5594  * @brief Command used on the peripheral to force the Link Layer to keep the
5595  *        peripheral latency disabled. Peripheral latency is enabled by default
5596  *        on a connection where peripheral latency has been set to a value
5597  *        greaten than zero by the Central when connection is established.
5598  *        Disabling the peripheral latency is useful to immediately reduce
5599  *        latency from Central to Peripheral. Note that when peripheral latency
5600  *        is enabled, the Link Layer will use the first available connection
5601  *        event to transfer the queued data, so there is no need to force the
5602  *        disabling of the peripheral latency to reduce latency from Peripheral
5603  *        to Central. This command returns BLE_ERROR_UNKNOWN_CONNECTION_ID if
5604  *        the connection handle does not exist. BLE_ERROR_COMMAND_DISALLOWED is
5605  *        returned if the command is given when the device is not in the
5606  *        peripheral role on the connection handle.
5607  * @param Connection_Handle Connection handle that identifies the connection.
5608  *        Values:
5609  *        - 0x0000 ... 0x0EFF
5610  * @param Enable Enable (1) or disable (0) the peripheral latency. Default value
5611  *        is Enabled (1).
5612  *        Values:
5613  *        - 0x00: DISABLED
5614  *        - 0x01: ENABLED
5615  * @retval Value indicating success or error code.
5616  */
5617 tBleStatus aci_hal_peripheral_latency_enable(uint16_t Connection_Handle,
5618                                              uint8_t Enable);
5619 /**
5620  * @brief This command can be used to get the maximum used size of the stack's
5621  *        internal FIFO queues: isr1_fifo, isr2_fifo and user_fifo. These values
5622  *        can be used to chose the maximum correct size for the queues, which
5623  *        can be set through the BLE_STACK_Init() function. If one of these
5624  *        queues reaches the maximum size, an hci_hardware_error_event is
5625  *        raised, with error code 0x03.
5626  * @param[out] ISR0_FIFO_Max_Level Maximum size reached by the FIFO used for
5627  *             critical controller events produced by the ISR (e.g. rx data
5628  *             packets). See isr0_fifo_size parameter field of
5629  *             BLE_STACK_InitTypeDef structure, used by BLE_STACK_Init().
5630  * @param[out] ISR1_FIFO_Max_Level Maximum size reached by the FIFO used for
5631  *             non-critical controller events produced by the ISR (e.g.
5632  *             advertising or IQ sampling reports). See isr1_fifo_size parameter
5633  *             field of BLE_STACK_InitTypeDef structure, used by
5634  *             BLE_STACK_Init().
5635  * @param[out] User_FIFO_Max_Level Maximum size reached by the FIFO used for
5636  *             controller and host events produced outside the ISR. See
5637  *             user_fifo_size parameter field of BLE_STACK_InitTypeDef
5638  *             structure, used by BLE_STACK_Init().
5639  * @retval Value indicating success or error code.
5640  */
5641 tBleStatus aci_hal_get_evt_fifo_max_level(uint16_t *ISR0_FIFO_Max_Level,
5642                                           uint16_t *ISR1_FIFO_Max_Level,
5643                                           uint16_t *User_FIFO_Max_Level);
5644 /**
5645  * @brief Set data pointer for legacy advertising data.
5646  * @param Data_Length
5647  * @param Data
5648  * @retval Value indicating success or error code.
5649  */
5650 tBleStatus ll_set_legacy_advertising_data_ptr(uint8_t Data_Length,
5651                                               uint8_t * Data);
5652 /**
5653  * @brief Set data pointer for legacy scan response data.
5654  * @param Data_Length
5655  * @param Data
5656  * @retval Value indicating success or error code.
5657  */
5658 tBleStatus ll_set_legacy_scan_reponse_data_ptr(uint8_t Data_Length,
5659                                                uint8_t * Data);
5660 /**
5661  * @brief Set data pointer for extended advertising data.
5662  * @param Advertising_Handle Used to identify an advertising set. This parameter
5663  *        is only meaningful if Extended Advertising Feature is enabled.
5664  *        Values:
5665  *        - 0x0000 ... 0x00EF
5666  * @param Operation If set to Unchanged data, just update the Advertising DID.
5667  *        Values:
5668  *        - 0x03: Complete data
5669  *        - 0x04: Unchanged data
5670  * @param Advertising_Data_Length Length of advertising data.
5671  * @param Advertising_Data Pointer to the buffer containing properly formatted
5672  *        advertising data (see Core v5.2 Vol 3, part C, chapter 11). Its
5673  *        content must not change, until an
5674  *        aci_hal_adv_scan_resp_data_update_event is received, which informs the
5675  *        application that the buffer is no more used by the Bluetooth stack.
5676  * @retval Value indicating success or error code.
5677  */
5678 tBleStatus ll_set_advertising_data_ptr(uint16_t Advertising_Handle,
5679                                        uint8_t Operation,
5680                                        uint16_t Advertising_Data_Length,
5681                                        uint8_t Advertising_Data[]);
5682 /**
5683  * @brief Set data pointer for extended scan response data.
5684  * @param Advertising_Handle Used to identify an advertising set. This parameter
5685  *        is only meaningful if Extended Advertising Feature is enabled.
5686  *        Values:
5687  *        - 0x0000 ... 0x00EF
5688  * @param Scan_Response_Data_Length Length of scan response data. If the
5689  *        advertising set uses scannable legacy advertising PDUs maximum length
5690  *        is 31 octets.
5691  * @param Scan_Response_Data Pointer to the buffer containing properly formatted
5692  *        scan response data (see Core v5.1 Vol 3, part C, chapter 11). Its
5693  *        content must not change, until an
5694  *        aci_hal_adv_scan_resp_data_update_event is received, which informs the
5695  *        application that the buffer is no more used by the Bluetooth stack.
5696  * @retval Value indicating success or error code.
5697  */
5698 tBleStatus ll_set_scan_reponse_data_ptr(uint16_t Advertising_Handle,
5699                                         uint16_t Scan_Response_Data_Length,
5700                                         uint8_t Scan_Response_Data[]);
5701 /**
5702  * @brief Retrieves info about an existing advertising set.
5703  * @param Advertising_Handle Used to identify an advertising set.
5704  *        Values:
5705  *        - 0x0000 ... 0x00EF
5706  * @param[out] Adv_Enabled It is 1 (TRUE) if advertising is enabled for the
5707  *             given advertising handle, 0 (FALSE) otherwise.
5708  * @param[out] Periodic_Adv_Configured It is 1 (TRUE) if periodic advertising
5709  *             has been configured for the given advertising handle, 0 (FALSE)
5710  *             otherwise.
5711  * @param[out] Periodic_Adv_Enabled It is 1 (TRUE) if periodic advertising has
5712  *             been enabled for the given advertising handle, 0 (FALSE)
5713  *             otherwise. Note: periodic advertising may be enabled but not
5714  *             started; in this case Adv_Enabled is false and
5715  *             Periodic_Adv_Enable is true.
5716  * @param[out] Advertising_Event_Properties Advertising event properties that
5717  *             have been previously set for the advertising set.
5718  * @retval Value indicating success or error code.
5719  */
5720 tBleStatus ll_get_advertising_info(uint16_t Advertising_Handle,
5721                                    uint8_t *Adv_Enabled,
5722                                    uint8_t *Periodic_Adv_Configured,
5723                                    uint8_t *Periodic_Adv_Enabled,
5724                                    uint16_t *Advertising_Event_Properties);
5725 /**
5726  * @brief Set data pointer for periodic extended advertising data.
5727  * @param Advertising_Handle Used to identify an advertising set. This parameter
5728  *        is only meaningful if Extended Advertising Feature is enabled.
5729  *        Values:
5730  *        - 0x0000 ... 0x00EF
5731  * @param Operation If set to Unchanged data, just update the Advertising DID.
5732  *        Values:
5733  *        - 0x03: Complete data
5734  *        - 0x04: Unchanged data
5735  * @param Advertising_Data_Length Length of periodic advertising data.
5736  * @param Advertising_Data Pointer to the buffer containing properly formatted
5737  *        periodic advertising data (see Core v5.2 Vol 3, part C, chapter 11).
5738  *        Its content must not change, until an
5739  *        aci_hal_adv_scan_resp_data_update_event is received, which informs the
5740  *        application that the buffer is no more used by the Bluetooth stack.
5741  * @retval Value indicating success or error code.
5742  */
5743 tBleStatus ll_set_periodic_advertising_data_ptr(uint16_t Advertising_Handle,
5744                                                 uint8_t Operation,
5745                                                 uint16_t Advertising_Data_Length,
5746                                                 uint8_t Advertising_Data[]);
5747 /**
5748  * @brief Function to get the value of the last anchor point for the given
5749  *        connection.
5750  * @param Connection_Handle
5751  * @param[out] Event_Counter
5752  * @param[out] Anchor_Point
5753  * @retval Value indicating success or error code.
5754  */
5755 tBleStatus aci_hal_get_anchor_point(uint16_t Connection_Handle,
5756                                     uint16_t *Event_Counter,
5757                                     uint32_t *Anchor_Point);
5758 /**
5759  * @brief
5760  * @param Advertising_Handle It is used to identify an advertising set
5761  *        Values:
5762  *        - 0x00 ... 0xEF: Used to identify an advertising set
5763  * @param Num_Subevents Number of subevent data in the command.
5764  *        Values:
5765  *        - 0x01 ... 0x0F
5766  * @param Subevent_Data_Ptr_Parameters See @ref Subevent_Data_Ptr_Parameters_t
5767  * @retval Value indicating success or error code.
5768  */
5769 tBleStatus ll_set_periodic_advertising_subevent_data_ptr(uint8_t Advertising_Handle,
5770                                                          uint8_t Num_Subevents,
5771                                                          Subevent_Data_Ptr_Parameters_t Subevent_Data_Ptr_Parameters[]);
5772 /**
5773  * @brief The LL_Set_Periodic_Advertising_Response_Data_Ptr command is used by
5774  *        the Host to set the data for a response slot in a specific subevent of
5775  *        the PAwR identified by the Sync_Handle. The data for a response slot
5776  *        shall be transmitted only once. The Request_Event parameter identifies
5777  *        the periodic advertising event in which the periodic advertising
5778  *        packet that the Host is responding to was received. The
5779  *        Request_Subevent parameter identifies the subevent in which the
5780  *        periodic advertising packet that the Host is responding to was
5781  *        received. The Response_Subevent parameter identifies the subevent that
5782  *        the response shall be sent in. The Response_Slot parameter identifies
5783  *        the response slot in the subevent identified by the Response_Subevent
5784  *        parameter in which this response data is to be transmitted. The
5785  *        Response_Data_Length specifies the length of the Response_Data that is
5786  *        significant. The Response_Data contains the advertising data to be
5787  *        transmitted in the response slot. If the Response_Data_Length is
5788  *        greater than the maximum that the Controller can transmit within the
5789  *        response slot, then the Response_Data shall be discarded and the
5790  *        Controller shall return the error code Packet Too Long (0x45). If
5791  *        advertising on the LE Coded PHY, then the S=8 coding shall be assumed
5792  *        unless the current advertising parameters require the use of S=2 for
5793  *        an advertising physical channel, in which case the S=2 coding shall be
5794  *        assumed for that advertising physical channel. If the response slot
5795  *        identified by the Response_Slot parameter has passed by the time this
5796  *        command is received by the Controller, the Controller shall return the
5797  *        error code Too Late (0x46) and discard the Response_Data parameter.
5798  * @param Sync_Handle Sync_Handle identifying the PAwR train.
5799  *        Values:
5800  *        - 0x0000 ... 0x0EFF
5801  * @param Request_Event The value of paEventCounter (see [Vol 6] Part B, Section
5802  *        4.4.2.1) for the periodic advertising packet that the Host is
5803  *        responding to.
5804  * @param Request_Subevent Used to identify the subevent of the PAwR train.
5805  *        Values:
5806  *        - 0x00 ... 0x7F
5807  * @param Response_Subevent Used to identify the response slot of the PAwR
5808  *        train.
5809  * @param Response_Slot Used to identify the response slot of the PAwR train.
5810  * @param Response_Data_Length The number of octets in the Response_Data
5811  *        parameter.
5812  *        Values:
5813  *        - 0x00 ... 0xFB
5814  * @param Response_Data Pointer to response data formatted as defined in [Vol 3]
5815  *        Part C, Section 11.
5816  * @retval Value indicating success or error code.
5817  */
5818 tBleStatus ll_set_periodic_advertising_response_data_ptr(uint16_t Sync_Handle,
5819                                                          uint16_t Request_Event,
5820                                                          uint8_t Request_Subevent,
5821                                                          uint8_t Response_Subevent,
5822                                                          uint8_t Response_Slot,
5823                                                          uint8_t Response_Data_Length,
5824                                                          uint8_t* Response_Data);
5825 /**
5826  * @}
5827  */
5828 
5829 /**
5830  * @}
5831  */
5832 
5833 
5834 /**
5835  *@addtogroup GAP GAP
5836  *@brief Generic Access Profile.
5837  *@{
5838  */
5839 /**
5840  *@defgroup ACI_GAP_Commands ACI GAP Commands
5841  *@brief Commands for GAP layer.
5842  *@{
5843  */
5844 /**
5845  * @brief Initialize the GAP layer.   WARNING: A section of the Flash memory is
5846  *        used by this procedure. When this section is empty, data are written
5847  *        inside. This normally happens once during the lifetime of the device,
5848  *        when the command is executed for the first time (unless the section is
5849  *        erased). Do not power off the device while this function is writing
5850  *        into Flash memory.
5851  * @param Privacy_Type Specify if privacy is enabled or not and which one .
5852  *        Values:
5853  *        - 0x00: Privacy disabled
5854  *        - 0x01: Privacy host enabled
5855  *        - 0x02: Privacy controller enabled
5856  * @param Identity_Address_Type Specify which address has to be used as Identity
5857  *        Address. 0x00: The public address is used as identity address 0x01:
5858  *        The static random address is used as identity address
5859  *        Values:
5860  *        - 0x00: Public Address
5861  *        - 0x01: Static Random Address
5862  * @retval Value indicating success or error code.
5863  */
5864 tBleStatus aci_gap_init(uint8_t Privacy_Type,
5865                         uint8_t Identity_Address_Type);
5866 /**
5867  * @brief Set the IO capabilities of the device. This command cannot be sent
5868  *        during a pairing procedure.
5869  * @param IO_Capability IO capability of the device.
5870  *        Values:
5871  *        - 0x00: IO_CAP_DISPLAY_ONLY
5872  *        - 0x01: IO_CAP_DISPLAY_YES_NO
5873  *        - 0x02: IO_CAP_KEYBOARD_ONLY
5874  *        - 0x03: IO_CAP_NO_INPUT_NO_OUTPUT
5875  *        - 0x04: IO_CAP_KEYBOARD_DISPLAY
5876  * @retval Value indicating success or error code.
5877  */
5878 tBleStatus aci_gap_set_io_capability(uint8_t IO_Capability);
5879 /**
5880  * @brief This command shall be given to set security requirements at device
5881  *        level. MITM_Mode setting will be used only when responding to an
5882  *        incoming Peripheral Security Request or Pairing Request received from
5883  *        peer device.   It is recommended to force the use of Secure
5884  *        Connections for pairing by using Secure Connections Only Mode, since
5885  *        it is the only way to protect the pairing from passive eavesdropping.
5886  *        The Pairing_Response parameter is used to control the way a pairing is
5887  *        accepted. If set to 0 (pairing response not required), pairing is
5888  *        always accepted, even for bonded devices, and no user interaction is
5889  *        required, since the response is automatically handled by the Stack
5890  *        Library.  If set to 1 (pairing response required for bonded devices
5891  *        only), the pairing is automatically accepted (no user interaction)
5892  *        except when the request comes from an already bonded device; in this
5893  *        case aci_gap_pairing_event is notified and the application has to give
5894  *        a confirmation through aci_gap_pairing_resp to accept the request to
5895  *        rebond. If Pairing_Response is set to 2 (explicit pairing response) a
5896  *        pairing confirmation is always required since aci_gap_pairing_event is
5897  *        always raised when a Pairing Request from a Central or a Peripheral
5898  *        Security Request form a Peripheral is received.   If the command is
5899  *        given during pairing, the command returns BLE_STATUS_NOT_ALLOWED.  The
5900  *        command returns BLE_STATUS_INVALID_PARAMS if some of the parameters
5901  *        are out of admitted range. If KeyPress_Notification_Support is set to
5902  *        1 but Secure Connection feature is not supported,
5903  *        BLE_ERROR_UNSUPPORTED_FEATURE is returned.
5904  * @param Bonding_Mode Bonding mode. Only if bonding is enabled (0x01), the
5905  *        bonding information is stored in flash
5906  *        Values:
5907  *        - 0x00: NO_BONDING
5908  *        - 0x01: BONDING
5909  * @param MITM_Mode MITM mode.
5910  *        Values:
5911  *        - 0x00: MITM_PROTECTION_NOT_REQUIRED
5912  *        - 0x01: MITM_PROTECTION_REQUIRED
5913  * @param SC_Support LE Secure connections support. Secure Connections Only Mode
5914  *        (0x02) is the recommended value. However it is no compatible with old
5915  *        devices not supporting LE Secure Connections. - 0x00: Secure
5916  *        Connections Pairing not supported. - 0x01: Secure Connections Pairing
5917  *        supported but optional. - 0x02: Secure Connections Pairing supported
5918  *        and mandatory (SC Only Mode). This is the recommended value.
5919  *        Values:
5920  *        - 0x00: SC_IS_NOT_SUPPORTED
5921  *        - 0x01: SC_IS_SUPPORTED
5922  *        - 0x02: SC_IS_MANDATORY
5923  * @param KeyPress_Notification_Support Keypress notification support
5924  *        Values:
5925  *        - 0x00: KEYPRESS_IS_NOT_SUPPORTED
5926  *        - 0x01: KEYPRESS_IS_SUPPORTED
5927  * @param Min_Encryption_Key_Size Minimum encryption key size to be used during
5928  *        pairing
5929  *        Values:
5930  *        - 7 ... 16
5931  * @param Max_Encryption_Key_Size Maximum encryption key size to be used during
5932  *        pairing
5933  *        Values:
5934  *        - 7 ... 16
5935  * @param Pairing_Response This parameter controls how pairing confirmation is
5936  *        managed.
5937  *        Values:
5938  *        - 0x00: GAP_PAIRING_RESP_NONE
5939  *        - 0x01: GAP_PAIRING_RESP_FOR_BONDED_DEVICES
5940  *        - 0x02: GAP_PAIRING_RESP_FOR_ALL
5941  * @retval Value indicating success or error code.
5942  */
5943 tBleStatus aci_gap_set_security_requirements(uint8_t Bonding_Mode,
5944                                              uint8_t MITM_Mode,
5945                                              uint8_t SC_Support,
5946                                              uint8_t KeyPress_Notification_Support,
5947                                              uint8_t Min_Encryption_Key_Size,
5948                                              uint8_t Max_Encryption_Key_Size,
5949                                              uint8_t Pairing_Response);
5950 /**
5951  * @brief This command should be send by the host in response to @ref
5952  *        aci_gap_passkey_req_event event. The command parameter contains the
5953  *        pass key which will be used during the pairing process.
5954  * @param Connection_Handle Connection handle that identifies the connection.
5955  *        Values:
5956  *        - 0x0000 ... 0x0EFF
5957  * @param Passkey Pass key that will be used during the pairing process.  Must
5958  *        be a six-digit decimal number.
5959  *        Values:
5960  *        - 0 ... 999999
5961  * @retval Value indicating success or error code.
5962  */
5963 tBleStatus aci_gap_passkey_resp(uint16_t Connection_Handle,
5964                                 uint32_t Passkey);
5965 /**
5966  * @brief This command sets the security level for the given connection (LE
5967  *        security mode 1), by enabling encryption if needed. It will just
5968  *        enable encryption on the link if the peer is bonded with at least the
5969  *        specified security level. Otherwise, it will start a pairing with the
5970  *        peer device. This command may be given either on a Central or on a
5971  *        Peripheral device.  The Security_Level indicates the minimum Security
5972  *        Level to be achieved: 1 for no security (no authentication or
5973  *        encryption), 2 for unauthenticated pairing with encryption, 3 for
5974  *        authenticated pairing with encryption, 4 for authenticated LE Secure
5975  *        Connections pairing with encryption using a 128-bit strength
5976  *        encryption key.
5977  * @param Connection_Handle Connection handle that identifies the connection.
5978  *        Values:
5979  *        - 0x0000 ... 0x0EFF
5980  * @param Security_Level Indicates the minimum Security Level to be achieved.
5981  *        Values:
5982  *        - 0x01: GAP_SECURITY_LEVEL_1
5983  *        - 0x02: GAP_SECURITY_LEVEL_2
5984  *        - 0x03: GAP_SECURITY_LEVEL_3
5985  *        - 0x04: GAP_SECURITY_LEVEL_4
5986  * @param Force_Pairing
5987  * @retval Value indicating success or error code.
5988  */
5989 tBleStatus aci_gap_set_security(uint16_t Connection_Handle,
5990                                 uint8_t Security_Level,
5991                                 uint8_t Force_Pairing);
5992 /**
5993  * @brief This command can be used to get the current security settings of the
5994  *        device.
5995  * @param Connection_Handle Connection handle that identifies the connection.
5996  *        Values:
5997  *        - 0x0000 ... 0x0EFF
5998  * @param[out] Security_Mode Security mode.
5999  *             Values:
6000  *             - 0x01: Security Mode 1
6001  *             - 0x02: Security Mode 2
6002  * @param[out] Security_Level Security Level.
6003  *             Values:
6004  *             - 0x01: Security Level 1
6005  *             - 0x02: Security Level 2
6006  *             - 0x03: Security Level 3
6007  *             - 0x04: Security Level 4
6008  * @retval Value indicating success or error code.
6009  */
6010 tBleStatus aci_gap_get_security_level(uint16_t Connection_Handle,
6011                                       uint8_t *Security_Mode,
6012                                       uint8_t *Security_Level);
6013 /**
6014  * @brief
6015  * @param LE_Event_Mask LE event mask. Default: 0x000000000000001F.
6016  *        Flags:
6017  *        - 0x0000000000000000: No LE events specified
6018  *        - 0x0000000000000001: LE Connection Complete Event
6019  *        - 0x0000000000000002: LE Advertising Report Event
6020  *        - 0x0000000000000004: LE Connection Update Complete Event
6021  *        - 0x0000000000000008: LE Read Remote Used Features Complete Event
6022  *        - 0x0000000000000010: LE Long Term Key Request Event
6023  *        - 0x0000000000000020: LE Remote Connection Parameter Request Event
6024  *        - 0x0000000000000040: LE Data Length Change Event
6025  *        - 0x0000000000000080: LE Read Local P-256 Public Key Complete Event
6026  *        - 0x0000000000000100: LE Generate DHKey Complete Event
6027  *        - 0x0000000000000200: LE Enhanced Connection Complete Event
6028  *        - 0x0000000000000400: LE Directed Advertising Report Event
6029  *        - 0x0000000000000800: LE PHY Update Complete event
6030  *        - 0x0000000000001000: LE Extended Advertising Report event
6031  *        - 0x0000000000002000: LE Periodic Advertising Sync Established event
6032  *        - 0x0000000000004000: LE Periodic Advertising Report event
6033  *        - 0x0000000000008000: LE Periodic Advertising Sync Lost event
6034  *        - 0x0000000000010000: LE Scan Timeout event
6035  *        - 0x0000000000020000: LE Advertising Set Terminated event
6036  *        - 0x0000000000040000: LE Scan Request Received event
6037  *        - 0x0000000000080000: LE Channel Selection Algorithm event
6038  *        - 0x0000000000100000: LE Connectionless IQ Report event
6039  *        - 0x0000000000200000: LE Connection IQ Report event
6040  *        - 0x0000000000400000: LE CTE Request Failed event
6041  *        - 0x0000000000800000: LE Periodic Advertising Sync Transfer Received event
6042  *        - 0x0000000001000000: LE CIS Established event
6043  *        - 0x0000000002000000: LE CIS Request event
6044  *        - 0x0000000004000000: LE Create BIG Complete event
6045  *        - 0x0000000008000000: LE Terminate BIG Complete event
6046  *        - 0x0000000010000000: LE BIG Sync Established event
6047  *        - 0x0000000020000000: LE BIG Sync Lost event
6048  *        - 0x0000000040000000: LE Request Peer SCA Complete event
6049  *        - 0x0000000080000000: LE Path Loss Threshold event
6050  *        - 0x0000000100000000: LE Transmit Power Reporting event
6051  *        - 0x0000000200000000: LE BIGInfo Advertising Report event
6052  *        - 0x0000000400000000: LE Subrate Change event
6053  *        - 0x0000000800000000: LE Periodic Advertising Sync Established event [v2]
6054  *        - 0x0000001000000000: LE Periodic Advertising Report event [v2]
6055  *        - 0x0000002000000000: LE Periodic Advertising Sync Transfer Received event [v2]
6056  *        - 0x0000004000000000: LE Periodic Advertising Subevent Data Request event
6057  *        - 0x0000008000000000: LE Periodic Advertising Response Report event
6058  *        - 0x0000010000000000: LE Enhanced Connection Complete event [v2]
6059  * @retval Value indicating success or error code.
6060  */
6061 tBleStatus aci_gap_set_le_event_mask(uint8_t LE_Event_Mask[8]);
6062 /**
6063  * @brief Command the controller to terminate the connection. A @ref
6064  *        hci_disconnection_complete_event will be generated when the link is
6065  *        disconnected. After this event is received, the Bluetooth stack may
6066  *        request to save GATT database information in non-volatile memory. So
6067  *        it is important not to reset or power off the system immediately after
6068  *        @ref hci_disconnection_complete_event is received. This operation is
6069  *        normally completed within less than few milliseconds.
6070  * @param Connection_Handle Connection handle that identifies the connection.
6071  *        Values:
6072  *        - 0x0000 ... 0x0EFF
6073  * @param Reason The reason for ending the connection.
6074  *        Values:
6075  *        - 0x05: Authentication Failure
6076  *        - 0x13: Remote User Terminated Connection
6077  *        - 0x14: Remote Device Terminated Connection due to Low Resources
6078  *        - 0x15: Remote Device Terminated Connection due to Power Off
6079  *        - 0x1A: Unsupported Remote Feature
6080  *        - 0x3B: Unacceptable Connection Parameters
6081  * @retval Value indicating success or error code.
6082  */
6083 tBleStatus aci_gap_terminate(uint16_t Connection_Handle,
6084                              uint8_t Reason);
6085 /**
6086  * @brief Clear the security database. All the devices in the security database
6087  *        will be removed. ATTENTION: It is strongly recommended not to give
6088  *        this command during intense radio activity (e.g. during advertising or
6089  *        connection with short intervals, i.e. less than 30 ms, or during
6090  *        scanning), since it will trigger an erase of a Flash sector. After
6091  *        this command, all devices previously recorded in the bonding table and
6092  *        connected when command has been submitted will remain connected,
6093  *        preserving authentication and encryption of the link.
6094  * @retval Value indicating success or error code.
6095  */
6096 tBleStatus aci_gap_clear_security_db(void);
6097 /**
6098  * @brief This command shall be given in response to an aci_gap_paring_event, to
6099  *        allow or reject either the pairing request from the Central or the
6100  *        security request from the Peripheral.
6101  * @param Connection_Handle Connection handle that identifies the connection.
6102  *        Values:
6103  *        - 0x0000 ... 0x0EFF
6104  * @param Accept
6105  *        Values:
6106  *        - 0x00: REJECT
6107  *        - 0x01: ACCEPT
6108  * @retval Value indicating success or error code.
6109  */
6110 tBleStatus aci_gap_pairing_resp(uint16_t Connection_Handle,
6111                                 uint8_t Accept);
6112 /**
6113  * @brief Creates a direct connection to a device.
6114  * @param Initiating_PHY PHYs that will be used for initiating the connection.
6115  *        Flags:
6116  *        - 0x01: LE_1M_PHY_BIT
6117  *        - 0x04: LE_CODED_PHY_BIT
6118  * @param Peer_Address_Type The Peer_Address_Type parameter indicates the type
6119  *        of address used in the connectable advertisement sent by the peer. 0:
6120  *        Public Device Address or Public Identity Address 1: Random Device
6121  *        Address or Random (static) Identity Address
6122  *        Values:
6123  *        - 0x00: Public Address
6124  *        - 0x01: Random Address
6125  * @param Peer_Address Public Device Address, Random Device Address, Public
6126  *        Identity Address, or Random (static) Identity Address of the device to
6127  *        be connected.
6128  * @retval Value indicating success or error code.
6129  */
6130 tBleStatus aci_gap_create_connection(uint8_t Initiating_PHY,
6131                                      uint8_t Peer_Address_Type,
6132                                      uint8_t Peer_Address[6]);
6133 /**
6134  * @brief Terminate the specified GAP procedure. An @ref
6135  *        aci_gap_proc_complete_event event is generated when the procedure has
6136  *        been completed, with the procedure code set to the corresponding
6137  *        procedure.
6138  * @param Procedure_Code Code identifying the procedure.
6139  *        Values:
6140  *        - 0x00: GAP_LIMITED_DISCOVERY_PROC
6141  *        - 0x01: GAP_GENERAL_DISCOVERY_PROC
6142  *        - 0x02: GAP_AUTO_CONNECTION_ESTABLISHMENT_PROC
6143  *        - 0x03: GAP_GENERAL_CONNECTION_ESTABLISHMENT_PROC
6144  *        - 0x04: GAP_SELECTIVE_CONNECTION_ESTABLISHMENT_PROC
6145  *        - 0x05: GAP_OBSERVATION_PROC
6146  *        - 0x06: GAP_DIRECT_CONNECTION_ESTABLISHMENT_PROC
6147  *        - 0x07: GAP_NAME_DISCOVERY_PROC
6148  * @retval Value indicating success or error code.
6149  */
6150 tBleStatus aci_gap_terminate_proc(uint8_t Procedure_Code);
6151 /**
6152  * @brief Start the connection update procedure (only when role is Central). A
6153  *        @ref hci_le_connection_update is called. On completion of the
6154  *        procedure, an @ref hci_le_connection_update_complete_event event is
6155  *        returned to the upper layer.
6156  * @param Connection_Handle Connection handle that identifies the connection.
6157  *        Values:
6158  *        - 0x0000 ... 0x0EFF
6159  * @param Connection_Interval_Min Minimum value for the connection event
6160  *        interval. This shall be less than or equal to Connection_Interval_Max.
6161  *        Time = N * 1.25 msec.
6162  *        Values:
6163  *        - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
6164  * @param Connection_Interval_Max Maximum value for the connection event
6165  *        interval. This shall be greater than or equal to
6166  *        Connection_Interval_Min. Time = N * 1.25 msec.
6167  *        Values:
6168  *        - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
6169  * @param Max_Latency Maximum Peripheral latency for the connection in number of
6170  *        connection events.
6171  *        Values:
6172  *        - 0x0000 ... 0x01F3
6173  * @param Supervision_Timeout Supervision timeout for the LE Link. It shall be a
6174  *        multiple of 10 ms and larger than (1 + connPeripheralLatency) *
6175  *        connInterval * 2. Time = N * 10 msec.
6176  *        Values:
6177  *        - 0x000A (100 ms)  ... 0x0C80 (32000 ms)
6178  * @param Min_CE_Length The minimum length of connection event recommended for
6179  *        this LE connection. Time = N * 0.625 msec.
6180  * @param Max_CE_Length The maximum length of connection event recommended for
6181  *        this LE connection. Time = N * 0.625 msec.
6182  * @retval Value indicating success or error code.
6183  */
6184 tBleStatus aci_gap_start_connection_update(uint16_t Connection_Handle,
6185                                            uint16_t Connection_Interval_Min,
6186                                            uint16_t Connection_Interval_Max,
6187                                            uint16_t Max_Latency,
6188                                            uint16_t Supervision_Timeout,
6189                                            uint16_t Min_CE_Length,
6190                                            uint16_t Max_CE_Length);
6191 /**
6192  * @brief This command tries to resolve the address provided with the IRKs
6193  *        present in its database. If the address is resolved successfully with
6194  *        any one of the IRKs present in the database, it returns success and
6195  *        also the corresponding public/static random address stored with the
6196  *        IRK in the database.
6197  * @param Address Address to be resolved
6198  * @param[out] Actual_Address The public or static random address of the peer
6199  *             device, distributed during pairing phase.
6200  * @retval Value indicating success or error code.
6201  */
6202 tBleStatus aci_gap_resolve_private_addr(uint8_t Address[6],
6203                                         uint8_t Actual_Address[6]);
6204 /**
6205  * @brief This command returns the identity addresses of the bonded devices.
6206  * @param Offset Index of the first record to be returned.
6207  * @param Max_Num_Of_Addresses Used to specify the maximum number of devices to
6208  *        be returned.
6209  * @param[out] Num_of_Addresses The number of bonded devices returned by this
6210  *             command.
6211  * @param[out] Bonded_Device_Entry See @ref Bonded_Device_Entry_t
6212  * @retval Value indicating success or error code.
6213  */
6214 tBleStatus aci_gap_get_bonded_devices(uint8_t Offset,
6215                                       uint8_t Max_Num_Of_Addresses,
6216                                       uint8_t *Num_of_Addresses,
6217                                       Bonded_Device_Entry_t Bonded_Device_Entry[]);
6218 /**
6219  * @brief The command finds whether the device, whose address is specified in
6220  *        the command, is bonded. If the device is using a resolvable private
6221  *        address and it has been bonded, then the command will return
6222  *        BLE_STATUS_SUCCESS.
6223  * @param Peer_Address_Type Address type.
6224  *        Values:
6225  *        - 0x00: Public Device Address
6226  *        - 0x01: Random Device Address
6227  * @param Peer_Address Address used by the peer device while advertising
6228  * @retval Value indicating success or error code.
6229  */
6230 tBleStatus aci_gap_is_device_bonded(uint8_t Peer_Address_Type,
6231                                     uint8_t Peer_Address[6]);
6232 /**
6233  * @brief This command allows the User to validate/confirm or not the Numeric
6234  *        Comparison value showed through the
6235  *        ACI_GAP_Numeric_Comparison_Value_Event.
6236  * @param Connection_Handle Connection handle that identifies the connection.
6237  *        Values:
6238  *        - 0x0000 ... 0x0EFF
6239  * @param Confirm_Yes_No 0 : The Numeric Values showed on both local and peer
6240  *        device are different! 1 : The Numeric Values showed on both local and
6241  *        peer device are equal!
6242  *        Values:
6243  *        - 0x00: No
6244  *        - 0x01: YES
6245  * @retval Value indicating success or error code.
6246  */
6247 tBleStatus aci_gap_numeric_comparison_value_confirm_yesno(uint16_t Connection_Handle,
6248                                                           uint8_t Confirm_Yes_No);
6249 /**
6250  * @brief This command permits to signal to the Stack the input type detected
6251  *        during Passkey input.
6252  * @param Connection_Handle Connection handle that identifies the connection.
6253  *        Values:
6254  *        - 0x0000 ... 0x0EFF
6255  * @param Input_Type Passkey input type detected
6256  *        Values:
6257  *        - 0x00: Passkey entry started
6258  *        - 0x01: Passkey digit entered
6259  *        - 0x02: Passkey digit erased
6260  *        - 0x03: Passkey cleared
6261  *        - 0x04: Passkey entry completed
6262  * @retval Value indicating success or error code.
6263  */
6264 tBleStatus aci_gap_passkey_input(uint16_t Connection_Handle,
6265                                  uint8_t Input_Type);
6266 /**
6267  * @brief This command can be used to get the local OOB authentication for LE
6268  *        Secure connections or the remote Temporary Key for Legacy Pairing set
6269  *        through aci_gap_set_oob_data(). This command is particularly useful in
6270  *        case of LE Secure Connections to retrieve the local OOB data generated
6271  *        with aci_gap_set_oob_data(). This data should then be sent to the peer
6272  *        through the OOB channel.
6273  * @param OOB_Data_Type OOB Data type. - 0x00: Legacy Pairing (LP) v.4.1 TK
6274  *        (Temporary Key) - 0x01: Secure Connections (SC) v.4.2 Random value r
6275  *        used for generation of Confirm value - 0x02: Secure Connections (SC)
6276  *        v.4.2 Confirm value C generated through AES-CMAC-128 based
6277  *        cryptographic function: C=f4(PKx, PKx, r, 0)
6278  *        Values:
6279  *        - 0x00: SM_TK
6280  *        - 0x01: SM_RANDOM_VALUE
6281  *        - 0x02: SM_CONFIRM_VALUE
6282  * @param[out] Address_Type Identity address type.
6283  *             Values:
6284  *             - 0x00: Public Identity Address
6285  *             - 0x01: Random (static) Identity Address
6286  * @param[out] Address Public or Random (static) address of this device
6287  * @param[out] OOB_Data_Len Length of OOB Data carried by next data field
6288  * @param[out] OOB_Data OOB Data to be exported via OOB.
6289  * @retval Value indicating success or error code.
6290  */
6291 tBleStatus aci_gap_get_oob_data(uint8_t OOB_Data_Type,
6292                                 uint8_t *Address_Type,
6293                                 uint8_t Address[6],
6294                                 uint8_t *OOB_Data_Len,
6295                                 uint8_t OOB_Data[16]);
6296 /**
6297  * @brief This command can be used to input the Authentication data exchanged
6298  *        via OOB channel: either local authentication data to be sent to the
6299  *        peer device through the OOB channel or the peer device authentication
6300  *        data received through OOB channel. Moreover, it can also be used to
6301  *        generate authentication data for LE Secure Connections.  Device_Type
6302  *        must be set to 0x00 (Local Device) to provide or generate local
6303  *        authentication data that will be sent to the peer through OOB channel.
6304  *        In this case Address_Type and Address parameters are ignored. With
6305  *        Device_Type=0 and OOB_Data_Len=0x00, OOB_Data_Type is ignored and the
6306  *        command triggers an automatic generation of OOB Authentication data r
6307  *        and C (that can be read with aci_gap_get_oob_data()), used for Secure
6308  *        Connections, otherwise the OOB_Data carried by the command will
6309  *        overwrite the current local authentication OOB Data. To generate OOB
6310  *        authentication data, the stack requires the availability of the local
6311  *        Public Key, to be previously generated with
6312  *        hci_le_read_local_p256_public_key command.  When peer authentication
6313  *        data are received through OOB channel for either Legacy Pairing or
6314  *        Secure Connections, aci_gap_set_oob_data() must be called with
6315  *        Device_Type set to 0x01 (Remote Device): the command will set the OOB
6316  *        data for the specified remote device (only one device at a time is
6317  *        supported).  For Legacy pairing, the TK must be provided as both local
6318  *        and remote data.
6319  * @param Device_Type If Device_Type is 0x00 (Local Device), it sets the local
6320  *        OOB authentication data. If Device_Type is 0x01 (Remote Device), the
6321  *        command sets the OOB data for the specified remote device (only one
6322  *        device at a time is supported).
6323  *        Values:
6324  *        - 0x00: Local device
6325  *        - 0x01: Remote device
6326  * @param Address_Type Identity address type of the remote device. Ignored if
6327  *        Device_Type is 0.
6328  *        Values:
6329  *        - 0x00: Public Identity Address
6330  *        - 0x01: Random (static) Identity Address
6331  * @param Address Public or Random (static) address of the peer device. Ignored
6332  *        if Device_Type is 0.
6333  * @param OOB_Data_Type OOB Data type. - 0x00: Legacy Pairing (LP) v.4.1 TK
6334  *        (Temporary Key) - 0x01: Secure Connections (SC) v.4.2 Random value r
6335  *        used for generation of Confirm value - 0x02: Secure Connections (SC)
6336  *        v.4.2 Confirm value C generated through AES-CMAC-128 based
6337  *        cryptographic function: C=f4(PKx, PKx, r, 0)
6338  *        Values:
6339  *        - 0x00: SM_TK
6340  *        - 0x01: SM_RANDOM_VALUE
6341  *        - 0x02: SM_CONFIRM_VALUE
6342  * @param OOB_Data_Len Length of OOB Data carried by next data field. It may be
6343  *        set to 0x00 to trigger the automatic generation of local Random and
6344  *        Confirm values for LE Secure Connections pairing.
6345  *        Values:
6346  *        - 0x00 ... 0x10
6347  * @param OOB_Data OOB Data to be exported via OOB.
6348  * @retval Value indicating success or error code.
6349  */
6350 tBleStatus aci_gap_set_oob_data(uint8_t Device_Type,
6351                                 uint8_t Address_Type,
6352                                 uint8_t Address[6],
6353                                 uint8_t OOB_Data_Type,
6354                                 uint8_t OOB_Data_Len,
6355                                 uint8_t OOB_Data[16]);
6356 /**
6357  * @brief This command can be used to remove a specified device from the bonding
6358  *        table. ATTENTION: the device removed from the Bonding Table will
6359  *        preserve its connection and authentication, until explicit
6360  *        disconnection is requested by the user.
6361  * @param Peer_Identity_Address_Type Identity address type.
6362  *        Values:
6363  *        - 0x00: Public Identity Address
6364  *        - 0x01: Random (static) Identity Address
6365  * @param Peer_Identity_Address Public or Random (static) Identity address of
6366  *        the peer device
6367  * @retval Value indicating success or error code.
6368  */
6369 tBleStatus aci_gap_remove_bonded_device(uint8_t Peer_Identity_Address_Type,
6370                                         uint8_t Peer_Identity_Address[6]);
6371 /**
6372  * @brief This commands configures the advertising parameters for the legacy
6373  *        advertising or for a given extended advertising set. For general or
6374  *        limited discoverable mode or connectable advertising, Flags AD type
6375  *        must be present in advertising data. See also Bluetooth Core
6376  *        specifications, Vol. 4, part E, section 7.8.53 (LE Set Extended
6377  *        Advertising Parameters command).
6378  * @param Advertising_Handle Used to identify an advertising set. This parameter
6379  *        is only meaningful if Extended Advertising Feature is enabled.
6380  *        Values:
6381  *        - 0x00 ... 0xEF
6382  * @param Discoverable_Mode Specifies the discoverable mode of the device.
6383  *        Values:
6384  *        - 0: Not Discoverable
6385  *        - 1: Limited Discoverable
6386  *        - 2: General Discoverable
6387  *        - 3: Broadcast
6388  * @param Advertising_Event_Properties The Advertising_Event_Properties
6389  *        parameter describes the type of advertising event that is being
6390  *        configured and its basic properties according to V5.1, Vol 2, Part E,
6391  *        section 7.8.53.
6392  *        Flags:
6393  *        - 0x0001: Connectable
6394  *        - 0x0002: Scannable
6395  *        - 0x0004: Directed
6396  *        - 0x0008: High Duty Cycle Directed Connectable
6397  *        - 0x0010: Legacy
6398  *        - 0x0020: Anonymous
6399  *        - 0x0040: Include TX Power
6400  * @param Primary_Advertising_Interval_Min Minimum advertising interval for
6401  *        undirected and low duty cycle directed advertising. Time = N * 0.625
6402  *        msec.
6403  *        Values:
6404  *        - 0x00000020 (20.000 ms)  ... 0x00FFFFFF (10485759.375 ms)
6405  * @param Primary_Advertising_Interval_Max Maximum advertising interval for
6406  *        undirected and low duty cycle directed advertising. Time = N * 0.625
6407  *        msec.
6408  *        Values:
6409  *        - 0x00000020 (20.000 ms)  ... 0x00FFFFFF (10485759.375 ms)
6410  * @param Primary_Advertising_Channel_Map It is a bit field that indicates the
6411  *        advertising channels that shall be used when transmitting advertising
6412  *        packets.
6413  *        Flags:
6414  *        - 0x01: CH_37
6415  *        - 0x02: CH_38
6416  *        - 0x04: CH_39
6417  * @param Peer_Address_Type The peer address type.
6418  *        Values:
6419  *        - 0x00: Public
6420  *        - 0x01: Random
6421  * @param Peer_Address Public Device Address, Random Device Address, Public
6422  *        Identity Address, or Random (static) Identity Address of the device to
6423  *        be connected.
6424  * @param Advertising_Filter_Policy Advertising Filter Policy. If Directed
6425  *        advertising is selected, the Peer_Address_Type and Peer_Address shall
6426  *        be valid and the Advertising_Filter_Policy parameter shall be ignored.
6427  *        0x00 Process scan and connection requests from all devices (i.e., the
6428  *        Filter Accept List is not in use) 0x01 Process connection requests
6429  *        from all devices and scan requests only from devices that are in the
6430  *        Filter Accept List 0x02 Process scan requests from all devices and
6431  *        connection requests only from devices that are in the Filter Accept
6432  *        List. 0x03 Process scan and connection requests only from devices in
6433  *        the Filter Accept List. All other values Reserved for future use
6434  *        Values:
6435  *        - 0x00: Scan and Connection requests from any
6436  *        - 0x01: Connection requests from any, scan requests from Filter Accept List only
6437  *        - 0x02: Scan requests from any, connection requests from Filter Accept List only
6438  *        - 0x03: Scan and connection requests from Filter Accept List only
6439  * @param Advertising_Tx_Power The Advertising_Tx_Power parameter indicates the
6440  *        maximum power level at which the advertising packets are to be
6441  *        transmitted on the advertising channels. The Controller shall choose a
6442  *        power level lower than or equal to the one specified by the Host.
6443  *        (Units: dBm). This parameter is ignored if extended advertising is not
6444  *        enabled.
6445  *        Values:
6446  *        - -127 ... 126
6447  *        - 127: No preference
6448  * @param Primary_Advertising_PHY The Primary_Advertising_PHY parameter
6449  *        indicates the PHY on which the advertising packets are transmitted on
6450  *        the primary advertising channel. If legacy advertising PDUs are being
6451  *        used, the Primary_Advertising_PHY shall indicate the LE 1M PHY. This
6452  *        parameter is ignored if extended advertising is not enabled.
6453  *        Values:
6454  *        - 0x01: LE_1M_PHY
6455  *        - 0x03: LE_CODED_PHY
6456  * @param Secondary_Advertising_Max_Skip The Secondary_Advertising_Max_Skip
6457  *        parameter is the maximum number of advertising events that can be
6458  *        skipped before the AUX_ADV_IND can be sent. This parameter is ignored
6459  *        if extended advertising is not enabled. 0x00 AUX_ADV_IND shall be sent
6460  *        prior to the next advertising event 0x01-0xFF Maximum advertising
6461  *        events the Controller can skip before sending the AUX_ADV_IND packets
6462  *        on the secondary advertising channel
6463  * @param Secondary_Advertising_PHY The Secondary_Advertising_PHY parameter
6464  *        indicates the PHY on which the advertising packets are be transmitted
6465  *        on the secondary advertising channel. This parameter is ignored if
6466  *        extended advertising is not enabled.
6467  *        Values:
6468  *        - 0x01: LE_1M_PHY
6469  *        - 0x02: LE_2M_PHY
6470  *        - 0x03: LE_CODED_PHY
6471  * @param Advertising_SID The Advertising_SID parameter specifies the value to
6472  *        be transmitted in the Advertising SID subfield of the ADI field of the
6473  *        Extended Header of those advertising channel PDUs that have an ADI
6474  *        field. If the advertising set only uses PDUs that do not contain an
6475  *        ADI field, Advertising_SID is ignored. This parameter is ignored if
6476  *        extended advertising is not enabled.
6477  *        Values:
6478  *        - 0x00 ... 0x0F
6479  * @param Scan_Request_Notification_Enable The Scan_Request_Notification_Enable
6480  *        parameter indicates whether the Controller shall send notifications
6481  *        upon the receipt of a scan request PDU that is in response to an
6482  *        advertisement from the specified advertising set that contains its
6483  *        device address and is from a scanner that is allowed by the
6484  *        advertising filter policy. This parameter is ignored if extended
6485  *        advertising is not enabled.
6486  *        Values:
6487  *        - 0x00: Scan request notifications disabled
6488  *        - 0x01: Scan request notifications enabled
6489  * @retval Value indicating success or error code.
6490  */
6491 tBleStatus aci_gap_set_advertising_configuration(uint8_t Advertising_Handle,
6492                                                  uint8_t Discoverable_Mode,
6493                                                  uint16_t Advertising_Event_Properties,
6494                                                  uint32_t Primary_Advertising_Interval_Min,
6495                                                  uint32_t Primary_Advertising_Interval_Max,
6496                                                  uint8_t Primary_Advertising_Channel_Map,
6497                                                  uint8_t Peer_Address_Type,
6498                                                  uint8_t Peer_Address[6],
6499                                                  uint8_t Advertising_Filter_Policy,
6500                                                  int8_t Advertising_Tx_Power,
6501                                                  uint8_t Primary_Advertising_PHY,
6502                                                  uint8_t Secondary_Advertising_Max_Skip,
6503                                                  uint8_t Secondary_Advertising_PHY,
6504                                                  uint8_t Advertising_SID,
6505                                                  uint8_t Scan_Request_Notification_Enable);
6506 /**
6507  * @brief This command is used to request the Controller to enable or disable
6508  *        one or more advertising sets using the advertising sets identified by
6509  *        the Advertising_Handle[i] parameter. The Controller manages the timing
6510  *        of advertisements in accordance with the advertising parameters given
6511  *        with @ref aci_gap_set_advertising_configuration command. Only the
6512  *        Enable parameter is used if extended advertising feature is disabled
6513  *        through modular configuration (CONTROLLER_EXT_ADV_SCAN_ENABLED=0),
6514  *        others are ignored. The command returns an error if adverting data are
6515  *        not set properly, according to the used discoverable mode: Flags AD
6516  *        type may be required (see @ref aci_gap_set_advertising_data). An error
6517  *        is also returned if either the length of advertising data is greater
6518  *        than 245 octets and advertising type is connectable, or if no scan
6519  *        response data is set and advertising type is scannable. See also
6520  *        Bluetooth Core specifications, Vol. 4, part E, section 7.8.56 (LE Set
6521  *        Extended Advertising Enable command).
6522  * @param Enable It allows to enable or disable one or more advertising sets
6523  *        using the advertising sets identified by the Advertising_Handle[i]
6524  *        parameter.
6525  *        Values:
6526  *        - 0x00: Disable
6527  *        - 0x01: Enable
6528  * @param Number_of_Sets The Number_of_Sets parameter is the number of
6529  *        advertising sets contained in the parameter arrays. 0x00: Disable all
6530  *        advertising sets 0x01 to 0x3F: Number of advertising sets to enable or
6531  *        disable. Ignored if extended advertising feature is disabled through
6532  *        modular configuration (CONTROLLER_EXT_ADV_SCAN_ENABLED=0).
6533  *        Values:
6534  *        - 0x00: Disable all sets
6535  *        - 0x01 ... 0x3F
6536  * @param Advertising_Set_Parameters See @ref Advertising_Set_Parameters_t
6537  * @retval Value indicating success or error code.
6538  */
6539 tBleStatus aci_gap_set_advertising_enable(uint8_t Enable,
6540                                           uint8_t Number_of_Sets,
6541                                           Advertising_Set_Parameters_t Advertising_Set_Parameters[]);
6542 /**
6543  * @brief The ACI_GAP_SET_SCAN_CONFIGURATION function configures the scan
6544  *        parameters for a given PHY. To configure more than one PHY, this
6545  *        function must be called more times.
6546  * @param Filter_Duplicates The Filter_Duplicates parameter controls whether the
6547  *        Link Layer should filter out duplicate advertising reports (filtering
6548  *        duplicates enabled) to the Host or if the Link Layer should generate
6549  *        advertising reports for each packet received (filtering duplicates
6550  *        disabled). See [Vol 6] Part B, Section 4.4.3.5.
6551  *        Values:
6552  *        - 0x00: Duplicate filtering disabled
6553  *        - 0x01: Duplicate filtering enabled
6554  *        - 0x02: Duplicate filtering enabled, reset for each scan period
6555  * @param Scanning_Filter_Policy 0x00 Accept all advertisement packets. Directed
6556  *        advertising packets which are not addressed for this device shall be
6557  *        ignored. 0x01 Ignore advertisement packets from devices not in the
6558  *        Filter Accept List Only. Directed advertising packets which are not
6559  *        addressed for this device shall be ignored 0x02 Accept all undirected
6560  *        advertisement packets. Directed advertisement packets where initiator
6561  *        address is a RPA and  Directed advertisement packets addressed to this
6562  *        device shall be accepted. 0x03 Accept all undirected advertisement
6563  *        packets from devices that are in the Filter Accept List.Directed
6564  *        advertisement packets where initiator address is RPA and Directed
6565  *        advertisement packets addressed to this device shall be accepted.
6566  *        Values:
6567  *        - 0x00: Accept All
6568  *        - 0x01: Filter Accept List Only
6569  *        - 0x02: Accept All (use resolving list)
6570  *        - 0x03: Filter Accept List Only (use resolving list)
6571  * @param Scanning_PHY PHY that is going to be configured. Only one bit can be
6572  *        set.
6573  *        Flags:
6574  *        - 0x01: LE_1M_PHY_BIT
6575  *        - 0x04: LE_CODED_PHY_BIT
6576  * @param Scan_Type The Scan_Type parameter specifies the type of scan to
6577  *        perform. 0: Passive Scanning. No scan request PDUs shall be sent. 1:
6578  *        Active Scanning. Scan request PDUs may be sent.
6579  *        Values:
6580  *        - 0x00: Passive Scanning
6581  *        - 0x01: Active Scanning
6582  * @param Scan_Interval Time interval from when the Controller started its last
6583  *        scan until it begins the subsequent scan on the primary advertising
6584  *        physical channel.  Time = N * 0.625 ms
6585  *        Values:
6586  *        - 0x0004 (2.500 ms)  ... 0xFFFF (40959.375 ms)
6587  * @param Scan_Window Time interval from when the Controller started its last
6588  *        scan until it begins the subsequent scan on the primary advertising
6589  *        physical channel. Time = N * 0.625 msec.
6590  *        Values:
6591  *        - 0x0004 (2.500 ms)  ... 0xFFFF (40959.375 ms)
6592  * @retval Value indicating success or error code.
6593  */
6594 tBleStatus aci_gap_set_scan_configuration(uint8_t Filter_Duplicates,
6595                                           uint8_t Scanning_Filter_Policy,
6596                                           uint8_t Scanning_PHY,
6597                                           uint8_t Scan_Type,
6598                                           uint16_t Scan_Interval,
6599                                           uint16_t Scan_Window);
6600 /**
6601  * @brief This function configures the connection parameters. To configure more
6602  *        than one PHY, this function must be called more times.
6603  * @param Initiating_PHY PHY that is going to be configured. Only one bit can be
6604  *        set.
6605  *        Flags:
6606  *        - 0x01: LE_1M_PHY_BIT
6607  *        - 0x02: LE_2M_PHY_BIT
6608  *        - 0x04: LE_CODED_PHY_BIT
6609  * @param Connection_Interval_Min Minimum value for the connection event
6610  *        interval. This shall be less than or equal to Connection_Interval_Max.
6611  *        Time = N * 1.25 msec.
6612  *        Values:
6613  *        - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
6614  * @param Connection_Interval_Max Maximum value for the connection event
6615  *        interval. This shall be greater than or equal to
6616  *        Connection_Interval_Min. Time = N * 1.25 msec.
6617  *        Values:
6618  *        - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
6619  * @param Max_Latency Maximum Peripheral latency for the connection in number of
6620  *        connection events.
6621  *        Values:
6622  *        - 0x0000 ... 0x01F3
6623  * @param Supervision_Timeout Supervision timeout for the LE Link. It shall be a
6624  *        multiple of 10 ms and larger than (1 + connPeripheralLatency) *
6625  *        connInterval * 2. Time = N * 10 msec.
6626  *        Values:
6627  *        - 0x000A (100 ms)  ... 0x0C80 (32000 ms)
6628  * @param Min_CE_Length The minimum length of connection event recommended for
6629  *        this LE connection. Time = N * 0.625 msec.
6630  * @param Max_CE_Length The maximum length of connection event recommended for
6631  *        this LE connection. Time = N * 0.625 msec.
6632  * @retval Value indicating success or error code.
6633  */
6634 tBleStatus aci_gap_set_connection_configuration(uint8_t Initiating_PHY,
6635                                                 uint16_t Connection_Interval_Min,
6636                                                 uint16_t Connection_Interval_Max,
6637                                                 uint16_t Max_Latency,
6638                                                 uint16_t Supervision_Timeout,
6639                                                 uint16_t Min_CE_Length,
6640                                                 uint16_t Max_CE_Length);
6641 /**
6642  * @brief Starts a GAP procedure according to the procedure code.
6643  * @param Procedure_Code Procedure to be started.
6644  *        Values:
6645  *        - 0x00: GAP_LIMITED_DISCOVERY_PROC
6646  *        - 0x01: GAP_GENERAL_DISCOVERY_PROC
6647  *        - 0x02: GAP_AUTO_CONNECTION_ESTABLISHMENT_PROC
6648  *        - 0x03: GAP_GENERAL_CONNECTION_ESTABLISHMENT_PROC
6649  *        - 0x04: GAP_SELECTIVE_CONNECTION_ESTABLISHMENT_PROC
6650  *        - 0x05: GAP_OBSERVATION_PROC
6651  * @param PHYs PHYs that will be used for Scanning or Initiating .
6652  *        Flags:
6653  *        - 0x01: LE_1M_PHY_BIT
6654  *        - 0x04: LE_CODED_PHY_BIT
6655  * @param Duration Ignored. Reserved for future use.
6656  * @param Period Ignored. Reserved for future use.
6657  * @retval Value indicating success or error code.
6658  */
6659 tBleStatus aci_gap_start_procedure(uint8_t Procedure_Code,
6660                                    uint8_t PHYs,
6661                                    uint16_t Duration,
6662                                    uint16_t Period);
6663 /**
6664  * @brief Creates a direct connection to a device and read the name
6665  *        characteristic.
6666  * @param PHYs PHYs that will be used for initiating the connection.
6667  *        Flags:
6668  *        - 0x01: LE_1M_PHY_BIT
6669  *        - 0x04: LE_CODED_PHY_BIT
6670  * @param Peer_Address_Type The Peer_Address_Type parameter indicates the type
6671  *        of address used in the connectable advertisement sent by the peer. 0:
6672  *        Public Device Address or Public Identity Address 1: Random Device
6673  *        Address or Random (static) Identity Address
6674  *        Values:
6675  *        - 0x00: Public Address
6676  *        - 0x01: Random Address
6677  * @param Peer_Address Public Device Address, Random Device Address, Public
6678  *        Identity Address, or Random (static) Identity Address of the device to
6679  *        be connected.
6680  * @retval Value indicating success or error code.
6681  */
6682 tBleStatus aci_gap_discover_name(uint8_t PHYs,
6683                                  uint8_t Peer_Address_Type,
6684                                  uint8_t Peer_Address[6]);
6685 /**
6686  * @brief Add specific device addresses to the Filter Accept and/or resolving
6687  *        list.
6688  * @param Lists Select in which list the device addresses will be added: Filter
6689  *        Accept List, resolving list or both.
6690  *        Flags:
6691  *        - 0x01: Filter Accept List
6692  *        - 0x02: Resolving List
6693  * @param Clear_Lists Clear the selected lists before adding the device
6694  *        addresses.
6695  *        Values:
6696  *        - 0x00: Do not clear
6697  *        - 0x01: Clear before adding
6698  * @param Num_of_List_Entries Number of devices that have to be added to the
6699  *        Filter Accept List.
6700  *        Values:
6701  *        - 0x00 ... 0xFF
6702  * @param List_Entry See @ref List_Entry_t
6703  * @retval Value indicating success or error code.
6704  */
6705 tBleStatus aci_gap_add_devices_to_filter_accept_and_resolving_list(uint8_t Lists,
6706                                                                    uint8_t Clear_Lists,
6707                                                                    uint8_t Num_of_List_Entries,
6708                                                                    List_Entry_t List_Entry[]);
6709 /**
6710  * @brief Clear the specified lists and add all bonded devices.
6711  * @param Lists Select in which list the device addresses will be added: Filter
6712  *        Accept List, resolving list or both.
6713  *        Flags:
6714  *        - 0x01: Filter Accept List
6715  *        - 0x02: Resolving List
6716  * @retval Value indicating success or error code.
6717  */
6718 tBleStatus aci_gap_configure_filter_accept_and_resolving_list(uint8_t Lists);
6719 /**
6720  * @brief The GAP_Remove_Advertising_Set command is used to remove an
6721  *        advertising set from the Controller. If the advertising set
6722  *        corresponding to the Advertising_Handle parameter does not exist, then
6723  *        the Controller shall return the error code Unknown Advertising
6724  *        Identifier (0x42). If advertising on the advertising set is enabled,
6725  *        then the Controller shall return the error code Command Disallowed
6726  *        (0x0C).
6727  * @param Advertising_Handle It is used to identify an advertising set
6728  *        Values:
6729  *        - 0x00 ... 0xEF: Used to identify an advertising set
6730  * @retval Value indicating success or error code.
6731  */
6732 tBleStatus aci_gap_remove_advertising_set(uint8_t Advertising_Handle);
6733 /**
6734  * @brief The GAP_Clear_Advertising_Sets command is used to remove all existing
6735  *        advertising sets from the Controller. If advertising is enabled on any
6736  *        advertising set, then the Controller shall return the error code
6737  *        Command Disallowed (0x0C). Note: All advertising sets are cleared on
6738  *        HCI reset.
6739  * @retval Value indicating success or error code.
6740  */
6741 tBleStatus aci_gap_clear_advertising_sets(void);
6742 /**
6743  * @brief The aci_gap_clear_advertising_sets
6744  * @param Advertising_Handle
6745  * @param Subevent
6746  * @param Initiator_Filter_Policy
6747  * @param Own_Address_Type
6748  * @param Peer_Address_Type
6749  * @param Peer_Address
6750  * @param Connection_Interval_Min
6751  * @param Connection_Interval_Max
6752  * @param Max_Latency
6753  * @param Supervision_Timeout
6754  * @param Min_CE_Length
6755  * @param Max_CE_Length
6756  * @retval Value indicating success or error code.
6757  */
6758 tBleStatus aci_gap_create_periodic_advertising_connection(uint8_t Advertising_Handle,
6759                                                           uint8_t Subevent,
6760                                                           uint8_t Initiator_Filter_Policy,
6761                                                           uint8_t Own_Address_Type,
6762                                                           uint8_t Peer_Address_Type,
6763                                                           uint8_t Peer_Address[6],
6764                                                           uint16_t Connection_Interval_Min,
6765                                                           uint16_t Connection_Interval_Max,
6766                                                           uint16_t Max_Latency,
6767                                                           uint16_t Supervision_Timeout,
6768                                                           uint16_t Min_CE_Length,
6769                                                           uint16_t Max_CE_Length);
6770 /**
6771  * @brief The ACI_GAP_SET_ADVERTISING_DATA function is used to set the data in
6772  *        advertising PDUs. Data must be formatted as defined in Bluetooth Core
6773  *        spec Vol. 3 Part C, Section 11.  If the device is in Limited
6774  *        Discoverable Mode, Flags data type (0x06) in advertising data must
6775  *        have the flags set as described: - The LE Limited Discoverable Mode
6776  *        flag set to one. - The 'BR/EDR Not Supported' flag set to one. - All
6777  *        other flags set to zero.  If the device is in General Discoverable
6778  *        Mode, Flags data type (0x06) in advertising data must have the flags
6779  *        set as described: - The LE General Discoverable Mode flag set to one.
6780  *        - The 'BR/EDR Not Supported' flag set to one. - All other flags set to
6781  *        zero.  If the device is in one of the other modes, Flags data type
6782  *        (0x06) in advertising data must have the flags set as described: - The
6783  *        'BR/EDR Not Supported' flag set to one. - All other flags set to zero.
6784  *        In this case (none of the discoverable modes is used), Flags data type
6785  *        may be omitted in advertising data if a device is sending non
6786  *        connectable events, otherwise it must be present.  For non-legacy
6787  *        PDUs, length of advertising data is limited to 245 octets in case of
6788  *        connectable advertising and cannot be present for scannable
6789  *        advertising. See also Bluetooth Core specifications, Vol. 4, part E,
6790  *        section 7.8.54 (LE Set Extended Advertising Data command).
6791  * @param Advertising_Handle Used to identify an advertising set. This parameter
6792  *        is only meaningful if Extended Advertising Feature is enabled.
6793  *        Values:
6794  *        - 0x00 ... 0xEF
6795  * @param Operation If set to Unchanged data, just update the Advertising DID.
6796  *        Values:
6797  *        - 0x03: Complete data
6798  *        - 0x04: Unchanged data
6799  * @param Advertising_Data_Length Length of advertising data. For legacy PDUs
6800  *        which supports advertising data maximum value is 31 octets. Data must
6801  *        be formatted as defined in Bluetooth Core spec Vol. 3 Part C, Section
6802  *        11.
6803  * @param Advertising_Data Pointer to the buffer containing properly formatted
6804  *        advertising data (see Core v5.1 Vol 3, part C, chapter 11). Its
6805  *        content must not change, until an
6806  *        aci_hal_adv_scan_resp_data_update_event is received, which informs the
6807  *        application that the buffer is no more used by the Bluetooth stack.
6808  * @retval Value indicating success or error code.
6809  */
6810 tBleStatus aci_gap_set_advertising_data(uint8_t Advertising_Handle,
6811                                         uint8_t Operation,
6812                                         uint16_t Advertising_Data_Length,
6813                                         uint8_t Advertising_Data[]);
6814 /**
6815  * @brief The ACI_GAP_SET_SCAN_RESPONSE_DATA function configures the scan
6816  *        response data as requested by the application.
6817  * @param Advertising_Handle Used to identify an advertising set. This parameter
6818  *        is only meaningful if Extended Advertising Feature is enabled.
6819  *        Values:
6820  *        - 0x00 ... 0xEF
6821  * @param Scan_Response_Data_Length Length of scan response data. If the
6822  *        advertising set uses scannable legacy advertising PDUs maximum length
6823  *        is 31 octets.
6824  * @param Scan_Response_Data Pointer to the buffer containing properly formatted
6825  *        scan response data (see Core v5.1 Vol 3, part C, chapter 11). Its
6826  *        content must not change, until an
6827  *        aci_hal_adv_scan_resp_data_update_event is received, which informs the
6828  *        application that the buffer is no more used by the Bluetooth stack.
6829  * @retval Value indicating success or error code.
6830  */
6831 tBleStatus aci_gap_set_scan_response_data(uint8_t Advertising_Handle,
6832                                           uint16_t Scan_Response_Data_Length,
6833                                           uint8_t Scan_Response_Data[]);
6834 /**
6835  * @brief
6836  * @param Session_Key
6837  * @param IV
6838  * @param Data_Length
6839  * @param Data
6840  * @param[out] Encrypted_Data
6841  * @retval Value indicating success or error code.
6842  */
6843 tBleStatus aci_gap_encrypt_adv_data(uint8_t Session_Key[16],
6844                                     uint8_t IV[8],
6845                                     uint8_t Data_Length,
6846                                     uint32_t * Data,
6847                                     uint8_t *Encrypted_Data);
6848 /**
6849  * @brief
6850  * @param Session_Key
6851  * @param IV
6852  * @param Encrypted_Data_Length
6853  * @param Encrypted_Data
6854  * @param[out] Decrypted_Data
6855  * @retval Value indicating success or error code.
6856  */
6857 tBleStatus aci_gap_decrypt_adv_data(uint8_t Session_Key[16],
6858                                     uint8_t IV[8],
6859                                     uint8_t Encrypted_Data_Length,
6860                                     uint8_t * Encrypted_Data,
6861                                     uint32_t *Decrypted_Data);
6862 /**
6863  * @}
6864  */
6865 
6866 /**
6867  * @}
6868  */
6869 
6870 
6871 /**
6872  *@addtogroup GATT GATT
6873  *@brief Generic Attribute Profile.
6874  *@{
6875  */
6876 /**
6877  *@defgroup ACI_GATT_Commands ACI GATT Commands
6878  *@brief Commands for GATT layer.
6879  *@{
6880  */
6881 /**
6882  * @brief Masks events from the GATT. The default configuration is all the
6883  *        events unmasked (enabled).
6884  * @param GATT_Evt_Mask GATT/ATT event mask.
6885  *        Values:
6886  *        - 0x00000001: ACI_GATT_ATTRIBUTE_MODIFIED_EVENT
6887  *        - 0x00000002: ACI_GATT_PROC_TIMEOUT_EVENT
6888  *        - 0x00000004: ACI_ATT_EXCHANGE_MTU_RESP_EVENT
6889  *        - 0x00000008: ACI_ATT_FIND_INFO_RESP_EVENT
6890  *        - 0x00000010: ACI_ATT_FIND_BY_TYPE_VALUE_RESP_EVENT
6891  *        - 0x00000020: ACI_ATT_READ_BY_TYPE_RESP_EVENT
6892  *        - 0x00000040: ACI_ATT_READ_RESP_EVENT
6893  *        - 0x00000080: ACI_ATT_READ_BLOB_RESP_EVENT
6894  *        - 0x00000100: ACI_ATT_READ_MULTIPLE_RESP_EVENT
6895  *        - 0x00000200: ACI_ATT_READ_BY_GROUP_TYPE_RESP_EVENT
6896  *        - 0x00000800: ACI_ATT_PREPARE_WRITE_RESP_EVENT
6897  *        - 0x00001000: ACI_ATT_EXEC_WRITE_RESP_EVENT
6898  *        - 0x00002000: ACI_GATT_INDICATION_EVENT
6899  *        - 0x00004000: ACI_GATT_NOTIFICATION_EVENT
6900  *        - 0x00008000: ACI_GATT_ERROR_RESP_EVENT
6901  *        - 0x00010000: ACI_GATT_PROC_COMPLETE_EVENT
6902  *        - 0x00020000: ACI_GATT_DISC_READ_CHAR_BY_UUID_RESP_EVENT
6903  *        - 0x00040000: ACI_GATT_TX_POOL_AVAILABLE_EVENT
6904  * @retval Value indicating success or error code.
6905  */
6906 tBleStatus aci_gatt_set_event_mask(uint32_t GATT_Evt_Mask);
6907 /**
6908  * @brief Performs an ATT MTU exchange procedure. When the ATT MTU exchange
6909  *        procedure is completed, a @ref aci_att_exchange_mtu_resp_event event
6910  *        is generated. A @ref aci_gatt_clt_proc_complete_event event is also
6911  *        generated to indicate the end of the procedure.
6912  * @param Connection_Handle Connection handle that identifies the connection.
6913  *        Values:
6914  *        - 0x0000 ... 0x0EFF
6915  * @retval Value indicating success or error code.
6916  */
6917 tBleStatus aci_gatt_clt_exchange_config(uint16_t Connection_Handle);
6918 /**
6919  * @brief Sends a Prepare Write Request. The Prepare Write Request is used to
6920  *        request the server to prepare to write the value of an attribute.  The
6921  *        responses of the procedure are given through the @ref
6922  *        aci_att_clt_prepare_write_resp_event event.  The end of the procedure
6923  *        is indicated by a @ref aci_gatt_clt_proc_complete_event.
6924  * @param Connection_Handle Connection handle that identifies the connection.
6925  *        Values:
6926  *        - 0x0000 ... 0x0EFF
6927  * @param CID Channel Identifier of the ATT bearer. It must be set to 0x0004 for
6928  *        unenhanced ATT bearer.
6929  * @param Attr_Handle Handle of the attribute to be written
6930  *        Values:
6931  *        - 0x0001 ... 0xFFFF
6932  * @param Val_Offset The offset of the first octet to be written
6933  *        Values:
6934  *        - 0 ... 511
6935  * @param Attribute_Val_Length Length of attribute value (maximum value is
6936  *        ATT_MTU - 5).
6937  * @param Attribute_Val The value of the attribute to be written
6938  * @retval Value indicating success or error code.
6939  */
6940 tBleStatus aci_gatt_clt_prepare_write_req(uint16_t Connection_Handle,
6941                                           uint16_t CID,
6942                                           uint16_t Attr_Handle,
6943                                           uint16_t Val_Offset,
6944                                           uint16_t Attribute_Val_Length,
6945                                           uint8_t Attribute_Val[]);
6946 /**
6947  * @brief Sends an Execute Write Request. The Execute Write Request is used to
6948  *        request the server to write or cancel the write of all the prepared
6949  *        values currently held in the prepare queue from this client.  The
6950  *        result of the procedure is given through the @ref
6951  *        aci_att_clt_exec_write_resp_event event.  The end of the procedure is
6952  *        indicated by a @ref aci_gatt_clt_proc_complete_event event.
6953  * @param Connection_Handle Connection handle that identifies the connection.
6954  *        Values:
6955  *        - 0x0000 ... 0x0EFF
6956  * @param CID Channel Identifier of the ATT bearer. It must be set to 0x0004 for
6957  *        unenhanced ATT bearer.
6958  * @param Execute Execute or cancel writes.
6959  *        Values:
6960  *        - 0x00: Cancel all prepared writes
6961  *        - 0x01: Immediately write all pending prepared values
6962  * @retval Value indicating success or error code.
6963  */
6964 tBleStatus aci_gatt_clt_execute_write_req(uint16_t Connection_Handle,
6965                                           uint16_t CID,
6966                                           uint8_t Execute);
6967 /**
6968  * @brief Starts the GATT client procedure to discover all primary services on
6969  *        the server. The responses of the procedure are given through the @ref
6970  *        aci_att_clt_read_by_group_type_resp_event event.
6971  * @param Connection_Handle Connection handle that identifies the connection.
6972  *        Values:
6973  *        - 0x0000 ... 0x0EFF
6974  * @param CID Channel Identifier of the ATT bearer. It must be set to 0x0004 for
6975  *        unenhanced ATT bearer.
6976  * @retval Value indicating success or error code.
6977  */
6978 tBleStatus aci_gatt_clt_disc_all_primary_services(uint16_t Connection_Handle,
6979                                                   uint16_t CID);
6980 /**
6981  * @brief Starts the procedure to discover the primary services of the specified
6982  *        UUID on the server. The responses of the procedure are given through
6983  *        the @ref aci_att_clt_find_by_type_value_resp_event event. The end of
6984  *        the procedure is indicated by a @ref aci_gatt_clt_proc_complete_event
6985  *        event.
6986  * @param Connection_Handle Connection handle that identifies the connection.
6987  *        Values:
6988  *        - 0x0000 ... 0x0EFF
6989  * @param CID Channel Identifier of the ATT bearer. It must be set to 0x0004 for
6990  *        unenhanced ATT bearer.
6991  * @param UUID_Type UUID type.
6992  *        Values:
6993  *        - 0x01: 16-bit UUID
6994  *        - 0x02: 128-bit UUID
6995  * @param UUID See @ref UUID_t
6996  * @retval Value indicating success or error code.
6997  */
6998 tBleStatus aci_gatt_clt_disc_primary_service_by_uuid(uint16_t Connection_Handle,
6999                                                      uint16_t CID,
7000                                                      uint8_t UUID_Type,
7001                                                      UUID_t *UUID);
7002 /**
7003  * @brief Starts the procedure to find all included services. The responses of
7004  *        the procedure are given through the @ref
7005  *        aci_att_clt_read_by_type_resp_event event. The end of the procedure is
7006  *        indicated by a @ref aci_gatt_clt_proc_complete_event event.
7007  * @param Connection_Handle Connection handle that identifies the connection.
7008  *        Values:
7009  *        - 0x0000 ... 0x0EFF
7010  * @param CID Channel Identifier of the ATT bearer. It must be set to 0x0004 for
7011  *        unenhanced ATT bearer.
7012  * @param Start_Handle Start attribute handle of the service
7013  *        Values:
7014  *        - 0x0001 ... 0xFFFF
7015  * @param End_Handle End attribute handle of the service
7016  *        Values:
7017  *        - 0x0001 ... 0xFFFF
7018  * @retval Value indicating success or error code.
7019  */
7020 tBleStatus aci_gatt_clt_find_included_services(uint16_t Connection_Handle,
7021                                                uint16_t CID,
7022                                                uint16_t Start_Handle,
7023                                                uint16_t End_Handle);
7024 /**
7025  * @brief Starts the procedure to discover all the characteristics of a given
7026  *        service. When the procedure is completed, a @ref
7027  *        aci_gatt_clt_proc_complete_event event is generated. Before procedure
7028  *        completion the response packets are given through @ref
7029  *        aci_att_clt_read_by_type_resp_event event.
7030  * @param Connection_Handle Connection handle that identifies the connection.
7031  *        Values:
7032  *        - 0x0000 ... 0x0EFF
7033  * @param CID Channel Identifier of the ATT bearer. It must be set to 0x0004 for
7034  *        unenhanced ATT bearer.
7035  * @param Start_Handle Start attribute handle of the service
7036  *        Values:
7037  *        - 0x0001 ... 0xFFFF
7038  * @param End_Handle End attribute handle of the service
7039  *        Values:
7040  *        - 0x0001 ... 0xFFFF
7041  * @retval Value indicating success or error code.
7042  */
7043 tBleStatus aci_gatt_clt_disc_all_char_of_service(uint16_t Connection_Handle,
7044                                                  uint16_t CID,
7045                                                  uint16_t Start_Handle,
7046                                                  uint16_t End_Handle);
7047 /**
7048  * @brief Starts the procedure to discover all the characteristics specified by
7049  *        a UUID. When the procedure is completed, a @ref
7050  *        aci_gatt_clt_proc_complete_event event is generated. Before procedure
7051  *        completion the response packets are given through @ref
7052  *        aci_gatt_clt_disc_read_char_by_uuid_resp_event event.
7053  * @param Connection_Handle Connection handle that identifies the connection.
7054  *        Values:
7055  *        - 0x0000 ... 0x0EFF
7056  * @param CID Channel Identifier of the ATT bearer. It must be set to 0x0004 for
7057  *        unenhanced ATT bearer.
7058  * @param Start_Handle Start attribute handle of the service
7059  *        Values:
7060  *        - 0x0001 ... 0xFFFF
7061  * @param End_Handle End attribute handle of the service
7062  *        Values:
7063  *        - 0x0001 ... 0xFFFF
7064  * @param UUID_Type UUID type.
7065  *        Values:
7066  *        - 0x01: 16-bit UUID
7067  *        - 0x02: 128-bit UUID
7068  * @param UUID See @ref UUID_t
7069  * @retval Value indicating success or error code.
7070  */
7071 tBleStatus aci_gatt_clt_disc_char_by_uuid(uint16_t Connection_Handle,
7072                                           uint16_t CID,
7073                                           uint16_t Start_Handle,
7074                                           uint16_t End_Handle,
7075                                           uint8_t UUID_Type,
7076                                           UUID_t *UUID);
7077 /**
7078  * @brief Starts the procedure to discover all characteristic descriptors on the
7079  *        server. When the procedure is completed, a @ref
7080  *        aci_gatt_clt_proc_complete_event event is generated. Before procedure
7081  *        completion the response packets are given through @ref
7082  *        aci_att_clt_find_info_resp_event event.
7083  * @param Connection_Handle Connection handle that identifies the connection.
7084  *        Values:
7085  *        - 0x0000 ... 0x0EFF
7086  * @param CID Channel Identifier of the ATT bearer. It must be set to 0x0004 for
7087  *        unenhanced ATT bearer.
7088  * @param Char_Handle Handle of the characteristic value
7089  *        Values:
7090  *        - 0x0001 ... 0xFFFF
7091  * @param End_Handle End handle of the characteristic
7092  *        Values:
7093  *        - 0x0001 ... 0xFFFF
7094  * @retval Value indicating success or error code.
7095  */
7096 tBleStatus aci_gatt_clt_disc_all_char_desc(uint16_t Connection_Handle,
7097                                            uint16_t CID,
7098                                            uint16_t Char_Handle,
7099                                            uint16_t End_Handle);
7100 /**
7101  * @brief Starts the procedure to read an attribute value. When the procedure is
7102  *        completed, a @ref aci_gatt_clt_proc_complete_event event is generated.
7103  *        Before procedure completion the response packet is given through @ref
7104  *        aci_att_clt_read_resp_event event.
7105  * @param Connection_Handle Connection handle that identifies the connection.
7106  *        Values:
7107  *        - 0x0000 ... 0x0EFF
7108  * @param CID Channel Identifier of the ATT bearer. It must be set to 0x0004 for
7109  *        unenhanced ATT bearer.
7110  * @param Attr_Handle Handle of the attribute to be read
7111  *        Values:
7112  *        - 0x0001 ... 0xFFFF
7113  * @retval Value indicating success or error code.
7114  */
7115 tBleStatus aci_gatt_clt_read(uint16_t Connection_Handle,
7116                              uint16_t CID,
7117                              uint16_t Attr_Handle);
7118 /**
7119  * @brief Starts the procedure to read all the characteristics specified by the
7120  *        UUID. When the procedure is completed, a @ref
7121  *        aci_gatt_clt_proc_complete_event event is generated. Before procedure
7122  *        completion the response packets are given through @ref
7123  *        aci_gatt_clt_disc_read_char_by_uuid_resp_event event.
7124  * @param Connection_Handle Connection handle that identifies the connection.
7125  *        Values:
7126  *        - 0x0000 ... 0x0EFF
7127  * @param CID Channel Identifier of the ATT bearer. It must be set to 0x0004 for
7128  *        unenhanced ATT bearer.
7129  * @param Start_Handle Starting handle of the range to be searched
7130  *        Values:
7131  *        - 0x0001 ... 0xFFFF
7132  * @param End_Handle End handle of the range to be searched
7133  *        Values:
7134  *        - 0x0001 ... 0xFFFF
7135  * @param UUID_Type UUID type.
7136  *        Values:
7137  *        - 0x01: 16-bit UUID
7138  *        - 0x02: 128-bit UUID
7139  * @param UUID See @ref UUID_t
7140  * @retval Value indicating success or error code.
7141  */
7142 tBleStatus aci_gatt_clt_read_using_char_uuid(uint16_t Connection_Handle,
7143                                              uint16_t CID,
7144                                              uint16_t Start_Handle,
7145                                              uint16_t End_Handle,
7146                                              uint8_t UUID_Type,
7147                                              UUID_t *UUID);
7148 /**
7149  * @brief Starts the procedure to read a long attribute value. the procedure is
7150  *        completed, a @ref aci_gatt_clt_proc_complete_event event is generated.
7151  *        Before procedure completion the response packets are given through
7152  *        @ref aci_att_clt_read_blob_resp_event event.
7153  * @param Connection_Handle Connection handle that identifies the connection.
7154  *        Values:
7155  *        - 0x0000 ... 0x0EFF
7156  * @param CID Channel Identifier of the ATT bearer. It must be set to 0x0004 for
7157  *        unenhanced ATT bearer.
7158  * @param Attr_Handle Handle of the attribute to be read
7159  *        Values:
7160  *        - 0x0001 ... 0xFFFF
7161  * @param Val_Offset Offset from which the value needs to be read
7162  *        Values:
7163  *        - 0 ... 511
7164  * @retval Value indicating success or error code.
7165  */
7166 tBleStatus aci_gatt_clt_read_long(uint16_t Connection_Handle,
7167                                   uint16_t CID,
7168                                   uint16_t Attr_Handle,
7169                                   uint16_t Val_Offset);
7170 /**
7171  * @brief Starts a procedure to read multiple characteristic values from a
7172  *        server. This sub-procedure is used to read multiple Characteristic
7173  *        Values from a server when the client knows the Characteristic Value
7174  *        Handles. Only values that have a known fixed size can be read, with
7175  *        the exception of the last value that can have a variable length. When
7176  *        the procedure is completed, a @ref aci_gatt_clt_proc_complete_event
7177  *        event is generated. Before procedure completion the response packets
7178  *        are given through @ref aci_att_clt_read_multiple_resp_event event. The
7179  *        response only contains a set of Characteristic Values that is less
7180  *        than or equal to (ATT_MTU - 1) octets in length. If the Set Of Values
7181  *        is greater than (ATT_MTU - 1) octets in length, only the first
7182  *        (ATT_MTU - 1) octets are included in the response.
7183  * @param Connection_Handle Connection handle that identifies the connection.
7184  *        Values:
7185  *        - 0x0000 ... 0x0EFF
7186  * @param CID Channel Identifier of the ATT bearer. It must be set to 0x0004 for
7187  *        unenhanced ATT bearer.
7188  * @param Number_of_Handles The number of handles for which the value has to be
7189  *        read. From 2 to (ATT_MTU-1)/2
7190  *        Values:
7191  *        - 0x02 ... 0xFF
7192  * @param Handle The handles for which the attribute value has to be read
7193  * @retval Value indicating success or error code.
7194  */
7195 tBleStatus aci_gatt_clt_read_multiple_char_value(uint16_t Connection_Handle,
7196                                                  uint16_t CID,
7197                                                  uint8_t Number_of_Handles,
7198                                                  uint16_t Handle[]);
7199 /**
7200  * @brief Starts the procedure to write a characteristic value without waiting
7201  *        for any response from the server. No events are generated after this
7202  *        command is executed. Writing attributes using this function is not
7203  *        considered reliable by the standard: packets may be discarded by the
7204  *        peer if too many write commands are received.
7205  * @param Connection_Handle Connection handle that identifies the connection.
7206  *        Values:
7207  *        - 0x0000 ... 0x0EFF
7208  * @param CID Channel Identifier of the ATT bearer. It must be set to 0x0004 for
7209  *        unenhanced ATT bearer.
7210  * @param Attr_Handle Handle of the attribute to be written
7211  *        Values:
7212  *        - 0x0001 ... 0xFFFF
7213  * @param Attribute_Val_Length Length of the value to be written (maximum value
7214  *        is ATT_MTU - 3)
7215  * @param Attribute_Val Value to be written
7216  * @retval Value indicating success or error code.
7217  */
7218 tBleStatus aci_gatt_clt_write_without_resp(uint16_t Connection_Handle,
7219                                            uint16_t CID,
7220                                            uint16_t Attr_Handle,
7221                                            uint16_t Attribute_Val_Length,
7222                                            uint8_t Attribute_Val[]);
7223 /**
7224  * @brief Starts a signed write without response from the server. The procedure
7225  *        is used to write a characteristic value with an authentication
7226  *        signature without waiting for any response from the server. It cannot
7227  *        be used when the link is encrypted, and therefore it cannot be used on
7228  *        enhanced ATT bearers.
7229  * @param Connection_Handle Connection handle that identifies the connection.
7230  *        Values:
7231  *        - 0x0000 ... 0x0EFF
7232  * @param Attr_Handle Handle of the attribute to be written
7233  *        Values:
7234  *        - 0x0001 ... 0xFFFF
7235  * @param Attribute_Val_Length Length of the value to be written (up to ATT_MTU
7236  *        - 13)
7237  * @param Attribute_Val Value to be written
7238  * @retval Value indicating success or error code.
7239  */
7240 tBleStatus aci_gatt_clt_signed_write_without_resp(uint16_t Connection_Handle,
7241                                                   uint16_t Attr_Handle,
7242                                                   uint16_t Attribute_Val_Length,
7243                                                   uint8_t Attribute_Val[]);
7244 /**
7245  * @brief Allow application to confirm indication. This command has to be sent
7246  *        when the application receives the event @ref
7247  *        aci_gatt_clt_indication_event.
7248  * @param Connection_Handle Connection handle that identifies the connection.
7249  *        Values:
7250  *        - 0x0000 ... 0x0EFF
7251  * @param CID Channel Identifier of the ATT bearer. It must be set to 0x0004 for
7252  *        unenhanced ATT bearer.
7253  * @retval Value indicating success or error code.
7254  */
7255 tBleStatus aci_gatt_clt_confirm_indication(uint16_t Connection_Handle,
7256                                            uint16_t CID);
7257 /**
7258  * @brief Send an indication or notification for the provided attribute handle.
7259  *        The Flags parameter indicates what kind of message will be sent: -)
7260  *        0x00 Send a notification -) 0x02 Send an indication
7261  * @param Connection_Handle Connection handle to be used to identify the
7262  *        connection with the peer device.
7263  *        Values:
7264  *        - 0x0000 ... 0x0EFF
7265  * @param CID Channel Identifier of the ATT bearer. It must be set to 0x0004 for
7266  *        unenhanced ATT bearer.
7267  * @param Attr_Handle Handle of the attribute to be notified
7268  *        Values:
7269  *        - 0x0001 ... 0xFFFF
7270  * @param Flags Select the notification type.
7271  *        Values:
7272  *        - 0x00: GATT_NOTIFICATION
7273  *        - 0x02: GATT_INDICATION
7274  * @param Val_Length Length of the Val field.
7275  * @param Val
7276  * @retval Value indicating success or error code.
7277  */
7278 tBleStatus aci_gatt_srv_notify(uint16_t Connection_Handle,
7279                                uint16_t CID,
7280                                uint16_t Attr_Handle,
7281                                uint8_t Flags,
7282                                uint16_t Val_Length,
7283                                uint8_t Val[]);
7284 /**
7285  * @brief Updates an attribute value for that kind of attributes that have
7286  *        different values for each connection, i.e. the Client Characteristic
7287  *        Configuration Descriptors. WARNING: use of this function can affect
7288  *        interoperability. Do not use the function unless you are aware of what
7289  *        you are doing.
7290  * @param Connection_Handle Connection handle for which the attribute value will
7291  *        be written.
7292  * @param Attr_Handle Handle of the attribute
7293  *        Values:
7294  *        - 0x0001 ... 0xFFFF
7295  * @param Value_Length Length of the attribute value in octets.
7296  * @param Value Attribute value.
7297  * @retval Value indicating success or error code.
7298  */
7299 tBleStatus aci_gatt_srv_write_multiple_instance_handle_value(uint16_t Connection_Handle,
7300                                                              uint16_t Attr_Handle,
7301                                                              uint16_t Value_Length,
7302                                                              uint8_t Value[]);
7303 /**
7304  * @brief Notify multiple characteristic values to a client.
7305  * @param Connection_Handle Connection handle for which the attribute value will
7306  *        be read.
7307  * @param CID Channel Identifier of the ATT bearer. It must be set to 0x0004 for
7308  *        unenhanced ATT bearer.
7309  * @param Flags Reserved for future use. Its value must be set to 0.
7310  *        Values:
7311  *        - 0x00
7312  * @param Num_Of_Attr
7313  * @param Gatt_Srv_Notify_Attr See @ref Gatt_Srv_Notify_Attr_t
7314  * @retval Value indicating success or error code.
7315  */
7316 tBleStatus aci_gatt_srv_multi_notify(uint16_t Connection_Handle,
7317                                      uint16_t CID,
7318                                      uint8_t Flags,
7319                                      uint8_t Num_Of_Attr,
7320                                      Gatt_Srv_Notify_Attr_t Gatt_Srv_Notify_Attr[]);
7321 /**
7322  * @brief This sub-procedure is used to read multiple Characteristic Values from
7323  *        a server when the client knows the Characteristic Value Handles. This
7324  *        procedure is useful when the attributes to read have a variable or
7325  *        unknown value length (otherwise aci_gatt_clt_read_multiple_char_value
7326  *        may be used). When the procedure is completed, a @ref
7327  *        aci_gatt_clt_proc_complete_event event is generated. Before procedure
7328  *        completion the response packets are given through @ref
7329  *        aci_att_clt_read_multiple_var_len_resp_event event.
7330  * @param Connection_Handle Connection handle that identifies the connection.
7331  *        Values:
7332  *        - 0x0000 ... 0x0EFF
7333  * @param CID Channel Identifier of the ATT bearer. It must be set to 0x0004 for
7334  *        unenhanced ATT bearer.
7335  * @param Number_of_Handles The number of handles for which the value has to be
7336  *        read. From 2 to (ATT_MTU-1)/2
7337  *        Values:
7338  *        - 0x02 ... 0xFF
7339  * @param Handle The handles for which the attribute value has to be read
7340  * @retval Value indicating success or error code.
7341  */
7342 tBleStatus aci_gatt_clt_read_multiple_var_len_char_value(uint16_t Connection_Handle,
7343                                                          uint16_t CID,
7344                                                          uint8_t Number_of_Handles,
7345                                                          uint16_t Handle[]);
7346 /**
7347  * @brief Adds a service to the GATT database. When a service is created, the
7348  *        host may reserve a range of handles for this service.
7349  * @param Service_p The pointer to the service definition.
7350  * @retval Value indicating success or error code.
7351  */
7352 tBleStatus aci_gatt_srv_add_service(ble_gatt_srv_def_t * Service_p);
7353 /**
7354  * @brief Includes a service given by Included_Service_Handle to another service
7355  *        given by Service_Handle. Attribute server creates an Include
7356  *        definition attribute and returns the handle of this attribute.
7357  * @param Service_Handle Handle of the Service to which another service has to
7358  *        be included.
7359  *        Values:
7360  *        - 0x0001 ... 0xFFFF
7361  * @param Included_Service_Handle Attribute Handle of the Service which has to
7362  *        be included in service
7363  *        Values:
7364  *        - 0x0001 ... 0xFFFF
7365  * @retval Value indicating success or error code.
7366  */
7367 tBleStatus aci_gatt_srv_include_service(uint16_t Service_Handle,
7368                                         uint16_t Included_Service_Handle);
7369 /**
7370  * @brief Adds a characteristic to a service.
7371  * @param Char_p The pointer to the Characteristic definition.
7372  * @param Service_Handle Handle of the Service to which the characteristic will
7373  *        be added.
7374  *        Values:
7375  *        - 0x0001 ... 0xFFFF
7376  * @retval Value indicating success or error code.
7377  */
7378 tBleStatus aci_gatt_srv_add_char(ble_gatt_chr_def_t * Char_p,
7379                                  uint16_t Service_Handle);
7380 /**
7381  * @brief Adds a characteristic descriptor to a characteristic.
7382  * @param Descr_p The pointer to the Descriptor definition.
7383  * @param Char_Handle The Characteristic handle.
7384  *        Values:
7385  *        - 0x0001 ... 0xFFFF
7386  * @retval Value indicating success or error code.
7387  */
7388 tBleStatus aci_gatt_srv_add_char_desc(ble_gatt_descr_def_t * Descr_p,
7389                                       uint16_t Char_Handle);
7390 /**
7391  * @brief Deletes the specified service from the GATT server database.
7392  * @param Serv_Handle Handle of the service to be deleted
7393  *        Values:
7394  *        - 0x0001 ... 0xFFFF
7395  * @retval Value indicating success or error code.
7396  */
7397 tBleStatus aci_gatt_srv_rm_service(uint16_t Serv_Handle);
7398 /**
7399  * @brief Deletes the include definition from the service.
7400  * @param Include_Handle Handle of the included service which has to be deleted
7401  *        Values:
7402  *        - 0x0001 ... 0xFFFF
7403  * @retval Value indicating success or error code.
7404  */
7405 tBleStatus aci_gatt_srv_rm_include_service(uint16_t Include_Handle);
7406 /**
7407  * @brief Deletes the specified characteristic from the service.
7408  * @param Char_Handle Handle of the characteristic which has to be deleted
7409  *        Values:
7410  *        - 0x0001 ... 0xFFFF
7411  * @retval Value indicating success or error code.
7412  */
7413 tBleStatus aci_gatt_srv_rm_char(uint16_t Char_Handle);
7414 /**
7415  * @brief This function retrieve the Attribute Handle assigned to the Service
7416  *        registered using the provided definition structure.
7417  * @param Serv_p The Service definition structure.
7418  * @return Attribute Handle of Service or BLE_ATT_INVALID_ATTR_HANDLE on error.
7419  */
7420 uint16_t aci_gatt_srv_get_service_handle(ble_gatt_srv_def_t * Serv_p);
7421 /**
7422  * @brief This function retrieve the Attribute Handle assigned to the Include
7423  *        Service.
7424  * @param Serv_Attr_Handle The Handle of the including Service.
7425  * @param Included_Srv_p The Included Service definition structure.
7426  * @return Attribute Handle of Service or BLE_ATT_INVALID_ATTR_HANDLE on error.
7427  */
7428 uint16_t aci_gatt_srv_get_include_service_handle(uint16_t Serv_Attr_Handle,
7429                                                    ble_gatt_srv_def_t * Included_Srv_p);
7430 /**
7431  * @brief This function retrieve the Attribute Handle assigned to the
7432  *        Characteristic registered using the provided definition structure.
7433  * @param Char_p The Characteristic definition structure.
7434  * @return Attribute Handle of Service or BLE_ATT_INVALID_ATTR_HANDLE on error.
7435  */
7436 uint16_t aci_gatt_srv_get_char_decl_handle(ble_gatt_chr_def_t * Char_p);
7437 /**
7438  * @brief This function retrieve the Attribute Handle assigned to the
7439  *        Characteristic Descriptor registered using the provided definition
7440  *        structure.
7441  * @param Descr_p The Characteristic Descriptor definition structure.
7442  * @return Attribute Handle of Service or BLE_ATT_INVALID_ATTR_HANDLE on error.
7443  */
7444 uint16_t aci_gatt_srv_get_descriptor_handle(ble_gatt_descr_def_t * Descr_p);
7445 /**
7446  * @brief Reads the value of the attribute handle specified from the local GATT
7447  *        database. This command cannot be used to read attributes that have
7448  *        different values for each connection, e.g. the Client Characteristic
7449  *        Configuration Descriptors or Client Supported Features Characteristic
7450  *        (in this case, aci_gatt_srv_read_multiple_instance_handle_value needs
7451  *        to be used).
7452  * @param Attr_Handle Handle of the attribute to read
7453  *        Values:
7454  *        - 0x0001 ... 0xFFFF
7455  * @param[out] Length Length of the attribute value
7456  * @param[out] Value Pointer to the Attribute Value.
7457  * @retval Value indicating success or error code.
7458  */
7459 tBleStatus aci_gatt_srv_read_handle_value(uint16_t Attr_Handle,
7460                                           uint16_t *Length,
7461                                           uint8_t * *Value);
7462 /**
7463  * @brief Command to be given in response to aci_gatt_srv_read_event,
7464  *        aci_gatt_srv_write_event, aci_att_srv_prepare_write_req_event or
7465  *        aci_att_srv_exec_write_req_event. It ends the ATT transaction
7466  *        initiated by the remote client.
7467  * @param Connection_Handle Connection handle that identifies the connection.
7468  *        Values:
7469  *        - 0x0000 ... 0x0EFF
7470  * @param CID Channel Identifier of the ATT bearer. It must be set to 0x0004 for
7471  *        unenhanced ATT bearer.
7472  * @param Attr_Handle Attribute handle for which the response command is issued.
7473  * @param Error_Code The reason why the request has generated an error response
7474  *        (ATT error codes)
7475  *        Values:
7476  *        - 0x01: Invalid handle
7477  *        - 0x02: Read not permitted
7478  *        - 0x03: Write not permitted
7479  *        - 0x04: Invalid PDU
7480  *        - 0x05: Insufficient authentication
7481  *        - 0x06: Request not supported
7482  *        - 0x07: Invalid offset
7483  *        - 0x08: Insufficient authorization
7484  *        - 0x09: Prepare queue full
7485  *        - 0x0A: Attribute not found
7486  *        - 0x0B: Attribute not long
7487  *        - 0x0C: Insufficient encryption key size
7488  *        - 0x0D: Invalid attribute value length
7489  *        - 0x0E: Unlikely error
7490  *        - 0x0F: Insufficient encryption
7491  *        - 0x10: Unsupported group type
7492  *        - 0x11: Insufficient resources
7493  * @param Val_Length Length of the Val field.
7494  * @param Val Pointer to the value that must be returned in the response, in
7495  *        case this is a reply to an aci_gatt_srv_read_event(). In other cases
7496  *        it is ignored.
7497  * @retval Value indicating success or error code.
7498  */
7499 tBleStatus aci_gatt_srv_resp(uint16_t Connection_Handle,
7500                              uint16_t CID,
7501                              uint16_t Attr_Handle,
7502                              uint8_t Error_Code,
7503                              uint16_t Val_Length,
7504                              uint8_t Val[]);
7505 /**
7506  * @brief Starts the procedure to write an attribute (characteristic value or
7507  *        descriptor). When the procedure is completed, a @ref
7508  *        aci_gatt_clt_proc_complete_event event is generated.  Note: the buffer
7509  *        containing the value to be written must be kept valid until the @ref
7510  *        aci_gatt_clt_proc_complete_event is received
7511  * @param Connection_Handle Connection handle that identifies the connection.
7512  *        Values:
7513  *        - 0x0000 ... 0x0EFF
7514  * @param CID Channel Identifier of the ATT bearer. It must be set to 0x0004 for
7515  *        unenhanced ATT bearer.
7516  * @param Attr_Handle Handle of the attribute to be written
7517  *        Values:
7518  *        - 0x0001 ... 0xFFFF
7519  * @param Attribute_Val_Length Length of the value to be written
7520  * @param Attribute_Val
7521  * @retval Value indicating success or error code.
7522  */
7523 tBleStatus aci_gatt_clt_write(uint16_t Connection_Handle,
7524                               uint16_t CID,
7525                               uint16_t Attr_Handle,
7526                               uint16_t Attribute_Val_Length,
7527                               uint8_t Attribute_Val[]);
7528 /**
7529  * @brief This procedure is used to write an Attribute Value to a Server when
7530  *        the Client knows the Attribute Handle but the length of the Value is
7531  *        longer than what can be sent in a single Write Request Attribute
7532  *        Protocol message. During the procedure,
7533  *        aci_att_clt_prepare_write_resp_event and
7534  *        aci_att_clt_exec_write_resp_event are raised.  Note: The memory
7535  *        pointed by Write_Ops_p parameter and the buffer containing the value
7536  *        to be written must be kept valid while the procedure is running. They
7537  *        can be released (or their content can be changed) when the
7538  *        aci_gatt_clt_proc_complete_event is emitted indicating that the
7539  *        procedure is completed, or an error was received.
7540  * @param Connection_Handle Connection handle that identifies the connection.
7541  *        Values:
7542  *        - 0x0000 ... 0x0EFF
7543  * @param CID Channel Identifier of the ATT bearer. It must be set to 0x0004 for
7544  *        unenhanced ATT bearer.
7545  * @param Write_Ops_p The pointer to structure that holds the write information.
7546  * @retval Value indicating success or error code.
7547  */
7548 tBleStatus aci_gatt_clt_write_long(uint16_t Connection_Handle,
7549                                    uint16_t CID,
7550                                    ble_gatt_clt_write_ops_t * Write_Ops_p);
7551 /**
7552  * @brief Starts the procedure to write a characteristic reliably (a check is
7553  *        made on the written values). When the procedure is completed, a  @ref
7554  *        aci_gatt_clt_proc_complete_event event is generated. During the
7555  *        procedure, @ref aci_att_clt_prepare_write_resp_event and @ref
7556  *        aci_att_clt_exec_write_resp_event events are raised.  Note: The memory
7557  *        pointed by Write_Ops_p parameter and the buffer containing the value
7558  *        to be written must be kept valid while the procedure is running. They
7559  *        can be released (or their content can be changed) when the
7560  *        aci_gatt_clt_proc_complete_event is emitted indicating that the
7561  *        procedure is completed, or an error was received.
7562  * @param Connection_Handle Connection handle that identifies the connection.
7563  *        Values:
7564  *        - 0x0000 ... 0x0EFF
7565  * @param CID Channel Identifier of the ATT bearer. It must be set to 0x0004 for
7566  *        unenhanced ATT bearer.
7567  * @param Num_Attrs The number of attributes to write, i.e. the number of
7568  *        elements in the list pointed by Write_Ops_p.
7569  * @param Write_Ops_p The pointer to the list of structures that hold the write
7570  *        information.
7571  * @retval Value indicating success or error code.
7572  */
7573 tBleStatus aci_gatt_clt_write_char_reliable(uint16_t Connection_Handle,
7574                                             uint16_t CID,
7575                                             uint8_t Num_Attrs,
7576                                             ble_gatt_clt_write_ops_t * Write_Ops_p);
7577 /**
7578  * @brief Read the value for that kind of attributes that have different values
7579  *        for each connection, i.e. Client Characteristic Configuration
7580  *        Descriptors or Client Supported Features Characteristic.
7581  * @param Connection_Handle Connection handle for which the attribute value will
7582  *        be read.
7583  * @param Attr_Handle Handle of the attribute
7584  *        Values:
7585  *        - 0x0001 ... 0xFFFF
7586  * @param[out] Value_Length
7587  * @param[out] Value Pointer to the buffer containing the value. Content may no
7588  *             more be valid after another call to this function or to
7589  *             BLE_STACK_Tick().
7590  * @retval Value indicating success or error code.
7591  */
7592 tBleStatus aci_gatt_srv_read_multiple_instance_handle_value(uint16_t Connection_Handle,
7593                                                             uint16_t Attr_Handle,
7594                                                             uint16_t *Value_Length,
7595                                                             uint8_t * *Value);
7596 /**
7597  * @}
7598  */
7599 
7600 /**
7601  * @}
7602  */
7603 
7604 
7605 /**
7606  *@addtogroup L2CAP L2CAP
7607  *@brief Logical Link Control and Adaptation Protocol.
7608  *@{
7609  */
7610 /**
7611  *@defgroup ACI_L2CAP_Commands ACI L2CAP Commands
7612  *@brief Commands for L2CAP layer.
7613  *@{
7614  */
7615 /**
7616  * @brief Send an L2CAP connection parameter update request from the peripheral
7617  *        to the central. An @ref aci_l2cap_connection_update_resp_event event
7618  *        will be raised when the central will respond to the  request (accepts
7619  *        or rejects).
7620  * @param Connection_Handle Connection handle that identifies the connection.
7621  *        Values:
7622  *        - 0x0000 ... 0x0EFF
7623  * @param Connection_Interval_Min Minimum value for the connection event
7624  *        interval. This shall be less than or equal to Connection_Interval_Max.
7625  *        Time = N * 1.25 msec.
7626  *        Values:
7627  *        - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
7628  * @param Connection_Interval_Max Maximum value for the connection event
7629  *        interval. This shall be greater than or equal to
7630  *        Connection_Interval_Min. Time = N * 1.25 msec.
7631  *        Values:
7632  *        - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
7633  * @param Peripheral_Latency Maximum Peripheral latency for the connection in
7634  *        number of connection events.
7635  *        Values:
7636  *        - 0x0000 ... 0x01F3
7637  * @param Timeout_Multiplier Defines connection timeout parameter in the
7638  *        following manner: Timeout Multiplier * 10ms.
7639  *        Values:
7640  *        - 10 (100 ms)  ... 3200 (32000 ms)
7641  * @retval Value indicating success or error code.
7642  */
7643 tBleStatus aci_l2cap_connection_parameter_update_req(uint16_t Connection_Handle,
7644                                                      uint16_t Connection_Interval_Min,
7645                                                      uint16_t Connection_Interval_Max,
7646                                                      uint16_t Peripheral_Latency,
7647                                                      uint16_t Timeout_Multiplier);
7648 /**
7649  * @brief Accept or reject a connection update. This command should be sent in
7650  *        response to a @ref aci_l2cap_connection_update_req_event event from
7651  *        the controller. The accept parameter has to be set if the connection
7652  *        parameters given in the event are acceptable.
7653  * @param Connection_Handle Connection handle that identifies the connection.
7654  *        Values:
7655  *        - 0x0000 ... 0x0EFF
7656  * @param Connection_Interval_Min Minimum value for the connection event
7657  *        interval. This shall be less than or equal to Connection_Interval_Max.
7658  *        Time = N * 1.25 msec.
7659  *        Values:
7660  *        - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
7661  * @param Connection_Interval_Max Maximum value for the connection event
7662  *        interval. This shall be greater than or equal to
7663  *        Connection_Interval_Min. Time = N * 1.25 msec.
7664  *        Values:
7665  *        - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
7666  * @param Peripheral_Latency Maximum Peripheral latency for the connection in
7667  *        number of connection events.
7668  *        Values:
7669  *        - 0x0000 ... 0x01F3
7670  * @param Timeout_Multiplier Defines connection timeout parameter in the
7671  *        following manner: Timeout Multiplier * 10ms.
7672  *        Values:
7673  *        - 10 (100 ms)  ... 3200 (32000 ms)
7674  * @param Min_CE_Length The minimum length of connection event recommended for
7675  *        this LE connection. Time = N * 0.625 msec.
7676  * @param Max_CE_Length The maximum length of connection event recommended for
7677  *        this LE connection. Time = N * 0.625 msec.
7678  * @param Identifier Identifier received in ACI_L2CAP_Connection_Update_Req
7679  *        event.
7680  * @param Accept Specify if connection update parameters are acceptable or not.
7681  *        Values:
7682  *        - 0x00: Reject
7683  *        - 0x01: Accept
7684  * @retval Value indicating success or error code.
7685  */
7686 tBleStatus aci_l2cap_connection_parameter_update_resp(uint16_t Connection_Handle,
7687                                                       uint16_t Connection_Interval_Min,
7688                                                       uint16_t Connection_Interval_Max,
7689                                                       uint16_t Peripheral_Latency,
7690                                                       uint16_t Timeout_Multiplier,
7691                                                       uint16_t Min_CE_Length,
7692                                                       uint16_t Max_CE_Length,
7693                                                       uint8_t Identifier,
7694                                                       uint8_t Accept);
7695 /**
7696  * @brief Create and configure an L2CAP channel between two devices using either
7697  *        LE Credit Based Flow Control Mode or Enhanced Credit Based Flow
7698  *        Control Mode.
7699  * @param Connection_Handle Handle identifying the connection.
7700  * @param SPSM Simplified Protocol/Service Multiplexer
7701  *        Values:
7702  *        - 0x0001 ... 0x00FF
7703  * @param MTU The maximum SDU size (in octets) that the L2CAP layer entity
7704  *        sending the L2CAP_LE_CREDIT_BASED_CONNECTION_REQ can receive on this
7705  *        channel.
7706  *        Values:
7707  *        - 23 ... 65535
7708  * @param MPS The maximum PDU payload size (in octets) that the L2CAP layer
7709  *        entity sending the L2CAP_LE_CREDIT_BASED_CONNECTION_REQ is capable of
7710  *        receiving on this channel.
7711  *        Values:
7712  *        - 23 ... 65533
7713  * @param Channel_Type
7714  * @param CID_Count
7715  * @retval Value indicating success or error code.
7716  */
7717 tBleStatus aci_l2cap_cos_connection_req(uint16_t Connection_Handle,
7718                                         uint16_t SPSM,
7719                                         uint16_t MTU,
7720                                         uint16_t MPS,
7721                                         uint8_t Channel_Type,
7722                                         uint8_t CID_Count);
7723 /**
7724  * @brief Command to be sent to respond to a request to open an L2CAP channel
7725  *        using LE Credit based Flow Control or Enhanced Credit Based Flow
7726  *        Control Mode. The request is notified through
7727  *        aci_l2cap_cos_connection_req_event().
7728  * @param Connection_Handle Connection handle that identifies the connection.
7729  *        Values:
7730  *        - 0x0000 ... 0x0EFF
7731  * @param Identifier Identifier of the request.
7732  * @param MTU The MTU field specifies the maximum SDU size (in octets) that the
7733  *        L2CAP layer entity sending the L2CAP_LE_CREDIT_BASED_CONNECTION_RSP
7734  *        can receive on this channel.
7735  *        Values:
7736  *        - 23 ... 65535
7737  * @param MPS The MPS field specifies the maximum PDU payload size (in octets)
7738  *        that the L2CAP layer entity sending the
7739  *        L2CAP_LE_CREDIT_BASED_CONNECTION_RSP is capable of receiving on this
7740  *        channel.
7741  *        Values:
7742  *        - 23 ... 65533
7743  * @param Result It indicates the outcome of the connection request. A result
7744  *        value of 0x0000 indicates success while a non-zero value indicates a
7745  *        fail.
7746  *        Values:
7747  *        - 0x0000: L2CAP_CONNECTION_SUCCESSFUL
7748  *        - 0x0002: L2CAP_CONN_FAIL_SPSM_NOT_SUPPORTED
7749  *        - 0x0004: L2CAP_CONN_FAIL_INSUFFICIENT_RESOURCES
7750  *        - 0x0005: L2CAP_CONN_FAIL_INSUFFICIENT_AUTHENTICATION
7751  *        - 0x0006: L2CAP_CONN_FAIL_INSUFFICIENT_AUTHORIZATION
7752  *        - 0x0007: L2CAP_CONN_FAIL_KEY_SIZE_TOO_SHORT
7753  *        - 0x0008: L2CAP_CONN_FAIL_INSUFFICIENT_ENCRYPTION
7754  *        - 0x0009: L2CAP_CONN_FAIL_INVALID_SOURCE_CID
7755  *        - 0x000A: L2CAP_CONN_FAIL_SOURCE_CID_ALREADY_ALLOCATED
7756  *        - 0x000B: L2CAP_CONN_FAIL_UNACCEPTABLE_PARAMETERS
7757  * @param CID_Count
7758  * @param[out] CID
7759  * @retval Value indicating success or error code.
7760  */
7761 tBleStatus aci_l2cap_cos_connection_resp(uint16_t Connection_Handle,
7762                                          uint8_t Identifier,
7763                                          uint16_t MTU,
7764                                          uint16_t MPS,
7765                                          uint16_t Result,
7766                                          uint8_t CID_Count,
7767                                          uint16_t CID[]);
7768 /**
7769  * @brief Command to terminate an L2CAP channel.
7770  * @param Connection_Handle
7771  * @param CID Local endpoint of the channel to be disconnected.
7772  * @retval Value indicating success or error code.
7773  */
7774 tBleStatus aci_l2cap_cos_disconnect_req(uint16_t Connection_Handle,
7775                                         uint16_t CID);
7776 /**
7777  * @brief Function to be called to send an SDU using an  L2CAP channel in LE
7778  *        Credit Based Flow Control mode or Enhanced Credit Based Flow Control
7779  *        Mode.
7780  * @param Connection_Handle Connection handle that identifies the connection.
7781  *        Values:
7782  *        - 0x0000 ... 0x0EFF
7783  * @param CID The local channel endpoint that identifies the L2CAP channel.
7784  * @param SDU_Length Length of the SDU to be transmitted.
7785  * @param SDU_Data Data contained in the SDU to be transmitted. Data must be
7786  *        valid until the SDU is transmitted.
7787  * @retval Value indicating success or error code.
7788  */
7789 tBleStatus aci_l2cap_cos_sdu_data_transmit(uint16_t Connection_Handle,
7790                                            uint16_t CID,
7791                                            uint16_t SDU_Length,
7792                                            uint8_t SDU_Data[]);
7793 /**
7794  * @brief Command to send an L2CAP_CREDIT_BASED_RECONFIGURE_REQ packet in order
7795  *        to request to change its receive MTU or MPS values compared to when
7796  *        the channels were created or last reconfigured.
7797  * @param Connection_Handle Identifier received in the
7798  *        aci_eatt_connection_event.
7799  * @param MTU The maximum SDU size (in octets) that the L2CAP layer entity can
7800  *        receive on each of the Source CID channels (represented by Local_CID
7801  *        array parameter). This is equal to the maximum size of an ATT packet
7802  *        on the Enhanced ATT bearer.
7803  *        Values:
7804  *        - 0x0040 ... 0xFFFF
7805  * @param MPS The maximum PDU payload size (in octets) that the local L2CAP
7806  *        layer is capable of receiving on each of the Source CID channels
7807  *        (represented by Local_CID array parameter).
7808  *        Values:
7809  *        - 0x0040 ... 0xFFFF
7810  * @param CID_Count The number of potential Enhanced ATT bearers that are going
7811  *        to be opened. This is the number of L2CAP channels to be opened in
7812  *        Enhanced Credit Based Flow Control mode.
7813  *        Values:
7814  *        - 0x01 ... 0x05
7815  * @param CID List of CID values representing the channel endpoints on the local
7816  *        device. Each entry in the array shall be non-zero and represents a
7817  *        request for a channel. The value of each CID shall be from the
7818  *        dynamically allocated range for LE devices (0x0040-0x007F) and shall
7819  *        not be already allocated to a different channel on the device sending
7820  *        the request.
7821  * @retval Value indicating success or error code.
7822  */
7823 tBleStatus aci_l2cap_cos_reconfigure_req(uint16_t Connection_Handle,
7824                                          uint16_t MTU,
7825                                          uint16_t MPS,
7826                                          uint8_t CID_Count,
7827                                          uint16_t CID[]);
7828 /**
7829  * @brief Command to send an L2CAP_CREDIT_BASED_RECONFIGURE_RSP packet in order
7830  *        to respond to an incoming L2CAP_CREDIT_BASED_RECONFIGURE_REQ. It has
7831  *        to be used upon the reception of an
7832  *        ACI_L2CAP_ECFC_RECONFIGURATION_EVENT.
7833  * @param Connection_Handle Identifier received in the
7834  *        aci_eatt_connection_event.
7835  * @param Identifier Identifier received in the aci_eatt_connection_event.
7836  * @param Result It indicates the outcome of the connection request. A result
7837  *        value of 0x0000 indicates success while a non-zero value indicates the
7838  *        connection request was refused.
7839  *        Values:
7840  *        - 0x0000: L2CAP_RECONFIG_SUCCESSFUL
7841  *        - 0x0001: L2CAP_MTU_REDUCTION_NOT_ALLOWED
7842  *        - 0x0002: L2CAP_MPS_REDUCTION_NOT_ALLOWED
7843  *        - 0x0003: L2CAP_INVALID_DESTINATION_CID
7844  *        - 0x0004: L2CAP_UNACCEPTABLE_PARAMETERS
7845  * @retval Value indicating success or error code.
7846  */
7847 tBleStatus aci_l2cap_cos_reconfigure_resp(uint16_t Connection_Handle,
7848                                           uint8_t Identifier,
7849                                           uint16_t Result);
7850 /**
7851  * @brief Function to be used to extract an SDU from receiving buffer.
7852  * @param Connection_Handle Connection handle that identifies the connection.
7853  *        Values:
7854  *        - 0x0000 ... 0x0EFF
7855  * @param CID The local channel endpoint that identifies the L2CAP channel.
7856  * @param SDU_Data_Buffer_Size Size of the buffer where SDU will be copied.
7857  * @param[in] SDU_Data_Buffer Buffer where the extracted SDU will be copied.
7858  * @param[out] SDU_Length Length of the extracted SDU.
7859  * @retval Value indicating success or error code.
7860  */
7861 tBleStatus aci_l2cap_cos_sdu_data_extract(uint16_t Connection_Handle,
7862                                           uint16_t CID,
7863                                           uint16_t SDU_Data_Buffer_Size,
7864                                           void * SDU_Data_Buffer,
7865                                           uint16_t *SDU_Length);
7866 /**
7867  * @}
7868  */
7869 
7870 /**
7871  * @}
7872  */
7873 
7874 #endif /* _BLE_API_H_ */
7875