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

ble_events.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: da11e262494de70c616cc70f8ac9632710441a37 (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
/*****************************************************************************
 * @file    ble_events.h
 * @author  MDG
 * @brief   STM32WB BLE API (event callbacks)
 *          Auto-generated file: do not edit!
 *****************************************************************************
 * @attention
 *
 * Copyright (c) 2018-2022 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_EVENTS_H__
#define BLE_EVENTS_H__


#include "ble_types.h"

#define HCI_EVENT_TABLE_SIZE 6
#define HCI_LE_EVENT_TABLE_SIZE 16
#define HCI_VS_EVENT_TABLE_SIZE 51

typedef struct
{
  uint16_t evt_code;
  void (*process)( const uint8_t* in );
} hci_event_table_t;

extern const hci_event_table_t hci_event_table[HCI_EVENT_TABLE_SIZE];
extern const hci_event_table_t hci_le_event_table[HCI_LE_EVENT_TABLE_SIZE];
extern const hci_event_table_t hci_vs_event_table[HCI_VS_EVENT_TABLE_SIZE];

/* HCI events */

/**
 * @brief HCI_DISCONNECTION_COMPLETE_EVENT
 * The Disconnection Complete event occurs when a connection is terminated.
 * The status parameter indicates if the disconnection was successful or not.
 * The reason parameter indicates the reason for the disconnection if the
 * disconnection was successful. If the disconnection was not successful, the
 * value of the reason parameter can be ignored by the Host. For example, this
 * can be the case if the Host has issued the Disconnect command and there was
 * a parameter error, or the command was not presently allowed, or a
 * Connection_Handle that didn't correspond to a connection was given.
 * 
 * @param Status Status error code.
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Reason Reason for disconnection (see Bluetooth spec. [Vol 1, Part F]
 *        Error Codes).
 * @return None
 */
void hci_disconnection_complete_event( uint8_t Status,
                                       uint16_t Connection_Handle,
                                       uint8_t Reason );

/**
 * @brief HCI_ENCRYPTION_CHANGE_EVENT
 * The Encryption Change event is used to indicate that the change of the
 * encryption mode has been completed. The Connection_Handle will be a
 * Connection_Handle for an ACL connection. The Encryption_Enabled event
 * parameter specifies the new Encryption_Enabled parameter for the
 * Connection_Handle specified by the Connection_Handle event parameter. This
 * event will occur on both devices to notify the Hosts when Encryption has
 * changed for the specified Connection_Handle between two devices. Note: This
 * event shall not be generated if encryption is paused or resumed; during a
 * role switch, for example.
 * The meaning of the Encryption_Enabled parameter depends on whether the Host
 * has indicated support for Secure Connections in the
 * Secure_Connections_Host_Support parameter. When
 * Secure_Connections_Host_Support is 'disabled' or the Connection_Handle
 * refers to an LE link, the Controller shall only use Encryption_Enabled
 * values 0x00 (OFF) and 0x01 (ON).
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.7.8].
 * 
 * @param Status Status error code.
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Encryption_Enabled Link Level Encryption.
 *        Values:
 *        - 0x00: Link Level Encryption OFF
 *        - 0x01: Link Level Encryption is ON with AES-CCM
 * @return None
 */
void hci_encryption_change_event( uint8_t Status,
                                  uint16_t Connection_Handle,
                                  uint8_t Encryption_Enabled );

/**
 * @brief HCI_READ_REMOTE_VERSION_INFORMATION_COMPLETE_EVENT
 * The Read Remote Version Information Complete event is used to indicate the
 * completion of the process obtaining the version information of the remote
 * Controller specified by the Connection_Handle event parameter. The
 * Connection_Handle shall be for an ACL connection.
 * The Version event parameter defines the specification version of the LE
 * Controller.
 * The Manufacturer_Name event parameter indicates the manufacturer of the
 * remote Controller. The Subversion event parameter is controlled by the
 * manufacturer and is implementation dependent. The Subversion event parameter
 * defines the various revisions that each version of the Bluetooth hardware
 * will go through as design processes change and errors are fixed. This allows
 * the software to determine what Bluetooth hardware is being used and, if
 * necessary, to work around various bugs in the hardware.
 * When the Connection_Handle is associated with an LE-U logical link, the
 * Version event parameter shall be Link Layer VersNr parameter, the
 * Manufacturer_Name event parameter shall be the CompId parameter, and the
 * Subversion event parameter shall be the SubVersNr parameter.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.7.12].
 * 
 * @param Status Status error code.
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Version Version of the Current LMP in the remote Controller
 * @param Manufacturer_Name Manufacturer Name of the remote Controller
 * @param Subversion Subversion of the LMP in the remote Controller
 * @return None
 */
void hci_read_remote_version_information_complete_event( uint8_t Status,
                                                         uint16_t Connection_Handle,
                                                         uint8_t Version,
                                                         uint16_t Manufacturer_Name,
                                                         uint16_t Subversion );

/**
 * @brief HCI_HARDWARE_ERROR_EVENT
 * The Hardware Error event is used to indicate some implementation specific
 * type of hardware failure for the controller. This event is used to notify
 * the Host that a hardware failure has occurred in the Controller.
 * 
 * @param Hardware_Code Hardware Error Event code.
 *        Error code 0 is not used.
 *        Error code 1 is bluecore act2 error detected.
 *        Error code 2 is bluecore time overrun error detected.
 *        Error code 3 is internal FIFO full.
 *        Values:
 *        - 0x00: Not used
 *        - 0x01: event_act2 error
 *        - 0x02: event_time_overrun error
 *        - 0x03: event_fifo_full error
 * @return None
 */
void hci_hardware_error_event( uint8_t Hardware_Code );

/**
 * @brief HCI_NUMBER_OF_COMPLETED_PACKETS_EVENT
 * The Number Of Completed Packets event is used by the Controller to indicate
 * to the Host how many HCI Data Packets have been completed (transmitted or
 * flushed) for each Connection_Handle since the previous Number Of Completed
 * Packets event was sent to the Host. This means that the corresponding buffer
 * space has been freed in the Controller. Based on this information, and the
 * HC_Total_Num_ACL_Data_Packets and HC_Total_Num_Synchronous_Data_Packets
 * return parameter of the Read_Buffer_Size command, the Host can determine for
 * which Connection_Handles the following HCI Data Packets should be sent to
 * the Controller. The Number Of Completed Packets event must not be sent
 * before the corresponding Connection Complete event. While the Controller has
 * HCI data packets in its buffer, it must keep sending the Number Of Completed
 * Packets event to the Host at least periodically, until it finally reports
 * that all the pending ACL Data Packets have been transmitted or flushed.
 * 
 * @param Number_of_Handles The number of Connection_Handles and
 *        Num_HCI_Data_Packets parameters pairs contained in this event
 * @param Handle_Packets_Pair_Entry See @ref Handle_Packets_Pair_Entry_t
 * @return None
 */
void hci_number_of_completed_packets_event( uint8_t Number_of_Handles,
                                            const Handle_Packets_Pair_Entry_t* Handle_Packets_Pair_Entry );

/**
 * @brief HCI_ENCRYPTION_KEY_REFRESH_COMPLETE_EVENT
 * The Encryption Key Refresh Complete event is used to indicate to the Host
 * that the encryption key was refreshed on the given Connection_Handle any
 * time encryption is paused and then resumed.
 * If the Encryption Key Refresh Complete event was generated due to an
 * encryption pause and resume operation embedded within a change connection
 * link key procedure, the Encryption Key Refresh Complete event shall be sent
 * prior to the Change Connection Link Key Complete event.
 * If the Encryption Key Refresh Complete event was generated due to an
 * encryption pause and resume operation embedded within a role switch
 * procedure, the Encryption Key Refresh Complete event shall be sent prior to
 * the Role Change event.
 * 
 * @param Status Status error code.
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @return None
 */
void hci_encryption_key_refresh_complete_event( uint8_t Status,
                                                uint16_t Connection_Handle );

/* HCI LE meta events */

/**
 * @brief HCI_LE_CONNECTION_COMPLETE_EVENT
 * The LE Connection Complete event indicates to both of the Hosts forming the
 * connection that a new connection has been created. Upon the creation of the
 * connection a Connection_Handle shall be assigned by the Controller, and
 * passed to the Host in this event. If the connection establishment fails this
 * event shall be provided to the Host that had issued the LE_Create_Connection
 * command.
 * This event indicates to the Host which issued a LE_Create_Connection command
 * and received a Command Status event if the connection establishment failed
 * or was successful.
 * The Master_Clock_Accuracy parameter is only valid for a slave. On a master,
 * this parameter shall be set to 0x00.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.7.65.1].
 * 
 * @param Status Status error code.
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Role Role of the local device in the connection.
 *        Values:
 *        - 0x00: Master
 *        - 0x01: Slave
 * @param Peer_Address_Type The address type of the peer device.
 *        Values:
 *        - 0x00: Public Device Address
 *        - 0x01: Random Device Address
 * @param Peer_Address Public Device Address or Random Device Address of the
 *        peer device
 * @param Conn_Interval Connection interval used on this connection.
 *        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 Master_Clock_Accuracy Master clock accuracy. Only valid for a slave.
 *        Values:
 *        - 0x00: 500 ppm
 *        - 0x01: 250 ppm
 *        - 0x02: 150 ppm
 *        - 0x03: 100 ppm
 *        - 0x04: 75 ppm
 *        - 0x05: 50 ppm
 *        - 0x06: 30 ppm
 *        - 0x07: 20 ppm
 * @return None
 */
void hci_le_connection_complete_event( uint8_t Status,
                                       uint16_t Connection_Handle,
                                       uint8_t Role,
                                       uint8_t Peer_Address_Type,
                                       const uint8_t* Peer_Address,
                                       uint16_t Conn_Interval,
                                       uint16_t Conn_Latency,
                                       uint16_t Supervision_Timeout,
                                       uint8_t Master_Clock_Accuracy );

/**
 * @brief HCI_LE_ADVERTISING_REPORT_EVENT
 * The LE Advertising Report event indicates that a device or multiple devices
 * have responded to an active scan or received some information during a
 * passive scan. The Controller may queue these advertising reports and send
 * information from multiple devices in one LE Advertising Report event.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.7.65.2].
 * Note: in the current BLE stack version, only one report is sent per event
 * (Num_Reports = 1).
 * 
 * @param Num_Reports Number of responses in this event.
 *        Values:
 *        - 0x01
 * @param Advertising_Report See @ref Advertising_Report_t
 * @return None
 */
void hci_le_advertising_report_event( uint8_t Num_Reports,
                                      const Advertising_Report_t* Advertising_Report );

/**
 * @brief HCI_LE_CONNECTION_UPDATE_COMPLETE_EVENT
 * The LE Connection Update Complete event is used to indicate that the
 * Controller process to update the connection has completed.
 * On a slave, if no connection parameters are updated, then this event shall
 * not be issued.
 * On a master, this event shall be issued if the Connection_Update command was
 * sent.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.7.65.3].
 * 
 * @param Status Status error code.
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Conn_Interval Connection interval used on this connection.
 *        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)
 * @return None
 */
void hci_le_connection_update_complete_event( uint8_t Status,
                                              uint16_t Connection_Handle,
                                              uint16_t Conn_Interval,
                                              uint16_t Conn_Latency,
                                              uint16_t Supervision_Timeout );

/**
 * @brief HCI_LE_READ_REMOTE_FEATURES_COMPLETE_EVENT
 * The LE Read Remote Features Complete event is used to indicate the
 * completion of the process of the Controller obtaining the used features of
 * the remote Bluetooth device specified by the Connection_Handle event
 * parameter.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.7.65.4].
 * 
 * @param Status Status error code.
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param LE_Features Bit Mask List of used LE features. For details see LE
 *        Link Layer specification.
 * @return None
 */
void hci_le_read_remote_features_complete_event( uint8_t Status,
                                                 uint16_t Connection_Handle,
                                                 const uint8_t* LE_Features );

/**
 * @brief HCI_LE_LONG_TERM_KEY_REQUEST_EVENT
 * The LE Long Term Key Request event indicates that the master device is
 * attempting to encrypt or re-encrypt the link and is requesting the Long Term
 * Key from the Host.
 * See Bluetooth spec. v.5.2 [Vol 6, Part B, 5.1.3] and [Vol 4, Part E,
 * 7.7.65.5].
 * 
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Random_Number 64-bit random number
 * @param Encrypted_Diversifier 16-bit encrypted diversifier
 * @return None
 */
void hci_le_long_term_key_request_event( uint16_t Connection_Handle,
                                         const uint8_t* Random_Number,
                                         uint16_t Encrypted_Diversifier );

/**
 * @brief HCI_LE_DATA_LENGTH_CHANGE_EVENT
 * The LE Data Length Change event notifies the Host of a change to either the
 * maximum Payload length or the maximum transmission time of packets in either
 * direction. The values reported are the maximum that will actually be used on
 * the connection following the change, except that on the LE Coded PHY a
 * packet taking up to 2704 us to transmit may be sent even though the
 * corresponding parameter has a lower value.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.7.65.7] and [Vol 6, Part B,
 * 4.5.10].
 * 
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param MaxTxOctets The maximum number of payload octets in a Link Layer
 *        packet that the local Controller will send on this connection
 *        (connEffectiveMaxTxOctets).
 *        Values:
 *        - 0x001B ... 0x00FB
 * @param MaxTxTime The maximum time that the local Controller will take to
 *        send a Link Layer packet on this connection (connEffectiveMaxTxTime).
 *        Values:
 *        - 0x0148 ... 0x4290
 * @param MaxRxOctets The maximum number of payload octets in a Link Layer
 *        packet that the local Controller expects to receive on this
 *        connection (connEffectiveMaxRxOctets).
 *        Values:
 *        - 0x001B ... 0x00FB
 * @param MaxRxTime The maximum time that the local Controller expects to take
 *        to receive a Link Layer packet on this connection
 *        (connEffectiveMaxRxTime).
 *        Values:
 *        - 0x0148 ... 0x4290
 * @return None
 */
void hci_le_data_length_change_event( uint16_t Connection_Handle,
                                      uint16_t MaxTxOctets,
                                      uint16_t MaxTxTime,
                                      uint16_t MaxRxOctets,
                                      uint16_t MaxRxTime );

/**
 * @brief HCI_LE_READ_LOCAL_P256_PUBLIC_KEY_COMPLETE_EVENT
 * This event is generated when local P-256 key generation is complete.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.7.65.8].
 * 
 * @param Status Status error code.
 * @param Local_P256_Public_Key Local P-256 public key.
 * @return None
 */
void hci_le_read_local_p256_public_key_complete_event( uint8_t Status,
                                                       const uint8_t* Local_P256_Public_Key );

/**
 * @brief HCI_LE_GENERATE_DHKEY_COMPLETE_EVENT
 * This event indicates that LE Diffie Hellman key generation has been
 * completed by the Controller.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.7.65.9].
 * 
 * @param Status Status error code.
 * @param DHKey Diffie Hellman Key
 * @return None
 */
void hci_le_generate_dhkey_complete_event( uint8_t Status,
                                           const uint8_t* DHKey );

/**
 * @brief HCI_LE_ENHANCED_CONNECTION_COMPLETE_EVENT
 * The LE Enhanced Connection Complete event indicates to both of the Hosts
 * forming the connection that a new connection has been created. Upon the
 * creation of the connection a Connection_Handle shall be assigned by the
 * Controller, and passed to the Host in this event. If the connection
 * establishment fails, this event shall be provided to the Host that had
 * issued the LE_Create_Connection command.
 * If this event is unmasked and LE Connection Complete event is unmasked, only
 * the LE Enhanced Connection Complete event is sent when a new connection has
 * been completed.
 * This event indicates to the Host that issued a LE_Create_Connection command
 * and received a Command Status event if the connection establishment failed
 * or was successful.
 * The Master_Clock_Accuracy parameter is only valid for a slave. On a master,
 * this parameter shall be set to 0x00.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.7.65.10].
 * 
 * @param Status Status error code.
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Role Role of the local device in the connection.
 *        Values:
 *        - 0x00: Master
 *        - 0x01: Slave
 * @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, Random Device Address, Public
 *        Identity Address or Random (static) Identity Address of the device to
 *        be connected.
 * @param Local_Resolvable_Private_Address Resolvable Private Address being
 *        used by the local device for this connection.
 *        This is only valid when the Own_Address_Type is set to 0x02 or 0x03.
 *        For other Own_Address_Type values, the Controller shall return all
 *        zeros.
 * @param Peer_Resolvable_Private_Address Resolvable Private Address being used
 *        by the peer device for this connection.
 *        This is only valid for Peer_Address_Type 0x02 and 0x03. For other
 *        Peer_Address_Type values, the Controller shall return all zeros.
 * @param Conn_Interval Connection interval used on this connection.
 *        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 Master_Clock_Accuracy Master clock accuracy. Only valid for a slave.
 *        Values:
 *        - 0x00: 500 ppm
 *        - 0x01: 250 ppm
 *        - 0x02: 150 ppm
 *        - 0x03: 100 ppm
 *        - 0x04: 75 ppm
 *        - 0x05: 50 ppm
 *        - 0x06: 30 ppm
 *        - 0x07: 20 ppm
 * @return None
 */
void hci_le_enhanced_connection_complete_event( uint8_t Status,
                                                uint16_t Connection_Handle,
                                                uint8_t Role,
                                                uint8_t Peer_Address_Type,
                                                const uint8_t* Peer_Address,
                                                const uint8_t* Local_Resolvable_Private_Address,
                                                const uint8_t* Peer_Resolvable_Private_Address,
                                                uint16_t Conn_Interval,
                                                uint16_t Conn_Latency,
                                                uint16_t Supervision_Timeout,
                                                uint8_t Master_Clock_Accuracy );

/**
 * @brief HCI_LE_DIRECT_ADVERTISING_REPORT_EVENT
 * The LE Direct Advertising Report event indicates that directed
 * advertisements have been received where the advertiser is using a resolvable
 * private address for the InitA field in the ADV_DIRECT_IND PDU and the
 * Scanning_Filter_Policy is equal to 0x02 or 0x03, see
 * HCI_LE_Set_Scan_Parameters.
 * Direct_Address_Type and Direct_Addres is the address the directed
 * advertisements are being directed to. Address_Type and Address is the
 * address of the advertiser sending the directed advertisements.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.7.65.11].
 * 
 * @param Num_Reports Number of responses in this event.
 *        Values:
 *        - 0x01
 * @param Direct_Advertising_Report See @ref Direct_Advertising_Report_t
 * @return None
 */
void hci_le_direct_advertising_report_event( uint8_t Num_Reports,
                                             const Direct_Advertising_Report_t* Direct_Advertising_Report );

/**
 * @brief HCI_LE_PHY_UPDATE_COMPLETE_EVENT
 * The LE PHY Update Complete Event is used to indicate that the Controller has
 * changed the transmitter PHY or receiver PHY in use.
 * If the Controller changes the transmitter PHY, the receiver PHY, or both
 * PHYs, this event shall be issued.
 * If an LE_Set_PHY command was sent and the Controller determines that neither
 * PHY will change as a result, it issues this event immediately.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.7.65.12].
 * 
 * @param Status Status error code.
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param 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 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 None
 */
void hci_le_phy_update_complete_event( uint8_t Status,
                                       uint16_t Connection_Handle,
                                       uint8_t TX_PHY,
                                       uint8_t RX_PHY );

/**
 * @brief HCI_LE_EXTENDED_ADVERTISING_REPORT_EVENT
 * The HCI_LE_Extended_Advertising_Report event indicates that a Bluetooth
 * device has responded to an active scan or has broadcast advertisements that
 * were received during a passive scan.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.7.65.13].
 * 
 * @param Num_Reports Number of responses in this event.
 *        Values:
 *        - 0x01
 * @param Event_Type Event type.
 *        Flags:
 *        - 0x0001: Connectable advertising
 *        - 0x0002: Scannable advertising
 *        - 0x0004: Directed advertising
 *        - 0x0008: Scan response
 *        - 0x0010: Legacy advertising PDUs used
 *        - 0x0020: Incomplete, more data to come
 *        - 0x0040: Incomplete, data truncated, no more to come
 * @param Address_Type Address type of the advertising device.
 *        Values:
 *        - 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)
 *        - 0xFF: No address provided (anonymous advertisement)
 * @param Address Public Device Address, Random Device Address, Public Identity
 *        Address, or Random (static) Identity Address of the advertising
 *        device.
 * @param Primary_PHY Primary advetising PHY.
 *        Values:
 *        - 0x01: Advertiser PHY is LE 1M
 * @param Secondary_PHY Secondary advetising PHY.
 *        Values:
 *        - 0x00: No packets on the secondary advertising physical channel
 *        - 0x01: Advertiser PHY is LE 1M
 *        - 0x02: Advertiser PHY is LE 2M
 *        - 0x03: Advertiser PHY is LE Coded
 * @param Advertising_SID Value of the Advertising SID subfield in the ADI
 *        field of the PDU or, for scan responses, in the ADI field of the
 *        original scannable.
 *        Values:
 *        - 0xFF: No ADI field provided
 *        - 0x00 ... 0x0F: Advertising SID subfield
 * @param TX_Power Tx Power (signed integer).
 *        Units: dBm.
 *        Values:
 *        - 127: Tx power information not available
 *        - -127 ... 20: Tx power
 * @param RSSI RSSI (signed integer).
 *        Units: dBm.
 *        Values:
 *        - 127: RSSI not available
 *        - -127 ... 20
 * @param Periodic_Adv_Interval Interval of the periodic advertising.
 *        Values:
 *        - 0x0000: No periodic advertising
 * @param Direct_Address_Type Target device address type.
 *        Values:
 *        - 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)
 *        - 0xFE: Random Device Address (Controller unable to resolve)
 * @param Direct_Address Public Device Address, Random Device Address, Public
 *        Identity Address, or Random (static) Identity Address of the target
 *        device.
 * @param Data_Length Length of Data
 * @param Data Octets of advertising or scan response data formatted as defined
 *        in Bluetooth spec. v.5.2 [Vol 3, Part C, 11].
 * @return None
 */
void hci_le_extended_advertising_report_event( uint8_t Num_Reports,
                                               uint16_t Event_Type,
                                               uint8_t Address_Type,
                                               const uint8_t* Address,
                                               uint8_t Primary_PHY,
                                               uint8_t Secondary_PHY,
                                               uint8_t Advertising_SID,
                                               uint8_t TX_Power,
                                               uint8_t RSSI,
                                               uint16_t Periodic_Adv_Interval,
                                               uint8_t Direct_Address_Type,
                                               const uint8_t* Direct_Address,
                                               uint8_t Data_Length,
                                               const uint8_t* Data );

/**
 * @brief HCI_LE_SCAN_TIMEOUT_EVENT
 * The HCI_LE_Scan_Timeout event indicates that scanning has ended because the
 * duration has expired.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.7.65.17].
 * 
 * @return None
 */
void hci_le_scan_timeout_event( void );

/**
 * @brief HCI_LE_ADVERTISING_SET_TERMINATED_EVENT
 * The HCI_LE_Advertising_Set_Terminated event indicates that the Controller
 * has terminated advertising in the advertising sets specified by the
 * Advertising_Handle parameter.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.7.65.18].
 * 
 * @param Status Status error code.
 * @param Advertising_Handle Used to identify an advertising set.
 *        Values:
 *        - 0x00 ... 0xEF
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Num_Completed_Ext_Adv_Events Number of completed extended advertising
 *        events transmitted by the Controller.
 *        Values:
 *        - 0x00 ... 0xFF
 * @return None
 */
void hci_le_advertising_set_terminated_event( uint8_t Status,
                                              uint8_t Advertising_Handle,
                                              uint16_t Connection_Handle,
                                              uint8_t Num_Completed_Ext_Adv_Events );

/**
 * @brief HCI_LE_SCAN_REQUEST_RECEIVED_EVENT
 * The HCI_LE_Scan_Request_Received event indicates that a SCAN_REQ PDU or an
 * AUX_SCAN_REQ PDU has been received by the advertiser. The request contains a
 * device address from a scanner that is allowed by the advertising filter
 * policy. The advertising set is identified by Advertising_Handle.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.7.65.19].
 * 
 * @param Advertising_Handle Used to identify an advertising set.
 *        Values:
 *        - 0x00 ... 0xEF
 * @param Scanner_Address_Type Scanner address type.
 *        Values:
 *        - 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)
 * @param Scanner_Address Public Device Address, Random Device Address, Public
 *        Identity Address, or Random (static) Identity Address of the scanner
 *        device.
 * @return None
 */
void hci_le_scan_request_received_event( uint8_t Advertising_Handle,
                                         uint8_t Scanner_Address_Type,
                                         const uint8_t* Scanner_Address );

/**
 * @brief HCI_LE_CHANNEL_SELECTION_ALGORITHM_EVENT
 * The HCI_LE_Channel_Selection_Algorithm event indicates which channel
 * selection algorithm is used on a data physical channel connection.
 * See Bluetooth spec. v.5.2 [Vol 4, Part E, 7.7.65.20].
 * 
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Channel_Selection_Algorithm LE Channel Selection Algorithm.
 *        Values:
 *        - 0x00: Algorithm #1 is used
 *        - 0x01: Algorithm #2 is used
 * @return None
 */
void hci_le_channel_selection_algorithm_event( uint16_t Connection_Handle,
                                               uint8_t Channel_Selection_Algorithm );

/* ACI GAP events */

/**
 * @brief ACI_GAP_LIMITED_DISCOVERABLE_EVENT
 * This event is generated by the controller when the limited discoverable mode
 * ends due to timeout. The timeout is 180 seconds.
 * 
 * @return None
 */
void aci_gap_limited_discoverable_event( void );

/**
 * @brief ACI_GAP_PAIRING_COMPLETE_EVENT
 * This event is generated when the pairing process has completed successfully
 * or a pairing procedure timeout has occurred or the pairing has failed. This
 * is to notify the application that we have paired with a remote device so
 * that it can take further actions or to notify that a timeout has occurred so
 * that the upper layer can decide to disconnect the link.
 * 
 * @param Connection_Handle Handle of the connection where this event occurred.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Status Pairing status
 *        Values:
 *        - 0x00: Success
 *        - 0x01: SMP timeout
 *        - 0x02: Pairing failed
 *        - 0x03: Encryption failed
 * @param Reason Pairing reason error code (valid in case of pairing failed
 *        status)
 *        Values:
 *        - 0x02: OOB_NOT_AVAILABLE
 *        - 0x03: AUTH_REQ_CANNOT_BE_MET
 *        - 0x04: CONFIRM_VALUE_FAILED
 *        - 0x05: PAIRING_NOT_SUPPORTED
 *        - 0x06: INSUFF_ENCRYPTION_KEY_SIZE
 *        - 0x07: CMD_NOT_SUPPORTED
 *        - 0x08: UNSPECIFIED_REASON
 *        - 0x09: VERY_EARLY_NEXT_ATTEMPT
 *        - 0x0A: SM_INVALID_PARAMS
 *        - 0x0B: SMP_SC_DHKEY_CHECK_FAILED
 *        - 0x0C: SMP_SC_NUMCOMPARISON_FAILED
 * @return None
 */
void aci_gap_pairing_complete_event( uint16_t Connection_Handle,
                                     uint8_t Status,
                                     uint8_t Reason );

/**
 * @brief ACI_GAP_PASS_KEY_REQ_EVENT
 * This event is generated by the Security manager to the application when a
 * passkey is required for pairing. When this event is received, the
 * application has to respond with the ACI_GAP_PASS_KEY_RESP command.
 * 
 * @param Connection_Handle Handle of the connection where this event occurred.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @return None
 */
void aci_gap_pass_key_req_event( uint16_t Connection_Handle );

/**
 * @brief ACI_GAP_AUTHORIZATION_REQ_EVENT
 * This event is generated by the Security manager to the application when the
 * application has set that authorization is required for reading/writing of
 * attributes. This event will be generated as soon as the pairing is complete.
 * When this event is received, ACI_GAP_AUTHORIZATION_RESP command should be
 * used to respond by the application.
 * 
 * @param Connection_Handle Handle of the connection where this event occurred.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @return None
 */
void aci_gap_authorization_req_event( uint16_t Connection_Handle );

/**
 * @brief ACI_GAP_SLAVE_SECURITY_INITIATED_EVENT
 * This event is generated when the slave security request is successfully sent
 * to the master.
 * 
 * @return None
 */
void aci_gap_slave_security_initiated_event( void );

/**
 * @brief ACI_GAP_BOND_LOST_EVENT
 * This event is generated when a pairing request is issued in response to a
 * slave security request from a master which has previously bonded with the
 * slave. When this event is received, the upper layer has to issue the command
 * ACI_GAP_ALLOW_REBOND in order to allow the slave to continue the pairing
 * process with the master.
 * 
 * @return None
 */
void aci_gap_bond_lost_event( void );

/**
 * @brief ACI_GAP_PROC_COMPLETE_EVENT
 * This event is sent by the GAP to the upper layers when a procedure
 * previously started has been terminated by the upper layer or has completed
 * for any other reason
 * 
 * @param Procedure_Code Terminated procedure.
 *        Values:
 *        - 0x01: GAP_LIMITED_DISCOVERY_PROC
 *        - 0x02: GAP_GENERAL_DISCOVERY_PROC
 *        - 0x08: GAP_AUTO_CONNECTION_ESTABLISHMENT_PROC
 *        - 0x10: GAP_GENERAL_CONNECTION_ESTABLISHMENT_PROC
 *        - 0x20: GAP_SELECTIVE_CONNECTION_ESTABLISHMENT_PROC
 *        - 0x40: GAP_DIRECT_CONNECTION_ESTABLISHMENT_PROC
 *        - 0x80: GAP_OBSERVATION_PROC
 * @param Status Status error code.
 * @param Data_Length Length of Data in octets
 * @param Data Procedure Specific Data:
 *        - For Name Discovery Procedure: the name of the peer device if the
 *        procedure completed successfully.
 * @return None
 */
void aci_gap_proc_complete_event( uint8_t Procedure_Code,
                                  uint8_t Status,
                                  uint8_t Data_Length,
                                  const uint8_t* Data );

/**
 * @brief ACI_GAP_ADDR_NOT_RESOLVED_EVENT
 * This event is sent only by a privacy enabled Peripheral. The event is sent
 * to the upper layers when the peripheral is unsuccessful in resolving the
 * resolvable address of the peer device after connecting to it.
 * 
 * @param Connection_Handle Handle of the connection where this event occurred.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @return None
 */
void aci_gap_addr_not_resolved_event( uint16_t Connection_Handle );

/**
 * @brief ACI_GAP_NUMERIC_COMPARISON_VALUE_EVENT
 * This event is sent only during SC Pairing, when Numeric Comparison
 * Association model is selected, in order to show the Numeric Value generated,
 * and to ask for Confirmation to the User. When this event is received, the
 * application has to respond with the ACI_GAP_NUMERIC_COMPARISON_RESP command.
 * 
 * @param Connection_Handle Handle of the connection where this event occurred.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Numeric_Value Generated numeric value.
 * @return None
 */
void aci_gap_numeric_comparison_value_event( uint16_t Connection_Handle,
                                             uint32_t Numeric_Value );

/**
 * @brief ACI_GAP_KEYPRESS_NOTIFICATION_EVENT
 * This event is sent only during SC Pairing, when Keypress Notifications are
 * supported, in order to show the input type signalled by the peer device,
 * having Keyboard only I/O capabilities. When this event is received, no
 * action is required to the User.
 * 
 * @param Connection_Handle Handle of the connection where this event occurred.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Notification_Type Type of Keypress input notified/signaled by peer
 *        device (having Keyboard only I/O capabilities.
 * @return None
 */
void aci_gap_keypress_notification_event( uint16_t Connection_Handle,
                                          uint8_t Notification_Type );

/* ACI GATT/ATT events */

/**
 * @brief ACI_GATT_ATTRIBUTE_MODIFIED_EVENT
 * This event is generated to the application by the GATT server when a client
 * modifies any attribute on the server, as consequence of one of the following
 * GATT procedures:
 * - write without response
 * - signed write without response
 * - write characteristic value
 * - write long characteristic value
 * - reliable write.
 * 
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Attr_Handle Handle of the attribute that was modified.
 * @param Offset Bits 14-0: offset from which the write has been performed by
 *        the peer device. Bit 15 is used as flag: when set to 1 it indicates
 *        that more data are to come (fragmented event in case of long
 *        attribute data).
 * @param Attr_Data_Length Length of Attr_Data in octets
 * @param Attr_Data The modified value
 * @return None
 */
void aci_gatt_attribute_modified_event( uint16_t Connection_Handle,
                                        uint16_t Attr_Handle,
                                        uint16_t Offset,
                                        uint16_t Attr_Data_Length,
                                        const uint8_t* Attr_Data );

/**
 * @brief ACI_GATT_PROC_TIMEOUT_EVENT
 * This event is generated by the client/server to the application on a GATT
 * timeout (30 seconds). This is a critical event that should not happen during
 * normal operating conditions. It is an indication of either a major
 * disruption in the communication link or a mistake in the application which
 * does not provide a reply to GATT procedures. After this event, the GATT
 * channel is closed and no more GATT communication can be performed. The
 * applications is exptected to issue an ACI_GAP_TERMINATE to disconnect from
 * the peer device. It is important to leave an 100 ms blank window before
 * sending the ACI_GAP_TERMINATE, since immediately after this event, system
 * could save important information in non volatile memory.
 * 
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @return None
 */
void aci_gatt_proc_timeout_event( uint16_t Connection_Handle );

/**
 * @brief ACI_ATT_EXCHANGE_MTU_RESP_EVENT
 * This event is generated in response to an Exchange MTU request. See
 * ACI_GATT_EXCHANGE_CONFIG.
 * 
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Server_RX_MTU Attribute server receive MTU size
 * @return None
 */
void aci_att_exchange_mtu_resp_event( uint16_t Connection_Handle,
                                      uint16_t Server_RX_MTU );

/**
 * @brief ACI_ATT_FIND_INFO_RESP_EVENT
 * This event is generated in response to a Find Information Request. See
 * ACI_ATT_FIND_INFO_REQ and Find Information Response in Bluetooth Core spec.
 * This event is also generated in response to ACI_GATT_DISC_ALL_CHAR_DESC
 * 
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Format Format of the hanndle-uuid pairs
 * @param Event_Data_Length Length of Handle_UUID_Pair in octets
 * @param Handle_UUID_Pair A sequence of handle-uuid pairs. if format=1, each
 *        pair is:[2 octets for handle, 2 octets for UUIDs], if format=2, each
 *        pair is:[2 octets for handle, 16 octets for UUIDs]
 * @return None
 */
void aci_att_find_info_resp_event( uint16_t Connection_Handle,
                                   uint8_t Format,
                                   uint8_t Event_Data_Length,
                                   const uint8_t* Handle_UUID_Pair );

/**
 * @brief ACI_ATT_FIND_BY_TYPE_VALUE_RESP_EVENT
 * This event is generated in response to a ACI_ATT_FIND_BY_TYPE_VALUE_REQ
 * 
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Num_of_Handle_Pair Number of attribute, group handle pairs
 * @param Attribute_Group_Handle_Pair See @ref Attribute_Group_Handle_Pair_t
 * @return None
 */
void aci_att_find_by_type_value_resp_event( uint16_t Connection_Handle,
                                            uint8_t Num_of_Handle_Pair,
                                            const Attribute_Group_Handle_Pair_t* Attribute_Group_Handle_Pair );

/**
 * @brief ACI_ATT_READ_BY_TYPE_RESP_EVENT
 * This event is generated in response to a ACI_ATT_READ_BY_TYPE_REQ. See
 * ACI_GATT_FIND_INCLUDED_SERVICES and ACI_GATT_DISC_ALL_CHAR_DESC.
 * 
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Handle_Value_Pair_Length The size of each attribute handle-value pair
 * @param Data_Length Length of Handle_Value_Pair_Data in octets
 * @param Handle_Value_Pair_Data Attribute Data List as defined in Bluetooth
 *        Core spec. A sequence of handle-value pairs: [2 octets for Attribute
 *        Handle, (Handle_Value_Pair_Length - 2 octets) for Attribute Value]
 * @return None
 */
void aci_att_read_by_type_resp_event( uint16_t Connection_Handle,
                                      uint8_t Handle_Value_Pair_Length,
                                      uint8_t Data_Length,
                                      const uint8_t* Handle_Value_Pair_Data );

/**
 * @brief ACI_ATT_READ_RESP_EVENT
 * This event is generated in response to a Read Request. See
 * ACI_GATT_READ_CHAR_VALUE.
 * 
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Event_Data_Length Length of following data
 * @param Attribute_Value The value of the attribute.
 * @return None
 */
void aci_att_read_resp_event( uint16_t Connection_Handle,
                              uint8_t Event_Data_Length,
                              const uint8_t* Attribute_Value );

/**
 * @brief ACI_ATT_READ_BLOB_RESP_EVENT
 * This event can be generated during a read long characteristic value
 * procedure. See ACI_GATT_READ_LONG_CHAR_VALUE.
 * 
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Event_Data_Length Length of following data
 * @param Attribute_Value Part of the attribute value.
 * @return None
 */
void aci_att_read_blob_resp_event( uint16_t Connection_Handle,
                                   uint8_t Event_Data_Length,
                                   const uint8_t* Attribute_Value );

/**
 * @brief ACI_ATT_READ_MULTIPLE_RESP_EVENT
 * This event is generated in response to a Read Multiple Request.
 * 
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Event_Data_Length Length of following data
 * @param Set_Of_Values A set of two or more values.
 *        A concatenation of attribute values for each of the attribute handles
 *        in the request in the order that they were requested.
 * @return None
 */
void aci_att_read_multiple_resp_event( uint16_t Connection_Handle,
                                       uint8_t Event_Data_Length,
                                       const uint8_t* Set_Of_Values );

/**
 * @brief ACI_ATT_READ_BY_GROUP_TYPE_RESP_EVENT
 * This event is generated in response to a Read By Group Type Request. See
 * ACI_GATT_DISC_ALL_PRIMARY_SERVICES.
 * 
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Attribute_Data_Length The size of each attribute data
 * @param Data_Length Length of Attribute_Data_List in octets
 * @param Attribute_Data_List Attribute Data List as defined in Bluetooth Core
 *        spec. A sequence of attribute handle, end group handle, attribute
 *        value tuples: [2 octets for Attribute Handle, 2 octets End Group
 *        Handle, (Attribute_Data_Length - 4 octets) for Attribute Value]
 * @return None
 */
void aci_att_read_by_group_type_resp_event( uint16_t Connection_Handle,
                                            uint8_t Attribute_Data_Length,
                                            uint8_t Data_Length,
                                            const uint8_t* Attribute_Data_List );

/**
 * @brief ACI_ATT_PREPARE_WRITE_RESP_EVENT
 * This event is generated in response to a ACI_ATT_PREPARE_WRITE_REQ.
 * 
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Attribute_Handle The handle of the attribute to be written
 * @param Offset The offset of the first octet to be written.
 * @param Part_Attribute_Value_Length Length of Part_Attribute_Value in octets
 * @param Part_Attribute_Value The value of the attribute to be written
 * @return None
 */
void aci_att_prepare_write_resp_event( uint16_t Connection_Handle,
                                       uint16_t Attribute_Handle,
                                       uint16_t Offset,
                                       uint8_t Part_Attribute_Value_Length,
                                       const uint8_t* Part_Attribute_Value );

/**
 * @brief ACI_ATT_EXEC_WRITE_RESP_EVENT
 * This event is generated in response to an Execute Write Request.
 * 
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @return None
 */
void aci_att_exec_write_resp_event( uint16_t Connection_Handle );

/**
 * @brief ACI_GATT_INDICATION_EVENT
 * This event is generated when an indication is received from the server.
 * 
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Attribute_Handle The handle of the attribute
 * @param Attribute_Value_Length Length of Attribute_Value in octets
 * @param Attribute_Value The current value of the attribute
 * @return None
 */
void aci_gatt_indication_event( uint16_t Connection_Handle,
                                uint16_t Attribute_Handle,
                                uint8_t Attribute_Value_Length,
                                const uint8_t* Attribute_Value );

/**
 * @brief ACI_GATT_NOTIFICATION_EVENT
 * This event is generated when a notification is received from the server.
 * 
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Attribute_Handle The handle of the attribute
 * @param Attribute_Value_Length Length of Attribute_Value in octets
 * @param Attribute_Value The current value of the attribute
 * @return None
 */
void aci_gatt_notification_event( uint16_t Connection_Handle,
                                  uint16_t Attribute_Handle,
                                  uint8_t Attribute_Value_Length,
                                  const uint8_t* Attribute_Value );

/**
 * @brief ACI_GATT_PROC_COMPLETE_EVENT
 * This event is generated when a GATT client procedure completes either with
 * error or successfully.
 * 
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Error_Code Indicates whether the procedure completed with an error or
 *        was successful (see "Status error codes" section)
 * @return None
 */
void aci_gatt_proc_complete_event( uint16_t Connection_Handle,
                                   uint8_t Error_Code );

/**
 * @brief ACI_GATT_ERROR_RESP_EVENT
 * This event is generated when an Error Response is received from the server.
 * The error response can be given by the server at the end of one of the GATT
 * discovery procedures. This does not mean that the procedure ended with an
 * error, but this error event is part of the procedure itself.
 * 
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Req_Opcode The request that generated this error response
 * @param Attribute_Handle The attribute handle that generated this error
 *        response
 * @param Error_Code The reason why the request has generated an error response
 *        (ATT error codes)
 *        Values:
 *        - 0x01: Invalid handle
 *        - 0x02: Read not permitted
 *        - 0x03: Write not permitted
 *        - 0x04: Invalid PDU
 *        - 0x05: Insufficient authentication
 *        - 0x06: Request not supported
 *        - 0x07: Invalid offset
 *        - 0x08: Insufficient authorization
 *        - 0x09: Prepare queue full
 *        - 0x0A: Attribute not found
 *        - 0x0B: Attribute not long
 *        - 0x0C: Insufficient encryption key size
 *        - 0x0D: Invalid attribute value length
 *        - 0x0E: Unlikely error
 *        - 0x0F: Insufficient encryption
 *        - 0x10: Unsupported group type
 *        - 0x11: Insufficient resources
 * @return None
 */
void aci_gatt_error_resp_event( uint16_t Connection_Handle,
                                uint8_t Req_Opcode,
                                uint16_t Attribute_Handle,
                                uint8_t Error_Code );

/**
 * @brief ACI_GATT_DISC_READ_CHAR_BY_UUID_RESP_EVENT
 * This event can be generated during a "Discover Characteristics By UUID"
 * procedure or a "Read using Characteristic UUID" procedure.
 * The attribute value will be a service declaration as defined in Bluetooth
 * spec. v.5.2 [Vol 3, Part G, 3.3.1], when a "Discover Characteristics By
 * UUID" has been started. It will be the value of the Characteristic if a*
 * "Read using Characteristic UUID" has been performed.
 * 
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Attribute_Handle The handle of the attribute
 * @param Attribute_Value_Length Length of Attribute_Value in octets
 * @param Attribute_Value The attribute value will be a service declaration as
 *        defined in Bluetooth spec. v.5.2 [Vol 3, Part G, 3.3.1], when a
 *        "Discover Characteristics By UUID" has been started.
 *        It will be the value of the Characteristic if a "Read using
 *        Characteristic UUID" has been performed.
 * @return None
 */
void aci_gatt_disc_read_char_by_uuid_resp_event( uint16_t Connection_Handle,
                                                 uint16_t Attribute_Handle,
                                                 uint8_t Attribute_Value_Length,
                                                 const uint8_t* Attribute_Value );

/**
 * @brief ACI_GATT_WRITE_PERMIT_REQ_EVENT
 * This event is given to the application when a write request, write command
 * or signed write command is received by the server from the client. This
 * event will be given to the application only if the event bit for this event
 * generation is set when the characteristic was added.
 * When this event is received, the application has to check whether the value
 * being requested for write can be allowed to be written and respond with the
 * command ACI_GATT_WRITE_RESP.
 * The details of the parameters of the command can be found. Based on the
 * response from the application, the attribute value will be modified by the
 * stack. If the write is rejected by the application, then the value of the
 * attribute will not be modified. In case of a write REQ, an error response
 * will be sent to the client, with the error code as specified by the
 * application.
 * In case of write/signed write commands, no response is sent to the client
 * but the attribute is not modified.
 * 
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Attribute_Handle The handle of the attribute
 * @param Data_Length Length of Data field
 * @param Data The data that the client has requested to write
 * @return None
 */
void aci_gatt_write_permit_req_event( uint16_t Connection_Handle,
                                      uint16_t Attribute_Handle,
                                      uint8_t Data_Length,
                                      const uint8_t* Data );

/**
 * @brief ACI_GATT_READ_PERMIT_REQ_EVENT
 * This event is given to the application when a read request or read blob
 * request is received by the server from the client. This event will be given
 * to the application only if the event bit for this event generation is set
 * when the characteristic was added.
 * On receiving this event, the application can update the value of the handle
 * if it desires and when done, it must send the ACI_GATT_ALLOW_READ command to
 * indicate to the stack that it can send the response to the client.
 * 
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Attribute_Handle The handle of the attribute
 * @param Offset Contains the offset from which the read has been requested
 * @return None
 */
void aci_gatt_read_permit_req_event( uint16_t Connection_Handle,
                                     uint16_t Attribute_Handle,
                                     uint16_t Offset );

/**
 * @brief ACI_GATT_READ_MULTI_PERMIT_REQ_EVENT
 * This event is given to the application when a read multiple request or read
 * by type request is received by the server from the client. This event will
 * be given to the application only if the event bit for this event generation
 * is set when the characteristic was added.
 * On receiving this event, the application can update the values of the
 * handles if it desires and when done, it must send the ACI_GATT_ALLOW_READ
 * command to indicate to the stack that it can send the response to the
 * client.
 * 
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Handle_Item See @ref Handle_Item_t
 * @return None
 */
void aci_gatt_read_multi_permit_req_event( uint16_t Connection_Handle,
                                           uint8_t Number_of_Handles,
                                           const Handle_Item_t* Handle_Item );

/**
 * @brief ACI_GATT_TX_POOL_AVAILABLE_EVENT
 * Each time BLE stack raises the error code BLE_STATUS_INSUFFICIENT_RESOURCES
 * (0x64), the ACI_GATT_TX_POOL_AVAILABLE_EVENT event is generated as soon as
 * there are at least two buffers available for notifications or write
 * commands.
 * 
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Available_Buffers Number of buffers available
 * @return None
 */
void aci_gatt_tx_pool_available_event( uint16_t Connection_Handle,
                                       uint16_t Available_Buffers );

/**
 * @brief ACI_GATT_SERVER_CONFIRMATION_EVENT
 * This event is generated when the client has sent the confirmation to a
 * previously sent indication
 * 
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @return None
 */
void aci_gatt_server_confirmation_event( uint16_t Connection_Handle );

/**
 * @brief ACI_GATT_PREPARE_WRITE_PERMIT_REQ_EVENT
 * This event is given to the application when a prepare write request is
 * received by the server from the client. This event will be given to the
 * application only if the event bit for this event generation is set when the
 * characteristic was added.
 * When this event is received, the application has to check whether the value
 * being requested for write can be allowed to be written and respond with the
 * command ACI_GATT_WRITE_RESP. Based on the response from the application, the
 * attribute value will be modified by the stack.
 * If the write is rejected by the application, then the value of the attribute
 * will not be modified and an error response will be sent to the client, with
 * the error code as specified by the application.
 * 
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Attribute_Handle The handle of the attribute
 * @param Offset The offset from which the prepare write has been requested
 * @param Data_Length Length of Data field
 * @param Data The data that the client has requested to write
 * @return None
 */
void aci_gatt_prepare_write_permit_req_event( uint16_t Connection_Handle,
                                              uint16_t Attribute_Handle,
                                              uint16_t Offset,
                                              uint8_t Data_Length,
                                              const uint8_t* Data );

/**
 * @brief ACI_GATT_READ_EXT_EVENT
 * When it is enabled with ACI_GATT_SET_EVENT_MASK, this event is generated
 * instead of ACI_ATT_READ_RESP_EVENT / ACI_ATT_READ_BLOB_RESP_EVENT /
 * ACI_ATT_READ_MULTIPLE_RESP_EVENT.
 * This event should be used instead of those events when ATT_MTU >
 * (BLE_EVT_MAX_PARAM_LEN - 4) i.e. ATT_MTU > 251 for BLE_EVT_MAX_PARAM_LEN
 * default value.
 * 
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Offset Bits 14-0: offset in octets from which Attribute_Value data
 *        starts. Bit 15 is used as flag: when set to 1 it indicates that more
 *        data are to come (fragmented event in case of long attribute data).
 * @param Event_Data_Length Length of following data
 * @param Attribute_Value The value of the attribute(s).
 * @return None
 */
void aci_gatt_read_ext_event( uint16_t Connection_Handle,
                              uint16_t Offset,
                              uint16_t Event_Data_Length,
                              const uint8_t* Attribute_Value );

/**
 * @brief ACI_GATT_INDICATION_EXT_EVENT
 * When it is enabled with ACI_GATT_SET_EVENT_MASK and when an indication is
 * received from the server, this event is generated instead of
 * ACI_GATT_INDICATION_EVENT.
 * This event should be used instead of ACI_GATT_INDICATION_EVENT when ATT_MTU
 * > (BLE_EVT_MAX_PARAM_LEN - 4) i.e. ATT_MTU > 251 for BLE_EVT_MAX_PARAM_LEN
 * default value.
 * 
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Attribute_Handle The handle of the attribute
 * @param Offset Bits 14-0: offset in octets from which Attribute_Value data
 *        starts. Bit 15 is used as flag: when set to 1 it indicates that more
 *        data are to come (fragmented event in case of long attribute data).
 * @param Attribute_Value_Length Length of Attribute_Value in octets
 * @param Attribute_Value The current value of the attribute
 * @return None
 */
void aci_gatt_indication_ext_event( uint16_t Connection_Handle,
                                    uint16_t Attribute_Handle,
                                    uint16_t Offset,
                                    uint16_t Attribute_Value_Length,
                                    const uint8_t* Attribute_Value );

/**
 * @brief ACI_GATT_NOTIFICATION_EXT_EVENT
 * When it is enabled with ACI_GATT_SET_EVENT_MASK and when a notification is
 * received from the server, this event is generated instead of
 * ACI_GATT_NOTIFICATION_EVENT.
 * This event should be used instead of ACI_GATT_NOTIFICATION_EVENT when
 * ATT_MTU > (BLE_EVT_MAX_PARAM_LEN - 4) i.e. ATT_MTU > 251 for
 * BLE_EVT_MAX_PARAM_LEN default value.
 * 
 * @param Connection_Handle Connection handle for which the event applies.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Attribute_Handle The handle of the attribute
 * @param Offset Bits 14-0: offset in octets from which Attribute_Value data
 *        starts. Bit 15 is used as flag: when set to 1 it indicates that more
 *        data are to come (fragmented event in case of long attribute data).
 * @param Attribute_Value_Length Length of Attribute_Value in octets
 * @param Attribute_Value The current value of the attribute
 * @return None
 */
void aci_gatt_notification_ext_event( uint16_t Connection_Handle,
                                      uint16_t Attribute_Handle,
                                      uint16_t Offset,
                                      uint16_t Attribute_Value_Length,
                                      const uint8_t* Attribute_Value );

/* ACI L2CAP events */

/**
 * @brief ACI_L2CAP_CONNECTION_UPDATE_RESP_EVENT
 * This event is generated when the master responds to the connection update
 * request packet with a connection update response packet.
 * 
 * @param Connection_Handle Handle of the connection where this event occurred.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Result Result field from the response packet.
 *        Values:
 *        - 0x0000: Connection Parameters accepted
 *        - 0x0001: Connection Parameters rejected
 * @return None
 */
void aci_l2cap_connection_update_resp_event( uint16_t Connection_Handle,
                                             uint16_t Result );

/**
 * @brief ACI_L2CAP_PROC_TIMEOUT_EVENT
 * This event is generated when the master does not respond to the connection
 * update request packet with a connection update response packet or a command
 * reject packet within 30 seconds.
 * 
 * @param Connection_Handle Handle of the connection where this event occurred.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Data_Length Length of following data
 * @return None
 */
void aci_l2cap_proc_timeout_event( uint16_t Connection_Handle,
                                   uint8_t Data_Length,
                                   const uint8_t* Data );

/**
 * @brief ACI_L2CAP_CONNECTION_UPDATE_REQ_EVENT
 * The event is given by the L2CAP layer when a connection update request is
 * received from the slave. The upper layer which receives this event has to
 * respond by sending a ACI_L2CAP_CONNECTION_PARAMETER_UPDATE_RESP command.
 * 
 * @param Connection_Handle Handle of the connection where this event occurred.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Identifier This is the identifier which associate the request to the
 *        response.
 * @param L2CAP_Length Length of the L2CAP connection update request.
 * @param 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 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 Slave_Latency Slave latency for the connection in number of
 *        connection events.
 *        Values:
 *        - 0x0000 ... 0x01F3
 * @param Timeout_Multiplier Defines connection timeout parameter in the
 *        following manner: Timeout Multiplier * 10ms.
 * @return None
 */
void aci_l2cap_connection_update_req_event( uint16_t Connection_Handle,
                                            uint8_t Identifier,
                                            uint16_t L2CAP_Length,
                                            uint16_t Interval_Min,
                                            uint16_t Interval_Max,
                                            uint16_t Slave_Latency,
                                            uint16_t Timeout_Multiplier );

/**
 * @brief ACI_L2CAP_COMMAND_REJECT_EVENT
 * This event is generated upon receipt of a valid Command Reject packet (e.g.
 * when the master responds to the Connection Update Request packet with a
 * Command Reject packet).
 * 
 * @param Connection_Handle Handle of the connection where this event occurred.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Identifier This is the identifier which associate the request to the
 *        response.
 * @param Reason Reason
 * @param Data_Length Length of following data
 * @param Data Data field associated with Reason
 * @return None
 */
void aci_l2cap_command_reject_event( uint16_t Connection_Handle,
                                     uint8_t Identifier,
                                     uint16_t Reason,
                                     uint8_t Data_Length,
                                     const uint8_t* Data );

/**
 * @brief ACI_L2CAP_COC_CONNECT_EVENT
 * This event is generated when receiving a valid Credit Based Connection
 * Request packet.
 * See Bluetooth spec. v.5.2 [Vol 3, Part A].
 * 
 * @param Connection_Handle Handle of the connection where this event occurred.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param SPSM Simplified Protocol/Service Multiplexer.
 *        Values:
 *        - 0x0001 ... 0x00FF
 * @param MTU Maximum Transmission Unit.
 *        Values:
 *        - 23 ... 65535
 * @param MPS Maximum payload size (in octets).
 *        Values:
 *        - 23 ... 65533
 * @param Initial_Credits Number of K-frames that can be received on the
 *        created channel(s) by the L2CAP layer entity sending this packet.
 *        Values:
 *        - 0 ... 65535
 * @param Channel_Number Number of channels to be created. If this parameter is
 *        set to 0, it requests the creation of one LE credit based connection-
 *        oriented channel. Otherwise, it requests the creation of one or more
 *        enhanced credit based connection-oriented channels.
 *        Values:
 *        - 0 ... 5
 * @return None
 */
void aci_l2cap_coc_connect_event( uint16_t Connection_Handle,
                                  uint16_t SPSM,
                                  uint16_t MTU,
                                  uint16_t MPS,
                                  uint16_t Initial_Credits,
                                  uint8_t Channel_Number );

/**
 * @brief ACI_L2CAP_COC_CONNECT_CONFIRM_EVENT
 * This event is generated when receiving a valid Credit Based Connection
 * Response packet.
 * See Bluetooth spec. v.5.2 [Vol 3, Part A].
 * 
 * @param Connection_Handle Handle of the connection where this event occurred.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param MTU Maximum Transmission Unit.
 *        Values:
 *        - 23 ... 65535
 * @param MPS Maximum payload size (in octets).
 *        Values:
 *        - 23 ... 65533
 * @param Initial_Credits Number of K-frames that can be received on the
 *        created channel(s) by the L2CAP layer entity sending this packet.
 *        Values:
 *        - 0 ... 65535
 * @param Result This parameter indicates the outcome of the request. A value
 *        of 0x0000 indicates success while a non-zero value indicates the
 *        request is refused.
 *        Values:
 *        - 0x0000 ... 0x000C
 * @param Channel_Number Number of created channels. It is the length of
 *        Channel_Index_List.
 *        Values:
 *        - 0 ... 5
 * @param Channel_Index_List List of channel indexes for which the primitive
 *        applies.
 * @return None
 */
void aci_l2cap_coc_connect_confirm_event( uint16_t Connection_Handle,
                                          uint16_t MTU,
                                          uint16_t MPS,
                                          uint16_t Initial_Credits,
                                          uint16_t Result,
                                          uint8_t Channel_Number,
                                          const uint8_t* Channel_Index_List );

/**
 * @brief ACI_L2CAP_COC_RECONF_EVENT
 * This event is generated when receiving a valid Credit Based Reconfigure
 * Request packet.
 * See Bluetooth spec. v.5.2 [Vol 3, Part A].
 * 
 * @param Connection_Handle Handle of the connection where this event occurred.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param MTU Maximum Transmission Unit.
 *        Values:
 *        - 23 ... 65535
 * @param MPS Maximum payload size (in octets).
 *        Values:
 *        - 23 ... 65533
 * @param Channel_Number Number of created channels. It is the length of
 *        Channel_Index_List.
 *        Values:
 *        - 1 ... 5
 * @param Channel_Index_List List of channel indexes for which the primitive
 *        applies.
 * @return None
 */
void aci_l2cap_coc_reconf_event( uint16_t Connection_Handle,
                                 uint16_t MTU,
                                 uint16_t MPS,
                                 uint8_t Channel_Number,
                                 const uint8_t* Channel_Index_List );

/**
 * @brief ACI_L2CAP_COC_RECONF_CONFIRM_EVENT
 * This event is generated when receiving a valid Credit Based Reconfigure
 * Response packet.
 * See Bluetooth spec. v.5.2 [Vol 3, Part A].
 * 
 * @param Connection_Handle Handle of the connection where this event occurred.
 *        Values:
 *        - 0x0000 ... 0x0EFF
 * @param Result This parameter indicates the outcome of the request. A value
 *        of 0x0000 indicates success while a non-zero value indicates the
 *        request is refused.
 *        Values:
 *        - 0x0000 ... 0x000C
 * @return None
 */
void aci_l2cap_coc_reconf_confirm_event( uint16_t Connection_Handle,
                                         uint16_t Result );

/**
 * @brief ACI_L2CAP_COC_DISCONNECT_EVENT
 * This event is generated when a connection-oriented channel is disconnected
 * following an L2CAP channel termination procedure.
 * See Bluetooth spec. v.5.2 [Vol 3, Part A].
 * 
 * @param Channel_Index Index of the connection-oriented channel for which the
 *        primitive applies.
 * @return None
 */
void aci_l2cap_coc_disconnect_event( uint8_t Channel_Index );

/**
 * @brief ACI_L2CAP_COC_FLOW_CONTROL_EVENT
 * This event is generated when receiving a valid Flow Control Credit signaling
 * packet.
 * See Bluetooth spec. v.5.2 [Vol 3, Part A].
 * 
 * @param Channel_Index Index of the connection-oriented channel for which the
 *        primitive applies.
 * @param Credits Number of credits the receiving device can increment,
 *        corresponding to the number of K-frames that can be sent to the peer
 *        device sending the Flow Control Credit packet.
 *        Values:
 *        - 1 ... 65535
 * @return None
 */
void aci_l2cap_coc_flow_control_event( uint8_t Channel_Index,
                                       uint16_t Credits );

/**
 * @brief ACI_L2CAP_COC_RX_DATA_EVENT
 * This event is generated when receiving a valid K-frame packet on a
 * connection-oriented channel.
 * See Bluetooth spec. v.5.2 [Vol 3, Part A].
 * Note: for the first K-frame of the SDU, the Information data contains the
 * L2CAP SDU Length coded on two octets followed by the K-frame information
 * payload. For the next K-frames of the SDU, the Information data only
 * contains the K-frame information payload.
 * 
 * @param Channel_Index Index of the connection-oriented channel for which the
 *        primitive applies.
 * @param Length Length of Data (in octets)
 * @param Data Information data
 * @return None
 */
void aci_l2cap_coc_rx_data_event( uint8_t Channel_Index,
                                  uint16_t Length,
                                  const uint8_t* Data );

/**
 * @brief ACI_L2CAP_COC_TX_POOL_AVAILABLE_EVENT
 * Each time ACI_L2CAP_COC_TX_DATA raises the error code
 * BLE_STATUS_INSUFFICIENT_RESOURCES (0x64), the
 * ACI_L2CAP_COC_TX_POOL_AVAILABLE_EVENT event is generated as soon as there is
 * a free buffer available for sending K-frames.
 * 
 * @return None
 */
void aci_l2cap_coc_tx_pool_available_event( void );

/* ACI HAL events */

/**
 * @brief ACI_HAL_END_OF_RADIO_ACTIVITY_EVENT
 * This event is generated when the device completes a radio activity and
 * provide information when a new radio activity will be performed.
 * Information provided includes type of radio activity and absolute time in
 * system ticks when a new radio activity is schedule, if any. Application can
 * use this information to schedule user activities synchronous to selected
 * radio activitities. A command ACI_HAL_SET_RADIO_ACTIVITY_MASK is provided to
 * enable radio activity events of user interests, by default no events are
 * enabled.
 * User should take into account that enabling radio events in application with
 * intense radio activity could lead to a fairly high rate of events generated.
 * Application use cases includes synchronizing notification with connection
 * interval, switching antenna at the end of advertising or performing flash
 * erase operation while radio is idle.
 * 
 * @param Last_State Completed radio events
 *        Values:
 *        - 0x00: Idle
 *        - 0x01: Advertising
 *        - 0x02: Connection event slave
 *        - 0x03: Scanning
 *        - 0x04: Connection request
 *        - 0x05: Connection event slave
 *        - 0x06: TX test mode
 *        - 0x07: RX test mode
 * @param Next_State Incoming radio events
 *        Values:
 *        - 0x00: Idle
 *        - 0x01: Advertising
 *        - 0x02: Connection event slave
 *        - 0x03: Scanning
 *        - 0x04: Connection request
 *        - 0x05: Connection event slave
 *        - 0x06: TX test mode
 *        - 0x07: RX test mode
 * @param Next_State_SysTime 32bit absolute current time expressed in internal
 *        time units.
 * @return None
 */
void aci_hal_end_of_radio_activity_event( uint8_t Last_State,
                                          uint8_t Next_State,
                                          uint32_t Next_State_SysTime );

/**
 * @brief ACI_HAL_SCAN_REQ_REPORT_EVENT
 * This event is reported to the application after a scan request is received
 * and a scan response is scheduled to be transmitted.
 * Note: RSSI in this event is valid only when privacy is not used.
 * 
 * @param RSSI RSSI (signed integer).
 *        Units: dBm.
 *        Values:
 *        - 127: RSSI not available
 *        - -127 ... 20
 * @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
 *        peer device
 * @return None
 */
void aci_hal_scan_req_report_event( uint8_t RSSI,
                                    uint8_t Peer_Address_Type,
                                    const uint8_t* Peer_Address );

/**
 * @brief ACI_HAL_FW_ERROR_EVENT
 * This event is generated to report firmware error information.
 * 
 * @param FW_Error_Type FW Error type
 *        Values:
 *        - 0x01: L2CAP recombination failure
 *        - 0x02: GATT unexpected peer message
 *        - 0x03: NVM level warning
 *        - 0x04: COC RX data length too large
 * @param Data_Length Length of Data in octets
 * @param Data The error event info
 * @return None
 */
void aci_hal_fw_error_event( uint8_t FW_Error_Type,
                             uint8_t Data_Length,
                             const uint8_t* Data );


#endif /* BLE_EVENTS_H__ */