Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ble_hci_le.h « auto « core « ble « STM32_WPAN « ST « Middlewares - github.com/Flipper-Zero/STM32CubeWB.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c7b3a632ed96c77ce4bca3e8eb6b3fee23e97d9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
/*****************************************************************************
 * @file    ble_hci_le.h
 * @author  MCD
 * @brief   STM32WB BLE API (hci_le)
 *          Auto-generated file: do not edit!
 *****************************************************************************
 * @attention
 *
 * Copyright (c) 2018-2021 STMicroelectronics.
 * All rights reserved.
 *
 * This software is licensed under terms that can be found in the LICENSE file
 * in the root directory of this software component.
 * If no LICENSE file comes with this software, it is provided AS-IS.
 *
 *****************************************************************************
 */

#ifndef BLE_HCI_LE_H__
#define BLE_HCI_LE_H__


#include "ble_types.h"

/**
 * @brief HCI_DISCONNECT
 * The HCI_DISCONNECT is used to terminate an existing connection. The
 * Connection_Handle command parameter indicates which connection is to be
 * disconnected. The Reason command parameter indicates the reason for ending
 * the connection. The remote Controller will receive the Reason command
 * parameter in the HCI_DISCONNECTION_COMPLETE_EVENT event. All synchronous
 * connections on a physical link should be disconnected before the ACL
 * connection on the same physical connection is disconnected.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.1.6].
 * 
 * @param Connection_Handle Connection handle for which the command applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Reason The reason for ending the connection.
 *        Values:
 *        - 0x05: Authentication Failure
 *        - 0x13: Remote User Terminated Connection
 *        - 0x14: Remote Device Terminated Connection due to Low Resources
 *        - 0x15: Remote Device Terminated Connection due to Power Off
 *        - 0x1A: Unsupported Remote Feature
 *        - 0x3B: Unacceptable Connection Parameters
 * @return Value indicating success or error code.
 */
tBleStatus hci_disconnect( uint16_t Connection_Handle,
                           uint8_t Reason );

/**
 * @brief HCI_READ_REMOTE_VERSION_INFORMATION
 * This command will obtain the values for the version information for the
 * remote device identified by the Connection_Handle parameter. The
 * Connection_Handle must be a Connection_Handle for an ACL or LE connection.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.1.23].
 * 
 * @param Connection_Handle Connection handle for which the command applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @return Value indicating success or error code.
 */
tBleStatus hci_read_remote_version_information( uint16_t Connection_Handle );

/**
 * @brief HCI_SET_EVENT_MASK
 * The Set_Event_Mask command is used to control which events are generated by
 * the HCI for the Host. If the bit in the Event_Mask is set to a one, then the
 * event associated with that bit will be enabled. For an LE Controller, the LE
 * Meta Event bit in the Event_Mask shall enable or disable all LE events in
 * the LE Meta Event. The Host has to deal with each event that occurs. The
 * event mask allows the Host to control how much it is interrupted.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.3.1].
 * 
 * @param Event_Mask Event mask. Default: 0x20001FFFFFFFFFFF
 *        Flags:
 *        - 0x0000000000000000: No events specified
 *        - 0x0000000000000010: Disconnection Complete Event
 *        - 0x0000000000000080: Encryption Change Event
 *        - 0x0000000000000800: Read Remote Version Information Complete Event
 *        - 0x0000000000008000: Hardware Error Event
 *        - 0x0000800000000000: Encryption Key Refresh Complete Event
 *        - 0x2000000000000000: LE Meta-Event
 * @return Value indicating success or error code.
 */
tBleStatus hci_set_event_mask( const uint8_t* Event_Mask );

/**
 * @brief HCI_RESET
 * The Reset command resets the Link Layer on an LE Controller. The Reset
 * command shall not affect the used HCI transport layer since the HCI
 * transport layers may have reset mechanisms of their own. After the reset is
 * completed, the current operational state is lost, the Controller enters
 * standby mode and the Controller automatically reverts to the default values
 * for the parameters for which default values are defined in the
 * specification.
 * Note: The Reset command does not necessarily perform a hardware reset. This
 * is implementation defined.
 * The Host shall not send additional HCI commands before the Command Complete
 * event related to the Reset command has been received.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.3.2].
 * 
 * @return Value indicating success or error code.
 */
tBleStatus hci_reset( void );

/**
 * @brief HCI_READ_TRANSMIT_POWER_LEVEL
 * This command reads the values for the Transmit_Power_Level parameter for the
 * specified Connection_Handle. The Connection_Handle shall be a
 * Connection_Handle for an ACL connection.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.3.35].
 * 
 * @param Connection_Handle Connection handle for which the command applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Type Current or maximum transmit power level.
 *        Values:
 *        - 0x00: Read Current Transmit Power Level.
 *        - 0x01: Read Maximum Transmit Power Level.
 * @param[out] Transmit_Power_Level Size: 1 Octet (signed integer)
 *        Units: dBm
 *        Values:
 *        - -30 ... 20
 * @return Value indicating success or error code.
 */
tBleStatus hci_read_transmit_power_level( uint16_t Connection_Handle,
                                          uint8_t Type,
                                          uint8_t* Transmit_Power_Level );

/**
 * @brief HCI_SET_CONTROLLER_TO_HOST_FLOW_CONTROL
 * This command is used by the Host to turn flow control on or off for data
 * and/or voice sent in the direction from the Controller to the Host. If flow
 * control is turned off, the Host should not send the
 * Host_Number_Of_Completed_Packets command. That command will be ignored by
 * the Controller if it is sent by the Host and flow control is off. If flow
 * control is turned on for HCI ACL Data Packets and off for HCI synchronous
 * Data Packets, Host_Number_Of_Completed_Packets commands sent by the Host
 * should only contain Connection_Handles for ACL connections. If flow control
 * is turned off for HCI ACL Data Packets and on for HCI synchronous Data
 * Packets, Host_Number_Of_Completed_Packets commands sent by the Host should
 * only contain Connection_Handles for synchronous connections. If flow control
 * is turned on for HCI ACL Data Packets and HCI synchronous Data Packets, the
 * Host will send Host_Number_Of_Completed_Packets commands both for ACL
 * connections and synchronous connections.
 * The Flow_Control_Enable parameter shall only be changed if no connections
 * exist.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.3.38].
 * 
 * @param Flow_Control_Enable Enable/Disable the Flow Control
 *        Values:
 *        - 0x00: Flow control off in direction from Controller to Host.
 *          Default.
 *        - 0x01: Flow control on for HCI ACL Data Packets and off for HCI
 *          synchronous.Data Packets in direction from Controller to Host.
 *        - 0x02: Flow control off for HCI ACL Data Packets and on for HCI
 *          synchronous.Data Packets in direction from Controller to Host.
 *        - 0x03: Flow control on both for HCI ACL Data Packets and HCI
 *          synchronous.Data Packets in direction from Controller to Host.
 * @return Value indicating success or error code.
 */
tBleStatus hci_set_controller_to_host_flow_control( uint8_t Flow_Control_Enable );

/**
 * @brief HCI_HOST_BUFFER_SIZE
 * The Host_Buffer_Size command is used by the Host to notify the Controller
 * about the maximum size of the data portion of HCI ACL and synchronous Data
 * Packets sent from the Controller to the Host. The Controller shall segment
 * the data to be transmitted from the Controller to the Host according to
 * these sizes, so that the HCI Data Packets will contain data with up to these
 * sizes. The Host_Buffer_Size command also notifies the Controller about the
 * total number of HCI ACL and synchronous Data Packets that can be stored in
 * the data buffers of the Host. If flow control from the Controller to the
 * Host is turned off, and the Host_Buffer_Size command has not been issued by
 * the Host, this means that the Controller will send HCI Data Packets to the
 * Host with any lengths the Controller wants to use, and it is assumed that
 * the data buffer sizes of the Host are unlimited. If flow control from the
 * Controller to the Host is turned on, the Host_Buffer_Size command shall
 * after a power-on or a reset always be sent by the Host before the first
 * Host_Number_Of_Completed_Packets command is sent.
 * The Set Controller To Host Flow Control Command is used to turn flow control
 * on or off.
 * The Host_ACL_Data_Packet_Length command parameter will be used to determine
 * the size of the L2CAP segments contained in ACL Data Packets, which are
 * transferred from the Controller to the Host.
 * The Host_Synchronous_Data_Packet_Length command parameter is used to
 * determine the maximum size of HCI synchronous Data Packets. Both the Host
 * and the Controller shall support command and event packets, where the data
 * portion (excluding header) contained in the packets is 255 octets in size.
 * The Host_Total_Num_ACL_Data_Packets command parameter contains the total
 * number of HCI ACL Data Packets that can be stored in the data buffers of the
 * Host. The Controller will determine how the buffers are to be divided
 * between different Connection_Handles.
 * The Host_Total_Num_Synchronous_Data_Packets command parameter gives the same
 * information for HCI synchronous Data Packets.
 * Note: The Host_ACL_Data_Packet_Length and
 * Host_Synchronous_Data_Packet_Length command parameters do not include the
 * length of the HCI Data Packet header.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.3.39].
 * 
 * @param Host_ACL_Data_Packet_Length Maximum length (in octets) of the data
 *        portion of each HCI ACL Data Packet that the Host is able to accept.
 *        Must be greater or equal to 251 bytes
 * @param Host_Synchronous_Data_Packet_Length Maximum length (in octets) of the
 *        data portion of each HCI synchronous Data Packet that the Host is
 *        able to accept.
 * @param Host_Total_Num_ACL_Data_Packets Total number of HCI ACL Data Packets
 *        that can be stored in the data buffers of the Host.
 * @param Host_Total_Num_Synchronous_Data_Packets Total number of HCI
 *        synchronous Data Packets that can be stored in the data buffers of
 *        the Host.
 * @return Value indicating success or error code.
 */
tBleStatus hci_host_buffer_size( uint16_t Host_ACL_Data_Packet_Length,
                                 uint8_t Host_Synchronous_Data_Packet_Length,
                                 uint16_t Host_Total_Num_ACL_Data_Packets,
                                 uint16_t Host_Total_Num_Synchronous_Data_Packets );

/**
 * @brief HCI_HOST_NUMBER_OF_COMPLETED_PACKETS
 * The Host_Number_Of_Completed_Packets command is used by the Host to indicate
 * to the Controller the number of HCI Data Packets that have been completed
 * for each Connection_Handle since the previous
 * Host_Number_Of_Completed_Packets command was sent to the Controller. This
 * means that the corresponding buffer space has been freed in the Host. Based
 * on this information, and the Host_Total_Num_ACL_Data_Packets and
 * Host_Total_Num_Synchronous_Data_Packets command parameters of the
 * Host_Buffer_Size command, the Controller can determine for which
 * Connection_Handles the following HCI Data Packets should be sent to the
 * Host. The command should only be issued by the Host if flow control in the
 * direction from the Controller to the Host is on and there is at least one
 * connection, or if the Controller is in local loopback mode. Otherwise, the
 * command will be ignored by the Controller. When the Host has completed one
 * or more HCI Data Packet(s) it shall send a Host_Number_Of_Completed_Packets
 * command to the Controller, until it finally reports that all pending HCI
 * Data Packets have been completed. The frequency at which this command is
 * sent is manufacturer specific.
 * The Set Controller To Host Flow Control Command is used to turn flow control
 * on or off. If flow control from the Controller to the Host is turned on, the
 * Host_Buffer_Size command shall always be sent by the Host after a power-on
 * or a reset before the first Host_Number_Of_Completed_Packets command is
 * sent.
 * Note: The Host_Number_Of_Completed_Packets command is a special command in
 * the sense that no event is normally generated after the command has
 * completed. The command may be sent at any time by the Host when there is at
 * least one connection, or if the Controller is in local loopback mode
 * independent of other commands. The normal flow control for commands is not
 * used for the Host_Number_Of_Completed_Packets command.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.3.40].
 * 
 * @param Number_Of_Handles The number of Connection_Handles and
 *        Host_Num_Of_Completed_Packets parameters pairs contained in this
 *        command.
 *        Values:
 *        - 0 ... 255
 * @param Host_Nb_Of_Completed_Pkt_Pair See @ref
 *        Host_Nb_Of_Completed_Pkt_Pair_t
 * @return Value indicating success or error code.
 */
