1 /*
2  * Copyright 2016-2023, Cypress Semiconductor Corporation or
3  * an affiliate of Cypress Semiconductor Corporation.  All rights reserved.
4  *
5  * This software, including source code, documentation and related
6  * materials ("Software") is owned by Cypress Semiconductor Corporation
7  * or one of its affiliates ("Cypress") and is protected by and subject to
8  * worldwide patent protection (United States and foreign),
9  * United States copyright laws and international treaty provisions.
10  * Therefore, you may use this Software only as provided in the license
11  * agreement accompanying the software package from which you
12  * obtained this Software ("EULA").
13  * If no EULA applies, Cypress hereby grants you a personal, non-exclusive,
14  * non-transferable license to copy, modify, and compile the Software
15  * source code solely for use in connection with Cypress's
16  * integrated circuit products.  Any reproduction, modification, translation,
17  * compilation, or representation of this Software except as specified
18  * above is prohibited without the express written permission of Cypress.
19  *
20  * Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO WARRANTY OF ANY KIND,
21  * EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, NONINFRINGEMENT, IMPLIED
22  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress
23  * reserves the right to make changes to the Software without notice. Cypress
24  * does not assume any liability arising out of the application or use of the
25  * Software or any product or circuit described in the Software. Cypress does
26  * not authorize its products for use in any products where a malfunction or
27  * failure of the Cypress product may reasonably be expected to result in
28  * significant property damage, injury or death ("High Risk Product"). By
29  * including Cypress's product in a High Risk Product, the manufacturer
30  * of such system or application assumes all risk of such use and in doing
31  * so agrees to indemnify Cypress against all liability.
32  */
33 
34 /** @file
35  *
36  * WICED Bluetooth Low Energy (BLE) Functions
37  *
38  */
39 #pragma once
40 
41 /**
42  * @if DUAL_MODE
43  * @addtogroup  btm_ble_api_functions        BLE (Bluetooth Low Energy)
44  * @ingroup  wicedbt_DeviceManagement
45  * This section describes the API's to use BLE functionality such as advertisement, scanning
46  * BLE Connection, Data transfer, BLE Security etc.
47  * @else
48  * @addtogroup  wicedbt_DeviceManagement
49  * @endif
50  *
51  *
52  * @{
53  */
54 
55 #include "wiced_bt_cfg.h"
56 #include "wiced_bt_dev.h"
57 #include "wiced_bt_isoc.h"
58 
59 #define BTM_BLE_LEGACY_AD_DATA_LEN 31                       /**< Max legacy advertisement data len*/
60 #define BTM_AFH_CHNL_MAP_SIZE    HCI_AFH_CHANNEL_MAP_LEN    /**< AFH channel map size */
61 #define BLE_CHANNEL_MAP_LEN      5                          /**< AFH Channel Map len */
62 /** BLE Channel Map */
63 typedef uint8_t wiced_bt_ble_chnl_map_t[BLE_CHANNEL_MAP_LEN];
64 
65 
66 /** Scanner filter policy */
67 enum wiced_bt_ble_scanner_filter_policy_e {
68     BTM_BLE_SCAN_POLICY_ACCEPT_ADV_RSP,              /**< accept adv packet from all, directed adv pkt not directed to local device is ignored */
69     BTM_BLE_SCAN_POLICY_FILTER_ADV_RSP,        /**< accept adv packet from device in filter Accept List, directed adv packet not directed to local device is ignored */
70     BTM_BLE_SCAN_POLICY_ACCEPT_RPA_DIR_ADV_RSP,      /**< accept adv packet from all, directed adv pkt not directed to local device is ignored except direct adv with RPA */
71     BTM_BLE_SCAN_POLICY_FILTER_RPA_DIR_ADV_RSP,/**< accept adv packet from device in filter Accept List, directed adv pkt not directed to me is ignored except direct adv with RPA */
72     BTM_BLE_SCAN_POLICY_MAX                       /**< Max Scan filter policy value */
73 };
74 /** BLE Scanner filter policy */
75 typedef uint8_t   wiced_bt_ble_scanner_filter_policy_t;  /**< Scanner filter policy (see #wiced_bt_ble_scanner_filter_policy_e) */
76 
77 
78 /** default advertising channel map */
79 #ifndef BTM_BLE_DEFAULT_ADVERT_CHNL_MAP
80 #define BTM_BLE_DEFAULT_ADVERT_CHNL_MAP   (BTM_BLE_ADVERT_CHNL_37| BTM_BLE_ADVERT_CHNL_38| BTM_BLE_ADVERT_CHNL_39)
81 #endif
82 
83 /** Advertising filter policy */
84 enum wiced_bt_ble_advert_filter_policy_e {
85     BTM_BLE_ADV_POLICY_ACCEPT_CONN_AND_SCAN     = 0x00,    /**< Process scan and connection requests from all devices (i.e., the Filter Accept List is not in use) (default) */
86     BTM_BLE_ADV_POLICY_ACCEPT_CONN_FILTER_SCAN  = 0x01,    /**< Process connection requests from all devices and only scan requests from devices that are in the Filter Accept List. */
87     BTM_BLE_ADV_POLICY_FILTER_CONN_ACCEPT_SCAN  = 0x02,    /**< Process scan requests from all devices and only connection requests from devices that are in the Filter Accept List */
88     BTM_BLE_ADV_POLICY_FILTER_CONN_FILTER_SCAN  = 0x03,    /**< Process scan and connection requests only from devices in the Filter Accept List. */
89     BTM_BLE_ADV_POLICY_MAX                                 /**< Max Adv filter value */
90 };
91 typedef uint8_t   wiced_bt_ble_advert_filter_policy_t;  /**< Advertising filter policy (see #wiced_bt_ble_advert_filter_policy_e) */
92 
93 /** default advertising filter policy */
94 #define BTM_BLE_ADVERT_FILTER_DEFAULT   BTM_BLE_ADV_POLICY_ACCEPT_CONN_AND_SCAN
95 
96 #define BTM_BLE_ADVERT_INTERVAL_MIN     0x0020  /**< adv parameter Min value */
97 #define BTM_BLE_ADVERT_INTERVAL_MAX     0x4000  /**< adv parameter Max value */
98 
99 #define BTM_BLE_SCAN_INTERVAL_MIN       0x0004  /**< Scan interval minimum value */
100 #define BTM_BLE_SCAN_INTERVAL_MAX       0x4000  /**< Scan interval miximum value */
101 #define BTM_BLE_SCAN_WINDOW_MIN         0x0004  /**< Scan window minimum value */
102 #define BTM_BLE_SCAN_WINDOW_MAX         0x4000  /**< Scan window maximum value */
103 #define BTM_BLE_CONN_INTERVAL_MIN       0x0006  /**< Connection interval minimum value */
104 #define BTM_BLE_CONN_INTERVAL_MAX       0x0C80  /**< Connection interval maximum value */
105 #define BTM_BLE_CONN_LATENCY_MAX        500     /**< Maximum Connection Latency */
106 #define BTM_BLE_CONN_SUP_TOUT_MIN       0x000A  /**< Minimum Supervision Timeout */
107 #define BTM_BLE_CONN_SUP_TOUT_MAX       0x0C80  /**< Maximum Supervision Timeout */
108 #define BTM_BLE_CONN_PARAM_UNDEF        0xffff  /**< use this value when a specific value not to be overwritten */
109 #define BTM_BLE_CONN_SUP_TOUT_DEF       700     /**< Default Supervision Timeout */
110 
111 /* default connection parameters if not configured, use GAP recommend value for auto connection */
112 /** default scan interval
113  *  30 ~ 60 ms (use 60)  = 96 *0.625
114  */
115 #define BTM_BLE_SCAN_FAST_INTERVAL      96
116 
117 /** default scan window (in .625ms slots) for background auto connections
118  * 30 ms = 48 *0.625
119  */
120 #define BTM_BLE_SCAN_FAST_WINDOW        48
121 
122 /** default scan interval used in reduced power cycle (background scanning)
123  *  1.28 s   = 2048 *0.625
124  */
125 #define BTM_BLE_SCAN_SLOW_INTERVAL_1    2048
126 
127 /** default scan window used in reduced power cycle (background scanning)
128  *   11.25 ms = 18 *0.625
129  */
130 #define BTM_BLE_SCAN_SLOW_WINDOW_1      18
131 
132 /** default scan interval used in reduced power cycle (background scanning)
133  *  2.56 s   = 4096 *0.625
134  */
135 #define BTM_BLE_SCAN_SLOW_INTERVAL_2    4096
136 
137 /** default scan window used in reduced power cycle (background scanning)
138  *  22.5 ms = 36 *0.625
139  */
140 #define BTM_BLE_SCAN_SLOW_WINDOW_2      36
141 
142 /** default connection interval min
143  *  recommended min: 30ms  = 24 * 1.25
144  */
145 #define BTM_BLE_CONN_INTERVAL_MIN_DEF   24
146 
147 /** default connection interval max
148  * recommended max: 50 ms = 56 * 1.25
149  */
150 #define BTM_BLE_CONN_INTERVAL_MAX_DEF   40
151 
152 /** default Peripheral latency */
153 #define BTM_BLE_CONN_PERIPHERAL_LATENCY_DEF  0
154 
155 /** default supervision timeout */
156 #define BTM_BLE_CONN_TIMEOUT_DEF                    2000
157 
158 /** BLE Signature
159  *  BLE data signature length 8 Bytes + 4 bytes counter
160  */
161 #define BTM_BLE_AUTH_SIGNATURE_SIZE                 12
162 typedef uint8_t wiced_dev_ble_signature_t[BTM_BLE_AUTH_SIGNATURE_SIZE];     /**< Device address (see #BTM_BLE_AUTH_SIGNATURE_SIZE) */
163 
164 #define BTM_BLE_POLICY_REJECT_ALL                   0x00    /**< relevant to both */
165 #define BTM_BLE_POLICY_ALLOW_SCAN                   0x01    /**< relevant to advertiser */
166 #define BTM_BLE_POLICY_ALLOW_CONN                   0x02    /**< relevant to advertiser */
167 #define BTM_BLE_POLICY_ALLOW_ALL                    0x03    /**< relevant to both */
168 
169 /* ADV data flag bit definition used for BTM_BLE_ADVERT_TYPE_FLAG */
170 #define BTM_BLE_LIMITED_DISCOVERABLE_FLAG           (0x01 << 0)     /**< Limited Discoverable */
171 #define BTM_BLE_GENERAL_DISCOVERABLE_FLAG           (0x01 << 1)     /**< General Discoverable */
172 #define BTM_BLE_BREDR_NOT_SUPPORTED                 (0x01 << 2)     /**< BR/EDR Not Supported */
173 /* 4.1 spec adv flag for simultaneous BR/EDR+LE connection support (see) */
174 #define BTM_BLE_SIMULTANEOUS_DUAL_MODE_TO_SAME_DEVICE_CONTROLLER_SUPPORTED      (0x01 << 3)   /**< Simultaneous LE and BR/EDR to Same Device Capable (Controller). */
175 #define BTM_BLE_SIMULTANEOUS_DUAL_MODE_TO_SAME_DEVICE_HOST_SUPPORTED            (0x01 << 4)   /**< Simultaneous LE and BR/EDR to Same Device Capable (Host). */
176 #define BTM_BLE_NON_LIMITED_DISCOVERABLE_FLAG       (0x00 )         /**< Non Discoverable */
177 #define BTM_BLE_ADVERT_FLAG_MASK                    (BTM_BLE_LIMITED_DISCOVERABLE_FLAG | BTM_BLE_BREDR_NOT_SUPPORTED | BTM_BLE_GENERAL_DISCOVERABLE_FLAG) /**< BLE adverisement mask */
178 #define BTM_BLE_LIMITED_DISCOVERABLE_MASK           (BTM_BLE_LIMITED_DISCOVERABLE_FLAG )    /**< BLE Limited discovery mask*/
179 
180 
181 /** Advertisement data types */
182 enum wiced_bt_ble_advert_type_e {
183     BTM_BLE_ADVERT_TYPE_FLAG                        = 0x01,                 /**< Advertisement flags */
184     BTM_BLE_ADVERT_TYPE_16SRV_PARTIAL               = 0x02,                 /**< List of supported services - 16 bit UUIDs (partial) */
185     BTM_BLE_ADVERT_TYPE_16SRV_COMPLETE              = 0x03,                 /**< List of supported services - 16 bit UUIDs (complete) */
186     BTM_BLE_ADVERT_TYPE_32SRV_PARTIAL               = 0x04,                 /**< List of supported services - 32 bit UUIDs (partial) */
187     BTM_BLE_ADVERT_TYPE_32SRV_COMPLETE              = 0x05,                 /**< List of supported services - 32 bit UUIDs (complete) */
188     BTM_BLE_ADVERT_TYPE_128SRV_PARTIAL              = 0x06,                 /**< List of supported services - 128 bit UUIDs (partial) */
189     BTM_BLE_ADVERT_TYPE_128SRV_COMPLETE             = 0x07,                 /**< List of supported services - 128 bit UUIDs (complete) */
190     BTM_BLE_ADVERT_TYPE_NAME_SHORT                  = 0x08,                 /**< Short name */
191     BTM_BLE_ADVERT_TYPE_NAME_COMPLETE               = 0x09,                 /**< Complete name */
192     BTM_BLE_ADVERT_TYPE_TX_POWER                    = 0x0A,                 /**< TX Power level  */
193     BTM_BLE_ADVERT_TYPE_DEV_CLASS                   = 0x0D,                 /**< Device Class */
194     BTM_BLE_ADVERT_TYPE_SIMPLE_PAIRING_HASH_C       = 0x0E,                 /**< Simple Pairing Hash C */
195     BTM_BLE_ADVERT_TYPE_SIMPLE_PAIRING_RAND_C       = 0x0F,                 /**< Simple Pairing Randomizer R */
196     BTM_BLE_ADVERT_TYPE_SM_TK                       = 0x10,                 /**< Security manager TK value */
197     BTM_BLE_ADVERT_TYPE_SM_OOB_FLAG                 = 0x11,                 /**< Security manager Out-of-Band data */
198     BTM_BLE_ADVERT_TYPE_INTERVAL_RANGE              = 0x12,                 /**< Peripheral connection interval range */
199     BTM_BLE_ADVERT_TYPE_SOLICITATION_SRV_UUID       = 0x14,                 /**< List of solicitated services - 16 bit UUIDs */
200     BTM_BLE_ADVERT_TYPE_128SOLICITATION_SRV_UUID    = 0x15,                 /**< List of solicitated services - 128 bit UUIDs */
201     BTM_BLE_ADVERT_TYPE_SERVICE_DATA                = 0x16,                 /**< Service data - 16 bit UUID */
202     BTM_BLE_ADVERT_TYPE_PUBLIC_TARGET               = 0x17,                 /**< Public target address */
203     BTM_BLE_ADVERT_TYPE_RANDOM_TARGET               = 0x18,                 /**< Random target address */
204     BTM_BLE_ADVERT_TYPE_APPEARANCE                  = 0x19,                 /**< Appearance */
205     BTM_BLE_ADVERT_TYPE_ADVERT_INTERVAL             = 0x1a,                 /**< Advertising interval */
206     BTM_BLE_ADVERT_TYPE_LE_BD_ADDR                  = 0x1b,                 /**< LE device bluetooth address */
207     BTM_BLE_ADVERT_TYPE_LE_ROLE                     = 0x1c,                 /**< LE role */
208     BTM_BLE_ADVERT_TYPE_256SIMPLE_PAIRING_HASH      = 0x1d,                 /**< Simple Pairing Hash C-256 */
209     BTM_BLE_ADVERT_TYPE_256SIMPLE_PAIRING_RAND      = 0x1e,                 /**< Simple Pairing Randomizer R-256 */
210     BTM_BLE_ADVERT_TYPE_32SOLICITATION_SRV_UUID     = 0x1f,                 /**< List of solicitated services - 32 bit UUIDs */
211     BTM_BLE_ADVERT_TYPE_32SERVICE_DATA              = 0x20,                 /**< Service data - 32 bit UUID */
212     BTM_BLE_ADVERT_TYPE_128SERVICE_DATA             = 0x21,                 /**< Service data - 128 bit UUID */
213     BTM_BLE_ADVERT_TYPE_CONN_CONFIRM_VAL            = 0x22,                 /**< LE Secure Connections Confirmation Value */
214     BTM_BLE_ADVERT_TYPE_CONN_RAND_VAL               = 0x23,                 /**< LE Secure Connections Random Value */
215     BTM_BLE_ADVERT_TYPE_URI                         = 0x24,                 /**< URI */
216     BTM_BLE_ADVERT_TYPE_INDOOR_POS                  = 0x25,                 /**< Indoor Positioning */
217     BTM_BLE_ADVERT_TYPE_TRANS_DISCOVER_DATA         = 0x26,                 /**< Transport Discovery Data */
218     BTM_BLE_ADVERT_TYPE_SUPPORTED_FEATURES          = 0x27,                 /**< LE Supported Features */
219     BTM_BLE_ADVERT_TYPE_UPDATE_CH_MAP_IND           = 0x28,                 /**< Channel Map Update Indication */
220     BTM_BLE_ADVERT_TYPE_PB_ADV                      = 0x29,                 /**< PB-ADV */
221     BTM_BLE_ADVERT_TYPE_MESH_MSG                    = 0x2A,                 /**< Mesh Message */
222     BTM_BLE_ADVERT_TYPE_MESH_BEACON                 = 0x2B,                 /**< Mesh Beacon */
223     BTM_BLE_ADVERT_TYPE_PSRI                        = 0x2E,                 /**< Generic Audio Provate Set Random Identifier */
224     BTM_BLE_ADVERT_TYPE_3D_INFO_DATA                = 0x3D,                 /**< 3D Information Data */
225     BTM_BLE_ADVERT_TYPE_MANUFACTURER                = 0xFF                  /**< Manufacturer data */
226 };
227 typedef uint8_t   wiced_bt_ble_advert_type_t;    /**< BLE advertisement data type (see #wiced_bt_ble_advert_type_e) */
228 
229 /** security settings used with L2CAP LE COC */
230 enum wiced_bt_ble_sec_flags_e
231 {
232     BTM_SEC_LE_LINK_ENCRYPTED                       = 0x01,                 /**< Link encrypted */
233     BTM_SEC_LE_LINK_PAIRED_WITHOUT_MITM             = 0x02,                 /**< Paired without man-in-the-middle protection */
234     BTM_SEC_LE_LINK_PAIRED_WITH_MITM                = 0x04                  /**< Link with man-in-the-middle protection */
235 };
236 
237 /** Advertisement element */
238 typedef struct
239 {
240     uint8_t                     *p_data;        /**< Advertisement data */
241     uint16_t                    len;            /**< Advertisement length */
242     wiced_bt_ble_advert_type_t  advert_type;    /**< Advertisement data type */
243 }wiced_bt_ble_advert_elem_t;
244 
245 /** Scan result event type */
246 enum wiced_bt_dev_ble_evt_type_e {
247     BTM_BLE_EVT_CONNECTABLE_ADVERTISEMENT           = 0x00,                 /**< Connectable advertisement */
248     BTM_BLE_EVT_CONNECTABLE_DIRECTED_ADVERTISEMENT  = 0x01,                 /**< Connectable Directed advertisement */
249     BTM_BLE_EVT_SCANNABLE_ADVERTISEMENT             = 0x02,                 /**< Scannable advertisement */
250     BTM_BLE_EVT_NON_CONNECTABLE_ADVERTISEMENT       = 0x03,                 /**< Non connectable advertisement */
251     BTM_BLE_EVT_SCAN_RSP                            = 0x04                  /**< Scan response */
252 };
253 typedef uint8_t wiced_bt_dev_ble_evt_type_t;    /**< Scan result event value (see #wiced_bt_dev_ble_evt_type_e) */
254 
255 /** Background connection type */
256 enum wiced_bt_ble_conn_type_e
257 {
258     BTM_BLE_CONN_NONE,                          /**< No background connection */
259     BTM_BLE_CONN_AUTO,                          /**< Auto connection based on filter list */
260     BTM_BLE_CONN_SELECTIVE = BTM_BLE_CONN_AUTO  /**< Selective not used */
261 };
262 typedef uint8_t wiced_bt_ble_conn_type_t;       /**< Connection type (see #wiced_bt_ble_conn_type_e) */
263 
264 /** LE inquiry result type */
265 typedef struct
266 {
267     wiced_bool_t                    is_extended;                            /**< True if an extended ADV */
268     wiced_bt_device_address_t       remote_bd_addr;                         /**< Device address */
269     uint8_t                         ble_addr_type;                          /**< LE Address type */
270     wiced_bt_dev_ble_evt_type_t     ble_evt_type;                           /**< Scan result event type */
271     int8_t                          rssi;                                   /**< Set to #BTM_INQ_RES_IGNORE_RSSI, if not valid */
272     uint8_t                         flag;                                   /**< Adverisement Flag value */
273     uint8_t                         primary_phy;                            /**< Primary PHY */
274     uint8_t                         secondary_phy;                          /**< Secondary PHY */
275     uint8_t                         adv_sid;                                /**< advertisement security ID */
276     uint8_t                         tx_power;                               /**< Tx power */
277     uint16_t                        periodic_adv_interval;                  /**< Periodic advertisement interval */
278     uint8_t                         direct_addr_type;                       /**< Directed address type */
279     wiced_bt_device_address_t       direct_bda;                             /**< Directed address */
280 } wiced_bt_ble_scan_results_t;
281 
282 /** LE encryption method **/
283 enum wiced_bt_ble_sec_action_type_e
284 {
285     BTM_BLE_SEC_NONE,               /**< No encryption */
286     BTM_BLE_SEC_ENCRYPT,            /**< encrypt the link using current key */
287     BTM_BLE_SEC_ENCRYPT_NO_MITM,    /**< encryption without MITM */
288     BTM_BLE_SEC_ENCRYPT_MITM        /**< encryption with MITM*/
289 };
290 typedef uint8_t wiced_bt_ble_sec_action_type_t;  /**< BLE security type. refer #wiced_bt_ble_sec_action_type_e */
291 
292 #define BTM_BLE_PREFER_1M_PHY              0x01    /**< LE 1M PHY preference */
293 #define BTM_BLE_PREFER_2M_PHY              0x02    /**< LE 2M PHY preference */
294 #define BTM_BLE_PREFER_LELR_PHY            0x04    /**< LE LELR PHY preference */
295 
296 /**  Host preferences on PHY.
297  *  bit field that indicates the transmitter PHYs that
298  *  the Host prefers the Controller to use.Bit number 3 -7 reserved for future.
299  */
300 typedef uint8_t   wiced_bt_ble_host_phy_preferences_t;
301 
302 #define BTM_BLE_PREFER_NO_LELR                         0x0000 /**< No preferred coding */
303 #define BTM_BLE_PREFER_LELR_125K                       0x0001 /**< Preferred coding is S=2 */
304 #define BTM_BLE_PREFER_LELR_512K                       0x0002 /**< Preferred coding is S=8 */
305 
306 /**  The PHY_options parameter is a bit field that allows the Host to specify options
307  *    for LE long range PHY. Default connection is with no LE coded PHY.The Controller may override any
308  *    preferred coding (S2 coded phy for 512k speed and s8 coded phy for 128K) for
309  *    transmitting on the LE Coded PHY.
310  *    The Host may specify a preferred coding even if it prefers not to use the LE
311  *    Coded transmitter PHY since the Controller may override the PHY preference.
312  *    Bit 2-15 reserved for future use.
313  *  @note  These preferences applicable only when BTM_BLE_PREFER_LELR_PHY flag gest set
314  */
315 typedef uint16_t  wiced_bt_ble_lelr_phy_preferences_t;
316 
317 /** Host PHY preferences */
318 typedef struct
319 {
320     wiced_bt_device_address_t               remote_bd_addr;     /**< Peer Device address */
321     wiced_bt_ble_host_phy_preferences_t     tx_phys;            /**< Host preference among the TX PHYs */
322     wiced_bt_ble_host_phy_preferences_t     rx_phys;            /**< Host preference among the RX PHYs */
323     wiced_bt_ble_lelr_phy_preferences_t     phy_opts;           /**< Host preference on LE coded PHY */
324 }wiced_bt_ble_phy_preferences_t;
325 
326 /** BLE connection parameteres */
327 typedef struct
328 {
329     wiced_bt_dev_role_t role;           /**< Connection role 0: Central  1: Peripheral */
330     uint16_t            conn_interval;          /**< Connection interval in slots */
331     uint16_t            conn_latency;           /**< Connection latency */
332     uint16_t            supervision_timeout;    /**< Supervision timeout */
333 }wiced_bt_ble_conn_params_t;
334 
335 /** BLE preferred connection parameters */
336 typedef struct
337 {
338     uint16_t  conn_interval_min;  /**< minimum connection interval */
339     uint16_t  conn_interval_max;  /**< maximum connection interval */
340     uint16_t  conn_latency;  /**< connection latency */
341     uint16_t  conn_supervision_timeout;  /**< connection supervision timeout */
342 }wiced_bt_ble_pref_conn_params_t;
343 
344 
345 /* The power table for multi ADV Tx Power levels
346     Min   : -12 dBm     #define BTM_BLE_ADV_TX_POWER_MIN        0
347     Low   :  -8 dBm     #define BTM_BLE_ADV_TX_POWER_LOW        1
348     Mid   :  -4 dBm     #define BTM_BLE_ADV_TX_POWER_MID        2
349     Upper :   0 dBm     #define BTM_BLE_ADV_TX_POWER_UPPER      3
350     Max   :   4 dBm     #define BTM_BLE_ADV_TX_POWER_MAX        4
351 */
352 #define MULTI_ADV_TX_POWER_MIN_INDEX                0   /**< Multi adv tx min power index */
353 #define MULTI_ADV_TX_POWER_MAX_INDEX                4   /**< Multi adv tx max power index */
354 
355 /** Transmit Power in dBm ( #MULTI_ADV_TX_POWER_MIN_INDEX to #MULTI_ADV_TX_POWER_MAX_INDEX ) */
356 typedef int8_t wiced_bt_ble_adv_tx_power_t;
357 
358 /** Multi-advertisement start/stop */
359 enum wiced_bt_ble_multi_advert_start_e
360 {
361     MULTI_ADVERT_STOP                               = 0x00,                 /**< Stop Multi-adverstisment */
362     MULTI_ADVERT_START                              = 0x01                  /**< Start Multi-adverstisment */
363 };
364 
365 /** Multi-advertisement type */
366 enum wiced_bt_ble_multi_advert_type_e
367 {
368     MULTI_ADVERT_CONNECTABLE_UNDIRECT_EVENT         = 0x00,     /**< Multi adv Connectable undirected event */
369     MULTI_ADVERT_CONNECTABLE_DIRECT_EVENT           = 0x01,     /**< Multi adv Connectable directed event */
370     MULTI_ADVERT_DISCOVERABLE_EVENT                 = 0x02,     /**< Multi adv Discoverable event */
371     MULTI_ADVERT_NONCONNECTABLE_EVENT               = 0x03,     /**< Multi adv NonConnectable event */
372     MULTI_ADVERT_LOW_DUTY_CYCLE_DIRECT_EVENT        = 0x04      /**< Multi adv Low Cycle directed event */
373 };
374 typedef uint8_t wiced_bt_ble_multi_advert_type_t;    /**< BLE advertisement type (see #wiced_bt_ble_multi_advert_type_e) */
375 
376 
377 /** LE Multi advertising parameter */
378 typedef struct
379 {
380     /**< BTM_BLE_ADVERT_INTERVAL_MIN to BTM_BLE_ADVERT_INTERVAL_MAX ( As per spec ) */
381     uint16_t                             adv_int_min;            /**< Minimum adv interval */
382     /**< BTM_BLE_ADVERT_INTERVAL_MIN to BTM_BLE_ADVERT_INTERVAL_MAX ( As per spec ) */
383     uint16_t                             adv_int_max;            /**< Maximum adv interval */
384     wiced_bt_ble_multi_advert_type_t     adv_type;               /**< Adv event type */
385     wiced_bt_ble_advert_chnl_map_t       channel_map;            /**< Adv channel map */
386     wiced_bt_ble_advert_filter_policy_t  adv_filter_policy;      /**< Advertising filter policy */
387     wiced_bt_ble_adv_tx_power_t          adv_tx_power;           /**< Adv tx power */
388     wiced_bt_device_address_t            peer_bd_addr;           /**< Peer Device address */
389     wiced_bt_ble_address_type_t          peer_addr_type;         /**< Peer LE Address type */
390     wiced_bt_device_address_t            own_bd_addr;            /**< Own LE address */
391     wiced_bt_ble_address_type_t          own_addr_type;          /**< Own LE Address type */
392 }wiced_bt_ble_multi_adv_params_t;
393 
394 /** Privacy mode
395  * refer Spec version 5.0 Vol 3 Part C Section 10.7 privacy feature
396  */
397 enum wiced_bt_ble_privacy_e
398 {
399     BTM_BLE_PRIVACY_MODE_NETWORK,                           /**< network privacy mode*/
400     BTM_BLE_PRIVACY_MODE_DEVICE                             /**< device privacy mode*/
401 };
402 /** BLE Privacy mode. Refer #wiced_bt_ble_privacy_e */
403 typedef uint8_t wiced_bt_ble_privacy_mode_t;
404 
405 /** Multi-advertisement Filtering policy  */
406 enum wiced_bt_ble_multi_advert_filtering_policy_e
407 {
408     MULTI_ADVERT_FILTER_POLICY_NOT_USED                         = 0x00,   /**< Multi adv filter filter Accept List not used */
409     MULTI_ADVERT_FILTER_POLICY_ADV_ALLOW_UNKNOWN_CONNECTION     = 0x01,   /**< Multi adv filter filter Accept List for scan request */
410     MULTI_ADVERT_FILTER_POLICY_ADV_ALLOW_UNKNOWN_SCANNING       = 0x02,   /**< Multi adv filter filter Accept List for connection request */
411     MULTI_ADVERT_FILTER_POLICY_USE_FOR_ALL                      = 0x03    /**< Multi adv filter filter Accept List for all */
412 };
413 typedef uint8_t wiced_bt_ble_multi_advert_filtering_policy_t;    /**< BLE advertisement filtering policy (see #wiced_bt_ble_multi_advert_filtering_policy_e) */
414 
415 /**
416  * Callback wiced_bt_ble_scan_result_cback_t
417  *
418  * Scan result callback (from calling #wiced_bt_ble_scan)
419  *
420  * @param p_scan_result             : scan result data (NULL indicates end of scanning)
421  * @param p_adv_data                : Advertisement data (parse using #wiced_bt_ble_check_advertising_data)
422  *
423  * @return Nothing
424  */
425 typedef void (wiced_bt_ble_scan_result_cback_t) (wiced_bt_ble_scan_results_t *p_scan_result, uint8_t *p_adv_data);
426 
427 /**
428  * Callback wiced_bt_ble_read_phy_complete_callback_t
429  *
430  * read phy complete callback (from calling #wiced_bt_ble_read_phy)
431  *
432  * @param p_phy_result             : read phys result
433  *
434  * @return Nothing
435  */
436 typedef void (wiced_bt_ble_read_phy_complete_callback_t) (wiced_bt_ble_phy_update_t *p_phy_result);
437 
438 /** ADV extension structures */
439 #define WICED_BT_BLE_MAX_EXT_ADV_DATA_LEN    251
440 
441 /** BLE PHY */
442 enum
443 {
444     WICED_BT_BLE_EXT_ADV_PHY_1M          = 0x1, /**< advetiser advertisement PHY is LE 1M */
445     WICED_BT_BLE_EXT_ADV_PHY_2M          = 0x2, /**< advetiser advertisement PHY is LE 2M */
446     WICED_BT_BLE_EXT_ADV_PHY_LE_CODED    = 0x3, /**< advetiser advertisement PHY is LE Coded (for long range) */
447     WICED_BT_BLE_EXT_ADV_NUM_PHYS        = 0x3  /**< 3 PHYs are defined */
448 };
449 typedef uint8_t wiced_bt_ble_ext_adv_phy_t;     /**< BLE phy to be used for extended advertisement */
450 
451 /** BLE PHY bit mask */
452 enum
453 {
454     WICED_BT_BLE_EXT_ADV_PHY_1M_BIT         = (1 << 0), /**< Bit mask to specify for LE1M PHY */
455     WICED_BT_BLE_EXT_ADV_PHY_2M_BIT         = (1 << 1), /**< Bit mask to specify for LE2M PHY */
456     WICED_BT_BLE_EXT_ADV_PHY_LE_CODED_BIT   = (1 << 2), /**< Bit mask to specify for LE coded PHY */
457 };
458 typedef uint8_t wiced_bt_ble_ext_adv_phy_mask_t;  /**< BLE phy mask to be used for extended advertisement */
459 
460 /** Advertising event properties: Describes the type of advertising event that is being configured and its basic properties */
461 enum
462 {
463     WICED_BT_BLE_EXT_ADV_EVENT_CONNECTABLE_ADV                       = (1 << 0),   /**< Connectable ADV */
464     WICED_BT_BLE_EXT_ADV_EVENT_SCANNABLE_ADV                         = (1 << 1),   /**< Scannable ADV */
465     WICED_BT_BLE_EXT_ADV_EVENT_DIRECTED_ADV                          = (1 << 2),   /**< Low duty cycle directed advertisement */
466     WICED_BT_BLE_EXT_ADV_EVENT_HIGH_DUTY_DIRECTED_CONNECTABLE_ADV    = (1 << 3),   /**< 3.75 ms Advertising Interval, only valid in legacy ADV */
467     WICED_BT_BLE_EXT_ADV_EVENT_LEGACY_ADV                            = (1 << 4),   /**< Legacy Advertisement. Adv data cannot be more than 31 bytes.*/
468     WICED_BT_BLE_EXT_ADV_EVENT_ANONYMOUS_ADV                         = (1 << 5),   /**< Omits advertisers address from all PDUs */
469     WICED_BT_BLE_EXT_ADV_EVENT_INCLUDE_TX_POWER                      = (1 << 6),   /**< Include Tx power in ext ADV pdus */
470 
471     /** Other bits RFU */
472 };
473 typedef uint16_t wiced_bt_ble_ext_adv_event_property_t;  /**< BLE extended advertisement event property */
474 
475 /** Advertisement set handle to identify adv set b/n host and controller */
476 enum
477 {
478     WICED_BT_BLE_EXT_ADV_HANDLE_MIN = 0x00,     /**< min advertisement set handle value */
479     WICED_BT_BLE_EXT_ADV_HANDLE_MAX = 0xef,     /**< max advertisement set handle value */
480 };
481 
482 typedef uint8_t wiced_bt_ble_ext_adv_handle_t; /**< advertisement set handle value */
483 
484 /** The Advertising set identifier(SID) is used to uniquely identify adv sets from advertiser.
485     SID the value to be transmitted in the advertising SID subfield of the ADI field of the Extended ADV PDUs */
486 enum
487 {
488     WICED_BT_BLE_EXT_ADV_SID_MIN = 0x00,        /**< min SID value */
489     WICED_BT_BLE_EXT_ADV_SID_MAX = 0x0f,        /**< max SID value */
490 };
491 typedef uint8_t wiced_bt_ble_ext_adv_sid_t; /**< SID value */
492 
493 /** Value to configure to receive scan request recived notification */
494 enum wiced_bt_ble_ext_adv_scan_req_notification_setting_e
495 {
496     WICED_BT_BLE_EXT_ADV_SCAN_REQ_NOTIFY_DISABLE = 0x00,    /**< Do not send Notification on scan request */
497     WICED_BT_BLE_EXT_ADV_SCAN_REQ_NOTIFY_ENABLE  = 0x01,    /**< Send Notification on scan request */
498 };
499 /** Enable or disable notification value (see #wiced_bt_ble_ext_adv_scan_req_notification_setting_e) */
500 typedef uint8_t wiced_bt_ble_ext_adv_scan_req_notification_setting_t;
501 
502 /** Advertisement duration configuration for specified adv handle */
503 typedef struct
504 {
505     wiced_bt_ble_ext_adv_handle_t   adv_handle;     /**< advertisement set handle */
506 
507     uint16_t adv_duration; /**< 0 = No advertising duration. Advertising to continue until the Host disables it.
508                                                     0xXXXX = Range: 0x0001 - 0xFFFF (10 ms to 655,350 ms) */
509 
510     uint8_t max_ext_adv_events; /**< 0xXX: Maximum number of extended advertising events the Controller shall
511                                             attempt to send prior to disabling the extended advertising set even if
512                                             the adv_duration parameter has not expired.
513                                             0x00: No maximum number of advertising events */
514 
515 } wiced_bt_ble_ext_adv_duration_config_t;
516 
517 
518 /** Periodic adv property */
519 enum wiced_bt_ble_periodic_adv_prop_e
520 {
521     WICED_BT_BLE_PERIODIC_ADV_PROPERTY_INCLUDE_TX_POWER      = (1 << 6) /**< Speicify Tx power in periodic adv events */
522 };
523 typedef uint16_t wiced_bt_ble_periodic_adv_prop_t;/**< Periodic adv property (see #wiced_bt_ble_periodic_adv_prop_e) */
524 
525 /** Extended scan duplicate filter policy */
526 enum wiced_bt_ble_ext_scan_filter_duplicate_e
527 {
528     WICED_BT_BLE_EXT_SCAN_FILTER_DUPLICATE_DISABLE,                     /**< send all advertisements received from advertisers*/
529     WICED_BT_BLE_EXT_SCAN_FILTER_DUPLICATE_ENABLE,                      /**< duplicate advertisements should not be sent until scan disabled */
530     WICED_BT_BLE_EXT_SCAN_FILTER_DUPLICATE_ENABLE_RESET_ON_SCAN_PERIOD, /**< filter duplicate adv during single scan Duration
531                                                                         (see wiced_bt_ble_ext_scan_enable_t).Period should be non zero on using this option */
532 };
533 
534 typedef uint8_t wiced_bt_ble_ext_scan_filter_duplicate_t; /**< Extended scan duplicate filter policy (see #wiced_bt_ble_ext_scan_filter_duplicate_e) */
535 
536 /** Filter policy used in extended create connection command */
537 enum wiced_bt_ble_ext_filter_policy_e
538 {
539     /* Initiator filter policy enums */
540     WICED_BT_BLE_IGNORE_FILTER_ACCEPT_LIST_FOR_CONNS               = 0,           /**< Filter Accept List is not used to determine which advertiser to connect to.
541                                                                 Peer_Address_Type and Peer_Address shall be used */
542     WICED_BT_BLE_USE_FILTER_ACCEPT_LIST_FOR_CONNS   = 1,           /**< Filter Accept List is used to determine which advertiser to connect to.
543                                                                 Peer_Address_Type and Peer_Address shall be ignored. */
544 };
545 typedef uint8_t wiced_bt_ble_ext_filter_policy_t;/**< Filter policy used. (see #wiced_bt_ble_ext_filter_policy_e) */
546 
547 /** Options used in create periodic sync to periodic adv command */
548 enum wiced_bt_ble_adv_sync_options_e
549 {
550     WICED_BT_BLE_IGNORE_SYNC_TO_PERIODIC_ADV_LIST =
551         0, /**< Use the Advertising_SID, Advertising_Address_Type, and Advertising
552                                                                 Address parameters specified in create sync command to determine
553                                                                 which advertiser to listen to */
554 
555     WICED_BT_BLE_SYNC_TO_PERIODIC_ADV_LIST = 1, /**< Use the Periodic Advertiser List to determine which
556                                                                 advertiser to listen to.*/
557 };
558 /** Options used in create periodic sync to periodic adv command (see #wiced_bt_ble_adv_sync_options_e)*/
559 typedef uint8_t wiced_bt_ble_adv_sync_options_t;
560 
561 /** Mode used in Periodic Advertising Sync Transfer Parameters */
562 enum wiced_bt_ble_periodic_adv_sync_transfer_mode_e
563 {
564     WICED_BT_BLE_IGNORE_PA_SYNC_TRANSFER_EVT, /**< No attempt is made to synchronize to the periodic advertising and no
565                                                                      HCI_LE_Periodic_Advertising_Sync_Transfer_Received event is sent to the Host (default). */
566     WICED_BT_BLE_ENABLE_PA_SYNC_TRANSFER_DISABLE_PA_REPORT_EVT, /**< An HCI_LE_Periodic_Advertising_Sync_Transfer_Received event is
567                                                                       sent to the Host. HCI_LE_Periodic_Advertising_Report events will be disabled. */
568     WICED_BT_BLE_ENABLE_PA_SYNC_TRANSFER_ENABLE_PA_REPORT_EVT, /**< An HCI_LE_Periodic_Advertising_Sync_Transfer_Received event is
569                                                                      sent to the Host. HCI_LE_Periodic_Advertising_Report events will be enabled. */
570 };
571 /** Mode used in create periodic sync to periodic adv command (see #wiced_bt_ble_periodic_adv_sync_transfer_mode_e)*/
572 typedef uint8_t wiced_bt_ble_periodic_adv_sync_transfer_mode_t;
573 
574 /** Extended ADV connection configuration structure */
575 typedef struct
576 {
577     /**< Bit 0 = 1: Scan connectable advertisements on the LE 1M PHY. Connection
578                   parameters for the LE 1M PHY are provided.
579        Bit 1 = 1: Connection parameters for the LE 2M PHY are provided.
580        Bit 2 = 1: Scan connectable advertisements on the LE Coded PHY. Connection
581                   parameters for the LE Coded PHY are provided */
582     wiced_bt_ble_ext_adv_phy_mask_t   initiating_phys;      /**< the PHY(s) bit mask on which the advertising
583                                                             packets should be received on the primary advertising channel and the PHYs
584                                                             for which connection parameters have been specified.*/
585 
586     uint16_t      scan_int[WICED_BT_BLE_EXT_ADV_NUM_PHYS];       /**< Range N: 0x0004 to 0xFFFF.Time = N * 0.625 ms. Time Range: 2.5 ms to 40.959375 s */
587     uint16_t      scan_window[WICED_BT_BLE_EXT_ADV_NUM_PHYS];    /**< Range N: 0x0004 to 0xFFFF.Time = N * 0.625 ms. Time Range: 2.5 ms to 40.959375 s */
588     uint16_t      min_conn_int[WICED_BT_BLE_EXT_ADV_NUM_PHYS];   /**< Range N: 0x0006 to 0x0C80 Time = N * 1.25 ms Time Range: 7.5 ms to 4 s */
589     uint16_t      max_conn_int[WICED_BT_BLE_EXT_ADV_NUM_PHYS];   /**< Range N: 0x0006 to 0x0C80 Time = N * 1.25 ms Time Range: 7.5 ms to 4 s */
590     uint16_t      conn_latency[WICED_BT_BLE_EXT_ADV_NUM_PHYS];   /**< Range N: 0x0000 to 0x01F3 */
591     uint16_t      supervision_to[WICED_BT_BLE_EXT_ADV_NUM_PHYS]; /**< Range N: 0x000A to 0x0C80 Time = N * 10 ms Time Range: 100 ms to 32 s */
592     uint16_t      min_ce_len[WICED_BT_BLE_EXT_ADV_NUM_PHYS];     /**< Range N: 0x0000 � 0xFFFF. Time = N * 0.625 ms */
593     uint16_t      max_ce_len[WICED_BT_BLE_EXT_ADV_NUM_PHYS];     /**< Range N: 0x0000 � 0xFFFF. Time = N * 0.625 ms */
594 
595 } wiced_bt_ble_ext_conn_cfg_t;
596 
597 /** When controller receives succesfully periodic adv event based on create sync to periodic advertiser command,
598     sync handle get generated by controller and reported in periodic sync established event
599     scanner uniquely identifies periodic adv data from adv reports using this handle and advertismenet set id(SID) */
600 enum
601 {
602     PERIODIC_SYNC_HANDLE_MIN = 0,
603     PERIODIC_SYNC_HANDLE_MAX = 0x0EFF,
604 };
605 
606 /** Sync_Handle to be used to identify the periodic advertiser. Range: 0x0000-0x0EFF */
607 typedef uint16_t wiced_bt_ble_periodic_adv_sync_handle_t;
608 
609 #define IS_CONNECTABLE_ADV_REPORT(x) (x & (1 << 0))            /**< adv is connectable */
610 #define IS_SCANNABLE_ADV_REPORT(x) (x & (1 << 1))              /**< adv is scannable */
611 #define IS_DIRECTED_ADV_REPORT(x) (x & (1 << 2))               /**< directed adv */
612 #define IS_SCAN_RSP_ADV_REPORT(x) (x & (1 << 3))               /**< scan response */
613 #define IS_LEGACY_ADV_REPORT(x) (x & (1 << 4))                 /**< legacy adv */
614 #define IS_ADV_REPORT_DATA_STATUS_INCOMPLETE(x) (x & (1 << 5)) /**< adv data incomplete, more data to come */
615 #define IS_ADV_REPORT_DATA_STATUS_TRUNCATED(x) (x & (2 << 5))  /**< Incomplete, data truncated, no more to come */
616 /** Bit mask to identify the type of the adv received in extended adv report. (see #wiced_bt_ble_ext_adv_report_t) event_type filed */
617 typedef uint16_t wiced_bt_ble_adv_report_event_mask_t;
618 
619 /**
620 Extended advertisement report data format
621 
622 Note:When multiple advertising packets are used to complete a single advertising
623 report(i.e. if adv set data received as multipl adv reports), the RSSI and TxPower event parameters
624 shall be set based on the last packet received.*/
625 typedef struct
626 {
627     wiced_bt_ble_adv_report_event_mask_t
628         event_type;                            /**< Type of the adv. (See #wiced_bt_ble_adv_report_event_mask_t) */
629     wiced_bt_ble_address_type_t addr_type;     /**< advertiser address type */
630     wiced_bt_device_address_t bd_addr;         /**< advertiser address */
631     wiced_bt_ble_ext_adv_phy_t prim_phy;       /**< PHY on which extended ADV PDUs received */
632     wiced_bt_ble_ext_adv_phy_t sec_phy;        /**< PHY on which auxilary ADV PDUs received */
633     wiced_bt_ble_ext_adv_sid_t adv_sid;        /**< advertising set identifier */
634     int8_t tx_pwr;                             /**< advertisement transmit power */
635     int8_t rssi;                               /**< advertisement RSSI */
636     uint16_t periodic_adv_int;                 /**< Interval of the periodic advertisements if periodic adv enabled
637                                                                 on the same set. Range: N = 0x0006 to 0xFFFF, Time = N * 1.25 ms */
638     wiced_bt_ble_address_type_t dir_addr_type; /**< Target device address type in case of directed adv report */
639     wiced_bt_device_address_t dir_bdaddr;      /**< Target device address in case of directed adv report */
640     uint8_t data_len;                          /**< adv data length */
641 
642     /* Place holder for adv data */
643     uint8_t ad_data[]; /**< adv data  */
644 } wiced_bt_ble_ext_adv_report_t;
645 
646 /** Min and Max possible number of reports in LE extended adv report event */
647 enum wiced_bt_ble_ext_adv_report_count_e
648 {
649     ADV_REP_EVT_COUNT_MIN = 1,  /**< min number of reports in LE extended adv report event */
650     ADV_REP_EVT_COUNT_MAX = 10, /**< max number of reports in LE extended adv report event */
651 };
652 typedef uint8_t
653     wiced_bt_ble_ext_adv_report_count_t; /**< Min and Max reports (see #wiced_bt_ble_ext_adv_report_count_e)*/
654 
655 /** Advertiser clock accuracy */
656 enum wiced_bt_ble_advertiser_clock_accuracy_e
657 {
658     ADVERTISER_CLK_ACCURACY_500PPM,
659     ADVERTISER_CLK_ACCURACY_250PPM,
660     ADVERTISER_CLK_ACCURACY_150PPM,
661     ADVERTISER_CLK_ACCURACY_100PPM,
662     ADVERTISER_CLK_ACCURACY_75PPM,
663     ADVERTISER_CLK_ACCURACY_50PPM,
664     ADVERTISER_CLK_ACCURACY_30PPM,
665     ADVERTISER_CLK_ACCURACY_20PPM,
666 };
667 typedef uint8_t
668     wiced_bt_ble_advertiser_clock_accuracy_t; /**< Advertiser clock accuracy (see #wiced_bt_ble_advertiser_clock_accuracy_e) */
669 
670 /** Sync extablished to periodic advertiser event data format.
671     (The LE Periodic Advertising Sync Established event indicates that the
672     Controller has received the first periodic advertising packet from an advertiser
673     after the LE_Periodic_Advertising_Create_Sync Command has been sent to
674     the Controller.)
675 */
676 typedef struct
677 {
678     uint8_t status;                                                     /**< HCI status */
679     wiced_bt_ble_periodic_adv_sync_handle_t sync_handle;                /**< sync handle */
680     wiced_bt_ble_ext_adv_sid_t adv_sid;                                 /**< advertisement set identifier */
681     wiced_bt_ble_address_type_t adv_addr_type;                          /**< advertiser address type */
682     wiced_bt_device_address_t adv_addr;                                 /**< advertiser address */
683     wiced_bt_ble_ext_adv_phy_t adv_phy;                                 /**< advertiser phy */
684     uint16_t periodic_adv_int;                                          /**< Periodic adv interval */
685     wiced_bt_ble_advertiser_clock_accuracy_t advertiser_clock_accuracy; /**< advertiser clock accuracy */
686 } wiced_bt_ble_periodic_adv_sync_established_event_data_t;
687 
688 /** Periodic advertising report data format */
689 typedef struct
690 {
691     wiced_bt_ble_periodic_adv_sync_handle_t sync_handle; /**< sync handle */
692     int8_t adv_tx_power; /**< advertisement transmit power Range: -127 to +126 dbm. 127 means tx power is not available */
693     int8_t adv_rssi;  /**< RSSI. range: -127 to +126. 127 means RSSI is not available */
694     uint8_t cte_type; /**< CTE Type */
695     uint8_t data_status; /**< 0 = complete data, 1 = data incomplete more data to come, 2 = data truncated.other RFU */
696     uint8_t data_len;    /**< Range: 0 -248. Other values RFU */
697     uint8_t adv_data[WICED_BT_BLE_MAX_EXT_ADV_DATA_LEN]; /**< periodic adv data */
698 } wiced_bt_ble_periodic_adv_report_event_data_t;
699 
700 /** sync handle and connection handle are same range */
701 typedef wiced_bt_ble_periodic_adv_sync_handle_t wiced_bt_ble_connection_handle_t;
702 
703 /** extended adv set terminated event data format. This event generated asynchronously by the
704     controller when adv set get terminated either adv duration expires or connection being created */
705 typedef struct
706 {
707     uint8_t status;                                                     /**< HCI status */
708     wiced_bt_ble_ext_adv_handle_t adv_handle;                           /**< advertisement set handle */
709     wiced_bt_ble_connection_handle_t conn_handle;                       /**< connection handle. The conn_handle
710                                                         parameter is only valid when advertising ends because a connection was created */
711     uint8_t                             num_completed_ext_adv_events;   /**< number of completed extended advertising events the Controller had
712                                                                         transmitted when either the duration elapsed or the maximum number of
713                                                                         extended advertising events was reached; otherwise it shall be set to zero. */
714 } wiced_bt_ble_ext_adv_set_terminated_event_data_t;
715 
716 /** scan request received event data format */
717 typedef struct
718 {
719     wiced_bt_ble_ext_adv_handle_t   adv_handle;         /**< advertisement set handle */
720     wiced_bt_ble_address_type_t     scanner_addr_type;  /**< Scanner address type */
721     wiced_bt_device_address_t       scanner_address;    /**< Scanner address */
722 } wiced_bt_ble_scan_req_received_event_data_t;
723 
724 /** BLE channel selection algorithms */
725 enum wiced_bt_ble_channel_sel_algo_e
726 {
727     LE_CHANNEL_SEL_ALGO_1_USED,         /**< LE channel selection algorithm#1 used */
728     LE_CHANNEL_SEL_ALGO_2_USED,         /**< LE channel selection algorithm#2 used */
729 };
730 typedef uint8_t wiced_bt_ble_channel_sel_algo_t;/**< LE channel algorithm selection (see #wiced_bt_ble_channel_sel_algo_e) */
731 
732 /** Channel selection algorithm event data format */
733 typedef struct
734 {
735     wiced_bt_ble_connection_handle_t      connection_handle;    /**< HCI connection handle */
736     wiced_bt_ble_channel_sel_algo_t       channel_sel_algo;     /**< BLE channel selection algorithm used for this connection */
737 
738     /* remaining RFU */
739 } wiced_bt_ble_channel_sel_algo_event_data_t;
740 
741 /** BIGInfo report */
742 typedef struct
743 {
744     uint16_t sync_handle; /**< Sync_Handle identifying the periodic advertising train (Range: 0x0000 to 0x0EFF) */
745     uint8_t num_bis;      /**< Value of the Num_BIS subfield of the BIGInfo field */
746     uint8_t number_of_subevents;        /**< Value of the NSE subfield of the BIGInfo field */
747     uint16_t iso_interval;              /**< Value of the ISO_Interval subfield of the BIGInfo field */
748     uint8_t burst_number;               /**< Value of the BN subfield of the BIGInfo field */
749     uint8_t pretransmission_offset;     /**< Value of the PTO subfield of the BIGInfo field */
750     uint8_t immediate_repetition_count; /**< Value of the IRC subfield of the BIGInfo field */
751     uint16_t max_pdu;                /**< Value of the Max_PDU subfield of the BIGInfo field in the Advertising PDU */
752     uint32_t sdu_interval;           /**< Value of the SDU_Interval subfield of the BIGInfo field */
753     uint16_t max_sdu;                /**< Value of the Max_SDU subfield of the BIGInfo field in the Advertising PDU */
754     wiced_bt_isoc_phy_t phy;         /**< The transmitter PHY of packets */
755     wiced_bt_isoc_framing_t framing; /**< Framing parameter */
756     wiced_bt_isoc_encryption_t encryption; /**< BIG carries encrypted or unencrypted data */
757 } wiced_bt_ble_biginfo_adv_report_t;
758 
759 /** Periodic Adv Sync Transfer Received Event Data */
760 typedef struct
761 {
762     wiced_bt_ble_periodic_adv_sync_established_event_data_t sync_data; /**< Periodic Adv Sync Data */
763     wiced_bt_ble_connection_handle_t conn_handle;                      /**< connection handle */
764     uint16_t service_data; /**< Service Data value provided by the peer device */
765 } wiced_bt_ble_periodic_adv_sync_transfer_event_data_t;
766 
767 /* @cond BETA_API
768    beta APIs for Periodic Advertising with Response*/
769 #define WICED_BT_MAX_PAWR_SUBEVENT_DATA_LEN  251
770 
771 /** Periodic Advertising with Response (PAWR) Sync Established Event Data */
772 typedef struct
773 {
774     uint8_t                                 status;                     /**< HCI status */
775     wiced_bt_ble_periodic_adv_sync_handle_t sync_handle;                /**< sync handle */
776     wiced_bt_ble_ext_adv_sid_t              adv_sid;                    /**< advertisement set identifier */
777     wiced_bt_ble_address_type_t             adv_addr_type;              /**< advertiser address type */
778     wiced_bt_device_address_t               adv_addr;                   /**< advertiser address */
779     wiced_bt_ble_ext_adv_phy_t              adv_phy;                    /**< advertiser phy */
780     uint16_t                                periodic_adv_int;           /**< Periodic adv interval */
781     wiced_bt_ble_advertiser_clock_accuracy_t advertiser_clock_accuracy; /**< advertiser clock accuracy */
782     uint8_t                                 num_subevents;              /**< number of subevents */
783     uint8_t                                 subevent_interval;          /**< subevent interval */
784     uint8_t                                 response_slot_delay;        /**< response slot delay */
785     uint8_t                                 response_slot_spacing;      /**< response slot spacing */
786 } wiced_bt_ble_pawr_sync_established_event_data_t;
787 
788 /** Periodic Advertising with Response (PAWR) Subevent Data Request Event Data */
789 typedef struct
790 {
791     wiced_bt_ble_ext_adv_handle_t   adv_handle;                 /**< advertisement set handle */
792     uint8_t                         subevent_start;             /**< first subevent */
793     uint8_t                         subevent_start_count;       /**< number of subevents */
794 } wiced_bt_ble_pawr_subevent_data_req_event_data_t;
795 
796 /** Periodic Advertising with Response (PAWR) Response Report Event Data */
797 typedef struct
798 {
799     uint8_t     adv_handle;
800     uint8_t     subevent;
801     uint8_t     tx_status;
802     uint8_t     tx_power;
803     uint8_t     rssi;
804     uint8_t     cte_type;
805     uint8_t     response_slot;
806     uint8_t     data_status;
807     uint8_t     data_len;
808     uint8_t     data[WICED_BT_MAX_PAWR_SUBEVENT_DATA_LEN];
809 } wiced_bt_ble_pawr_rsp_report_event_data_t;
810 
811 /** Periodic Advertising with Response (PAWR) Indication Report Event Data */
812 typedef struct
813 {
814     wiced_bt_ble_periodic_adv_sync_handle_t sync_handle;                /**< sync handle */
815     uint8_t     tx_power;
816     uint8_t     rssi;
817     uint8_t     cte_type;
818     uint8_t     sub_event;
819     uint8_t     data_status;
820     uint8_t     data_length;                                /**< Length of the subevent indication data  */
821     uint8_t     data[WICED_BT_MAX_PAWR_SUBEVENT_DATA_LEN];  /**< Subevent data  */
822 } wiced_bt_ble_pawr_ind_report_event_data_t;
823 /* @endcond */
824 
825 /** ADV extension events to the application */
826 typedef enum
827 {
828     WICED_BT_BLE_PERIODIC_ADV_SYNC_ESTABLISHED_EVENT,   /**< Sync established to periodic advertiser's periodic advertisement. Event Data : wiced_bt_ble_periodic_adv_sync_established_event_data_t */
829     WICED_BT_BLE_PERIODIC_ADV_REPORT_EVENT,             /**< Periodic adv report. Event Data: wiced_bt_ble_periodic_adv_report_event_data_t */
830     WICED_BT_BLE_PERIODIC_ADV_SYNC_LOST_EVENT,          /**< Periodic sync lost event. Event Data: wiced_bt_ble_periodic_adv_sync_handle_t */
831     WICED_BT_BLE_ADV_SET_TERMINATED_EVENT,              /**< Advertising set terminated becaue either connection being created or adv timeout. Event data: wiced_bt_ble_ext_adv_set_terminated_event_data_t */
832     WICED_BT_BLE_SCAN_REQUEST_RECEIVED_EVENT,           /**< scan request received event. Event data: wiced_bt_ble_scan_req_received_event_data_t */
833     WICED_BT_BLE_CHANNEL_SEL_ALGO_EVENT,                /**< LE Channel selected algorithm event. Event Data: wiced_bt_ble_channel_sel_algo_event_data_t */
834     WICED_BT_BLE_BIGINFO_ADV_REPORT_EVENT,              /**< BIGInfo adv report event. Event Data: wiced_bt_ble_biginfo_adv_report_t */
835     WICED_BT_BLE_PERIODIC_ADV_SYNC_TRANSFER_EVENT,      /**< Periodic Adv Sync Transfer Event. Event Data: wiced_bt_ble_periodic_adv_sync_transfer_event_data_t */
836 	/* @cond BETA_API
837 	beta APIs for Periodic Advertising with Response*/
838     WICED_BT_BLE_PAWR_SYNC_ESTABLISHED_EVENT,           /**< Periodic Adv Sync Transfer Event. Event Data: wiced_bt_ble_pawr_sync_established_event_data_t */
839     WICED_BT_BLE_PAWR_SUBEVENT_DATA_REQ_EVENT,          /**< Periodic Adv Sync Transfer Event. Event Data: wiced_bt_ble_pawr_subevent_data_req_event_data_t */
840     WICED_BT_BLE_PAWR_IND_REPORT_EVENT,                 /**< Periodic Adv Sync Transfer Event. Event Data: wiced_bt_ble_pawr_ind_report_event_data_t */
841     WICED_BT_BLE_PAWR_RSP_REPORT_EVENT                  /**< Periodic Adv Sync Transfer Event. Event Data: wiced_bt_ble_pawr_rsp_report_event_data_t */
842 	/* @endcond */
843 } wiced_bt_ble_adv_ext_event_t;
844 
845 /** union of events data */
846 typedef union
847 {
848     wiced_bt_ble_periodic_adv_sync_established_event_data_t sync_establish;     /**< Data for WICED_BT_BLE_PERIODIC_ADV_SYNC_ESTABLISHED_EVENT*/
849     wiced_bt_ble_periodic_adv_report_event_data_t           periodic_adv_report;/**< Data for WICED_BT_BLE_PERIODIC_ADV_REPORT_EVENT*/
850     wiced_bt_ble_periodic_adv_sync_handle_t                 sync_handle;        /**< Data for WICED_BT_BLE_PERIODIC_ADV_SYNC_LOST_EVENT*/
851     wiced_bt_ble_ext_adv_set_terminated_event_data_t        adv_set_terminated; /**< Data for WICED_BT_BLE_ADV_SET_TERMINATED_EVENT*/
852     wiced_bt_ble_scan_req_received_event_data_t             scan_req_received;  /**< Data for WICED_BT_BLE_SCAN_REQUEST_RECEIVED_EVENT*/
853     wiced_bt_ble_channel_sel_algo_event_data_t              channel_sel_algo;   /**< Data for WICED_BT_BLE_CHANNEL_SEL_ALGO_EVENT*/
854     wiced_bt_ble_biginfo_adv_report_t                       biginfo_adv_report; /**< Data for WICED_BT_BLE_BIGINFO_ADV_REPORT_EVENT*/
855     wiced_bt_ble_periodic_adv_sync_transfer_event_data_t    sync_transfer;      /**< Data for WICED_BT_BLE_PERIODIC_ADV_SYNC_TRANSFER_EVENT */
856 	/* @cond BETA_API
857 	beta APIs for Periodic Advertising with Response*/
858     wiced_bt_ble_pawr_sync_established_event_data_t         pawr_sync;          /**< Data for WICED_BT_BLE_PAWR_SYNC_ESTABLISHED_EVENT*/
859     wiced_bt_ble_pawr_subevent_data_req_event_data_t        pawr_data_req;      /**< Data for WICED_BT_BLE_PAWR_SUBEVENT_DATA_REQ_EVENT*/
860     wiced_bt_ble_pawr_ind_report_event_data_t               pawr_ind_report;    /**< Data for WICED_BT_BLE_PAWR_IND_REPORT_EVENT*/
861     wiced_bt_ble_pawr_rsp_report_event_data_t               pawr_rsp_report;    /**< Data for WICED_BT_BLE_PAWR_RSP_REPORT_EVENT*/
862 	/* @endcond */
863 } wiced_bt_ble_adv_ext_event_data_t;
864 
865 /** Configuration for extended scanning */
866 typedef struct
867 {
868     wiced_bt_ble_ext_adv_phy_mask_t  scanning_phys;      /**< The Scanning_PHYs parameter indicates the PHY(s) on which the advertising
869                                                                 packets should be received on the primary advertising channel.*/
870 
871     uint8_t     enc_phy_scan_type;          /**< encoded phy scan type. (active or passive) */
872     uint16_t    enc_phy_scan_int;           /**< encoded phy scan interval */
873     uint16_t    enc_phy_scan_win;           /**< encoded phy scan window */
874 
875     /** When the Duration and Period parameters are non-zero, the Controller shall
876     scan for the duration of the Duration parameter within a scan period specified
877     by the Period parameter. After the scan period has expired, a new scan period
878     shall begin and scanning shall begin again for the duration specified. The scan
879     periods continue until the Host disables scanning. Duration parameter cannot be greater than or equal to the Period parameter
880     If the Duration parameter is zero or both the Duration parameter and Period parameter are non-zero controller continue
881     scanning until host disable scanning with enable set to false */
882     uint16_t    duration;                   /**< Scan duration */
883     uint16_t    period;                     /**< Scan period */
884 } wiced_bt_ble_ext_scan_config_t;
885 
886 /**
887  * Callback wiced_bt_ble_adv_ext_event_cb_fp_t
888  *
889  * Adv extension command status, command complete event and LE adv extension meta event callback
890  *
891  * @param event             : Event type (see #wiced_bt_ble_adv_ext_event_t)
892  * @param p_data            : Event data (see #wiced_bt_ble_adv_ext_event_data_t)
893  *
894  * @return Nothing
895  */
896 typedef void (*wiced_bt_ble_adv_ext_event_cb_fp_t) (wiced_bt_ble_adv_ext_event_t event, wiced_bt_ble_adv_ext_event_data_t *p_data);
897 
898 /* @cond BETA_API
899    beta APIs for Periodic Advertising with Response*/
900 /** Configuration for Periodic Advertising with Response (PAWR) subevent indication data
901 **  which is sent by the central device at the start of each subevent
902 */
903 typedef struct
904 {
905     uint8_t     subevent_num;               /**< The subevent number */
906     uint8_t     rsp_slot_start;             /**< Response slot start */
907     uint8_t     rsp_slot_count;             /**< Response slot count */
908     uint8_t     ind_data_length;            /**< Length of the subevent indication data  */
909     uint8_t     ind_data[WICED_BT_MAX_PAWR_SUBEVENT_DATA_LEN]; /**< Subevent data  */
910 } wiced_bt_ble_pawr_subevent_ind_data_t;
911 /* @endcond */
912 
913 
914 /******************************************************
915  *               Function Declarations
916  *
917  ******************************************************/
918 #ifdef __cplusplus
919 extern "C" {
920 #endif
921 
922 /**
923  * @addtogroup  btm_ble_adv_scan_functions        Advertisement & Scan
924  * @ingroup     btm_ble_api_functions
925  *
926  * This section provides functions for BLE advertisement and BLE scan operations.
927  *
928  * @{
929  */
930 
931 /**
932  * Start advertising.
933  *
934  * Use #wiced_bt_ble_set_raw_advertisement_data to configure advertising data
935  * prior to starting avertisements. The advertisements are stopped upon successful LE connection establishment.
936  *
937  * @note 1. Steps for undirected ADVs viz., BTM_BLE_ADVERT_UNDIRECTED_HIGH, BTM_BLE_ADVERT_UNDIRECTED_LOW,
938  * and non connectable advs viz., BTM_BLE_ADVERT_NONCONN_HIGH, BTM_BLE_ADVERT_NONCONN_LOW
939  *   a) Set ADV data
940  *   b) Set Scan Response data if adv type is scannable
941  * @note 2. if adv type is set to Directed then the stack resets any advertisement data which has been set for an earlier advertisement. Refer note 1 prior to attempting an undirected advertisement
942  *
943  * The <b>advert_mode</b> parameter determines what advertising parameters and durations
944  * to use (as specified by the application configuration).
945  *
946  * @param[in]       advert_mode                         : advertisement mode
947  * @param[in]       directed_advertisement_bdaddr_type  : BLE_ADDR_PUBLIC or BLE_ADDR_RANDOM (if using directed advertisement mode)
948  * @param[in]       directed_advertisement_bdaddr_ptr   : Directed advertisement address (NULL if not using directed advertisement)
949  *
950  * @return      status
951  *
952  */
953 wiced_result_t wiced_bt_start_advertisements(wiced_bt_ble_advert_mode_t advert_mode, wiced_bt_ble_address_type_t directed_advertisement_bdaddr_type, wiced_bt_device_address_ptr_t directed_advertisement_bdaddr_ptr);
954 
955 /**
956  *
957  * Get current advertising mode
958  *
959  * @return          Current advertising mode (refer #wiced_bt_ble_advert_mode_e)
960  *
961  */
962 wiced_bt_ble_advert_mode_t wiced_bt_ble_get_current_advert_mode(void);
963 
964 /**
965  * Set advertisement raw data to the controller. Application can invoke #wiced_bt_start_advertisements
966  * after setting the adv data. Max length of the advertising data to be set is 31 bytes.
967  * API returns an error if the length of data being set exceeds 31 bytes
968  *
969  * @param[in] num_elem :   number of ADV data element
970  * @param[in] p_data :      advertisement raw data
971  *
972  * @return          wiced_result_t
973  *
974  */
975 wiced_result_t wiced_bt_ble_set_raw_advertisement_data(uint8_t num_elem, wiced_bt_ble_advert_elem_t *p_data);
976 
977 /**
978  * Write advertisement raw data to application buffer.
979  *
980  * @note: This API does not write data to the controller
981  *
982  * @param[in] p_adv : buffer pointer at which the raw data in \p p_type_data is to be written
983  * @param[in] adv_len : length of the buffer pointer pointed to by \p p_adv, should be atleast (2 + \p type_len)
984  *                     for a successful write operation
985  * @param[in] adv_type: adveritsement type
986  * @param[in] p_type_data: advertisement data of \p adv_type
987  * @param[in] type_len : length of advertisement data at \p p_type_data of \p adv_type
988  *
989  * @return  length of the \p p_adv buffer written.
990  *
991  */
992 int wiced_bt_ble_build_raw_advertisement_data(uint8_t *p_adv,
993                                               int adv_len,
994                                               wiced_bt_ble_advert_type_t adv_type,
995                                               uint8_t *p_type_data,
996                                               uint16_t type_len);
997 
998 /**
999  * Parse advertising data (returned from scan results callback #wiced_bt_ble_scan_result_cback_t).
1000  * Look for specified advertisement data type.
1001  *
1002  * @param[in]       p_adv       : pointer to advertisement data
1003  * @param[in]       type        : advertisement data type to look for
1004  * @param[out]      p_length    : length of advertisement data (if found)
1005  *
1006  * @return          pointer to start of requested advertisement data (if found). NULL if requested data type not found.
1007  *
1008  */
1009 uint8_t *wiced_bt_ble_check_advertising_data( uint8_t *p_adv, wiced_bt_ble_advert_type_t type, uint8_t *p_length);
1010 
1011 /**
1012  * When multiple entry for same adv type is available in the adv data this api will help to get next entry of specified advertisement data type
1013  * when there is a single instance use wiced_bt_ble_check_advertising_data
1014  *
1015  * @param[in]       p_adv       : pointer to advertisement data
1016  * @param[in]       p_offset    : offset from the start of the adv data recevied, also returns next offset to start searching from
1017  * @param[in]       type        : advertisement data type to look for
1018  * @param[out]      p_length    : length of advertisement data (if found)
1019  *
1020  * @return          pointer to next requested advertisement data (if found). NULL if requested data type not found.
1021  *
1022  */
1023 uint8_t *wiced_bt_ble_get_next_adv_entry(uint8_t *p_adv,
1024                                          int *p_offset,
1025                                          wiced_bt_ble_advert_type_t type,
1026                                          uint8_t *p_length);
1027     /**
1028  *
1029  * Update the filter policy of advertiser.
1030  *
1031  *  @param[in]      advertising_policy: advertising filter policy
1032  *
1033  *  @return         TRUE if successful
1034  */
1035 wiced_bool_t wiced_btm_ble_update_advertisement_filter_policy(wiced_bt_ble_advert_filter_policy_t advertising_policy);
1036 
1037 /**
1038 *  Command to set LE Advertisement tx power
1039 *
1040 * @param[in]       power          :  power value in db
1041 * @param[in]       p_cb           :  Result callback (wiced_bt_set_adv_tx_power_result_t will be passed to the callback)
1042 *
1043 * @return          wiced_result_t
1044 *                  WICED_BT_PENDING if callback is not NULL.
1045 *                  WICED_BT_SUCCESS if callback is NULL
1046 *
1047 *
1048 **/
1049 wiced_result_t wiced_bt_ble_set_adv_tx_power(int8_t power, wiced_bt_dev_vendor_specific_command_complete_cback_t *p_cb);
1050 
1051 /**
1052 * Read LE Advertisement transmit power
1053 * @note: This API can be used to get Tx power for Legacy advertisements.
1054 *        It will return an error if the application is using Extended Advertisements.
1055 *        See Bluetool Core spec 5.2, Vol 4, Part E, section 3.1.1 Legacy and extended advertising
1056 *
1057 * @param[in]       p_cback         : Result callback (wiced_bt_tx_power_result_t will be passed to the callback)
1058 *
1059 * @return
1060 *
1061 *                  WICED_BT_PENDING if command issued to controller.
1062 *                  WICED_BT_NO_RESOURCES if couldn't allocate memory to issue command
1063 *                  WICED_BT_BUSY if command is already in progress
1064 *                  WICED_BT_ILLEGAL_VALUE if the callback is NULL
1065 */
1066 wiced_result_t wiced_bt_ble_read_adv_tx_power(wiced_bt_dev_cmpl_cback_t *p_cback);
1067 
1068 /**
1069  *
1070  * Set scan response raw data
1071  *
1072  * @param[in] num_elem :   number of scan response data elements
1073  * @param[in] p_data :     scan response raw data
1074  *
1075  * @return          status of the operation
1076  *
1077  */
1078 wiced_bt_dev_status_t wiced_bt_ble_set_raw_scan_response_data(uint8_t num_elem,
1079                                                         wiced_bt_ble_advert_elem_t *p_data);
1080 
1081 /**
1082  *
1083  * This function makes the device start or stop operating in the observer role.
1084  * The observer role device receives advertising events from a broadcast device.
1085  *
1086  * @note This API uses following parameters from the configuration settings \ref wiced_bt_cfg_ble_t.p_ble_scan_cfg, \n
1087  *       \ref wiced_bt_cfg_ble_scan_settings_t.low_duty_scan_interval,\n
1088  *       \ref wiced_bt_cfg_ble_scan_settings_t.low_duty_scan_window, \n
1089  *       \ref wiced_bt_cfg_ble_scan_settings_t.scan_mode, \n
1090  *       \ref wiced_bt_cfg_ble_scan_settings_t.scan_mode
1091  *
1092  *
1093  *
1094  * @param[in] start :               TRUE to start the observer role
1095  * @param[in] duration :            the duration for the observer role
1096  * @param[in] p_scan_result_cback : scan result callback
1097  *
1098  * @return          status of the operation
1099  *
1100  */
1101 wiced_bt_dev_status_t wiced_bt_ble_observe (wiced_bool_t start, uint8_t duration, wiced_bt_ble_scan_result_cback_t *p_scan_result_cback);
1102 
1103 /**
1104  * Start LE scanning
1105  *
1106  * The <b>scan_type</b> parameter determines what scanning parameters and durations
1107  *                  to use (as specified by the application configuration).
1108  *
1109  *                  Scan results are notified using \p p_scan_result_cback
1110  *
1111  * @note This API uses following parameters from the configuration settings of \ref wiced_bt_cfg_ble_t.p_ble_scan_cfg,\n
1112  *       \ref wiced_bt_cfg_ble_scan_settings_t.high_duty_scan_interval,\n
1113  *       \ref wiced_bt_cfg_ble_scan_settings_t.high_duty_scan_window,\n
1114  *       \ref wiced_bt_cfg_ble_scan_settings_t.high_duty_scan_duration,\n
1115  *       \ref wiced_bt_cfg_ble_scan_settings_t.low_duty_scan_interval,\n
1116  *       \ref wiced_bt_cfg_ble_scan_settings_t.low_duty_scan_window,\n
1117  *       \ref wiced_bt_cfg_ble_scan_settings_t.low_duty_scan_duration,\n
1118  *       \ref wiced_bt_cfg_ble_scan_settings_t.scan_mode \n
1119  *
1120  *
1121  * @param[in]       scan_type : BTM_BLE_SCAN_TYPE_NONE, BTM_BLE_SCAN_TYPE_HIGH_DUTY,  BTM_BLE_SCAN_TYPE_LOW_DUTY
1122  * @param[in]       duplicate_filter_enable : TRUE or FALSE to enable or disable  duplicate filtering
1123  *
1124  * @param[in]       p_scan_result_cback : scan result callback
1125  *
1126  * @return          wiced_result_t \n
1127  *
1128  * <b> WICED_BT_PENDING </b>        : if successfully initiated \n
1129  * <b> WICED_BT_BUSY </b>           : if already in progress \n
1130  * <b> WICED_BT_ILLEGAL_VALUE </b>  : if parameter(s) are out of range \n
1131  * <b> WICED_BT_NO_RESOURCES </b>   : if could not allocate resources to start the command \n
1132  * <b> WICED_BT_WRONG_MODE </b>     : if the device is not up.
1133  */
1134 wiced_result_t  wiced_bt_ble_scan (wiced_bt_ble_scan_type_t scan_type, wiced_bool_t duplicate_filter_enable, wiced_bt_ble_scan_result_cback_t *p_scan_result_cback);
1135 
1136 /**
1137  *
1138  * Get current scan state
1139  *
1140  * @return          wiced_bt_ble_scan_type_t \n
1141  *
1142  * <b> BTM_BLE_SCAN_TYPE_NONE </b>         Not scanning \n
1143  * <b> BTM_BLE_SCAN_TYPE_HIGH_DUTY </b>    High duty cycle scan \n
1144  * <b> BTM_BLE_SCAN_TYPE_LOW_DUTY </b>     Low duty cycle scan
1145  */
1146 wiced_bt_ble_scan_type_t wiced_bt_ble_get_current_scan_state(void);
1147 
1148 /**
1149  *
1150  * Update the filter policy of scanning.
1151  *
1152  *  @param[in]      scanner_policy: scanning filter policy
1153  *
1154  *  @return         void
1155  */
1156 void wiced_bt_ble_update_scanner_filter_policy(wiced_bt_ble_scanner_filter_policy_t scanner_policy);
1157 
1158 /**@} btm_ble_adv_scan_functions */
1159 
1160 /**
1161  * @addtogroup  btm_ble_conn_filter_accept_list_functions        Connection and Filter Accept List
1162  * @ingroup     btm_ble_api_functions
1163  *
1164  * This section provides functions for BLE connection related and Filter Accept List operations.
1165  *
1166  * @{
1167  */
1168 
1169 /**
1170  *
1171  * Set BLE background connection procedure type.
1172  *
1173  * @param[in]       conn_type: BTM_BLE_CONN_NONE or BTM_BLE_CONN_AUTO
1174  * @param[in]       p_select_cback: UNUSED
1175  *
1176  * @return          TRUE if background connection set
1177  *
1178  */
1179 wiced_bool_t wiced_bt_ble_set_background_connection_type (wiced_bt_ble_conn_type_t conn_type, void *p_select_cback);
1180 
1181 /**
1182  *
1183  * This function is called to add or remove a device into/from the
1184  * filter list. The background connection procedure is decided by
1185  * the background connection type, it can be auto connection, or none.
1186  *
1187  * @param[in]       add_remove    : TRUE to add; FALSE to remove.
1188  * @param[in]       remote_bda    : device address to add/remove.
1189  * @param[in]       ble_addr_type : Address type.
1190 
1191  * @return          TRUE if successful
1192  *
1193  */
1194 wiced_bool_t wiced_bt_ble_update_background_connection_device(wiced_bool_t add_remove, wiced_bt_device_address_t remote_bda, wiced_bt_ble_address_type_t ble_addr_type);
1195 
1196 /**
1197  * To read LE connection parameters based on connection address received in gatt connection up indication.
1198  *
1199  * @param[in]       remote_bda          : remote device address.
1200  * @param[in]       p_conn_parameters   : Connection Parameters
1201  *
1202  * @return          wiced_result_t \n
1203  *
1204  * <b> WICED_BT_ILLEGAL_VALUE </b> : if p_conn_parameters is NULL. \n
1205  * <b> WICED_BT_UNKNOWN_ADDR </b>  : if device address is bad. \n
1206  * <b> WICED_BT_SUCCESS </b> otherwise.
1207  *
1208  */
1209 wiced_result_t wiced_bt_ble_get_connection_parameters(wiced_bt_device_address_t remote_bda, wiced_bt_ble_conn_params_t *p_conn_parameters);
1210 
1211 /**
1212  *
1213  * Add or remove device from advertising filter Accept List
1214  *
1215  * @param[in]       add: TRUE to add; FALSE to remove
1216  * @param[in]       addr_type: Type of the addr
1217  * @param[in]       remote_bda: remote device address.
1218  *
1219  * @return          wiced_bool_t (<b> WICED_TRUE </b> if successful else <b> WICED_FALSE </b>)
1220  *
1221  */
1222 wiced_bool_t wiced_bt_ble_update_advertising_filter_accept_list(wiced_bool_t add, wiced_bt_ble_address_type_t addr_type, wiced_bt_device_address_t remote_bda);
1223 
1224 /**
1225  *
1226  * Add or remove device from scanner filter Accept List
1227  *
1228  * @param[in]       add: TRUE to add; FALSE to remove
1229  * @param[in]       remote_bda: remote device address.
1230  * @param[in]       addr_type   : remote device address type .
1231  *
1232  * @return          WICED_TRUE if successful else WICED_FALSE
1233  *
1234  */
1235 wiced_bool_t wiced_bt_ble_update_scanner_filter_list(wiced_bool_t add, wiced_bt_device_address_t remote_bda,  wiced_bt_ble_address_type_t addr_type);
1236 
1237 /**
1238  *
1239  * Request clearing filter Accept List in controller side
1240  *
1241  *
1242  * @return          TRUE if request of clear is sent to controller side
1243  *
1244  */
1245 wiced_bool_t wiced_bt_ble_clear_filter_accept_list(void);
1246 
1247 /**
1248  *
1249  * Returns size of Filter Accept List size in controller side
1250  *
1251  *
1252  * @return          size of Filter Accept List in current controller
1253  *
1254  */
1255 uint8_t wiced_bt_ble_get_filter_accept_list_size(void);
1256 
1257 /**@} btm_ble_conn_filter_accept_list_functions */
1258 
1259 /**
1260  * @addtogroup  btm_ble_phy_functions        Phy
1261  * @ingroup     btm_ble_api_functions
1262  *
1263  * This section provides functionality to read and update PHY.
1264  *
1265  * @{
1266  */
1267 
1268 /**
1269  * Host to read the current transmitter PHY and receiver PHY on the connection identified by the remote bdaddr.
1270  * phy results notified using #wiced_bt_ble_read_phy_complete_callback_t callback
1271  *
1272  * @param[in]       remote_bd_addr                   - remote device address
1273  * @param[in]       p_read_phy_complete_callback     - read phy complete callback
1274  *
1275  * @return          wiced_result_t \n
1276  *
1277  * <b> WICED_BT_SUCCESS </b>        : if the request was successfully sent to HCI. \n
1278  * <b> WICED_BT_UNKNOWN_ADDR </b>   : if device address does not correspond to a connected remote device \n
1279  * <b> WICED_BT_ILLEGAL_VALUE </b>  : if p_read_phy_complete_callback is NULL \n
1280  * <b> WICED_BT_NO_RESOURCES </b>   : if could not allocate resources to start the command
1281  *
1282  */
1283 wiced_bt_dev_status_t wiced_bt_ble_read_phy (wiced_bt_device_address_t remote_bd_addr,
1284                         wiced_bt_ble_read_phy_complete_callback_t *p_read_phy_complete_callback);
1285 
1286 /**
1287  * Host to configure default transmitter phy and receiver phy to
1288  * be used for all subsequent connections over the LE transport.
1289  *
1290  *
1291  * @param[in]       phy_preferences      - Phy preferences
1292  *
1293  * Note : remote_bd_addr field of the phy_preferences is ignored.
1294  *
1295  * @return          wiced_result_t
1296  *
1297  * <b> WICED_BT_SUCCESS </b>        : if the request was successfully sent to HCI. \n
1298  * <b> WICED_BT_ILLEGAL_VALUE </b>  : if phy_preferences is NULL \n
1299  * <b> WICED_BT_NO_RESOURCES </b>   : if could not allocate resources to start the command
1300  *
1301  */
1302 wiced_bt_dev_status_t wiced_bt_ble_set_default_phy (wiced_bt_ble_phy_preferences_t *phy_preferences);
1303 
1304 /**
1305  * Host to configure the LE link to 1M or 2M and LE coding to be used
1306  *
1307  * @param[in]       phy_preferences      - Phy preferences
1308  *
1309  * @return          wiced_result_t \n
1310  *
1311  * <b> WICED_BT_SUCCESS </b>        : if the request was successfully sent to HCI. \n
1312  * <b> WICED_BT_ILLEGAL_VALUE </b>  : if phy_preferences is NULL \n
1313  * <b> WICED_BT_UNKNOWN_ADDR </b>   : if device address does not correspond to a connected remote device \n
1314  * <b> WICED_BT_NO_RESOURCES </b>   : if could not allocate resources to start the command
1315  *
1316  */
1317 wiced_result_t wiced_bt_ble_set_phy (wiced_bt_ble_phy_preferences_t *phy_preferences);
1318 
1319 /**
1320  * Set channel classification for the available 40 channels.
1321  *
1322  * Channel n is bad = 0.
1323  * Channel n is unknown = 1.
1324  *
1325  * At least one channel shall be marked as unknown.
1326  *
1327  * @param[in]       ble_channel_map
1328  *
1329  * @return          wiced_result_t \n
1330  *
1331  * <b> WICED_BT_SUCCESS </b>        if successfully initiated \n
1332  * <b> WICED_BT_NO_RESOURCES </b>   if could not allocate resources to start the command
1333  */
1334 wiced_result_t wiced_bt_ble_set_channel_classification(const wiced_bt_ble_chnl_map_t ble_channel_map);
1335 /**@} btm_ble_phy_functions */
1336 
1337 /**
1338  * @addtogroup  btm_ble_multi_adv_functions        MultiAdv
1339  * @ingroup     btm_ble_api_functions
1340  *
1341  * This section describes Multiple Advertisement API, using this interface application can enable more than one advertisement train.
1342  * @note Controller should have support for this feature.
1343  *
1344  * @{
1345  */
1346 
1347 /**
1348  * Start/Stop Mulit advertisements.
1349  * wiced_start_multi_advertisements gives option to start multiple adverstisment instances
1350  * Each of the instances can set different #wiced_set_multi_advertisement_params and #wiced_set_multi_advertisement_data.
1351  * Hence this feature allows the device to advertise to multiple Centrals at the same time like a multiple peripheral device,
1352  * with different advertising data, Random private addresses, tx_power etc.
1353  *
1354  * @param[in]       advertising_enable : MULTI_ADVERT_START  - Advertising is enabled
1355  *                                       MULTI_ADVERT_STOP   - Advertising is disabled
1356  *
1357  * @param[in]       adv_instance       : 1 to MULTI_ADV_MAX_NUM_INSTANCES
1358  *
1359  * @return          wiced_bt_dev_status_t
1360  *
1361  *                  TRUE if command succeeded
1362  */
1363  wiced_bt_dev_status_t wiced_start_multi_advertisements( uint8_t advertising_enable, uint8_t adv_instance );
1364 
1365 /**
1366  * Set multi advertisement data for each adv_instance
1367  *
1368  *
1369  * @param[in]       p_data        : Advertising Data ( Max length 31 bytess)
1370  * @param[in]       data_len      : Advertising Data len ( Max 31 bytes )
1371  * @param[in]       adv_instance  : 1 to MULTI_ADV_MAX_NUM_INSTANCES
1372  *
1373  * @return          wiced_bt_dev_status_t \n
1374  *                  WICED_BT_SUCCESS if command succeeded
1375  */
1376 wiced_bt_dev_status_t wiced_set_multi_advertisement_data( uint8_t * p_data, uint8_t data_len, uint8_t adv_instance );
1377 
1378 /**
1379  * Set multi advertisement params for each adv_instance
1380  *
1381  *
1382  * @param[in]       adv_instance  : 1 to MULTI_ADV_MAX_NUM_INSTANCES
1383  * @param[in]       params        : Advertising params refer #wiced_bt_ble_multi_adv_params_t
1384  *
1385  * @return          wiced_bt_dev_status_t \n
1386  *                  WICED_BT_SUCCESS if command succeeded
1387  */
1388 
1389 wiced_bt_dev_status_t wiced_set_multi_advertisement_params(uint8_t adv_instance, wiced_bt_ble_multi_adv_params_t *params);
1390 
1391 
1392 /**
1393  * Set multi advertisement data for scan response
1394  *
1395  * @param[in]       p_data        : Advertising Data ( Max length 31 bytess)
1396  * @param[in]       data_len      : Advertising Data len ( Max 31 bytes )
1397  * @param[in]       adv_instance  : 1 to MULTI_ADV_MAX_NUM_INSTANCES
1398  *
1399  * @return          wiced_bt_dev_status_t \n
1400  *                  WICED_BT_SUCCESS if command succeeded
1401  */
1402 wiced_bt_dev_status_t wiced_set_multi_advertisement_scan_response_data( uint8_t * p_data, uint8_t data_len, uint8_t adv_instance );
1403 
1404 /**
1405  * Set multi advertisement random address for an instance
1406  *
1407  *
1408  * @param[in]       randomAddr    : own random address
1409  * @param[in]       adv_instance  : 1 to MULTI_ADV_MAX_NUM_INSTANCES
1410  *
1411  * @return          wiced_bt_dev_status_t \n
1412  *                  WICED_BT_SUCCESS if command succeeded
1413  */
1414 wiced_bt_dev_status_t wiced_set_multi_advertisements_random_address( wiced_bt_device_address_t randomAddr, uint8_t adv_instance );
1415 
1416 /**
1417  * Allows the application to register a callback that will be invoked
1418  * just before an ADV packet is about to be sent out and immediately after.
1419  *
1420  * @param[in]       adv_instance                : 1 to MULTI_ADV_MAX_NUM_INSTANCES
1421  * @param[in]       clientCallback              : Pointer to a function that will be invoked in application thread context
1422  *                  with WICED_BT_ADV_NOTIFICATION_READY for before ADV and WICED_BT_ADV_NOTIFICATION_DONE after ADV packet is complete.
1423  * @param[in]       advanceNoticeInMicroSeconds : Number of microseconds before the ADV the notification is to be sent. Will be rounded down to
1424  *                  the nearest 1.25mS. Has to be an even multiple of 625uS.
1425  *
1426  * @return          wiced_bool_t \n
1427  *                  WICED_TRUE if command succeeded
1428  */
1429 wiced_bool_t wiced_bt_notify_multi_advertisement_packet_transmissions( uint8_t adv_instance, void (*clientCallback)( uint32_t ),
1430                                                                        uint32_t advanceNoticeInMicroSeconds );
1431 
1432 /**@} btm_ble_multi_adv_functions */
1433 
1434 /**
1435  * @} btm_ble_api_functions
1436  */
1437 
1438 /**
1439  * @ingroup     btm_ble_sec_api_functions
1440  *
1441  * @{
1442  */
1443 
1444 /**
1445  *
1446  * Grant or deny access.  Used in response to an BTM_SECURITY_REQUEST_EVT event.
1447  *
1448  * @param[in]       bd_addr     : peer device bd address.
1449  * @param[in]       res         : WICED_BT_SUCCESS to grant access;
1450                                   WICED_BT_UNSUPPORTED , if local device does not allow pairing;
1451                                   WICED_BT_REPEATED_ATTEMPTS otherwise
1452  *
1453  * @return          <b> None </b>
1454  *
1455  */
1456 void wiced_bt_ble_security_grant(wiced_bt_device_address_t bd_addr, wiced_bt_dev_status_t res);
1457 
1458 /**
1459  * Sign the data using AES128 CMAC algorith.
1460  *
1461  * @param[in]       bd_addr: target device the data to be signed for.
1462  * @param[in]       p_text: signing data
1463  * @param[in]       len: length of the signing data
1464  * @param[in]       signature: output parameter where data signature is going to be stored
1465  *
1466  * @return          TRUE if signing successful, otherwise FALSE.
1467  *
1468  */
1469 wiced_bool_t wiced_bt_ble_data_signature(wiced_bt_device_address_t bd_addr,
1470                                          uint8_t *p_text,
1471                                          uint16_t len,
1472                                          wiced_dev_ble_signature_t signature);
1473 
1474 /**
1475  * Verify the data signature
1476  *
1477  * @param[in]       bd_addr: target device the data to be signed for.
1478  * @param[in]       p_orig:  original data before signature.
1479  * @param[in]       len: length of the signing data
1480  * @param[in]       counter: counter used when doing data signing
1481  * @param[in]       p_comp: signature to be compared against.
1482  *
1483  * @return          TRUE if signature verified correctly; otherwise FALSE.
1484  *
1485  */
1486 wiced_bool_t wiced_bt_ble_verify_signature(wiced_bt_device_address_t bd_addr,
1487                                            uint8_t *p_orig,
1488                                            uint16_t len,
1489                                            uint32_t counter,
1490                                            uint8_t *p_comp);
1491 
1492 /**
1493  * Get security mode 1 flags and encryption key size for LE peer.
1494  *
1495  * @param[in]       bd_addr         : peer address
1496  * @param[out]      p_le_sec_flags  : security flags (see #wiced_bt_ble_sec_flags_e)
1497  * @param[out]      p_le_key_size   : encryption key size
1498  *
1499  * @return          TRUE if successful
1500  *
1501  */
1502 wiced_bool_t wiced_bt_ble_get_security_state(wiced_bt_device_address_t bd_addr,
1503                                              uint8_t *p_le_sec_flags,
1504                                              uint8_t *p_le_key_size);
1505 
1506 /**
1507  * Updates privacy mode if device is already available in controller resolving list
1508  *
1509  * @param[in]       remote_bda      -remote device address received during connection up
1510  * @param[in]       rem_bda_type    -remote device address type received during connection up
1511  * @param[in]       privacy_mode    - privacy mode (see #wiced_bt_ble_privacy_mode_t)
1512  *
1513  * @return          wiced_bt_dev_status_t \n
1514  * <b> WICED_BT_ILLEGAL_VALUE </b>  : if paramer is wrong \n
1515  * <b> WICED_BT_UNSUPPORTED </b>    : if command not supported \n
1516  * <b> WICED_BT_UNKNOWN_ADDR </b>   : if bd_addr is wrong \n
1517  * <b> WICED_BT_ILLEGAL_ACTION </b> : if device not added to resolving list or peer irk is not valid \n
1518  * <b> WICED_BT_ERROR </b>      : error while processing the command \n
1519  * <b> WICED_BT_SUCCESS</b>     : if command started
1520  *
1521  */
1522 wiced_bt_dev_status_t wiced_bt_ble_set_privacy_mode(wiced_bt_device_address_t remote_bda,
1523                                                     wiced_bt_ble_address_type_t rem_bda_type,
1524                                                     wiced_bt_ble_privacy_mode_t privacy_mode);
1525 
1526 /**
1527  * Get the configured local random device address.
1528  *
1529  * Note : random address depends on below settings in that priority order.
1530  *      1) Global privacy configuration using rpa_refresh_timeout (see #wiced_bt_cfg_settings_t).
1531  *      2) else configured for static random bd_address while downloading using BT_DEVICE_ADDRESS=random build setting.
1532  *
1533  * @param[out]       random_bd_addr     - device random bd address
1534  *
1535  * @return          wiced_bt_dev_status_t
1536  * <b> WICED_BT_SUCCESS </b> : if random address is configured.\n
1537  * <b> WICED_BT_WRONG_MODE </b> : if random address not configured.\n
1538  *
1539  */
1540 wiced_bt_dev_status_t wiced_bt_ble_read_device_random_address(wiced_bt_device_address_t random_bd_addr);
1541 
1542 /**
1543  * Check if the local BT controller supports extended advertising
1544  *
1545  * @return          wiced_bool_t
1546  *
1547  */
1548 wiced_bool_t wiced_bt_ble_is_ext_adv_supported(void);
1549 
1550 /**
1551  * Check if the local BT controller supports periodic advertising
1552  *
1553  * @return          wiced_bool_t
1554  *
1555  */
1556 wiced_bool_t wiced_bt_ble_is_periodic_adv_supported(void);
1557 
1558 /**
1559  * Sends HCI command to set the random address for an adv set
1560  *
1561  * @param[in]       adv_handle  - handle of the advertising set
1562  * @param[in]       random_addr - random address to use for this set
1563  *
1564  * @return          wiced_bt_dev_status_t
1565  *
1566  * <b> WICED_BT_SUCCESS </b>       : If random addr is set successfully\n
1567  * <b> WICED_BT_ILLEGAL_VALUE </b> : If paramer is wrong \n
1568  * <b> WICED_BT_UNSUPPORTED </b>   : If command not supported \n
1569  * <b> WICED_BT_NO_RESOURCES </b>  : If no memory to issue the command \n
1570  * <b> WICED_BT_PENDING </b>       : If command queued to send down \n
1571  *
1572  */
1573 wiced_bt_dev_status_t wiced_bt_ble_set_ext_adv_random_address(wiced_bt_ble_ext_adv_handle_t adv_handle,
1574                                                               wiced_bt_device_address_t random_addr);
1575 
1576 /**
1577  * Sends the HCI command to set the parameters for extended advetisement
1578  *
1579  * @param[in]        adv_handle                  Advertisement set handle
1580  * @param[in]        event_properties            Bit mask to speicify connectable,scannable,low duty,high duty,directed,legacy adv
1581  * @param[in]        primary_adv_int_min         Range: 0x000020 to 0xFFFFFF (20 ms to 10,485.759375 s)
1582  * @param[in]        primary_adv_int_max         Range: 0x000020 to 0xFFFFFF(20 ms to 10,485.759375 s)
1583  * @param[in]        primary_adv_channel_map     BLE advertisement channel map (see #wiced_bt_ble_advert_chnl_map_e)
1584  * @param[in]        own_addr_type               Ignored in case of anonymous adv. See event_properties
1585  * @param[in]        peer_addr_type              Peer address type
1586  * @param[in]        peer_addr                   peer address
1587  * @param[in]        adv_filter_policy           Adv filter policy
1588  * @param[in]        adv_tx_power                -127 to +126. 127 means host has no preference
1589  * @param[in]        primary_adv_phy             Phy used to transmit ADV packets on Primary ADV channels
1590  * @param[in]        secondary_adv_max_skip      Valid only in case of extended ADV. Range 0 to FF.
1591                                                                                          Maximum advertising events controller can skip before sending
1592                                                                                          auxiliary adv packets on the secondary adv channel
1593  * @param[in]        secondary_adv_phy           Phy used to transmit ADV packets on secondary ADV channels. Valid only in case of extended ADV
1594  * @param[in]        adv_sid                     Advertisement set identifier is the value to be transmitted in extended ADV PDUs
1595 
1596  * @param[in]        scan_request_not            scan request received notification enable/disable
1597 
1598  * @return          wiced_bt_dev_status_t
1599  *
1600  * <b> WICED_BT_SUCCESS </b>       : If all extended adv params are set successfully\n
1601  * <b> WICED_BT_ILLEGAL_VALUE </b> : If paramer is wrong \n
1602  * <b> WICED_BT_UNSUPPORTED </b>   : If command not supported \n
1603  * <b> WICED_BT_NO_RESOURCES </b>  : If no memory to issue the command \n
1604  * <b> WICED_BT_PENDING </b>       : If command queued to send down \n
1605  *
1606  */
1607 wiced_bt_dev_status_t wiced_bt_ble_set_ext_adv_parameters(
1608     wiced_bt_ble_ext_adv_handle_t adv_handle,
1609     wiced_bt_ble_ext_adv_event_property_t event_properties,
1610     uint32_t primary_adv_int_min,
1611     uint32_t primary_adv_int_max,
1612     wiced_bt_ble_advert_chnl_map_t primary_adv_channel_map,
1613     wiced_bt_ble_address_type_t own_addr_type,
1614     wiced_bt_ble_address_type_t peer_addr_type,
1615     wiced_bt_device_address_t peer_addr,
1616     wiced_bt_ble_advert_filter_policy_t adv_filter_policy,
1617     int8_t adv_tx_power,
1618     wiced_bt_ble_ext_adv_phy_t primary_adv_phy,
1619     uint8_t secondary_adv_max_skip,
1620     wiced_bt_ble_ext_adv_phy_t secondary_adv_phy,
1621     wiced_bt_ble_ext_adv_sid_t adv_sid,
1622     wiced_bt_ble_ext_adv_scan_req_notification_setting_t scan_request_not);
1623 
1624 /**
1625  * Sends HCI command to write the extended adv data
1626  * @note This API allows sending data formatted with \ref wiced_bt_ble_build_raw_advertisement_data.
1627  * @note This API cannot be used for the advertising handle with the event_properties that doesn't support advertising data;
1628  * viz., WICED_BT_BLE_EXT_ADV_EVENT_DIRECTED_ADV, WICED_BT_BLE_EXT_ADV_EVENT_HIGH_DUTY_DIRECTED_CONNECTABLE_ADV
1629  *
1630  * @param[in]       adv_handle  - handle of the advertising set
1631  * @param[in]       data_len    - length of the adv data to use for this set
1632  * @param[in]       p_data      - pointer to the adv data to use for this set
1633  *
1634  * @return          wiced_bt_dev_status_t
1635  * <b> WICED_BT_SUCCESS </b>       : If all extended adv data set successfully\n
1636  * <b> WICED_BT_ILLEGAL_VALUE </b> : If paramer is wrong \n
1637  * <b> WICED_BT_UNSUPPORTED </b>   : If command not supported \n
1638  * <b> WICED_BT_NO_RESOURCES </b>  : If no memory to issue the command \n
1639  * <b> WICED_BT_PENDING </b>       : If command queued to send down \n
1640  *
1641  */
1642 wiced_bt_dev_status_t wiced_bt_ble_set_ext_adv_data(wiced_bt_ble_ext_adv_handle_t adv_handle,
1643     uint16_t data_len,
1644     uint8_t *p_data);
1645 
1646 /**
1647  * Sends HCI command to write the legacy adv data
1648  * @note This API allows sending data formatted with \ref wiced_bt_ble_build_raw_advertisement_data.
1649  *
1650  * @param[in]       data_len - length of the adv data to use, max size 31 bytes
1651  * @param[in]       p_data   - pointer to the adv data to use
1652  *
1653  * @return          wiced_bt_dev_status_t
1654  * <b> WICED_BT_SUCCESS </b>       : If all extended adv data set successfully\n
1655  * <b> WICED_BT_ILLEGAL_VALUE </b> : If paramer is wrong \n
1656  * <b> WICED_BT_UNSUPPORTED </b>   : If command not supported \n
1657  * <b> WICED_BT_NO_RESOURCES </b>  : If no memory to issue the command \n
1658  * <b> WICED_BT_PENDING </b>       : If command queued to send down \n
1659  *
1660  */
1661 wiced_bt_dev_status_t wiced_bt_ble_set_legacy_adv_data(uint16_t data_len, uint8_t *p_data);
1662 
1663 /**
1664  * Sends HCI command to write the extended scan rsp data
1665  *
1666  * @param[in]       adv_handle  - handle of the advertising set
1667  * @param[in]       data_len    - length of the scan response data to use for this set
1668  * @param[in]       p_data      - pointer to the scan response data to use for this set
1669  *
1670  * @return          wiced_bt_dev_status_t
1671  *
1672  * <b> WICED_BT_SUCCESS </b>       : If all extended scan response data set successfully\n
1673  * <b> WICED_BT_ILLEGAL_VALUE </b> : If paramer is wrong \n
1674  * <b> WICED_BT_UNSUPPORTED </b>   : If command not supported \n
1675  * <b> WICED_BT_NO_RESOURCES </b>  : If no memory to issue the command \n
1676  * <b> WICED_BT_PENDING </b>       : If command queued to send down \n
1677  *
1678  */
1679 wiced_bt_dev_status_t wiced_bt_ble_set_ext_scan_rsp_data(wiced_bt_ble_ext_adv_handle_t adv_handle,
1680                                                          uint16_t data_len,
1681                                                          uint8_t *p_data);
1682 
1683 /**
1684  * Sends the HCI command to start/stop extended advertisements
1685  *
1686  * @param[in]       enable    - true to enable, false to disable
1687  * @param[in]       num_sets  - number of sets to enable, unused if disabling
1688  * @param[in]       p_dur     - pointer to adv handle(s) and duration configuration
1689  *
1690  * @return          wiced_bt_dev_status_t
1691  *
1692  * <b> WICED_BT_ILLEGAL_VALUE </b> : If paramer is wrong \n
1693  * <b> WICED_BT_UNSUPPORTED </b>   : If command not supported \n
1694  * <b> WICED_BT_NO_RESOURCES </b>  : If no memory to issue the command \n
1695  * <b> WICED_BT_SUCCESS </b>       : If successful\n
1696  *
1697  */
1698 wiced_bt_dev_status_t wiced_bt_ble_start_ext_adv(uint8_t enable,
1699                                                  uint8_t num_sets,
1700                                                  wiced_bt_ble_ext_adv_duration_config_t *p_dur);
1701 
1702 /**
1703  * Sends the HCI command to remove an extended advertisement set (which is currently not advertising)
1704  *
1705  * @param[in]       adv_handle    - handle to advertisement set
1706  *
1707  * @return          wiced_bt_dev_status_t
1708  *
1709  * <b> WICED_BT_ILLEGAL_VALUE </b> : If paramer is wrong \n
1710  * <b> WICED_BT_UNSUPPORTED </b>   : If command not supported \n
1711  * <b> WICED_BT_NO_RESOURCES </b>  : If no memory to issue the command \n
1712  * <b> WICED_BT_SUCCESS </b>       : If successful\n
1713  *
1714  */
1715 wiced_bt_dev_status_t wiced_bt_ble_remove_adv_set(wiced_bt_ble_ext_adv_handle_t adv_handle);
1716 
1717 /**
1718  * Sends the HCI command to remove all extended advertisement sets which are currently not advertising
1719  *
1720  * @return          wiced_bt_dev_status_t
1721  *
1722  * <b> WICED_BT_UNSUPPORTED </b>   : If command not supported \n
1723  * <b> WICED_BT_NO_RESOURCES </b>  : If no memory to issue the command \n
1724  * <b> WICED_BT_SUCCESS </b>       : If successfuly\n
1725  *
1726  */
1727 wiced_bt_dev_status_t wiced_bt_ble_clear_adv_sets(void);
1728 
1729 /**
1730  * Read the number of ADV sets supported by the controller.
1731  *
1732  * @return          uint8_t
1733  *
1734  */
1735 uint8_t wiced_bt_ble_read_num_ext_adv_sets(void);
1736 
1737 /**
1738  * Read the maximum ADV data length supported by the controller.
1739  *
1740  * @return          uint16_t
1741  *
1742  */
1743 uint16_t wiced_bt_ble_read_max_ext_adv_data_len(void);
1744 
1745 /**
1746  * Sends the HCI command to set the parameters for periodic advertising
1747  *
1748  * @param[in]       adv_handle            advertisement set handle
1749  * @param[in]       periodic_adv_int_min  Range N: 0x0006 to 0xFFFF, Time = N * 1.25 ms
1750  * @param[in]       periodic_adv_int_max  Range N: 0x0006 to 0xFFFF, Time = N * 1.25 ms
1751  * @param[in]       periodic_adv_properties   periodic adv property indicates which field should be include in periodic adv
1752  *
1753  * @return          wiced_bt_dev_status_t
1754  *
1755  * <b> WICED_BT_ILLEGAL_VALUE </b> : If paramer is wrong \n
1756  * <b> WICED_BT_UNSUPPORTED </b>   : If command not supported \n
1757  * <b> WICED_BT_NO_RESOURCES </b>  : If no memory to issue the command \n
1758  * <b> WICED_BT_SUCCESS </b>       : If successful\n
1759  *
1760  */
1761 wiced_bt_dev_status_t wiced_bt_ble_set_periodic_adv_params(wiced_bt_ble_ext_adv_handle_t adv_handle,
1762                                                            uint16_t periodic_adv_int_min,
1763                                                            uint16_t periodic_adv_int_max,
1764                                                            wiced_bt_ble_periodic_adv_prop_t periodic_adv_properties);
1765 
1766 /**
1767  * Sends the HCI command to write the periodic adv data
1768  *
1769  * @param[in]    adv_handle        advertisement set handle
1770  * @param[in]    adv_data_length   periodic data length
1771  * @param[in]    p_adv_data        pointer to the periodic data
1772  *
1773  * @return          wiced_bt_dev_status_t
1774  * <b> WICED_BT_ILLEGAL_VALUE </b> : If paramer is wrong \n
1775  * <b> WICED_BT_UNSUPPORTED </b>   : If command not supported \n
1776  * <b> WICED_BT_NO_RESOURCES </b>  : If no memory to issue the command \n
1777  * <b> WICED_BT_SUCCESS </b>       : If successful\n
1778  *
1779  */
1780 wiced_bt_dev_status_t wiced_bt_ble_set_periodic_adv_data(wiced_bt_ble_ext_adv_handle_t adv_handle,
1781                                                          uint16_t adv_data_length,
1782                                                          uint8_t *p_adv_data);
1783 
1784 /**
1785  * Sends the HCI command to start/stop periodic advertisements
1786 
1787  * @param[in]       adv_handle  - handle of the advertising set
1788  * @param[in]       enable      - true to enable, false to disable
1789  *
1790  * @return          wiced_bt_dev_status_t
1791  * <b> WICED_BT_ILLEGAL_VALUE </b> : If paramer is wrong \n
1792  * <b> WICED_BT_UNSUPPORTED </b>   : If command not supported \n
1793  * <b> WICED_BT_NO_RESOURCES </b>  : If no memory to issue the command \n
1794  * <b> WICED_BT_SUCCESS </b>       : If successful\n
1795  *
1796  */
1797 wiced_bt_dev_status_t wiced_bt_ble_start_periodic_adv(wiced_bt_ble_ext_adv_handle_t adv_handle, wiced_bool_t enable);
1798 
1799 /**
1800  * Stores extended scan configuration to apply on start ext scan
1801  *
1802  * @param[in]       p_ext_scan_cfg    - pointer to scan configuration
1803  *
1804  * @return          wiced_bt_dev_status_t
1805  *
1806  * <b> WICED_BT_ILLEGAL_VALUE </b> : If paramer is wrong \n
1807  * <b> WICED_BT_UNSUPPORTED </b>   : If command not supported \n
1808  * <b> WICED_BT_NO_RESOURCES </b>  : If no memory to issue the command \n
1809  * <b> WICED_BT_SUCCESS </b>       : If successful\n
1810  *
1811  */
1812 wiced_bt_dev_status_t wiced_bt_ble_cache_ext_scan_config(wiced_bt_ble_ext_scan_config_t *p_ext_scan_cfg);
1813 
1814 /**
1815  * Stores the extended ADV connection configuration.
1816  *
1817  * @param[in]       p_ext_conn_cfg    - pointer to connection configuration
1818  *
1819  * @return          wiced_bt_dev_status_t
1820  *
1821  * <b> WICED_BT_ILLEGAL_VALUE </b> : If paramer is wrong \n
1822  * <b> WICED_BT_UNSUPPORTED </b>   : If command not supported \n
1823  * <b> WICED_BT_NO_RESOURCES </b>  : If no memory to issue the command \n
1824  * <b> WICED_BT_SUCCESS </b>       : If successful\n
1825  *
1826  */
1827 wiced_bt_dev_status_t wiced_bt_ble_cache_ext_conn_config(wiced_bt_ble_ext_conn_cfg_t *p_ext_conn_cfg);
1828 
1829 /**
1830  * Sends the HCI command to synchronize with periodic advertising from an advertiser and begin receiving periodic
1831  * advertising packets.
1832  *
1833  * @param[in]       options         - ref: wiced_bt_ble_adv_sync_options_t
1834  * @param[in]       adv_sid         - min SID / max SID
1835  * @param[in]       adv_addr_type   - address type
1836  * @param[in]       adv_addr        - address value
1837  * @param[in]       skip
1838  * @param[in]       sync_timeout    - timeout value
1839  * @param[in]       sync_cte_type   - bit 0 - Do not sync to packets with an AoA Constant Tone Extension
1840  *                                        1 - Do not sync to packets with an AoD Constant Tone Extension with 1 μs slots
1841  *                                        2 - Do not sync to packets with an AoD Constant Tone Extension with 2 μs slots
1842  *                                        3 - Do not sync to packets with a type 3 Constant Tone Extension
1843  *
1844  * @return          wiced_bt_dev_status_t
1845  * <b> WICED_BT_ILLEGAL_VALUE </b> : If paramer is wrong \n
1846  * <b> WICED_BT_UNSUPPORTED </b>   : If command not supported \n
1847  * <b> WICED_BT_NO_RESOURCES </b>  : If no memory to issue the command \n
1848  * <b> WICED_BT_SUCCESS </b>       : If successful\n
1849  *
1850  */
1851 wiced_bt_dev_status_t wiced_bt_ble_create_sync_to_periodic_adv(wiced_bt_ble_adv_sync_options_t options,
1852                                                                wiced_bt_ble_ext_adv_sid_t adv_sid,
1853                                                                wiced_bt_ble_address_type_t adv_addr_type,
1854                                                                wiced_bt_device_address_t adv_addr,
1855                                                                uint16_t skip,
1856                                                                uint16_t sync_timeout,
1857                                                                uint8_t sync_cte_type);
1858 
1859 /**
1860  * Sends HCI command to cancel the create sync command while it is pending.
1861  *
1862  *
1863  * @return          wiced_bt_dev_status_t
1864  * <b> WICED_BT_UNSUPPORTED </b>   : If command not supported \n
1865  * <b> WICED_BT_NO_RESOURCES </b>  : If no memory to issue the command \n
1866  * <b> WICED_BT_SUCCESS </b>       : If successful\n
1867  *
1868  */
1869 wiced_bt_dev_status_t wiced_bt_ble_cancel_sync_to_periodic_adv(void);
1870 
1871 /**
1872  * Sends the HCI command to stop reception of periodic advertising identified by the sync_handle
1873  *
1874  * @param[in]       sync_handle      - Sync handle received in WICED_BT_BLE_PERIODIC_ADV_SYNC_ESTABLISHED_EVENT.
1875  *
1876  * @return          wiced_bt_dev_status_t
1877  *
1878  * <b> WICED_BT_UNSUPPORTED </b>   : If command not supported \n
1879  * <b> WICED_BT_NO_RESOURCES </b>  : If no memory to issue the command \n
1880  * <b> WICED_BT_PENDING </b>       : If command queued to send down \n
1881  * <b> WICED_BT_SUCCESS </b>       : If successful \n
1882  *
1883  */
1884 wiced_bt_dev_status_t wiced_bt_ble_terminate_sync_to_periodic_adv(uint16_t sync_handle);
1885 
1886 /**
1887  * Sends the HCI command to add the given advertiser to Periodic Advertiser list.
1888  *
1889  * Note : Caller shall not attempt to add more than max list size
1890  *       Shall not attempt to call this API, while create to periodic sync command is pending.
1891  *
1892  * @param[in]      advertiser_addr_type : Periodic advertiser addr type
1893  * @param[in]      advetiser_addr       : Periodic advertiser addr
1894  * @param[in]      adv_sid              : Periodic advertiser sid
1895  *
1896  * @return          wiced_bt_dev_status_t
1897  * <b> WICED_BT_ILLEGAL_VALUE </b> : If paramer is wrong \n
1898  * <b> WICED_BT_UNSUPPORTED </b>   : If command not supported \n
1899  * <b> WICED_BT_NO_RESOURCES </b>  : If no memory to issue the command \n
1900  * <b> WICED_BT_PENDING </b>       : If command queued to send down \n
1901  * <b> WICED_BT_SUCCESS </b>       : If successful\n
1902  *
1903  */
1904 wiced_bt_dev_status_t wiced_bt_ble_add_device_to_periodic_adv_list(wiced_bt_ble_address_type_t advertiser_addr_type,
1905                                                                    wiced_bt_device_address_t advetiser_addr,
1906                                                                    wiced_bt_ble_ext_adv_sid_t adv_sid);
1907 
1908 /**
1909  * Sends the HCI command to remove the given advertiser from Periodic Advertiser list.
1910  *
1911  * Note : Shall not attempt to call this API, while create to periodic sync command is pending.
1912  *
1913  * @param[in]      advertiser_addr_type : Periodic advertiser addr type
1914  * @param[in]      advetiser_addr       : Periodic advertiser addr
1915  * @param[in]      adv_sid              : Periodic advertiser sid
1916  *
1917  * @return          wiced_bt_dev_status_t
1918  * <b> WICED_BT_ILLEGAL_VALUE </b> : If paramer is wrong \n
1919  * <b> WICED_BT_UNSUPPORTED </b>   : If command not supported \n
1920  * <b> WICED_BT_NO_RESOURCES </b>  : If no memory to issue the command \n
1921  * <b> WICED_BT_PENDING </b>       : If command queued to send down \n
1922  * <b> WICED_BT_SUCCESS </b>       : If successful\n
1923  *
1924  */
1925 wiced_bt_dev_status_t wiced_bt_ble_remove_device_from_periodic_adv_list(
1926     wiced_bt_ble_address_type_t advertiser_addr_type,
1927     wiced_bt_device_address_t advetiser_addr,
1928     wiced_bt_ble_ext_adv_sid_t adv_sid);
1929 
1930 /**
1931  * Sends the HCI command to remove to remove all devices from the the Periodic Advertisers list.
1932  *
1933  * Note : Shall not attempt to call this API, while create to periodic sync command is pending.
1934  *
1935  * @return          wiced_bt_dev_status_t
1936  * <b> WICED_BT_UNSUPPORTED </b>   : If command not supported \n
1937  * <b> WICED_BT_NO_RESOURCES </b>  : If no memory to issue the command \n
1938  * <b> WICED_BT_PENDING </b>       : If command queued to send down \n
1939  * <b> WICED_BT_SUCCESS </b>       : If successful\n
1940  *
1941  */
1942 wiced_bt_dev_status_t wiced_bt_ble_clear_periodic_adv_list(void);
1943 
1944 /**
1945  * Read the Periodic Advertisers list size.
1946  *
1947  * @return          uint8_t : list size
1948  *
1949  */
1950 uint8_t wiced_bt_ble_read_periodic_adv_list_size(void);
1951 
1952 /**
1953  * Register an application callback function to receive extended advertising events.
1954  *
1955  * @param[in]       p_app_adv_ext_event_cb      - pointer to function to receive extended adv events.
1956  *
1957  * @return          wiced_bt_dev_status_t
1958  * <b> WICED_BT_UNSUPPORTED </b>   : If command not supported \n
1959  * <b> WICED_BT_NO_RESOURCES </b>  : If no memory to issue the command \n
1960  * <b> WICED_BT_PENDING </b>       : If command queued to send down \n
1961  * <b> WICED_BT_SUCCESS </b>       : If successful\n
1962  *
1963  */
1964 void wiced_bt_ble_register_adv_ext_cback(wiced_bt_ble_adv_ext_event_cb_fp_t p_app_adv_ext_event_cb);
1965 
1966 /**
1967  * Sends the HCI command enable or disable receiving periodic ADV data for a sync handle.
1968  *
1969  * @param[in]       sync_handle : Sync handle
1970  * @param[in]       enable      : Boolean for enable/disable.
1971  *
1972  * @return          wiced_bt_dev_status_t
1973  * <b> WICED_BT_UNSUPPORTED </b>   : If command not supported \n
1974  * <b> WICED_BT_NO_RESOURCES </b>  : If no memory to issue the command \n
1975  * <b> WICED_BT_SUCCESS </b>       : If command queued to send down \n
1976  *
1977  */
1978 wiced_bt_dev_status_t wiced_bt_ble_set_periodic_adv_rcv_enable(wiced_bt_ble_periodic_adv_sync_handle_t sync_handle, wiced_bool_t enable);
1979 
1980 /**
1981  * Sends the HCI command to send synchronization information about the periodic advertising train identified by the Sync_Handle parameter to given device
1982  *
1983  * @param[in]       peer_bda        - Peer Bluetooth Address
1984  * @param[in]       service_data    - Service Data value
1985  * @param[in]       sync_handle : Sync handle
1986  *
1987  * @return          wiced_bt_dev_status_t
1988  * <b> WICED_BT_UNKNOWN_ADDR </b> :  If Unknown remote BD address \n
1989  * <b> WICED_BT_NO_RESOURCES </b>  : If no memory to issue the command \n
1990  * <b> WICED_BT_SUCCESS </b>       : If command queued to send down \n
1991  *
1992  */
1993 wiced_bt_dev_status_t wiced_bt_ble_periodic_adv_sync_transfer(wiced_bt_device_address_t peer_bda,
1994                                                               uint16_t service_data,
1995                                                               wiced_bt_ble_periodic_adv_sync_handle_t sync_handle);
1996 
1997 /**
1998  * Sends the HCI command  to send synchronization information about the periodic advertising in an advertising set to given device.
1999  *
2000  * @param[in]       peer_bda        - Peer Bluetooth Address
2001  * @param[in]       service_data    - Service Data value
2002  * @param[in]       adv_handle  - handle of the advertising set
2003  *
2004  * @return          wiced_bt_dev_status_t
2005  * <b> WICED_BT_UNKNOWN_ADDR </b> :  If Unknown remote BD address \n
2006  * <b> WICED_BT_NO_RESOURCES </b>  : If no memory to issue the command \n
2007  * <b> WICED_BT_SUCCESS </b>       : If command queued to send down \n
2008  *
2009  */
2010 wiced_bt_dev_status_t wiced_bt_ble_periodic_adv_set_info_transfer(wiced_bt_device_address_t peer_bda,
2011                                                                   uint16_t service_data,
2012                                                                   wiced_bt_ble_ext_adv_handle_t adv_handle);
2013 
2014 /**
2015  * Sends the HCI command to set synchronize periodic transfer parameter
2016  *
2017  * @param[in]       peer_bda        - Peer Bluetooth Address
2018  * @param[in]       mode            - ref: wiced_bt_ble_periodic_adv_sync_transfer_mode_t
2019  * @param[in]       skip            -  The number of periodic advertising packets that can be skipped after a successful receive
2020  * @param[in]       sync_timeout    - timeout value
2021  * @param[in]       sync_cte_type   - bit 0 - Do not sync to packets with an AoA Constant Tone Extension
2022  *                                        1 - Do not sync to packets with an AoD Constant Tone Extension with 1 μs slots
2023  *                                        2 - Do not sync to packets with an AoD Constant Tone Extension with 2 μs slots
2024  *                                        3 - Do not sync to packets with a type 3 Constant Tone Extension
2025  *
2026  * @return          wiced_bt_dev_status_t
2027  * <b> WICED_BT_UNKNOWN_ADDR </b> :  If Unknown remote BD address \n
2028  * <b> WICED_BT_NO_RESOURCES </b>  : If no memory to issue the command \n
2029  * <b> WICED_BT_SUCCESS </b>       : If successful\n
2030  *
2031  */
2032 wiced_bt_dev_status_t wiced_bt_ble_set_periodic_adv_sync_transfer_param(
2033     wiced_bt_device_address_t peer_bda,
2034     wiced_bt_ble_periodic_adv_sync_transfer_mode_t mode,
2035     uint16_t skip,
2036     uint16_t sync_timeout,
2037     uint8_t sync_cte_type);
2038 
2039 /**
2040  * Sends the HCI command to set Default synchronize periodic transfer parameter
2041  *
2042  * @param[in]       mode         - ref: wiced_bt_ble_periodic_adv_sync_transfer_mode_t
2043  * @param[in]       skip            -  The number of periodic advertising packets that can be skipped after a successful receive
2044  * @param[in]       sync_timeout    - timeout value
2045  * @param[in]       sync_cte_type   - bit 0 - Do not sync to packets with an AoA Constant Tone Extension
2046  *                                        1 - Do not sync to packets with an AoD Constant Tone Extension with 1 μs slots
2047  *                                        2 - Do not sync to packets with an AoD Constant Tone Extension with 2 μs slots
2048  *                                        3 - Do not sync to packets with a type 3 Constant Tone Extension
2049  *
2050  * @return          wiced_bt_dev_status_t
2051  * <b> WICED_BT_NO_RESOURCES </b>  : If no memory to issue the command \n
2052  * <b> WICED_BT_SUCCESS </b>       : If successful\n
2053  *
2054  */
2055 wiced_bt_dev_status_t wiced_bt_ble_set_default_periodic_adv_sync_transfer_param(
2056     wiced_bt_ble_periodic_adv_sync_transfer_mode_t mode,
2057     uint16_t skip,
2058     uint16_t sync_timeout,
2059     uint8_t sync_cte_type);
2060 
2061 
2062 /**
2063  * Function         wiced_ble_private_device_address_resolution
2064  *
2065  *                  This API verifies whether given device address is Resolvable Private Address or not
2066  *
2067  * @param rpa       BLE Resolvable Private Address
2068  * @param irk       BLE IRK
2069  * @return          wiced_result_t
2070  *                  WICED_BT_SUCCESS the identity of device address has been resolved.
2071  *                  WICED_BT_ERROR   otherwise.
2072  */
2073 wiced_result_t wiced_ble_private_device_address_resolution(wiced_bt_device_address_t rpa, BT_OCTET16 irk);
2074 
2075 /**
2076  * Function         wiced_bt_ble_read_le_features
2077  *
2078  *                  This API returns the features supported by the \p bda
2079  *
2080  * @param[in]  bda       Device address pointer, pass NULL for local device
2081  * @param[out] features  Pointer to store the supported features
2082  * @return          wiced_result_t
2083  *                  WICED_BT_SUCCESS contents of features are valid
2084  *                  WICED_BT_ERROR   otherwise.
2085  */
2086 wiced_result_t wiced_bt_ble_read_le_features(wiced_bt_device_address_t bda, wiced_bt_features_t features);
2087 
2088 /**
2089  * Function         wiced_bt_ble_address_resolution_list_clear_and_disable
2090  *
2091  *                  This API clears the address resolution list and disables the address resolution feature.
2092  *
2093  * @return          wiced_result_t
2094  *                  WICED_BT_SUCCESS if address resolution list is cleared and adress resolution feature is disabled.
2095  *                  WICED_BT_ERROR   otherwise.
2096  */
2097 wiced_result_t wiced_bt_ble_address_resolution_list_clear_and_disable(void);
2098 
2099 /* @cond BETA_API
2100    beta APIs for Periodic Advertising with Response*/
2101 /**
2102 * Function         wiced_bt_ble_set_pawr_params
2103 *
2104 *                  This API is called on a central to set the PAWR parameters
2105 *
2106 * @param[in]  adv_handle    Handle of the Advertising Set
2107 * @param[out] features  Pointer to store the supported features
2108 * @return          wiced_result_t
2109 *                  WICED_BT_SUCCESS contents of features are valid
2110 *                  WICED_BT_ERROR   otherwise.
2111 */
2112 wiced_bt_dev_status_t wiced_bt_ble_set_pawr_params (wiced_bt_ble_ext_adv_handle_t adv_handle,
2113                             uint16_t                         periodic_adv_int_min,
2114                             uint16_t                         periodic_adv_int_max,
2115                             wiced_bt_ble_periodic_adv_prop_t periodic_adv_properties,
2116                             uint8_t                          num_subevents,
2117                             uint8_t                          subevent_interval,
2118                             uint8_t                          response_slot_delay,
2119                             uint8_t                          response_slot_spacing,
2120                             uint8_t                          num_response_slots);
2121 
2122 /**
2123 * Function         wiced_bt_ble_set_pawr_subevent_ind_data
2124 *
2125 *                  This API is called on a peripheral to set the subevent indication data
2126 *
2127 * @param[in]  adv_handle    Handle of the Advertising Set
2128 * @param[out] features  Pointer to store the supported features
2129 * @return          wiced_result_t
2130 *                  WICED_BT_SUCCESS contents of features are valid
2131 *                  WICED_BT_ERROR   otherwise.
2132 */
2133 wiced_bt_dev_status_t wiced_bt_ble_set_pawr_subevent_ind_data (wiced_bt_ble_ext_adv_handle_t adv_handle,
2134     int  num_subevents, wiced_bt_ble_pawr_subevent_ind_data_t *p_se_data);
2135 
2136 
2137 /**
2138 * Function         wiced_bt_ble_set_pawr_subevent_rsp_data
2139 *
2140 *                  This API is called on a peripheral to set the subevent response data
2141 *
2142 * @param[in]  sync_handle    Handle of the synchronized advertising train
2143 * @param[out] features  Pointer to store the supported features
2144 * @return          wiced_result_t
2145 *                  WICED_BT_SUCCESS contents of features are valid
2146 *                  WICED_BT_ERROR   otherwise.
2147 */
2148 wiced_bt_dev_status_t wiced_bt_ble_set_pawr_subevent_rsp_data (uint16_t sync_handle,
2149     uint8_t subevent_num, uint8_t rsp_slot, uint8_t rsp_data_len, uint8_t *p_data);
2150 
2151 
2152 /**
2153 * Function         wiced_bt_ble_pawr_sync_subevents
2154 *
2155 *                  This API is called on a peripheral to set the PAWR sunevents
2156 *                  that it wants to sync to.
2157 *
2158 * @param[in]  sync_handle     Handle of the synchronized periodic ADV train
2159 * @param[in]  properties      Properties of the synchronized periodic ADV train
2160 * @param[in]  num_subevents   Number of subevents
2161 * @param[in]  p_subevents     Pointer to an array of subevents
2162 *
2163 * @return          wiced_result_t
2164 *                  WICED_BT_SUCCESS contents of features are valid
2165 *                  WICED_BT_ERROR   otherwise.
2166 */
2167 wiced_bt_dev_status_t wiced_bt_ble_set_pawr_sync_subevents (uint16_t sync_handle, uint16_t properties,
2168                                 int num_subevents, uint8_t *p_subevents);
2169 
2170 /* @endcond */
2171 
2172 /**@} btm_ble_api_functions */
2173 
2174 #ifdef __cplusplus
2175 }
2176 #endif
2177