• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  *  Copyright (C) 1999-2012 Broadcom Corporation
4  *
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at:
8  *
9  *  http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  ******************************************************************************/
18 
19 /******************************************************************************
20  *
21  *  This file contains the Bluetooth Manager (BTM) API function external
22  *  definitions.
23  *
24  ******************************************************************************/
25 #ifndef BTM_BLE_API_H
26 #define BTM_BLE_API_H
27 
28 #include "btm_api.h"
29 #include "gki.h"
30 
31 #define CHNL_MAP_LEN    5
32 typedef UINT8 tBTM_BLE_CHNL_MAP[CHNL_MAP_LEN];
33 
34 /* 0x00-0x04 only used for set advertising parameter command */
35 #define BTM_BLE_CONNECT_EVT     0x00   /* 0x00-0x04 only used for set advertising
36                                             parameter command */
37 #define BTM_BLE_CONNECT_DIR_EVT 0x01   /* Connectable directed advertising */
38 #define BTM_BLE_DISCOVER_EVT    0x02  /* Scannable undirected advertising */
39 #define BTM_BLE_NON_CONNECT_EVT 0x03  /* Non connectable undirected advertising */
40 #define BTM_BLE_CONNECT_LO_DUTY_DIR_EVT 0x04        /* Connectable low duty
41                                                        cycle directed advertising  */
42     /* 0x00 - 0x05 can be received on adv event type */
43 #define BTM_BLE_SCAN_RSP_EVT    0x04
44 #define BTM_BLE_SCAN_REQ_EVT    0x05
45 #define BTM_BLE_UNKNOWN_EVT     0xff
46 
47 #define BTM_BLE_UNKNOWN_EVT     0xff
48 
49 typedef UINT32 tBTM_BLE_REF_VALUE;
50 
51 #define BTM_BLE_SCAN_MODE_PASS      0
52 #define BTM_BLE_SCAN_MODE_ACTI      1
53 #define BTM_BLE_SCAN_MODE_NONE      0xff
54 typedef UINT8 tBTM_BLE_SCAN_MODE;
55 
56 #define BTM_BLE_BATCH_SCAN_MODE_DISABLE 0
57 #define BTM_BLE_BATCH_SCAN_MODE_PASS  1
58 #define BTM_BLE_BATCH_SCAN_MODE_ACTI  2
59 #define BTM_BLE_BATCH_SCAN_MODE_PASS_ACTI 3
60 
61 typedef UINT8 tBTM_BLE_BATCH_SCAN_MODE;
62 
63 /* advertising channel map */
64 #define BTM_BLE_ADV_CHNL_37    (0x01 << 0)
65 #define BTM_BLE_ADV_CHNL_38    (0x01 << 1)
66 #define BTM_BLE_ADV_CHNL_39    (0x01 << 2)
67 typedef UINT8 tBTM_BLE_ADV_CHNL_MAP;
68 
69 /*d efault advertising channel map */
70 #ifndef BTM_BLE_DEFAULT_ADV_CHNL_MAP
71 #define BTM_BLE_DEFAULT_ADV_CHNL_MAP   (BTM_BLE_ADV_CHNL_37| BTM_BLE_ADV_CHNL_38| BTM_BLE_ADV_CHNL_39)
72 #endif
73 
74 /* advertising filter policy */
75 #define AP_SCAN_CONN_ALL           0x00        /* default */
76 #define AP_SCAN_WL_CONN_ALL        0x01
77 #define AP_SCAN_ALL_CONN_WL        0x02
78 #define AP_SCAN_CONN_WL            0x03
79 #define AP_SCAN_CONN_POLICY_MAX    0x04
80 typedef UINT8   tBTM_BLE_AFP;
81 
82 /* default advertising filter policy */
83 #ifndef BTM_BLE_DEFAULT_AFP
84 #define BTM_BLE_DEFAULT_AFP   AP_SCAN_CONN_ALL
85 #endif
86 
87 /* scanning filter policy */
88 #define SP_ADV_ALL     0x00     /* accept adv pakt from all, directed adv pkt not directed to me is ignored */
89 #define SP_ADV_WL      0x01     /* accept adv pakt from device in white list, directed adv pkt not directed to me is ignored */
90 typedef UINT8   tBTM_BLE_SFP;
91 
92 #ifndef BTM_BLE_DEFAULT_SFP
93 #define BTM_BLE_DEFAULT_SFP   SP_ADV_ALL
94 #endif
95 
96 /* adv parameter boundary values */
97 #define BTM_BLE_ADV_INT_MIN            0x0020
98 #define BTM_BLE_ADV_INT_MAX            0x4000
99 
100 /* Full scan boundary values */
101 #define BTM_BLE_ADV_SCAN_FULL_MIN      0x00
102 #define BTM_BLE_ADV_SCAN_FULL_MAX      0x64
103 
104 /* Partial scan boundary values */
105 #define BTM_BLE_ADV_SCAN_TRUNC_MIN      BTM_BLE_ADV_SCAN_FULL_MIN
106 #define BTM_BLE_ADV_SCAN_TRUNC_MAX      BTM_BLE_ADV_SCAN_FULL_MAX
107 
108 /* Threshold values */
109 #define BTM_BLE_ADV_SCAN_THR_MIN        BTM_BLE_ADV_SCAN_FULL_MIN
110 #define BTM_BLE_ADV_SCAN_THR_MAX        BTM_BLE_ADV_SCAN_FULL_MAX
111 
112 /* connection parameter boundary values */
113 #define BTM_BLE_SCAN_INT_MIN            0x0004
114 #define BTM_BLE_SCAN_INT_MAX            0x4000
115 #define BTM_BLE_SCAN_WIN_MIN            0x0004
116 #define BTM_BLE_SCAN_WIN_MAX            0x4000
117 #define BTM_BLE_CONN_INT_MIN            0x0006
118 #define BTM_BLE_CONN_INT_MAX            0x0C80
119 #define BTM_BLE_CONN_LATENCY_MAX        500
120 #define BTM_BLE_CONN_SUP_TOUT_MIN       0x000A
121 #define BTM_BLE_CONN_SUP_TOUT_MAX       0x0C80
122 #define BTM_BLE_CONN_PARAM_UNDEF        0xffff      /* use this value when a specific value not to be overwritten */
123 
124 /* default connection parameters if not configured, use GAP recommend value for auto/selective connection */
125 /* default scan interval */
126 #ifndef BTM_BLE_SCAN_FAST_INT
127 #define BTM_BLE_SCAN_FAST_INT    96    /* 30 ~ 60 ms (use 60)  = 96 *0.625 */
128 #endif
129 /* default scan window for background connection, applicable for auto connection or selective conenction */
130 #ifndef BTM_BLE_SCAN_FAST_WIN
131 #define BTM_BLE_SCAN_FAST_WIN   48      /* 30 ms = 48 *0.625 */
132 #endif
133 
134 /* default scan paramter used in reduced power cycle (background scanning) */
135 #ifndef BTM_BLE_SCAN_SLOW_INT_1
136 #define BTM_BLE_SCAN_SLOW_INT_1    2048    /* 1.28 s   = 2048 *0.625 */
137 #endif
138 #ifndef BTM_BLE_SCAN_SLOW_WIN_1
139 #define BTM_BLE_SCAN_SLOW_WIN_1   48      /* 30 ms = 48 *0.625 */
140 #endif
141 
142 /* default scan paramter used in reduced power cycle (background scanning) */
143 #ifndef BTM_BLE_SCAN_SLOW_INT_2
144 #define BTM_BLE_SCAN_SLOW_INT_2    4096    /* 2.56 s   = 4096 *0.625 */
145 #endif
146 #ifndef BTM_BLE_SCAN_SLOW_WIN_2
147 #define BTM_BLE_SCAN_SLOW_WIN_2   36      /* 22.5 ms = 36 *0.625 */
148 #endif
149 
150 /* default connection interval min */
151 #ifndef BTM_BLE_CONN_INT_MIN_DEF
152 #define BTM_BLE_CONN_INT_MIN_DEF     24      /* recommended min: 30ms  = 24 * 1.25 */
153 #endif
154 /* default connectino interval max */
155 #ifndef BTM_BLE_CONN_INT_MAX_DEF
156 #define BTM_BLE_CONN_INT_MAX_DEF     40      /* recommended max: 50 ms = 56 * 1.25 */
157 #endif
158 /* default slave latency */
159 #ifndef BTM_BLE_CONN_SLAVE_LATENCY_DEF
160 #define BTM_BLE_CONN_SLAVE_LATENCY_DEF  0      /* 0 */
161 #endif
162 /* default supervision timeout */
163 #ifndef BTM_BLE_CONN_TIMEOUT_DEF
164 #define BTM_BLE_CONN_TIMEOUT_DEF    2000
165 #endif
166 
167 #define BTM_BLE_DIR_CONN_FALLBACK_UNDIR         1
168 #define BTM_BLE_DIR_CONN_FALLBACK_NO_ADV        2
169 
170 #ifndef BTM_BLE_DIR_CONN_FALLBACK
171 #define BTM_BLE_DIR_CONN_FALLBACK   BTM_BLE_DIR_CONN_FALLBACK_UNDIR
172 #endif
173 
174 #define BTM_CMAC_TLEN_SIZE          8                   /* 64 bits */
175 #define BTM_BLE_AUTH_SIGN_LEN       12                   /* BLE data signature length 8 Bytes + 4 bytes counter*/
176 typedef UINT8 BLE_SIGNATURE[BTM_BLE_AUTH_SIGN_LEN];         /* Device address */
177 
178 #ifndef BTM_BLE_HOST_SUPPORT
179 #define BTM_BLE_HOST_SUPPORT		0x01
180 #endif
181 
182 #ifndef BTM_BLE_SIMULTANEOUS_HOST
183 #define BTM_BLE_SIMULTANEOUS_HOST	0x01
184 #endif
185 
186 /* Appearance Values Reported with BTM_BLE_AD_TYPE_APPEARANCE */
187 #define BTM_BLE_APPEARANCE_UKNOWN                  0x0000
188 #define BTM_BLE_APPEARANCE_GENERIC_PHONE           0x0040
189 #define BTM_BLE_APPEARANCE_GENERIC_COMPUTER        0x0080
190 #define BTM_BLE_APPEARANCE_GENERIC_WATCH           0x00C0
191 #define BTM_BLE_APPEARANCE_SPORTS_WATCH            0x00C1
192 #define BTM_BLE_APPEARANCE_GENERIC_CLOCK           0x0100
193 #define BTM_BLE_APPEARANCE_GENERIC_DISPLAY         0x0140
194 #define BTM_BLE_APPEARANCE_GENERIC_REMOTE          0x0180
195 #define BTM_BLE_APPEARANCE_GENERIC_EYEGLASSES      0x01C0
196 #define BTM_BLE_APPEARANCE_GENERIC_TAG             0x0200
197 #define BTM_BLE_APPEARANCE_GENERIC_KEYRING         0x0240
198 #define BTM_BLE_APPEARANCE_GENERIC_MEDIA_PLAYER    0x0280
199 #define BTM_BLE_APPEARANCE_GENERIC_BARCODE_SCANNER 0x02C0
200 #define BTM_BLE_APPEARANCE_GENERIC_THERMOMETER     0x0300
201 #define BTM_BLE_APPEARANCE_THERMOMETER_EAR         0x0301
202 #define BTM_BLE_APPEARANCE_GENERIC_HEART_RATE      0x0340
203 #define BTM_BLE_APPEARANCE_HEART_RATE_BELT         0x0341
204 #define BTM_BLE_APPEARANCE_GENERIC_BLOOD_PRESSURE  0x0380
205 #define BTM_BLE_APPEARANCE_BLOOD_PRESSURE_ARM      0x0381
206 #define BTM_BLE_APPEARANCE_BLOOD_PRESSURE_WRIST    0x0382
207 #define BTM_BLE_APPEARANCE_GENERIC_HID             0x03C0
208 #define BTM_BLE_APPEARANCE_HID_KEYBOARD            0x03C1
209 #define BTM_BLE_APPEARANCE_HID_MOUSE               0x03C2
210 #define BTM_BLE_APPEARANCE_HID_JOYSTICK            0x03C3
211 #define BTM_BLE_APPEARANCE_HID_GAMEPAD             0x03C4
212 #define BTM_BLE_APPEARANCE_HID_DIGITIZER_TABLET    0x03C5
213 #define BTM_BLE_APPEARANCE_HID_CARD_READER         0x03C6
214 #define BTM_BLE_APPEARANCE_HID_DIGITAL_PEN         0x03C7
215 #define BTM_BLE_APPEARANCE_HID_BARCODE_SCANNER     0x03C8
216 #define BTM_BLE_APPEARANCE_GENERIC_GLUCOSE         0x0400
217 #define BTM_BLE_APPEARANCE_GENERIC_WALKING         0x0440
218 #define BTM_BLE_APPEARANCE_WALKING_IN_SHOE         0x0441
219 #define BTM_BLE_APPEARANCE_WALKING_ON_SHOE         0x0442
220 #define BTM_BLE_APPEARANCE_WALKING_ON_HIP          0x0443
221 #define BTM_BLE_APPEARANCE_GENERIC_CYCLING         0x0480
222 #define BTM_BLE_APPEARANCE_CYCLING_COMPUTER        0x0481
223 #define BTM_BLE_APPEARANCE_CYCLING_SPEED           0x0482
224 #define BTM_BLE_APPEARANCE_CYCLING_CADENCE         0x0483
225 #define BTM_BLE_APPEARANCE_CYCLING_POWER           0x0484
226 #define BTM_BLE_APPEARANCE_CYCLING_SPEED_CADENCE   0x0485
227 #define BTM_BLE_APPEARANCE_GENERIC_PULSE_OXIMETER  0x0C40
228 #define BTM_BLE_APPEARANCE_PULSE_OXIMETER_FINGERTIP 0x0C41
229 #define BTM_BLE_APPEARANCE_PULSE_OXIMETER_WRIST    0x0C42
230 #define BTM_BLE_APPEARANCE_GENERIC_WEIGHT          0x0C80
231 #define BTM_BLE_APPEARANCE_GENERIC_OUTDOOR_SPORTS  0x1440
232 #define BTM_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION 0x1441
233 #define BTM_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION_AND_NAV     0x1442
234 #define BTM_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION_POD         0x1443
235 #define BTM_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION_POD_AND_NAV 0x1444
236 
237 
238 /* Structure returned with Rand/Encrypt complete callback */
239 typedef struct
240 {
241     UINT8   status;
242     UINT8   param_len;
243     UINT16  opcode;
244     UINT8   param_buf[BT_OCTET16_LEN];
245 } tBTM_RAND_ENC;
246 
247 /* General callback function for notifying an application that a synchronous
248 ** BTM function is complete. The pointer contains the address of any returned data.
249 */
250 typedef void (tBTM_RAND_ENC_CB) (tBTM_RAND_ENC *p1);
251 
252 #define BTM_BLE_FILTER_TARGET_SCANNER       0x01
253 #define BTM_BLE_FILTER_TARGET_ADVR          0x00
254 
255 #define BTM_BLE_POLICY_BLACK_ALL            0x00    /* relevant to both */
256 #define BTM_BLE_POLICY_ALLOW_SCAN           0x01    /* relevant to advertiser */
257 #define BTM_BLE_POLICY_ALLOW_CONN           0x02    /* relevant to advertiser */
258 #define BTM_BLE_POLICY_WHITE_ALL            0x03    /* relevant to both */
259 
260 /* ADV data flag bit definition used for BTM_BLE_AD_TYPE_FLAG */
261 #define BTM_BLE_LIMIT_DISC_FLAG         (0x01 << 0)
262 #define BTM_BLE_GEN_DISC_FLAG           (0x01 << 1)
263 #define BTM_BLE_BREDR_NOT_SPT           (0x01 << 2)
264 /* 4.1 spec adv flag for simultaneous BR/EDR+LE connection support */
265 #define BTM_BLE_DMT_CONTROLLER_SPT      (0x01 << 3)
266 #define BTM_BLE_DMT_HOST_SPT            (0x01 << 4)
267 #define BTM_BLE_NON_LIMIT_DISC_FLAG     (0x00 )         /* lowest bit unset */
268 #define BTM_BLE_ADV_FLAG_MASK           (BTM_BLE_LIMIT_DISC_FLAG | BTM_BLE_BREDR_NOT_SPT | BTM_BLE_GEN_DISC_FLAG)
269 #define BTM_BLE_LIMIT_DISC_MASK         (BTM_BLE_LIMIT_DISC_FLAG )
270 
271 #define BTM_BLE_AD_BIT_DEV_NAME        (0x00000001 << 0)
272 #define BTM_BLE_AD_BIT_FLAGS           (0x00000001 << 1)
273 #define BTM_BLE_AD_BIT_MANU            (0x00000001 << 2)
274 #define BTM_BLE_AD_BIT_TX_PWR          (0x00000001 << 3)
275 #define BTM_BLE_AD_BIT_INT_RANGE       (0x00000001 << 5)
276 #define BTM_BLE_AD_BIT_SERVICE         (0x00000001 << 6)
277 #define BTM_BLE_AD_BIT_SERVICE_SOL     (0x00000001 << 7)
278 #define BTM_BLE_AD_BIT_SERVICE_DATA    (0x00000001 << 8)
279 #define BTM_BLE_AD_BIT_SIGN_DATA       (0x00000001 << 9)
280 #define BTM_BLE_AD_BIT_SERVICE_128SOL  (0x00000001 << 10)
281 #define BTM_BLE_AD_BIT_APPEARANCE      (0x00000001 << 11)
282 #define BTM_BLE_AD_BIT_PUBLIC_ADDR      (0x00000001 << 12)
283 #define BTM_BLE_AD_BIT_RANDOM_ADDR       (0x00000001 << 13)
284 #define BTM_BLE_AD_BIT_SERVICE_32        (0x00000001 << 4)
285 #define BTM_BLE_AD_BIT_SERVICE_32SOL     (0x00000001 << 14)
286 #define BTM_BLE_AD_BIT_PROPRIETARY     (0x00000001 << 15)
287 #define BTM_BLE_AD_BIT_SERVICE_128      (0x00000001 << 16)      /*128-bit Service UUIDs*/
288 
289 typedef  UINT32  tBTM_BLE_AD_MASK;
290 
291 #define BTM_BLE_AD_TYPE_FLAG            HCI_EIR_FLAGS_TYPE                  /* 0x01 */
292 #define BTM_BLE_AD_TYPE_16SRV_PART      HCI_EIR_MORE_16BITS_UUID_TYPE       /* 0x02 */
293 #define BTM_BLE_AD_TYPE_16SRV_CMPL      HCI_EIR_COMPLETE_16BITS_UUID_TYPE   /* 0x03 */
294 #define BTM_BLE_AD_TYPE_32SRV_PART      HCI_EIR_MORE_32BITS_UUID_TYPE       /* 0x04 */
295 #define BTM_BLE_AD_TYPE_32SRV_CMPL      HCI_EIR_COMPLETE_32BITS_UUID_TYPE   /* 0x05 */
296 #define BTM_BLE_AD_TYPE_128SRV_PART     HCI_EIR_MORE_128BITS_UUID_TYPE       /* 0x06 */
297 #define BTM_BLE_AD_TYPE_128SRV_CMPL     HCI_EIR_COMPLETE_128BITS_UUID_TYPE   /* 0x07 */
298 #define BTM_BLE_AD_TYPE_NAME_SHORT      HCI_EIR_SHORTENED_LOCAL_NAME_TYPE       /* 0x08 */
299 #define BTM_BLE_AD_TYPE_NAME_CMPL       HCI_EIR_COMPLETE_LOCAL_NAME_TYPE        /* 0x09 */
300 #define BTM_BLE_AD_TYPE_TX_PWR          HCI_EIR_TX_POWER_LEVEL_TYPE             /* 0x0A */
301 #define BTM_BLE_AD_TYPE_DEV_CLASS       0x0D
302 #define BTM_BLE_AD_TYPE_SM_TK           0x10
303 #define BTM_BLE_AD_TYPE_SM_OOB_FLAG     0x11
304 #define BTM_BLE_AD_TYPE_INT_RANGE       0x12
305 #define BTM_BLE_AD_TYPE_SOL_SRV_UUID    0x14
306 #define BTM_BLE_AD_TYPE_128SOL_SRV_UUID 0x15
307 #define BTM_BLE_AD_TYPE_SERVICE_DATA    0x16
308 #define BTM_BLE_AD_TYPE_PUBLIC_TARGET   0x17
309 #define BTM_BLE_AD_TYPE_RANDOM_TARGET   0x18
310 #define BTM_BLE_AD_TYPE_APPEARANCE      0x19
311 #define BTM_BLE_AD_TYPE_ADV_INT         0x1a
312 #define BTM_BLE_AD_TYPE_32SOL_SRV_UUID  0x1b
313 #define BTM_BLE_AD_TYPE_32SERVICE_DATA  0x1c
314 #define BTM_BLE_AD_TYPE_128SERVICE_DATA 0x1d
315 
316 #define BTM_BLE_AD_TYPE_MANU            HCI_EIR_MANUFACTURER_SPECIFIC_TYPE      /* 0xff */
317 typedef UINT8   tBTM_BLE_AD_TYPE;
318 
319 /* adv tx power level */
320 #define BTM_BLE_ADV_TX_POWER_MIN        0           /* minimum tx power */
321 #define BTM_BLE_ADV_TX_POWER_LOW        1           /* low tx power     */
322 #define BTM_BLE_ADV_TX_POWER_MID        2           /* middle tx power  */
323 #define BTM_BLE_ADV_TX_POWER_UPPER      3           /* upper tx power   */
324 #define BTM_BLE_ADV_TX_POWER_MAX        4           /* maximum tx power */
325 typedef UINT8 tBTM_BLE_ADV_TX_POWER;
326 
327 /* adv tx power in dBm */
328 typedef struct
329 {
330     UINT8 adv_inst_max;         /* max adv instance supported in controller */
331     UINT8 rpa_offloading;
332     UINT16 tot_scan_results_strg;
333     UINT8 max_irk_list_sz;
334     UINT8 filter_support;
335     UINT8 max_filter;
336     UINT8 energy_support;
337     BOOLEAN values_read;
338 }tBTM_BLE_VSC_CB;
339 
340 /* slave preferred connection interval range */
341 typedef struct
342 {
343     UINT16  low;
344     UINT16  hi;
345 
346 }tBTM_BLE_INT_RANGE;
347 
348 /* Service tag supported in the device */
349 typedef struct
350 {
351     UINT8       num_service;
352     BOOLEAN     list_cmpl;
353     UINT16      *p_uuid;
354 }tBTM_BLE_SERVICE;
355 
356 /* 32 bits Service supported in the device */
357 typedef struct
358 {
359     UINT8       num_service;
360     BOOLEAN     list_cmpl;
361     UINT32      *p_uuid;
362 }tBTM_BLE_32SERVICE;
363 
364 /* 128 bits Service supported in the device */
365 typedef struct
366 {
367     BOOLEAN     list_cmpl;
368     UINT8       uuid128[MAX_UUID_SIZE];
369 }tBTM_BLE_128SERVICE;
370 
371 typedef struct
372 {
373     UINT8       len;
374     UINT8      *p_val;
375 }tBTM_BLE_MANU;
376 
377 
378 typedef struct
379 {
380     tBT_UUID    service_uuid;
381     UINT8       len;
382     UINT8      *p_val;
383 }tBTM_BLE_SERVICE_DATA;
384 
385 typedef struct
386 {
387     UINT8       adv_type;
388     UINT8       len;
389     UINT8       *p_val;     /* number of len byte */
390 }tBTM_BLE_PROP_ELEM;
391 
392 typedef struct
393 {
394     UINT8                   num_elem;
395     tBTM_BLE_PROP_ELEM      *p_elem;
396 }tBTM_BLE_PROPRIETARY;
397 
398 typedef struct
399 {
400     tBTM_BLE_INT_RANGE      int_range;      /* slave prefered conn interval range */
401     tBTM_BLE_MANU           *p_manu;           /* manufactuer data */
402     tBTM_BLE_SERVICE        *p_services;       /* services */
403     tBTM_BLE_128SERVICE     *p_services_128b;  /* 128 bits service */
404     tBTM_BLE_32SERVICE      *p_service_32b;     /* 32 bits Service UUID */
405     tBTM_BLE_SERVICE        *p_sol_services;    /* 16 bits services Solicitation UUIDs */
406     tBTM_BLE_32SERVICE      *p_sol_service_32b;    /* List of 32 bit Service Solicitation UUIDs */
407     tBTM_BLE_128SERVICE     *p_sol_service_128b;    /* List of 128 bit Service Solicitation UUIDs */
408     tBTM_BLE_PROPRIETARY    *p_proprietary;
409     tBTM_BLE_SERVICE_DATA   *p_service_data;    /* service data */
410     UINT16                  appearance;
411     UINT8                   flag;
412     UINT8                   tx_power;
413 }tBTM_BLE_ADV_DATA;
414 
415 #ifndef BTM_BLE_MULTI_ADV_MAX
416 #define BTM_BLE_MULTI_ADV_MAX   10 /* controller returned adv_inst_max should be less
417                                       than this number */
418 #endif
419 
420 #define BTM_BLE_MULTI_ADV_INVALID   0
421 
422 #define BTM_BLE_MULTI_ADV_ENB_EVT           1
423 #define BTM_BLE_MULTI_ADV_DISABLE_EVT       2
424 #define BTM_BLE_MULTI_ADV_PARAM_EVT         3
425 #define BTM_BLE_MULTI_ADV_DATA_EVT          4
426 typedef UINT8 tBTM_BLE_MULTI_ADV_EVT;
427 
428 #define BTM_BLE_MULTI_ADV_DEFAULT_STD 0
429 
430 typedef struct
431 {
432     UINT16          adv_int_min;
433     UINT16          adv_int_max;
434     UINT8           adv_type;
435     tBTM_BLE_ADV_CHNL_MAP channel_map;
436     tBTM_BLE_AFP    adv_filter_policy;
437     tBTM_BLE_ADV_TX_POWER tx_power;
438 }tBTM_BLE_ADV_PARAMS;
439 
440 typedef struct
441 {
442     UINT8   *p_sub_code; /* dynamic array to store sub code */
443     UINT8   *p_inst_id;  /* dynamic array to store instance id */
444     UINT8   pending_idx;
445     UINT8   next_idx;
446 }tBTM_BLE_MULTI_ADV_OPQ;
447 
448 typedef void (tBTM_BLE_MULTI_ADV_CBACK)(tBTM_BLE_MULTI_ADV_EVT evt, UINT8 inst_id,
449                 void *p_ref, tBTM_STATUS status);
450 
451 typedef struct
452 {
453     UINT8                       inst_id;
454     UINT8                       adv_evt;
455     BD_ADDR                     rpa;
456     TIMER_LIST_ENT              raddr_timer_ent;
457     tBTM_BLE_MULTI_ADV_CBACK    *p_cback;
458     void                        *p_ref;
459     UINT8                       index;
460 }tBTM_BLE_MULTI_ADV_INST;
461 
462 typedef struct
463 {
464     UINT8 inst_index_queue[BTM_BLE_MULTI_ADV_MAX];
465     int front;
466     int rear;
467 }tBTM_BLE_MULTI_ADV_INST_IDX_Q;
468 
469 typedef struct
470 {
471     tBTM_BLE_MULTI_ADV_INST *p_adv_inst; /* dynamic array to store adv instance */
472     tBTM_BLE_MULTI_ADV_OPQ  op_q;
473 }tBTM_BLE_MULTI_ADV_CB;
474 
475 typedef void (tBTM_BLE_SCAN_THRESHOLD_CBACK)(tBTM_BLE_REF_VALUE ref_value);
476 typedef void (tBTM_BLE_SCAN_REP_CBACK)(tBTM_BLE_REF_VALUE ref_value, UINT8 report_format,
477                                        UINT8 num_records, UINT16 total_len,
478                                        UINT8* p_rep_data, UINT8 status);
479 typedef void (tBTM_BLE_SCAN_SETUP_CBACK)(UINT8 evt, tBTM_BLE_REF_VALUE ref_value, UINT8 status);
480 
481 #ifndef BTM_BLE_BATCH_SCAN_MAX
482 #define BTM_BLE_BATCH_SCAN_MAX   5
483 #endif
484 
485 #ifndef BTM_BLE_BATCH_REP_MAIN_Q_SIZE
486 #define BTM_BLE_BATCH_REP_MAIN_Q_SIZE  2
487 #endif
488 
489 typedef enum
490 {
491     BTM_BLE_SCAN_INVALID_STATE=0,
492     BTM_BLE_SCAN_ENABLE_CALLED=1,
493     BTM_BLE_SCAN_ENABLED_STATE=2,
494     BTM_BLE_SCAN_DISABLE_CALLED=3,
495     BTM_BLE_SCAN_DISABLED_STATE=4
496 }tBTM_BLE_BATCH_SCAN_STATE;
497 
498 enum
499 {
500     BTM_BLE_DISCARD_OLD_ITEMS,
501     BTM_BLE_DISCARD_LOWER_RSSI_ITEMS
502 };
503 typedef UINT8 tBTM_BLE_DISCARD_RULE;
504 
505 typedef struct
506 {
507     UINT8   sub_code[BTM_BLE_BATCH_SCAN_MAX];
508     tBTM_BLE_BATCH_SCAN_STATE cur_state[BTM_BLE_BATCH_SCAN_MAX];
509     tBTM_BLE_REF_VALUE        ref_value[BTM_BLE_BATCH_SCAN_MAX];
510     UINT8   pending_idx;
511     UINT8   next_idx;
512 }tBTM_BLE_BATCH_SCAN_OPQ;
513 
514 typedef struct
515 {
516     UINT8   rep_mode[BTM_BLE_BATCH_REP_MAIN_Q_SIZE];
517     tBTM_BLE_REF_VALUE  ref_value[BTM_BLE_BATCH_REP_MAIN_Q_SIZE];
518     UINT8   num_records[BTM_BLE_BATCH_REP_MAIN_Q_SIZE];
519     UINT16  data_len[BTM_BLE_BATCH_REP_MAIN_Q_SIZE];
520     UINT8   *p_data[BTM_BLE_BATCH_REP_MAIN_Q_SIZE];
521     UINT8   pending_idx;
522     UINT8   next_idx;
523 }tBTM_BLE_BATCH_SCAN_REP_Q;
524 
525 typedef struct
526 {
527     tBTM_BLE_BATCH_SCAN_STATE      cur_state;
528     tBTM_BLE_BATCH_SCAN_MODE scan_mode;
529     UINT32                  scan_interval;
530     UINT32                  scan_window;
531     tBLE_ADDR_TYPE          addr_type;
532     tBTM_BLE_DISCARD_RULE   discard_rule;
533     tBTM_BLE_BATCH_SCAN_OPQ  op_q;
534     tBTM_BLE_BATCH_SCAN_REP_Q main_rep_q;
535     tBTM_BLE_SCAN_SETUP_CBACK     *p_setup_cback;
536     tBTM_BLE_SCAN_THRESHOLD_CBACK *p_thres_cback;
537     tBTM_BLE_SCAN_REP_CBACK       *p_scan_rep_cback;
538     tBTM_BLE_REF_VALUE             ref_value;
539 }tBTM_BLE_BATCH_SCAN_CB;
540 
541 /* filter selection bit index  */
542 #define BTM_BLE_PF_ADDR_FILTER          0
543 #define BTM_BLE_PF_SRVC_DATA            1
544 #define BTM_BLE_PF_SRVC_UUID            2
545 #define BTM_BLE_PF_SRVC_SOL_UUID        3
546 #define BTM_BLE_PF_LOCAL_NAME           4
547 #define BTM_BLE_PF_MANU_DATA            5
548 #define BTM_BLE_PF_SRVC_DATA_PATTERN    6
549 #define BTM_BLE_PF_TYPE_ALL             7  /* when passed in payload filter type all, only clear action is applicable */
550 #define BTM_BLE_PF_TYPE_MAX             8
551 
552 /* max number of filter spot for different filter type */
553 #ifndef BTM_BLE_MAX_UUID_FILTER
554 #define BTM_BLE_MAX_UUID_FILTER     8
555 #endif
556 #ifndef BTM_BLE_MAX_ADDR_FILTER
557 #define BTM_BLE_MAX_ADDR_FILTER     8
558 #endif
559 #ifndef BTM_BLE_PF_STR_COND_MAX
560 #define BTM_BLE_PF_STR_COND_MAX     4   /* apply to manu data , or local name */
561 #endif
562 #ifndef BTM_BLE_PF_STR_LEN_MAX
563 #define BTM_BLE_PF_STR_LEN_MAX      29  /* match for first 29 bytes */
564 #endif
565 
566 typedef UINT8   tBTM_BLE_PF_COND_TYPE;
567 
568 #define BTM_BLE_PF_LOGIC_OR              0
569 #define BTM_BLE_PF_LOGIC_AND             1
570 typedef UINT8 tBTM_BLE_PF_LOGIC_TYPE;
571 
572 #define BTM_BLE_PF_ENABLE       1
573 #define BTM_BLE_PF_CONFIG       2
574 typedef UINT8 tBTM_BLE_PF_ACTION;
575 
576 typedef UINT8 tBTM_BLE_PF_FILT_INDEX;
577 
578 typedef UINT8 tBTM_BLE_PF_AVBL_SPACE;
579 
580 #define BTM_BLE_PF_BRDCAST_ADDR_FILT  1
581 #define BTM_BLE_PF_SERV_DATA_CHG_FILT 2
582 #define BTM_BLE_PF_SERV_UUID          4
583 #define BTM_BLE_PF_SERV_SOLC_UUID     8
584 #define BTM_BLE_PF_LOC_NAME_CHECK    16
585 #define BTM_BLE_PF_MANUF_NAME_CHECK  32
586 #define BTM_BLE_PF_SERV_DATA_CHECK   64
587 typedef UINT16 tBTM_BLE_PF_FEAT_SEL;
588 
589 #define BTM_BLE_PF_LIST_LOGIC_OR   1
590 #define BTM_BLE_PF_LIST_LOGIC_AND  2
591 typedef UINT16 tBTM_BLE_PF_LIST_LOGIC_TYPE;
592 
593 #define BTM_BLE_PF_FILT_LOGIC_OR   0
594 #define BTM_BLE_PF_FILT_LOGIC_AND  1
595 typedef UINT16 tBTM_BLE_PF_FILT_LOGIC_TYPE;
596 
597 typedef UINT8  tBTM_BLE_PF_RSSI_THRESHOLD;
598 typedef UINT8  tBTM_BLE_PF_DELIVERY_MODE;
599 typedef UINT16 tBTM_BLE_PF_TIMEOUT;
600 typedef UINT8  tBTM_BLE_PF_TIMEOUT_CNT;
601 
602 typedef struct
603 {
604     tBTM_BLE_PF_FEAT_SEL feat_seln;
605     tBTM_BLE_PF_LIST_LOGIC_TYPE logic_type;
606     tBTM_BLE_PF_FILT_LOGIC_TYPE filt_logic_type;
607     tBTM_BLE_PF_RSSI_THRESHOLD  rssi_high_thres;
608     tBTM_BLE_PF_RSSI_THRESHOLD  rssi_low_thres;
609     tBTM_BLE_PF_DELIVERY_MODE dely_mode;
610     tBTM_BLE_PF_TIMEOUT found_timeout;
611     tBTM_BLE_PF_TIMEOUT lost_timeout;
612     tBTM_BLE_PF_TIMEOUT_CNT found_timeout_cnt;
613 }tBTM_BLE_PF_FILT_PARAMS;
614 
615 enum
616 {
617     BTM_BLE_SCAN_COND_ADD,
618     BTM_BLE_SCAN_COND_DELETE,
619     BTM_BLE_SCAN_COND_CLEAR = 2
620 };
621 typedef UINT8 tBTM_BLE_SCAN_COND_OP;
622 
623 enum
624 {
625     BTM_BLE_FILT_ENABLE_DISABLE = 1,
626     BTM_BLE_FILT_CFG            = 2,
627     BTM_BLE_FILT_ADV_PARAM      = 3
628 };
629 
630 typedef UINT8 tBTM_BLE_FILT_CB_EVT;
631 
632 /* BLE adv payload filtering config complete callback */
633 typedef void (tBTM_BLE_PF_CFG_CBACK)(tBTM_BLE_PF_ACTION action, tBTM_BLE_SCAN_COND_OP cfg_op,
634                                       tBTM_BLE_PF_AVBL_SPACE avbl_space, tBTM_STATUS status,
635                                       tBTM_BLE_REF_VALUE ref_value);
636 
637 typedef void (tBTM_BLE_PF_CMPL_CBACK) (tBTM_BLE_PF_CFG_CBACK);
638 
639 /* BLE adv payload filtering status setup complete callback */
640 typedef void (tBTM_BLE_PF_STATUS_CBACK) (UINT8 action, tBTM_STATUS status,
641                                         tBTM_BLE_REF_VALUE ref_value);
642 
643 /* BLE adv payload filtering param setup complete callback */
644 typedef void (tBTM_BLE_PF_PARAM_CBACK) (tBTM_BLE_PF_ACTION action_type,
645                                         tBTM_BLE_PF_AVBL_SPACE avbl_space,
646                                         tBTM_BLE_REF_VALUE ref_value, tBTM_STATUS status);
647 
648 typedef union
649 {
650       UINT16              uuid16_mask;
651       UINT32              uuid32_mask;
652       UINT8               uuid128_mask[LEN_UUID_128];
653 }tBTM_BLE_PF_COND_MASK;
654 
655 typedef struct
656 {
657     tBLE_BD_ADDR            *p_target_addr;     /* target address, if NULL, generic UUID filter */
658     tBT_UUID                uuid;           /* UUID condition */
659     tBTM_BLE_PF_LOGIC_TYPE  cond_logic;    /* AND/OR */
660     tBTM_BLE_PF_COND_MASK   *p_uuid_mask;           /* UUID mask */
661 }tBTM_BLE_PF_UUID_COND;
662 
663 typedef struct
664 {
665     UINT8                   data_len;       /* <= 20 bytes */
666     UINT8                   *p_data;
667 }tBTM_BLE_PF_LOCAL_NAME_COND;
668 
669 typedef struct
670 {
671     UINT16                  company_id;     /* company ID */
672     UINT8                   data_len;       /* <= 20 bytes */
673     UINT8                   *p_pattern;
674     UINT16                  company_id_mask; /* UUID value mask */
675     UINT8                   *p_pattern_mask; /* Manufactuer data matching mask, same length as data pattern,
676                                                 set to all 0xff, match exact data */
677 }tBTM_BLE_PF_MANU_COND;
678 
679 typedef struct
680 {
681     UINT16                  uuid;     /* service ID */
682     UINT8                   data_len;       /* <= 20 bytes */
683     UINT8                   *p_pattern;
684     UINT8                   *p_pattern_mask; /* Service data matching mask, same length as data pattern,
685                                                 set to all 0xff, match exact data */
686 }tBTM_BLE_PF_SRVC_PATTERN_COND;
687 
688 
689 typedef union
690 {
691     tBLE_BD_ADDR                            target_addr;
692     tBTM_BLE_PF_LOCAL_NAME_COND             local_name; /* lcoal name filtering */
693     tBTM_BLE_PF_MANU_COND                   manu_data;  /* manufactuer data filtering */
694     tBTM_BLE_PF_UUID_COND                   srvc_uuid;  /* service UUID filtering */
695     tBTM_BLE_PF_UUID_COND                   solicitate_uuid;   /* solicitated service UUID filtering */
696     tBTM_BLE_PF_SRVC_PATTERN_COND           srvc_data;      /* service data pattern */
697 }tBTM_BLE_PF_COND_PARAM;
698 
699 typedef struct
700 {
701     UINT8   action_ocf[BTM_BLE_PF_TYPE_MAX];
702     tBTM_BLE_REF_VALUE  ref_value[BTM_BLE_PF_TYPE_MAX];
703     tBTM_BLE_PF_PARAM_CBACK  *p_filt_param_cback[BTM_BLE_PF_TYPE_MAX];
704     tBTM_BLE_PF_CFG_CBACK *p_scan_cfg_cback[BTM_BLE_PF_TYPE_MAX];
705     UINT8   cb_evt[BTM_BLE_PF_TYPE_MAX];
706     UINT8   pending_idx;
707     UINT8   next_idx;
708 }tBTM_BLE_ADV_FILTER_ADV_OPQ;
709 
710 #define BTM_BLE_MAX_FILTER_COUNTER  (BTM_BLE_MAX_ADDR_FILTER + 1) /* per device filter + one generic filter indexed by 0 */
711 
712 #ifndef BTM_CS_IRK_LIST_MAX
713 #define BTM_CS_IRK_LIST_MAX 0x20
714 #endif
715 
716 typedef struct
717 {
718     BOOLEAN    in_use;
719     BD_ADDR    bd_addr;
720     UINT8      pf_counter[BTM_BLE_PF_TYPE_MAX]; /* number of filter indexed by tBTM_BLE_PF_COND_TYPE */
721 }tBTM_BLE_PF_COUNT;
722 
723 typedef struct
724 {
725     BOOLEAN             enable;
726     UINT8               op_type;
727     tBTM_BLE_PF_COUNT   *p_addr_filter_count; /* per BDA filter array */
728     tBLE_BD_ADDR        cur_filter_target;
729     tBTM_BLE_PF_STATUS_CBACK *p_filt_stat_cback;
730     tBTM_BLE_ADV_FILTER_ADV_OPQ  op_q;
731 }tBTM_BLE_ADV_FILTER_CB;
732 
733 /* Sub codes */
734 #define BTM_BLE_META_PF_ENABLE          0x00
735 #define BTM_BLE_META_PF_FEAT_SEL        0x01
736 #define BTM_BLE_META_PF_ADDR            0x02
737 #define BTM_BLE_META_PF_UUID            0x03
738 #define BTM_BLE_META_PF_SOL_UUID        0x04
739 #define BTM_BLE_META_PF_LOCAL_NAME      0x05
740 #define BTM_BLE_META_PF_MANU_DATA       0x06
741 #define BTM_BLE_META_PF_SRVC_DATA       0x07
742 #define BTM_BLE_META_PF_ALL             0x08
743 
744 /* These are the fields returned in each device adv packet.  It
745 ** is returned in the results callback if registered.
746 */
747 typedef struct
748 {
749     UINT8               conn_mode;
750     tBTM_BLE_AD_MASK    ad_mask;        /* mask of the valid adv data field */
751     UINT8               flag;
752     UINT8               tx_power_level;
753     UINT8               remote_name_len;
754     UINT8               *p_remote_name;
755     tBTM_BLE_SERVICE    service;
756 } tBTM_BLE_INQ_DATA;
757 
758 enum
759 {
760     BTM_BLE_CONN_NONE,
761     BTM_BLE_CONN_AUTO,
762     BTM_BLE_CONN_SELECTIVE
763 };
764 typedef UINT8   tBTM_BLE_CONN_TYPE;
765 
766 typedef void (tBTM_BLE_TRACK_ADV_CBACK)(int filt_index, tBLE_ADDR_TYPE addr_type, BD_ADDR bda,
767                                         int adv_state, tBTM_BLE_REF_VALUE ref_value);
768 
769 typedef UINT8 tBTM_BLE_TRACK_ADV_EVT;
770 
771 typedef struct
772 {
773     tBTM_BLE_REF_VALUE             ref_value;
774     tBTM_BLE_TRACK_ADV_CBACK *p_track_cback;
775 }tBTM_BLE_ADV_TRACK_CB;
776 
777 enum
778 {
779     BTM_BLE_TRACK_ADV_ADD,
780     BTM_BLE_TRACK_ADV_REMOVE
781 };
782 
783 typedef UINT8 tBTM_BLE_TRACK_ADV_ACTION;
784 
785 #define BTM_BLE_MULTI_ADV_INVALID   0
786 
787 #define BTM_BLE_BATCH_SCAN_ENABLE_EVT     1
788 #define BTM_BLE_BATCH_SCAN_CFG_STRG_EVT   2
789 #define BTM_BLE_BATCH_SCAN_READ_REPTS_EVT 3
790 #define BTM_BLE_BATCH_SCAN_THR_EVT        4
791 #define BTM_BLE_BATCH_SCAN_PARAM_EVT      5
792 #define BTM_BLE_BATCH_SCAN_DISABLE_EVT    6
793 
794 typedef UINT8 tBTM_BLE_BATCH_SCAN_EVT;
795 
796 typedef UINT32 tBTM_BLE_TX_TIME_MS;
797 typedef UINT32 tBTM_BLE_RX_TIME_MS;
798 typedef UINT32 tBTM_BLE_IDLE_TIME_MS;
799 typedef UINT32 tBTM_BLE_ENERGY_USED;
800 
801 typedef void (tBTM_BLE_ENERGY_INFO_CBACK)(tBTM_BLE_TX_TIME_MS tx_time, tBTM_BLE_RX_TIME_MS rx_time,
802                                           tBTM_BLE_IDLE_TIME_MS idle_time,
803                                           tBTM_BLE_ENERGY_USED  energy_used,
804                                           tBTM_STATUS status);
805 
806 typedef struct
807 {
808     tBTM_BLE_ENERGY_INFO_CBACK *p_ener_cback;
809 }tBTM_BLE_ENERGY_INFO_CB;
810 
811 typedef BOOLEAN (tBTM_BLE_SEL_CBACK)(BD_ADDR random_bda,     UINT8 *p_remote_name);
812 typedef void (tBTM_BLE_CTRL_FEATURES_CBACK)(tBTM_STATUS status);
813 
814 /* callback function for SMP signing algorithm, signed data in little endian order with tlen bits long */
815 typedef void (tBTM_BLE_SIGN_CBACK)(void *p_ref_data, UINT8 *p_signing_data);
816 typedef void (tBTM_BLE_VERIFY_CBACK)(void *p_ref_data, BOOLEAN match);
817 /* random address set complete callback */
818 typedef void (tBTM_BLE_RANDOM_SET_CBACK) (BD_ADDR random_bda);
819 
820 typedef void (tBTM_BLE_SCAN_REQ_CBACK)(BD_ADDR remote_bda, tBLE_ADDR_TYPE addr_type, UINT8 adv_evt);
821 
822 tBTM_BLE_SCAN_SETUP_CBACK bta_ble_scan_setup_cb;
823 
824 /*****************************************************************************
825 **  EXTERNAL FUNCTION DECLARATIONS
826 *****************************************************************************/
827 #ifdef __cplusplus
828 extern "C" {
829 #endif
830 /*******************************************************************************
831 **
832 ** Function         BTM_SecAddBleDevice
833 **
834 ** Description      Add/modify device.  This function will be normally called
835 **                  during host startup to restore all required information
836 **                  for a LE device stored in the NVRAM.
837 **
838 ** Parameters:      bd_addr          - BD address of the peer
839 **                  bd_name          - Name of the peer device.  NULL if unknown.
840 **                  dev_type         - Remote device's device type.
841 **                  addr_type        - LE device address type.
842 **
843 ** Returns          TRUE if added OK, else FALSE
844 **
845 *******************************************************************************/
846 BTM_API extern BOOLEAN BTM_SecAddBleDevice (BD_ADDR bd_addr, BD_NAME bd_name,
847                                            tBT_DEVICE_TYPE dev_type, tBLE_ADDR_TYPE addr_type);
848 
849 /*******************************************************************************
850 **
851 ** Function         BTM_SecAddBleKey
852 **
853 ** Description      Add/modify LE device information.  This function will be
854 **                  normally called during host startup to restore all required
855 **                  information stored in the NVRAM.
856 **
857 ** Parameters:      bd_addr          - BD address of the peer
858 **                  p_le_key         - LE key values.
859 **                  key_type         - LE SMP key type.
860 *
861 ** Returns          TRUE if added OK, else FALSE
862 **
863 *******************************************************************************/
864 BTM_API extern BOOLEAN BTM_SecAddBleKey (BD_ADDR bd_addr, tBTM_LE_KEY_VALUE *p_le_key,
865                                          tBTM_LE_KEY_TYPE key_type);
866 
867 /*******************************************************************************
868 **
869 ** Function         BTM_BleSetAdvParams
870 **
871 ** Description      This function is called to set advertising parameters.
872 **
873 ** Parameters:       None.
874 **
875 ** Returns          void
876 **
877 *******************************************************************************/
878 BTM_API extern tBTM_STATUS BTM_BleSetAdvParams(UINT16 adv_int_min, UINT16 adv_int_max,
879                                 tBLE_BD_ADDR *p_dir_bda, tBTM_BLE_ADV_CHNL_MAP chnl_map);
880 
881 /*******************************************************************************
882 **
883 ** Function         BTM_BleWriteAdvData
884 **
885 ** Description      This function is called to write advertising data.
886 **
887 ** Parameters:       None.
888 **
889 ** Returns          void
890 **
891 *******************************************************************************/
892 BTM_API extern tBTM_STATUS BTM_BleWriteAdvData(tBTM_BLE_AD_MASK  data_mask,
893                                                tBTM_BLE_ADV_DATA *p_data);
894 
895 /*******************************************************************************
896 **
897 ** Function         BTM_BleSetAdvParams
898 **
899 ** Description      This function is called to set advertising parameters.
900 **
901 ** Parameters       adv_int_min: minimum advertising interval
902 **                  adv_int_max: maximum advertising interval
903 **                  p_dir_bda: connectable direct initiator's LE device address
904 **                  chnl_map: advertising channel map.
905 **
906 ** Returns          void
907 **
908 *******************************************************************************/
909 BTM_API extern void BTM_BleReadAdvParams (UINT16 *adv_int_min, UINT16 *adv_int_max,
910                             tBLE_BD_ADDR *p_dir_bda, tBTM_BLE_ADV_CHNL_MAP *p_chnl_map);
911 
912 /*******************************************************************************
913 **
914 ** Function         BTM_BleObtainVendorCapabilities
915 **
916 ** Description      This function is called to obatin vendor capabilties
917 **
918 ** Parameters       p_cmn_vsc_cb - Returns the vednor capabilities
919 **
920 ** Returns          void
921 **
922 *******************************************************************************/
923 extern void BTM_BleObtainVendorCapabilities(tBTM_BLE_VSC_CB *p_cmn_vsc_cb);
924 
925 /*******************************************************************************
926 **
927 ** Function         BTM_BleSetScanParams
928 **
929 ** Description      This function is called to set Scan parameters.
930 **
931 ** Parameters       adv_int_min: minimum advertising interval
932 **                  adv_int_max: maximum advertising interval
933 **                  scan_type: scan mode.
934 **
935 ** Returns          void
936 **
937 *******************************************************************************/
938 BTM_API extern void BTM_BleSetScanParams(UINT16 scan_interval, UINT16 scan_window,
939                                          tBTM_BLE_SCAN_MODE scan_type);
940 /*******************************************************************************
941 **
942 ** Function         BTM_BleGetVendorCapabilities
943 **
944 ** Description      This function reads local LE features
945 **
946 ** Parameters       p_cmn_vsc_cb : Locala LE capability structure
947 **
948 ** Returns          void
949 **
950 *******************************************************************************/
951 BTM_API extern void BTM_BleGetVendorCapabilities(tBTM_BLE_VSC_CB *p_cmn_vsc_cb);
952 /*******************************************************************************
953 **
954 ** Function         BTM_BleSetStorageConfig
955 **
956 ** Description      This function is called to setup storage configuration and setup callbacks.
957 **
958 ** Parameters       UINT8 batch_scan_full_max -Batch scan full maximum
959                     UINT8 batch_scan_trunc_max - Batch scan truncated value maximum
960                     UINT8 batch_scan_notify_threshold - Threshold value
961                     tBTM_BLE_SCAN_SETUP_CBACK *p_setup_cback - Setup callback
962                     tBTM_BLE_SCAN_THRESHOLD_CBACK *p_thres_cback -Threshold callback
963                     void *p_ref - Reference value
964 **
965 ** Returns          tBTM_STATUS
966 **
967 *******************************************************************************/
968 BTM_API extern tBTM_STATUS BTM_BleSetStorageConfig(UINT8 batch_scan_full_max,
969                                         UINT8 batch_scan_trunc_max,
970                                         UINT8 batch_scan_notify_threshold,
971                                         tBTM_BLE_SCAN_SETUP_CBACK *p_setup_cback,
972                                         tBTM_BLE_SCAN_THRESHOLD_CBACK *p_thres_cback,
973                                         tBTM_BLE_SCAN_REP_CBACK* p_cback,
974                                         tBTM_BLE_REF_VALUE ref_value);
975 
976 /*******************************************************************************
977 **
978 ** Function         BTM_BleEnableBatchScan
979 **
980 ** Description      This function is called to enable batch scan
981 **
982 ** Parameters       tBTM_BLE_BATCH_SCAN_MODE scan_mode - Batch scan mode
983                     UINT32 scan_interval -Scan interval
984                     UINT32 scan_window - Scan window value
985                     tBLE_ADDR_TYPE addr_type - Address type
986                     tBTM_BLE_DISCARD_RULE discard_rule - Data discard rules
987 **
988 ** Returns          tBTM_STATUS
989 **
990 *******************************************************************************/
991 BTM_API extern tBTM_STATUS BTM_BleEnableBatchScan(tBTM_BLE_BATCH_SCAN_MODE scan_mode,
992                                         UINT32 scan_interval, UINT32 scan_window,
993                                         tBTM_BLE_DISCARD_RULE discard_rule,
994                                         tBLE_ADDR_TYPE addr_type,
995                                         tBTM_BLE_REF_VALUE ref_value);
996 
997 /*******************************************************************************
998 **
999 ** Function         BTM_BleDisableBatchScan
1000 **
1001 ** Description      This function is called to disable batch scanning
1002 **
1003 ** Parameters       void
1004 **
1005 ** Returns          void
1006 **
1007 *******************************************************************************/
1008 BTM_API extern tBTM_STATUS BTM_BleDisableBatchScan(tBTM_BLE_REF_VALUE ref_value);
1009 
1010 /*******************************************************************************
1011 **
1012 ** Function         BTM_BleReadScanReports
1013 **
1014 ** Description      This function is called to read batch scan reports
1015 **
1016 ** Parameters       tBTM_BLE_SCAN_MODE scan_mode - Scan mode report to be read out
1017                     tBTM_BLE_SCAN_REP_CBACK* p_cback - Reports callback
1018 **
1019 ** Returns          tBTM_STATUS
1020 **
1021 *******************************************************************************/
1022 BTM_API extern tBTM_STATUS BTM_BleReadScanReports(tBTM_BLE_SCAN_MODE scan_mode,
1023                                                   tBTM_BLE_REF_VALUE ref_value);
1024 
1025 /*******************************************************************************
1026 **
1027 ** Function         BTM_BleTrackAdvertiser
1028 **
1029 ** Description      This function is called to read batch scan reports
1030 **
1031 ** Parameters       p_track_cback - Tracking callback
1032 **                  ref_value - Reference value
1033 **
1034 ** Returns          tBTM_STATUS
1035 **
1036 *******************************************************************************/
1037 BTM_API extern tBTM_STATUS BTM_BleTrackAdvertiser(tBTM_BLE_TRACK_ADV_CBACK *p_track_cback,
1038                                                   tBTM_BLE_REF_VALUE ref_value);
1039 
1040 /*******************************************************************************
1041 **
1042 ** Function         BTM_BleWriteScanRsp
1043 **
1044 ** Description      This function is called to write LE scan response.
1045 **
1046 ** Parameters:      p_scan_rsp: scan response.
1047 **
1048 ** Returns          status
1049 **
1050 *******************************************************************************/
1051 BTM_API extern tBTM_STATUS BTM_BleWriteScanRsp(tBTM_BLE_AD_MASK data_mask,
1052                                                tBTM_BLE_ADV_DATA *p_data);
1053 
1054 /*******************************************************************************
1055 **
1056 ** Function         BTM_BleObserve
1057 **
1058 ** Description      This procedure keep the device listening for advertising
1059 **                  events from a broadcast device.
1060 **
1061 ** Parameters       start: start or stop observe.
1062 **
1063 ** Returns          void
1064 **
1065 *******************************************************************************/
1066 BTM_API extern tBTM_STATUS BTM_BleObserve(BOOLEAN start, UINT8 duration,
1067                            tBTM_INQ_RESULTS_CB *p_results_cb, tBTM_CMPL_CB *p_cmpl_cb);
1068 
1069 
1070 /*******************************************************************************
1071 **
1072 ** Function         BTM_GetDeviceIDRoot
1073 **
1074 ** Description      This function is called to read the local device identity
1075 **                  root.
1076 **
1077 ** Returns          void
1078 **                  the local device ER is copied into er
1079 **
1080 *******************************************************************************/
1081 BTM_API extern void BTM_GetDeviceIDRoot (BT_OCTET16 ir);
1082 
1083 /*******************************************************************************
1084 **
1085 ** Function         BTM_GetDeviceEncRoot
1086 **
1087 ** Description      This function is called to read the local device encryption
1088 **                  root.
1089 **
1090 ** Returns          void
1091 **                  the local device ER is copied into er
1092 **
1093 *******************************************************************************/
1094 BTM_API extern void BTM_GetDeviceEncRoot (BT_OCTET16 er);
1095 
1096 /*******************************************************************************
1097 **
1098 ** Function         BTM_GetDeviceDHK
1099 **
1100 ** Description      This function is called to read the local device DHK.
1101 **
1102 ** Returns          void
1103 **                  the local device DHK is copied into dhk
1104 **
1105 *******************************************************************************/
1106 BTM_API extern void BTM_GetDeviceDHK (BT_OCTET16 dhk);
1107 
1108 /*******************************************************************************
1109 **
1110 ** Function         BTM_SecurityGrant
1111 **
1112 ** Description      This function is called to grant security process.
1113 **
1114 ** Parameters       bd_addr - peer device bd address.
1115 **                  res     - result of the operation BTM_SUCCESS if success.
1116 **                            Otherwise, BTM_REPEATED_ATTEMPTS is too many attempts.
1117 **
1118 ** Returns          None
1119 **
1120 *******************************************************************************/
1121 BTM_API extern void BTM_SecurityGrant(BD_ADDR bd_addr, UINT8 res);
1122 
1123 /*******************************************************************************
1124 **
1125 ** Function         BTM_BlePasskeyReply
1126 **
1127 ** Description      This function is called after Security Manager submitted
1128 **                  passkey request to the application.
1129 **
1130 ** Parameters:      bd_addr      - Address of the device for which passkey was requested
1131 **                  res          - result of the operation SMP_SUCCESS if success
1132 **                  passkey - numeric value in the range of
1133 **                  BTM_MIN_PASSKEY_VAL(0) - BTM_MAX_PASSKEY_VAL(999999(0xF423F)).
1134 **
1135 *******************************************************************************/
1136 BTM_API extern void BTM_BlePasskeyReply (BD_ADDR bd_addr, UINT8 res, UINT32 passkey);
1137 
1138 /*******************************************************************************
1139 **
1140 ** Function         BTM_LeOobDataReply
1141 **
1142 ** Description      This function is called to provide the OOB data for
1143 **                  SMP in response to BTM_LE_OOB_REQ_EVT
1144 **
1145 ** Parameters:      bd_addr     - Address of the peer device
1146 **                  res         - result of the operation SMP_SUCCESS if success
1147 **                  p_data      - simple pairing Randomizer  C.
1148 **
1149 *******************************************************************************/
1150 BTM_API extern void BTM_BleOobDataReply(BD_ADDR bd_addr, UINT8 res, UINT8 len, UINT8 *p_data);
1151 
1152 
1153 /*******************************************************************************
1154 **
1155 ** Function         BTM_BleDataSignature
1156 **
1157 ** Description      This function is called to sign the data using AES128 CMAC
1158 **                  algorith.
1159 **
1160 ** Parameter        bd_addr: target device the data to be signed for.
1161 **                  p_text: singing data
1162 **                  len: length of the signing data
1163 **                  signature: output parameter where data signature is going to
1164 **                             be stored.
1165 **
1166 ** Returns          TRUE if signing sucessul, otherwise FALSE.
1167 **
1168 *******************************************************************************/
1169 BTM_API extern BOOLEAN BTM_BleDataSignature (BD_ADDR bd_addr, UINT8 *p_text, UINT16 len,
1170                                              BLE_SIGNATURE signature);
1171 
1172 /*******************************************************************************
1173 **
1174 ** Function         BTM_BleVerifySignature
1175 **
1176 ** Description      This function is called to verify the data signature
1177 **
1178 ** Parameter        bd_addr: target device the data to be signed for.
1179 **                  p_orig:  original data before signature.
1180 **                  len: length of the signing data
1181 **                  counter: counter used when doing data signing
1182 **                  p_comp: signature to be compared against.
1183 
1184 ** Returns          TRUE if signature verified correctly; otherwise FALSE.
1185 **
1186 *******************************************************************************/
1187 BTM_API extern BOOLEAN BTM_BleVerifySignature (BD_ADDR bd_addr, UINT8 *p_orig,
1188                                             UINT16 len, UINT32 counter,
1189                                             UINT8 *p_comp);
1190 
1191 /*******************************************************************************
1192 **
1193 ** Function         BTM_ReadConnectionAddr
1194 **
1195 ** Description      This function is called to set the local device random address
1196 **                  .
1197 **
1198 ** Returns          void
1199 **
1200 *******************************************************************************/
1201 BTM_API extern void BTM_ReadConnectionAddr (BD_ADDR remote_bda, BD_ADDR local_conn_addr,
1202                                             tBLE_ADDR_TYPE *p_addr_type);
1203 
1204 
1205 
1206 /*******************************************************************************
1207 **
1208 ** Function         BTM_ReadRemoteConnectionAddr
1209 **
1210 ** Description      This function is read the remote device address currently used
1211 **                  .
1212 **
1213 ** Returns          void
1214 **
1215 *******************************************************************************/
1216 BTM_API extern BOOLEAN BTM_ReadRemoteConnectionAddr(BD_ADDR pseudo_addr,
1217                                                     BD_ADDR conn_addr,
1218                                                     tBLE_ADDR_TYPE *p_addr_type);
1219 
1220 /*******************************************************************************
1221 **
1222 ** Function         BTM_BleLoadLocalKeys
1223 **
1224 ** Description      Local local identity key, encryption root or sign counter.
1225 **
1226 ** Parameters:      key_type: type of key, can be BTM_BLE_KEY_TYPE_ID, BTM_BLE_KEY_TYPE_ER
1227 **                            or BTM_BLE_KEY_TYPE_COUNTER.
1228 **                  p_key: pointer to the key.
1229 *
1230 ** Returns          non2.
1231 **
1232 *******************************************************************************/
1233 BTM_API extern void BTM_BleLoadLocalKeys(UINT8 key_type, tBTM_BLE_LOCAL_KEYS *p_key);
1234 
1235 
1236 /*******************************************************************************
1237 **
1238 ** Function         BTM_BleSetBgConnType
1239 **
1240 ** Description      This function is called to set BLE background connection
1241 **                  procedure type. It can be auto connection, or selective connection.
1242 **
1243 ** Parameters       conn_type: it can be auto connection, or selective connection.
1244 **                  p_select_cback: callback function when selective connection procedure
1245 **                              is being used.
1246 **
1247 ** Returns          void
1248 **
1249 *******************************************************************************/
1250 BTM_API extern BOOLEAN BTM_BleSetBgConnType(tBTM_BLE_CONN_TYPE   conn_type,
1251                                     tBTM_BLE_SEL_CBACK   *p_select_cback);
1252 
1253 /*******************************************************************************
1254 **
1255 ** Function         BTM_BleUpdateBgConnDev
1256 **
1257 ** Description      This function is called to add or remove a device into/from
1258 **                  background connection procedure. The background connection
1259 *                   procedure is decided by the background connection type, it can be
1260 *                   auto connection, or selective connection.
1261 **
1262 ** Parameters       add_remove: TRUE to add; FALSE to remove.
1263 **                  remote_bda: device address to add/remove.
1264 **
1265 ** Returns          void
1266 **
1267 *******************************************************************************/
1268 BTM_API extern BOOLEAN BTM_BleUpdateBgConnDev(BOOLEAN add_remove, BD_ADDR   remote_bda);
1269 
1270 /*******************************************************************************
1271 **
1272 ** Function         BTM_BleClearBgConnDev
1273 **
1274 ** Description      This function is called to clear the whitelist,
1275 **                  end any pending whitelist connections,
1276 *                   and reset the local bg device list.
1277 **
1278 ** Parameters       void
1279 **
1280 ** Returns          void
1281 **
1282 *******************************************************************************/
1283 BTM_API extern void BTM_BleClearBgConnDev(void);
1284 
1285 /********************************************************
1286 **
1287 ** Function         BTM_BleSetPrefConnParams
1288 **
1289 ** Description      Set a peripheral's preferred connection parameters. When
1290 **                  any of the value does not want to be updated while others
1291 **                  do, use BTM_BLE_CONN_PARAM_UNDEF for the ones want to
1292 **                  leave untouched.
1293 **
1294 ** Parameters:      bd_addr          - BD address of the peripheral
1295 **                  min_conn_int     - minimum preferred connection interval
1296 **                  max_conn_int     - maximum preferred connection interval
1297 **                  slave_latency    - preferred slave latency
1298 **                  supervision_tout - preferred supervision timeout
1299 **
1300 ** Returns          void
1301 **
1302 *******************************************************************************/
1303 BTM_API extern  void BTM_BleSetPrefConnParams (BD_ADDR bd_addr,
1304                                                UINT16 min_conn_int,  UINT16 max_conn_int,
1305                                                UINT16 slave_latency, UINT16 supervision_tout);
1306 
1307 /******************************************************************************
1308 **
1309 ** Function         BTM_BleSetConnScanParams
1310 **
1311 ** Description      Set scan parameters used in BLE connection request
1312 **
1313 ** Parameters:      scan_interval    - scan interval
1314 **                  scan_window      - scan window
1315 **
1316 ** Returns          void
1317 **
1318 *******************************************************************************/
1319 BTM_API extern  void BTM_BleSetConnScanParams (UINT16 scan_interval, UINT16 scan_window);
1320 
1321 /******************************************************************************
1322 **
1323 ** Function         BTM_BleReadControllerFeatures
1324 **
1325 ** Description      Reads BLE specific controller features
1326 **
1327 ** Parameters:      tBTM_BLE_CTRL_FEATURES_CBACK : Callback to notify when features are read
1328 **
1329 ** Returns          void
1330 **
1331 *******************************************************************************/
1332 BTM_API extern void BTM_BleReadControllerFeatures(tBTM_BLE_CTRL_FEATURES_CBACK  *p_vsc_cback);
1333 
1334 /*******************************************************************************
1335 **
1336 ** Function         BTM_CheckAdvData
1337 **
1338 ** Description      This function is called to get ADV data for a specific type.
1339 **
1340 ** Parameters       p_adv - pointer of ADV data
1341 **                  type   - finding ADV data type
1342 **                  p_length - return the length of ADV data not including type
1343 **
1344 ** Returns          pointer of ADV data
1345 **
1346 *******************************************************************************/
1347 BTM_API extern  UINT8 *BTM_CheckAdvData( UINT8 *p_adv, UINT8 type, UINT8 *p_length);
1348 
1349 /*******************************************************************************
1350 **
1351 ** Function         BTM_ReadDevInfo
1352 **
1353 ** Description      This function is called to read the device/address type
1354 **                  of BD address.
1355 **
1356 ** Parameter        remote_bda: remote device address
1357 **                  p_dev_type: output parameter to read the device type.
1358 **                  p_addr_type: output parameter to read the address type.
1359 **
1360 *******************************************************************************/
1361 BTM_API extern void BTM_ReadDevInfo (BD_ADDR remote_bda, tBT_DEVICE_TYPE *p_dev_type,
1362                                      tBLE_ADDR_TYPE *p_addr_type);
1363 
1364 /*******************************************************************************
1365 **
1366 ** Function         BTM_BleBroadcast
1367 **
1368 ** Description      This function is to start or stop broadcasting.
1369 **
1370 ** Parameters       start: start or stop broadcasting.
1371 **
1372 ** Returns          status.
1373 **
1374 *******************************************************************************/
1375 BTM_API extern tBTM_STATUS BTM_BleBroadcast(BOOLEAN start);
1376 
1377 /*******************************************************************************
1378 **
1379 ** Function         BTM_RegisterScanReqEvt
1380 **
1381 ** Description      This function is called to register a scan request callback
1382 **                  on the advertiser.
1383 **
1384 ** Parameters       p_scan_req_cback: scan request callback.  If NULL, remove the
1385 **                                    registration.
1386 **
1387 ** Returns          void
1388 **
1389 *******************************************************************************/
1390 BTM_API extern void BTM_RegisterScanReqEvt(tBTM_BLE_SCAN_REQ_CBACK *p_scan_req_cback);
1391 
1392 /*******************************************************************************
1393 **
1394 ** Function         BTM_BleConfigPrivacy
1395 **
1396 ** Description      This function is called to enable or disable the privacy in
1397 **                  the local device.
1398 **
1399 ** Parameters       enable: TRUE to enable it; FALSE to disable it.
1400 **
1401 ** Returns          void
1402 **
1403 *******************************************************************************/
1404 BTM_API extern void BTM_BleConfigPrivacy(BOOLEAN enable);
1405 
1406 /*******************************************************************************
1407 **
1408 ** Function         BTM_BleLocalPrivacyEnabled
1409 **
1410 ** Description        Checks if local device supports private address
1411 **
1412 ** Returns          Return TRUE if local privacy is enabled else FALSE
1413 **
1414 *******************************************************************************/
1415 BTM_API extern BOOLEAN BTM_BleLocalPrivacyEnabled();
1416 
1417 /*******************************************************************************
1418 **
1419 ** Function          BTM_BleMaxMultiAdvInstanceCount
1420 **
1421 ** Description        Returns max number of multi adv instances  supported by controller
1422 **
1423 ** Returns          Max multi adv instance count
1424 **
1425 *******************************************************************************/
1426 BTM_API extern UINT8  BTM_BleMaxMultiAdvInstanceCount();
1427 
1428 /*******************************************************************************
1429 **
1430 ** Function         BTM_BleSetConnMode
1431 **
1432 ** Description      This function is called to set BLE connectable mode for a
1433 **                  peripheral device.
1434 **
1435 ** Parameters       directed: is directed connectable mode, or non-directed.
1436 **                  p_dir_bda: connectable direct initiator's LE device address
1437 **
1438 ** Returns          void
1439 **
1440 *******************************************************************************/
1441 BTM_API extern tBTM_STATUS BTM_BleSetConnMode(BOOLEAN directed);
1442 
1443 /*******************************************************************************
1444 **
1445 ** Function         BTM_BleTurnOnPrivacyOnRemote
1446 **
1447 ** Description      This function is called to enable or disable the privacy on the
1448 **                  remote device.
1449 **
1450 ** Parameters       bd_addr: remote device address.
1451 **                  privacy_on: TRUE to enable it; FALSE to disable it.
1452 **
1453 ** Returns          void
1454 **
1455 *******************************************************************************/
1456 BTM_API extern void BTM_BleTurnOnPrivacyOnRemote(BD_ADDR bd_addr,
1457                                                  BOOLEAN privacy_on);
1458 
1459 
1460 /*******************************************************************************
1461 **
1462 ** Function         BTM_BleUpdateAdvWhitelist
1463 **
1464 ** Description      Add or remove device from advertising white list
1465 **
1466 ** Returns          void
1467 **
1468 *******************************************************************************/
1469 BTM_API extern BOOLEAN BTM_BleUpdateAdvWhitelist(BOOLEAN add_remove, BD_ADDR emote_bda);
1470 
1471 /*******************************************************************************
1472 **
1473 ** Function         BTM_BleUpdateAdvFilterPolicy
1474 **
1475 ** Description      This function update the filter policy of advertiser.
1476 **
1477 ** Parameter        adv_policy: advertising filter policy
1478 **
1479 ** Return           void
1480 *******************************************************************************/
1481 BTM_API extern void BTM_BleUpdateAdvFilterPolicy(tBTM_BLE_AFP adv_policy);
1482 
1483 /*******************************************************************************
1484 **
1485 ** Function         BTM_BleReceiverTest
1486 **
1487 ** Description      This function is called to start the LE Receiver test
1488 **
1489 ** Parameter       rx_freq - Frequency Range
1490 **               p_cmd_cmpl_cback - Command Complete callback
1491 **
1492 *******************************************************************************/
1493 void BTM_BleReceiverTest(UINT8 rx_freq, tBTM_CMPL_CB *p_cmd_cmpl_cback);
1494 
1495 
1496 /*******************************************************************************
1497 **
1498 ** Function         BTM_BleTransmitterTest
1499 **
1500 ** Description      This function is called to start the LE Transmitter test
1501 **
1502 ** Parameter       tx_freq - Frequency Range
1503 **                       test_data_len - Length in bytes of payload data in each packet
1504 **                       packet_payload - Pattern to use in the payload
1505 **                       p_cmd_cmpl_cback - Command Complete callback
1506 **
1507 *******************************************************************************/
1508 void BTM_BleTransmitterTest(UINT8 tx_freq, UINT8 test_data_len,
1509                                  UINT8 packet_payload, tBTM_CMPL_CB *p_cmd_cmpl_cback);
1510 
1511 /*******************************************************************************
1512 **
1513 ** Function         BTM_BleTestEnd
1514 **
1515 ** Description      This function is called to stop the in-progress TX or RX test
1516 **
1517 ** Parameter       p_cmd_cmpl_cback - Command complete callback
1518 **
1519 *******************************************************************************/
1520 void BTM_BleTestEnd(tBTM_CMPL_CB *p_cmd_cmpl_cback);
1521 
1522 /*******************************************************************************
1523 **
1524 ** Function         BTM_UseLeLink
1525 **
1526 ** Description      This function is to select the underneath physical link to use.
1527 **
1528 ** Returns          TRUE to use LE, FALSE use BR/EDR.
1529 **
1530 *******************************************************************************/
1531 BTM_API extern BOOLEAN BTM_UseLeLink (BD_ADDR bd_addr);
1532 
1533 /*******************************************************************************
1534 **
1535 ** Function         BTM_BleStackEnable
1536 **
1537 ** Description      Enable/Disable BLE functionality on stack regarless controller
1538 **                  capability.
1539 **
1540 ** Parameters:      enable: TRUE to enable, FALSE to disable.
1541 **
1542 ** Returns          TRUE if added OK, else FALSE
1543 **
1544 *******************************************************************************/
1545 BTM_API extern tBTM_STATUS BTM_BleStackEnable (BOOLEAN enable);
1546 
1547 /*******************************************************************************/
1548 /*                          Multi ADV API                                      */
1549 /*******************************************************************************
1550 **
1551 ** Function         BTM_BleEnableAdvInstance
1552 **
1553 ** Description      This function enable a Multi-ADV instance with the specified
1554 **                  adv parameters
1555 **
1556 ** Parameters       p_params: pointer to the adv parameter structure, set as default
1557 **                            adv parameter when the instance is enabled.
1558 **                  p_cback: callback function for the adv instance.
1559 **                  p_ref:  reference data attach to the adv instance to be enabled.
1560 **
1561 ** Returns          status
1562 **
1563 *******************************************************************************/
1564 BTM_API extern tBTM_STATUS BTM_BleEnableAdvInstance (tBTM_BLE_ADV_PARAMS *p_params,
1565                                       tBTM_BLE_MULTI_ADV_CBACK *p_cback,
1566                                       void *p_ref);
1567 
1568 /*******************************************************************************
1569 **
1570 ** Function         BTM_BleUpdateAdvInstParam
1571 **
1572 ** Description      This function update a Multi-ADV instance with the specififed
1573 **                  adv parameters.
1574 **
1575 ** Parameters       inst_id: adv instance ID
1576 **                  p_params: pointer to the adv parameter structure.
1577 **
1578 ** Returns          status
1579 **
1580 *******************************************************************************/
1581 BTM_API extern tBTM_STATUS BTM_BleUpdateAdvInstParam (UINT8 inst_id, tBTM_BLE_ADV_PARAMS *p_params);
1582 
1583 /*******************************************************************************
1584 **
1585 ** Function         BTM_BleCfgAdvInstData
1586 **
1587 ** Description      This function configure a Multi-ADV instance with the specified
1588 **                  adv data or scan response data.
1589 **
1590 ** Parameters       inst_id: adv instance ID
1591 **                  is_scan_rsp: is this scacn response, if no set as adv data.
1592 **                  data_mask: adv data mask.
1593 **                  p_data: pointer to the adv data structure.
1594 **
1595 ** Returns          status
1596 **
1597 *******************************************************************************/
1598 BTM_API extern tBTM_STATUS BTM_BleCfgAdvInstData (UINT8 inst_id, BOOLEAN is_scan_rsp,
1599                                     tBTM_BLE_AD_MASK data_mask,
1600                                     tBTM_BLE_ADV_DATA *p_data);
1601 
1602 /*******************************************************************************
1603 **
1604 ** Function         BTM_BleDisableAdvInstance
1605 **
1606 ** Description      This function disable a Multi-ADV instance.
1607 **
1608 ** Parameters       inst_id: adv instance ID
1609 **
1610 ** Returns          status
1611 **
1612 *******************************************************************************/
1613 BTM_API extern tBTM_STATUS BTM_BleDisableAdvInstance (UINT8 inst_id);
1614 
1615 /*******************************************************************************
1616 **
1617 ** Function         BTM_BleAdvFilterParamSetup
1618 **
1619 ** Description      This function is called to setup the adv data payload filter
1620 **                  condition.
1621 **
1622 ** Parameters       p_target: enabble the filter condition on a target device; if NULL
1623 **                            enable the generic scan condition.
1624 **                  enable: enable or disable the filter condition
1625 **
1626 ** Returns          void
1627 **
1628 *******************************************************************************/
1629 BTM_API extern tBTM_STATUS BTM_BleAdvFilterParamSetup(int action,
1630                                 tBTM_BLE_PF_FILT_INDEX filt_index,
1631                                 tBTM_BLE_PF_FILT_PARAMS *p_filt_params,
1632                                 tBLE_BD_ADDR *p_target, tBTM_BLE_PF_PARAM_CBACK *p_cmpl_cback,
1633                                 tBTM_BLE_REF_VALUE ref_value);
1634 
1635 /*******************************************************************************
1636 **
1637 ** Function         BTM_BleCfgFilterCondition
1638 **
1639 ** Description      This function is called to configure the adv data payload filter
1640 **                  condition.
1641 **
1642 ** Parameters       action: to read/write/clear
1643 **                  cond_type: filter condition type.
1644 **                  p_cond: filter condition paramter
1645 **
1646 ** Returns          tBTM_STATUS
1647 **
1648 *******************************************************************************/
1649 BTM_API extern tBTM_STATUS BTM_BleCfgFilterCondition(tBTM_BLE_SCAN_COND_OP action,
1650                                       tBTM_BLE_PF_COND_TYPE cond_type,
1651                                       tBTM_BLE_PF_FILT_INDEX filt_index,
1652                                       tBTM_BLE_PF_COND_PARAM *p_cond,
1653                                       tBTM_BLE_PF_CFG_CBACK *p_cmpl_cback,
1654                                       tBTM_BLE_REF_VALUE ref_value);
1655 
1656 /*******************************************************************************
1657 **
1658 ** Function         BTM_BleEnableDisableFilterFeature
1659 **
1660 ** Description      This function is called to enable or disable the APCF feature
1661 **
1662 ** Parameters       enable - TRUE - enables the APCF, FALSE - disables the APCF
1663 **                       ref_value - Ref value
1664 **
1665 ** Returns          tBTM_STATUS
1666 **
1667 *******************************************************************************/
1668 BTM_API extern tBTM_STATUS BTM_BleEnableDisableFilterFeature(UINT8 enable,
1669                                                tBTM_BLE_PF_STATUS_CBACK *p_stat_cback,
1670                                                tBTM_BLE_REF_VALUE ref_value);
1671 
1672 /*******************************************************************************
1673 **
1674 ** Function         BTM_BleGetEnergyInfo
1675 **
1676 ** Description      This function obtains the energy info
1677 **
1678 ** Parameters       p_ener_cback - Callback pointer
1679 **
1680 ** Returns          status
1681 **
1682 *******************************************************************************/
1683 BTM_API extern tBTM_STATUS BTM_BleGetEnergyInfo(tBTM_BLE_ENERGY_INFO_CBACK *p_ener_cback);
1684 
1685 #ifdef __cplusplus
1686 }
1687 #endif
1688 
1689 #endif
1690