tBleStatus hci_host_number_of_completed_packets( uint8_t Number_Of_Handles,
                                                 const Host_Nb_Of_Completed_Pkt_Pair_t* Host_Nb_Of_Completed_Pkt_Pair );

/**
 * @brief HCI_READ_LOCAL_VERSION_INFORMATION
 * This command reads the values for the version information for the local
 * Controller. The HCI Version information defines the version information of
 * the HCI layer. The LMP/PAL Version information defines the version of the
 * LMP or PAL. The Manufacturer_Name information indicates the manufacturer of
 * the local device. The HCI Revision and LMP/PAL Subversion are implementation
 * dependent.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.4.1].
 * 
 * @param[out] HCI_Version See Bluetooth Assigned Numbers
 *        (https://www.bluetooth.org/en-us/specification/assigned-numbers)
 * @param[out] HCI_Revision Revision of the Current HCI in the BR/EDR
 *        Controller.
 * @param[out] LMP_PAL_Version Version of the Current LMP or PAL in the
 *        Controller.
 *        See Bluetooth Assigned Numbers (https://www.bluetooth.org/en-
 *        us/specification/assigned-numbers)
 * @param[out] Manufacturer_Name Manufacturer Name of the BR/EDR Controller.
 *        See Bluetooth Assigned Numbers (https://www.bluetooth.org/en-
 *        us/specification/assigned-numbers)
 * @param[out] LMP_PAL_Subversion Subversion of the Current LMP or PAL in the
 *        Controller. This value is
 *        implementation dependent.
 * @return Value indicating success or error code.
 */
tBleStatus hci_read_local_version_information( uint8_t* HCI_Version,
                                               uint16_t* HCI_Revision,
                                               uint8_t* LMP_PAL_Version,
                                               uint16_t* Manufacturer_Name,
                                               uint16_t* LMP_PAL_Subversion );

/**
 * @brief HCI_READ_LOCAL_SUPPORTED_COMMANDS
 * This command reads the list of HCI commands supported for the local
 * Controller. This command shall return the Supported_Commands configuration
 * parameter. It is implied that if a command is listed as supported, the
 * feature underlying that command is also supported.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.4.2].
 * 
 * @param[out] Supported_Commands Bit mask for each HCI Command. If a bit is 1,
 *        the Controller supports the corresponding command and the features
 *        required for the command.
 *        Unsupported or undefined commands shall be set to 0.
 * @return Value indicating success or error code.
 */
tBleStatus hci_read_local_supported_commands( uint8_t* Supported_Commands );

/**
 * @brief HCI_READ_LOCAL_SUPPORTED_FEATURES
 * This command requests a list of the supported features for the local
 * Controller. This command will return a list of the LMP features. For details
 * see Part C, Link Manager Protocol Specification.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.4.3].
 * 
 * @param[out] LMP_Features Bit Mask List of LMP features.
 * @return Value indicating success or error code.
 */
tBleStatus hci_read_local_supported_features( uint8_t* LMP_Features );

/**
 * @brief HCI_READ_BD_ADDR
 * On an LE Controller, this command shall read the Public Device Address as
 * defined in [Vol 6] Part B, Section 1.3, Device Address. If this Controller
 * does not have a Public Device Address, the value 0x000000000000 shall be
 * returned.
 * On an LE Controller, the public address shall be the same as the BD_ADDR.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.4.6].
 * 
 * @param[out] BD_ADDR BD_ADDR ( Bluetooth Device Address) of the Device.
 * @return Value indicating success or error code.
 */
tBleStatus hci_read_bd_addr( uint8_t* BD_ADDR );

/**
 * @brief HCI_READ_RSSI
 * This command reads the Received Signal Strength Indication (RSSI) value from
 * a Controller. For an LE transport, a Connection_Handle is used as the Handle
 * command parameter and return parameter. The meaning of the RSSI metric is an
 * absolute receiver signal strength value in dBm to +/- 6 dB accuracy. If the
 * RSSI cannot be read, the RSSI metric shall be set to 127.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.5.4].
 * 
 * @param Connection_Handle Connection handle for which the command applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param[out] RSSI RSSI (signed integer).
 *        Units: dBm.
 *        Values:
 *        - 127: RSSI not available
 *        - -127 ... 20
 * @return Value indicating success or error code.
 */
tBleStatus hci_read_rssi( uint16_t Connection_Handle,
                          uint8_t* RSSI );

