1 /* USER CODE BEGIN Header */
2 /**
3   ******************************************************************************
4   * @file    aci_adv_nwk.h
5   * @author  MCD Application Team
6   * @brief   Adaptation layer from stack native advertising interface
7   *                      to network interface.
8   ******************************************************************************
9   * @attention
10   *
11   * Copyright (c) 2024 STMicroelectronics.
12   * All rights reserved.
13   *
14   * This software is licensed under terms that can be found in the LICENSE file
15   * in the root directory of this software component.
16   * If no LICENSE file comes with this software, it is provided AS-IS.
17   *
18   ******************************************************************************
19   */
20 /* USER CODE END Header */
21 
22 #ifndef ACI_ADV_NWK_H
23 #define ACI_ADV_NWK_H
24 
25 #include "ble.h"
26 
27 /** Documentation for C struct Subevent_Data_Parameters_t */
28 typedef struct Subevent_Data_Parameters_t_s {
29   /** The subevent index of the data.
30    *  Values:
31    *  - 0x00 ... 0x7F
32    */
33   uint8_t Subevent;
34   /** The first response slots to be used in this subevent.
35    */
36   uint8_t Response_Slot_Start;
37   /** The number of response slots to be used.
38    */
39   uint8_t Response_Slot_Count;
40   /** The number of octets in the Subevent_Data parameter.
41    *  Values:
42    *  - 0x00 ... 0xFB
43    */
44   uint8_t Subevent_Data_Length;
45   /** Advertising data formatted as defined in [Vol 3] Part C, Section 11.
46    */
47   uint8_t *Subevent_Data;
48 } Subevent_Data_Parameters_t;
49 
50 void aci_adv_nwk_init(void);
51 
52 tBleStatus aci_gap_set_advertising_data_nwk(uint8_t Advertising_Handle,
53                                             uint8_t Operation,
54                                             uint8_t Advertising_Data_Length,
55                                             uint8_t *Advertising_Data);
56 
57 tBleStatus aci_gap_set_scan_response_data_nwk(uint8_t Advertising_Handle,
58                                               uint8_t Operation,
59                                               uint8_t Scan_Response_Data_Length,
60                                               uint8_t *Scan_Response_Data);
61 
62 tBleStatus hci_le_set_advertising_data(uint8_t Advertising_Data_Length,
63                                        uint8_t Advertising_Data[31]);
64 
65 tBleStatus hci_le_set_scan_response_data(uint8_t Scan_Response_Data_Length,
66                                          uint8_t Scan_Response_Data[31]);
67 
68 tBleStatus hci_le_set_extended_advertising_data(uint8_t Advertising_Handle,
69                                                 uint8_t Operation,
70                                                 uint8_t Fragment_Preference,
71                                                 uint8_t Advertising_Data_Length,
72                                                 uint8_t *Advertising_Data);
73 
74 tBleStatus hci_le_set_extended_scan_response_data(uint8_t Advertising_Handle,
75                                                   uint8_t Operation,
76                                                   uint8_t Fragment_Preference,
77                                                   uint8_t Scan_Response_Data_Length,
78                                                   uint8_t *Scan_Response_Data);
79 
80 tBleStatus hci_le_set_periodic_advertising_data(uint8_t Advertising_Handle,
81                                                 uint8_t Operation,
82                                                 uint8_t Advertising_Data_Length,
83                                                 uint8_t Advertising_Data[]);
84 
85 tBleStatus hci_le_set_periodic_advertising_subevent_data(uint8_t Advertising_Handle,
86                                                          uint8_t Num_Subevents,
87                                                          Subevent_Data_Parameters_t Subevent_Data_Parameters[]);
88 
89 tBleStatus hci_le_set_periodic_advertising_response_data(uint16_t Sync_Handle,
90                                                          uint16_t Request_Event,
91                                                          uint8_t Request_Subevent,
92                                                          uint8_t Response_Subevent,
93                                                          uint8_t Response_Slot,
94                                                          uint8_t Response_Data_Length,
95                                                          uint8_t Response_Data[]);
96 
97 tBleStatus aci_gap_encrypt_adv_data_nwk(uint8_t session_key[16],
98                                         uint8_t iv[8],
99                                         uint8_t adv_payload_data_len,
100                                         uint8_t adv_payload_data_clear[],
101                                         uint8_t *adv_payload_data_encrypted_len,
102                                         uint8_t adv_payload_data_encrypted[]);
103 
104 tBleStatus aci_gap_decrypt_adv_data_nwk(uint8_t session_key[16],
105                                         uint8_t iv[8],
106                                         uint8_t adv_payload_encrypted_data_len,
107                                         uint8_t adv_payload_encrypted_data[],
108                                         uint8_t *adv_payload_clear_data_len,
109                                         uint8_t adv_payload_clear_data[]);
110 
111 #endif /* ACI_ADV_NWK_H */
112