bta_api.h revision 87776cf5e201b18646cbc16f11a7110d5ffe510c
1/******************************************************************************
2 *
3 *  Copyright (C) 2003-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 is the public interface file for BTA, Broadcom's Bluetooth
22 *  application layer for mobile phones.
23 *
24 ******************************************************************************/
25#ifndef BTA_API_H
26#define BTA_API_H
27
28#include "data_types.h"
29#include "bt_target.h"
30#include "bt_types.h"
31#include "btm_api.h"
32#include "uipc_msg.h"
33
34#if BLE_INCLUDED == TRUE
35#include "btm_ble_api.h"
36#endif
37
38/*****************************************************************************
39**  Constants and data types
40*****************************************************************************/
41
42/* Status Return Value */
43#define BTA_SUCCESS             0           /* Successful operation. */
44#define BTA_FAILURE             1           /* Generic failure. */
45#define BTA_PENDING             2           /* API cannot be completed right now */
46#define BTA_BUSY                3
47#define BTA_NO_RESOURCES        4
48#define BTA_WRONG_MODE          5
49
50typedef UINT8 tBTA_STATUS;
51
52/*
53 * Service ID
54 *
55 * NOTES: When you add a new Service ID for BTA AND require to change the value of BTA_MAX_SERVICE_ID,
56 *        make sure that the correct security ID of the new service from Security service definitions (btm_api.h)
57 *        should be added to bta_service_id_to_btm_srv_id_lkup_tbl table in bta_dm_act.c.
58 */
59
60#define BTA_RES_SERVICE_ID      0           /* Reserved */
61#define BTA_SPP_SERVICE_ID      1           /* Serial port profile. */
62#define BTA_DUN_SERVICE_ID      2           /* Dial-up networking profile. */
63#define BTA_A2DP_SOURCE_SERVICE_ID      3   /* A2DP Source profile. */
64#define BTA_LAP_SERVICE_ID      4           /* LAN access profile. */
65#define BTA_HSP_SERVICE_ID      5           /* Headset profile. */
66#define BTA_HFP_SERVICE_ID      6           /* Hands-free profile. */
67#define BTA_OPP_SERVICE_ID      7           /* Object push  */
68#define BTA_FTP_SERVICE_ID      8           /* File transfer */
69#define BTA_CTP_SERVICE_ID      9           /* Cordless Terminal */
70#define BTA_ICP_SERVICE_ID      10          /* Intercom Terminal */
71#define BTA_SYNC_SERVICE_ID     11          /* Synchronization */
72#define BTA_BPP_SERVICE_ID      12          /* Basic printing profile */
73#define BTA_BIP_SERVICE_ID      13          /* Basic Imaging profile */
74#define BTA_PANU_SERVICE_ID     14          /* PAN User */
75#define BTA_NAP_SERVICE_ID      15          /* PAN Network access point */
76#define BTA_GN_SERVICE_ID       16          /* PAN Group Ad-hoc networks */
77#define BTA_SAP_SERVICE_ID      17          /* SIM Access profile */
78#define BTA_A2DP_SERVICE_ID     18          /* A2DP Sink */
79#define BTA_AVRCP_SERVICE_ID    19          /* A/V remote control */
80#define BTA_HID_SERVICE_ID      20          /* HID */
81#define BTA_VDP_SERVICE_ID      21          /* Video distribution */
82#define BTA_PBAP_SERVICE_ID     22          /* PhoneBook Access Server*/
83#define BTA_HSP_HS_SERVICE_ID   23          /* HFP HS role */
84#define BTA_HFP_HS_SERVICE_ID   24          /* HSP HS role */
85#define BTA_MAP_SERVICE_ID      25          /* Message Access Profile */
86#define BTA_MN_SERVICE_ID       26          /* Message Notification Service */
87#define BTA_HDP_SERVICE_ID      27          /* Health Device Profile */
88#define BTA_PCE_SERVICE_ID      28          /* PhoneBook Access Client*/
89
90#if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE
91/* BLE profile service ID */
92#define BTA_BLE_SERVICE_ID      29          /* GATT profile */
93
94// btla-specific ++
95#define BTA_USER_SERVICE_ID     30          /* User requested UUID */
96
97#define BTA_MAX_SERVICE_ID      31
98// btla-specific --
99#else
100#define BTA_USER_SERVICE_ID     29          /* User requested UUID */
101#define BTA_MAX_SERVICE_ID      30
102#endif
103/* service IDs (BTM_SEC_SERVICE_FIRST_EMPTY + 1) to (BTM_SEC_MAX_SERVICES - 1)
104 * are used by BTA JV */
105#define BTA_FIRST_JV_SERVICE_ID     (BTM_SEC_SERVICE_FIRST_EMPTY + 1)
106#define BTA_LAST_JV_SERVICE_ID      (BTM_SEC_MAX_SERVICES - 1)
107
108typedef UINT8 tBTA_SERVICE_ID;
109
110/* Service ID Mask */
111#define BTA_RES_SERVICE_MASK        0x00000001  /* Reserved */
112#define BTA_SPP_SERVICE_MASK        0x00000002  /* Serial port profile. */
113#define BTA_DUN_SERVICE_MASK        0x00000004  /* Dial-up networking profile. */
114#define BTA_FAX_SERVICE_MASK        0x00000008  /* Fax profile. */
115#define BTA_LAP_SERVICE_MASK        0x00000010  /* LAN access profile. */
116#define BTA_HSP_SERVICE_MASK        0x00000020  /* HSP AG role. */
117#define BTA_HFP_SERVICE_MASK        0x00000040  /* HFP AG role */
118#define BTA_OPP_SERVICE_MASK        0x00000080  /* Object push  */
119#define BTA_FTP_SERVICE_MASK        0x00000100  /* File transfer */
120#define BTA_CTP_SERVICE_MASK        0x00000200  /* Cordless Terminal */
121#define BTA_ICP_SERVICE_MASK        0x00000400  /* Intercom Terminal */
122#define BTA_SYNC_SERVICE_MASK       0x00000800  /* Synchronization */
123#define BTA_BPP_SERVICE_MASK        0x00001000  /* Print server */
124#define BTA_BIP_SERVICE_MASK        0x00002000  /* Basic Imaging */
125#define BTA_PANU_SERVICE_MASK       0x00004000  /* PAN User */
126#define BTA_NAP_SERVICE_MASK        0x00008000  /* PAN Network access point */
127#define BTA_GN_SERVICE_MASK         0x00010000  /* PAN Group Ad-hoc networks */
128#define BTA_SAP_SERVICE_MASK        0x00020000  /* PAN Group Ad-hoc networks */
129#define BTA_A2DP_SERVICE_MASK       0x00040000  /* Advanced audio distribution */
130#define BTA_AVRCP_SERVICE_MASK      0x00080000  /* A/V remote control */
131#define BTA_HID_SERVICE_MASK        0x00100000  /* HID */
132#define BTA_VDP_SERVICE_MASK        0x00200000  /* Video distribution */
133#define BTA_PBAP_SERVICE_MASK       0x00400000  /* Phone Book Server */
134#define BTA_HSP_HS_SERVICE_MASK     0x00800000  /* HFP HS role */
135#define BTA_HFP_HS_SERVICE_MASK     0x01000000  /* HSP HS role */
136#define BTA_MAS_SERVICE_MASK        0x02000000  /* Message Access Profile */
137#define BTA_MN_SERVICE_MASK         0x04000000  /* Message Notification Profile */
138#define BTA_HL_SERVICE_MASK         0x08000000  /* Health Device Profile */
139#define BTA_PCE_SERVICE_MASK        0x10000000  /* Phone Book Client */
140
141#if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE
142#define BTA_BLE_SERVICE_MASK        0x20000000  /* GATT based service */
143// btla-specific ++
144#define BTA_USER_SERVICE_MASK       0x40000000  /* Message Notification Profile */
145// btla-specific --
146#else
147// btla-specific ++
148#define BTA_USER_SERVICE_MASK       0x20000000  /* Message Notification Profile */
149// btla-specific --
150#endif
151
152#if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE
153#define BTA_ALL_SERVICE_MASK        0x3FFFFFFF  /* All services supported by BTA. */
154#else
155#define BTA_ALL_SERVICE_MASK        0x1FFFFFFF  /* All services supported by BTA. */
156#endif
157
158typedef UINT32 tBTA_SERVICE_MASK;
159
160/* extended service mask, including mask with one or more GATT UUID */
161typedef struct
162{
163    tBTA_SERVICE_MASK   srvc_mask;
164    UINT8               num_uuid;
165    tBT_UUID            *p_uuid;
166}tBTA_SERVICE_MASK_EXT;
167
168/* Security Setting Mask */
169#define BTA_SEC_NONE            BTM_SEC_NONE                                         /* No security. */
170#define BTA_SEC_AUTHORIZE       (BTM_SEC_IN_AUTHORIZE )                              /* Authorization required (only needed for out going connection )*/
171#define BTA_SEC_AUTHENTICATE    (BTM_SEC_IN_AUTHENTICATE | BTM_SEC_OUT_AUTHENTICATE) /* Authentication required. */
172#define BTA_SEC_ENCRYPT         (BTM_SEC_IN_ENCRYPT | BTM_SEC_OUT_ENCRYPT)           /* Encryption required. */
173
174typedef UINT8 tBTA_SEC;
175
176/* Ignore for Discoverable, Connectable, Pairable and Connectable Paired only device modes */
177
178#define BTA_DM_IGNORE           0xFF
179
180#define BTA_ALL_APP_ID          0xFF
181
182/* Discoverable Modes */
183#define BTA_DM_NON_DISC         BTM_NON_DISCOVERABLE        /* Device is not discoverable. */
184#define BTA_DM_GENERAL_DISC     BTM_GENERAL_DISCOVERABLE    /* General discoverable. */
185#define BTA_DM_LIMITED_DISC     BTM_LIMITED_DISCOVERABLE    /* Limited discoverable. */
186#if ((defined BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
187#define BTA_DM_BLE_NON_DISCOVERABLE        BTM_BLE_NON_DISCOVERABLE        /* Device is not LE discoverable */
188#define BTA_DM_BLE_GENERAL_DISCOVERABLE    BTM_BLE_GENERAL_DISCOVERABLE    /* Device is LE General discoverable */
189#define BTA_DM_BLE_LIMITED_DISCOVERABLE    BTM_BLE_LIMITED_DISCOVERABLE    /* Device is LE Limited discoverable */
190#endif
191typedef UINT16 tBTA_DM_DISC;        /* this discoverability mode is a bit mask among BR mode and LE mode */
192
193/* Connectable Modes */
194#define BTA_DM_NON_CONN         BTM_NON_CONNECTABLE         /* Device is not connectable. */
195#define BTA_DM_CONN             BTM_CONNECTABLE             /* Device is connectable. */
196#if ((defined BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
197#define BTA_DM_BLE_NON_CONNECTABLE      BTM_BLE_NON_CONNECTABLE     /* Device is LE non-connectable. */
198#define BTA_DM_BLE_CONNECTABLE          BTM_BLE_CONNECTABLE         /* Device is LE connectable. */
199#endif
200
201// btla-specific ++
202typedef UINT16 tBTA_DM_CONN;
203
204#define BTA_TRANSPORT_UNKNOWN   0
205#define BTA_TRANSPORT_BR_EDR    BT_TRANSPORT_BR_EDR
206#define BTA_TRANSPORT_LE        BT_TRANSPORT_LE
207typedef tBT_TRANSPORT tBTA_TRANSPORT;
208
209/* Pairable Modes */
210#define BTA_DM_PAIRABLE         1
211#define BTA_DM_NON_PAIRABLE     0
212
213/* Connectable Paired Only Mode */
214#define BTA_DM_CONN_ALL         0
215#define BTA_DM_CONN_PAIRED      1
216
217/* Inquiry Modes */
218#define BTA_DM_INQUIRY_NONE		BTM_INQUIRY_NONE            /*No BR inquiry. */
219#define BTA_DM_GENERAL_INQUIRY  BTM_GENERAL_INQUIRY         /* Perform general inquiry. */
220#define BTA_DM_LIMITED_INQUIRY  BTM_LIMITED_INQUIRY         /* Perform limited inquiry. */
221
222#if ((defined BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
223#define BTA_BLE_INQUIRY_NONE    BTM_BLE_INQUIRY_NONE
224#define BTA_BLE_GENERAL_INQUIRY BTM_BLE_GENERAL_INQUIRY      /* Perform LE general inquiry. */
225#define BTA_BLE_LIMITED_INQUIRY BTM_BLE_LIMITED_INQUIRY      /* Perform LE limited inquiry. */
226#endif
227typedef UINT8 tBTA_DM_INQ_MODE;
228
229/* Inquiry Filter Type */
230#define BTA_DM_INQ_CLR          BTM_CLR_INQUIRY_FILTER          /* Clear inquiry filter. */
231#define BTA_DM_INQ_DEV_CLASS    BTM_FILTER_COND_DEVICE_CLASS    /* Filter on device class. */
232#define BTA_DM_INQ_BD_ADDR      BTM_FILTER_COND_BD_ADDR         /* Filter on a specific  BD address. */
233
234typedef UINT8 tBTA_DM_INQ_FILT;
235
236/* Authorize Response */
237#define BTA_DM_AUTH_PERM        0      /* Authorized for future connections to the service */
238#define BTA_DM_AUTH_TEMP        1      /* Authorized for current connection only */
239#define BTA_DM_NOT_AUTH         2      /* Not authorized for the service */
240
241typedef UINT8 tBTA_AUTH_RESP;
242
243/* M/S preferred roles */
244#define BTA_ANY_ROLE          0x00
245#define BTA_MASTER_ROLE_PREF  0x01
246#define BTA_MASTER_ROLE_ONLY  0x02
247
248typedef UINT8 tBTA_PREF_ROLES;
249
250enum
251{
252
253    BTA_DM_NO_SCATTERNET,        /* Device doesn't support scatternet, it might
254                                    support "role switch during connection" for
255                                    an incoming connection, when it already has
256                                    another connection in master role */
257    BTA_DM_PARTIAL_SCATTERNET,   /* Device supports partial scatternet. It can have
258                                    simulateous connection in Master and Slave roles
259                                    for short period of time */
260    BTA_DM_FULL_SCATTERNET       /* Device can have simultaneous connection in master
261                                    and slave roles */
262
263};
264
265
266/* Inquiry filter device class condition */
267typedef struct
268{
269    DEV_CLASS       dev_class;        /* device class of interest */
270    DEV_CLASS       dev_class_mask;   /* mask to determine the bits of device class of interest */
271} tBTA_DM_COD_COND;
272
273
274/* Inquiry Filter Condition */
275typedef union
276{
277    BD_ADDR              bd_addr;            /* BD address of  device to filter. */
278    tBTA_DM_COD_COND     dev_class_cond;     /* Device class filter condition */
279} tBTA_DM_INQ_COND;
280
281/* Inquiry Parameters */
282typedef struct
283{
284    tBTA_DM_INQ_MODE    mode;           /* Inquiry mode, limited or general. */
285    UINT8               duration;       /* Inquiry duration in 1.28 sec units. */
286    UINT8               max_resps;      /* Maximum inquiry responses.  Set to zero for unlimited responses. */
287    BOOLEAN             report_dup;     /* report duplicated inquiry response with higher RSSI value */
288    tBTA_DM_INQ_FILT    filter_type;    /* Filter condition type. */
289    tBTA_DM_INQ_COND    filter_cond;    /* Filter condition data. */
290#if (defined(BTA_HOST_INTERLEAVE_SEARCH) && BTA_HOST_INTERLEAVE_SEARCH == TRUE)
291    UINT8               intl_duration[4];/*duration array storing the interleave scan's time portions*/
292#endif
293} tBTA_DM_INQ;
294
295typedef struct
296{
297    UINT8   bta_dm_eir_min_name_len;        /* minimum length of local name when it is shortened */
298#if (BTA_EIR_CANNED_UUID_LIST == TRUE)
299    UINT8   bta_dm_eir_uuid16_len;          /* length of 16-bit UUIDs */
300    UINT8  *bta_dm_eir_uuid16;              /* 16-bit UUIDs */
301#else
302    UINT32  uuid_mask[BTM_EIR_SERVICE_ARRAY_SIZE]; /* mask of UUID list in EIR */
303#endif
304    INT8   *bta_dm_eir_inq_tx_power;        /* Inquiry TX power         */
305    UINT8   bta_dm_eir_flag_len;            /* length of flags in bytes */
306    UINT8  *bta_dm_eir_flags;               /* flags for EIR */
307    UINT8   bta_dm_eir_manufac_spec_len;    /* length of manufacturer specific in bytes */
308    UINT8  *bta_dm_eir_manufac_spec;        /* manufacturer specific */
309    UINT8   bta_dm_eir_additional_len;      /* length of additional data in bytes */
310    UINT8  *bta_dm_eir_additional;          /* additional data */
311} tBTA_DM_EIR_CONF;
312
313#if BLE_INCLUDED == TRUE
314/* ADV data flag bit definition used for BTM_BLE_AD_TYPE_FLAG */
315#define BTA_BLE_LIMIT_DISC_FLAG     BTM_BLE_LIMIT_DISC_FLAG
316#define BTA_BLE_GEN_DISC_FLAG       BTM_BLE_GEN_DISC_FLAG
317#define BTA_BLE_BREDR_NOT_SPT       BTM_BLE_BREDR_NOT_SPT
318#define BTA_BLE_DMT_CONTROLLER_SPT  BTM_BLE_DMT_CONTROLLER_SPT
319#define BTA_BLE_DMT_HOST_SPT        BTM_BLE_DMT_HOST_SPT
320#define BTA_BLE_NON_LIMIT_DISC_FLAG BTM_BLE_NON_LIMIT_DISC_FLAG
321#define BTA_BLE_ADV_FLAG_MASK       BTM_BLE_ADV_FLAG_MASK
322#define BTA_BLE_LIMIT_DISC_MASK     BTM_BLE_LIMIT_DISC_MASK
323
324/* ADV data bit mask */
325#define BTA_BLE_AD_BIT_DEV_NAME        BTM_BLE_AD_BIT_DEV_NAME
326#define BTA_BLE_AD_BIT_FLAGS           BTM_BLE_AD_BIT_FLAGS
327#define BTA_BLE_AD_BIT_MANU            BTM_BLE_AD_BIT_MANU
328#define BTA_BLE_AD_BIT_TX_PWR          BTM_BLE_AD_BIT_TX_PWR
329#define BTA_BLE_AD_BIT_INT_RANGE       BTM_BLE_AD_BIT_INT_RANGE
330#define BTA_BLE_AD_BIT_SERVICE         BTM_BLE_AD_BIT_SERVICE
331#define BTA_BLE_AD_BIT_APPEARANCE      BTM_BLE_AD_BIT_APPEARANCE
332#define BTA_BLE_AD_BIT_PROPRIETARY     BTM_BLE_AD_BIT_PROPRIETARY
333#define BTA_DM_BLE_AD_BIT_SERVICE_SOL     BTM_BLE_AD_BIT_SERVICE_SOL
334#define BTA_DM_BLE_AD_BIT_SERVICE_DATA    BTM_BLE_AD_BIT_SERVICE_DATA
335#define BTA_DM_BLE_AD_BIT_SIGN_DATA       BTM_BLE_AD_BIT_SIGN_DATA
336#define BTA_DM_BLE_AD_BIT_SERVICE_128SOL  BTM_BLE_AD_BIT_SERVICE_128SOL
337#define BTA_DM_BLE_AD_BIT_PUBLIC_ADDR     BTM_BLE_AD_BIT_PUBLIC_ADDR
338#define BTA_DM_BLE_AD_BIT_RANDOM_ADDR     BTM_BLE_AD_BIT_RANDOM_ADDR
339#define BTA_DM_BLE_AD_BIT_SERVICE_128     BTM_BLE_AD_BIT_SERVICE_128      /*128-bit Service UUIDs*/
340
341typedef  tBTM_BLE_AD_MASK  tBTA_BLE_AD_MASK;
342
343/* slave preferred connection interval range */
344typedef struct
345{
346    UINT16  low;
347    UINT16  hi;
348
349}tBTA_BLE_INT_RANGE;
350
351/* Service tag supported in the device */
352typedef struct
353{
354    UINT8       num_service;
355    BOOLEAN     list_cmpl;
356    UINT16      *p_uuid;
357}tBTA_BLE_SERVICE;
358
359
360typedef struct
361{
362    UINT8       len;
363    UINT8      *p_val;
364}tBTA_BLE_MANU;
365
366typedef struct
367{
368    UINT8       adv_type;
369    UINT8       len;
370    UINT8       *p_val;     /* number of len byte */
371}tBTA_BLE_PROP_ELEM;
372
373/* vendor proprietary adv type */
374typedef struct
375{
376    UINT8                   num_elem;
377    tBTA_BLE_PROP_ELEM      *p_elem;
378}tBTA_BLE_PROPRIETARY;
379
380typedef struct
381{
382    tBT_UUID    service_uuid;
383    UINT8       len;
384    UINT8      *p_val;
385}tBTA_BLE_SERVICE_DATA;
386
387typedef tBTM_BLE_128SERVICE tBTA_BLE_128SERVICE;
388typedef tBTM_BLE_32SERVICE  tBTA_BLE_32SERVICE;
389
390typedef struct
391{
392    tBTA_BLE_INT_RANGE      int_range;          /* slave prefered conn interval range */
393    tBTA_BLE_MANU           *p_manu;            /* manufacturer data */
394    tBTA_BLE_SERVICE        *p_services;        /* 16 bits services */
395    tBTA_BLE_128SERVICE     *p_services_128b;   /* 128 bits service */
396    tBTA_BLE_32SERVICE      *p_service_32b;     /* 32 bits Service UUID */
397    tBTA_BLE_SERVICE        *p_sol_services;    /* 16 bits services Solicitation UUIDs */
398    tBTA_BLE_32SERVICE      *p_sol_service_32b; /* List of 32 bit Service Solicitation UUIDs */
399    tBTA_BLE_128SERVICE     *p_sol_service_128b;/* List of 128 bit Service Solicitation UUIDs */
400    tBTA_BLE_PROPRIETARY    *p_proprietary;     /* proprietary data */
401    tBTA_BLE_SERVICE_DATA   *p_service_data;    /* service data */
402    UINT16                  appearance;         /* appearance data */
403    UINT8                   flag;
404    UINT8                   tx_power;
405}tBTA_BLE_ADV_DATA;
406
407typedef void (tBTA_SET_ADV_DATA_CMPL_CBACK) (tBTA_STATUS status);
408
409/* advertising channel map */
410#define BTA_BLE_ADV_CHNL_37 BTM_BLE_ADV_CHNL_37
411#define BTA_BLE_ADV_CHNL_38 BTM_BLE_ADV_CHNL_38
412#define BTA_BLE_ADV_CHNL_39 BTM_BLE_ADV_CHNL_39
413typedef tBTM_BLE_ADV_CHNL_MAP tBTA_BLE_ADV_CHNL_MAP; /* use as a bit mask */
414
415/* advertising filter policy */
416typedef tBTM_BLE_AFP   tBTA_BLE_AFP;
417
418/* adv event type */
419#define BTA_BLE_CONNECT_EVT         BTM_BLE_CONNECT_EVT     /* Connectable undirected advertising */
420#define BTA_BLE_CONNECT_DIR_EVT     BTM_BLE_CONNECT_DIR_EVT /* Connectable directed advertising */
421#define BTA_BLE_DISCOVER_EVT        BTM_BLE_DISCOVER_EVT    /* Scannable undirected advertising */
422#define BTA_BLE_NON_CONNECT_EVT     BTM_BLE_NON_CONNECT_EVT /* Non connectable undirected advertising */
423typedef UINT8 tBTA_BLE_ADV_EVT;
424
425/* adv tx power level */
426#define BTA_BLE_ADV_TX_POWER_MIN        0           /* minimum tx power */
427#define BTA_BLE_ADV_TX_POWER_LOW        1           /* low tx power     */
428#define BTA_BLE_ADV_TX_POWER_MID        2           /* middle tx power  */
429#define BTA_BLE_ADV_TX_POWER_UPPER      3           /* upper tx power   */
430#define BTA_BLE_ADV_TX_POWER_MAX        4           /* maximum tx power */
431typedef UINT8 tBTA_BLE_ADV_TX_POWER;
432
433/* advertising instance parameters */
434typedef struct
435{
436    UINT16                  adv_int_min;            /* minimum adv interval */
437    UINT16                  adv_int_max;            /* maximum adv interval */
438    tBTA_BLE_ADV_EVT        adv_type;               /* adv event type */
439    tBTA_BLE_ADV_CHNL_MAP   channel_map;            /* adv channel map */
440    tBTA_BLE_AFP            adv_filter_policy;      /* advertising filter policy */
441    tBTA_BLE_ADV_TX_POWER   tx_power;               /* adv tx power */
442}tBTA_BLE_ADV_PARAMS;
443
444/* These are the fields returned in each device adv packet.  It
445** is returned in the results callback if registered.
446*/
447typedef struct
448{
449    UINT8               conn_mode;
450    tBTA_BLE_AD_MASK    ad_mask;        /* mask of the valid adv data field */
451    UINT8               flag;
452    UINT8               tx_power_level;
453    UINT8               remote_name_len;
454    UINT8               *p_remote_name;
455    tBTA_BLE_SERVICE    service;
456} tBTA_BLE_INQ_DATA;
457#endif
458
459/* BLE customer specific feature function type definitions */
460/* data type used on customer specific feature for RSSI monitoring */
461#define BTA_BLE_RSSI_ALERT_HI        0
462#define BTA_BLE_RSSI_ALERT_RANGE     1
463#define BTA_BLE_RSSI_ALERT_LO        2
464typedef UINT8 tBTA_DM_BLE_RSSI_ALERT_TYPE;
465
466#define BTA_BLE_RSSI_ALERT_NONE		    BTM_BLE_RSSI_ALERT_NONE		/*	(0) */
467#define BTA_BLE_RSSI_ALERT_HI_BIT		BTM_BLE_RSSI_ALERT_HI_BIT		/*	(1) */
468#define BTA_BLE_RSSI_ALERT_RANGE_BIT	BTM_BLE_RSSI_ALERT_RANGE_BIT	/*	(1 << 1) */
469#define BTA_BLE_RSSI_ALERT_LO_BIT		BTM_BLE_RSSI_ALERT_LO_BIT		/*	(1 << 2) */
470typedef UINT8     tBTA_DM_BLE_RSSI_ALERT_MASK;
471
472
473typedef void (tBTA_DM_BLE_RSSI_CBACK) (BD_ADDR bd_addr, tBTA_DM_BLE_RSSI_ALERT_TYPE alert_type, INT8 rssi);
474
475/* max number of filter spot for different filter type */
476#define BTA_DM_BLE_MAX_UUID_FILTER     BTM_BLE_MAX_UUID_FILTER    /* 8 */
477#define BTA_DM_BLE_MAX_ADDR_FILTER     BTM_BLE_MAX_ADDR_FILTER    /* 8 */
478#define BTA_DM_BLE_PF_STR_COND_MAX     BTM_BLE_PF_STR_COND_MAX    /* 4    apply to manu data , or local name */
479#define BTA_DM_BLE_PF_STR_LEN_MAX      BTM_BLE_PF_STR_LEN_MAX  /* match for first 20 bytes */
480
481#define BTA_DM_BLE_PF_LOGIC_OR              0
482#define BTA_DM_BLE_PF_LOGIC_AND             1
483typedef UINT8 tBTA_DM_BLE_PF_LOGIC_TYPE;
484
485enum
486{
487    BTA_DM_BLE_SCAN_COND_ADD,
488    BTA_DM_BLE_SCAN_COND_DELETE,
489    BTA_DM_BLE_SCAN_COND_CLEAR = 2
490};
491typedef UINT8 tBTA_DM_BLE_SCAN_COND_OP;
492
493/* filter selection bit index  */
494#define BTA_DM_BLE_PF_ADDR_FILTER          BTM_BLE_PF_ADDR_FILTER
495#define BTA_DM_BLE_PF_SRVC_DATA            BTM_BLE_PF_SRVC_DATA
496#define BTA_DM_BLE_PF_SRVC_UUID            BTM_BLE_PF_SRVC_UUID
497#define BTA_DM_BLE_PF_SRVC_SOL_UUID        BTM_BLE_PF_SRVC_SOL_UUID
498#define BTA_DM_BLE_PF_LOCAL_NAME           BTM_BLE_PF_LOCAL_NAME
499#define BTA_DM_BLE_PF_MANU_DATA            BTM_BLE_PF_MANU_DATA
500#define BTA_DM_BLE_PF_SRVC_DATA_PATTERN    BTM_BLE_PF_SRVC_DATA_PATTERN
501#define BTA_DM_BLE_PF_TYPE_MAX             BTM_BLE_PF_TYPE_MAX
502#define BTA_DM_BLE_PF_SRVC_DATA            BTM_BLE_PF_SRVC_DATA
503#define BTA_DM_BLE_PF_TYPE_ALL             BTM_BLE_PF_TYPE_ALL
504#define BTA_DM_BLE_PF_TYPE_MAX             BTM_BLE_PF_TYPE_MAX
505typedef UINT8   tBTA_DM_BLE_PF_COND_TYPE;
506
507typedef union
508{
509      UINT16              uuid16_mask;
510      UINT32              uuid32_mask;
511      UINT8               uuid128_mask[LEN_UUID_128];
512}tBTA_DM_BLE_PF_COND_MASK;
513
514typedef struct
515{
516    tBLE_BD_ADDR                *p_target_addr;     /* target address, if NULL, generic UUID filter */
517    tBT_UUID                    uuid;           /* UUID condition */
518    tBTA_DM_BLE_PF_LOGIC_TYPE   cond_logic;    /* AND/OR */
519    tBTA_DM_BLE_PF_COND_MASK    *p_uuid_mask;           /* UUID condition mask, if NULL, match exact as UUID condition */
520}tBTA_DM_BLE_PF_UUID_COND;
521
522typedef struct
523{
524    UINT8                   data_len;       /* <= 20 bytes */
525    UINT8                   *p_data;
526}tBTA_DM_BLE_PF_LOCAL_NAME_COND;
527
528typedef struct
529{
530    UINT16                  company_id;     /* company ID */
531    UINT8                   data_len;       /* <= 20 bytes */
532    UINT8                   *p_pattern;
533    UINT16                  company_id_mask; /* UUID value mask */
534    UINT8                   *p_pattern_mask; /* Manufactuer data matching mask, same length as data pattern,
535                                                set to all 0xff, match exact data */
536}tBTA_DM_BLE_PF_MANU_COND;
537
538typedef struct
539{
540    UINT16                  uuid;     /* service ID */
541    UINT8                   data_len;       /* <= 20 bytes */
542    UINT8                   *p_pattern;
543}tBTA_DM_BLE_PF_SRVC_PATTERN_COND;
544
545typedef union
546{
547    tBLE_BD_ADDR                            target_addr;
548    tBTA_DM_BLE_PF_LOCAL_NAME_COND             local_name; /* lcoal name filtering */
549    tBTA_DM_BLE_PF_MANU_COND                   manu_data;  /* manufactuer data filtering */
550    tBTA_DM_BLE_PF_UUID_COND                   srvc_uuid;  /* service UUID filtering */
551    tBTA_DM_BLE_PF_UUID_COND                   solicitate_uuid;   /* solicitated service UUID filtering */
552    tBTA_DM_BLE_PF_SRVC_PATTERN_COND           srvc_data;      /* service data pattern */
553}tBTA_DM_BLE_PF_COND_PARAM;
554
555typedef INT8 tBTA_DM_RSSI_VALUE;
556typedef UINT8 tBTA_DM_LINK_QUALITY_VALUE;
557
558
559/* signal strength mask */
560#define BTA_SIG_STRENGTH_RSSI_MASK          1
561#define BTA_SIG_STRENGTH_LINK_QUALITY_MASK  2
562
563typedef UINT8 tBTA_SIG_STRENGTH_MASK;
564
565
566/* Security Callback Events */
567#define BTA_DM_ENABLE_EVT               0       /* Enable Event */
568#define BTA_DM_DISABLE_EVT              1       /* Disable Event */
569#define BTA_DM_PIN_REQ_EVT              2       /* PIN request. */
570#define BTA_DM_AUTH_CMPL_EVT            3       /* Authentication complete indication. */
571#define BTA_DM_AUTHORIZE_EVT            4       /* Authorization request. */
572#define BTA_DM_LINK_UP_EVT              5       /* Connection UP event */
573#define BTA_DM_LINK_DOWN_EVT            6       /* Connection DOWN event */
574#define BTA_DM_SIG_STRENGTH_EVT         7       /* Signal strength for bluetooth connection */
575#define BTA_DM_BUSY_LEVEL_EVT           8       /* System busy level */
576#define BTA_DM_BOND_CANCEL_CMPL_EVT     9       /* Bond cancel complete indication */
577#define BTA_DM_SP_CFM_REQ_EVT           10      /* Simple Pairing User Confirmation request. */
578#define BTA_DM_SP_KEY_NOTIF_EVT         11      /* Simple Pairing Passkey Notification */
579#define BTA_DM_SP_RMT_OOB_EVT           12      /* Simple Pairing Remote OOB Data request. */
580#define BTA_DM_SP_KEYPRESS_EVT          13      /* Key press notification event. */
581#define BTA_DM_ROLE_CHG_EVT             14      /* Role Change event. */
582#define BTA_DM_BLE_KEY_EVT              15      /* BLE SMP key event for peer device keys */
583#define BTA_DM_BLE_SEC_REQ_EVT          16      /* BLE SMP security request */
584#define BTA_DM_BLE_PASSKEY_NOTIF_EVT    17      /* SMP passkey notification event */
585#define BTA_DM_BLE_PASSKEY_REQ_EVT      18      /* SMP passkey request event */
586#define BTA_DM_BLE_OOB_REQ_EVT          19      /* SMP OOB request event */
587#define BTA_DM_BLE_LOCAL_IR_EVT         20      /* BLE local IR event */
588#define BTA_DM_BLE_LOCAL_ER_EVT         21      /* BLE local ER event */
589// btla-specific ++
590#define BTA_DM_BLE_AUTH_CMPL_EVT        22      /* BLE Auth complete */
591// btla-specific --
592#define BTA_DM_DEV_UNPAIRED_EVT         23
593#define BTA_DM_HW_ERROR_EVT             24      /* BT Chip H/W error */
594typedef UINT8 tBTA_DM_SEC_EVT;
595
596/* Structure associated with BTA_DM_ENABLE_EVT */
597typedef struct
598{
599    BD_ADDR         bd_addr;            /* BD address of local device. */
600    tBTA_STATUS    status;
601} tBTA_DM_ENABLE;
602
603/* Structure associated with BTA_DM_PIN_REQ_EVT */
604typedef struct
605{
606    /* Note: First 3 data members must be, bd_addr, dev_class, and bd_name in order */
607    BD_ADDR         bd_addr;            /* BD address peer device. */
608    DEV_CLASS       dev_class;          /* Class of Device */
609    BD_NAME         bd_name;            /* Name of peer device. */
610} tBTA_DM_PIN_REQ;
611
612/* BLE related definition */
613
614#define BTA_DM_AUTH_FAIL_BASE                   (HCI_ERR_MAX_ERR + 10)
615#define BTA_DM_AUTH_CONVERT_SMP_CODE(x)        (BTA_DM_AUTH_FAIL_BASE + (x))
616#define BTA_DM_AUTH_SMP_PASSKEY_FAIL             BTA_DM_AUTH_CONVERT_SMP_CODE (SMP_PASSKEY_ENTRY_FAIL)
617#define BTA_DM_AUTH_SMP_OOB_FAIL                (BTA_DM_AUTH_FAIL_BASE + SMP_OOB_FAIL)
618#define BTA_DM_AUTH_SMP_PAIR_AUTH_FAIL          (BTA_DM_AUTH_FAIL_BASE + SMP_PAIR_AUTH_FAIL)
619#define BTA_DM_AUTH_SMP_CONFIRM_VALUE_FAIL      (BTA_DM_AUTH_FAIL_BASE + SMP_CONFIRM_VALUE_ERR)
620#define BTA_DM_AUTH_SMP_PAIR_NOT_SUPPORT        (BTA_DM_AUTH_FAIL_BASE + SMP_PAIR_NOT_SUPPORT)
621#define BTA_DM_AUTH_SMP_ENC_KEY_SIZE            (BTA_DM_AUTH_FAIL_BASE + SMP_ENC_KEY_SIZE)
622#define BTA_DM_AUTH_SMP_INVALID_CMD             (BTA_DM_AUTH_FAIL_BASE + SMP_INVALID_CMD)
623#define BTA_DM_AUTH_SMP_UNKNOWN_ERR             (BTA_DM_AUTH_FAIL_BASE + SMP_PAIR_FAIL_UNKNOWN)
624#define BTA_DM_AUTH_SMP_REPEATED_ATTEMPT        (BTA_DM_AUTH_FAIL_BASE + SMP_REPEATED_ATTEMPTS)
625#define BTA_DM_AUTH_SMP_INTERNAL_ERR            (BTA_DM_AUTH_FAIL_BASE + SMP_PAIR_INTERNAL_ERR)
626#define BTA_DM_AUTH_SMP_UNKNOWN_IO              (BTA_DM_AUTH_FAIL_BASE + SMP_UNKNOWN_IO_CAP)
627#define BTA_DM_AUTH_SMP_INIT_FAIL               (BTA_DM_AUTH_FAIL_BASE + SMP_INIT_FAIL)
628#define BTA_DM_AUTH_SMP_CONFIRM_FAIL            (BTA_DM_AUTH_FAIL_BASE + SMP_CONFIRM_FAIL)
629#define BTA_DM_AUTH_SMP_BUSY                    (BTA_DM_AUTH_FAIL_BASE + SMP_BUSY)
630#define BTA_DM_AUTH_SMP_ENC_FAIL                (BTA_DM_AUTH_FAIL_BASE + SMP_ENC_FAIL)
631#define BTA_DM_AUTH_SMP_RSP_TIMEOUT             (BTA_DM_AUTH_FAIL_BASE + SMP_RSP_TIMEOUT)
632
633/* connection parameter boundary value and dummy value */
634#define BTA_DM_BLE_SCAN_INT_MIN          BTM_BLE_SCAN_INT_MIN
635#define BTA_DM_BLE_SCAN_INT_MAX          BTM_BLE_SCAN_INT_MAX
636#define BTA_DM_BLE_SCAN_WIN_MIN          BTM_BLE_SCAN_WIN_MIN
637#define BTA_DM_BLE_SCAN_WIN_MAX          BTM_BLE_SCAN_WIN_MAX
638#define BTA_DM_BLE_CONN_INT_MIN          BTM_BLE_CONN_INT_MIN
639#define BTA_DM_BLE_CONN_INT_MAX          BTM_BLE_CONN_INT_MAX
640#define BTA_DM_BLE_CONN_LATENCY_MAX      BTM_BLE_CONN_LATENCY_MAX
641#define BTA_DM_BLE_CONN_SUP_TOUT_MIN     BTM_BLE_CONN_SUP_TOUT_MIN
642#define BTA_DM_BLE_CONN_SUP_TOUT_MAX     BTM_BLE_CONN_SUP_TOUT_MAX
643#define BTA_DM_BLE_CONN_PARAM_UNDEF      BTM_BLE_CONN_PARAM_UNDEF  /* use this value when a specific value not to be overwritten */
644
645
646#define BTA_LE_KEY_PENC      BTM_LE_KEY_PENC  /* encryption information of peer device */
647#define BTA_LE_KEY_PID       BTM_LE_KEY_PID   /* identity key of the peer device */
648#define BTA_LE_KEY_PCSRK     BTM_LE_KEY_PCSRK   /* peer SRK */
649#define BTA_LE_KEY_LENC      BTM_LE_KEY_LENC        /* master role security information:div */
650#define BTA_LE_KEY_LID       BTM_LE_KEY_LID         /* master device ID key */
651#define BTA_LE_KEY_LCSRK     BTM_LE_KEY_LCSRK        /* local CSRK has been deliver to peer */
652typedef UINT8 tBTA_LE_KEY_TYPE; /* can be used as a bit mask */
653
654
655typedef tBTM_LE_PENC_KEYS  tBTA_LE_PENC_KEYS ;
656typedef tBTM_LE_PCSRK_KEYS tBTA_LE_PCSRK_KEYS;
657typedef tBTM_LE_LENC_KEYS  tBTA_LE_LENC_KEYS  ;
658typedef tBTM_LE_LCSRK_KEYS tBTA_LE_LCSRK_KEYS ;
659typedef tBTM_LE_PID_KEYS   tBTA_LE_PID_KEYS ;
660
661typedef union
662{
663    tBTA_LE_PENC_KEYS   penc_key;       /* received peer encryption key */
664    tBTA_LE_PCSRK_KEYS  psrk_key;       /* received peer device SRK */
665    tBTA_LE_PID_KEYS    pid_key;        /* peer device ID key */
666    tBTA_LE_LENC_KEYS   lenc_key;       /* local encryption reproduction keys LTK = = d1(ER,DIV,0)*/
667    tBTA_LE_LCSRK_KEYS  lcsrk_key;      /* local device CSRK = d1(ER,DIV,1)*/
668}tBTA_LE_KEY_VALUE;
669
670#define BTA_BLE_LOCAL_KEY_TYPE_ID         1
671#define BTA_BLE_LOCAL_KEY_TYPE_ER         2
672typedef UINT8 tBTA_DM_BLE_LOCAL_KEY_MASK;
673
674typedef struct
675{
676    BT_OCTET16       ir;
677    BT_OCTET16       irk;
678    BT_OCTET16       dhk;
679}tBTA_BLE_LOCAL_ID_KEYS;
680
681#define BTA_DM_SEC_GRANTED              BTA_SUCCESS
682#define BTA_DM_SEC_PAIR_NOT_SPT         BTA_DM_AUTH_SMP_PAIR_NOT_SUPPORT
683#define BTA_DM_SEC_REP_ATTEMPTS         BTA_DM_AUTH_SMP_REPEATED_ATTEMPT
684typedef UINT8 tBTA_DM_BLE_SEC_GRANT;
685
686
687#define BTA_DM_BLE_ONN_NONE             BTM_BLE_CONN_NONE
688#define BTA_DM_BLE_CONN_AUTO            BTM_BLE_CONN_AUTO
689#define BTA_DM_BLE_CONN_SELECTIVE       BTM_BLE_CONN_SELECTIVE
690typedef UINT8 tBTA_DM_BLE_CONN_TYPE;
691
692typedef BOOLEAN (tBTA_DM_BLE_SEL_CBACK)(BD_ADDR random_bda, UINT8 *p_remote_name);
693
694/* Structure associated with BTA_DM_BLE_SEC_REQ_EVT */
695typedef struct
696{
697    BD_ADDR         bd_addr;        /* peer address */
698    BD_NAME         bd_name;        /* peer device name */
699} tBTA_DM_BLE_SEC_REQ;
700
701typedef struct
702{
703    BD_ADDR                 bd_addr;        /* peer address */
704    tBTM_LE_KEY_TYPE        key_type;
705    tBTM_LE_KEY_VALUE       key_value;
706}tBTA_DM_BLE_KEY;
707
708/* Structure associated with BTA_DM_AUTH_CMPL_EVT */
709typedef struct
710{
711    BD_ADDR         bd_addr;            /* BD address peer device. */
712    BD_NAME         bd_name;            /* Name of peer device. */
713    BOOLEAN         key_present;        /* Valid link key value in key element */
714    LINK_KEY        key;                /* Link key associated with peer device. */
715    UINT8           key_type;           /* The type of Link Key */
716    BOOLEAN         success;            /* TRUE of authentication succeeded, FALSE if failed. */
717#if BLE_INCLUDED == TRUE
718    BOOLEAN         privacy_enabled;    /* used for BLE device only */
719#endif
720    UINT8           fail_reason;        /* The HCI reason/error code for when success=FALSE */
721
722} tBTA_DM_AUTH_CMPL;
723
724
725/* Structure associated with BTA_DM_AUTHORIZE_EVT */
726typedef struct
727{
728    BD_ADDR         bd_addr;            /* BD address peer device. */
729    BD_NAME         bd_name;            /* Name of peer device. */
730    tBTA_SERVICE_ID service;            /* Service ID to authorize. */
731// btla-specific ++
732    DEV_CLASS      dev_class;
733// btla-specific --
734} tBTA_DM_AUTHORIZE;
735
736/* Structure associated with BTA_DM_LINK_UP_EVT */
737typedef struct
738{
739    BD_ADDR         bd_addr;            /* BD address peer device. */
740#if BLE_INCLUDED == TRUE
741    tBTA_TRANSPORT  link_type;
742#endif
743} tBTA_DM_LINK_UP;
744
745/* Structure associated with BTA_DM_LINK_DOWN_EVT */
746typedef struct
747{
748    BD_ADDR         bd_addr;            /* BD address peer device. */
749    UINT8           status;             /* connection open/closed */
750    BOOLEAN         is_removed;         /* TRUE if device is removed when link is down */
751#if BLE_INCLUDED == TRUE
752    tBTA_TRANSPORT  link_type;
753#endif
754} tBTA_DM_LINK_DOWN;
755
756/* Structure associated with BTA_DM_ROLE_CHG_EVT */
757typedef struct
758{
759    BD_ADDR         bd_addr;            /* BD address peer device. */
760    UINT8           new_role;           /* the new connection role */
761} tBTA_DM_ROLE_CHG;
762
763/* Structure associated with BTA_DM_SIG_STRENGTH_EVT */
764typedef struct
765{
766    BD_ADDR         bd_addr;            /* BD address peer device. */
767    tBTA_SIG_STRENGTH_MASK mask;        /* mask for the values that are valid */
768    tBTA_DM_RSSI_VALUE  rssi_value;
769    tBTA_DM_LINK_QUALITY_VALUE link_quality_value;
770
771} tBTA_DM_SIG_STRENGTH;
772
773/* Structure associated with BTA_DM_BUSY_LEVEL_EVT */
774typedef struct
775{
776    UINT8           level;     /* when paging or inquiring, level is 10.
777                                    Otherwise, the number of ACL links */
778    UINT8           level_flags; /* indicates individual flags */
779} tBTA_DM_BUSY_LEVEL;
780
781#define BTA_IO_CAP_OUT      BTM_IO_CAP_OUT      /* DisplayOnly */
782#define BTA_IO_CAP_IO       BTM_IO_CAP_IO       /* DisplayYesNo */
783#define BTA_IO_CAP_IN       BTM_IO_CAP_IN       /* KeyboardOnly */
784#define BTA_IO_CAP_NONE     BTM_IO_CAP_NONE     /* NoInputNoOutput */
785typedef tBTM_IO_CAP     tBTA_IO_CAP;
786
787#define BTA_AUTH_SP_NO    BTM_AUTH_SP_NO      /* 0 MITM Protection Not Required - Single Profile/non-bonding
788                                                Numeric comparison with automatic accept allowed */
789#define BTA_AUTH_SP_YES   BTM_AUTH_SP_YES     /* 1 MITM Protection Required - Single Profile/non-bonding
790                                                Use IO Capabilities to determine authentication procedure */
791#define BTA_AUTH_AP_NO    BTM_AUTH_AP_NO      /* 2 MITM Protection Not Required - All Profiles/dedicated bonding
792                                                Numeric comparison with automatic accept allowed */
793#define BTA_AUTH_AP_YES   BTM_AUTH_AP_YES     /* 3 MITM Protection Required - All Profiles/dedicated bonding
794                                                Use IO Capabilities to determine authentication procedure */
795#define BTA_AUTH_SPGB_NO  BTM_AUTH_SPGB_NO    /* 4 MITM Protection Not Required - Single Profiles/general bonding
796                                                Numeric comparison with automatic accept allowed */
797#define BTA_AUTH_SPGB_YES BTM_AUTH_SPGB_YES   /* 5 MITM Protection Required - Single Profiles/general bonding
798                                                Use IO Capabilities to determine authentication procedure */
799typedef tBTM_AUTH_REQ   tBTA_AUTH_REQ;
800
801#define BTA_AUTH_DD_BOND    BTM_AUTH_DD_BOND  /* 2 this bit is set for dedicated bonding */
802#define BTA_AUTH_GEN_BOND   BTM_AUTH_SPGB_NO  /* 4 this bit is set for general bonding */
803#define BTA_AUTH_BONDS      BTM_AUTH_BONDS    /* 6 the general/dedicated bonding bits  */
804
805#define BTA_LE_AUTH_NO_BOND    BTM_LE_AUTH_REQ_NO_BOND  /* 0*/
806#define BTA_LE_AUTH_BOND       BTM_LE_AUTH_REQ_BOND     /* 1 << 0 */
807#define BTA_LE_AUTH_REQ_MITM   BTM_LE_AUTH_REQ_MITM    /* 1 << 2 */
808typedef tBTM_LE_AUTH_REQ       tBTA_LE_AUTH_REQ;       /* combination of the above bit pattern */
809
810#define BTA_OOB_NONE        BTM_OOB_NONE
811#define BTA_OOB_PRESENT     BTM_OOB_PRESENT
812#if BTM_OOB_INCLUDED == TRUE
813#define BTA_OOB_UNKNOWN     BTM_OOB_UNKNOWN
814#endif
815typedef tBTM_OOB_DATA   tBTA_OOB_DATA;
816
817/* Structure associated with BTA_DM_SP_CFM_REQ_EVT */
818typedef struct
819{
820    /* Note: First 3 data members must be, bd_addr, dev_class, and bd_name in order */
821    BD_ADDR         bd_addr;        /* peer address */
822    DEV_CLASS       dev_class;      /* peer CoD */
823    BD_NAME         bd_name;        /* peer device name */
824    UINT32          num_val;        /* the numeric value for comparison. If just_works, do not show this number to UI */
825    BOOLEAN         just_works;     /* TRUE, if "Just Works" association model */
826    tBTA_AUTH_REQ   loc_auth_req;   /* Authentication required for local device */
827    tBTA_AUTH_REQ   rmt_auth_req;   /* Authentication required for peer device */
828    tBTA_IO_CAP     loc_io_caps;    /* IO Capabilities of local device */
829    tBTA_AUTH_REQ   rmt_io_caps;    /* IO Capabilities of remote device */
830} tBTA_DM_SP_CFM_REQ;
831
832enum
833{
834    BTA_SP_KEY_STARTED,         /* passkey entry started */
835    BTA_SP_KEY_ENTERED,         /* passkey digit entered */
836    BTA_SP_KEY_ERASED,          /* passkey digit erased */
837    BTA_SP_KEY_CLEARED,         /* passkey cleared */
838    BTA_SP_KEY_COMPLT           /* passkey entry completed */
839};
840typedef UINT8   tBTA_SP_KEY_TYPE;
841
842/* Structure associated with BTA_DM_SP_KEYPRESS_EVT */
843typedef struct
844{
845    BD_ADDR             bd_addr;        /* peer address */
846    tBTA_SP_KEY_TYPE   notif_type;
847}tBTA_DM_SP_KEY_PRESS;
848
849/* Structure associated with BTA_DM_SP_KEY_NOTIF_EVT */
850typedef struct
851{
852    /* Note: First 3 data members must be, bd_addr, dev_class, and bd_name in order */
853    BD_ADDR         bd_addr;        /* peer address */
854    DEV_CLASS       dev_class;      /* peer CoD */
855    BD_NAME         bd_name;        /* peer device name */
856    UINT32          passkey;        /* the numeric value for comparison. If just_works, do not show this number to UI */
857} tBTA_DM_SP_KEY_NOTIF;
858
859/* Structure associated with BTA_DM_SP_RMT_OOB_EVT */
860typedef struct
861{
862    /* Note: First 3 data members must be, bd_addr, dev_class, and bd_name in order */
863    BD_ADDR         bd_addr;        /* peer address */
864    DEV_CLASS       dev_class;      /* peer CoD */
865    BD_NAME         bd_name;        /* peer device name */
866} tBTA_DM_SP_RMT_OOB;
867
868/* Structure associated with BTA_DM_BOND_CANCEL_CMPL_EVT */
869typedef struct
870{
871    tBTA_STATUS     result;    /* TRUE of bond cancel succeeded, FALSE if failed. */
872} tBTA_DM_BOND_CANCEL_CMPL;
873
874/* Union of all security callback structures */
875typedef union
876{
877    tBTA_DM_ENABLE      enable;         /* BTA enabled */
878    tBTA_DM_PIN_REQ     pin_req;        /* PIN request. */
879    tBTA_DM_AUTH_CMPL   auth_cmpl;      /* Authentication complete indication. */
880    tBTA_DM_AUTHORIZE   authorize;      /* Authorization request. */
881    tBTA_DM_LINK_UP     link_up;       /* ACL connection down event */
882    tBTA_DM_LINK_DOWN   link_down;       /* ACL connection down event */
883    tBTA_DM_SIG_STRENGTH sig_strength;  /* rssi and link quality value */
884    tBTA_DM_BUSY_LEVEL  busy_level;     /* System busy level */
885    tBTA_DM_SP_CFM_REQ  cfm_req;        /* user confirm request */
886    tBTA_DM_SP_KEY_NOTIF key_notif;     /* passkey notification */
887    tBTA_DM_SP_RMT_OOB  rmt_oob;        /* remote oob */
888    tBTA_DM_BOND_CANCEL_CMPL bond_cancel_cmpl; /* Bond Cancel Complete indication */
889    tBTA_DM_SP_KEY_PRESS   key_press;   /* key press notification event */
890    tBTA_DM_ROLE_CHG     role_chg;       /* role change event */
891    tBTA_DM_BLE_SEC_REQ  ble_req;        /* BLE SMP related request */
892    tBTA_DM_BLE_KEY      ble_key;        /* BLE SMP keys used when pairing */
893    tBTA_BLE_LOCAL_ID_KEYS  ble_id_keys;  /* IR event */
894    BT_OCTET16              ble_er;       /* ER event data */
895} tBTA_DM_SEC;
896
897/* Security callback */
898typedef void (tBTA_DM_SEC_CBACK)(tBTA_DM_SEC_EVT event, tBTA_DM_SEC *p_data);
899
900#define BTA_BLE_MULTI_ADV_MAX BTM_BLE_MULTI_ADV_MAX
901#define BTA_BLE_MULTI_ADV_ILLEGAL 0
902
903/* multi adv callback event */
904#define BTA_BLE_MULTI_ADV_ENB_EVT           1
905#define BTA_BLE_MULTI_ADV_DISABLE_EVT       2
906#define BTA_BLE_MULTI_ADV_PARAM_EVT         3
907#define BTA_BLE_MULTI_ADV_DATA_EVT          4
908
909typedef UINT8 tBTA_BLE_MULTI_ADV_EVT;
910
911/* multi adv callback */
912typedef void (tBTA_BLE_MULTI_ADV_CBACK)(tBTA_BLE_MULTI_ADV_EVT event,
913                                        UINT8 inst_id, void *p_ref, tBTA_STATUS status);
914
915/* Vendor Specific Command Callback */
916typedef tBTM_VSC_CMPL_CB        tBTA_VENDOR_CMPL_CBACK;
917
918/* Search callback events */
919#define BTA_DM_INQ_RES_EVT              0       /* Inquiry result for a peer device. */
920#define BTA_DM_INQ_CMPL_EVT             1       /* Inquiry complete. */
921#define BTA_DM_DISC_RES_EVT             2       /* Discovery result for a peer device. */
922#define BTA_DM_DISC_BLE_RES_EVT         3       /* Discovery result for BLE GATT based servoce on a peer device. */
923#define BTA_DM_DISC_CMPL_EVT            4       /* Discovery complete. */
924#define BTA_DM_DI_DISC_CMPL_EVT         5       /* Discovery complete. */
925#define BTA_DM_SEARCH_CANCEL_CMPL_EVT   6       /* Search cancelled */
926
927typedef UINT8 tBTA_DM_SEARCH_EVT;
928
929#define BTA_DM_INQ_RES_IGNORE_RSSI      BTM_INQ_RES_IGNORE_RSSI /* 0x7f RSSI value not supplied (ignore it) */
930
931/* Structure associated with BTA_DM_INQ_RES_EVT */
932typedef struct
933{
934    BD_ADDR         bd_addr;                /* BD address peer device. */
935    DEV_CLASS       dev_class;              /* Device class of peer device. */
936    BOOLEAN         remt_name_not_required; /* Application sets this flag if it already knows the name of the device */
937                                            /* If the device name is known to application BTA skips the remote name request */
938    BOOLEAN         is_limited;             /* TRUE, if the limited inquiry bit is set in the CoD */
939    INT8            rssi;                   /* The rssi value */
940    UINT8           *p_eir;                 /* received EIR */
941#if (BLE_INCLUDED == TRUE)
942    UINT8               inq_result_type;
943    UINT8               ble_addr_type;
944    tBTM_BLE_EVT_TYPE   ble_evt_type;
945    tBT_DEVICE_TYPE     device_type;
946    UINT8               flag;
947#endif
948
949} tBTA_DM_INQ_RES;
950
951/* Structure associated with BTA_DM_INQ_CMPL_EVT */
952typedef struct
953{
954    UINT8           num_resps;          /* Number of inquiry responses. */
955} tBTA_DM_INQ_CMPL;
956
957/* Structure associated with BTA_DM_DI_DISC_CMPL_EVT */
958typedef struct
959{
960    BD_ADDR             bd_addr;        /* BD address peer device. */
961    UINT8               num_record;     /* Number of DI record */
962    tBTA_STATUS         result;
963} tBTA_DM_DI_DISC_CMPL;
964
965/* Structure associated with BTA_DM_DISC_RES_EVT */
966typedef struct
967{
968    BD_ADDR             bd_addr;        /* BD address peer device. */
969    BD_NAME             bd_name;        /* Name of peer device. */
970    tBTA_SERVICE_MASK   services;       /* Services found on peer device. */
971// btla-specific ++
972    UINT8           *   p_raw_data;     /* Raw data for discovery DB */
973    UINT32              raw_data_size;  /* size of raw data */
974    tBT_DEVICE_TYPE     device_type;    /* device type in case it is BLE device */
975    UINT32              num_uuids;
976    UINT8               *p_uuid_list;
977// btla-specific --
978    tBTA_STATUS         result;
979} tBTA_DM_DISC_RES;
980
981/* Structure associated with tBTA_DM_DISC_BLE_RES */
982typedef struct
983{
984    BD_ADDR             bd_addr;        /* BD address peer device. */
985    BD_NAME             bd_name;        /* Name of peer device. */
986    tBT_UUID            service;        /* GATT based Services UUID found on peer device. */
987} tBTA_DM_DISC_BLE_RES;
988
989
990/* Union of all search callback structures */
991typedef union
992{
993    tBTA_DM_INQ_RES     inq_res;        /* Inquiry result for a peer device. */
994    tBTA_DM_INQ_CMPL    inq_cmpl;       /* Inquiry complete. */
995    tBTA_DM_DISC_RES    disc_res;       /* Discovery result for a peer device. */
996    tBTA_DM_DISC_BLE_RES    disc_ble_res;   /* discovery result for GATT based service */
997    tBTA_DM_DI_DISC_CMPL    di_disc;        /* DI discovery result for a peer device */
998
999} tBTA_DM_SEARCH;
1000
1001/* Search callback */
1002typedef void (tBTA_DM_SEARCH_CBACK)(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH *p_data);
1003
1004/* Execute call back */
1005typedef void (tBTA_DM_EXEC_CBACK) (void * p_param);
1006
1007/* Encryption callback*/
1008typedef void (tBTA_DM_ENCRYPT_CBACK) (BD_ADDR bd_addr, tBTA_TRANSPORT transport, tBTA_STATUS result);
1009
1010#if BLE_INCLUDED == TRUE
1011#define BTA_DM_BLE_SEC_NONE         BTM_BLE_SEC_NONE
1012#define BTA_DM_BLE_SEC_ENCRYPT      BTM_BLE_SEC_ENCRYPT
1013#define BTA_DM_BLE_SEC_NO_MITM      BTM_BLE_SEC_ENCRYPT_NO_MITM
1014#define BTA_DM_BLE_SEC_MITM         BTM_BLE_SEC_ENCRYPT_MITM
1015typedef tBTM_BLE_SEC_ACT            tBTA_DM_BLE_SEC_ACT;
1016#else
1017typedef UINT8                       tBTA_DM_BLE_SEC_ACT;
1018#endif
1019
1020/* Maximum service name length */
1021#define BTA_SERVICE_NAME_LEN    35
1022#define BTA_SERVICE_DESP_LEN    BTA_SERVICE_NAME_LEN
1023#define BTA_PROVIDER_NAME_LEN   BTA_SERVICE_NAME_LEN
1024
1025
1026/* link policy masks  */
1027#define BTA_DM_LP_SWITCH        HCI_ENABLE_MASTER_SLAVE_SWITCH
1028#define BTA_DM_LP_HOLD          HCI_ENABLE_HOLD_MODE
1029#define BTA_DM_LP_SNIFF         HCI_ENABLE_SNIFF_MODE
1030#define BTA_DM_LP_PARK          HCI_ENABLE_PARK_MODE
1031typedef UINT16 tBTA_DM_LP_MASK;
1032
1033/* power mode actions  */
1034#define BTA_DM_PM_NO_ACTION    0x00       /* no change to the current pm setting */
1035#define BTA_DM_PM_PARK         0x10       /* prefers park mode */
1036#define BTA_DM_PM_SNIFF        0x20       /* prefers sniff mode */
1037#define BTA_DM_PM_SNIFF1       0x21       /* prefers sniff1 mode */
1038#define BTA_DM_PM_SNIFF2       0x22       /* prefers sniff2 mode */
1039#define BTA_DM_PM_SNIFF3       0x23       /* prefers sniff3 mode */
1040#define BTA_DM_PM_SNIFF4       0x24       /* prefers sniff4 mode */
1041#define BTA_DM_PM_SNIFF5       0x25       /* prefers sniff5 mode */
1042#define BTA_DM_PM_SNIFF6       0x26       /* prefers sniff6 mode */
1043#define BTA_DM_PM_SNIFF7       0x27       /* prefers sniff7 mode */
1044#define BTA_DM_PM_SNIFF_USER0  0x28       /* prefers user-defined sniff0 mode (testtool only) */
1045#define BTA_DM_PM_SNIFF_USER1  0x29       /* prefers user-defined sniff1 mode (testtool only) */
1046#define BTA_DM_PM_ACTIVE       0x40       /* prefers active mode */
1047#define BTA_DM_PM_RETRY        0x80       /* retry power mode based on current settings */
1048#define BTA_DM_PM_NO_PREF      0x01       /* service has no prefernce on power mode setting. eg. connection to service got closed */
1049
1050typedef UINT8 tBTA_DM_PM_ACTTION;
1051
1052/* index to bta_dm_ssr_spec */
1053#define BTA_DM_PM_SSR0          0
1054#define BTA_DM_PM_SSR1          1       /* BTA_DM_PM_SSR1 will be dedicated for
1055                                        HH SSR setting entry, no other profile can use it */
1056#define BTA_DM_PM_SSR2          2
1057#define BTA_DM_PM_SSR3          3
1058#define BTA_DM_PM_SSR4          4
1059#define BTA_DM_PM_SSR5          5
1060#define BTA_DM_PM_SSR6          6
1061
1062#define BTA_DM_PM_NUM_EVTS      9
1063
1064#ifndef BTA_DM_PM_PARK_IDX
1065#define BTA_DM_PM_PARK_IDX      5 /* the actual index to bta_dm_pm_md[] for PARK mode */
1066#endif
1067
1068/* Switch callback events */
1069#define BTA_DM_SWITCH_CMPL_EVT      0       /* Completion of the Switch API */
1070
1071typedef UINT8 tBTA_DM_SWITCH_EVT;
1072typedef void (tBTA_DM_SWITCH_CBACK)(tBTA_DM_SWITCH_EVT event, tBTA_STATUS status);
1073
1074/* Audio routing out configuration */
1075#define BTA_DM_ROUTE_NONE       0x00    /* No Audio output */
1076#define BTA_DM_ROUTE_DAC        0x01    /* routing over analog output */
1077#define BTA_DM_ROUTE_I2S        0x02    /* routing over digital (I2S) output */
1078#define BTA_DM_ROUTE_BT_MONO    0x04    /* routing over SCO */
1079#define BTA_DM_ROUTE_BT_STEREO  0x08    /* routing over BT Stereo */
1080#define BTA_DM_ROUTE_HOST       0x10    /* routing over Host */
1081#define BTA_DM_ROUTE_FMTX       0x20    /* routing over FMTX */
1082#define BTA_DM_ROUTE_FMRX       0x40    /* routing over FMRX */
1083#define BTA_DM_ROUTE_BTSNK      0x80    /* routing over BT SNK */
1084
1085typedef UINT8 tBTA_DM_ROUTE_PATH;
1086
1087
1088/* Device Identification (DI) data structure
1089*/
1090/* Used to set the DI record */
1091typedef tSDP_DI_RECORD          tBTA_DI_RECORD;
1092/* Used to get the DI record */
1093typedef tSDP_DI_GET_RECORD      tBTA_DI_GET_RECORD;
1094/* SDP discovery database */
1095typedef tSDP_DISCOVERY_DB       tBTA_DISCOVERY_DB;
1096
1097#ifndef         BTA_DI_NUM_MAX
1098#define         BTA_DI_NUM_MAX       3
1099#endif
1100
1101/* Device features mask definitions */
1102#define BTA_FEATURE_BYTES_PER_PAGE  BTM_FEATURE_BYTES_PER_PAGE
1103#define BTA_EXT_FEATURES_PAGE_MAX   BTM_EXT_FEATURES_PAGE_MAX
1104/* ACL type
1105*/
1106#define BTA_DM_LINK_TYPE_BR_EDR    0x01
1107#define BTA_DM_LINK_TYPE_LE        0x02
1108#define BTA_DM_LINK_TYPE_ALL       0xFF
1109typedef UINT8 tBTA_DM_LINK_TYPE;
1110
1111/*****************************************************************************
1112**  External Function Declarations
1113*****************************************************************************/
1114#ifdef __cplusplus
1115extern "C"
1116{
1117#endif
1118
1119/*******************************************************************************
1120**
1121** Function         BTA_EnableBluetooth
1122**
1123** Description      This function initializes BTA and prepares BTA and the
1124**                  Bluetooth protocol stack for use.  This function is
1125**                  typically called at startup or when Bluetooth services
1126**                  are required by the phone.  This function must be called
1127**                  before calling any other API function.
1128**
1129**
1130** Returns          BTA_SUCCESS if successful.
1131**                  BTA_FAIL if internal failure.
1132**
1133*******************************************************************************/
1134BTA_API extern tBTA_STATUS BTA_EnableBluetooth(tBTA_DM_SEC_CBACK *p_cback);
1135
1136/*******************************************************************************
1137**
1138** Function         BTA_DisableBluetooth
1139**
1140** Description      This function disables BTA and the Bluetooth protocol
1141**                  stack.  It is called when BTA is no longer being used
1142**                  by any application in the system.
1143**
1144**
1145** Returns          void
1146**
1147*******************************************************************************/
1148BTA_API extern tBTA_STATUS BTA_DisableBluetooth(void);
1149
1150/*******************************************************************************
1151**
1152** Function         BTA_EnableTestMode
1153**
1154** Description      Enables bluetooth device under test mode
1155**
1156**
1157** Returns          tBTA_STATUS
1158**
1159*******************************************************************************/
1160BTA_API extern tBTA_STATUS BTA_EnableTestMode(void);
1161
1162/*******************************************************************************
1163**
1164** Function         BTA_DisableTestMode
1165**
1166** Description      Disable bluetooth device under test mode
1167**
1168**
1169** Returns          None
1170**
1171*******************************************************************************/
1172BTA_API extern void BTA_DisableTestMode(void);
1173
1174/*******************************************************************************
1175**
1176** Function         BTA_DmIsDeviceUp
1177**
1178** Description      This function tests whether the Bluetooth module is up
1179**                  and ready.  This is a direct execution function that
1180**                  may lock task scheduling on some platforms.
1181**
1182**
1183** Returns          TRUE if the module is ready.
1184**                  FALSE if the module is not ready.
1185**
1186*******************************************************************************/
1187BTA_API extern BOOLEAN BTA_DmIsDeviceUp(void);
1188
1189/*******************************************************************************
1190**
1191** Function         BTA_DmSetDeviceName
1192**
1193** Description      This function sets the Bluetooth name of the local device.
1194**
1195**
1196** Returns          void
1197**
1198*******************************************************************************/
1199BTA_API extern void BTA_DmSetDeviceName(char *p_name);
1200
1201/*******************************************************************************
1202**
1203** Function         BTA_DmSetVisibility
1204**
1205** Description      This function sets the Bluetooth connectable,discoverable,
1206**                  pairable and conn paired only modesmodes of the local device.
1207**                  This controls whether other Bluetooth devices can find and connect to
1208**                  the local device.
1209**
1210**
1211** Returns          void
1212**
1213*******************************************************************************/
1214BTA_API extern void BTA_DmSetVisibility(tBTA_DM_DISC disc_mode, tBTA_DM_CONN conn_mode, UINT8 pairable_mode, UINT8 conn_filter);
1215
1216/*******************************************************************************
1217**
1218** Function         BTA_DmSetScanParam
1219**
1220** Description      This function sets the parameters for page scan and
1221**                  inquiry scan.
1222**
1223**
1224** Returns          void
1225**
1226*******************************************************************************/
1227BTA_API extern void BTA_DmSetScanParam (UINT16 page_scan_interval, UINT16 page_scan_window,
1228                                  UINT16 inquiry_scan_interval, UINT16 inquiry_scan_window);
1229
1230/*******************************************************************************
1231**
1232** Function         BTA_DmSetAfhChannels
1233**
1234** Description      This function sets the AFH first and
1235**                  last disable channel, so channels within
1236**                  that range are disabled.
1237**                  In order to use this API, BTM_BYPASS_AMP_AUTO_AFH must be set
1238**                  to be TRUE
1239**
1240** Returns          void
1241**
1242*******************************************************************************/
1243BTA_API extern void BTA_DmSetAfhChannels(UINT8 first, UINT8 last);
1244
1245
1246/*******************************************************************************
1247**
1248** Function         BTA_DmVendorSpecificCommand
1249**
1250** Description      This function sends the vendor specific command
1251**                  to the controller
1252**
1253**
1254** Returns          tBTA_STATUS
1255**
1256*******************************************************************************/
1257BTA_API extern tBTA_STATUS BTA_DmVendorSpecificCommand (UINT16 opcode, UINT8 param_len,UINT8 *p_param_buf, tBTA_VENDOR_CMPL_CBACK *p_cback);
1258
1259
1260/*******************************************************************************
1261**
1262** Function         BTA_DmSearch
1263**
1264** Description      This function searches for peer Bluetooth devices.  It
1265**                  first performs an inquiry; for each device found from the
1266**                  inquiry it gets the remote name of the device.  If
1267**                  parameter services is nonzero, service discovery will be
1268**                  performed on each device for the services specified.
1269**
1270**
1271** Returns          void
1272**
1273*******************************************************************************/
1274BTA_API extern void BTA_DmSearch(tBTA_DM_INQ *p_dm_inq, tBTA_SERVICE_MASK services,
1275                                 tBTA_DM_SEARCH_CBACK *p_cback);
1276
1277/*******************************************************************************
1278**
1279** Function         BTA_DmSearchCancel
1280**
1281** Description      This function cancels a search that has been initiated
1282**                  by calling BTA_DmSearch().
1283**
1284**
1285** Returns          void
1286**
1287*******************************************************************************/
1288BTA_API extern void BTA_DmSearchCancel(void);
1289
1290/*******************************************************************************
1291**
1292** Function         BTA_DmDiscover
1293**
1294** Description      This function performs service discovery for the services
1295**                  of a particular peer device.
1296**
1297**
1298** Returns          void
1299**
1300*******************************************************************************/
1301BTA_API extern void BTA_DmDiscover(BD_ADDR bd_addr, tBTA_SERVICE_MASK services,
1302                                   tBTA_DM_SEARCH_CBACK *p_cback, BOOLEAN sdp_search);
1303
1304// btla-specific ++
1305/*******************************************************************************
1306**
1307** Function         BTA_DmDiscoverUUID
1308**
1309** Description      This function performs service discovery for the services
1310**                  of a particular peer device.
1311**
1312**
1313** Returns          void
1314**
1315*******************************************************************************/
1316BTA_API extern void BTA_DmDiscoverUUID(BD_ADDR bd_addr, tSDP_UUID *uuid,
1317                    tBTA_DM_SEARCH_CBACK *p_cback, BOOLEAN sdp_search);
1318
1319/*******************************************************************************
1320**
1321** Function         BTA_DmGetCachedRemoteName
1322**
1323** Description      Retieve cached remote name if available
1324**
1325** Returns          BTA_SUCCESS if cached name was retrieved
1326**                  BTA_FAILURE if cached name is not available
1327**
1328*******************************************************************************/
1329tBTA_STATUS BTA_DmGetCachedRemoteName(BD_ADDR remote_device, UINT8 **pp_cached_name);
1330// btla-specific --
1331
1332/*******************************************************************************
1333**
1334** Function         BTA_DmIsMaster
1335**
1336** Description      This function checks if the local device is the master of
1337**                  the link to the given device
1338**
1339** Returns          TRUE if master.
1340**                  FALSE if not.
1341**
1342*******************************************************************************/
1343BTA_API extern BOOLEAN BTA_DmIsMaster(BD_ADDR bd_addr);
1344
1345/*******************************************************************************
1346**
1347** Function         BTA_DmBond
1348**
1349** Description      This function initiates a bonding procedure with a peer
1350**                  device.  The bonding procedure enables authentication
1351**                  and optionally encryption on the Bluetooth link.
1352**
1353**
1354** Returns          void
1355**
1356*******************************************************************************/
1357BTA_API extern void BTA_DmBond(BD_ADDR bd_addr);
1358
1359/*******************************************************************************
1360**
1361** Function         BTA_DmBondByTransport
1362**
1363** Description      This function initiates a bonding procedure with a peer
1364**                  device by designated transport.  The bonding procedure enables
1365**                  authentication and optionally encryption on the Bluetooth link.
1366**
1367**
1368** Returns          void
1369**
1370*******************************************************************************/
1371BTA_API extern void BTA_DmBondByTransport(BD_ADDR bd_addr, tBTA_TRANSPORT transport);
1372
1373
1374/*******************************************************************************
1375**
1376** Function         BTA_DmBondCancel
1377**
1378** Description      This function cancels a bonding procedure with a peer
1379**                  device.
1380**
1381**
1382** Returns          void
1383**
1384*******************************************************************************/
1385BTA_API extern void BTA_DmBondCancel(BD_ADDR bd_addr);
1386
1387/*******************************************************************************
1388**
1389** Function         BTA_DmPinReply
1390**
1391** Description      This function provides a PIN when one is requested by DM
1392**                  during a bonding procedure.  The application should call
1393**                  this function after the security callback is called with
1394**                  a BTA_DM_PIN_REQ_EVT.
1395**
1396**
1397** Returns          void
1398**
1399*******************************************************************************/
1400BTA_API extern void BTA_DmPinReply(BD_ADDR bd_addr, BOOLEAN accept, UINT8 pin_len,
1401                                   UINT8 *p_pin);
1402
1403/*******************************************************************************
1404**
1405** Function         BTA_DmLinkPolicy
1406**
1407** Description      This function sets/clears the link policy mask to the given
1408**                  bd_addr.
1409**                  If clearing the sniff or park mode mask, the link is put
1410**                  in active mode.
1411**
1412** Returns          void
1413**
1414*******************************************************************************/
1415BTA_API extern void BTA_DmLinkPolicy(BD_ADDR bd_addr, tBTA_DM_LP_MASK policy_mask,
1416                                     BOOLEAN set);
1417
1418#if (BTM_OOB_INCLUDED == TRUE)
1419/*******************************************************************************
1420**
1421** Function         BTA_DmLocalOob
1422**
1423** Description      This function retrieves the OOB data from local controller.
1424**                  The result is reported by bta_dm_co_loc_oob().
1425**
1426** Returns          void
1427**
1428*******************************************************************************/
1429BTA_API extern void BTA_DmLocalOob(void);
1430#endif /* BTM_OOB_INCLUDED */
1431
1432/*******************************************************************************
1433**
1434** Function         BTA_DmConfirm
1435**
1436** Description      This function accepts or rejects the numerical value of the
1437**                  Simple Pairing process on BTA_DM_SP_CFM_REQ_EVT
1438**
1439** Returns          void
1440**
1441*******************************************************************************/
1442BTA_API extern void BTA_DmConfirm(BD_ADDR bd_addr, BOOLEAN accept);
1443
1444/*******************************************************************************
1445**
1446** Function         BTA_DmPasskeyCancel
1447**
1448** Description      This function is called to cancel the simple pairing process
1449**                  reported by BTA_DM_SP_KEY_NOTIF_EVT
1450**
1451** Returns          void
1452**
1453*******************************************************************************/
1454BTA_API extern void BTA_DmPasskeyCancel(BD_ADDR bd_addr);
1455
1456/*******************************************************************************
1457**
1458** Function         BTA_DmAddDevice
1459**
1460** Description      This function adds a device to the security database list
1461**                  of peer devices. This function would typically be called
1462**                  at system startup to initialize the security database with
1463**                  known peer devices.  This is a direct execution function
1464**                  that may lock task scheduling on some platforms.
1465**
1466** Returns          void
1467**
1468*******************************************************************************/
1469BTA_API extern void BTA_DmAddDevice(BD_ADDR bd_addr, DEV_CLASS dev_class,
1470                                    LINK_KEY link_key, tBTA_SERVICE_MASK trusted_mask,
1471                                    BOOLEAN is_trusted, UINT8 key_type,
1472                                    tBTA_IO_CAP io_cap);
1473
1474/*******************************************************************************
1475**
1476** Function         BTA_DmAddDevWithName
1477**
1478** Description      This function is newer version of  BTA_DmAddDevice()
1479**                  which added bd_name and features as input parameters.
1480**
1481**
1482** Returns          void
1483**
1484** Note:            features points to the remote device features array.
1485**                  The array size is
1486**                  BTA_FEATURE_BYTES_PER_PAGE * (BTA_EXT_FEATURES_PAGE_MAX + 1)
1487**
1488*******************************************************************************/
1489BTA_API extern void BTA_DmAddDevWithName (BD_ADDR bd_addr, DEV_CLASS dev_class,
1490                                      BD_NAME bd_name, UINT8 *features,
1491                                      LINK_KEY link_key, tBTA_SERVICE_MASK trusted_mask,
1492                                      BOOLEAN is_trusted, UINT8 key_type, tBTA_IO_CAP io_cap);
1493
1494/*******************************************************************************
1495**
1496** Function         BTA_DmRemoveDevice
1497**
1498** Description      This function removes a device from the security database.
1499**                  This is a direct execution function that may lock task
1500**                  scheduling on some platforms.
1501**
1502**
1503** Returns          BTA_SUCCESS if successful.
1504**                  BTA_FAIL if operation failed.
1505**
1506*******************************************************************************/
1507BTA_API extern tBTA_STATUS BTA_DmRemoveDevice(BD_ADDR bd_addr);
1508
1509/*******************************************************************************
1510**
1511** Function         BTA_DmAuthorizeReply
1512**
1513** Description      This function provides an authorization reply when
1514**                  authorization is requested by BTA.  The application calls
1515**                  this function after the security callback is called with
1516**                  a BTA_DM_AUTHORIZE_EVT.
1517**
1518**
1519** Returns          void
1520**
1521*******************************************************************************/
1522BTA_API extern void BTA_DmAuthorizeReply(BD_ADDR bd_addr, tBTA_SERVICE_ID service,
1523                                         tBTA_AUTH_RESP response);
1524
1525/*******************************************************************************
1526**
1527** Function         BTA_DmSignalStrength
1528**
1529** Description      This function initiates RSSI and channnel quality
1530**                  measurments. BTA_DM_SIG_STRENGTH_EVT is sent to
1531**                  application with the values of RSSI and channel
1532**                  quality
1533**
1534**
1535** Returns          void
1536**
1537*******************************************************************************/
1538BTA_API extern void BTA_DmSignalStrength(tBTA_SIG_STRENGTH_MASK mask, UINT16 period, BOOLEAN start);
1539
1540/*******************************************************************************
1541**
1542** Function         BTA_DmWriteInqTxPower
1543**
1544** Description      This command is used to write the inquiry transmit power level
1545**                  used to transmit the inquiry (ID) data packets.
1546**
1547** Parameters       tx_power - tx inquiry power to use, valid value is -70 ~ 20
1548
1549** Returns          void
1550**
1551*******************************************************************************/
1552BTA_API extern void BTA_DmWriteInqTxPower(INT8 tx_power);
1553
1554/*******************************************************************************
1555**
1556** Function         BTA_DmEirAddUUID
1557**
1558** Description      This function is called to add UUID into EIR.
1559**
1560** Parameters       tBT_UUID - UUID
1561**
1562** Returns          None
1563**
1564*******************************************************************************/
1565BTA_API extern void BTA_DmEirAddUUID (tBT_UUID *p_uuid);
1566
1567/*******************************************************************************
1568**
1569** Function         BTA_DmEirRemoveUUID
1570**
1571** Description      This function is called to remove UUID from EIR.
1572**
1573** Parameters       tBT_UUID - UUID
1574**
1575** Returns          None
1576**
1577*******************************************************************************/
1578BTA_API extern void BTA_DmEirRemoveUUID (tBT_UUID *p_uuid);
1579
1580/*******************************************************************************
1581**
1582** Function         BTA_DmSetEIRConfig
1583**
1584** Description      This function is called to override the BTA default EIR parameters.
1585**                  This funciton is only valid in a system where BTU & App task
1586**                  are in the same memory space.
1587**
1588** Parameters       Pointer to User defined EIR config
1589**
1590** Returns          None
1591**
1592*******************************************************************************/
1593BTA_API extern void BTA_DmSetEIRConfig (tBTA_DM_EIR_CONF *p_eir_cfg);
1594
1595/*******************************************************************************
1596**
1597** Function         BTA_CheckEirData
1598**
1599** Description      This function is called to get EIR data from significant part.
1600**
1601** Parameters       p_eir - pointer of EIR significant part
1602**                  type   - finding EIR data type
1603**                  p_length - return the length of EIR data
1604**
1605** Returns          pointer of EIR data
1606**
1607*******************************************************************************/
1608BTA_API extern UINT8 *BTA_CheckEirData( UINT8 *p_eir, UINT8 tag, UINT8 *p_length );
1609
1610/*******************************************************************************
1611**
1612** Function         BTA_GetEirService
1613**
1614** Description      This function is called to get BTA service mask from EIR.
1615**
1616** Parameters       p_eir - pointer of EIR significant part
1617**                  p_services - return the BTA service mask
1618**
1619** Returns          None
1620**
1621*******************************************************************************/
1622BTA_API extern void BTA_GetEirService( UINT8 *p_eir, tBTA_SERVICE_MASK *p_services );
1623
1624/*******************************************************************************
1625**
1626** Function         BTA_DmUseSsr
1627**
1628** Description      This function is called to check if the connected peer device
1629**                  supports SSR or not.
1630**
1631** Returns          TRUE, if SSR is supported
1632**
1633*******************************************************************************/
1634BTA_API extern BOOLEAN BTA_DmUseSsr( BD_ADDR bd_addr );
1635
1636
1637/*******************************************************************************
1638**
1639** Function         BTA_DmSetLocalDiRecord
1640**
1641** Description      This function adds a DI record to the local SDP database.
1642**
1643** Returns          BTA_SUCCESS if record set sucessfully, otherwise error code.
1644**
1645*******************************************************************************/
1646BTA_API extern tBTA_STATUS BTA_DmSetLocalDiRecord( tBTA_DI_RECORD *p_device_info,
1647	                          UINT32 *p_handle );
1648
1649/*******************************************************************************
1650**
1651** Function         BTA_DmGetLocalDiRecord
1652**
1653** Description      Get a specified DI record to the local SDP database. If no
1654**                  record handle is provided, the primary DI record will be
1655**                  returned.
1656**
1657** Returns          BTA_SUCCESS if record set sucessfully, otherwise error code.
1658**
1659*******************************************************************************/
1660BTA_API extern tBTA_STATUS BTA_DmGetLocalDiRecord( tBTA_DI_GET_RECORD *p_device_info,
1661	                          UINT32 *p_handle );
1662
1663/*******************************************************************************
1664**
1665** Function         BTA_DmDiDiscover
1666**
1667** Description      This function queries a remote device for DI information.
1668**
1669** Returns          None.
1670**
1671*******************************************************************************/
1672BTA_API extern void BTA_DmDiDiscover( BD_ADDR remote_device, tBTA_DISCOVERY_DB *p_db,
1673                       UINT32 len, tBTA_DM_SEARCH_CBACK *p_cback );
1674
1675/*******************************************************************************
1676**
1677** Function         BTA_DmGetDiRecord
1678**
1679** Description      This function retrieves a remote device's DI record from
1680**                  the specified database.
1681**
1682** Returns          None.
1683**
1684*******************************************************************************/
1685BTA_API extern tBTA_STATUS BTA_DmGetDiRecord( UINT8 get_record_index, tBTA_DI_GET_RECORD *p_device_info,
1686                        tBTA_DISCOVERY_DB *p_db );
1687
1688/*******************************************************************************
1689**
1690**
1691** Function         BTA_DmCloseACL
1692**
1693** Description      This function force to close an ACL connection and remove the
1694**                  device from the security database list of known devices.
1695**
1696** Parameters:      bd_addr       - Address of the peer device
1697**                  remove_dev    - remove device or not after link down
1698**                  transport     - which transport to close
1699
1700**
1701** Returns          void.
1702**
1703*******************************************************************************/
1704BTA_API extern void BTA_DmCloseACL(BD_ADDR bd_addr, BOOLEAN remove_dev, tBTA_TRANSPORT transport);
1705
1706/*******************************************************************************
1707**
1708** Function         BTA_SysFeatures
1709**
1710** Description      This function is called to set system features.
1711**
1712** Returns          void
1713**
1714*******************************************************************************/
1715BTA_API extern void BTA_SysFeatures (UINT16 sys_features);
1716
1717/*******************************************************************************
1718**
1719** Function         bta_dmexecutecallback
1720**
1721** Description      This function will request BTA to execute a call back in the context of BTU task
1722**                  This API was named in lower case because it is only intended
1723**                  for the internal customers(like BTIF).
1724**
1725** Returns          void
1726**
1727*******************************************************************************/
1728BTA_API extern void bta_dmexecutecallback (tBTA_DM_EXEC_CBACK* p_callback, void * p_param);
1729
1730#if (BTM_SCO_HCI_INCLUDED == TRUE)
1731/*******************************************************************************
1732**
1733** Function         BTA_DmPcmInitSamples
1734**
1735** Description      initialize the down sample converter.
1736**
1737**                  src_sps: original samples per second (source audio data)
1738**                            (ex. 44100, 48000)
1739**                  bits: number of bits per pcm sample (16)
1740**                  n_channels: number of channels (i.e. mono(1), stereo(2)...)
1741**
1742** Returns          none
1743**
1744*******************************************************************************/
1745BTA_API extern void BTA_DmPcmInitSamples (UINT32 src_sps, UINT32 bits, UINT32 n_channels);
1746
1747/**************************************************************************************
1748** Function         BTA_DmPcmResample
1749**
1750** Description      Down sampling utility to convert higher sampling rate into 8K/16bits
1751**                  PCM samples.
1752**
1753** Parameters       p_src: pointer to the buffer where the original sampling PCM
1754**                              are stored.
1755**                  in_bytes:  Length of the input PCM sample buffer in byte.
1756**                  p_dst:      pointer to the buffer which is to be used to store
1757**                              the converted PCM samples.
1758**
1759**
1760** Returns          INT32: number of samples converted.
1761**
1762**************************************************************************************/
1763BTA_API extern INT32 BTA_DmPcmResample (void *p_src, UINT32 in_bytes, void *p_dst);
1764#endif
1765
1766#if ((defined BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
1767/* BLE related API functions */
1768/*******************************************************************************
1769**
1770** Function         BTA_DmBleSecurityGrant
1771**
1772** Description      Grant security request access.
1773**
1774** Parameters:      bd_addr          - BD address of the peer
1775**                  res              - security grant status.
1776**
1777** Returns          void
1778**
1779*******************************************************************************/
1780BTA_API extern void BTA_DmBleSecurityGrant(BD_ADDR bd_addr, tBTA_DM_BLE_SEC_GRANT res);
1781
1782
1783
1784/*******************************************************************************
1785**
1786** Function         BTA_DmBleSetBgConnType
1787**
1788** Description      This function is called to set BLE connectable mode for a
1789**                  peripheral device.
1790**
1791** Parameters       bg_conn_type: it can be auto connection, or selective connection.
1792**                  p_select_cback: callback function when selective connection procedure
1793**                              is being used.
1794**
1795** Returns          void
1796**
1797*******************************************************************************/
1798BTA_API extern void BTA_DmBleSetBgConnType(tBTA_DM_BLE_CONN_TYPE bg_conn_type, tBTA_DM_BLE_SEL_CBACK *p_select_cback);
1799
1800/*******************************************************************************
1801**
1802** Function         BTA_DmBlePasskeyReply
1803**
1804** Description      Send BLE SMP passkey reply.
1805**
1806** Parameters:      bd_addr          - BD address of the peer
1807**                  accept           - passkey entry sucessful or declined.
1808**                  passkey          - passkey value, must be a 6 digit number,
1809**                                     can be lead by 0.
1810**
1811** Returns          void
1812**
1813*******************************************************************************/
1814BTA_API extern void BTA_DmBlePasskeyReply(BD_ADDR bd_addr, BOOLEAN accept, UINT32 passkey);
1815
1816/*******************************************************************************
1817**
1818** Function         BTA_DmAddBleDevice
1819**
1820** Description      Add a BLE device.  This function will be normally called
1821**                  during host startup to restore all required information
1822**                  for a LE device stored in the NVRAM.
1823**
1824** Parameters:      bd_addr          - BD address of the peer
1825**                  dev_type         - Remote device's device type.
1826**                  addr_type        - LE device address type.
1827**
1828** Returns          void
1829**
1830*******************************************************************************/
1831BTA_API extern void BTA_DmAddBleDevice(BD_ADDR bd_addr, tBLE_ADDR_TYPE addr_type,
1832                                       tBT_DEVICE_TYPE dev_type);
1833
1834
1835/*******************************************************************************
1836**
1837** Function         BTA_DmAddBleKey
1838**
1839** Description      Add/modify LE device information.  This function will be
1840**                  normally called during host startup to restore all required
1841**                  information stored in the NVRAM.
1842**
1843** Parameters:      bd_addr          - BD address of the peer
1844**                  p_le_key         - LE key values.
1845**                  key_type         - LE SMP key type.
1846**
1847** Returns          void
1848**
1849*******************************************************************************/
1850BTA_API extern void BTA_DmAddBleKey (BD_ADDR bd_addr,
1851                                     tBTA_LE_KEY_VALUE *p_le_key,
1852                                     tBTA_LE_KEY_TYPE key_type);
1853
1854/*******************************************************************************
1855**
1856** Function         BTA_DmSetBlePrefConnParams
1857**
1858** Description      This function is called to set the preferred connection
1859**                  parameters when default connection parameter is not desired.
1860**
1861** Parameters:      bd_addr          - BD address of the peripheral
1862**                  min_conn_int     - minimum preferred connection interval
1863**                  max_conn_int     - maximum preferred connection interval
1864**                  slave_latency    - preferred slave latency
1865**                  supervision_tout - preferred supervision timeout
1866**
1867**
1868** Returns          void
1869**
1870*******************************************************************************/
1871BTA_API extern void BTA_DmSetBlePrefConnParams(BD_ADDR bd_addr,
1872                               UINT16 min_conn_int, UINT16 max_conn_int,
1873                               UINT16 slave_latency, UINT16 supervision_tout );
1874
1875/*******************************************************************************
1876**
1877** Function         BTA_DmSetBleConnScanParams
1878**
1879** Description      This function is called to set scan parameters used in
1880**                  BLE connection request
1881**
1882** Parameters:      bd_addr          - BD address of the peripheral
1883**                  scan_interval    - scan interval
1884**                  scan_window      - scan window
1885**
1886** Returns          void
1887**
1888*******************************************************************************/
1889BTA_API extern void BTA_DmSetBleConnScanParams(UINT16 scan_interval,
1890                                               UINT16 scan_window );
1891
1892/*******************************************************************************
1893**
1894** Function         BTA_DmSetBleAdvParams
1895**
1896** Description      This function sets the advertising parameters BLE functionality.
1897**                  It is to be called when device act in peripheral or broadcaster
1898**                  role.
1899**
1900** Parameters:      adv_int_min    - adv interval minimum
1901**                  adv_int_max    - adv interval max
1902**                  p_dir_bda      - directed adv initator address
1903**
1904** Returns          void
1905**
1906*******************************************************************************/
1907BTA_API extern void BTA_DmSetBleAdvParams (UINT16 adv_int_min, UINT16 adv_int_max,
1908                                           tBLE_BD_ADDR *p_dir_bda);
1909/*******************************************************************************
1910**
1911** Function         BTA_DmSearchExt
1912**
1913** Description      This function searches for peer Bluetooth devices. It performs
1914**                  an inquiry and gets the remote name for devices. Service
1915**                  discovery is done if services is non zero
1916**
1917** Parameters       p_dm_inq: inquiry conditions
1918**                  services: if service is not empty, service discovery will be done.
1919**                            for all GATT based service condition, put num_uuid, and
1920**                            p_uuid is the pointer to the list of UUID values.
1921**                  p_cback: callback functino when search is completed.
1922**
1923**
1924**
1925** Returns          void
1926**
1927*******************************************************************************/
1928BTA_API extern void BTA_DmSearchExt(tBTA_DM_INQ *p_dm_inq, tBTA_SERVICE_MASK_EXT *p_services,
1929                                    tBTA_DM_SEARCH_CBACK *p_cback);
1930
1931/*******************************************************************************
1932**
1933** Function         BTA_DmDiscoverExt
1934**
1935** Description      This function does service discovery for services of a
1936**                  peer device. When services.num_uuid is 0, it indicates all
1937**                  GATT based services are to be searched; other wise a list of
1938**                  UUID of interested services should be provided through
1939**                  services.p_uuid.
1940**
1941**
1942**
1943** Returns          void
1944**
1945*******************************************************************************/
1946BTA_API extern void BTA_DmDiscoverExt(BD_ADDR bd_addr, tBTA_SERVICE_MASK_EXT *p_services,
1947                                    tBTA_DM_SEARCH_CBACK *p_cback, BOOLEAN sdp_search);
1948
1949/*******************************************************************************
1950**
1951** Function         BTA_DmDiscoverByTransport
1952**
1953** Description      This function does service discovery on particular transport
1954**                  for services of a
1955**                  peer device. When services.num_uuid is 0, it indicates all
1956**                  GATT based services are to be searched; other wise a list of
1957**                  UUID of interested services should be provided through
1958**                  p_services->p_uuid.
1959**
1960**
1961**
1962** Returns          void
1963**
1964*******************************************************************************/
1965BTA_API extern void BTA_DmDiscoverByTransport(BD_ADDR bd_addr, tBTA_SERVICE_MASK_EXT *p_services,
1966                                              tBTA_DM_SEARCH_CBACK *p_cback, BOOLEAN sdp_search,
1967                                              tBTA_TRANSPORT transport);
1968
1969/*******************************************************************************
1970**
1971** Function         BTA_DmSetEncryption
1972**
1973** Description      This function is called to ensure that connection is
1974**                  encrypted.  Should be called only on an open connection.
1975**                  Typically only needed for connections that first want to
1976**                  bring up unencrypted links, then later encrypt them.
1977**
1978** Parameters:      bd_addr       - Address of the peer device
1979**                  transport     - transport of the link to be encruypted
1980**                  p_callback    - Pointer to callback function to indicat the
1981**                                  link encryption status
1982**                  sec_act       - This is the security action to indicate
1983**                                  what knid of BLE security level is required for
1984**                                  the BLE link if the BLE is supported
1985**                                  Note: This parameter is ignored for the BR/EDR link
1986**                                        or the BLE is not supported
1987**
1988** Returns          void
1989**
1990**
1991*******************************************************************************/
1992BTA_API extern void BTA_DmSetEncryption(BD_ADDR bd_addr, tBTA_TRANSPORT transport,
1993                                        tBTA_DM_ENCRYPT_CBACK *p_callback,
1994                                         tBTA_DM_BLE_SEC_ACT sec_act);
1995
1996
1997/*******************************************************************************
1998**
1999** Function         BTA_DmBleObserve
2000**
2001** Description      This procedure keep the device listening for advertising
2002**                  events from a broadcast device.
2003**
2004** Parameters       start: start or stop observe.
2005**                  duration : Duration of the scan. Continuous scan if 0 is passed
2006**                  p_results_cb: Callback to be called with scan results
2007**
2008** Returns          void
2009**
2010*******************************************************************************/
2011BTA_API extern void BTA_DmBleObserve(BOOLEAN start, UINT8 duration,
2012                                           tBTA_DM_SEARCH_CBACK *p_results_cb);
2013
2014
2015#endif
2016
2017// btla-specific ++
2018/*******************************************************************************
2019**
2020** Function         BTA_DmSetAfhChannelAssessment
2021**
2022** Description      This function is called to set the channel assessment mode on or off
2023**
2024** Returns          status
2025**
2026*******************************************************************************/
2027BTA_API extern void BTA_DmSetAfhChannelAssessment (BOOLEAN enable_or_disable);
2028
2029#if BLE_INCLUDED == TRUE
2030// btla-specific --
2031/*******************************************************************************
2032**
2033** Function         BTA_DmBleConfigLocalPrivacy
2034**
2035** Description      Enable/disable privacy on the local device
2036**
2037** Parameters:      privacy_enable   - enable/disabe privacy on remote device.
2038**
2039** Returns          void
2040**
2041*******************************************************************************/
2042BTA_API extern void BTA_DmBleConfigLocalPrivacy(BOOLEAN privacy_enable);
2043
2044/*******************************************************************************
2045**
2046** Function         BTA_DmBleEnableRemotePrivacy
2047**
2048** Description      Enable/disable privacy on a remote device
2049**
2050** Parameters:      bd_addr          - BD address of the peer
2051**                  privacy_enable   - enable/disabe privacy on remote device.
2052**
2053** Returns          void
2054**
2055*******************************************************************************/
2056BTA_API extern void BTA_DmBleEnableRemotePrivacy(BD_ADDR bd_addr, BOOLEAN privacy_enable);
2057
2058
2059/*******************************************************************************
2060**
2061** Function         BTA_DmBleSetAdvConfig
2062**
2063** Description      This function is called to override the BTA default ADV parameters.
2064**
2065** Parameters       Pointer to User defined ADV data structure
2066**
2067** Returns          None
2068**
2069*******************************************************************************/
2070BTA_API extern void BTA_DmBleSetAdvConfig (tBTA_BLE_AD_MASK data_mask,
2071                                           tBTA_BLE_ADV_DATA *p_adv_cfg,
2072                                           tBTA_SET_ADV_DATA_CMPL_CBACK *p_adv_data_cback);
2073
2074/*******************************************************************************
2075**
2076** Function         BTA_DmBleSetScanRsp
2077**
2078** Description      This function is called to override the BTA scan response.
2079**
2080** Parameters       Pointer to User defined ADV data structure
2081**
2082** Returns          None
2083**
2084*******************************************************************************/
2085BTA_API extern void BTA_DmBleSetScanRsp (tBTA_BLE_AD_MASK data_mask,
2086                                         tBTA_BLE_ADV_DATA *p_adv_cfg,
2087                                         tBTA_SET_ADV_DATA_CMPL_CBACK *p_adv_data_cback);
2088
2089/*******************************************************************************
2090**
2091** Function         BTA_DmBleBroadcast
2092**
2093** Description      This function starts or stops LE broadcasting.
2094**
2095** Parameters       start: start or stop broadcast.
2096**
2097** Returns          None
2098**
2099*******************************************************************************/
2100BTA_API extern void BTA_DmBleBroadcast (BOOLEAN start);
2101
2102
2103/*******************************************************************************
2104**
2105** Function         BTA_BleEnableAdvInstance
2106**
2107** Description      This function enables the Multi ADV instance feature
2108**
2109** Parameters       p_params Pointer to ADV param user defined structure
2110**                  p_cback  Pointer to Multi ADV callback structure
2111**                  p_ref - Reference pointer
2112**
2113** Returns          None
2114**
2115*******************************************************************************/
2116BTA_API extern tBTA_STATUS BTA_BleEnableAdvInstance (tBTA_BLE_ADV_PARAMS *p_params,
2117                                tBTA_BLE_MULTI_ADV_CBACK *p_cback,void *p_ref);
2118
2119/*******************************************************************************
2120**
2121** Function         BTA_BleUpdateAdvInstParam
2122**
2123** Description      This function updates the Multi ADV instance params
2124**
2125** Parameters       inst_id Instance ID
2126**                  p_params Pointer to ADV param user defined structure
2127**
2128** Returns          None
2129**
2130*******************************************************************************/
2131BTA_API extern tBTA_STATUS BTA_BleUpdateAdvInstParam (UINT8 inst_id,
2132                                tBTA_BLE_ADV_PARAMS *p_params);
2133
2134/*******************************************************************************
2135**
2136** Function         BTA_BleCfgAdvInstData
2137**
2138** Description      This function is called to configure the ADV instance data
2139**
2140** Parameters       inst_id - Instance ID
2141**                  is_scan_rsp - Boolean value Scan response
2142**                  Pointer to User defined ADV data structure
2143** Returns          None
2144**
2145*******************************************************************************/
2146BTA_API extern tBTA_STATUS BTA_BleCfgAdvInstData (UINT8 inst_id, BOOLEAN is_scan_rsp,
2147                                tBTA_BLE_AD_MASK data_mask, tBTA_BLE_ADV_DATA *p_data);
2148
2149/*******************************************************************************
2150**
2151** Function         BTA_BleDisableAdvInstance
2152**
2153** Description      This function is called to disable the ADV instance
2154**
2155** Parameters       inst_id - Instance ID to be disabled
2156**
2157** Returns          None
2158**
2159*******************************************************************************/
2160BTA_API extern tBTA_STATUS BTA_BleDisableAdvInstance(UINT8 inst_id);
2161
2162/*******************************************************************************
2163**
2164** Function         BTA_DmBleUpdateConnectionParams
2165**
2166** Description      Update connection parameters, can only be used when connection is up.
2167**
2168** Parameters:      bd_addr   - BD address of the peer
2169**                  min_int   -     minimum connection interval, [0x0004~ 0x4000]
2170**                  max_int   -     maximum connection interval, [0x0004~ 0x4000]
2171**                  latency   -     slave latency [0 ~ 500]
2172**                  timeout   -     supervision timeout [0x000a ~ 0xc80]
2173**
2174** Returns          void
2175**
2176*******************************************************************************/
2177BTA_API extern void BTA_DmBleUpdateConnectionParams(BD_ADDR bd_addr, UINT16 min_int,
2178                                   UINT16 max_int, UINT16 latency, UINT16 timeout);
2179#endif
2180
2181#ifdef __cplusplus
2182}
2183#endif
2184
2185#endif /* BTA_API_H */
2186
2187