/**
 * @brief HCI_LE_SET_EVENT_MASK
 * The LE_Set_Event_Mask command is used to control which LE events are
 * generated by the HCI for the Host. If the bit in the LE_Event_Mask is set to
 * a one, then the event associated with that bit will be enabled. The Host has
 * to deal with each event that is generated by an LE Controller. The event
 * mask allows the Host to control which events will interrupt it.
 * For LE events to be generated, the LE Meta-Event bit in the Event_Mask shall
 * also be set. If that bit is not set, then LE events shall not be generated,
 * regardless of how the LE_Event_Mask is set.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.1].
 * 
 * @param LE_Event_Mask LE event mask. Default: 0x00000000000FFFFF.
 *        Flags:
 *        - 0x0000000000000000: No LE events specified
 *        - 0x0000000000000001: LE Connection Complete Event
 *        - 0x0000000000000002: LE Advertising Report Event
 *        - 0x0000000000000004: LE Connection Update Complete Event
 *        - 0x0000000000000008: LE Read Remote Used Features Complete Event
 *        - 0x0000000000000010: LE Long Term Key Request Event
 *        - 0x0000000000000020: LE Remote Connection Parameter Request Event
 *        - 0x0000000000000040: LE Data Length Change Event
 *        - 0x0000000000000080: LE Read Local P-256 Public Key Complete Event
 *        - 0x0000000000000100: LE Generate DHKey Complete Event
 *        - 0x0000000000000200: LE Enhanced Connection Complete Event
 *        - 0x0000000000000400: LE Direct Advertising Report Event
 *        - 0x0000000000000800: LE PHY Update Complete Event
 *        - 0x0000000000001000: LE Extended Advertising Report Event
 *        - 0x0000000000002000: LE Periodic Advertising Sync Established Event
 *        - 0x0000000000004000: LE Periodic Advertising Report Event
 *        - 0x0000000000008000: LE Periodic Advertising Sync Lost Event
 *        - 0x0000000000010000: LE Extended Scan Timeouout Event
 *        - 0x0000000000020000: LE Extended Advertising Set Terminated Event
 *        - 0x0000000000040000: LE Scan Request Received Event
 *        - 0x0000000000080000: LE Channel Selection Algorithm Event
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_set_event_mask( const uint8_t* LE_Event_Mask );

/**
 * @brief HCI_LE_READ_BUFFER_SIZE
 * The LE_Read_Buffer_Size command is used to read the maximum size of the data
 * portion of HCI LE ACL Data Packets sent from the Host to the Controller.
 * The Host will segment the data transmitted to the Controller according to
 * these values, so that the HCI Data Packets will contain data with up to this
 * size. The LE_Read_Buffer_Size command also returns the total number of HCI
 * LE ACL Data Packets that can be stored in the data buffers of the
 * Controller. The LE_Read_Buffer_Size command must be issued by the Host
 * before it sends any data to an LE Controller (see Section 4.1.1).
 * If the Controller returns a length value of zero, the Host shall use the
 * Read_Buffer_Size command to determine the size of the data buffers.
 * Note: Both the Read_Buffer_Size and LE_Read_Buffer_Size commands may return
 * buffer length and number of packets parameter values that are nonzero.
 * The HC_LE_ACL_Data_Packet_Length return parameter shall be used to determine
 * the size of the L2CAP PDU segments contained in ACL Data Packets, which are
 * transferred from the Host to the Controller to be broken up into packets by
 * the Link Layer. Both the Host and the Controller shall support command and
 * event packets, where the data portion (excluding header) contained in the
 * packets is 255 octets in size. The HC_Total_Num_LE_ACL_Data_Packets return
 * parameter contains the total number of HCI ACL Data Packets that can be
 * stored in the data buffers of the Controller. The Host determines how the
 * buffers are to be divided between different Connection Handles.
 * Note: The HC_LE_ACL_Data_Packet_Length return parameter does not include the
 * length of the HCI Data Packet header.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.2].
 * 
 * @param[out] HC_LE_ACL_Data_Packet_Length 0x0000 No dedicated LE Buffer - use
 *        Read_Buffer_Size command.
 *        0x0001 - 0xFFFF Maximum length (in octets) of the data portion of
 *        each HCI ACL Data Packet that the Controller is able to accept.
 * @param[out] HC_Total_Num_LE_ACL_Data_Packets 0x00 No dedicated LE Buffer -
 *        use Read_Buffer_Size command.
 *        0x01 - 0xFF Total number of HCI ACL Data Packets that can be stored
 *        in the data buffers of the Controller.
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_read_buffer_size( uint16_t* HC_LE_ACL_Data_Packet_Length,
                                    uint8_t* HC_Total_Num_LE_ACL_Data_Packets );

/**
 * @brief HCI_LE_READ_LOCAL_SUPPORTED_FEATURES
 * This command requests the list of the supported LE features for the
 * Controller.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.3].
 * 
 * @param[out] LE_Features Bit Mask List of LE features. See Bluetooth Core
 *        specification.
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_read_local_supported_features( uint8_t* LE_Features );

/**
 * @brief HCI_LE_SET_RANDOM_ADDRESS
 * The LE_Set_Random_Address command is used by the Host to set the LE Random
 * Device Address in the Controller (see [Vol 6] Part B, Section 1.3).
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.4].
 * 
 * @param Random_Address Random Device Address.
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_set_random_address( const uint8_t* Random_Address );

/**
 * @brief HCI_LE_SET_ADVERTISING_PARAMETERS
 * The LE_Set_Advertising_Parameters command is used by the Host to set the
 * advertising parameters.
 * The Advertising_Interval_Min shall be less than or equal to the
 * Advertising_Interval_Max.
 * The Advertising_Interval_Min and Advertising_Interval_Max should not be the
 * same value to enable the Controller to determine the best advertising
 * interval given other activities.
 * For high duty cycle directed advertising, i.e. when Advertising_Type is 0x01
 * (ADV_DIRECT_IND, high duty cycle), the Advertising_Interval_Min and
 * Advertising_Interval_Max parameters are not used and shall be ignored.
 * The Advertising_Type is used to determine the packet type that is used for
 * advertising when advertising is enabled.
 * The Advertising_Interval_Min and Advertising_Interval_Max shall not be set
 * to less than 0x00A0 (100 ms) if the Advertising_Type is set to 0x02
 * (ADV_SCAN_IND) or 0x03 (ADV_NONCONN_IND). The Own_Address_Type determines if
 * the advertising packets are identified with the Public Device Address of the
 * device, or a Random Device Address as written by the LE_Set_Random_Address
 * command.
 * If directed advertising is performed, i.e. when Advertising_Type is set to
 * 0x01 (ADV_DIRECT_IND, high duty cycle) or 0x04 (ADV_DIRECT_IND, low duty
 * cycle mode), then the Direct_Address_Type and Direct_Address shall be valid,
 * otherwise they shall be ignored by the Controller and not used.
 * The Advertising_Channel_Map is a bit field that indicates the advertising
 * channels that shall be used when transmitting advertising packets. At least
 * one channel bit shall be set in the Advertising_Channel_Map parameter.
 * The Advertising_Filter_Policy parameter shall be ignored when directed
 * advertising is enabled.
 * The Host shall not issue this command when advertising is enabled in the
 * Controller; if it is the Command Disallowed error code shall be used.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.5].
 * 
 * @param Advertising_Interval_Min Minimum advertising interval.
 *        Time = N * 0.625 ms.
 *        Values:
 *        - 0x0020 (20.000 ms)  ... 0x4000 (10240.000 ms)
 * @param Advertising_Interval_Max Maximum advertising interval.
 *        Time = N * 0.625 ms.
 *        Values:
 *        - 0x0020 (20.000 ms)  ... 0x4000 (10240.000 ms)
 * @param Advertising_Type Advertising type.
 *        Values:
 *        - 0x00: ADV_IND (Connectable undirected advertising)
 *        - 0x01: ADV_DIRECT_IND, high duty cycle (Connectable high duty cycle
 *          directed advertising)
 *        - 0x02: ADV_SCAN_IND (Scannable undirected advertising)
 *        - 0x03: ADV_NONCONN_IND (Non connectable undirected advertising)
 *        - 0x04: ADV_DIRECT_IND_LDC, low duty cycle (Connectable low duty
 *          cycle directed advertising)
 * @param Own_Address_Type Own address type.
 *        Values:
 *        - 0x00: Public Device Address
 *        - 0x01: Random Device Address
 *        - 0x02: Resolvable Private Address if available, otherwise Public
 *          Address
 *        - 0x03: Resolvable Private Address if available, otherwise Random
 *          Address
 * @param Peer_Address_Type Address type of the peer device.
 *        Values:
 *        - 0x00: Public Device Address or Public Identity Address
 *        - 0x01: Random Device Address or Random (static) Identity Address
 * @param Peer_Address Public Device Address, Random Device Address, Public
 *        Identity Address, or Random (static) Identity Address of the device
 *        to be connected.
 * @param Advertising_Channel_Map Advertising channel map.
 *        Flags:
 *        - 0x01: Channel 37 shall be used
 *        - 0x02: Channel 38 shall be used
 *        - 0x04: Channel 39 shall be used
 * @param Advertising_Filter_Policy Advertising filter policy.
 *        Values:
 *        - 0x00: Allow Scan Request from Any, Allow Connect Request from Any
 *        - 0x01: Allow Scan Request from White List Only, Allow Connect
 *          Request from Any
 *        - 0x02: Allow Scan Request from Any, Allow Connect Request from White
 *          List Only
 *        - 0x03: Allow Scan Request from White List Only, Allow Connect
 *          Request from White List Only
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_set_advertising_parameters( uint16_t Advertising_Interval_Min,
                                              uint16_t Advertising_Interval_Max,
                                              uint8_t Advertising_Type,
                                              uint8_t Own_Address_Type,
                                              uint8_t Peer_Address_Type,
                                              const uint8_t* Peer_Address,
                                              uint8_t Advertising_Channel_Map,
                                              uint8_t Advertising_Filter_Policy );

/**
 * @brief HCI_LE_READ_ADVERTISING_PHYSICAL_CHANNEL_TX_POWER
 * The LE_Read_Advertising_Physical_Channel_Tx_Power command is used by the
 * Host to read the transmit power level used for LE advertising physical
 * channel packets.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.6].
 * 
 * @param[out] Transmit_Power_Level Size: 1 Octet (signed integer)
 *        Units: dBm
 *        Accuracy: +/- 4 dBm
 *        Values:
 *        - -20 ... 10
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_read_advertising_physical_channel_tx_power( uint8_t* Transmit_Power_Level );

/**
 * @brief HCI_LE_SET_ADVERTISING_DATA
 * The LE_Set_Advertising_Data command is used to set the data used in
 * advertising packets that have a data field.
 * Only the significant part of the Advertising_Data is transmitted in the
 * advertising packets, as defined in [Vol 3] Part C, Section 11.,
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.7].
 * 
 * @param Advertising_Data_Length The number of significant octets in the
 *        following data field
 * @param Advertising_Data 31 octets of data formatted as defined in [Vol 3]
 *        Part C, Section 11.
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_set_advertising_data( uint8_t Advertising_Data_Length,
                                        const uint8_t* Advertising_Data );

/**
 * @brief HCI_LE_SET_SCAN_RESPONSE_DATA
 * This command is used to provide data used in Scanning Packets that have a
 * data field.
 * Only the significant part of the Scan_Response_Data is transmitted in the
 * Scanning Packets, as defined in [Vol 3] Part C, Section 11.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.8].
 * 
 * @param Scan_Response_Data_Length The number of significant octets in the
 *        following data field
 * @param Scan_Response_Data 31 octets of data formatted as defined in [Vol 3]
 *        Part C, Section 11.
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_set_scan_response_data( uint8_t Scan_Response_Data_Length,
                                          const uint8_t* Scan_Response_Data );

/**
 * @brief HCI_LE_SET_ADVERTISING_ENABLE
 * The LE_Set_Advertising_Enable command is used to request the Controller to
 * start or stop advertising. The Controller manages the timing of
 * advertisements as per the advertising parameters given in the
 * LE_Set_Advertising_Parameters command.
 * The Controller shall continue advertising until the Host issues an
 * LE_Set_Advertising_Enable command with Advertising_Enable set to 0x00
 * (Advertising is disabled) or until a connection is created or until the
 * Advertising is timed out due to high duty cycle Directed Advertising. In
 * these cases, advertising is then disabled.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.9].
 * 
 * @param Advertising_Enable Enable/disable advertising.
 *        Values:
 *        - 0x00: Advertising is disabled
 *        - 0x01: Advertising is enabled
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_set_advertising_enable( uint8_t Advertising_Enable );

/**
 * @brief HCI_LE_SET_SCAN_PARAMETERS
 * The LE_Set_Scan_Parameters command is used to set the scan parameters.
 * The LE_Scan_Type parameter controls the type of scan to perform.
 * The LE_Scan_Interval and LE_Scan_Window parameters are recommendations from
 * the Host on how long (LE_Scan_Window) and how frequently (LE_Scan_Interval)
 * the Controller should scan (See [Vol 6] Part B, Section 4.4.3). The
 * LE_Scan_Window parameter shall always be set to a value smaller or equal to
 * the value set for the LE_Scan_Interval parameter. If they are set to the
 * same value scanning should be run continuously.
 * The Own_Address_Type parameter determines the address used (Public or Random
 * Device Address) when performing active scan.
 * The Host shall not issue this command when scanning is enabled in the
 * Controller; if it is the Command Disallowed error code shall be used.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.10].
 * 
 * @param LE_Scan_Type Passive or active scanning. With passive scanning, no
 *        scan request PDUs are sent.
 *        Values:
 *        - 0x00: Passive scanning
 *        - 0x01: Active scanning
 * @param LE_Scan_Interval This is defined as the time interval from when the
 *        Controller started its last LE scan until it begins the subsequent LE
 *        scan.
 *        Time = N * 0.625 ms.
 *        Values:
 *        - 0x0004 (2.500 ms)  ... 0x4000 (10240.000 ms)
 * @param LE_Scan_Window Amount of time for the duration of the LE scan.
 *        LE_Scan_Window shall be less than or equal to LE_Scan_Interval.
 *        Time = N * 0.625 ms.
 *        Values:
 *        - 0x0004 (2.500 ms)  ... 0x4000 (10240.000 ms)
 * @param Own_Address_Type Own address type.
 *        Values:
 *        - 0x00: Public Device Address
 *        - 0x01: Random Device Address
 *        - 0x02: Resolvable Private Address if available, otherwise Public
 *          Address
 *        - 0x03: Resolvable Private Address if available, otherwise Random
 *          Address
 * @param Scanning_Filter_Policy 0x00 Accept all advertisement packets.
 *        Directed advertising packets which are not addressed for this device
 *        shall be ignored.
 *        0x01 Ignore advertisement packets from devices not in the White List
 *        Only. Directed advertising packets which are not addressed for this
 *        device shall be ignored
 *        0x02 Accept all undirected advertisement packets. Directed
 *        advertisement packets where initiator address is a RPA and Directed
 *        advertisement packets addressed to this device shall be accepted.
 *        0x03 Accept all undirected advertisement packets from devices that
 *        are in the White List.Directed advertisement packets where initiator
 *        address is RPA and Directed advertisement packets addressed to this
 *        device shall be accepted.
 *        Values:
 *        - 0x00: Accept all
 *        - 0x01: Ignore devices not in the White List
 *        - 0x02: Accept all (use resolving list)
 *        - 0x03: Ignore devices not in the White List (use resolving list)
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_set_scan_parameters( uint8_t LE_Scan_Type,
                                       uint16_t LE_Scan_Interval,
                                       uint16_t LE_Scan_Window,
                                       uint8_t Own_Address_Type,
                                       uint8_t Scanning_Filter_Policy );

/**
 * @brief HCI_LE_SET_SCAN_ENABLE
 * The LE_Set_Scan_Enable command is used to start scanning. Scanning is used
 * to discover advertising devices nearby.
 * The Filter_Duplicates parameter controls whether the Link Layer shall filter
 * duplicate advertising reports to the Host, or if the Link Layer should
 * generate advertising reports for each packet received.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.11].
 * 
 * @param LE_Scan_Enable Enable/disable scan.
 *        Values:
 *        - 0x00: Scanning disabled
 *        - 0x01: Scanning enabled
 * @param Filter_Duplicates Enable/disable duplicate filtering.
 *        Values:
 *        - 0x00: Duplicate filtering disabled
 *        - 0x01: Duplicate filtering enabled
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_set_scan_enable( uint8_t LE_Scan_Enable,
                                   uint8_t Filter_Duplicates );

/**
 * @brief HCI_LE_CREATE_CONNECTION
 * The LE_Create_Connection command is used to create a Link Layer connection
 * to a connectable advertiser.
 * The LE_Scan_Interval and LE_Scan_Window parameters are recommendations from
 * the Host on how long (LE_Scan_Window) and how frequently (LE_Scan_Interval)
 * the Controller should scan. The LE_Scan_Window parameter shall be set to a
 * value smaller or equal to the value set for the LE_Scan_Interval parameter.
 * If both are set to the same value, scanning should run continuously.
 * The Initiator_Filter_Policy is used to determine whether the WhiteList is
 * used.
 * If the whitelist is not used, the Peer_Address_Type and the Peer_Address
 * parameters specify the address type and address of the advertising device to
 * connect to.
 * The Link Layer shall set the address in the CONNECT_REQ packets to either
 * the Public Device Address or the Random Device Addressed based on the
 * Own_Address_Type parameter.
 * The Conn_Interval_Min and Conn_Interval_Max parameters define the minimum
 * and maximum allowed connection interval. The Conn_Interval_Min parameter
 * shall not be greater than the Conn_Interval_Max parameter.
 * The Conn_Latency parameter defines the maximum allowed connection latency.
 * The Supervision_Timeout parameter defines the link supervision timeout for
 * the connection. The Supervision_Timeout in milliseconds shall be larger than
 * (1 + Conn_Latency) * Conn_Interval_Max * 2, where Conn_Interval_Max is given
 * in milliseconds.
 * The Minimum_CE_Length and Maximum_CE_Length parameters are informative
 * parameters providing the Controller with the expected minimum and maximum
 * length of the connection events. The Minimum_CE_Length parameter shall be
 * less than or equal to the Maximum_CE_Length parameter.
 * The Host shall not issue this command when another LE_Create_Connection is
 * pending in the Controller; if this does occur the Controller shall return
 * the Command Disallowed error code shall be used.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.12].
 * 
 * @param LE_Scan_Interval This is defined as the time interval from when the
 *        Controller started its last LE scan until it begins the subsequent LE
 *        scan.
 *        Time = N * 0.625 ms.
 *        Values:
 *        - 0x0004 (2.500 ms)  ... 0x4000 (10240.000 ms)
 * @param LE_Scan_Window Amount of time for the duration of the LE scan.
 *        LE_Scan_Window shall be less than or equal to LE_Scan_Interval.
 *        Time = N * 0.625 ms.
 *        Values:
 *        - 0x0004 (2.500 ms)  ... 0x4000 (10240.000 ms)
 * @param Initiator_Filter_Policy Initiator filter policy.
 *        Values:
 *        - 0x00: White list is not used
 *        - 0x01: White list is used
 * @param Peer_Address_Type Address type
 *        0x00 Public Device Address
 *        0x01 Random Device Address
 *        0x02 Public Identity Address (Corresponds to Resolved Private
 *        Address)
 *        0x03 Random (Static) Identity Address (Corresponds to Resolved
 *        Private Address)
 *        Values:
 *        - 0x00: Public Device Address
 *        - 0x01: Random Device Address
 *        - 0x02: Public Identity Address
 *        - 0x03: Random (Static) Identity Address
 * @param Peer_Address Public Device Address or Random Device Address of the
 *        device to be connected.
 * @param Own_Address_Type Own address type.
 *        Values:
 *        - 0x00: Public Device Address
 *        - 0x01: Random Device Address
 *        - 0x02: Resolvable Private Address if available, otherwise Public
 *          Address
 *        - 0x03: Resolvable Private Address if available, otherwise Random
 *          Address
 * @param Conn_Interval_Min Minimum value for the connection event interval.
 *        This shall be less than or equal to Conn_Interval_Max.
 *        Time = N * 1.25 ms.
 *        Values:
 *        - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
 * @param Conn_Interval_Max Maximum value for the connection event interval.
 *        This shall be greater than or equal to Conn_Interval_Min.
 *        Time = N * 1.25 ms.
 *        Values:
 *        - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
 * @param Conn_Latency Slave latency for the connection in number of connection
 *        events.
 *        Values:
 *        - 0x0000 ... 0x01F3
 * @param Supervision_Timeout Supervision timeout for the LE Link.
 *        It shall be a multiple of 10 ms and larger than (1 +
 *        connSlaveLatency) * connInterval * 2.
 *        Time = N * 10 ms.
 *        Values:
 *        - 0x000A (100 ms)  ... 0x0C80 (32000 ms)
 * @param Minimum_CE_Length Information parameter about the minimum length of
 *        connection needed for this LE connection.
 *        Time = N * 0.625 ms.
 *        Values:
 *        - 0x0000 (0.000 ms)  ... 0xFFFF (40959.375 ms)
 * @param Maximum_CE_Length Information parameter about the maximum length of
 *        connection needed for this LE connection.
 *        Time = N * 0.625 ms.
 *        Values:
 *        - 0x0000 (0.000 ms)  ... 0xFFFF (40959.375 ms)
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_create_connection( uint16_t LE_Scan_Interval,
                                     uint16_t LE_Scan_Window,
                                     uint8_t Initiator_Filter_Policy,
                                     uint8_t Peer_Address_Type,
                                     const uint8_t* Peer_Address,
                                     uint8_t Own_Address_Type,
                                     uint16_t Conn_Interval_Min,
                                     uint16_t Conn_Interval_Max,
                                     uint16_t Conn_Latency,
                                     uint16_t Supervision_Timeout,
                                     uint16_t Minimum_CE_Length,
                                     uint16_t Maximum_CE_Length );

/**
 * @brief HCI_LE_CREATE_CONNECTION_CANCEL
 * The LE_Create_Connection_Cancel command is used to cancel the
 * LE_Create_Connection command. This command shall only be issued after the
 * LE_Create_Connection command has been issued, a Command Status event has
 * been received for the LE Create Connection command and before the LE
 * Connection Complete event.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.13].
 * 
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_create_connection_cancel( void );

/**
 * @brief HCI_LE_READ_WHITE_LIST_SIZE
 * The LE_Read_White_List_Size command is used to read the total number of
 * whitelist entries that can be stored in the Controller.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.14].
 * 
 * @param[out] White_List_Size Total number of white list entries that can be
 *        stored in the Controller.
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_read_white_list_size( uint8_t* White_List_Size );

/**
 * @brief HCI_LE_CLEAR_WHITE_LIST
 * The LE_Clear_White_List command is used to clear the whitelist stored in the
 * Controller.
 * This command can be used at any time except when:
 * - the advertising filter policy uses the whitelist and advertising is
 * enabled.
 * - the scanning filter policy uses the whitelist and scanning is enabled.
 * - the initiator filter policy uses the whitelist and an LE_Create_Connection
 * command is outstanding.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.15].
 * 
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_clear_white_list( void );

/**
 * @brief HCI_LE_ADD_DEVICE_TO_WHITE_LIST
 * The LE_Add_Device_To_White_List command is used to add a single device to
 * the whitelist stored in the Controller.
 * This command can be used at any time except when:
 * - the advertising filter policy uses the whitelist and advertising is
 * enabled.
 * - the scanning filter policy uses the whitelist and scanning is enabled.
 * - the initiator filter policy uses the whitelist and a create connection
 * command is outstanding.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.16].
 * 
 * @param Address_Type Address type.
 *        Values:
 *        - 0x00: Public Device Address
 *        - 0x01: Random Device Address
 * @param Address Public Device Address or Random Device Address.
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_add_device_to_white_list( uint8_t Address_Type,
                                            const uint8_t* Address );

/**
 * @brief HCI_LE_REMOVE_DEVICE_FROM_WHITE_LIST
 * The LE_Remove_Device_From_White_List command is used to remove a single
 * device from the whitelist stored in the Controller.
 * This command can be used at any time except when:
 * - the advertising filter policy uses the whitelist and advertising is
 * enabled.
 * - the scanning filter policy uses the whitelist and scanning is enabled.
 * - the initiator filter policy uses the whitelist and a create connection
 * command is outstanding.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.17].
 * 
 * @param Address_Type Address type.
 *        Values:
 *        - 0x00: Public Device Address
 *        - 0x01: Random Device Address
 * @param Address Public Device Address or Random Device Address.
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_remove_device_from_white_list( uint8_t Address_Type,
                                                 const uint8_t* Address );

/**
 * @brief HCI_LE_CONNECTION_UPDATE
 * The LE_Connection_Update command is used to change the Link Layer connection
 * parameters of a connection. This command is supported only on master side.
 * The Conn_Interval_Min and Conn_Interval_Max parameters are used to define
 * the minimum and maximum allowed connection interval. The Conn_Interval_Min
 * parameter shall not be greater than the Conn_Interval_Max parameter.
 * The Conn_Latency parameter shall define the maximum allowed connection
 * latency.
 * The Supervision_Timeout parameter shall define the link supervision timeout
 * for the LE link. The Supervision_Timeout in milliseconds shall be larger
 * than (1 + Conn_Latency) * Conn_Interval_Max * 2, where Conn_Interval_Max is
 * given in milliseconds.
 * The Minimum_CE_Length and Maximum_CE_Length are information parameters
 * providing the Controller with a hint about the expected minimum and maximum
 * length of the connection events. The Minimum_CE_Length shall be less than or
 * equal to the Maximum_CE_Length.
 * The actual parameter values selected by the Link Layer may be different from
 * the parameter values provided by the Host through this command.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.18].
 * 
 * @param Connection_Handle Connection handle for which the command applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Conn_Interval_Min Minimum value for the connection event interval.
 *        This shall be less than or equal to Conn_Interval_Max.
 *        Time = N * 1.25 ms.
 *        Values:
 *        - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
 * @param Conn_Interval_Max Maximum value for the connection event interval.
 *        This shall be greater than or equal to Conn_Interval_Min.
 *        Time = N * 1.25 ms.
 *        Values:
 *        - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
 * @param Conn_Latency Slave latency for the connection in number of connection
 *        events.
 *        Values:
 *        - 0x0000 ... 0x01F3
 * @param Supervision_Timeout Supervision timeout for the LE Link.
 *        It shall be a multiple of 10 ms and larger than (1 +
 *        connSlaveLatency) * connInterval * 2.
 *        Time = N * 10 ms.
 *        Values:
 *        - 0x000A (100 ms)  ... 0x0C80 (32000 ms)
 * @param Minimum_CE_Length Information parameter about the minimum length of
 *        connection needed for this LE connection.
 *        Time = N * 0.625 ms.
 *        Values:
 *        - 0x0000 (0.000 ms)  ... 0xFFFF (40959.375 ms)
 * @param Maximum_CE_Length Information parameter about the maximum length of
 *        connection needed for this LE connection.
 *        Time = N * 0.625 ms.
 *        Values:
 *        - 0x0000 (0.000 ms)  ... 0xFFFF (40959.375 ms)
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_connection_update( uint16_t Connection_Handle,
                                     uint16_t Conn_Interval_Min,
                                     uint16_t Conn_Interval_Max,
                                     uint16_t Conn_Latency,
                                     uint16_t Supervision_Timeout,
                                     uint16_t Minimum_CE_Length,
                                     uint16_t Maximum_CE_Length );

/**
 * @brief HCI_LE_SET_HOST_CHANNEL_CLASSIFICATION
 * The LE_Set_Host_Channel_Classification command allows the Host to specify a
 * channel classification for data channels based on its "local information".
 * This classification persists until overwritten with a subsequent
 * LE_Set_Host_Channel_Classification command or until the Controller is reset
 * using the Reset command (see [Vol 6] Part B, Section 4.5.8.1).
 * If this command is used, the Host should send it within 10 seconds of
 * knowing that the channel classification has changed. The interval between
 * two successive commands sent shall be at least one second.
 * This command shall only be used when the local device supports the Master
 * role.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.19].
 * 
 * @param LE_Channel_Map This parameter contains 37 1-bit fields.
 *        The nth such field (in the range 0 to 36) contains the value for the
 *        link layer channel index n.
 *        Channel n is bad = 0.
 *        Channel n is unknown = 1.
 *        The most significant bits are reserved and shall be set to 0.
 *        At least one channel shall be marked as unknown.
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_set_host_channel_classification( const uint8_t* LE_Channel_Map );

/**
 * @brief HCI_LE_READ_CHANNEL_MAP
 * The LE_Read_Channel_Map command returns the current Channel_Map for the
 * specified Connection_Handle. The returned value indicates the state of the
 * Channel_Map specified by the last transmitted or received Channel_Map (in a
 * CONNECT_REQ or LL_CHANNEL_MAP_REQ message) for the specified
 * Connection_Handle, regardless of whether the Master has received an
 * acknowledgement.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.20].
 * 
 * @param Connection_Handle Connection handle for which the command applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param[out] LE_Channel_Map This parameter contains 37 1-bit fields.
 *        The nth such field (in the range 0 to 36) contains the value for the
 *        link layer channel index n.
 *        Channel n is unused = 0.
 *        Channel n is used = 1.
 *        The most significant bits are reserved and shall be set to 0.
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_read_channel_map( uint16_t Connection_Handle,
                                    uint8_t* LE_Channel_Map );

/**
 * @brief HCI_LE_READ_REMOTE_FEATURES
 * This command requests a list of the used LE features from the remote device.
 * This command shall return a list of the used LE features. For details see
 * [Vol 6] Part B, Section 4.6.
 * This command may be issued on both the master and slave.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.21].
 * 
 * @param Connection_Handle Connection handle for which the command applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_read_remote_features( uint16_t Connection_Handle );

/**
 * @brief HCI_LE_ENCRYPT
 * The LE_Encrypt command is used to request the Controller to encrypt the
 * Plaintext_Data in the command using the Key given in the command and returns
 * the Encrypted_Data to the Host. The AES-128 bit block cypher is defined in
 * NIST Publication FIPS-197
 * (http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf).
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.22].
 * 
 * @param Key 128 bit key for the encryption of the data given in the command.
 * @param Plaintext_Data 128 bit data block that is requested to be encrypted.
 * @param[out] Encrypted_Data 128 bit encrypted data block.
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_encrypt( const uint8_t* Key,
                           const uint8_t* Plaintext_Data,
                           uint8_t* Encrypted_Data );

/**
 * @brief HCI_LE_RAND
 * The LE_Rand command is used to request the Controller to generate 8 octets
 * of random data to be sent to the Host. The Random_Number shall be generated
 * according to [Vol 2] Part H, Section 2 if the LE Feature (LL Encryption) is
 * supported.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.23].
 * 
 * @param[out] Random_Number Random Number
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_rand( uint8_t* Random_Number );

/**
 * @brief HCI_LE_ENABLE_ENCRYPTION
 * The LE_Enable_Encryption command is used to authenticate the given
 * encryption key associated with the remote device specified by the connection
 * handle, and once authenticated will encrypt the connection. The parameters
 * are as defined in [Vol 3] Part H, Section 2.4.4.
 * If the connection is already encrypted then the Controller shall pause
 * connection encryption before attempting to authenticate the given encryption
 * key, and then re-encrypt the connection. While encryption is paused no user
 * data shall be transmitted.
 * On an authentication failure, the connection shall be automatically
 * disconnected by the Link Layer. If this command succeeds, then the
 * connection shall be encrypted.
 * This command shall only be used when the local device's role is Master.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.24].
 * 
 * @param Connection_Handle Connection handle for which the command applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Random_Number 64 bit random number.
 * @param Encrypted_Diversifier 16 bit encrypted diversifier.
 * @param Long_Term_Key 128 bit long term key.
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_enable_encryption( uint16_t Connection_Handle,
                                     const uint8_t* Random_Number,
                                     uint16_t Encrypted_Diversifier,
                                     const uint8_t* Long_Term_Key );

/**
 * @brief HCI_LE_LONG_TERM_KEY_REQUEST_REPLY
 * The LE_Long_Term_Key_Request_Reply command is used to reply to an LE Long
 * Term Key Request event from the Controller, and specifies the Long_Term_Key
 * parameter that shall be used for this Connection_Handle. The Long_Term_Key
 * is used as defined in [Vol 6] Part B, Section 5.1.3.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.25].
 * 
 * @param Connection_Handle Connection handle for which the command applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Long_Term_Key 128 bit long term key.
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_long_term_key_request_reply( uint16_t Connection_Handle,
                                               const uint8_t* Long_Term_Key );

/**
 * @brief HCI_LE_LONG_TERM_KEY_REQUEST_NEGATIVE_REPLY
 * The LE_Long_Term_Key_Request_Negative_Reply command is used to reply to an
 * LE Long Term Key Request event from the Controller if the Host cannot
 * provide a Long Term Key for this Connection_Handle.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.26].
 * 
 * @param Connection_Handle Connection handle for which the command applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_long_term_key_request_negative_reply( uint16_t Connection_Handle );

/**
 * @brief HCI_LE_READ_SUPPORTED_STATES
 * The LE_Read_Supported_States command reads the states and state combinations
 * that the link layer supports. See [Vol 6] Part B, Section 1.1.1.
 * LE_States is an 8-octet bit field. If a bit is set to 1 then this state or
 * state combination is supported by the Controller. Multiple bits in LE_States
 * may be set to 1 to indicate support for multiple state and state
 * combinations.
 * All the Advertising type with the Initiate State combinations shall be set
 * only if the corresponding Advertising types and Master Role combination are
 * set.
 * All the Scanning types and the Initiate State combinations shall be set only
 * if the corresponding Scanning types and Master Role combination are set.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.27].
 * 
 * @param[out] LE_States State or state combination is supported by the
 *        Controller.
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_read_supported_states( uint8_t* LE_States );

/**
 * @brief HCI_LE_RECEIVER_TEST
 * This command is used to start a test where the DUT receives test reference
 * packets at a fixed interval. The tester generates the test reference
 * packets.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.28].
 * 
 * @param RX_Frequency N = (F - 2402) / 2
 *        Frequency Range : 2402 MHz to 2480 MHz
 *        Values:
 *        - 0x00 ... 0x27
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_receiver_test( uint8_t RX_Frequency );

/**
 * @brief HCI_LE_TRANSMITTER_TEST
 * This command is used to start a test where the DUT generates test reference
 * packets at a fixed interval. The Controller shall transmit at maximum power.
 * An LE Controller supporting the LE_Transmitter_Test command shall support
 * Packet_Payload values 0x00, 0x01 and 0x02. An LE Controller may support
 * other values of Packet_Payload.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.29].
 * 
 * @param TX_Frequency N = (F - 2402) / 2
 *        Frequency Range : 2402 MHz to 2480 MHz
 *        Values:
 *        - 0x00 ... 0x27
 * @param Length_Of_Test_Data Length in bytes of payload data in each packet.
 *        Values:
 *        - 0x00 ... 0x25
 * @param Packet_Payload Type of packet payload.
 *        Values:
 *        - 0x00: Pseudo-Random bit sequence 9
 *        - 0x01: Pattern of alternating bits '11110000'
 *        - 0x02: Pattern of alternating bits '10101010'
 *        - 0x03: Pseudo-Random bit sequence 15
 *        - 0x04: Pattern of All '1' bits
 *        - 0x05: Pattern of All '0' bits
 *        - 0x06: Pattern of alternating bits '00001111'
 *        - 0x07: Pattern of alternating bits '0101'
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_transmitter_test( uint8_t TX_Frequency,
                                    uint8_t Length_Of_Test_Data,
                                    uint8_t Packet_Payload );

/**
 * @brief HCI_LE_TEST_END
 * This command is used to stop any test which is in progress. The
 * Number_Of_Packets for a transmitter test shall be reported as 0x0000. The
 * Number_Of_Packets is an unsigned number and contains the number of received
 * packets.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.30].
 * 
 * @param[out] Number_Of_Packets Number of packets received
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_test_end( uint16_t* Number_Of_Packets );

/**
 * @brief HCI_LE_SET_DATA_LENGTH
 * The LE_Set_Data_Length command allows the Host to suggest maximum
 * transmission packet size and maximum packet transmission time
 * (connMaxTxOctets and connMaxTxTime - see Bluetooth spec. Vol 6 [Part B]
 * 4.5.10) to be used for a given connection. The Controller may use smaller or
 * larger values based on local information.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.33].
 * 
 * @param Connection_Handle Connection handle for which the command applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param TxOctets Preferred maximum number of payload octets that the local
 *        Controller should include in a single Link Layer packet on this
 *        connection.
 *        Values:
 *        - 0x001B ... 0x00FB
 * @param TxTime Preferred maximum number of microseconds that the local
 *        Controller should use to transmit a single Link Layer packet on this
 *        connection.
 *        Values:
 *        - 0x0148 ... 0x4290
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_set_data_length( uint16_t Connection_Handle,
                                   uint16_t TxOctets,
                                   uint16_t TxTime );

/**
 * @brief HCI_LE_READ_SUGGESTED_DEFAULT_DATA_LENGTH
 * The LE_Read_Suggested_Default_Data_Length command allows the Host to read
 * the Host's suggested values (SuggestedMaxTxOctets and SuggestedMaxTxTime)
 * for the Controller's maximum transmitted number of payload octets and
 * maximum packet transmission time to be used for new connections.
 * See Bluetooth spec. v.5.2 [Vol 6, Part B, 4.5.10].
 * 
 * @param[out] SuggestedMaxTxOctets The Host's suggested value for the
 *        Controller's maximum transmitted number of payload octets to be used
 *        for new connections.
 *        Values:
 *        - 0x001B ... 0x00FB
 * @param[out] SuggestedMaxTxTime The Host's suggested value for the
 *        Controller's maximum packet transmission time to be used for new
 *        connections.
 *        Values:
 *        - 0x0148 ... 0x4290
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_read_suggested_default_data_length( uint16_t* SuggestedMaxTxOctets,
                                                      uint16_t* SuggestedMaxTxTime );

/**
 * @brief HCI_LE_WRITE_SUGGESTED_DEFAULT_DATA_LENGTH
 * The LE_Write_Suggested_Default_Data_Length command allows the Host to
 * specify its suggested values for the Controller's maximum transmission
 * number of payload octets and maximum packet transmission time to be used for
 * new connections. The Controller may use smaller or larger values for
 * connInitialMaxTxOctets and connInitialMaxTxTime based on local information.
 * See Bluetooth spec. v.5.2 [Vol 6, Part B, 4.5.10].
 * 
 * @param SuggestedMaxTxOctets The Host's suggested value for the Controller's
 *        maximum transmitted number of payload octets to be used for new
 *        connections.
 *        Values:
 *        - 0x001B ... 0x00FB
 * @param SuggestedMaxTxTime The Host's suggested value for the Controller's
 *        maximum packet transmission time to be used for new connections.
 *        Values:
 *        - 0x0148 ... 0x4290
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_write_suggested_default_data_length( uint16_t SuggestedMaxTxOctets,
                                                       uint16_t SuggestedMaxTxTime );

/**
 * @brief HCI_LE_READ_LOCAL_P256_PUBLIC_KEY
 * The LE_Read_Local_P-256_Public_Key command is used to return the local P-256
 * public key from the Controller. The Controller shall generate a new P-256
 * public/private key pair upon receipt of this command.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.36].
 * 
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_read_local_p256_public_key( void );

/**
 * @brief HCI_LE_GENERATE_DHKEY
 * The LE_Generate_DHKey command is used to initiate generation of a Diffie-
 * Hellman key in the Controller for use over the LE transport. This command
 * takes the remote P-256 public key as input. The Diffie-Hellman key
 * generation uses the private key generated by LE_Read_Local_P256_Public_Key
 * command.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.37].
 * 
 * @param Remote_P256_Public_Key The remote P-256 public key in X, Y format:
 *        Octets 31-0: X co-ordinate
 *        Octets 63-32: Y co-ordinate
 *        Little Endian Format
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_generate_dhkey( const uint8_t* Remote_P256_Public_Key );

/**
 * @brief HCI_LE_ADD_DEVICE_TO_RESOLVING_LIST
 * The LE_Add_Device_To_Resolving_List command is used to add one device to the
 * list of address translations used to resolve Resolvable Private Addresses in
 * the Controller.
 * This command cannot be used when address translation is enabled in the
 * Controller and:
 * - Advertising is enabled
 * - Scanning is enabled
 * - Create connection command is outstanding
 * This command can be used at any time when address translation is disabled in
 * the Controller.
 * When a Controller cannot add a device to the resolving list because the list
 * is full, it shall respond with error code 0x07 (Memory Capacity Exceeded).
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.38].
 * 
 * @param Peer_Identity_Address_Type Identity address type.
 *        Values:
 *        - 0x00: Public Identity Address
 *        - 0x01: Random (static) Identity Address
 * @param Peer_Identity_Address Public or Random (static) Identity address of
 *        the peer device
 * @param Peer_IRK IRK of the peer device
 * @param Local_IRK IRK of the local device
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_add_device_to_resolving_list( uint8_t Peer_Identity_Address_Type,
                                                const uint8_t* Peer_Identity_Address,
                                                const uint8_t* Peer_IRK,
                                                const uint8_t* Local_IRK );

/**
 * @brief HCI_LE_REMOVE_DEVICE_FROM_RESOLVING_LIST
 * The LE_Remove_Device_From_Resolving_List command is used to remove one
 * device from the list of address translations used to resolve Resolvable
 * Private Addresses in the controller.
 * This command cannot be used when address translation is enabled in the
 * Controller and:
 * - Advertising is enabled
 * - Scanning is enabled
 * - Create connection command is outstanding
 * This command can be used at any time when address translation is disabled in
 * the Controller.
 * When a Controller cannot remove a device from the resolving list because it
 * is not found, it shall respond with error code 0x02 (Unknown Connection
 * Identifier).
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.39].
 * 
 * @param Peer_Identity_Address_Type Identity address type.
 *        Values:
 *        - 0x00: Public Identity Address
 *        - 0x01: Random (static) Identity Address
 * @param Peer_Identity_Address Public or Random (static) Identity address of
 *        the peer device
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_remove_device_from_resolving_list( uint8_t Peer_Identity_Address_Type,
                                                     const uint8_t* Peer_Identity_Address );

/**
 * @brief HCI_LE_CLEAR_RESOLVING_LIST
 * The LE_Clear_Resolving_List command is used to remove all devices from the
 * list of address translations used to resolve Resolvable Private Addresses in
 * the Controller.
 * This command cannot be used when address translation is enabled in the
 * Controller and:
 * - Advertising is enabled
 * - Scanning is enabled
 * - Create connection command is outstanding
 * This command can be used at any time when address translation is disabled in
 * the Controller.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.40].
 * 
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_clear_resolving_list( void );

/**
 * @brief HCI_LE_READ_RESOLVING_LIST_SIZE
 * The LE_Read_Resolving_List_Size command is used to read the total number of
 * address translation entries in the resolving list that can be stored in the
 * Controller.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.41].
 * 
 * @param[out] Resolving_List_Size Number of address translation entries in the
 *        resolving list
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_read_resolving_list_size( uint8_t* Resolving_List_Size );

/**
 * @brief HCI_LE_READ_PEER_RESOLVABLE_ADDRESS
 * The LE_Read_Peer_Resolvable_Address command is used to get the current peer
 * Resolvable Private Address being used for the corresponding peer Public and
 * Random (static) Identity Address. The peer's resolvable address being used
 * may change after the command is called.
 * This command can be used at any time.
 * When a Controller cannot find a Resolvable Private Address associated with
 * the Peer Identity Address, it shall respond with error code 0x02 (Unknown
 * Connection Identifier).
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.42].
 * 
 * @param Peer_Identity_Address_Type Identity address type.
 *        Values:
 *        - 0x00: Public Identity Address
 *        - 0x01: Random (static) Identity Address
 * @param Peer_Identity_Address Public or Random (static) Identity address of
 *        the peer device
 * @param[out] Peer_Resolvable_Address Resolvable Private Address being used by
 *        the peer device
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_read_peer_resolvable_address( uint8_t Peer_Identity_Address_Type,
                                                const uint8_t* Peer_Identity_Address,
                                                uint8_t* Peer_Resolvable_Address );

/**
 * @brief HCI_LE_READ_LOCAL_RESOLVABLE_ADDRESS
 * The LE_Read_Local_Resolvable_Address command is used to get the current
 * local Resolvable Private Address being used for the corresponding peer
 * Identity Address. The local's resolvable address being used may change after
 * the command is called.
 * This command can be used at any time.
 * When a Controller cannot find a Resolvable Private Address associated with
 * the Peer Identity Address, it shall respond with error code 0x02 (Unknown
 * Connection Identifier).
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.43].
 * 
 * @param Peer_Identity_Address_Type Identity address type.
 *        Values:
 *        - 0x00: Public Identity Address
 *        - 0x01: Random (static) Identity Address
 * @param Peer_Identity_Address Public or Random (static) Identity address of
 *        the peer device
 * @param[out] Local_Resolvable_Address Resolvable Private Address being used
 *        by the local device
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_read_local_resolvable_address( uint8_t Peer_Identity_Address_Type,
                                                 const uint8_t* Peer_Identity_Address,
                                                 uint8_t* Local_Resolvable_Address );

/**
 * @brief HCI_LE_SET_ADDRESS_RESOLUTION_ENABLE
 * The LE_Set_Address_Resolution_Enable command is used to enable resolution of
 * Resolvable Private Addresses in the Controller. This causes the Controller
 * to use the resolving list whenever the Controller receives a local or peer
 * Resolvable Private Address.
 * This command can be used at any time except when:
 * - Advertising is enabled
 * - Scanning is enabled
 * - Create connection command is outstanding
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.44].
 * 
 * @param Address_Resolution_Enable Enable/disable address resolution in the
 *        controller.
 *        0x00: Address Resolution in controller disabled (default),
 *        0x01: Address Resolution in controller enabled
 *        Values:
 *        - 0x00: Address Resolution in controller disabled (default)
 *        - 0x01: Address Resolution in controller enabled
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_set_address_resolution_enable( uint8_t Address_Resolution_Enable );

/**
 * @brief HCI_LE_SET_RESOLVABLE_PRIVATE_ADDRESS_TIMEOUT
 * The LE_Set_Resolvable_Private_Address_Timeout command set the length of time
 * the controller uses a Resolvable Private Address before a new resolvable
 * private address is generated and starts being used. This timeout applies to
 * all addresses generated by the controller.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.45].
 * 
 * @param RPA_Timeout RPA_Timeout measured in seconds.
 *        Range for N: 0x0001 - 0xA1B8 (1 sec - approximately 11.5 hours)
 *        Default: N= 0x0384 (900 secs or 15 minutes)
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_set_resolvable_private_address_timeout( uint16_t RPA_Timeout );

/**
 * @brief HCI_LE_READ_MAXIMUM_DATA_LENGTH
 * The LE_Read_Maximum_Data_Length command allows the Host to read the
 * Controller's maximum supported payload octets and packet duration times for
 * transmission and reception (supportedMaxTxOctets and supportedMaxTxTime,
 * supportedMaxRxOctets, and supportedMaxRxTime, see Bluetooth spec. v.5.2 [Vol
 * 6, Part B, 4.5.10]).
 * 
 * @param[out] supportedMaxTxOctets Maximum number of payload octets that the
 *        local Controller supports for transmission of a single Link Layer
 *        packet on a data connection.
 *        Values:
 *        - 0x001B ... 0x00FB
 * @param[out] supportedMaxTxTime Maximum time, in microseconds, that the local
 *        Controller supports for transmission of a single Link Layer packet on
 *        a data connection.
 *        Values:
 *        - 0x0148 ... 0x4290
 * @param[out] supportedMaxRxOctets Maximum number of payload octets that the
 *        local Controller supports for reception of a single Link Layer packet
 *        on a data connection.
 *        Values:
 *        - 0x001B ... 0x00FB
 * @param[out] supportedMaxRxTime Maximum time, in microseconds, that the local
 *        Controller supports for reception of a single Link Layer packet on a
 *        data connection.
 *        Values:
 *        - 0x0148 ... 0x4290
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_read_maximum_data_length( uint16_t* supportedMaxTxOctets,
                                            uint16_t* supportedMaxTxTime,
                                            uint16_t* supportedMaxRxOctets,
                                            uint16_t* supportedMaxRxTime );

/**
 * @brief HCI_LE_READ_PHY
 * The LE_Read_PHY command is used to read the current transmitter PHY and
 * receiver PHY on the connection identified by the Connection_Handle.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.47].
 * 
 * @param Connection_Handle Connection handle for which the command applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param[out] TX_PHY Transmitter PHY in use
 *        Values:
 *        - 0x01: The transmitter PHY for the connection is LE 1M
 *        - 0x02: The transmitter PHY for the connection is LE 2M
 *        - 0x03: The transmitter PHY for the connection is LE Coded (not
 *          supported)
 * @param[out] RX_PHY Receiver PHY in use
 *        Values:
 *        - 0x01: The receiver PHY for the connection is LE 1M
 *        - 0x02: The receiver PHY for the connection is LE 2M
 *        - 0x03: The receiver PHY for the connection is LE Coded (not
 *          supported)
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_read_phy( uint16_t Connection_Handle,
                            uint8_t* TX_PHY,
                            uint8_t* RX_PHY );

/**
 * @brief HCI_LE_SET_DEFAULT_PHY
 * The LE_Set_Default_PHY command allows the Host to specify its preferred
 * values for the transmitter PHY and receiver PHY to be used for all
 * subsequent connections over the LE transport.
 * The ALL_PHYS parameter is a bit field that allows the Host to specify, for
 * each
 * direction, whether it has no preference among the PHYs that the Controller
 * supports in a given direction or whether it has specified particular PHYs
 * that it prefers in the TX_PHYS or RX_PHYS parameter.
 * The TX_PHYS parameter is a bit field that indicates the transmitter PHYs
 * that the Host prefers the Controller to use. If the ALL_PHYS parameter
 * specifies that the Host has no preference, the TX_PHYS parameter is ignored;
 * otherwise at least one bit shall be set to 1.
 * The RX_PHYS parameter is a bit field that indicates the receiver PHYs that
 * the Host prefers the Controller to use. If the ALL_PHYS parameter specifies
 * that the Host has no preference, the RX_PHYS parameter is ignored; otherwise
 * at least one bit shall be set to 1.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.48].
 * 
 * @param ALL_PHYS Host preferences for TX PHY and RX PHY
 *        Values:
 *        - 0x00 ... 0x03
 * @param TX_PHYS Host preferences for TX PHY (no LE coded support)
 *        Values:
 *        - 0x00 ... 0x03
 * @param RX_PHYS Host preferences for RX PHY (no LE coded support)
 *        Values:
 *        - 0x00 ... 0x03
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_set_default_phy( uint8_t ALL_PHYS,
                                   uint8_t TX_PHYS,
                                   uint8_t RX_PHYS );

/**
 * @brief HCI_LE_SET_PHY
 * The LE_Set_PHY command is used to set the PHY preferences for the connection
 * identified by the Connection_Handle. The Controller might not be able to
 * make the change (e.g. because the peer does not support the requested PHY)
 * or may decide that the current PHY is preferable.
 * The ALL_PHYS parameter is a bit field that allows the Host to specify, for
 * each direction, whether it has no preference among the PHYs that the
 * Controller supports in a given direction or whether it has specified
 * particular PHYs that it prefers in the TX_PHYS or RX_PHYS parameter.
 * The TX_PHYS parameter is a bit field that indicates the transmitter PHYs
 * that the Host prefers the Controller to use. If the ALL_PHYS parameter
 * specifies that the Host has no preference, the TX_PHYS parameter is ignored;
 * otherwise at least one bit shall be set to 1.
 * The RX_PHYS parameter is a bit field that indicates the receiver PHYs that
 * the Host prefers the Controller to use. If the ALL_PHYS parameter specifies
 * that the Host has no preference, the RX_PHYS parameter is ignored; otherwise
 * at least one bit shall be set to 1.
 * If, for at least one direction, the Host has specified a preference and the
 * current PHY is not one of those preferred, the Controller shall request a
 * change. Otherwise the Controller may, but need not, request a change.
 * The PHY preferences provided by the LE Set PHY command override those
 * provided via the LE Set Default PHY command (Section 7.8.48) or any
 * preferences previously set using the LE Set PHY command on the same
 * connection.
 * The PHY_options parameter is a bit field that allows the Host to specify
 * options for PHYs. The default value for a new connection shall be all zero
 * bits. The Controller may override any preferred coding for transmitting on
 * the LE Coded PHY.
 * The Host may specify a preferred coding even if it prefers not to use the LE
 * Coded transmitter PHY since the Controller may override the PHY preference.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.49].
 * 
 * @param Connection_Handle Connection handle for which the command applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param ALL_PHYS Host preferences for TX PHY and RX PHY
 *        Values:
 *        - 0x00 ... 0x03
 * @param TX_PHYS Host preferences for TX PHY (no LE coded support)
 *        Values:
 *        - 0x00 ... 0x03
 * @param RX_PHYS Host preferences for RX PHY (no LE coded support)
 *        Values:
 *        - 0x00 ... 0x03
 * @param PHY_options Not supported
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_set_phy( uint16_t Connection_Handle,
                           uint8_t ALL_PHYS,
                           uint8_t TX_PHYS,
                           uint8_t RX_PHYS,
                           uint16_t PHY_options );

/**
 * @brief HCI_LE_RECEIVER_TEST_V2
 * This command is used to start a test where the DUT receives test reference
 * packets at a fixed interval. The tester generates the test reference
 * packets.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.50].
 * 
 * @param RX_Frequency N = (F - 2402) / 2
 *        Frequency Range : 2402 MHz to 2480 MHz
 *        Values:
 *        - 0x00 ... 0x27
 * @param PHY PHY to use for test packet
 *        Values:
 *        - 0x00: Reserved for future use
 *        - 0x01: Transmitter set to use the LE 1M PHY
 *        - 0x02: Transmitter set to use the LE 2M PHY
 *        - 0x03: Transmitter set to use the LE Coded PHY with S=8 data coding
 *        - 0x04: Transmitter set to use the LE Coded PHY with S=2 data coding
 * @param Modulation_Index Modulation index capability of the transmitter
 *        Values:
 *        - 0x00: Assume transmitter will have a standard modulation index
 *        - 0x01: Assume transmitter will have a stable modulation index
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_receiver_test_v2( uint8_t RX_Frequency,
                                    uint8_t PHY,
                                    uint8_t Modulation_Index );

/**
 * @brief HCI_LE_TRANSMITTER_TEST_V2
 * This command is used to start a test where the DUT generates test reference
 * packets at a fixed interval. The Controller shall transmit at maximum power.
 * An LE Controller supporting this command shall support Packet_Payload values
 * 0x00, 0x01 and 0x02. An LE Controller supporting the LE Coded PHY shall also
 * support Packet_Payload value 0x04 (not supported by STM32WB). An LE
 * Controller may support other values of Packet_Payload.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.51].
 * 
 * @param TX_Frequency N = (F - 2402) / 2
 *        Frequency Range : 2402 MHz to 2480 MHz
 *        Values:
 *        - 0x00 ... 0x27
 * @param Length_Of_Test_Data Length in bytes of payload data in each packet.
 *        Values:
 *        - 0x00 ... 0x25
 * @param Packet_Payload Type of packet payload.
 *        Values:
 *        - 0x00: Pseudo-Random bit sequence 9
 *        - 0x01: Pattern of alternating bits '11110000'
 *        - 0x02: Pattern of alternating bits '10101010'
 *        - 0x03: Pseudo-Random bit sequence 15
 *        - 0x04: Pattern of All '1' bits
 *        - 0x05: Pattern of All '0' bits
 *        - 0x06: Pattern of alternating bits '00001111'
 *        - 0x07: Pattern of alternating bits '0101'
 * @param PHY PHY to use for test packet
 *        Values:
 *        - 0x00: Reserved for future use
 *        - 0x01: Transmitter set to use the LE 1M PHY
 *        - 0x02: Transmitter set to use the LE 2M PHY
 *        - 0x03: Transmitter set to use the LE Coded PHY with S=8 data coding
 *        - 0x04: Transmitter set to use the LE Coded PHY with S=2 data coding
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_transmitter_test_v2( uint8_t TX_Frequency,
                                       uint8_t Length_Of_Test_Data,
                                       uint8_t Packet_Payload,
                                       uint8_t PHY );

/**
 * @brief HCI_LE_SET_ADVERTISING_SET_RANDOM_ADDRESS
 * This command is used by the Host to set the random device address specified
 * by the Random_Address parameter.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.52].
 * 
 * @param Advertising_Handle Used to identify an advertising set.
 *        Values:
 *        - 0x00 ... 0xEF
 * @param Random_Address Random Device Address.
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_set_advertising_set_random_address( uint8_t Advertising_Handle,
                                                      const uint8_t* Random_Address );

/**
 * @brief HCI_LE_SET_EXTENDED_ADVERTISING_PARAMETERS
 * This command is used by the Host to set the extended advertising parameters.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.53].
 * 
 * @param Advertising_Handle Used to identify an advertising set.
 *        Values:
 *        - 0x00 ... 0xEF
 * @param Adv_Event_Properties Type of advertising event.
 *        Flags:
 *        - 0x0001: Connectable advertising
 *        - 0x0002: Scannable advertising
 *        - 0x0004: Directed advertising
 *        - 0x0008: High Duty Cycle Directed Connectable advertising
 *        - 0x0010: Use legacy advertising PDUs
 *        - 0x0020: Anonymous advertising
 *        - 0x0040: Include TxPower in at least one advertising PDU
 * @param Primary_Adv_Interval_Min Minimum advertising interval.
 *        Time = N * 0.625 ms.
 *        Values:
 *        - 0x000020 (20.000 ms)  ... 0xFFFFFF (10485759.375 ms)
 * @param Primary_Adv_Interval_Max Maximum advertising interval.
 *        Time = N * 0.625 ms.
 *        Values:
 *        - 0x000020 (20.000 ms)  ... 0xFFFFFF (10485759.375 ms)
 * @param Primary_Adv_Channel_Map Advertising channel map.
 *        Flags:
 *        - 0x01: Channel 37 shall be used
 *        - 0x02: Channel 38 shall be used
 *        - 0x04: Channel 39 shall be used
 * @param Own_Address_Type Own address type.
 *        Values:
 *        - 0x00: Public Device Address
 *        - 0x01: Random Device Address
 *        - 0x02: Resolvable Private Address if available, otherwise Public
 *          Address
 *        - 0x03: Resolvable Private Address if available, otherwise Random
 *          Address
 * @param Peer_Address_Type Address type of the peer device.
 *        Values:
 *        - 0x00: Public Device Address or Public Identity Address
 *        - 0x01: Random Device Address or Random (static) Identity Address
 * @param Peer_Address Public Device Address, Random Device Address, Public
 *        Identity Address, or Random (static) Identity Address of the device
 *        to be connected.
 * @param Adv_Filter_Policy Advertising filter policy
 *        Values:
 *        - 0x00: Process scan and connection requests from all devices (i.e.,
 *          the White List is not in use)
 *        - 0x01: Process connection requests from all devices and scan
 *          requests only from devices that are in the White List.
 *        - 0x02: Process scan requests from all devices and connection
 *          requests only from devices that are in the White List.
 *        - 0x03: Process scan and connection requests only from devices in the
 *          White  List.
 * @param Adv_TX_Power Advertising TX power. Units: dBm.
 *        Values:
 *        - -127 ... 20
 * @param Primary_Adv_PHY Primary advertising PHY.
 *        Values:
 *        - 0x01: Primary advertisement PHY is LE 1M
 *        - 0x03: Primary advertisement PHY is LE Coded (not supported)
 * @param Secondary_Adv_Max_Skip Secondary advertising maximum skip.
 *        Values:
 *        - 0x00: AUX_ADV_IND shall be sent prior to the next advertising event
 *        - 0x01 ... 0xFF: Maximum advertising events the Controller can skip
 *          before sending the AUX_ADV_IND packets on the secondary advertising
 *          physical channel
 * @param Secondary_Adv_PHY Secondary advertising PHY.
 *        Values:
 *        - 0x01: Secondary advertisement PHY is LE 1M
 *        - 0x02: Secondary advertisement PHY is LE 2M
 *        - 0x03: Secondary advertisement PHY is LE Coded (not supported)
 * @param Adv_SID Value of the Advertising SID subfield in the ADI field of the
 *        PDU.
 *        Values:
 *        - 0x00 ... 0x0F
 * @param Scan_Req_Notification_Enable Scan request notifications.
 *        Values:
 *        - 0x00: Scan request notifications disabled
 *        - 0x01: Scan request notifications enabled
 * @param[out] Selected_TX_Power Power level selected by the Controller. Units:
 *        dBm.
 *        Values:
 *        - -127 ... 20
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_set_extended_advertising_parameters( uint8_t Advertising_Handle,
                                                       uint16_t Adv_Event_Properties,
                                                       const uint8_t* Primary_Adv_Interval_Min,
                                                       const uint8_t* Primary_Adv_Interval_Max,
                                                       uint8_t Primary_Adv_Channel_Map,
                                                       uint8_t Own_Address_Type,
                                                       uint8_t Peer_Address_Type,
                                                       const uint8_t* Peer_Address,
                                                       uint8_t Adv_Filter_Policy,
                                                       uint8_t Adv_TX_Power,
                                                       uint8_t Primary_Adv_PHY,
                                                       uint8_t Secondary_Adv_Max_Skip,
                                                       uint8_t Secondary_Adv_PHY,
                                                       uint8_t Adv_SID,
                                                       uint8_t Scan_Req_Notification_Enable,
                                                       uint8_t* Selected_TX_Power );

/**
 * @brief HCI_LE_SET_EXTENDED_ADVERTISING_DATA
 * This command is used to set the data used in extended advertising PDUs that
 * have a data field.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.54].
 * 
 * @param Advertising_Handle Used to identify an advertising set.
 *        Values:
 *        - 0x00 ... 0xEF
 * @param Operation Advertising operation.
 *        Values:
 *        - 0x00: Intermediate fragment of fragmented extended advertising data
 *        - 0x01: First fragment of fragmented extended advertising data
 *        - 0x02: Last fragment of fragmented extended advertising data
 *        - 0x03: Complete extended advertising data
 *        - 0x04: Unchanged data (just update the Advertising DID)
 * @param Fragment_Preference Fragment preference.
 *        Values:
 *        - 0x00: The Controller may fragment all data
 *        - 0x01: The Controller should not fragment or should minimize
 *          fragmentation of data
 * @param Advertising_Data_Length Length of Advertising_Data in octets
 * @param Advertising_Data Data formatted as defined in Bluetooth spec. v.5.2
 *        [Vol 3, Part C, 11].
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_set_extended_advertising_data( uint8_t Advertising_Handle,
                                                 uint8_t Operation,
                                                 uint8_t Fragment_Preference,
                                                 uint8_t Advertising_Data_Length,
                                                 const uint8_t* Advertising_Data );

/**
 * @brief HCI_LE_SET_EXTENDED_SCAN_RESPONSE_DATA
 * This command is used to provide scan response data used in scanning response
 * PDUs during extended advertising.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.55].
 * 
 * @param Advertising_Handle Used to identify an advertising set.
 *        Values:
 *        - 0x00 ... 0xEF
 * @param Operation Scan response operation.
 *        Values:
 *        - 0x00: Intermediate fragment of fragmented scan response data
 *        - 0x01: First fragment of fragmented scan response data
 *        - 0x02: Last fragment of fragmented scan response data
 *        - 0x03: Complete scan response data
 * @param Fragment_Preference Fragment preference.
 *        Values:
 *        - 0x00: The Controller may fragment all data
 *        - 0x01: The Controller should not fragment or should minimize
 *          fragmentation of data
 * @param Scan_Response_Data_Length Length of Scan_Response_Data in octets
 * @param Scan_Response_Data Data formatted as defined in Bluetooth spec. v.5.2
 *        [Vol 3, Part C, 11].
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_set_extended_scan_response_data( uint8_t Advertising_Handle,
                                                   uint8_t Operation,
                                                   uint8_t Fragment_Preference,
                                                   uint8_t Scan_Response_Data_Length,
                                                   const uint8_t* Scan_Response_Data );

/**
 * @brief HCI_LE_SET_EXTENDED_ADVERTISING_ENABLE
 * This command is used to request the Controller to enable or disable one or
 * more advertising sets using the advertising sets identified by the
 * Advertising_Handle[i] parameter.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.56].
 * 
 * @param Enable Enable/disable advertising.
 *        Values:
 *        - 0x00: Advertising is disabled
 *        - 0x01: Advertising is enabled
 * @param Num_Sets Number of advertising sets.
 *        Values:
 *        - 0x00: Disable all advertising sets
 *        - 0x01 ... 0x3F: Number of advertising sets to enable or disable
 * @param Adv_Set See @ref Adv_Set_t
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_set_extended_advertising_enable( uint8_t Enable,
                                                   uint8_t Num_Sets,
                                                   const Adv_Set_t* Adv_Set );

/**
 * @brief HCI_LE_READ_MAXIMUM_ADVERTISING_DATA_LENGTH
 * This command is used to read the maximum length of data supported by the
 * Controller for use as advertisement data or scan response data in an
 * extended advertising event.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.57].
 * 
 * @param[out] Max_Advertising_Data_Length Maximum supported advertising data
 *        length.
 *        Values:
 *        - 0x001F ... 0x0672
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_read_maximum_advertising_data_length( uint16_t* Max_Advertising_Data_Length );

/**
 * @brief HCI_LE_READ_NUMBER_OF_SUPPORTED_ADVERTISING_SETS
 * This command is used to read the maximum number of advertising sets
 * supported by the Controller at the same time during extended advertising.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.58].
 * 
 * @param[out] Num_Supported_Advertising_Sets Number of advertising sets
 *        supported at the same time.
 *        Values:
 *        - 0x01 ... 0xF0
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_read_number_of_supported_advertising_sets( uint8_t* Num_Supported_Advertising_Sets );

/**
 * @brief HCI_LE_REMOVE_ADVERTISING_SET
 * This command is used to remove an advertising set from the Controller.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.59].
 * 
 * @param Advertising_Handle Used to identify an advertising set.
 *        Values:
 *        - 0x00 ... 0xEF
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_remove_advertising_set( uint8_t Advertising_Handle );

/**
 * @brief HCI_LE_CLEAR_ADVERTISING_SETS
 * This command is used to remove all existing advertising sets from the
 * Controller.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.60].
 * 
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_clear_advertising_sets( void );

/**
 * @brief HCI_LE_SET_EXTENDED_SCAN_PARAMETERS
 * This command is used to set the extended scan parameters to be used on the
 * advertising physical channels.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.64].
 * 
 * @param Own_Address_Type Own address type.
 *        Values:
 *        - 0x00: Public Device Address
 *        - 0x01: Random Device Address
 *        - 0x02: Resolvable Private Address if available, otherwise Public
 *          Address
 *        - 0x03: Resolvable Private Address if available, otherwise Random
 *          Address
 * @param Scanning_Filter_Policy Scan filter policy.
 *        Values:
 *        - 0x00: Accept all advertising and scan response PDUs except directed
 *          advertising PDUs not addressed to this device
 *        - 0x01: Accept only advertising and scan response PDUs from devices
 *          where the advertiser's address is in the White List. Directed
 *          advertising PDUs which are not addressed to this device shall be
 *          ignored.
 *        - 0x02: Accept all advertising and scan response PDUs except directed
 *          advertising PDUs where the identity address corresponding to
 *          TargetA does not address this device.
 *        - 0x03: Accept all advertising and scan response PDUs except
 *          advertising and scan response PDUs where the advertiser's identity
 *          address is not in the White List; and directed advertising PDUs
 *          where the identity address corresponding to TargetA does not
 *          address this device.
 * @param Scanning_PHYs Scan PHYs.
 *        Flags:
 *        - 0x01: Scan advertisements on the LE 1M PHY
 *        - 0x04: Scan advertisements on the LE Coded PHY (not supported)
 * @param Scan_Type Passive or active scanning. With passive scanning, no scan
 *        request PDUs are sent.
 *        Values:
 *        - 0x00: Passive scanning
 *        - 0x01: Active scanning
 * @param Scan_Interval Time interval from when the Controller started its last
 *        scan until it begins the subsequent scan on the primary advertising
 *        physical channel.
 *        Time = N * 0.625 ms.
 *        Values:
 *        - 0x0004 (2.500 ms)  ... 0xFFFF (40959.375 ms)
 * @param Scan_Window Duration of the scan on the primary advertising physical
 *        channel.
 *        Time = N * 0.625 ms.
 *        Values:
 *        - 0x0004 (2.500 ms)  ... 0xFFFF (40959.375 ms)
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_set_extended_scan_parameters( uint8_t Own_Address_Type,
                                                uint8_t Scanning_Filter_Policy,
                                                uint8_t Scanning_PHYs,
                                                uint8_t Scan_Type,
                                                uint16_t Scan_Interval,
                                                uint16_t Scan_Window );

/**
 * @brief HCI_LE_SET_EXTENDED_SCAN_ENABLE
 * This command is used to enable or disable extended scanning.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.65].
 * 
 * @param Enable Enable/disable scan.
 *        Values:
 *        - 0x00: Scanning disabled
 *        - 0x01: Scanning enabled
 * @param Filter_Duplicates Duplicate filtering.
 *        Values:
 *        - 0x00: Duplicate filtering disabled
 *        - 0x01: Duplicate filtering enabled
 *        - 0x02: Duplicate filtering enabled, reset for each scan period
 * @param Duration Scan duration.
 *        Time = N * 10 ms.
 *        Values:
 *        - 0x0000 (0 ms) : Scan continuously until explicitly disable
 *        - 0x0001 (10 ms)  ... 0xFFFF (655350 ms) : Scan duration
 * @param Period Scan period.
 *        Time = N * 1.28 s.
 *        Values:
 *        - 0x0000 (0 ms) : Scan continuously
 *        - 0x0001 (1280 ms)  ... 0xFFFF (83884800 ms) : Time interval from
 *          when the Controller started its last Scan_Duration until it begins
 *          the subsequent Scan_Duration
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_set_extended_scan_enable( uint8_t Enable,
                                            uint8_t Filter_Duplicates,
                                            uint16_t Duration,
                                            uint16_t Period );

/**
 * @brief HCI_LE_EXTENDED_CREATE_CONNECTION
 * This command is used to create an ACL connection to a connectable advertiser
 * by means of extended scanning.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.66].
 * 
 * @param Initiator_Filter_Policy Initiator filter policy.
 *        Values:
 *        - 0x00: White list is not used
 *        - 0x01: White list is used
 * @param Own_Address_Type Own address type.
 *        Values:
 *        - 0x00: Public Device Address
 *        - 0x01: Random Device Address
 *        - 0x02: Resolvable Private Address if available, otherwise Public
 *          Address
 *        - 0x03: Resolvable Private Address if available, otherwise Random
 *          Address
 * @param Peer_Address_Type Address type of the peer device.
 *        Values:
 *        - 0x00: Public Device Address or Public Identity Address
 *        - 0x01: Random Device Address or Random (static) Identity Address
 * @param Peer_Address Public Device Address, Random Device Address, Public
 *        Identity Address, or Random (static) Identity Address of the device
 *        to be connected.
 * @param Initiating_PHYs Initiating PHYs.
 *        Values:
 *        - 0: Scan connectable advertisements on the LE 1M PHY- Connection
 *          parameters for the LE 1M PHY
 *        - 1: Connection parameters for the LE 2M PHY
 *        - 2: Scan connectable advertisements on the LE Coded PHY (not
 *          supported)
 * @param Scan_Interval Time interval from when the Controller started its last
 *        scan until it begins the subsequent scan on the primary advertising
 *        physical channel.
 *        Time = N * 0.625 ms.
 *        Values:
 *        - 0x0004 (2.500 ms)  ... 0xFFFF (40959.375 ms)
 * @param Scan_Window Duration of the scan on the primary advertising physical
 *        channel.
 *        Time = N * 0.625 ms.
 *        Values:
 *        - 0x0004 (2.500 ms)  ... 0xFFFF (40959.375 ms)
 * @param Conn_Interval_Min Minimum value for the connection event interval.
 *        This shall be less than or equal to Conn_Interval_Max.
 *        Time = N * 1.25 ms.
 *        Values:
 *        - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
 * @param Conn_Interval_Max Maximum value for the connection event interval.
 *        This shall be greater than or equal to Conn_Interval_Min.
 *        Time = N * 1.25 ms.
 *        Values:
 *        - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
 * @param Conn_Latency Slave latency for the connection in number of connection
 *        events.
 *        Values:
 *        - 0x0000 ... 0x01F3
 * @param Supervision_Timeout Supervision timeout for the LE Link.
 *        It shall be a multiple of 10 ms and larger than (1 +
 *        connSlaveLatency) * connInterval * 2.
 *        Time = N * 10 ms.
 *        Values:
 *        - 0x000A (100 ms)  ... 0x0C80 (32000 ms)
 * @param Min_CE_Length Information parameter about the minimum length of
 *        connection needed for this LE connection.
 *        Time = N * 0.625 ms.
 *        Values:
 *        - 0x0000 (0.000 ms)  ... 0xFFFF (40959.375 ms)
 * @param Max_CE_Length Information parameter about the maximum length of
 *        connection needed for this LE connection.
 *        Time = N * 0.625 ms.
 *        Values:
 *        - 0x0000 (0.000 ms)  ... 0xFFFF (40959.375 ms)
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_extended_create_connection( uint8_t Initiator_Filter_Policy,
                                              uint8_t Own_Address_Type,
                                              uint8_t Peer_Address_Type,
                                              const uint8_t* Peer_Address,
                                              uint8_t Initiating_PHYs,
                                              uint16_t Scan_Interval,
                                              uint16_t Scan_Window,
                                              uint16_t Conn_Interval_Min,
                                              uint16_t Conn_Interval_Max,
                                              uint16_t Conn_Latency,
                                              uint16_t Supervision_Timeout,
                                              uint16_t Min_CE_Length,
                                              uint16_t Max_CE_Length );

/**
 * @brief HCI_LE_READ_TRANSMIT_POWER
 * This command is used to read the minimum and maximum transmit powers
 * supported by the Controller.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.74].
 * 
 * @param[out] Min_TX_Power Signed integer. Units: dBm
 *        Values:
 *        - -127 ... 20
 * @param[out] Max_TX_Power Signed integer. Units: dBm
 *        Values:
 *        - -127 ... 20
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_read_transmit_power( uint8_t* Min_TX_Power,
                                       uint8_t* Max_TX_Power );

/**
 * @brief HCI_LE_SET_PRIVACY_MODE
 * This command is used to allow the Host to specify the privacy mode to be
 * used for a given entry on the resolving list.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.8.77].
 * 
 * @param Peer_Identity_Address_Type Identity address type.
 *        Values:
 *        - 0x00: Public Identity Address
 *        - 0x01: Random (static) Identity Address
 * @param Peer_Identity_Address Public or Random (static) Identity address of
 *        the peer device
 * @param Privacy_Mode Privacy Mode.
 *        Values:
 *        - 0x00: Use Network Privacy Mode
 *        - 0x01: Use Device Privacy Mode
 * @return Value indicating success or error code.
 */
tBleStatus hci_le_set_privacy_mode( uint8_t Peer_Identity_Address_Type,
                                    const uint8_t* Peer_Identity_Address,
                                    uint8_t Privacy_Mode );


#endif /* BLE_HCI_LE_H__ */