xref: /btstack/port/stm32-wb55xx-nucleo-freertos/Middlewares/STM32_WPAN/ble/core/auto/ble_events.c (revision 0561b2d8d5dba972c7daa57d5e677f7a1327edfd)
1 /******************************************************************************
2  * @file    ble_events.c
3  * @author  MCD Application Team
4  * @date    19 July 2019
5  * @brief   Source file for STM32WB (Event callbacks)
6  *          Auto-generated file: do not edit!
7  ******************************************************************************
8  * @attention
9  *
10  * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
11  * All rights reserved.</center></h2>
12  *
13  * This software component is licensed by ST under Ultimate Liberty license
14  * SLA0044, the "License"; You may not use this file except in compliance with
15  * the License. You may obtain a copy of the License at:
16  *                             www.st.com/SLA0044
17  *
18  ******************************************************************************
19  */
20 
21 #include "ble_events.h"
22 
23 void hci_disconnection_complete_event_process(uint8_t *buffer_in);
24 void hci_encryption_change_event_process(uint8_t *buffer_in);
25 void hci_read_remote_version_information_complete_event_process(uint8_t *buffer_in);
26 void hci_hardware_error_event_process(uint8_t *buffer_in);
27 void hci_number_of_completed_packets_event_process(uint8_t *buffer_in);
28 void hci_data_buffer_overflow_event_process(uint8_t *buffer_in);
29 void hci_encryption_key_refresh_complete_event_process(uint8_t *buffer_in);
30 void aci_hal_end_of_radio_activity_event_process(uint8_t *buffer_in);
31 void aci_hal_scan_req_report_event_process(uint8_t *buffer_in);
32 void aci_hal_fw_error_event_process(uint8_t *buffer_in);
33 void aci_gap_limited_discoverable_event_process(uint8_t *buffer_in);
34 void aci_gap_pairing_complete_event_process(uint8_t *buffer_in);
35 void aci_gap_pass_key_req_event_process(uint8_t *buffer_in);
36 void aci_gap_authorization_req_event_process(uint8_t *buffer_in);
37 void aci_gap_slave_security_initiated_event_process(uint8_t *buffer_in);
38 void aci_gap_bond_lost_event_process(uint8_t *buffer_in);
39 void aci_gap_proc_complete_event_process(uint8_t *buffer_in);
40 void aci_gap_addr_not_resolved_event_process(uint8_t *buffer_in);
41 void aci_gap_numeric_comparison_value_event_process(uint8_t *buffer_in);
42 void aci_gap_keypress_notification_event_process(uint8_t *buffer_in);
43 void aci_l2cap_connection_update_resp_event_process(uint8_t *buffer_in);
44 void aci_l2cap_proc_timeout_event_process(uint8_t *buffer_in);
45 void aci_l2cap_connection_update_req_event_process(uint8_t *buffer_in);
46 void aci_l2cap_command_reject_event_process(uint8_t *buffer_in);
47 void aci_gatt_attribute_modified_event_process(uint8_t *buffer_in);
48 void aci_gatt_proc_timeout_event_process(uint8_t *buffer_in);
49 void aci_att_exchange_mtu_resp_event_process(uint8_t *buffer_in);
50 void aci_att_find_info_resp_event_process(uint8_t *buffer_in);
51 void aci_att_find_by_type_value_resp_event_process(uint8_t *buffer_in);
52 void aci_att_read_by_type_resp_event_process(uint8_t *buffer_in);
53 void aci_att_read_resp_event_process(uint8_t *buffer_in);
54 void aci_att_read_blob_resp_event_process(uint8_t *buffer_in);
55 void aci_att_read_multiple_resp_event_process(uint8_t *buffer_in);
56 void aci_att_read_by_group_type_resp_event_process(uint8_t *buffer_in);
57 void aci_att_prepare_write_resp_event_process(uint8_t *buffer_in);
58 void aci_att_exec_write_resp_event_process(uint8_t *buffer_in);
59 void aci_gatt_indication_event_process(uint8_t *buffer_in);
60 void aci_gatt_notification_event_process(uint8_t *buffer_in);
61 void aci_gatt_proc_complete_event_process(uint8_t *buffer_in);
62 void aci_gatt_error_resp_event_process(uint8_t *buffer_in);
63 void aci_gatt_disc_read_char_by_uuid_resp_event_process(uint8_t *buffer_in);
64 void aci_gatt_write_permit_req_event_process(uint8_t *buffer_in);
65 void aci_gatt_read_permit_req_event_process(uint8_t *buffer_in);
66 void aci_gatt_read_multi_permit_req_event_process(uint8_t *buffer_in);
67 void aci_gatt_tx_pool_available_event_process(uint8_t *buffer_in);
68 void aci_gatt_server_confirmation_event_process(uint8_t *buffer_in);
69 void aci_gatt_prepare_write_permit_req_event_process(uint8_t *buffer_in);
70 void aci_gatt_indication_ext_event_process(uint8_t *buffer_in);
71 void aci_gatt_notification_ext_event_process(uint8_t *buffer_in);
72 void hci_le_connection_complete_event_process(uint8_t *buffer_in);
73 void hci_le_advertising_report_event_process(uint8_t *buffer_in);
74 void hci_le_connection_update_complete_event_process(uint8_t *buffer_in);
75 void hci_le_read_remote_used_features_complete_event_process(uint8_t *buffer_in);
76 void hci_le_long_term_key_request_event_process(uint8_t *buffer_in);
77 void hci_le_data_length_change_event_process(uint8_t *buffer_in);
78 void hci_le_read_local_p256_public_key_complete_event_process(uint8_t *buffer_in);
79 void hci_le_generate_dhkey_complete_event_process(uint8_t *buffer_in);
80 void hci_le_enhanced_connection_complete_event_process(uint8_t *buffer_in);
81 void hci_le_direct_advertising_report_event_process(uint8_t *buffer_in);
82 void hci_le_phy_update_complete_event_process(uint8_t *buffer_in);
83 
84 const hci_event_table_t hci_event_table[HCI_EVENT_TABLE_SIZE] =
85 {
86   /* hci_disconnection_complete_event */
87   0x0005, hci_disconnection_complete_event_process,
88   /* hci_encryption_change_event */
89   0x0008, hci_encryption_change_event_process,
90   /* hci_read_remote_version_information_complete_event */
91   0x000c, hci_read_remote_version_information_complete_event_process,
92   /* hci_hardware_error_event */
93   0x0010, hci_hardware_error_event_process,
94   /* hci_number_of_completed_packets_event */
95   0x0013, hci_number_of_completed_packets_event_process,
96   /* hci_data_buffer_overflow_event */
97   0x001a, hci_data_buffer_overflow_event_process,
98   /* hci_encryption_key_refresh_complete_event */
99   0x0030, hci_encryption_key_refresh_complete_event_process,
100 };
101 
102 const hci_event_table_t hci_le_meta_event_table[HCI_LE_META_EVENT_TABLE_SIZE] =
103 {
104   /* hci_le_connection_complete_event */
105   0x0001, hci_le_connection_complete_event_process,
106   /* hci_le_advertising_report_event */
107   0x0002, hci_le_advertising_report_event_process,
108   /* hci_le_connection_update_complete_event */
109   0x0003, hci_le_connection_update_complete_event_process,
110   /* hci_le_read_remote_used_features_complete_event */
111   0x0004, hci_le_read_remote_used_features_complete_event_process,
112   /* hci_le_long_term_key_request_event */
113   0x0005, hci_le_long_term_key_request_event_process,
114   /* hci_le_data_length_change_event */
115   0x0007, hci_le_data_length_change_event_process,
116   /* hci_le_read_local_p256_public_key_complete_event */
117   0x0008, hci_le_read_local_p256_public_key_complete_event_process,
118   /* hci_le_generate_dhkey_complete_event */
119   0x0009, hci_le_generate_dhkey_complete_event_process,
120   /* hci_le_enhanced_connection_complete_event */
121   0x000a, hci_le_enhanced_connection_complete_event_process,
122   /* hci_le_direct_advertising_report_event */
123   0x000b, hci_le_direct_advertising_report_event_process,
124   /* hci_le_phy_update_complete_event */
125   0x000c, hci_le_phy_update_complete_event_process,
126 };
127 
128 const hci_event_table_t hci_vendor_specific_event_table[HCI_VENDOR_SPECIFIC_EVENT_TABLE_SIZE] =
129 {
130   /* aci_hal_end_of_radio_activity_event */
131   0x0004, aci_hal_end_of_radio_activity_event_process,
132   /* aci_hal_scan_req_report_event */
133   0x0005, aci_hal_scan_req_report_event_process,
134   /* aci_hal_fw_error_event */
135   0x0006, aci_hal_fw_error_event_process,
136   /* aci_gap_limited_discoverable_event */
137   0x0400, aci_gap_limited_discoverable_event_process,
138   /* aci_gap_pairing_complete_event */
139   0x0401, aci_gap_pairing_complete_event_process,
140   /* aci_gap_pass_key_req_event */
141   0x0402, aci_gap_pass_key_req_event_process,
142   /* aci_gap_authorization_req_event */
143   0x0403, aci_gap_authorization_req_event_process,
144   /* aci_gap_slave_security_initiated_event */
145   0x0404, aci_gap_slave_security_initiated_event_process,
146   /* aci_gap_bond_lost_event */
147   0x0405, aci_gap_bond_lost_event_process,
148   /* aci_gap_proc_complete_event */
149   0x0407, aci_gap_proc_complete_event_process,
150   /* aci_gap_addr_not_resolved_event */
151   0x0408, aci_gap_addr_not_resolved_event_process,
152   /* aci_gap_numeric_comparison_value_event */
153   0x0409, aci_gap_numeric_comparison_value_event_process,
154   /* aci_gap_keypress_notification_event */
155   0x040a, aci_gap_keypress_notification_event_process,
156   /* aci_l2cap_connection_update_resp_event */
157   0x0800, aci_l2cap_connection_update_resp_event_process,
158   /* aci_l2cap_proc_timeout_event */
159   0x0801, aci_l2cap_proc_timeout_event_process,
160   /* aci_l2cap_connection_update_req_event */
161   0x0802, aci_l2cap_connection_update_req_event_process,
162   /* aci_l2cap_command_reject_event */
163   0x080a, aci_l2cap_command_reject_event_process,
164   /* aci_gatt_attribute_modified_event */
165   0x0c01, aci_gatt_attribute_modified_event_process,
166   /* aci_gatt_proc_timeout_event */
167   0x0c02, aci_gatt_proc_timeout_event_process,
168   /* aci_att_exchange_mtu_resp_event */
169   0x0c03, aci_att_exchange_mtu_resp_event_process,
170   /* aci_att_find_info_resp_event */
171   0x0c04, aci_att_find_info_resp_event_process,
172   /* aci_att_find_by_type_value_resp_event */
173   0x0c05, aci_att_find_by_type_value_resp_event_process,
174   /* aci_att_read_by_type_resp_event */
175   0x0c06, aci_att_read_by_type_resp_event_process,
176   /* aci_att_read_resp_event */
177   0x0c07, aci_att_read_resp_event_process,
178   /* aci_att_read_blob_resp_event */
179   0x0c08, aci_att_read_blob_resp_event_process,
180   /* aci_att_read_multiple_resp_event */
181   0x0c09, aci_att_read_multiple_resp_event_process,
182   /* aci_att_read_by_group_type_resp_event */
183   0x0c0a, aci_att_read_by_group_type_resp_event_process,
184   /* aci_att_prepare_write_resp_event */
185   0x0c0c, aci_att_prepare_write_resp_event_process,
186   /* aci_att_exec_write_resp_event */
187   0x0c0d, aci_att_exec_write_resp_event_process,
188   /* aci_gatt_indication_event */
189   0x0c0e, aci_gatt_indication_event_process,
190   /* aci_gatt_notification_event */
191   0x0c0f, aci_gatt_notification_event_process,
192   /* aci_gatt_proc_complete_event */
193   0x0c10, aci_gatt_proc_complete_event_process,
194   /* aci_gatt_error_resp_event */
195   0x0c11, aci_gatt_error_resp_event_process,
196   /* aci_gatt_disc_read_char_by_uuid_resp_event */
197   0x0c12, aci_gatt_disc_read_char_by_uuid_resp_event_process,
198   /* aci_gatt_write_permit_req_event */
199   0x0c13, aci_gatt_write_permit_req_event_process,
200   /* aci_gatt_read_permit_req_event */
201   0x0c14, aci_gatt_read_permit_req_event_process,
202   /* aci_gatt_read_multi_permit_req_event */
203   0x0c15, aci_gatt_read_multi_permit_req_event_process,
204   /* aci_gatt_tx_pool_available_event */
205   0x0c16, aci_gatt_tx_pool_available_event_process,
206   /* aci_gatt_server_confirmation_event */
207   0x0c17, aci_gatt_server_confirmation_event_process,
208   /* aci_gatt_prepare_write_permit_req_event */
209   0x0c18, aci_gatt_prepare_write_permit_req_event_process,
210   /* aci_gatt_indication_ext_event */
211   0x0c1e, aci_gatt_indication_ext_event_process,
212   /* aci_gatt_notification_ext_event */
213   0x0c1f, aci_gatt_notification_ext_event_process,
214 };
215 
216 /* hci_disconnection_complete_event */
217 /* Event len: 1 + 2 + 1 */
218 /**
219   * @brief The Disconnection Complete event occurs when a connection is terminated.
220 The status parameter indicates if the disconnection was successful or not. The
221 reason parameter indicates the reason for the disconnection if the disconnection
222 was successful. If the disconnection was not successful, the value of the
223 reason parameter can be ignored by the Host. For example, this can be the
224 case if the Host has issued the Disconnect command and there was a parameter
225 error, or the command was not presently allowed, or a Connection_Handle
226 that didn't correspond to a connection was given.
227   * @param Status Status error code.
228   * @param Connection_Handle Connection_Handle which was disconnected.
229   * Values:
230   - 0x0000 ... 0x0EFF
231   * @param Reason Reason for disconnection.
232   * Values:
233   - 0x00: Success
234   - 0x01: Unknown HCI Command
235   - 0x02: Unknown Connection Identifier
236   - 0x03: Hardware Failure
237   - 0x05: Authentication Failure
238   - 0x06: PIN or Key Missing
239   - 0x07: Memory Capacity Exceeded
240   - 0x08: Connection Timeout
241   - 0x09: Connection Limit Exceeded
242   - 0x0B: ACL Connection Already Exists
243   - 0x0C: Command Disallowed
244   - 0x0D: Connection Rejected Due To Limited Resources
245   - 0x0E: Connection Rejected Due To Security Reasons
246   - 0x0F: Connection Rejected due to Unacceptable BD_ADDR
247   - 0x10: Connection Accept Timeout Exceeded
248   - 0x11: Unsupported Feature Or Parameter Value
249   - 0x12: Invalid HCI Command Parameters
250   - 0x13: Remote User Terminated Connection
251   - 0x14: Remote Device Terminated Connection due to Low Resources
252   - 0x15: Remote Device Terminated Connection due to Power Off
253   - 0x16: Connection Terminated By Local Host
254   - 0x17: Repeated Attempts
255   - 0x18: Pairing Not Allowed
256   - 0x19: Unknown LMP PDU
257   - 0x1A: Unsupported Remote Feature / Unsupported LMP Feature
258   - 0x1E: Invalid LMP Parameters
259   - 0x1F: Unspecified Error
260   - 0x20: Unsupported LMP Parameter Value
261   - 0x21: Role Change Not Allowed
262   - 0x22: LMP Response Timeout / LL Response Timeout
263   - 0x23: LMP Error Transaction Collision
264   - 0x24: LMP PDU Not Allowed
265   - 0x25: Encryption Mode Not Acceptable
266   - 0x26: Link Key cannot be Changed
267   - 0x28: Instant Passed
268   - 0x29: Pairing With Unit Key Not Supported
269   - 0x2A: Different Transaction Collision
270   - 0x2E: Channel Assessment Not Supported
271   - 0x2F: Insufficient Security
272   - 0x30: Parameter Out Of Mandatory Range
273   - 0x32: Role Switch Pending
274   - 0x34: Reserved Slot Violation
275   - 0x35: Role Switch Failed
276   - 0x37: Secure Simple Pairing Not Supported by Host
277   - 0x38: Host Busy - Pairing
278   - 0x39: Connection Rejected due to No Suitable Channel Found
279   - 0x3A: Controller Busy
280   - 0x3B: Unacceptable Connection Interval
281   - 0x3C: Directed Advertising Timeout
282   - 0x3D: Connection Terminated Due to MIC Failure
283   - 0x3E: Connection Failed to be Established
284   - 0x41: Failed
285   - 0x42: Invalid parameters
286   - 0x43: Busy
287   - 0x44: Invalid length
288   - 0x45: Pending
289   - 0x46: Not allowed
290   - 0x47: GATT error
291   - 0x48: Address not resolved
292   - 0x50: Invalid CID
293   - 0x5A: CSRK not found
294   - 0x5B: IRK not found
295   - 0x5C: Device not found in DB
296   - 0x5D: Security DB full
297   - 0x5E: Device not bonded
298   - 0x5F: Device in blacklist
299   - 0x60: Invalid handle
300   - 0x61: Invalid parameter
301   - 0x62: Out of handles
302   - 0x63: Invalid operation
303   - 0x64: Insufficient resources
304   - 0x65: Insufficient encryption key size
305   - 0x66: Characteristic already exist
306   - 0x82: No valid slot
307   - 0x83: Short window
308   - 0x84: New interval failed
309   - 0x85: Too large interval
310   - 0x86: Slot length failed
311   * @retval None
312 */
313 
hci_disconnection_complete_event_process(uint8_t * buffer_in)314 void hci_disconnection_complete_event_process(uint8_t *buffer_in)
315 {
316   /* Input params */
317   hci_disconnection_complete_event_rp0 *rp0 = (hci_disconnection_complete_event_rp0 *)buffer_in;
318   hci_disconnection_complete_event(rp0->Status,
319                                    rp0->Connection_Handle,
320                                    rp0->Reason);
321 }
322 
323 /* hci_encryption_change_event */
324 /* Event len: 1 + 2 + 1 */
325 /**
326   * @brief The Encryption Change event is used to indicate that the change of the encryption
327 mode has been completed. The Connection_Handle will be a Connection_Handle
328 for an ACL connection. The Encryption_Enabled event parameter
329 specifies the new Encryption_Enabled parameter for the Connection_Handle
330 specified by the Connection_Handle event parameter. This event will occur on
331 both devices to notify the Hosts when Encryption has changed for the specified
332 Connection_Handle between two devices. Note: This event shall not be generated
333 if encryption is paused or resumed; during a role switch, for example.
334 The meaning of the Encryption_Enabled parameter depends on whether the
335 Host has indicated support for Secure Connections in the Secure_Connections_Host_Support
336 parameter. When Secure_Connections_Host_Support is
337 'disabled' or the Connection_Handle refers to an LE link, the Controller shall
338 only use Encryption_Enabled values 0x00 (OFF) and 0x01 (ON).
339 (See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.7.8)
340   * @param Status Status error code.
341   * @param Connection_Handle Connection handle for which the command is given.
342   * Values:
343   - 0x0000 ... 0x0EFF
344   * @param Encryption_Enabled Link Level Encryption.
345   * Values:
346   - 0x00: Link Level Encryption OFF
347   - 0x01: Link Level Encryption is ON with AES-CCM
348   * @retval None
349 */
350 
hci_encryption_change_event_process(uint8_t * buffer_in)351 void hci_encryption_change_event_process(uint8_t *buffer_in)
352 {
353   /* Input params */
354   hci_encryption_change_event_rp0 *rp0 = (hci_encryption_change_event_rp0 *)buffer_in;
355   hci_encryption_change_event(rp0->Status,
356                               rp0->Connection_Handle,
357                               rp0->Encryption_Enabled);
358 }
359 
360 /* hci_read_remote_version_information_complete_event */
361 /* Event len: 1 + 2 + 1 + 2 + 2 */
362 /**
363   * @brief The Read Remote Version Information Complete event is used to indicate the
364 completion of the process obtaining the version information of the remote Controller
365 specified by the Connection_Handle event parameter. The Connection_Handle
366 shall be for an ACL connection.
367 The Version event parameter defines the specification version of the LE Controller.
368 The Manufacturer_Name event parameter indicates the manufacturer
369 of the remote Controller. The Subversion event parameter is controlled
370 by the manufacturer and is implementation dependent. The Subversion
371 event parameter defines the various revisions that each version of the Bluetooth
372 hardware will go through as design processes change and errors are
373 fixed. This allows the software to determine what Bluetooth hardware is being
374 used and, if necessary, to work around various bugs in the hardware.
375 When the Connection_Handle is associated with an LE-U logical link, the Version
376 event parameter shall be Link Layer VersNr parameter, the Manufacturer_Name
377 event parameter shall be the CompId parameter, and the Subversion
378 event parameter shall be the SubVersNr parameter.
379 (See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.7.12)
380   * @param Status Status error code.
381   * @param Connection_Handle Connection handle for which the command is given.
382   * Values:
383   - 0x0000 ... 0x0EFF
384   * @param Version Version of the Current LMP in the remote Controller
385   * @param Manufacturer_Name Manufacturer Name of the remote Controller
386   * @param Subversion Subversion of the LMP in the remote Controller
387   * @retval None
388 */
389 
hci_read_remote_version_information_complete_event_process(uint8_t * buffer_in)390 void hci_read_remote_version_information_complete_event_process(uint8_t *buffer_in)
391 {
392   /* Input params */
393   hci_read_remote_version_information_complete_event_rp0 *rp0 = (hci_read_remote_version_information_complete_event_rp0 *)buffer_in;
394   hci_read_remote_version_information_complete_event(rp0->Status,
395                                                      rp0->Connection_Handle,
396                                                      rp0->Version,
397                                                      rp0->Manufacturer_Name,
398                                                      rp0->Subversion);
399 }
400 
401 /* hci_hardware_error_event */
402 /* Event len: 1 */
403 /**
404   * @brief 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.
405   * @param Hardware_Code Hardware Error Event code.
406 Error code 0 is not used.
407 Error code 1 is bluecore act2 error detected.
408 Error code 2 is bluecore time overrun error detected.
409 Error code 3 is internal FIFO full.
410   * Values:
411   - 0x00: Not used
412   - 0x01: event_act2 error
413   - 0x02: event_time_overrun error
414   - 0x03: event_fifo_full error
415   * @retval None
416 */
417 
hci_hardware_error_event_process(uint8_t * buffer_in)418 void hci_hardware_error_event_process(uint8_t *buffer_in)
419 {
420   /* Input params */
421   hci_hardware_error_event_rp0 *rp0 = (hci_hardware_error_event_rp0 *)buffer_in;
422   hci_hardware_error_event(rp0->Hardware_Code);
423 }
424 
425 /* hci_number_of_completed_packets_event */
426 /* Event len: 1 + rp0->Number_of_Handles * (sizeof(Handle_Packets_Pair_Entry_t)) */
427 /**
428   * @brief 'The Number Of Completed Packets event is used by the Controller to indicate
429 to the Host how many HCI Data Packets have been completed (transmitted or
430 flushed) for each Connection_Handle since the previous Number Of Completed
431 Packets event was sent to the Host. This means that the corresponding
432 buffer space has been freed in the Controller. Based on this information, and
433 the HC_Total_Num_ACL_Data_Packets and HC_Total_Num_Synchronous_-
434 Data_Packets return parameter of the Read_Buffer_Size command, the Host
435 can determine for which Connection_Handles the following HCI Data Packets
436 should be sent to the Controller. The Number Of Completed Packets event
437 must not be sent before the corresponding Connection Complete event. While
438 the Controller has HCI data packets in its buffer, it must keep sending the Number
439 Of Completed Packets event to the Host at least periodically, until it finally
440 reports that all the pending ACL Data Packets have been transmitted or
441 flushed.
442   * @param Number_of_Handles The number of Connection_Handles and Num_HCI_Data_Packets parameters pairs contained in this event
443   * @param Handle_Packets_Pair_Entry See @ref Handle_Packets_Pair_Entry_t
444   * @retval None
445 */
446 
hci_number_of_completed_packets_event_process(uint8_t * buffer_in)447 void hci_number_of_completed_packets_event_process(uint8_t *buffer_in)
448 {
449   /* Input params */
450   hci_number_of_completed_packets_event_rp0 *rp0 = (hci_number_of_completed_packets_event_rp0 *)buffer_in;
451   hci_number_of_completed_packets_event(rp0->Number_of_Handles,
452                                         rp0->Handle_Packets_Pair_Entry);
453 }
454 
455 /* hci_data_buffer_overflow_event */
456 /* Event len: 1 */
457 /**
458   * @brief 'This event is used to indicate that the Controller's data buffers have been overflowed.
459 This can occur if the Host has sent more packets than allowed. The
460 Link_Type parameter is used to indicate that the overflow was caused by ACL data.
461   * @param Link_Type On wich type of channel overflow has occurred.
462   * Values:
463   - 0x01: ACL Buffer Overflow
464   * @retval None
465 */
466 
hci_data_buffer_overflow_event_process(uint8_t * buffer_in)467 void hci_data_buffer_overflow_event_process(uint8_t *buffer_in)
468 {
469   /* Input params */
470   hci_data_buffer_overflow_event_rp0 *rp0 = (hci_data_buffer_overflow_event_rp0 *)buffer_in;
471   hci_data_buffer_overflow_event(rp0->Link_Type);
472 }
473 
474 /* hci_encryption_key_refresh_complete_event */
475 /* Event len: 1 + 2 */
476 /**
477   * @brief 'The Encryption Key Refresh Complete event is used to indicate to the Host
478 that the encryption key was refreshed on the given Connection_Handle any
479 time encryption is paused and then resumed.
480 If the Encryption Key Refresh Complete event was generated due to an
481 encryption pause and resume operation embedded within a change connection
482 link key procedure, the Encryption Key Refresh Complete event shall be sent
483 prior to the Change Connection Link Key Complete event.
484 If the Encryption Key Refresh Complete event was generated due to an
485 encryption pause and resume operation embedded within a role switch procedure,
486 the Encryption Key Refresh Complete event shall be sent prior to the
487 Role Change event.
488   * @param Status Status error code.
489   * @param Connection_Handle Connection handle for which the command is given.
490   * Values:
491   - 0x0000 ... 0x0EFF
492   * @retval None
493 */
494 
hci_encryption_key_refresh_complete_event_process(uint8_t * buffer_in)495 void hci_encryption_key_refresh_complete_event_process(uint8_t *buffer_in)
496 {
497   /* Input params */
498   hci_encryption_key_refresh_complete_event_rp0 *rp0 = (hci_encryption_key_refresh_complete_event_rp0 *)buffer_in;
499   hci_encryption_key_refresh_complete_event(rp0->Status,
500                                             rp0->Connection_Handle);
501 }
502 
503 /* aci_hal_end_of_radio_activity_event */
504 /* Event len: 1 + 1 + 4 */
505 /**
506   * @brief 'This event is generated when the device completes a radio activity and provide information when a new radio acitivity will be performed.
507 Informtation provided includes type of radio activity and absolute time in system ticks when a new radio acitivity is schedule, if any. Application can use this information to schedule user activities synchronous to selected radio activitities. A command @ref aci_hal_set_radio_activity_mask is provided to enable radio activity events of user interests, by default no events are enabled.
508 User should take into account that enablinng radio events in application with intense radio activity could lead to a fairly high rate of events generated.
509 Application use cases includes synchronizing notification with connection interval, switiching antenna at the end of advertising or performing flash erase operation while radio is idle.
510   * @param Last_State Completed radio events
511   * Values:
512   - 0x00: Idle
513   - 0x01: Advertising
514   - 0x02: Connection event slave
515   - 0x03: Scanning
516   - 0x04: Connection request
517   - 0x05: Connection event slave
518   - 0x06: TX test mode
519   - 0x07: RX test mode
520   * @param Next_State Incoming radio events
521   * Values:
522   - 0x00: Idle
523   - 0x01: Advertising
524   - 0x02: Connection event slave
525   - 0x03: Scanning
526   - 0x04: Connection request
527   - 0x05: Connection event slave
528   - 0x06: TX test mode
529   - 0x07: RX test mode
530   * @param Next_State_SysTime 32bit absolute current time expressed in internal time units.
531   * @retval None
532 */
533 
aci_hal_end_of_radio_activity_event_process(uint8_t * buffer_in)534 void aci_hal_end_of_radio_activity_event_process(uint8_t *buffer_in)
535 {
536   /* Input params */
537   aci_hal_end_of_radio_activity_event_rp0 *rp0 = (aci_hal_end_of_radio_activity_event_rp0 *)buffer_in;
538   aci_hal_end_of_radio_activity_event(rp0->Last_State,
539                                       rp0->Next_State,
540                                       rp0->Next_State_SysTime);
541 }
542 
543 /* aci_hal_scan_req_report_event */
544 /* Event len: 1 + 1 + 6 */
545 /**
546   * @brief This event is reported to the application after a scan request is received and a scan reponse
547 is scheduled to be transmitted.
548   * @param RSSI N Size: 1 Octet (signed integer)
549 Units: dBm
550   * Values:
551   - 127: RSSI not available
552   - -127 ... 20
553   * @param Peer_Address_Type 0x00 Public Device Address
554 0x01 Random Device Address
555 0x02 Public Identity Address (Corresponds to Resolved Private Address)
556 0x03 Random (Static) Identity Address (Corresponds to Resolved Private Address)
557   * Values:
558   - 0x00: Public Device Address
559   - 0x01: Random Device Address
560   - 0x02: Public Identity Address
561   - 0x03: Random (Static) Identity Address
562   * @param Peer_Address Public Device Address or Random Device Address of the peer device
563   * @retval None
564 */
565 
aci_hal_scan_req_report_event_process(uint8_t * buffer_in)566 void aci_hal_scan_req_report_event_process(uint8_t *buffer_in)
567 {
568   /* Input params */
569   aci_hal_scan_req_report_event_rp0 *rp0 = (aci_hal_scan_req_report_event_rp0 *)buffer_in;
570   aci_hal_scan_req_report_event(rp0->RSSI,
571                                 rp0->Peer_Address_Type,
572                                 rp0->Peer_Address);
573 }
574 
575 /* aci_hal_fw_error_event */
576 /* Event len: 1 + 1 + rp0->Data_Length * (sizeof(uint8_t)) */
577 /**
578   * @brief This event is generated to report firmware error informations.
579   * @param FW_Error_Type FW Error type
580   * Values:
581   - 0x01: L2CAP recombination failure
582   - 0x02: GATT UNEXPECTED RESPONSE ERROR
583   - 0x03: NVM LEVEL WARNING
584   * @param Data_Length Length of Data in octets
585   * @param Data The error event info
586   * @retval None
587 */
588 
aci_hal_fw_error_event_process(uint8_t * buffer_in)589 void aci_hal_fw_error_event_process(uint8_t *buffer_in)
590 {
591   /* Input params */
592   aci_hal_fw_error_event_rp0 *rp0 = (aci_hal_fw_error_event_rp0 *)buffer_in;
593   aci_hal_fw_error_event(rp0->FW_Error_Type,
594                          rp0->Data_Length,
595                          rp0->Data);
596 }
597 
598 /* aci_gap_limited_discoverable_event */
599 /* Event len: 0 */
600 /**
601   * @brief This event is generated by the controller when the limited discoverable mode ends due to
602 timeout. The timeout is 180 seconds.
603   * @retval None
604 */
605 
aci_gap_limited_discoverable_event_process(uint8_t * buffer_in)606 void aci_gap_limited_discoverable_event_process(uint8_t *buffer_in)
607 {
608   aci_gap_limited_discoverable_event();
609 }
610 
611 /* aci_gap_pairing_complete_event */
612 /* Event len: 2 + 1 + 1 */
613 /**
614   * @brief This event is generated when the pairing process has completed successfully or a pairing
615 procedure timeout has occurred or the pairing has failed. This is to notify the application that
616 we have paired with a remote device so that it can take further actions or to notify that a
617 timeout has occurred so that the upper layer can decide to disconnect the link.
618   * @param Connection_Handle Connection handle on which the pairing procedure completed
619   * @param Status Pairing status
620   * Values:
621   - 0x00: Success
622   - 0x01: Timeout
623   - 0x02: Failed
624   * @param Reason Pairing reason error code
625   * Values:
626   - 0x00
627   - 0x01: PASSKEY_ENTRY_FAILED
628   - 0x02: OOB_NOT_AVAILABLE
629   - 0x03: AUTH_REQ_CANNOT_BE_MET
630   - 0x04: CONFIRM_VALUE_FAILED
631   - 0x05: PAIRING_NOT_SUPPORTED
632   - 0x06: INSUFF_ENCRYPTION_KEY_SIZE
633   - 0x07: CMD_NOT_SUPPORTED
634   - 0x08: UNSPECIFIED_REASON
635   - 0x09: VERY_EARLY_NEXT_ATTEMPT
636   - 0x0A: SM_INVALID_PARAMS
637   - 0x0B: SMP_SC_DHKEY_CHECK_FAILED
638   - 0x0C: SMP_SC_NUMCOMPARISON_FAILED
639   * @retval None
640 */
641 
aci_gap_pairing_complete_event_process(uint8_t * buffer_in)642 void aci_gap_pairing_complete_event_process(uint8_t *buffer_in)
643 {
644   /* Input params */
645   aci_gap_pairing_complete_event_rp0 *rp0 = (aci_gap_pairing_complete_event_rp0 *)buffer_in;
646   aci_gap_pairing_complete_event(rp0->Connection_Handle,
647                                  rp0->Status,
648                                  rp0->Reason);
649 }
650 
651 /* aci_gap_pass_key_req_event */
652 /* Event len: 2 */
653 /**
654   * @brief This event is generated by the Security manager to the application when a passkey is
655 required for pairing. When this event is received, the application has to respond with the
656 @ref aci_gap_pass_key_resp command.
657   * @param Connection_Handle Connection handle for which the passkey has been requested.
658   * @retval None
659 */
660 
aci_gap_pass_key_req_event_process(uint8_t * buffer_in)661 void aci_gap_pass_key_req_event_process(uint8_t *buffer_in)
662 {
663   /* Input params */
664   aci_gap_pass_key_req_event_rp0 *rp0 = (aci_gap_pass_key_req_event_rp0 *)buffer_in;
665   aci_gap_pass_key_req_event(rp0->Connection_Handle);
666 }
667 
668 /* aci_gap_authorization_req_event */
669 /* Event len: 2 */
670 /**
671   * @brief This event is generated by the Security manager to the application when the application has
672 set that authorization is required for reading/writing of attributes. This event will be
673 generated as soon as the pairing is complete. When this event is received,
674 @ref aci_gap_authorization_resp command should be used to respond by the application.
675   * @param Connection_Handle Connection handle for which authorization has been requested.
676   * @retval None
677 */
678 
aci_gap_authorization_req_event_process(uint8_t * buffer_in)679 void aci_gap_authorization_req_event_process(uint8_t *buffer_in)
680 {
681   /* Input params */
682   aci_gap_authorization_req_event_rp0 *rp0 = (aci_gap_authorization_req_event_rp0 *)buffer_in;
683   aci_gap_authorization_req_event(rp0->Connection_Handle);
684 }
685 
686 /* aci_gap_slave_security_initiated_event */
687 /* Event len: 0 */
688 /**
689   * @brief This event is generated when the slave security request is successfully sent to the master.
690   * @retval None
691 */
692 
aci_gap_slave_security_initiated_event_process(uint8_t * buffer_in)693 void aci_gap_slave_security_initiated_event_process(uint8_t *buffer_in)
694 {
695   aci_gap_slave_security_initiated_event();
696 }
697 
698 /* aci_gap_bond_lost_event */
699 /* Event len: 0 */
700 /**
701   * @brief This event is generated when a pairing request is issued in response to a slave security
702 request from a master which has previously bonded with the slave. When this event is
703 received, the upper layer has to issue the command @ref aci_gap_allow_rebond in order to
704 allow the slave to continue the pairing process with the master.
705   * @retval None
706 */
707 
aci_gap_bond_lost_event_process(uint8_t * buffer_in)708 void aci_gap_bond_lost_event_process(uint8_t *buffer_in)
709 {
710   aci_gap_bond_lost_event();
711 }
712 
713 /* aci_gap_proc_complete_event */
714 /* Event len: 1 + 1 + 1 + rp0->Data_Length * (sizeof(uint8_t)) */
715 /**
716   * @brief This event is sent by the GAP to the upper layers when a procedure previously started has
717 been terminated by the upper layer or has completed for any other reason
718   * @param Procedure_Code Terminated procedure.
719   * Values:
720   - 0x01: GAP_LIMITED_DISCOVERY_PROC
721   - 0x02: GAP_GENERAL_DISCOVERY_PROC
722   - 0x04: GAP_NAME_DISCOVERY_PROC
723   - 0x08: GAP_AUTO_CONNECTION_ESTABLISHMENT_PROC
724   - 0x10: GAP_GENERAL_CONNECTION_ESTABLISHMENT_PROC
725   - 0x20: GAP_SELECTIVE_CONNECTION_ESTABLISHMENT_PROC
726   - 0x40: GAP_DIRECT_CONNECTION_ESTABLISHMENT_PROC
727   - 0x80: GAP_OBSERVATION_PROC
728   * @param Status Status error code.
729   * @param Data_Length Length of Data in octets
730   * @param Data Procedure Specific Data:
731 - For Name Discovery Procedure: the name of the peer device if the procedure completed successfully.
732   * @retval None
733 */
734 
aci_gap_proc_complete_event_process(uint8_t * buffer_in)735 void aci_gap_proc_complete_event_process(uint8_t *buffer_in)
736 {
737   /* Input params */
738   aci_gap_proc_complete_event_rp0 *rp0 = (aci_gap_proc_complete_event_rp0 *)buffer_in;
739   aci_gap_proc_complete_event(rp0->Procedure_Code,
740                               rp0->Status,
741                               rp0->Data_Length,
742                               rp0->Data);
743 }
744 
745 /* aci_gap_addr_not_resolved_event */
746 /* Event len: 2 */
747 /**
748   * @brief This event is sent only by a privacy enabled Peripheral. The event is sent to the
749 upper layers when the peripheral is unsuccessful in resolving the resolvable
750 address of the peer device after connecting to it.
751   * @param Connection_Handle Connection handle for which the private address could not be
752 resolved with any of the stored IRK's.
753   * @retval None
754 */
755 
aci_gap_addr_not_resolved_event_process(uint8_t * buffer_in)756 void aci_gap_addr_not_resolved_event_process(uint8_t *buffer_in)
757 {
758   /* Input params */
759   aci_gap_addr_not_resolved_event_rp0 *rp0 = (aci_gap_addr_not_resolved_event_rp0 *)buffer_in;
760   aci_gap_addr_not_resolved_event(rp0->Connection_Handle);
761 }
762 
763 /* aci_gap_numeric_comparison_value_event */
764 /* Event len: 2 + 4 */
765 /**
766   * @brief This event is sent only during SC v.4.2 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
767 @ref aci_gap_numeric_comparison_resp command.
768   * @param Connection_Handle Connection handle related to the underlying Pairing
769   * @param Numeric_Value
770   * @retval None
771 */
772 
aci_gap_numeric_comparison_value_event_process(uint8_t * buffer_in)773 void aci_gap_numeric_comparison_value_event_process(uint8_t *buffer_in)
774 {
775   /* Input params */
776   aci_gap_numeric_comparison_value_event_rp0 *rp0 = (aci_gap_numeric_comparison_value_event_rp0 *)buffer_in;
777   aci_gap_numeric_comparison_value_event(rp0->Connection_Handle,
778                                          rp0->Numeric_Value);
779 }
780 
781 /* aci_gap_keypress_notification_event */
782 /* Event len: 2 + 1 */
783 /**
784   * @brief This event is sent only during SC v.4.2 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.
785   * @param Connection_Handle Connection handle related to the underlying Pairing
786   * @param Notification_Type Type of Keypress input notified/signaled by peer device (having Keyboard only I/O capabilities
787   * @retval None
788 */
789 
aci_gap_keypress_notification_event_process(uint8_t * buffer_in)790 void aci_gap_keypress_notification_event_process(uint8_t *buffer_in)
791 {
792   /* Input params */
793   aci_gap_keypress_notification_event_rp0 *rp0 = (aci_gap_keypress_notification_event_rp0 *)buffer_in;
794   aci_gap_keypress_notification_event(rp0->Connection_Handle,
795                                       rp0->Notification_Type);
796 }
797 
798 /* aci_l2cap_connection_update_resp_event */
799 /* Event len: 2 + 2 */
800 /**
801   * @brief This event is generated when the master responds to the connection update request packet
802 with a connection update response packet.
803   * @param Connection_Handle Connection handle referring to the COS Channel where the Disconnection has been received.
804   * @param Result
805   * @retval None
806 */
807 
aci_l2cap_connection_update_resp_event_process(uint8_t * buffer_in)808 void aci_l2cap_connection_update_resp_event_process(uint8_t *buffer_in)
809 {
810   /* Input params */
811   aci_l2cap_connection_update_resp_event_rp0 *rp0 = (aci_l2cap_connection_update_resp_event_rp0 *)buffer_in;
812   aci_l2cap_connection_update_resp_event(rp0->Connection_Handle,
813                                          rp0->Result);
814 }
815 
816 /* aci_l2cap_proc_timeout_event */
817 /* Event len: 2 + 1 + rp0->Data_Length * (sizeof(uint8_t)) */
818 /**
819   * @brief This event is generated when the master does not respond to the connection update
820 request packet with a connection update response packet or a command reject packet
821 within 30 seconds.
822   * @param Connection_Handle Handle of the connection related to this L2CAP procedure.
823   * @param Data_Length Length of following data
824   * @param Data
825   * @retval None
826 */
827 
aci_l2cap_proc_timeout_event_process(uint8_t * buffer_in)828 void aci_l2cap_proc_timeout_event_process(uint8_t *buffer_in)
829 {
830   /* Input params */
831   aci_l2cap_proc_timeout_event_rp0 *rp0 = (aci_l2cap_proc_timeout_event_rp0 *)buffer_in;
832   aci_l2cap_proc_timeout_event(rp0->Connection_Handle,
833                                rp0->Data_Length,
834                                rp0->Data);
835 }
836 
837 /* aci_l2cap_connection_update_req_event */
838 /* Event len: 2 + 1 + 2 + 2 + 2 + 2 + 2 */
839 /**
840   * @brief The event is given by the L2CAP layer when a connection update request is received from
841 the slave. The upper layer which receives this event has to respond by sending a
842 @ref aci_l2cap_connection_parameter_update_resp command.
843   * @param Connection_Handle Handle of the connection related to this L2CAP procedure.
844   * @param Identifier This is the identifier which associate the request to the response.
845   * @param L2CAP_Length Length of the L2CAP connection update request.
846   * @param Interval_Min Minimum value for the connection event interval. This shall be less
847 than or equal to Conn_Interval_Max.
848 Time = N * 1.25 msec.
849   * Values:
850   - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
851   * @param Interval_Max Maximum value for the connection event interval. This shall be
852 greater than or equal to Conn_Interval_Min.
853 Time = N * 1.25 msec.
854   * Values:
855   - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
856   * @param Slave_Latency Slave latency for the connection in number of connection events.
857   * Values:
858   - 0x0000 ... 0x01F3
859   * @param Timeout_Multiplier Defines connection timeout parameter in the following manner: Timeout Multiplier * 10ms.
860   * @retval None
861 */
862 
aci_l2cap_connection_update_req_event_process(uint8_t * buffer_in)863 void aci_l2cap_connection_update_req_event_process(uint8_t *buffer_in)
864 {
865   /* Input params */
866   aci_l2cap_connection_update_req_event_rp0 *rp0 = (aci_l2cap_connection_update_req_event_rp0 *)buffer_in;
867   aci_l2cap_connection_update_req_event(rp0->Connection_Handle,
868                                         rp0->Identifier,
869                                         rp0->L2CAP_Length,
870                                         rp0->Interval_Min,
871                                         rp0->Interval_Max,
872                                         rp0->Slave_Latency,
873                                         rp0->Timeout_Multiplier);
874 }
875 
876 /* aci_l2cap_command_reject_event */
877 /* Event len: 2 + 1 + 2 + 1 + rp0->Data_Length * (sizeof(uint8_t)) */
878 /**
879   * @brief This event is generated when the master responds to the connection update request packet
880 with a command reject packet.
881   * @param Connection_Handle Connection handle referring to the COS Channel where the Disconnection has been received.
882   * @param Identifier This is the identifier which associate the request to the response.
883   * @param Reason Reason
884   * @param Data_Length Length of following data
885   * @param Data Data field associated with Reason
886   * @retval None
887 */
888 
aci_l2cap_command_reject_event_process(uint8_t * buffer_in)889 void aci_l2cap_command_reject_event_process(uint8_t *buffer_in)
890 {
891   /* Input params */
892   aci_l2cap_command_reject_event_rp0 *rp0 = (aci_l2cap_command_reject_event_rp0 *)buffer_in;
893   aci_l2cap_command_reject_event(rp0->Connection_Handle,
894                                  rp0->Identifier,
895                                  rp0->Reason,
896                                  rp0->Data_Length,
897                                  rp0->Data);
898 }
899 
900 /* aci_gatt_attribute_modified_event */
901 /* Event len: 2 + 2 + 2 + 2 + rp0->Attr_Data_Length * (sizeof(uint8_t)) */
902 /**
903   * @brief This event is generated to the application by the GATT server when a client modifies any
904 attribute on the server, as consequence of one of the following GATT procedures:
905 - write without response
906 - signed write without response
907 - write characteristic value
908 - write long characteristic value
909 - reliable write.
910   * @param Connection_Handle The connection handle which modified the attribute.
911   * @param Attr_Handle Handle of the attribute that was modified.
912   * @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).
913   * @param Attr_Data_Length Length of Attr_Data in octets
914   * @param Attr_Data The modified value
915   * @retval None
916 */
917 
aci_gatt_attribute_modified_event_process(uint8_t * buffer_in)918 void aci_gatt_attribute_modified_event_process(uint8_t *buffer_in)
919 {
920   /* Input params */
921   aci_gatt_attribute_modified_event_rp0 *rp0 = (aci_gatt_attribute_modified_event_rp0 *)buffer_in;
922   aci_gatt_attribute_modified_event(rp0->Connection_Handle,
923                                     rp0->Attr_Handle,
924                                     rp0->Offset,
925                                     rp0->Attr_Data_Length,
926                                     rp0->Attr_Data);
927 }
928 
929 /* aci_gatt_proc_timeout_event */
930 /* Event len: 2 */
931 /**
932   * @brief This event is generated by the client/server to the application on a GATT timeout (30
933 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 @ref aci_gap_terminate to disconnect from the peer device. It is important to leave an 100 ms blank window before sending the @ref aci_gap_terminate, since immediately after this event, system could save important information in non volatile memory.
934   * @param Connection_Handle Connection handle on which the GATT procedure has timed out
935   * @retval None
936 */
937 
aci_gatt_proc_timeout_event_process(uint8_t * buffer_in)938 void aci_gatt_proc_timeout_event_process(uint8_t *buffer_in)
939 {
940   /* Input params */
941   aci_gatt_proc_timeout_event_rp0 *rp0 = (aci_gatt_proc_timeout_event_rp0 *)buffer_in;
942   aci_gatt_proc_timeout_event(rp0->Connection_Handle);
943 }
944 
945 /* aci_att_exchange_mtu_resp_event */
946 /* Event len: 2 + 2 */
947 /**
948   * @brief This event is generated in response to an Exchange MTU request. See
949 @ref aci_gatt_exchange_config.
950   * @param Connection_Handle Connection handle related to the response.
951   * Values:
952   - 0x0000 ... 0x0EFF
953   * @param Server_RX_MTU Attribute server receive MTU size
954   * @retval None
955 */
956 
aci_att_exchange_mtu_resp_event_process(uint8_t * buffer_in)957 void aci_att_exchange_mtu_resp_event_process(uint8_t *buffer_in)
958 {
959   /* Input params */
960   aci_att_exchange_mtu_resp_event_rp0 *rp0 = (aci_att_exchange_mtu_resp_event_rp0 *)buffer_in;
961   aci_att_exchange_mtu_resp_event(rp0->Connection_Handle,
962                                   rp0->Server_RX_MTU);
963 }
964 
965 /* aci_att_find_info_resp_event */
966 /* Event len: 2 + 1 + 1 + rp0->Event_Data_Length * (sizeof(uint8_t)) */
967 /**
968   * @brief This event is generated in response to a Find Information Request. See
969 @ref aci_att_find_info_req and Find Information Response in Bluetooth Core v5.0
970 spec. This event is also generated in response to @ref aci_gatt_disc_all_char_desc
971   * @param Connection_Handle Connection handle related to the response.
972   * Values:
973   - 0x0000 ... 0x0EFF
974   * @param Format Format of the hanndle-uuid pairs
975   * @param Event_Data_Length Length of Handle_UUID_Pair in octets
976   * @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]
977   * @retval None
978 */
979 
aci_att_find_info_resp_event_process(uint8_t * buffer_in)980 void aci_att_find_info_resp_event_process(uint8_t *buffer_in)
981 {
982   /* Input params */
983   aci_att_find_info_resp_event_rp0 *rp0 = (aci_att_find_info_resp_event_rp0 *)buffer_in;
984   aci_att_find_info_resp_event(rp0->Connection_Handle,
985                                rp0->Format,
986                                rp0->Event_Data_Length,
987                                rp0->Handle_UUID_Pair);
988 }
989 
990 /* aci_att_find_by_type_value_resp_event */
991 /* Event len: 2 + 1 + rp0->Num_of_Handle_Pair * (sizeof(Attribute_Group_Handle_Pair_t)) */
992 /**
993   * @brief This event is generated in response to a @ref aci_att_find_by_type_value_req
994   * @param Connection_Handle Connection handle related to the response.
995   * Values:
996   - 0x0000 ... 0x0EFF
997   * @param Num_of_Handle_Pair Number of attribute, group handle pairs
998   * @param Attribute_Group_Handle_Pair See @ref Attribute_Group_Handle_Pair_t
999   * @retval None
1000 */
1001 
aci_att_find_by_type_value_resp_event_process(uint8_t * buffer_in)1002 void aci_att_find_by_type_value_resp_event_process(uint8_t *buffer_in)
1003 {
1004   /* Input params */
1005   aci_att_find_by_type_value_resp_event_rp0 *rp0 = (aci_att_find_by_type_value_resp_event_rp0 *)buffer_in;
1006   aci_att_find_by_type_value_resp_event(rp0->Connection_Handle,
1007                                         rp0->Num_of_Handle_Pair,
1008                                         rp0->Attribute_Group_Handle_Pair);
1009 }
1010 
1011 /* aci_att_read_by_type_resp_event */
1012 /* Event len: 2 + 1 + 1 + rp0->Data_Length * (sizeof(uint8_t)) */
1013 /**
1014   * @brief This event is generated in response to a @ref aci_att_read_by_type_req. See
1015 @ref aci_gatt_find_included_services and @ref aci_gatt_disc_all_char_desc.
1016   * @param Connection_Handle Connection handle related to the response.
1017   * Values:
1018   - 0x0000 ... 0x0EFF
1019   * @param Handle_Value_Pair_Length The size of each attribute handle-value pair
1020   * @param Data_Length Length of Handle_Value_Pair_Data in octets
1021   * @param Handle_Value_Pair_Data Attribute Data List as defined in Bluetooth Core v5.0 spec. A sequence of handle-value pairs: [2 octets for Attribute Handle, (Handle_Value_Pair_Length - 2 octets) for Attribute Value]
1022   * @retval None
1023 */
1024 
aci_att_read_by_type_resp_event_process(uint8_t * buffer_in)1025 void aci_att_read_by_type_resp_event_process(uint8_t *buffer_in)
1026 {
1027   /* Input params */
1028   aci_att_read_by_type_resp_event_rp0 *rp0 = (aci_att_read_by_type_resp_event_rp0 *)buffer_in;
1029   aci_att_read_by_type_resp_event(rp0->Connection_Handle,
1030                                   rp0->Handle_Value_Pair_Length,
1031                                   rp0->Data_Length,
1032                                   rp0->Handle_Value_Pair_Data);
1033 }
1034 
1035 /* aci_att_read_resp_event */
1036 /* Event len: 2 + 1 + rp0->Event_Data_Length * (sizeof(uint8_t)) */
1037 /**
1038   * @brief This event is generated in response to a Read Request. See @ref aci_gatt_read_char_value.
1039   * @param Connection_Handle Connection handle related to the response.
1040   * Values:
1041   - 0x0000 ... 0x0EFF
1042   * @param Event_Data_Length Length of following data
1043   * @param Attribute_Value The value of the attribute.
1044   * @retval None
1045 */
1046 
aci_att_read_resp_event_process(uint8_t * buffer_in)1047 void aci_att_read_resp_event_process(uint8_t *buffer_in)
1048 {
1049   /* Input params */
1050   aci_att_read_resp_event_rp0 *rp0 = (aci_att_read_resp_event_rp0 *)buffer_in;
1051   aci_att_read_resp_event(rp0->Connection_Handle,
1052                           rp0->Event_Data_Length,
1053                           rp0->Attribute_Value);
1054 }
1055 
1056 /* aci_att_read_blob_resp_event */
1057 /* Event len: 2 + 1 + rp0->Event_Data_Length * (sizeof(uint8_t)) */
1058 /**
1059   * @brief This event can be generated during a read long characteristic value procedure. See @ref aci_gatt_read_long_char_value.
1060   * @param Connection_Handle Connection handle related to the response.
1061   * Values:
1062   - 0x0000 ... 0x0EFF
1063   * @param Event_Data_Length Length of following data
1064   * @param Attribute_Value Part of the attribute value.
1065   * @retval None
1066 */
1067 
aci_att_read_blob_resp_event_process(uint8_t * buffer_in)1068 void aci_att_read_blob_resp_event_process(uint8_t *buffer_in)
1069 {
1070   /* Input params */
1071   aci_att_read_blob_resp_event_rp0 *rp0 = (aci_att_read_blob_resp_event_rp0 *)buffer_in;
1072   aci_att_read_blob_resp_event(rp0->Connection_Handle,
1073                                rp0->Event_Data_Length,
1074                                rp0->Attribute_Value);
1075 }
1076 
1077 /* aci_att_read_multiple_resp_event */
1078 /* Event len: 2 + 1 + rp0->Event_Data_Length * (sizeof(uint8_t)) */
1079 /**
1080   * @brief This event is generated in response to a Read Multiple Request.
1081   * @param Connection_Handle Connection handle related to the response.
1082   * Values:
1083   - 0x0000 ... 0x0EFF
1084   * @param Event_Data_Length Length of following data
1085   * @param Set_Of_Values A set of two or more values.
1086 A concatenation of attribute values for each of the attribute handles in the request in the order that they were requested.
1087   * @retval None
1088 */
1089 
aci_att_read_multiple_resp_event_process(uint8_t * buffer_in)1090 void aci_att_read_multiple_resp_event_process(uint8_t *buffer_in)
1091 {
1092   /* Input params */
1093   aci_att_read_multiple_resp_event_rp0 *rp0 = (aci_att_read_multiple_resp_event_rp0 *)buffer_in;
1094   aci_att_read_multiple_resp_event(rp0->Connection_Handle,
1095                                    rp0->Event_Data_Length,
1096                                    rp0->Set_Of_Values);
1097 }
1098 
1099 /* aci_att_read_by_group_type_resp_event */
1100 /* Event len: 2 + 1 + 1 + rp0->Data_Length * (sizeof(uint8_t)) */
1101 /**
1102   * @brief This event is generated in response to a Read By Group Type Request. See
1103 @ref aci_gatt_disc_all_primary_services.
1104   * @param Connection_Handle Connection handle related to the response.
1105   * Values:
1106   - 0x0000 ... 0x0EFF
1107   * @param Attribute_Data_Length The size of each attribute data
1108   * @param Data_Length Length of Attribute_Data_List in octets
1109   * @param Attribute_Data_List Attribute Data List as defined in Bluetooth Core v5.0 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]
1110   * @retval None
1111 */
1112 
aci_att_read_by_group_type_resp_event_process(uint8_t * buffer_in)1113 void aci_att_read_by_group_type_resp_event_process(uint8_t *buffer_in)
1114 {
1115   /* Input params */
1116   aci_att_read_by_group_type_resp_event_rp0 *rp0 = (aci_att_read_by_group_type_resp_event_rp0 *)buffer_in;
1117   aci_att_read_by_group_type_resp_event(rp0->Connection_Handle,
1118                                         rp0->Attribute_Data_Length,
1119                                         rp0->Data_Length,
1120                                         rp0->Attribute_Data_List);
1121 }
1122 
1123 /* aci_att_prepare_write_resp_event */
1124 /* Event len: 2 + 2 + 2 + 1 + rp0->Part_Attribute_Value_Length * (sizeof(uint8_t)) */
1125 /**
1126   * @brief This event is generated in response to a @ref aci_att_prepare_write_req.
1127   * @param Connection_Handle Connection handle related to the response.
1128   * Values:
1129   - 0x0000 ... 0x0EFF
1130   * @param Attribute_Handle The handle of the attribute to be written
1131   * @param Offset The offset of the first octet to be written.
1132   * @param Part_Attribute_Value_Length Length of Part_Attribute_Value in octets
1133   * @param Part_Attribute_Value The value of the attribute to be written
1134   * @retval None
1135 */
1136 
aci_att_prepare_write_resp_event_process(uint8_t * buffer_in)1137 void aci_att_prepare_write_resp_event_process(uint8_t *buffer_in)
1138 {
1139   /* Input params */
1140   aci_att_prepare_write_resp_event_rp0 *rp0 = (aci_att_prepare_write_resp_event_rp0 *)buffer_in;
1141   aci_att_prepare_write_resp_event(rp0->Connection_Handle,
1142                                    rp0->Attribute_Handle,
1143                                    rp0->Offset,
1144                                    rp0->Part_Attribute_Value_Length,
1145                                    rp0->Part_Attribute_Value);
1146 }
1147 
1148 /* aci_att_exec_write_resp_event */
1149 /* Event len: 2 */
1150 /**
1151   * @brief This event is generated in response to an Execute Write Request.
1152   * @param Connection_Handle Connection handle related to the response.
1153   * Values:
1154   - 0x0000 ... 0x0EFF
1155   * @retval None
1156 */
1157 
aci_att_exec_write_resp_event_process(uint8_t * buffer_in)1158 void aci_att_exec_write_resp_event_process(uint8_t *buffer_in)
1159 {
1160   /* Input params */
1161   aci_att_exec_write_resp_event_rp0 *rp0 = (aci_att_exec_write_resp_event_rp0 *)buffer_in;
1162   aci_att_exec_write_resp_event(rp0->Connection_Handle);
1163 }
1164 
1165 /* aci_gatt_indication_event */
1166 /* Event len: 2 + 2 + 1 + rp0->Attribute_Value_Length * (sizeof(uint8_t)) */
1167 /**
1168   * @brief This event is generated when an indication is received from the server.
1169   * @param Connection_Handle Connection handle related to the response.
1170   * Values:
1171   - 0x0000 ... 0x0EFF
1172   * @param Attribute_Handle The handle of the attribute
1173   * @param Attribute_Value_Length Length of Attribute_Value in octets
1174   * @param Attribute_Value The current value of the attribute
1175   * @retval None
1176 */
1177 
aci_gatt_indication_event_process(uint8_t * buffer_in)1178 void aci_gatt_indication_event_process(uint8_t *buffer_in)
1179 {
1180   /* Input params */
1181   aci_gatt_indication_event_rp0 *rp0 = (aci_gatt_indication_event_rp0 *)buffer_in;
1182   aci_gatt_indication_event(rp0->Connection_Handle,
1183                             rp0->Attribute_Handle,
1184                             rp0->Attribute_Value_Length,
1185                             rp0->Attribute_Value);
1186 }
1187 
1188 /* aci_gatt_notification_event */
1189 /* Event len: 2 + 2 + 1 + rp0->Attribute_Value_Length * (sizeof(uint8_t)) */
1190 /**
1191   * @brief This event is generated when a notification is received from the server.
1192   * @param Connection_Handle Connection handle related to the response.
1193   * Values:
1194   - 0x0000 ... 0x0EFF
1195   * @param Attribute_Handle The handle of the attribute
1196   * @param Attribute_Value_Length Length of Attribute_Value in octets
1197   * @param Attribute_Value The current value of the attribute
1198   * @retval None
1199 */
1200 
aci_gatt_notification_event_process(uint8_t * buffer_in)1201 void aci_gatt_notification_event_process(uint8_t *buffer_in)
1202 {
1203   /* Input params */
1204   aci_gatt_notification_event_rp0 *rp0 = (aci_gatt_notification_event_rp0 *)buffer_in;
1205   aci_gatt_notification_event(rp0->Connection_Handle,
1206                               rp0->Attribute_Handle,
1207                               rp0->Attribute_Value_Length,
1208                               rp0->Attribute_Value);
1209 }
1210 
1211 /* aci_gatt_proc_complete_event */
1212 /* Event len: 2 + 1 */
1213 /**
1214   * @brief This event is generated when a GATT client procedure completes either with error or
1215 successfully.
1216   * @param Connection_Handle Connection handle related to the response.
1217   * Values:
1218   - 0x0000 ... 0x0EFF
1219   * @param Error_Code Indicates whether the procedure completed with an error or was successful
1220   * Values:
1221   - 0x00: Success
1222   - 0x01: Unknown HCI Command
1223   - 0x02: Unknown Connection Identifier
1224   - 0x03: Hardware Failure
1225   - 0x05: Authentication Failure
1226   - 0x06: PIN or Key Missing
1227   - 0x07: Memory Capacity Exceeded
1228   - 0x08: Connection Timeout
1229   - 0x09: Connection Limit Exceeded
1230   - 0x0B: ACL Connection Already Exists
1231   - 0x0C: Command Disallowed
1232   - 0x0D: Connection Rejected Due To Limited Resources
1233   - 0x0E: Connection Rejected Due To Security Reasons
1234   - 0x0F: Connection Rejected due to Unacceptable BD_ADDR
1235   - 0x10: Connection Accept Timeout Exceeded
1236   - 0x11: Unsupported Feature Or Parameter Value
1237   - 0x12: Invalid HCI Command Parameters
1238   - 0x13: Remote User Terminated Connection
1239   - 0x14: Remote Device Terminated Connection due to Low Resources
1240   - 0x15: Remote Device Terminated Connection due to Power Off
1241   - 0x16: Connection Terminated By Local Host
1242   - 0x17: Repeated Attempts
1243   - 0x18: Pairing Not Allowed
1244   - 0x19: Unknown LMP PDU
1245   - 0x1A: Unsupported Remote Feature / Unsupported LMP Feature
1246   - 0x1E: Invalid LMP Parameters
1247   - 0x1F: Unspecified Error
1248   - 0x20: Unsupported LMP Parameter Value
1249   - 0x21: Role Change Not Allowed
1250   - 0x22: LMP Response Timeout / LL Response Timeout
1251   - 0x23: LMP Error Transaction Collision
1252   - 0x24: LMP PDU Not Allowed
1253   - 0x25: Encryption Mode Not Acceptable
1254   - 0x26: Link Key cannot be Changed
1255   - 0x28: Instant Passed
1256   - 0x29: Pairing With Unit Key Not Supported
1257   - 0x2A: Different Transaction Collision
1258   - 0x2E: Channel Assessment Not Supported
1259   - 0x2F: Insufficient Security
1260   - 0x30: Parameter Out Of Mandatory Range
1261   - 0x32: Role Switch Pending
1262   - 0x34: Reserved Slot Violation
1263   - 0x35: Role Switch Failed
1264   - 0x37: Secure Simple Pairing Not Supported by Host
1265   - 0x38: Host Busy - Pairing
1266   - 0x39: Connection Rejected due to No Suitable Channel Found
1267   - 0x3A: Controller Busy
1268   - 0x3B: Unacceptable Connection Interval
1269   - 0x3C: Directed Advertising Timeout
1270   - 0x3D: Connection Terminated Due to MIC Failure
1271   - 0x3E: Connection Failed to be Established
1272   - 0x41: Failed
1273   - 0x42: Invalid parameters
1274   - 0x43: Busy
1275   - 0x44: Invalid length
1276   - 0x45: Pending
1277   - 0x46: Not allowed
1278   - 0x47: GATT error
1279   - 0x48: Address not resolved
1280   - 0x50: Invalid CID
1281   - 0x5A: CSRK not found
1282   - 0x5B: IRK not found
1283   - 0x5C: Device not found in DB
1284   - 0x5D: Security DB full
1285   - 0x5E: Device not bonded
1286   - 0x5F: Device in blacklist
1287   - 0x60: Invalid handle
1288   - 0x61: Invalid parameter
1289   - 0x62: Out of handles
1290   - 0x63: Invalid operation
1291   - 0x64: Insufficient resources
1292   - 0x65: Insufficient encryption key size
1293   - 0x66: Characteristic already exist
1294   - 0x82: No valid slot
1295   - 0x83: Short window
1296   - 0x84: New interval failed
1297   - 0x85: Too large interval
1298   - 0x86: Slot length failed
1299   * @retval None
1300 */
1301 
aci_gatt_proc_complete_event_process(uint8_t * buffer_in)1302 void aci_gatt_proc_complete_event_process(uint8_t *buffer_in)
1303 {
1304   /* Input params */
1305   aci_gatt_proc_complete_event_rp0 *rp0 = (aci_gatt_proc_complete_event_rp0 *)buffer_in;
1306   aci_gatt_proc_complete_event(rp0->Connection_Handle,
1307                                rp0->Error_Code);
1308 }
1309 
1310 /* aci_gatt_error_resp_event */
1311 /* Event len: 2 + 1 + 2 + 1 */
1312 /**
1313   * @brief This event is generated when an Error Response is received from the server. The error
1314 response can be given by the server at the end of one of the GATT discovery procedures.
1315 This does not mean that the procedure ended with an error, but this error event is part of the
1316 procedure itself.
1317   * @param Connection_Handle Connection handle related to the response.
1318   * Values:
1319   - 0x0000 ... 0x0EFF
1320   * @param Req_Opcode The request that generated this error response
1321   * @param Attribute_Handle The attribute handle that generated this error response
1322   * @param Error_Code The reason why the request has generated an error response (ATT error codes)
1323   * Values:
1324   - 0x01: Invalid handle
1325   - 0x02: Read not permitted
1326   - 0x03: Write not permitted
1327   - 0x04: Invalid PDU
1328   - 0x05: Insufficient authentication
1329   - 0x06: Request not supported
1330   - 0x07: Invalid offset
1331   - 0x08: Insufficient authorization
1332   - 0x09: Prepare queue full
1333   - 0x0A: Attribute not found
1334   - 0x0B: Attribute not long
1335   - 0x0C: Insufficient encryption key size
1336   - 0x0D: Invalid attribute value length
1337   - 0x0E: Unlikely error
1338   - 0x0F: Insufficient encryption
1339   - 0x10: Unsupported group type
1340   - 0x11: Insufficient resources
1341   * @retval None
1342 */
1343 
aci_gatt_error_resp_event_process(uint8_t * buffer_in)1344 void aci_gatt_error_resp_event_process(uint8_t *buffer_in)
1345 {
1346   /* Input params */
1347   aci_gatt_error_resp_event_rp0 *rp0 = (aci_gatt_error_resp_event_rp0 *)buffer_in;
1348   aci_gatt_error_resp_event(rp0->Connection_Handle,
1349                             rp0->Req_Opcode,
1350                             rp0->Attribute_Handle,
1351                             rp0->Error_Code);
1352 }
1353 
1354 /* aci_gatt_disc_read_char_by_uuid_resp_event */
1355 /* Event len: 2 + 2 + 1 + rp0->Attribute_Value_Length * (sizeof(uint8_t)) */
1356 /**
1357   * @brief This event can be generated during a "Discover Characteristics By UUID" procedure or a
1358 "Read using Characteristic UUID" procedure.
1359 The attribute value will be a service declaration as defined in Bluetooth Core v5.0.spec
1360 (vol.3, Part G, ch. 3.3.1), when a "Discover Characteristics By UUID" has been started. It will
1361 be the value of the Characteristic if a* "Read using Characteristic UUID" has been
1362 performed.
1363   * @param Connection_Handle Connection handle related to the response.
1364   * Values:
1365   - 0x0000 ... 0x0EFF
1366   * @param Attribute_Handle The handle of the attribute
1367   * @param Attribute_Value_Length Length of Attribute_Value in octets
1368   * @param Attribute_Value The attribute value will be a service declaration as defined in Bluetooth Core v5.0 spec
1369  (vol.3, Part G, ch. 3.3.1), when a "Discover Characteristics By UUID" has been started.
1370  It will be the value of the Characteristic if a "Read using Characteristic UUID" has been performed.
1371   * @retval None
1372 */
1373 
aci_gatt_disc_read_char_by_uuid_resp_event_process(uint8_t * buffer_in)1374 void aci_gatt_disc_read_char_by_uuid_resp_event_process(uint8_t *buffer_in)
1375 {
1376   /* Input params */
1377   aci_gatt_disc_read_char_by_uuid_resp_event_rp0 *rp0 = (aci_gatt_disc_read_char_by_uuid_resp_event_rp0 *)buffer_in;
1378   aci_gatt_disc_read_char_by_uuid_resp_event(rp0->Connection_Handle,
1379                                              rp0->Attribute_Handle,
1380                                              rp0->Attribute_Value_Length,
1381                                              rp0->Attribute_Value);
1382 }
1383 
1384 /* aci_gatt_write_permit_req_event */
1385 /* Event len: 2 + 2 + 1 + rp0->Data_Length * (sizeof(uint8_t)) */
1386 /**
1387   * @brief This event is given to the application when a write request, write command or signed write
1388 command is received by the server from the client. This event will be given to the application
1389 only if the event bit for this event generation is set when the characteristic was added.
1390 When this event is received, the application has to check whether the value being requested
1391 for write can be allowed to be written and respond with the command @ref aci_gatt_write_resp.
1392 The details of the parameters of the command can be found. Based on the response from
1393 the application, the attribute value will be modified by the stack. If the write is rejected by the
1394 application, then the value of the attribute will not be modified. In case of a write REQ, an
1395 error response will be sent to the client, with the error code as specified by the application.
1396 In case of write/signed write commands, no response is sent to the client but the attribute is
1397 not modified.
1398   * @param Connection_Handle Handle of the connection on which there was the request to write the attribute
1399   * @param Attribute_Handle The handle of the attribute
1400   * @param Data_Length Length of Data field
1401   * @param Data The data that the client has requested to write
1402   * @retval None
1403 */
1404 
aci_gatt_write_permit_req_event_process(uint8_t * buffer_in)1405 void aci_gatt_write_permit_req_event_process(uint8_t *buffer_in)
1406 {
1407   /* Input params */
1408   aci_gatt_write_permit_req_event_rp0 *rp0 = (aci_gatt_write_permit_req_event_rp0 *)buffer_in;
1409   aci_gatt_write_permit_req_event(rp0->Connection_Handle,
1410                                   rp0->Attribute_Handle,
1411                                   rp0->Data_Length,
1412                                   rp0->Data);
1413 }
1414 
1415 /* aci_gatt_read_permit_req_event */
1416 /* Event len: 2 + 2 + 2 */
1417 /**
1418   * @brief This event is given to the application when a read request or read blob request is received
1419 by the server from the client. This event will be given to the application only if the event bit
1420 for this event generation is set when the characteristic was added.
1421 On receiving this event, the application can update the value of the handle if it desires and
1422 when done, it has to send the @ref aci_gatt_allow_read command to indicate to the stack that it
1423 can send the response to the client.
1424   * @param Connection_Handle Connection handle related to the response.
1425   * Values:
1426   - 0x0000 ... 0x0EFF
1427   * @param Attribute_Handle The handle of the attribute
1428   * @param Offset Contains the offset from which the read has been requested
1429   * @retval None
1430 */
1431 
aci_gatt_read_permit_req_event_process(uint8_t * buffer_in)1432 void aci_gatt_read_permit_req_event_process(uint8_t *buffer_in)
1433 {
1434   /* Input params */
1435   aci_gatt_read_permit_req_event_rp0 *rp0 = (aci_gatt_read_permit_req_event_rp0 *)buffer_in;
1436   aci_gatt_read_permit_req_event(rp0->Connection_Handle,
1437                                  rp0->Attribute_Handle,
1438                                  rp0->Offset);
1439 }
1440 
1441 /* aci_gatt_read_multi_permit_req_event */
1442 /* Event len: 2 + 1 + rp0->Number_of_Handles * (sizeof(Handle_Item_t)) */
1443 /**
1444   * @brief This event is given to the application when a read multiple request or read by type request is
1445 received by the server from the client. This event will be given to the application only if the
1446 event bit for this event generation is set when the characteristic was added.
1447 On receiving this event, the application can update the values of the handles if it desires and
1448 when done, it has to send the @ref aci_gatt_allow_read command to indicate to the stack that it
1449 can send the response to the client.
1450   * @param Connection_Handle Handle of the connection which requested to read the attribute
1451   * @param Number_of_Handles
1452   * @param Handle_Item See @ref Handle_Item_t
1453   * @retval None
1454 */
1455 
aci_gatt_read_multi_permit_req_event_process(uint8_t * buffer_in)1456 void aci_gatt_read_multi_permit_req_event_process(uint8_t *buffer_in)
1457 {
1458   /* Input params */
1459   aci_gatt_read_multi_permit_req_event_rp0 *rp0 = (aci_gatt_read_multi_permit_req_event_rp0 *)buffer_in;
1460   aci_gatt_read_multi_permit_req_event(rp0->Connection_Handle,
1461                                        rp0->Number_of_Handles,
1462                                        rp0->Handle_Item);
1463 }
1464 
1465 /* aci_gatt_tx_pool_available_event */
1466 /* Event len: 2 + 2 */
1467 /**
1468   * @brief Each time BLE FW stack raises the error code
1469 BLE_STATUS_INSUFFICIENT_RESOURCES (0x64), the
1470 @ref aci_gatt_tx_pool_available_event event is generated as soon as there are at least two
1471 buffers available for notifications or write commands.
1472   * @param Connection_Handle Connection handle related to the request
1473   * @param Available_Buffers Number of buffers available
1474   * @retval None
1475 */
1476 
aci_gatt_tx_pool_available_event_process(uint8_t * buffer_in)1477 void aci_gatt_tx_pool_available_event_process(uint8_t *buffer_in)
1478 {
1479   /* Input params */
1480   aci_gatt_tx_pool_available_event_rp0 *rp0 = (aci_gatt_tx_pool_available_event_rp0 *)buffer_in;
1481   aci_gatt_tx_pool_available_event(rp0->Connection_Handle,
1482                                    rp0->Available_Buffers);
1483 }
1484 
1485 /* aci_gatt_server_confirmation_event */
1486 /* Event len: 2 */
1487 /**
1488   * @brief This event is generated when the client has sent the confirmation to a previously sent indication
1489   * @param Connection_Handle Connection handle related to the event
1490   * @retval None
1491 */
1492 
aci_gatt_server_confirmation_event_process(uint8_t * buffer_in)1493 void aci_gatt_server_confirmation_event_process(uint8_t *buffer_in)
1494 {
1495   /* Input params */
1496   aci_gatt_server_confirmation_event_rp0 *rp0 = (aci_gatt_server_confirmation_event_rp0 *)buffer_in;
1497   aci_gatt_server_confirmation_event(rp0->Connection_Handle);
1498 }
1499 
1500 /* aci_gatt_prepare_write_permit_req_event */
1501 /* Event len: 2 + 2 + 2 + 1 + rp0->Data_Length * (sizeof(uint8_t)) */
1502 /**
1503   * @brief This event is given to the application when a prepare write request
1504 is received by the server from the client. This event will be given to the application
1505 only if the event bit for this event generation is set when the characteristic was added.
1506 When this event is received, the application has to check whether the value being requested
1507 for write can be allowed to be written and respond with the command @ref aci_gatt_write_resp.
1508 Based on the response from the application, the attribute value will be modified by the stack.
1509 If the write is rejected by the application, then the value of the attribute will not be modified
1510 and an error response will be sent to the client, with the error code as specified by the application.
1511   * @param Connection_Handle Handle of the connection on which there was the request to write the attribute
1512   * @param Attribute_Handle The handle of the attribute
1513   * @param Offset The offset from which the prepare write has been requested
1514   * @param Data_Length Length of Data field
1515   * @param Data The data that the client has requested to write
1516   * @retval None
1517 */
1518 
aci_gatt_prepare_write_permit_req_event_process(uint8_t * buffer_in)1519 void aci_gatt_prepare_write_permit_req_event_process(uint8_t *buffer_in)
1520 {
1521   /* Input params */
1522   aci_gatt_prepare_write_permit_req_event_rp0 *rp0 = (aci_gatt_prepare_write_permit_req_event_rp0 *)buffer_in;
1523   aci_gatt_prepare_write_permit_req_event(rp0->Connection_Handle,
1524                                           rp0->Attribute_Handle,
1525                                           rp0->Offset,
1526                                           rp0->Data_Length,
1527                                           rp0->Data);
1528 }
1529 
1530 /* aci_gatt_indication_ext_event */
1531 /* Event len: 2 + 2 + 2 + 2 + rp0->Attribute_Value_Length * (sizeof(uint8_t)) */
1532 /**
1533   * @brief 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.
1534 This event should be used instead of ACI_GATT_INDICATION_EVENT when ATT_MTU > (BLE_EVT_MAX_PARAM_LEN - 4)
1535 i.e. ATT_MTU > 251 for BLE_EVT_MAX_PARAM_LEN default value.
1536 
1537   * @param Connection_Handle Connection handle related to the response.
1538   * Values:
1539   - 0x0000 ... 0x0EFF
1540   * @param Attribute_Handle The handle of the attribute
1541   * @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).
1542   * @param Attribute_Value_Length Length of Attribute_Value in octets
1543   * @param Attribute_Value The current value of the attribute
1544   * @retval None
1545 */
1546 
aci_gatt_indication_ext_event_process(uint8_t * buffer_in)1547 void aci_gatt_indication_ext_event_process(uint8_t *buffer_in)
1548 {
1549   /* Input params */
1550   aci_gatt_indication_ext_event_rp0 *rp0 = (aci_gatt_indication_ext_event_rp0 *)buffer_in;
1551   aci_gatt_indication_ext_event(rp0->Connection_Handle,
1552                                 rp0->Attribute_Handle,
1553                                 rp0->Offset,
1554                                 rp0->Attribute_Value_Length,
1555                                 rp0->Attribute_Value);
1556 }
1557 
1558 /* aci_gatt_notification_ext_event */
1559 /* Event len: 2 + 2 + 2 + 2 + rp0->Attribute_Value_Length * (sizeof(uint8_t)) */
1560 /**
1561   * @brief 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.
1562 This event should be used instead of ACI_GATT_NOTIFICATION_EVENT when ATT_MTU > (BLE_EVT_MAX_PARAM_LEN - 4)
1563 i.e. ATT_MTU > 251 for BLE_EVT_MAX_PARAM_LEN default value.
1564 
1565   * @param Connection_Handle Connection handle related to the response.
1566   * Values:
1567   - 0x0000 ... 0x0EFF
1568   * @param Attribute_Handle The handle of the attribute
1569   * @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).
1570   * @param Attribute_Value_Length Length of Attribute_Value in octets
1571   * @param Attribute_Value The current value of the attribute
1572   * @retval None
1573 */
1574 
aci_gatt_notification_ext_event_process(uint8_t * buffer_in)1575 void aci_gatt_notification_ext_event_process(uint8_t *buffer_in)
1576 {
1577   /* Input params */
1578   aci_gatt_notification_ext_event_rp0 *rp0 = (aci_gatt_notification_ext_event_rp0 *)buffer_in;
1579   aci_gatt_notification_ext_event(rp0->Connection_Handle,
1580                                   rp0->Attribute_Handle,
1581                                   rp0->Offset,
1582                                   rp0->Attribute_Value_Length,
1583                                   rp0->Attribute_Value);
1584 }
1585 
1586 /* hci_le_connection_complete_event */
1587 /* Event len: 1 + 2 + 1 + 1 + 6 + 2 + 2 + 2 + 1 */
1588 /**
1589   * @brief The LE Connection Complete event indicates to both of the Hosts forming the
1590 connection that a new connection has been created. Upon the creation of the
1591 connection a Connection_Handle shall be assigned by the Controller, and
1592 passed to the Host in this event. If the connection establishment fails this event
1593 shall be provided to the Host that had issued the LE_Create_Connection command.
1594 This event indicates to the Host which issued a LE_Create_Connection
1595 command and received a Command Status event if the connection
1596 establishment failed or was successful.
1597 The Master_Clock_Accuracy parameter is only valid for a slave. On a master,
1598 this parameter shall be set to 0x00. See Bluetooth spec 5.0 vol 2 [part E] 7.7.65.1
1599   * @param Status Status error code.
1600   * @param Connection_Handle Connection handle to be used to identify the connection with the peer device.
1601   * Values:
1602   - 0x0000 ... 0x0EFF
1603   * @param Role Role of the local device in the connection.
1604   * Values:
1605   - 0x00: Master
1606   - 0x01: Slave
1607   * @param Peer_Address_Type The address type of the peer device.
1608   * Values:
1609   - 0x00: Public Device Address
1610   - 0x01: Random Device Address
1611   * @param Peer_Address Public Device Address or Random Device Address of the peer
1612 device
1613   * @param Conn_Interval Connection interval used on this connection.
1614 Time = N * 1.25 msec
1615   * Values:
1616   - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
1617   * @param Conn_Latency Slave latency for the connection in number of connection events.
1618   * Values:
1619   - 0x0000 ... 0x01F3
1620   * @param Supervision_Timeout Supervision timeout for the LE Link.
1621 It shall be a multiple of 10 ms and larger than (1 + connSlaveLatency) * connInterval * 2.
1622 Time = N * 10 msec.
1623   * Values:
1624   - 0x000A (100 ms)  ... 0x0C80 (32000 ms)
1625   * @param Master_Clock_Accuracy Master clock accuracy. Only valid for a slave.
1626   * Values:
1627   - 0x00: 500 ppm
1628   - 0x01: 250 ppm
1629   - 0x02: 150 ppm
1630   - 0x03: 100 ppm
1631   - 0x04: 75 ppm
1632   - 0x05: 50 ppm
1633   - 0x06: 30 ppm
1634   - 0x07: 20 ppm
1635   * @retval None
1636 */
1637 
hci_le_connection_complete_event_process(uint8_t * buffer_in)1638 void hci_le_connection_complete_event_process(uint8_t *buffer_in)
1639 {
1640   /* Input params */
1641   hci_le_connection_complete_event_rp0 *rp0 = (hci_le_connection_complete_event_rp0 *)buffer_in;
1642   hci_le_connection_complete_event(rp0->Status,
1643                                    rp0->Connection_Handle,
1644                                    rp0->Role,
1645                                    rp0->Peer_Address_Type,
1646                                    rp0->Peer_Address,
1647                                    rp0->Conn_Interval,
1648                                    rp0->Conn_Latency,
1649                                    rp0->Supervision_Timeout,
1650                                    rp0->Master_Clock_Accuracy);
1651 }
1652 
1653 /* hci_le_advertising_report_event */
1654 /* Event len: 1 + rp0->Num_Reports * (sizeof(Advertising_Report_t)) */
1655 /**
1656   * @brief The LE Advertising Report event indicates that a Bluetooth device or multiple
1657 Bluetooth devices have responded to an active scan or received some information
1658 during a passive scan. The Controller may queue these advertising reports
1659 and send information from multiple devices in one LE Advertising Report event. See Bluetooth spec 5.0 vol 2 [part E] 7.7.65.2
1660   * @param Num_Reports Number of responses in this event.
1661   * Values:
1662   - 0x01
1663   * @param Advertising_Report See @ref Advertising_Report_t
1664   * @retval None
1665 */
1666 
hci_le_advertising_report_event_process(uint8_t * buffer_in)1667 void hci_le_advertising_report_event_process(uint8_t *buffer_in)
1668 {
1669   /* Input params */
1670   hci_le_advertising_report_event_rp0 *rp0 = (hci_le_advertising_report_event_rp0 *)buffer_in;
1671 
1672   Advertising_Report_t Advertising_Report[1];
1673   int i;
1674   for (i = 0; i < rp0->Num_Reports; i++)
1675   {
1676     buffer_in += 1;
1677     Osal_MemCpy( &Advertising_Report[0], buffer_in, 9 );
1678     Advertising_Report[0].Data = &buffer_in[9];
1679     buffer_in += 9 + buffer_in[8];
1680     Advertising_Report[0].RSSI = buffer_in[0];
1681     hci_le_advertising_report_event( 1, Advertising_Report );
1682   }
1683 
1684 }
1685 
1686 /* hci_le_connection_update_complete_event */
1687 /* Event len: 1 + 2 + 2 + 2 + 2 */
1688 /**
1689   * @brief The LE Connection Update Complete event is used to indicate that the Controller
1690 process to update the connection has completed.
1691 On a slave, if no connection parameters are updated, then this event shall not be issued.
1692 On a master, this event shall be issued if the Connection_Update command was sent. See Bluetooth spec 5.0 vol 2 [part E] 7.7.65.3
1693   * @param Status Status error code.
1694   * @param Connection_Handle Connection handle to be used to identify the connection with the peer device.
1695   * Values:
1696   - 0x0000 ... 0x0EFF
1697   * @param Conn_Interval Connection interval used on this connection.
1698 Time = N * 1.25 msec
1699   * Values:
1700   - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
1701   * @param Conn_Latency Slave latency for the connection in number of connection events.
1702   * Values:
1703   - 0x0000 ... 0x01F3
1704   * @param Supervision_Timeout Supervision timeout for the LE Link.
1705 It shall be a multiple of 10 ms and larger than (1 + connSlaveLatency) * connInterval * 2.
1706 Time = N * 10 msec.
1707   * Values:
1708   - 0x000A (100 ms)  ... 0x0C80 (32000 ms)
1709   * @retval None
1710 */
1711 
hci_le_connection_update_complete_event_process(uint8_t * buffer_in)1712 void hci_le_connection_update_complete_event_process(uint8_t *buffer_in)
1713 {
1714   /* Input params */
1715   hci_le_connection_update_complete_event_rp0 *rp0 = (hci_le_connection_update_complete_event_rp0 *)buffer_in;
1716   hci_le_connection_update_complete_event(rp0->Status,
1717                                           rp0->Connection_Handle,
1718                                           rp0->Conn_Interval,
1719                                           rp0->Conn_Latency,
1720                                           rp0->Supervision_Timeout);
1721 }
1722 
1723 /* hci_le_read_remote_used_features_complete_event */
1724 /* Event len: 1 + 2 + 8 */
1725 /**
1726   * @brief The LE Read Remote Used Features Complete event is used to indicate the
1727 completion of the process of the Controller obtaining the used features of the
1728 remote Bluetooth device specified by the Connection_Handle event parameter.See Bluetooth spec 5.0 vol 2 [part E] 7.7.65.4
1729   * @param Status Status error code.
1730   * @param Connection_Handle Connection handle to be used to identify the connection with the peer device.
1731   * Values:
1732   - 0x0000 ... 0x0EFF
1733   * @param LE_Features Bit Mask List of used LE features. For details see LE Link Layer specification.
1734   * @retval None
1735 */
1736 
hci_le_read_remote_used_features_complete_event_process(uint8_t * buffer_in)1737 void hci_le_read_remote_used_features_complete_event_process(uint8_t *buffer_in)
1738 {
1739   /* Input params */
1740   hci_le_read_remote_used_features_complete_event_rp0 *rp0 = (hci_le_read_remote_used_features_complete_event_rp0 *)buffer_in;
1741   hci_le_read_remote_used_features_complete_event(rp0->Status,
1742                                                   rp0->Connection_Handle,
1743                                                   rp0->LE_Features);
1744 }
1745 
1746 /* hci_le_long_term_key_request_event */
1747 /* Event len: 2 + 8 + 2 */
1748 /**
1749   * @brief The LE Long Term Key Request event indicates that the master device is
1750 attempting to encrypt or re-encrypt the link and is requesting the Long Term
1751 Key from the Host. (See [Vol 6] Part B, Section 5.1.3)and Bluetooth spec 5.0 vol 2 [part E] 7.7.65.5
1752   * @param Connection_Handle Connection handle to be used to identify the connection with the peer device.
1753   * Values:
1754   - 0x0000 ... 0x0EFF
1755   * @param Random_Number 64-bit random number
1756   * @param Encrypted_Diversifier 16-bit encrypted diversifier
1757   * @retval None
1758 */
1759 
hci_le_long_term_key_request_event_process(uint8_t * buffer_in)1760 void hci_le_long_term_key_request_event_process(uint8_t *buffer_in)
1761 {
1762   /* Input params */
1763   hci_le_long_term_key_request_event_rp0 *rp0 = (hci_le_long_term_key_request_event_rp0 *)buffer_in;
1764   hci_le_long_term_key_request_event(rp0->Connection_Handle,
1765                                      rp0->Random_Number,
1766                                      rp0->Encrypted_Diversifier);
1767 }
1768 
1769 /* hci_le_data_length_change_event */
1770 /* Event len: 2 + 2 + 2 + 2 + 2 */
1771 /**
1772   * @brief The LE Data Length Change event notifies the Host of a change to either the
1773 maximum Payload length or the maximum transmission time of packets in
1774 either direction. The values reported are the maximum that will actually be
1775 used on the connection following the change, except that on the LE Coded
1776 PHY a packet taking up to 2704 us to transmit may be sent even though the
1777 corresponding parameter has a lower value.
1778  See Bluetooth spec 5.0 vol 2 [part E] 7.7.65.7
1779   * @param Connection_Handle Connection handle to be used to identify the connection with the peer device.
1780   * Values:
1781   - 0x0000 ... 0x0EFF
1782   * @param MaxTxOctets The maximum number of payload octets in a Link Layer packet that the
1783 local Controller will send on this connection(connEffectiveMaxTxOctets defined in [Vol 6] Part B, Section 4.5.10).
1784   * Values:
1785   - 0x001B ... 0x00FB
1786   * @param MaxTxTime The maximum time that the local Controller will take to send a Link
1787 Layer packet on this connection (connEffectiveMaxTxTime defined in[Vol 6] Part B, Section 4.5.10).
1788   * Values:
1789   - 0x0148 ... 0x4290
1790   * @param MaxRxOctets The maximum number of payload octets in a Link Layer packet that the
1791 local Controller expects to receive on this connection(connEffectiveMaxRxOctets defined in [Vol 6] Part B, Section 4.5.10).
1792   * Values:
1793   - 0x001B ... 0x00FB
1794   * @param MaxRxTime The maximum time that the local Controller expects to take to receive a
1795 Link Layer packet on this connection (connEffectiveMaxRxTime defined in [Vol 6] Part B, Section 4.5.10).
1796   * Values:
1797   - 0x0148 ... 0x4290
1798   * @retval None
1799 */
1800 
hci_le_data_length_change_event_process(uint8_t * buffer_in)1801 void hci_le_data_length_change_event_process(uint8_t *buffer_in)
1802 {
1803   /* Input params */
1804   hci_le_data_length_change_event_rp0 *rp0 = (hci_le_data_length_change_event_rp0 *)buffer_in;
1805   hci_le_data_length_change_event(rp0->Connection_Handle,
1806                                   rp0->MaxTxOctets,
1807                                   rp0->MaxTxTime,
1808                                   rp0->MaxRxOctets,
1809                                   rp0->MaxRxTime);
1810 }
1811 
1812 /* hci_le_read_local_p256_public_key_complete_event */
1813 /* Event len: 1 + 64 */
1814 /**
1815   * @brief This event is generated when local P-256 key generation is complete.
1816                                                                   See Bluetooth spec 5.0 vol 2 [part E] 7.7.65.8
1817   * @param Status Status error code.
1818   * @param Local_P256_Public_Key Local P-256 public key.
1819   * @retval None
1820 */
1821 
hci_le_read_local_p256_public_key_complete_event_process(uint8_t * buffer_in)1822 void hci_le_read_local_p256_public_key_complete_event_process(uint8_t *buffer_in)
1823 {
1824   /* Input params */
1825   hci_le_read_local_p256_public_key_complete_event_rp0 *rp0 = (hci_le_read_local_p256_public_key_complete_event_rp0 *)buffer_in;
1826   hci_le_read_local_p256_public_key_complete_event(rp0->Status,
1827                                                    rp0->Local_P256_Public_Key);
1828 }
1829 
1830 /* hci_le_generate_dhkey_complete_event */
1831 /* Event len: 1 + 32 */
1832 /**
1833   * @brief This event indicates that LE Diffie Hellman key generation has been completed
1834 by the Controller. See Bluetooth spec 5.0 vol 2 [part E] 7.7.65.9
1835   * @param Status Status error code.
1836   * @param DHKey Diffie Hellman Key
1837   * @retval None
1838 */
1839 
hci_le_generate_dhkey_complete_event_process(uint8_t * buffer_in)1840 void hci_le_generate_dhkey_complete_event_process(uint8_t *buffer_in)
1841 {
1842   /* Input params */
1843   hci_le_generate_dhkey_complete_event_rp0 *rp0 = (hci_le_generate_dhkey_complete_event_rp0 *)buffer_in;
1844   hci_le_generate_dhkey_complete_event(rp0->Status,
1845                                        rp0->DHKey);
1846 }
1847 
1848 /* hci_le_enhanced_connection_complete_event */
1849 /* Event len: 1 + 2 + 1 + 1 + 6 + 6 + 6 + 2 + 2 + 2 + 1 */
1850 /**
1851   * @brief The LE Enhanced Connection Complete event indicates to both of the Hosts
1852 forming the connection that a new connection has been created. Upon the
1853 creation of the connection a Connection_Handle shall be assigned by the
1854 Controller, and passed to the Host in this event. If the connection establishment
1855 fails, this event shall be provided to the Host that had issued the
1856 LE_Create_Connection command.
1857 If this event is unmasked and LE Connection Complete event is unmasked,
1858 only the LE Enhanced Connection Complete event is sent when a new
1859 connection has been completed.
1860 This event indicates to the Host that issued a LE_Create_Connection
1861 command and received a Command Status event if the connection
1862 establishment failed or was successful.
1863 The Master_Clock_Accuracy parameter is only valid for a slave. On a master,
1864 this parameter shall be set to 0x00. See Bluetooth spec 5.0 vol 2 [part E] 7.7.65.10
1865   * @param Status Status error code.
1866   * @param Connection_Handle Connection handle to be used to identify the connection with the peer device.
1867   * Values:
1868   - 0x0000 ... 0x0EFF
1869   * @param Role Role of the local device in the connection.
1870   * Values:
1871   - 0x00: Master
1872   - 0x01: Slave
1873   * @param Peer_Address_Type 0x00 Public Device Address
1874 0x01 Random Device Address
1875 0x02 Public Identity Address (Corresponds to Resolved Private Address)
1876 0x03 Random (Static) Identity Address (Corresponds to Resolved Private Address)
1877   * Values:
1878   - 0x00: Public Device Address
1879   - 0x01: Random Device Address
1880   - 0x02: Public Identity Address
1881   - 0x03: Random (Static) Identity Address
1882   * @param Peer_Address Public Device Address, Random Device Address, Public Identity
1883 Address or Random (static) Identity Address of the device to be connected.
1884   * @param Local_Resolvable_Private_Address Resolvable Private Address being used by the local device for this connection.
1885 This is only valid when the Own_Address_Type is set to 0x02 or 0x03. For other Own_Address_Type values,
1886 the Controller shall return all zeros.
1887   * @param Peer_Resolvable_Private_Address Resolvable Private Address being used by the peer device for this connection.
1888 This is only valid for Peer_Address_Type 0x02 and 0x03. For
1889 other Peer_Address_Type values, the Controller shall return all zeros.
1890   * @param Conn_Interval Connection interval used on this connection.
1891 Time = N * 1.25 msec
1892   * Values:
1893   - 0x0006 (7.50 ms)  ... 0x0C80 (4000.00 ms)
1894   * @param Conn_Latency Slave latency for the connection in number of connection events.
1895   * Values:
1896   - 0x0000 ... 0x01F3
1897   * @param Supervision_Timeout Supervision timeout for the LE Link.
1898 It shall be a multiple of 10 ms and larger than (1 + connSlaveLatency) * connInterval * 2.
1899 Time = N * 10 msec.
1900   * Values:
1901   - 0x000A (100 ms)  ... 0x0C80 (32000 ms)
1902   * @param Master_Clock_Accuracy Master clock accuracy. Only valid for a slave.
1903   * Values:
1904   - 0x00: 500 ppm
1905   - 0x01: 250 ppm
1906   - 0x02: 150 ppm
1907   - 0x03: 100 ppm
1908   - 0x04: 75 ppm
1909   - 0x05: 50 ppm
1910   - 0x06: 30 ppm
1911   - 0x07: 20 ppm
1912   * @retval None
1913 */
1914 
hci_le_enhanced_connection_complete_event_process(uint8_t * buffer_in)1915 void hci_le_enhanced_connection_complete_event_process(uint8_t *buffer_in)
1916 {
1917   /* Input params */
1918   hci_le_enhanced_connection_complete_event_rp0 *rp0 = (hci_le_enhanced_connection_complete_event_rp0 *)buffer_in;
1919   hci_le_enhanced_connection_complete_event(rp0->Status,
1920                                             rp0->Connection_Handle,
1921                                             rp0->Role,
1922                                             rp0->Peer_Address_Type,
1923                                             rp0->Peer_Address,
1924                                             rp0->Local_Resolvable_Private_Address,
1925                                             rp0->Peer_Resolvable_Private_Address,
1926                                             rp0->Conn_Interval,
1927                                             rp0->Conn_Latency,
1928                                             rp0->Supervision_Timeout,
1929                                             rp0->Master_Clock_Accuracy);
1930 }
1931 
1932 /* hci_le_direct_advertising_report_event */
1933 /* Event len: 1 + rp0->Num_Reports * (sizeof(Direct_Advertising_Report_t)) */
1934 /**
1935   * @brief The LE Direct Advertising Report event indicates that directed advertisements
1936 have been received where the advertiser is using a resolvable private address
1937 for the InitA field in the ADV_DIRECT_IND PDU and the
1938 Scanning_Filter_Policy is equal to 0x02 or 0x03, see HCI_LE_Set_Scan_Parameters.
1939 Direct_Address_Type and Direct_Addres is the address the directed
1940 advertisements are being directed to. Address_Type and Address is the
1941 address of the advertiser sending the directed advertisements. See Bluetooth spec 5.0 vol 2 [part E] 7.7.65.11
1942   * @param Num_Reports Number of responses in this event.
1943   * Values:
1944   - 0x01
1945   * @param Direct_Advertising_Report See @ref Direct_Advertising_Report_t
1946   * @retval None
1947 */
1948 
hci_le_direct_advertising_report_event_process(uint8_t * buffer_in)1949 void hci_le_direct_advertising_report_event_process(uint8_t *buffer_in)
1950 {
1951   /* Input params */
1952   hci_le_direct_advertising_report_event_rp0 *rp0 = (hci_le_direct_advertising_report_event_rp0 *)buffer_in;
1953   hci_le_direct_advertising_report_event(rp0->Num_Reports,
1954                                          rp0->Direct_Advertising_Report);
1955 }
1956 
1957 /* hci_le_phy_update_complete_event */
1958 /* Event len: 1 + 2 + 1 + 1 */
1959 /**
1960   * @brief The LE PHY Update Complete Event is used to indicate that the Controller has
1961 changed the transmitter PHY or receiver PHY in use.
1962 If the Controller changes the transmitter PHY, the receiver PHY, or both PHYs,
1963 this event shall be issued.
1964 If an LE_Set_PHY command was sent and the Controller determines that
1965 neither PHY will change as a result, it issues this event immediately.
1966  See See Bluetooth spec 5.0 vol 2 [part E] 7.7.65.12
1967   * @param Status Status error code.
1968   * @param Connection_Handle Connection handle to be used to identify the connection with the peer device.
1969   * Values:
1970   - 0x0000 ... 0x0EFF
1971   * @param TX_PHY Transmitter PHY in use
1972   * Values:
1973   - 0x01: The transmitter PHY for the connection is LE 1M
1974   - 0x02: The transmitter PHY for the connection is LE 2M
1975   - 0x03: The transmitter PHY for the connection is LE Coded (Not Supported by STM32WB)
1976   * @param RX_PHY Receiver PHY in use
1977   * Values:
1978   - 0x01: The receiver PHY for the connection is LE 1M
1979   - 0x02: The receiver PHY for the connection is LE 2M
1980   - 0x03: The receiver PHY for the connection is LE Coded (Not Supported by STM32WB)
1981   * @retval None
1982 */
1983 
hci_le_phy_update_complete_event_process(uint8_t * buffer_in)1984 void hci_le_phy_update_complete_event_process(uint8_t *buffer_in)
1985 {
1986   /* Input params */
1987   hci_le_phy_update_complete_event_rp0 *rp0 = (hci_le_phy_update_complete_event_rp0 *)buffer_in;
1988   hci_le_phy_update_complete_event(rp0->Status,
1989                                    rp0->Connection_Handle,
1990                                    rp0->TX_PHY,
1991                                    rp0->RX_PHY);
1992 }
1993 
1994