blob: 86d91826cbf37609a6ad990111242af8d72e3387 [file] [log] [blame]
The Android Open Source Project5738f832012-12-12 16:00:35 -08001/******************************************************************************
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
Andre Eisenbach781b5ad2013-05-28 15:11:43 +0900180#define BTA_ALL_APP_ID 0xFF
The Android Open Source Project5738f832012-12-12 16:00:35 -0800181
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. */
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800186#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 */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800192
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. */
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800196#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
The Android Open Source Project5738f832012-12-12 16:00:35 -0800200
201// btla-specific ++
202typedef UINT16 tBTA_DM_CONN;
203// btla-specific --
204
205/* Pairable Modes */
206#define BTA_DM_PAIRABLE 1
207#define BTA_DM_NON_PAIRABLE 0
208
209/* Connectable Paired Only Mode */
210#define BTA_DM_CONN_ALL 0
211#define BTA_DM_CONN_PAIRED 1
212
213/* Inquiry Modes */
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800214#define BTA_DM_INQUIRY_NONE BTM_INQUIRY_NONE /*No BR inquiry. */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800215#define BTA_DM_GENERAL_INQUIRY BTM_GENERAL_INQUIRY /* Perform general inquiry. */
216#define BTA_DM_LIMITED_INQUIRY BTM_LIMITED_INQUIRY /* Perform limited inquiry. */
217
218#if ((defined BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
219#define BTA_BLE_INQUIRY_NONE BTM_BLE_INQUIRY_NONE
220#define BTA_BLE_GENERAL_INQUIRY BTM_BLE_GENERAL_INQUIRY /* Perform LE general inquiry. */
221#define BTA_BLE_LIMITED_INQUIRY BTM_BLE_LIMITED_INQUIRY /* Perform LE limited inquiry. */
222#endif
223typedef UINT8 tBTA_DM_INQ_MODE;
224
225/* Inquiry Filter Type */
226#define BTA_DM_INQ_CLR BTM_CLR_INQUIRY_FILTER /* Clear inquiry filter. */
227#define BTA_DM_INQ_DEV_CLASS BTM_FILTER_COND_DEVICE_CLASS /* Filter on device class. */
228#define BTA_DM_INQ_BD_ADDR BTM_FILTER_COND_BD_ADDR /* Filter on a specific BD address. */
229
230typedef UINT8 tBTA_DM_INQ_FILT;
231
232/* Authorize Response */
233#define BTA_DM_AUTH_PERM 0 /* Authorized for future connections to the service */
234#define BTA_DM_AUTH_TEMP 1 /* Authorized for current connection only */
235#define BTA_DM_NOT_AUTH 2 /* Not authorized for the service */
236
237typedef UINT8 tBTA_AUTH_RESP;
238
239/* M/S preferred roles */
240#define BTA_ANY_ROLE 0x00
241#define BTA_MASTER_ROLE_PREF 0x01
242#define BTA_MASTER_ROLE_ONLY 0x02
243
244typedef UINT8 tBTA_PREF_ROLES;
245
246enum
247{
248
249 BTA_DM_NO_SCATTERNET, /* Device doesn't support scatternet, it might
250 support "role switch during connection" for
251 an incoming connection, when it already has
252 another connection in master role */
253 BTA_DM_PARTIAL_SCATTERNET, /* Device supports partial scatternet. It can have
254 simulateous connection in Master and Slave roles
255 for short period of time */
256 BTA_DM_FULL_SCATTERNET /* Device can have simultaneous connection in master
257 and slave roles */
258
259};
260
261
262/* Inquiry filter device class condition */
263typedef struct
264{
265 DEV_CLASS dev_class; /* device class of interest */
266 DEV_CLASS dev_class_mask; /* mask to determine the bits of device class of interest */
267} tBTA_DM_COD_COND;
268
269
270/* Inquiry Filter Condition */
271typedef union
272{
273 BD_ADDR bd_addr; /* BD address of device to filter. */
274 tBTA_DM_COD_COND dev_class_cond; /* Device class filter condition */
275} tBTA_DM_INQ_COND;
276
277/* Inquiry Parameters */
278typedef struct
279{
280 tBTA_DM_INQ_MODE mode; /* Inquiry mode, limited or general. */
281 UINT8 duration; /* Inquiry duration in 1.28 sec units. */
282 UINT8 max_resps; /* Maximum inquiry responses. Set to zero for unlimited responses. */
283 BOOLEAN report_dup; /* report duplicated inquiry response with higher RSSI value */
284 tBTA_DM_INQ_FILT filter_type; /* Filter condition type. */
285 tBTA_DM_INQ_COND filter_cond; /* Filter condition data. */
Matthew Xie7f3e4292013-09-30 12:44:10 -0700286#if (defined(BTA_HOST_INTERLEAVE_SEARCH) && BTA_HOST_INTERLEAVE_SEARCH == TRUE)
287 UINT8 intl_duration[4];/*duration array storing the interleave scan's time portions*/
288#endif
The Android Open Source Project5738f832012-12-12 16:00:35 -0800289} tBTA_DM_INQ;
290
291typedef struct
292{
293 UINT8 bta_dm_eir_min_name_len; /* minimum length of local name when it is shortened */
294#if (BTA_EIR_CANNED_UUID_LIST == TRUE)
295 UINT8 bta_dm_eir_uuid16_len; /* length of 16-bit UUIDs */
296 UINT8 *bta_dm_eir_uuid16; /* 16-bit UUIDs */
297#else
298 UINT32 uuid_mask[BTM_EIR_SERVICE_ARRAY_SIZE]; /* mask of UUID list in EIR */
299#endif
300 INT8 *bta_dm_eir_inq_tx_power; /* Inquiry TX power */
301 UINT8 bta_dm_eir_flag_len; /* length of flags in bytes */
302 UINT8 *bta_dm_eir_flags; /* flags for EIR */
303 UINT8 bta_dm_eir_manufac_spec_len; /* length of manufacturer specific in bytes */
304 UINT8 *bta_dm_eir_manufac_spec; /* manufacturer specific */
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800305 UINT8 bta_dm_eir_additional_len; /* length of additional data in bytes */
306 UINT8 *bta_dm_eir_additional; /* additional data */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800307} tBTA_DM_EIR_CONF;
308
309#if BLE_INCLUDED == TRUE
310/* ADV data flag bit definition used for BTM_BLE_AD_TYPE_FLAG */
311#define BTA_BLE_LIMIT_DISC_FLAG BTM_BLE_LIMIT_DISC_FLAG
312#define BTA_BLE_GEN_DISC_FLAG BTM_BLE_GEN_DISC_FLAG
313#define BTA_BLE_BREDR_NOT_SPT BTM_BLE_BREDR_NOT_SPT
314#define BTA_BLE_NON_LIMIT_DISC_FLAG BTM_BLE_NON_LIMIT_DISC_FLAG
315#define BTA_BLE_ADV_FLAG_MASK BTM_BLE_ADV_FLAG_MASK
316#define BTA_BLE_LIMIT_DISC_MASK BTM_BLE_LIMIT_DISC_MASK
317
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800318/* ADV data bit mask */
319#define BTA_BLE_AD_BIT_DEV_NAME BTM_BLE_AD_BIT_DEV_NAME
320#define BTA_BLE_AD_BIT_FLAGS BTM_BLE_AD_BIT_FLAGS
321#define BTA_BLE_AD_BIT_MANU BTM_BLE_AD_BIT_MANU
322#define BTA_BLE_AD_BIT_TX_PWR BTM_BLE_AD_BIT_TX_PWR
323#define BTA_BLE_AD_BIT_INT_RANGE BTM_BLE_AD_BIT_INT_RANGE
324#define BTA_BLE_AD_BIT_SERVICE BTM_BLE_AD_BIT_SERVICE
325#define BTA_BLE_AD_BIT_APPEARANCE BTM_BLE_AD_BIT_APPEARANCE
326#define BTA_BLE_AD_BIT_PROPRIETARY BTM_BLE_AD_BIT_PROPRIETARY
327#define BTA_DM_BLE_AD_BIT_SERVICE_SOL BTM_BLE_AD_BIT_SERVICE_SOL
328#define BTA_DM_BLE_AD_BIT_SERVICE_DATA BTM_BLE_AD_BIT_SERVICE_DATA
329#define BTA_DM_BLE_AD_BIT_SIGN_DATA BTM_BLE_AD_BIT_SIGN_DATA
330#define BTA_DM_BLE_AD_BIT_SERVICE_128SOL BTM_BLE_AD_BIT_SERVICE_128SOL
331#define BTA_DM_BLE_AD_BIT_PUBLIC_ADDR BTM_BLE_AD_BIT_PUBLIC_ADDR
332#define BTA_DM_BLE_AD_BIT_RANDOM_ADDR BTM_BLE_AD_BIT_RANDOM_ADDR
333
The Android Open Source Project5738f832012-12-12 16:00:35 -0800334typedef UINT16 tBTA_BLE_AD_MASK;
335
336/* slave preferred connection interval range */
337typedef struct
338{
339 UINT16 low;
340 UINT16 hi;
341
342}tBTA_BLE_INT_RANGE;
343
344/* Service tag supported in the device */
345typedef struct
346{
347 UINT8 num_service;
348 BOOLEAN list_cmpl;
349 UINT16 *p_uuid;
350}tBTA_BLE_SERVICE;
351
The Android Open Source Project5738f832012-12-12 16:00:35 -0800352
353typedef struct
354{
355 UINT8 len;
356 UINT8 *p_val;
357}tBTA_BLE_MANU;
358
359typedef struct
360{
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800361 UINT8 adv_type;
362 UINT8 len;
363 UINT8 *p_val; /* number of len byte */
364}tBTA_BLE_PROP_ELEM;
365
366/* vendor proprietary adv type */
367typedef struct
368{
369 UINT8 num_elem;
370 tBTA_BLE_PROP_ELEM *p_elem;
371}tBTA_BLE_PROPRIETARY;
372
373typedef struct
374{
375 tBTA_BLE_MANU manu; /* manufactuer data */
376 tBTA_BLE_INT_RANGE int_range; /* slave prefered conn interval range */
377 tBTA_BLE_SERVICE services; /* services */
378 UINT16 appearance; /* appearance data */
379 UINT8 flag;
380 tBTA_BLE_PROPRIETARY *p_proprietary;
381
The Android Open Source Project5738f832012-12-12 16:00:35 -0800382}tBTA_BLE_ADV_DATA;
383
384/* These are the fields returned in each device adv packet. It
385** is returned in the results callback if registered.
386*/
387typedef struct
388{
389 UINT8 conn_mode;
390 tBTA_BLE_AD_MASK ad_mask; /* mask of the valid adv data field */
391 UINT8 flag;
392 UINT8 tx_power_level;
393 UINT8 remote_name_len;
394 UINT8 *p_remote_name;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800395 tBTA_BLE_SERVICE service;
396} tBTA_BLE_INQ_DATA;
397#endif
398
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800399/* BLE customer specific feature function type definitions */
400/* data type used on customer specific feature for RSSI monitoring */
401#define BTA_BLE_RSSI_ALERT_HI 0
402#define BTA_BLE_RSSI_ALERT_RANGE 1
403#define BTA_BLE_RSSI_ALERT_LO 2
404typedef UINT8 tBTA_DM_BLE_RSSI_ALERT_TYPE;
405
406#define BTA_BLE_RSSI_ALERT_NONE BTM_BLE_RSSI_ALERT_NONE /* (0) */
407#define BTA_BLE_RSSI_ALERT_HI_BIT BTM_BLE_RSSI_ALERT_HI_BIT /* (1) */
408#define BTA_BLE_RSSI_ALERT_RANGE_BIT BTM_BLE_RSSI_ALERT_RANGE_BIT /* (1 << 1) */
409#define BTA_BLE_RSSI_ALERT_LO_BIT BTM_BLE_RSSI_ALERT_LO_BIT /* (1 << 2) */
410typedef UINT8 tBTA_DM_BLE_RSSI_ALERT_MASK;
411
412
413typedef void (tBTA_DM_BLE_RSSI_CBACK) (BD_ADDR bd_addr, tBTA_DM_BLE_RSSI_ALERT_TYPE alert_type, INT8 rssi);
414
415/* max number of filter spot for different filter type */
416#define BTA_DM_BLE_MAX_UUID_FILTER BTM_BLE_MAX_UUID_FILTER /* 8 */
417#define BTA_DM_BLE_MAX_ADDR_FILTER BTM_BLE_MAX_ADDR_FILTER /* 8 */
418#define BTA_DM_BLE_PF_STR_COND_MAX BTM_BLE_PF_STR_COND_MAX /* 4 apply to manu data , or local name */
419#define BTA_DM_BLE_PF_STR_LEN_MAX BTM_BLE_PF_STR_LEN_MAX /* match for first 20 bytes */
420
421#define BTA_DM_BLE_PF_LOGIC_OR 0
422#define BTA_DM_BLE_PF_LOGIC_AND 1
423typedef UINT8 tBTA_DM_BLE_PF_LOGIC_TYPE;
424
425enum
426{
427 BTA_DM_BLE_SCAN_COND_ADD,
428 BTA_DM_BLE_SCAN_COND_DELETE,
429 BTA_DM_BLE_SCAN_COND_CLEAR = 2
430};
431typedef UINT8 tBTA_DM_BLE_SCAN_COND_OP;
432
433/* filter selection bit index */
434#define BTA_DM_BLE_PF_ADDR_FILTER BTM_BLE_PF_ADDR_FILTER
Andre Eisenbachb203d472013-11-20 17:23:06 -0800435#define BTA_DM_BLE_PF_SRVC_DATA BTM_BLE_PF_SRVC_DATA
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800436#define BTA_DM_BLE_PF_SRVC_UUID BTM_BLE_PF_SRVC_UUID
437#define BTA_DM_BLE_PF_SRVC_SOL_UUID BTM_BLE_PF_SRVC_SOL_UUID
438#define BTA_DM_BLE_PF_LOCAL_NAME BTM_BLE_PF_LOCAL_NAME
439#define BTA_DM_BLE_PF_MANU_DATA BTM_BLE_PF_MANU_DATA
Andre Eisenbachb203d472013-11-20 17:23:06 -0800440#define BTA_DM_BLE_PF_SRVC_DATA_PATTERN BTM_BLE_PF_SRVC_DATA_PATTERN
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800441#define BTA_DM_BLE_PF_TYPE_MAX BTM_BLE_PF_TYPE_MAX
Andre Eisenbach3aa60542013-03-22 18:00:51 -0700442#define BTA_DM_BLE_PF_TYPE_ALL BTM_BLE_PF_TYPE_ALL
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800443typedef UINT8 tBTA_DM_BLE_PF_COND_TYPE;
444
Andre Eisenbachb203d472013-11-20 17:23:06 -0800445typedef union
446{
447 UINT16 uuid16_mask;
448 UINT32 uuid32_mask;
449 UINT8 uuid128_mask[LEN_UUID_128];
450}tBTA_DM_BLE_PF_COND_MASK;
451
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800452typedef struct
453{
454 tBLE_BD_ADDR *p_target_addr; /* target address, if NULL, generic UUID filter */
455 tBT_UUID uuid; /* UUID condition */
456 tBTA_DM_BLE_PF_LOGIC_TYPE cond_logic; /* AND/OR */
Andre Eisenbachb203d472013-11-20 17:23:06 -0800457 tBTA_DM_BLE_PF_COND_MASK *p_uuid_mask; /* UUID condition mask, if NULL, match exact as UUID condition */
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800458}tBTA_DM_BLE_PF_UUID_COND;
459
460typedef struct
461{
462 UINT8 data_len; /* <= 20 bytes */
463 UINT8 *p_data;
464}tBTA_DM_BLE_PF_LOCAL_NAME_COND;
465
466typedef struct
467{
468 UINT16 company_id; /* company ID */
469 UINT8 data_len; /* <= 20 bytes */
470 UINT8 *p_pattern;
Andre Eisenbachb203d472013-11-20 17:23:06 -0800471 UINT16 company_id_mask; /* UUID value mask */
472 UINT8 *p_pattern_mask; /* Manufactuer data matching mask, same length as data pattern,
473 set to all 0xff, match exact data */
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800474}tBTA_DM_BLE_PF_MANU_COND;
475
Andre Eisenbachb203d472013-11-20 17:23:06 -0800476typedef struct
477{
478 UINT16 uuid; /* service ID */
479 UINT8 data_len; /* <= 20 bytes */
480 UINT8 *p_pattern;
481}tBTA_DM_BLE_PF_SRVC_PATTERN_COND;
482
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800483typedef union
484{
485 tBLE_BD_ADDR target_addr;
486 tBTA_DM_BLE_PF_LOCAL_NAME_COND local_name; /* lcoal name filtering */
487 tBTA_DM_BLE_PF_MANU_COND manu_data; /* manufactuer data filtering */
488 tBTA_DM_BLE_PF_UUID_COND srvc_uuid; /* service UUID filtering */
489 tBTA_DM_BLE_PF_UUID_COND solicitate_uuid; /* solicitated service UUID filtering */
Andre Eisenbachb203d472013-11-20 17:23:06 -0800490 tBTA_DM_BLE_PF_SRVC_PATTERN_COND srvc_data; /* service data pattern */
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800491}tBTA_DM_BLE_PF_COND_PARAM;
492
The Android Open Source Project5738f832012-12-12 16:00:35 -0800493typedef INT8 tBTA_DM_RSSI_VALUE;
494typedef UINT8 tBTA_DM_LINK_QUALITY_VALUE;
495
496
497/* signal strength mask */
498#define BTA_SIG_STRENGTH_RSSI_MASK 1
499#define BTA_SIG_STRENGTH_LINK_QUALITY_MASK 2
500
501typedef UINT8 tBTA_SIG_STRENGTH_MASK;
502
503
504/* Security Callback Events */
505#define BTA_DM_ENABLE_EVT 0 /* Enable Event */
506#define BTA_DM_DISABLE_EVT 1 /* Disable Event */
507#define BTA_DM_PIN_REQ_EVT 2 /* PIN request. */
508#define BTA_DM_AUTH_CMPL_EVT 3 /* Authentication complete indication. */
509#define BTA_DM_AUTHORIZE_EVT 4 /* Authorization request. */
510#define BTA_DM_LINK_UP_EVT 5 /* Connection UP event */
511#define BTA_DM_LINK_DOWN_EVT 6 /* Connection DOWN event */
512#define BTA_DM_SIG_STRENGTH_EVT 7 /* Signal strength for bluetooth connection */
513#define BTA_DM_BUSY_LEVEL_EVT 8 /* System busy level */
514#define BTA_DM_BOND_CANCEL_CMPL_EVT 9 /* Bond cancel complete indication */
515#define BTA_DM_SP_CFM_REQ_EVT 10 /* Simple Pairing User Confirmation request. */
516#define BTA_DM_SP_KEY_NOTIF_EVT 11 /* Simple Pairing Passkey Notification */
517#define BTA_DM_SP_RMT_OOB_EVT 12 /* Simple Pairing Remote OOB Data request. */
518#define BTA_DM_SP_KEYPRESS_EVT 13 /* Key press notification event. */
519#define BTA_DM_ROLE_CHG_EVT 14 /* Role Change event. */
520#define BTA_DM_BLE_KEY_EVT 15 /* BLE SMP key event for peer device keys */
521#define BTA_DM_BLE_SEC_REQ_EVT 16 /* BLE SMP security request */
522#define BTA_DM_BLE_PASSKEY_NOTIF_EVT 17 /* SMP passkey notification event */
523#define BTA_DM_BLE_PASSKEY_REQ_EVT 18 /* SMP passkey request event */
524#define BTA_DM_BLE_OOB_REQ_EVT 19 /* SMP OOB request event */
525#define BTA_DM_BLE_LOCAL_IR_EVT 20 /* BLE local IR event */
526#define BTA_DM_BLE_LOCAL_ER_EVT 21 /* BLE local ER event */
527// btla-specific ++
528#define BTA_DM_BLE_AUTH_CMPL_EVT 22 /* BLE Auth complete */
529// btla-specific --
530#define BTA_DM_DEV_UNPAIRED_EVT 23
531#define BTA_DM_HW_ERROR_EVT 24 /* BT Chip H/W error */
532typedef UINT8 tBTA_DM_SEC_EVT;
533
534/* Structure associated with BTA_DM_ENABLE_EVT */
535typedef struct
536{
537 BD_ADDR bd_addr; /* BD address of local device. */
538 tBTA_STATUS status;
539} tBTA_DM_ENABLE;
540
541/* Structure associated with BTA_DM_PIN_REQ_EVT */
542typedef struct
543{
544 BD_ADDR bd_addr; /* BD address peer device. */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800545 DEV_CLASS dev_class; /* Class of Device */
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800546 BD_NAME bd_name; /* Name of peer device. */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800547} tBTA_DM_PIN_REQ;
548
549/* BLE related definition */
550
551#define BTA_DM_AUTH_FAIL_BASE (HCI_ERR_MAX_ERR + 10)
552#define BTA_DM_AUTH_CONVERT_SMP_CODE(x) (BTA_DM_AUTH_FAIL_BASE + (x))
553#define BTA_DM_AUTH_SMP_PASSKEY_FAIL BTA_DM_AUTH_CONVERT_SMP_CODE (SMP_PASSKEY_ENTRY_FAIL)
554#define BTA_DM_AUTH_SMP_OOB_FAIL (BTA_DM_AUTH_FAIL_BASE + SMP_OOB_FAIL)
555#define BTA_DM_AUTH_SMP_PAIR_AUTH_FAIL (BTA_DM_AUTH_FAIL_BASE + SMP_PAIR_AUTH_FAIL)
556#define BTA_DM_AUTH_SMP_CONFIRM_VALUE_FAIL (BTA_DM_AUTH_FAIL_BASE + SMP_CONFIRM_VALUE_ERR)
557#define BTA_DM_AUTH_SMP_PAIR_NOT_SUPPORT (BTA_DM_AUTH_FAIL_BASE + SMP_PAIR_NOT_SUPPORT)
558#define BTA_DM_AUTH_SMP_ENC_KEY_SIZE (BTA_DM_AUTH_FAIL_BASE + SMP_ENC_KEY_SIZE)
559#define BTA_DM_AUTH_SMP_INVALID_CMD (BTA_DM_AUTH_FAIL_BASE + SMP_INVALID_CMD)
560#define BTA_DM_AUTH_SMP_UNKNOWN_ERR (BTA_DM_AUTH_FAIL_BASE + SMP_PAIR_FAIL_UNKNOWN)
561#define BTA_DM_AUTH_SMP_REPEATED_ATTEMPT (BTA_DM_AUTH_FAIL_BASE + SMP_REPEATED_ATTEMPTS)
562#define BTA_DM_AUTH_SMP_INTERNAL_ERR (BTA_DM_AUTH_FAIL_BASE + SMP_PAIR_INTERNAL_ERR)
563#define BTA_DM_AUTH_SMP_UNKNOWN_IO (BTA_DM_AUTH_FAIL_BASE + SMP_UNKNOWN_IO_CAP)
564#define BTA_DM_AUTH_SMP_INIT_FAIL (BTA_DM_AUTH_FAIL_BASE + SMP_INIT_FAIL)
565#define BTA_DM_AUTH_SMP_CONFIRM_FAIL (BTA_DM_AUTH_FAIL_BASE + SMP_CONFIRM_FAIL)
566#define BTA_DM_AUTH_SMP_BUSY (BTA_DM_AUTH_FAIL_BASE + SMP_BUSY)
567#define BTA_DM_AUTH_SMP_ENC_FAIL (BTA_DM_AUTH_FAIL_BASE + SMP_ENC_FAIL)
568#define BTA_DM_AUTH_SMP_RSP_TIMEOUT (BTA_DM_AUTH_FAIL_BASE + SMP_RSP_TIMEOUT)
569
570/* connection parameter boundary value and dummy value */
571#define BTA_DM_BLE_SCAN_INT_MIN BTM_BLE_SCAN_INT_MIN
572#define BTA_DM_BLE_SCAN_INT_MAX BTM_BLE_SCAN_INT_MAX
573#define BTA_DM_BLE_SCAN_WIN_MIN BTM_BLE_SCAN_WIN_MIN
574#define BTA_DM_BLE_SCAN_WIN_MAX BTM_BLE_SCAN_WIN_MAX
575#define BTA_DM_BLE_CONN_INT_MIN BTM_BLE_CONN_INT_MIN
576#define BTA_DM_BLE_CONN_INT_MAX BTM_BLE_CONN_INT_MAX
577#define BTA_DM_BLE_CONN_LATENCY_MAX BTM_BLE_CONN_LATENCY_MAX
578#define BTA_DM_BLE_CONN_SUP_TOUT_MIN BTM_BLE_CONN_SUP_TOUT_MIN
579#define BTA_DM_BLE_CONN_SUP_TOUT_MAX BTM_BLE_CONN_SUP_TOUT_MAX
580#define BTA_DM_BLE_CONN_PARAM_UNDEF BTM_BLE_CONN_PARAM_UNDEF /* use this value when a specific value not to be overwritten */
581
582
583#define BTA_LE_KEY_PENC BTM_LE_KEY_PENC /* encryption information of peer device */
584#define BTA_LE_KEY_PID BTM_LE_KEY_PID /* identity key of the peer device */
585#define BTA_LE_KEY_PCSRK BTM_LE_KEY_PCSRK /* peer SRK */
586#define BTA_LE_KEY_LENC BTM_LE_KEY_LENC /* master role security information:div */
587#define BTA_LE_KEY_LID BTM_LE_KEY_LID /* master device ID key */
588#define BTA_LE_KEY_LCSRK BTM_LE_KEY_LCSRK /* local CSRK has been deliver to peer */
589typedef UINT8 tBTA_LE_KEY_TYPE; /* can be used as a bit mask */
590
591
592typedef tBTM_LE_PENC_KEYS tBTA_LE_PENC_KEYS ;
593typedef tBTM_LE_PCSRK_KEYS tBTA_LE_PCSRK_KEYS;
594typedef tBTM_LE_LENC_KEYS tBTA_LE_LENC_KEYS ;
595typedef tBTM_LE_LCSRK_KEYS tBTA_LE_LCSRK_KEYS ;
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800596typedef tBTM_LE_PID_KEYS tBTA_LE_PID_KEYS ;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800597
598typedef union
599{
600 tBTA_LE_PENC_KEYS penc_key; /* received peer encryption key */
601 tBTA_LE_PCSRK_KEYS psrk_key; /* received peer device SRK */
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800602 tBTA_LE_PID_KEYS pid_key; /* peer device ID key */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800603 tBTA_LE_LENC_KEYS lenc_key; /* local encryption reproduction keys LTK = = d1(ER,DIV,0)*/
604 tBTA_LE_LCSRK_KEYS lcsrk_key; /* local device CSRK = d1(ER,DIV,1)*/
605}tBTA_LE_KEY_VALUE;
606
607#define BTA_BLE_LOCAL_KEY_TYPE_ID 1
608#define BTA_BLE_LOCAL_KEY_TYPE_ER 2
609typedef UINT8 tBTA_DM_BLE_LOCAL_KEY_MASK;
610
611typedef struct
612{
613 BT_OCTET16 ir;
614 BT_OCTET16 irk;
615 BT_OCTET16 dhk;
616}tBTA_BLE_LOCAL_ID_KEYS;
617
618#define BTA_DM_SEC_GRANTED BTA_SUCCESS
619#define BTA_DM_SEC_PAIR_NOT_SPT BTA_DM_AUTH_SMP_PAIR_NOT_SUPPORT
620#define BTA_DM_SEC_REP_ATTEMPTS BTA_DM_AUTH_SMP_REPEATED_ATTEMPT
621typedef UINT8 tBTA_DM_BLE_SEC_GRANT;
622
623
624#define BTA_DM_BLE_ONN_NONE BTM_BLE_CONN_NONE
625#define BTA_DM_BLE_CONN_AUTO BTM_BLE_CONN_AUTO
626#define BTA_DM_BLE_CONN_SELECTIVE BTM_BLE_CONN_SELECTIVE
627typedef UINT8 tBTA_DM_BLE_CONN_TYPE;
628
629typedef BOOLEAN (tBTA_DM_BLE_SEL_CBACK)(BD_ADDR random_bda, UINT8 *p_remote_name);
630
631/* Structure associated with BTA_DM_BLE_SEC_REQ_EVT */
632typedef struct
633{
634 BD_ADDR bd_addr; /* peer address */
635 BD_NAME bd_name; /* peer device name */
636} tBTA_DM_BLE_SEC_REQ;
637
638typedef struct
639{
640 BD_ADDR bd_addr; /* peer address */
641 tBTM_LE_KEY_TYPE key_type;
642 tBTM_LE_KEY_VALUE key_value;
643}tBTA_DM_BLE_KEY;
644
645/* Structure associated with BTA_DM_AUTH_CMPL_EVT */
646typedef struct
647{
648 BD_ADDR bd_addr; /* BD address peer device. */
649 BD_NAME bd_name; /* Name of peer device. */
650 BOOLEAN key_present; /* Valid link key value in key element */
651 LINK_KEY key; /* Link key associated with peer device. */
652 UINT8 key_type; /* The type of Link Key */
653 BOOLEAN success; /* TRUE of authentication succeeded, FALSE if failed. */
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800654#if BLE_INCLUDED == TRUE
655 BOOLEAN privacy_enabled; /* used for BLE device only */
656#endif
The Android Open Source Project5738f832012-12-12 16:00:35 -0800657 UINT8 fail_reason; /* The HCI reason/error code for when success=FALSE */
658
659} tBTA_DM_AUTH_CMPL;
660
661
662/* Structure associated with BTA_DM_AUTHORIZE_EVT */
663typedef struct
664{
665 BD_ADDR bd_addr; /* BD address peer device. */
666 BD_NAME bd_name; /* Name of peer device. */
667 tBTA_SERVICE_ID service; /* Service ID to authorize. */
668// btla-specific ++
669 DEV_CLASS dev_class;
670// btla-specific --
671} tBTA_DM_AUTHORIZE;
672
673/* Structure associated with BTA_DM_LINK_UP_EVT */
674typedef struct
675{
676 BD_ADDR bd_addr; /* BD address peer device. */
677} tBTA_DM_LINK_UP;
678
679/* Structure associated with BTA_DM_LINK_DOWN_EVT */
680typedef struct
681{
682 BD_ADDR bd_addr; /* BD address peer device. */
683 UINT8 status; /* connection open/closed */
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800684 BOOLEAN is_removed; /* TRUE if device is removed when link is down */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800685} tBTA_DM_LINK_DOWN;
686
687/* Structure associated with BTA_DM_ROLE_CHG_EVT */
688typedef struct
689{
690 BD_ADDR bd_addr; /* BD address peer device. */
691 UINT8 new_role; /* the new connection role */
692} tBTA_DM_ROLE_CHG;
693
694/* Structure associated with BTA_DM_SIG_STRENGTH_EVT */
695typedef struct
696{
697 BD_ADDR bd_addr; /* BD address peer device. */
698 tBTA_SIG_STRENGTH_MASK mask; /* mask for the values that are valid */
699 tBTA_DM_RSSI_VALUE rssi_value;
700 tBTA_DM_LINK_QUALITY_VALUE link_quality_value;
701
702} tBTA_DM_SIG_STRENGTH;
703
704/* Structure associated with BTA_DM_BUSY_LEVEL_EVT */
705typedef struct
706{
707 UINT8 level; /* when paging or inquiring, level is 10.
708 Otherwise, the number of ACL links */
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800709 UINT8 level_flags; /* indicates individual flags */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800710} tBTA_DM_BUSY_LEVEL;
711
712#define BTA_IO_CAP_OUT BTM_IO_CAP_OUT /* DisplayOnly */
713#define BTA_IO_CAP_IO BTM_IO_CAP_IO /* DisplayYesNo */
714#define BTA_IO_CAP_IN BTM_IO_CAP_IN /* KeyboardOnly */
715#define BTA_IO_CAP_NONE BTM_IO_CAP_NONE /* NoInputNoOutput */
716typedef tBTM_IO_CAP tBTA_IO_CAP;
717
718#define BTA_AUTH_SP_NO BTM_AUTH_SP_NO /* 0 MITM Protection Not Required - Single Profile/non-bonding
719 Numeric comparison with automatic accept allowed */
720#define BTA_AUTH_SP_YES BTM_AUTH_SP_YES /* 1 MITM Protection Required - Single Profile/non-bonding
721 Use IO Capabilities to determine authentication procedure */
722#define BTA_AUTH_AP_NO BTM_AUTH_AP_NO /* 2 MITM Protection Not Required - All Profiles/dedicated bonding
723 Numeric comparison with automatic accept allowed */
724#define BTA_AUTH_AP_YES BTM_AUTH_AP_YES /* 3 MITM Protection Required - All Profiles/dedicated bonding
725 Use IO Capabilities to determine authentication procedure */
726#define BTA_AUTH_SPGB_NO BTM_AUTH_SPGB_NO /* 4 MITM Protection Not Required - Single Profiles/general bonding
727 Numeric comparison with automatic accept allowed */
728#define BTA_AUTH_SPGB_YES BTM_AUTH_SPGB_YES /* 5 MITM Protection Required - Single Profiles/general bonding
729 Use IO Capabilities to determine authentication procedure */
730typedef tBTM_AUTH_REQ tBTA_AUTH_REQ;
731
732#define BTA_AUTH_DD_BOND BTM_AUTH_DD_BOND /* 2 this bit is set for dedicated bonding */
733#define BTA_AUTH_GEN_BOND BTM_AUTH_SPGB_NO /* 4 this bit is set for general bonding */
734#define BTA_AUTH_BONDS BTM_AUTH_BONDS /* 6 the general/dedicated bonding bits */
735
736#define BTA_LE_AUTH_NO_BOND BTM_LE_AUTH_REQ_NO_BOND /* 0*/
737#define BTA_LE_AUTH_BOND BTM_LE_AUTH_REQ_BOND /* 1 << 0 */
738#define BTA_LE_AUTH_REQ_MITM BTM_LE_AUTH_REQ_MITM /* 1 << 2 */
739typedef tBTM_LE_AUTH_REQ tBTA_LE_AUTH_REQ; /* combination of the above bit pattern */
740
741#define BTA_OOB_NONE BTM_OOB_NONE
742#define BTA_OOB_PRESENT BTM_OOB_PRESENT
743#if BTM_OOB_INCLUDED == TRUE
744#define BTA_OOB_UNKNOWN BTM_OOB_UNKNOWN
745#endif
746typedef tBTM_OOB_DATA tBTA_OOB_DATA;
747
748/* Structure associated with BTA_DM_SP_CFM_REQ_EVT */
749typedef struct
750{
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800751 /* Note: First 3 data members must be, bd_addr, dev_class, and bd_name in order */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800752 BD_ADDR bd_addr; /* peer address */
753 DEV_CLASS dev_class; /* peer CoD */
754 BD_NAME bd_name; /* peer device name */
755 UINT32 num_val; /* the numeric value for comparison. If just_works, do not show this number to UI */
756 BOOLEAN just_works; /* TRUE, if "Just Works" association model */
757 tBTA_AUTH_REQ loc_auth_req; /* Authentication required for local device */
758 tBTA_AUTH_REQ rmt_auth_req; /* Authentication required for peer device */
759 tBTA_IO_CAP loc_io_caps; /* IO Capabilities of local device */
760 tBTA_AUTH_REQ rmt_io_caps; /* IO Capabilities of remote device */
761} tBTA_DM_SP_CFM_REQ;
762
763enum
764{
765 BTA_SP_KEY_STARTED, /* passkey entry started */
766 BTA_SP_KEY_ENTERED, /* passkey digit entered */
767 BTA_SP_KEY_ERASED, /* passkey digit erased */
768 BTA_SP_KEY_CLEARED, /* passkey cleared */
769 BTA_SP_KEY_COMPLT /* passkey entry completed */
770};
771typedef UINT8 tBTA_SP_KEY_TYPE;
772
773/* Structure associated with BTA_DM_SP_KEYPRESS_EVT */
774typedef struct
775{
776 BD_ADDR bd_addr; /* peer address */
777 tBTA_SP_KEY_TYPE notif_type;
778}tBTA_DM_SP_KEY_PRESS;
779
780/* Structure associated with BTA_DM_SP_KEY_NOTIF_EVT */
781typedef struct
782{
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800783 /* Note: First 3 data members must be, bd_addr, dev_class, and bd_name in order */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800784 BD_ADDR bd_addr; /* peer address */
785 DEV_CLASS dev_class; /* peer CoD */
786 BD_NAME bd_name; /* peer device name */
787 UINT32 passkey; /* the numeric value for comparison. If just_works, do not show this number to UI */
788} tBTA_DM_SP_KEY_NOTIF;
789
790/* Structure associated with BTA_DM_SP_RMT_OOB_EVT */
791typedef struct
792{
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800793 /* Note: First 3 data members must be, bd_addr, dev_class, and bd_name in order */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800794 BD_ADDR bd_addr; /* peer address */
795 DEV_CLASS dev_class; /* peer CoD */
796 BD_NAME bd_name; /* peer device name */
797} tBTA_DM_SP_RMT_OOB;
798
799/* Structure associated with BTA_DM_BOND_CANCEL_CMPL_EVT */
800typedef struct
801{
802 tBTA_STATUS result; /* TRUE of bond cancel succeeded, FALSE if failed. */
803} tBTA_DM_BOND_CANCEL_CMPL;
804
805/* Union of all security callback structures */
806typedef union
807{
808 tBTA_DM_ENABLE enable; /* BTA enabled */
809 tBTA_DM_PIN_REQ pin_req; /* PIN request. */
810 tBTA_DM_AUTH_CMPL auth_cmpl; /* Authentication complete indication. */
811 tBTA_DM_AUTHORIZE authorize; /* Authorization request. */
812 tBTA_DM_LINK_UP link_up; /* ACL connection down event */
813 tBTA_DM_LINK_DOWN link_down; /* ACL connection down event */
814 tBTA_DM_SIG_STRENGTH sig_strength; /* rssi and link quality value */
815 tBTA_DM_BUSY_LEVEL busy_level; /* System busy level */
816 tBTA_DM_SP_CFM_REQ cfm_req; /* user confirm request */
817 tBTA_DM_SP_KEY_NOTIF key_notif; /* passkey notification */
818 tBTA_DM_SP_RMT_OOB rmt_oob; /* remote oob */
819 tBTA_DM_BOND_CANCEL_CMPL bond_cancel_cmpl; /* Bond Cancel Complete indication */
820 tBTA_DM_SP_KEY_PRESS key_press; /* key press notification event */
821 tBTA_DM_ROLE_CHG role_chg; /* role change event */
822 tBTA_DM_BLE_SEC_REQ ble_req; /* BLE SMP related request */
823 tBTA_DM_BLE_KEY ble_key; /* BLE SMP keys used when pairing */
824 tBTA_BLE_LOCAL_ID_KEYS ble_id_keys; /* IR event */
825 BT_OCTET16 ble_er; /* ER event data */
826} tBTA_DM_SEC;
827
828/* Security callback */
829typedef void (tBTA_DM_SEC_CBACK)(tBTA_DM_SEC_EVT event, tBTA_DM_SEC *p_data);
830
831/* Vendor Specific Command Callback */
832typedef tBTM_VSC_CMPL_CB tBTA_VENDOR_CMPL_CBACK;
833
834/* Search callback events */
835#define BTA_DM_INQ_RES_EVT 0 /* Inquiry result for a peer device. */
836#define BTA_DM_INQ_CMPL_EVT 1 /* Inquiry complete. */
837#define BTA_DM_DISC_RES_EVT 2 /* Discovery result for a peer device. */
838#define BTA_DM_DISC_BLE_RES_EVT 3 /* Discovery result for BLE GATT based servoce on a peer device. */
839#define BTA_DM_DISC_CMPL_EVT 4 /* Discovery complete. */
840#define BTA_DM_DI_DISC_CMPL_EVT 5 /* Discovery complete. */
841#define BTA_DM_SEARCH_CANCEL_CMPL_EVT 6 /* Search cancelled */
842
843typedef UINT8 tBTA_DM_SEARCH_EVT;
844
845#define BTA_DM_INQ_RES_IGNORE_RSSI BTM_INQ_RES_IGNORE_RSSI /* 0x7f RSSI value not supplied (ignore it) */
846
847/* Structure associated with BTA_DM_INQ_RES_EVT */
848typedef struct
849{
850 BD_ADDR bd_addr; /* BD address peer device. */
851 DEV_CLASS dev_class; /* Device class of peer device. */
852 BOOLEAN remt_name_not_required; /* Application sets this flag if it already knows the name of the device */
853 /* If the device name is known to application BTA skips the remote name request */
854 BOOLEAN is_limited; /* TRUE, if the limited inquiry bit is set in the CoD */
855 INT8 rssi; /* The rssi value */
856 UINT8 *p_eir; /* received EIR */
857#if (BLE_INCLUDED == TRUE)
858 UINT8 inq_result_type;
859 UINT8 ble_addr_type;
860 tBTM_BLE_EVT_TYPE ble_evt_type;
861 tBT_DEVICE_TYPE device_type;
862#endif
863
864} tBTA_DM_INQ_RES;
865
866/* Structure associated with BTA_DM_INQ_CMPL_EVT */
867typedef struct
868{
869 UINT8 num_resps; /* Number of inquiry responses. */
870} tBTA_DM_INQ_CMPL;
871
872/* Structure associated with BTA_DM_DI_DISC_CMPL_EVT */
873typedef struct
874{
875 BD_ADDR bd_addr; /* BD address peer device. */
876 UINT8 num_record; /* Number of DI record */
877 tBTA_STATUS result;
878} tBTA_DM_DI_DISC_CMPL;
879
880/* Structure associated with BTA_DM_DISC_RES_EVT */
881typedef struct
882{
883 BD_ADDR bd_addr; /* BD address peer device. */
884 BD_NAME bd_name; /* Name of peer device. */
885 tBTA_SERVICE_MASK services; /* Services found on peer device. */
886// btla-specific ++
887 UINT8 * p_raw_data; /* Raw data for discovery DB */
888 UINT32 raw_data_size; /* size of raw data */
889 tBT_DEVICE_TYPE device_type; /* device type in case it is BLE device */
890 UINT32 num_uuids;
891 UINT8 *p_uuid_list;
892// btla-specific --
893 tBTA_STATUS result;
894} tBTA_DM_DISC_RES;
895
896/* Structure associated with tBTA_DM_DISC_BLE_RES */
897typedef struct
898{
899 BD_ADDR bd_addr; /* BD address peer device. */
900 BD_NAME bd_name; /* Name of peer device. */
901 tBT_UUID service; /* GATT based Services UUID found on peer device. */
902} tBTA_DM_DISC_BLE_RES;
903
904
905/* Union of all search callback structures */
906typedef union
907{
908 tBTA_DM_INQ_RES inq_res; /* Inquiry result for a peer device. */
909 tBTA_DM_INQ_CMPL inq_cmpl; /* Inquiry complete. */
910 tBTA_DM_DISC_RES disc_res; /* Discovery result for a peer device. */
911 tBTA_DM_DISC_BLE_RES disc_ble_res; /* discovery result for GATT based service */
912 tBTA_DM_DI_DISC_CMPL di_disc; /* DI discovery result for a peer device */
913
914} tBTA_DM_SEARCH;
915
916/* Search callback */
917typedef void (tBTA_DM_SEARCH_CBACK)(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH *p_data);
918
919/* Execute call back */
920typedef void (tBTA_DM_EXEC_CBACK) (void * p_param);
921
922/* Encryption callback*/
923typedef void (tBTA_DM_ENCRYPT_CBACK) (BD_ADDR bd_addr, tBTA_STATUS result);
924
925#if BLE_INCLUDED == TRUE
926#define BTA_DM_BLE_SEC_NONE BTM_BLE_SEC_NONE
927#define BTA_DM_BLE_SEC_ENCRYPT BTM_BLE_SEC_ENCRYPT
928#define BTA_DM_BLE_SEC_NO_MITM BTM_BLE_SEC_ENCRYPT_NO_MITM
929#define BTA_DM_BLE_SEC_MITM BTM_BLE_SEC_ENCRYPT_MITM
930typedef tBTM_BLE_SEC_ACT tBTA_DM_BLE_SEC_ACT;
931#else
932typedef UINT8 tBTA_DM_BLE_SEC_ACT;
933#endif
934
935/* Maximum service name length */
936#define BTA_SERVICE_NAME_LEN 35
937#define BTA_SERVICE_DESP_LEN BTA_SERVICE_NAME_LEN
938#define BTA_PROVIDER_NAME_LEN BTA_SERVICE_NAME_LEN
939
940
941/* link policy masks */
942#define BTA_DM_LP_SWITCH HCI_ENABLE_MASTER_SLAVE_SWITCH
943#define BTA_DM_LP_HOLD HCI_ENABLE_HOLD_MODE
944#define BTA_DM_LP_SNIFF HCI_ENABLE_SNIFF_MODE
945#define BTA_DM_LP_PARK HCI_ENABLE_PARK_MODE
946typedef UINT16 tBTA_DM_LP_MASK;
947
948/* power mode actions */
949#define BTA_DM_PM_NO_ACTION 0x00 /* no change to the current pm setting */
950#define BTA_DM_PM_PARK 0x10 /* prefers park mode */
951#define BTA_DM_PM_SNIFF 0x20 /* prefers sniff mode */
952#define BTA_DM_PM_SNIFF1 0x21 /* prefers sniff1 mode */
953#define BTA_DM_PM_SNIFF2 0x22 /* prefers sniff2 mode */
954#define BTA_DM_PM_SNIFF3 0x23 /* prefers sniff3 mode */
955#define BTA_DM_PM_SNIFF4 0x24 /* prefers sniff4 mode */
956#define BTA_DM_PM_SNIFF5 0x25 /* prefers sniff5 mode */
957#define BTA_DM_PM_SNIFF6 0x26 /* prefers sniff6 mode */
958#define BTA_DM_PM_SNIFF7 0x27 /* prefers sniff7 mode */
959#define BTA_DM_PM_SNIFF_USER0 0x28 /* prefers user-defined sniff0 mode (testtool only) */
960#define BTA_DM_PM_SNIFF_USER1 0x29 /* prefers user-defined sniff1 mode (testtool only) */
961#define BTA_DM_PM_ACTIVE 0x40 /* prefers active mode */
962#define BTA_DM_PM_RETRY 0x80 /* retry power mode based on current settings */
963#define BTA_DM_PM_NO_PREF 0x01 /* service has no prefernce on power mode setting. eg. connection to service got closed */
964
965typedef UINT8 tBTA_DM_PM_ACTTION;
966
967/* index to bta_dm_ssr_spec */
968#define BTA_DM_PM_SSR0 0
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800969#define BTA_DM_PM_SSR1 1 /* BTA_DM_PM_SSR1 will be dedicated for
970 HH SSR setting entry, no other profile can use it */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800971#define BTA_DM_PM_SSR2 2
972#define BTA_DM_PM_SSR3 3
973#define BTA_DM_PM_SSR4 4
974#define BTA_DM_PM_SSR5 5
975#define BTA_DM_PM_SSR6 6
976
977#define BTA_DM_PM_NUM_EVTS 9
978
979#ifndef BTA_DM_PM_PARK_IDX
980#define BTA_DM_PM_PARK_IDX 5 /* the actual index to bta_dm_pm_md[] for PARK mode */
981#endif
982
983#define BTA_DM_SW_BB_TO_MM BTM_SW_BB_TO_MM
984#define BTA_DM_SW_MM_TO_BB BTM_SW_MM_TO_BB
985#define BTA_DM_SW_BB_TO_BTC BTM_SW_BB_TO_BTC
986#define BTA_DM_SW_BTC_TO_BB BTM_SW_BTC_TO_BB
987
988typedef tBTM_SW_DIR tBTA_DM_SW_DIR;
989
990/* Switch callback events */
991#define BTA_DM_SWITCH_CMPL_EVT 0 /* Completion of the Switch API */
992
993typedef UINT8 tBTA_DM_SWITCH_EVT;
994typedef void (tBTA_DM_SWITCH_CBACK)(tBTA_DM_SWITCH_EVT event, tBTA_STATUS status);
995
996/* Audio routing out configuration */
997#define BTA_DM_ROUTE_NONE 0x00 /* No Audio output */
998#define BTA_DM_ROUTE_DAC 0x01 /* routing over analog output */
999#define BTA_DM_ROUTE_I2S 0x02 /* routing over digital (I2S) output */
1000#define BTA_DM_ROUTE_BT_MONO 0x04 /* routing over SCO */
1001#define BTA_DM_ROUTE_BT_STEREO 0x08 /* routing over BT Stereo */
1002#define BTA_DM_ROUTE_HOST 0x10 /* routing over Host */
1003#define BTA_DM_ROUTE_FMTX 0x20 /* routing over FMTX */
1004#define BTA_DM_ROUTE_FMRX 0x40 /* routing over FMRX */
1005#define BTA_DM_ROUTE_BTSNK 0x80 /* routing over BT SNK */
1006
1007typedef UINT8 tBTA_DM_ROUTE_PATH;
1008
1009
1010/* Device Identification (DI) data structure
1011*/
1012/* Used to set the DI record */
1013typedef tSDP_DI_RECORD tBTA_DI_RECORD;
1014/* Used to get the DI record */
1015typedef tSDP_DI_GET_RECORD tBTA_DI_GET_RECORD;
1016/* SDP discovery database */
1017typedef tSDP_DISCOVERY_DB tBTA_DISCOVERY_DB;
1018
1019#ifndef BTA_DI_NUM_MAX
1020#define BTA_DI_NUM_MAX 3
1021#endif
1022
Andre Eisenbach3aa60542013-03-22 18:00:51 -07001023/* Device features mask definitions */
1024#define BTA_FEATURE_BYTES_PER_PAGE BTM_FEATURE_BYTES_PER_PAGE
1025#define BTA_EXT_FEATURES_PAGE_MAX BTM_EXT_FEATURES_PAGE_MAX
1026
The Android Open Source Project5738f832012-12-12 16:00:35 -08001027/*****************************************************************************
1028** External Function Declarations
1029*****************************************************************************/
1030#ifdef __cplusplus
1031extern "C"
1032{
1033#endif
1034
1035/*******************************************************************************
1036**
1037** Function BTA_EnableBluetooth
1038**
1039** Description This function initializes BTA and prepares BTA and the
1040** Bluetooth protocol stack for use. This function is
1041** typically called at startup or when Bluetooth services
1042** are required by the phone. This function must be called
1043** before calling any other API function.
1044**
1045**
1046** Returns BTA_SUCCESS if successful.
1047** BTA_FAIL if internal failure.
1048**
1049*******************************************************************************/
1050BTA_API extern tBTA_STATUS BTA_EnableBluetooth(tBTA_DM_SEC_CBACK *p_cback);
1051
1052/*******************************************************************************
1053**
1054** Function BTA_DisableBluetooth
1055**
1056** Description This function disables BTA and the Bluetooth protocol
1057** stack. It is called when BTA is no longer being used
1058** by any application in the system.
1059**
1060**
1061** Returns void
1062**
1063*******************************************************************************/
1064BTA_API extern tBTA_STATUS BTA_DisableBluetooth(void);
1065
1066/*******************************************************************************
1067**
1068** Function BTA_EnableTestMode
1069**
1070** Description Enables bluetooth device under test mode
1071**
1072**
1073** Returns tBTA_STATUS
1074**
1075*******************************************************************************/
1076BTA_API extern tBTA_STATUS BTA_EnableTestMode(void);
1077
1078/*******************************************************************************
1079**
1080** Function BTA_DisableTestMode
1081**
1082** Description Disable bluetooth device under test mode
1083**
1084**
1085** Returns None
1086**
1087*******************************************************************************/
1088BTA_API extern void BTA_DisableTestMode(void);
1089
1090/*******************************************************************************
1091**
1092** Function BTA_DmIsDeviceUp
1093**
1094** Description This function tests whether the Bluetooth module is up
1095** and ready. This is a direct execution function that
1096** may lock task scheduling on some platforms.
1097**
1098**
1099** Returns TRUE if the module is ready.
1100** FALSE if the module is not ready.
1101**
1102*******************************************************************************/
1103BTA_API extern BOOLEAN BTA_DmIsDeviceUp(void);
1104
1105/*******************************************************************************
1106**
1107** Function BTA_DmSetDeviceName
1108**
1109** Description This function sets the Bluetooth name of the local device.
1110**
1111**
1112** Returns void
1113**
1114*******************************************************************************/
1115BTA_API extern void BTA_DmSetDeviceName(char *p_name);
1116
1117/*******************************************************************************
1118**
1119** Function BTA_DmSetVisibility
1120**
1121** Description This function sets the Bluetooth connectable,discoverable,
1122** pairable and conn paired only modesmodes of the local device.
1123** This controls whether other Bluetooth devices can find and connect to
1124** the local device.
1125**
1126**
1127** Returns void
1128**
1129*******************************************************************************/
1130BTA_API extern void BTA_DmSetVisibility(tBTA_DM_DISC disc_mode, tBTA_DM_CONN conn_mode, UINT8 pairable_mode, UINT8 conn_filter);
1131
1132/*******************************************************************************
1133**
1134** Function BTA_DmSetScanParam
1135**
1136** Description This function sets the parameters for page scan and
1137** inquiry scan.
1138**
1139**
1140** Returns void
1141**
1142*******************************************************************************/
1143BTA_API extern void BTA_DmSetScanParam (UINT16 page_scan_interval, UINT16 page_scan_window,
1144 UINT16 inquiry_scan_interval, UINT16 inquiry_scan_window);
1145
1146/*******************************************************************************
1147**
1148** Function BTA_DmSetAfhChannels
1149**
1150** Description This function sets the AFH first and
1151** last disable channel, so channels within
1152** that range are disabled.
1153** In order to use this API, BTM_BYPASS_AMP_AUTO_AFH must be set
1154** to be TRUE
1155**
1156** Returns void
1157**
1158*******************************************************************************/
1159BTA_API extern void BTA_DmSetAfhChannels(UINT8 first, UINT8 last);
1160
1161
1162/*******************************************************************************
1163**
1164** Function BTA_DmVendorSpecificCommand
1165**
1166** Description This function sends the vendor specific command
1167** to the controller
1168**
1169**
1170** Returns tBTA_STATUS
1171**
1172*******************************************************************************/
1173BTA_API extern tBTA_STATUS BTA_DmVendorSpecificCommand (UINT16 opcode, UINT8 param_len,UINT8 *p_param_buf, tBTA_VENDOR_CMPL_CBACK *p_cback);
1174
1175
1176/*******************************************************************************
1177**
1178** Function BTA_DmSearch
1179**
1180** Description This function searches for peer Bluetooth devices. It
1181** first performs an inquiry; for each device found from the
1182** inquiry it gets the remote name of the device. If
1183** parameter services is nonzero, service discovery will be
1184** performed on each device for the services specified.
1185**
1186**
1187** Returns void
1188**
1189*******************************************************************************/
1190BTA_API extern void BTA_DmSearch(tBTA_DM_INQ *p_dm_inq, tBTA_SERVICE_MASK services,
1191 tBTA_DM_SEARCH_CBACK *p_cback);
1192
1193/*******************************************************************************
1194**
1195** Function BTA_DmSearchCancel
1196**
1197** Description This function cancels a search that has been initiated
1198** by calling BTA_DmSearch().
1199**
1200**
1201** Returns void
1202**
1203*******************************************************************************/
1204BTA_API extern void BTA_DmSearchCancel(void);
1205
1206/*******************************************************************************
1207**
1208** Function BTA_DmDiscover
1209**
1210** Description This function performs service discovery for the services
1211** of a particular peer device.
1212**
1213**
1214** Returns void
1215**
1216*******************************************************************************/
1217BTA_API extern void BTA_DmDiscover(BD_ADDR bd_addr, tBTA_SERVICE_MASK services,
1218 tBTA_DM_SEARCH_CBACK *p_cback, BOOLEAN sdp_search);
1219
1220// btla-specific ++
1221/*******************************************************************************
1222**
1223** Function BTA_DmDiscoverUUID
1224**
1225** Description This function performs service discovery for the services
1226** of a particular peer device.
1227**
1228**
1229** Returns void
1230**
1231*******************************************************************************/
1232BTA_API extern void BTA_DmDiscoverUUID(BD_ADDR bd_addr, tSDP_UUID *uuid,
1233 tBTA_DM_SEARCH_CBACK *p_cback, BOOLEAN sdp_search);
1234
1235/*******************************************************************************
1236**
1237** Function BTA_DmGetCachedRemoteName
1238**
1239** Description Retieve cached remote name if available
1240**
1241** Returns BTA_SUCCESS if cached name was retrieved
1242** BTA_FAILURE if cached name is not available
1243**
1244*******************************************************************************/
1245tBTA_STATUS BTA_DmGetCachedRemoteName(BD_ADDR remote_device, UINT8 **pp_cached_name);
1246// btla-specific --
1247
1248/*******************************************************************************
1249**
1250** Function BTA_DmIsMaster
1251**
1252** Description This function checks if the local device is the master of
1253** the link to the given device
1254**
1255** Returns TRUE if master.
1256** FALSE if not.
1257**
1258*******************************************************************************/
1259BTA_API extern BOOLEAN BTA_DmIsMaster(BD_ADDR bd_addr);
1260
1261/*******************************************************************************
1262**
1263** Function BTA_DmBond
1264**
1265** Description This function initiates a bonding procedure with a peer
1266** device. The bonding procedure enables authentication
1267** and optionally encryption on the Bluetooth link.
1268**
1269**
1270** Returns void
1271**
1272*******************************************************************************/
1273BTA_API extern void BTA_DmBond(BD_ADDR bd_addr);
1274
1275/*******************************************************************************
1276**
1277** Function BTA_DmBondCancel
1278**
1279** Description This function cancels a bonding procedure with a peer
1280** device.
1281**
1282**
1283** Returns void
1284**
1285*******************************************************************************/
1286BTA_API extern void BTA_DmBondCancel(BD_ADDR bd_addr);
1287
1288/*******************************************************************************
1289**
1290** Function BTA_DmPinReply
1291**
1292** Description This function provides a PIN when one is requested by DM
1293** during a bonding procedure. The application should call
1294** this function after the security callback is called with
1295** a BTA_DM_PIN_REQ_EVT.
1296**
1297**
1298** Returns void
1299**
1300*******************************************************************************/
1301BTA_API extern void BTA_DmPinReply(BD_ADDR bd_addr, BOOLEAN accept, UINT8 pin_len,
1302 UINT8 *p_pin);
1303
1304/*******************************************************************************
1305**
1306** Function BTA_DmLinkPolicy
1307**
1308** Description This function sets/clears the link policy mask to the given
1309** bd_addr.
1310** If clearing the sniff or park mode mask, the link is put
1311** in active mode.
1312**
1313** Returns void
1314**
1315*******************************************************************************/
1316BTA_API extern void BTA_DmLinkPolicy(BD_ADDR bd_addr, tBTA_DM_LP_MASK policy_mask,
1317 BOOLEAN set);
1318
1319#if (BTM_OOB_INCLUDED == TRUE)
1320/*******************************************************************************
1321**
1322** Function BTA_DmLocalOob
1323**
1324** Description This function retrieves the OOB data from local controller.
1325** The result is reported by bta_dm_co_loc_oob().
1326**
1327** Returns void
1328**
1329*******************************************************************************/
1330BTA_API extern void BTA_DmLocalOob(void);
1331#endif /* BTM_OOB_INCLUDED */
1332
1333/*******************************************************************************
1334**
1335** Function BTA_DmConfirm
1336**
1337** Description This function accepts or rejects the numerical value of the
1338** Simple Pairing process on BTA_DM_SP_CFM_REQ_EVT
1339**
1340** Returns void
1341**
1342*******************************************************************************/
1343BTA_API extern void BTA_DmConfirm(BD_ADDR bd_addr, BOOLEAN accept);
1344
1345/*******************************************************************************
1346**
1347** Function BTA_DmPasskeyCancel
1348**
1349** Description This function is called to cancel the simple pairing process
1350** reported by BTA_DM_SP_KEY_NOTIF_EVT
1351**
1352** Returns void
1353**
1354*******************************************************************************/
1355BTA_API extern void BTA_DmPasskeyCancel(BD_ADDR bd_addr);
1356
1357/*******************************************************************************
1358**
1359** Function BTA_DmAddDevice
1360**
1361** Description This function adds a device to the security database list
1362** of peer devices. This function would typically be called
1363** at system startup to initialize the security database with
1364** known peer devices. This is a direct execution function
1365** that may lock task scheduling on some platforms.
1366**
1367** Returns void
1368**
1369*******************************************************************************/
1370BTA_API extern void BTA_DmAddDevice(BD_ADDR bd_addr, DEV_CLASS dev_class,
1371 LINK_KEY link_key, tBTA_SERVICE_MASK trusted_mask,
1372 BOOLEAN is_trusted, UINT8 key_type,
1373 tBTA_IO_CAP io_cap);
1374
1375/*******************************************************************************
1376**
1377** Function BTA_DmAddDevWithName
1378**
1379** Description This function is newer version of BTA_DmAddDevice()
1380** which added bd_name and features as input parameters.
1381**
1382**
1383** Returns void
1384**
Andre Eisenbach3aa60542013-03-22 18:00:51 -07001385** Note: features points to the remote device features array.
1386** The array size is
1387** BTA_FEATURE_BYTES_PER_PAGE * (BTA_EXT_FEATURES_PAGE_MAX + 1)
1388**
The Android Open Source Project5738f832012-12-12 16:00:35 -08001389*******************************************************************************/
1390BTA_API extern void BTA_DmAddDevWithName (BD_ADDR bd_addr, DEV_CLASS dev_class,
Andre Eisenbach3aa60542013-03-22 18:00:51 -07001391 BD_NAME bd_name, UINT8 *features,
The Android Open Source Project5738f832012-12-12 16:00:35 -08001392 LINK_KEY link_key, tBTA_SERVICE_MASK trusted_mask,
1393 BOOLEAN is_trusted, UINT8 key_type, tBTA_IO_CAP io_cap);
1394
1395/*******************************************************************************
1396**
1397** Function BTA_DmRemoveDevice
1398**
1399** Description This function removes a device from the security database.
1400** This is a direct execution function that may lock task
1401** scheduling on some platforms.
1402**
1403**
1404** Returns BTA_SUCCESS if successful.
1405** BTA_FAIL if operation failed.
1406**
1407*******************************************************************************/
1408BTA_API extern tBTA_STATUS BTA_DmRemoveDevice(BD_ADDR bd_addr);
1409
1410/*******************************************************************************
1411**
1412** Function BTA_DmAuthorizeReply
1413**
1414** Description This function provides an authorization reply when
1415** authorization is requested by BTA. The application calls
1416** this function after the security callback is called with
1417** a BTA_DM_AUTHORIZE_EVT.
1418**
1419**
1420** Returns void
1421**
1422*******************************************************************************/
1423BTA_API extern void BTA_DmAuthorizeReply(BD_ADDR bd_addr, tBTA_SERVICE_ID service,
1424 tBTA_AUTH_RESP response);
1425
1426/*******************************************************************************
1427**
1428** Function BTA_DmSignalStrength
1429**
1430** Description This function initiates RSSI and channnel quality
1431** measurments. BTA_DM_SIG_STRENGTH_EVT is sent to
1432** application with the values of RSSI and channel
1433** quality
1434**
1435**
1436** Returns void
1437**
1438*******************************************************************************/
1439BTA_API extern void BTA_DmSignalStrength(tBTA_SIG_STRENGTH_MASK mask, UINT16 period, BOOLEAN start);
1440
1441/*******************************************************************************
1442**
1443** Function BTA_DmWriteInqTxPower
1444**
1445** Description This command is used to write the inquiry transmit power level
1446** used to transmit the inquiry (ID) data packets.
1447**
1448** Parameters tx_power - tx inquiry power to use, valid value is -70 ~ 20
1449
1450** Returns void
1451**
1452*******************************************************************************/
1453BTA_API extern void BTA_DmWriteInqTxPower(INT8 tx_power);
1454
1455/*******************************************************************************
1456**
1457** Function BTA_DmEirAddUUID
1458**
1459** Description This function is called to add UUID into EIR.
1460**
1461** Parameters tBT_UUID - UUID
1462**
1463** Returns None
1464**
1465*******************************************************************************/
1466BTA_API extern void BTA_DmEirAddUUID (tBT_UUID *p_uuid);
1467
1468/*******************************************************************************
1469**
1470** Function BTA_DmEirRemoveUUID
1471**
1472** Description This function is called to remove UUID from EIR.
1473**
1474** Parameters tBT_UUID - UUID
1475**
1476** Returns None
1477**
1478*******************************************************************************/
1479BTA_API extern void BTA_DmEirRemoveUUID (tBT_UUID *p_uuid);
1480
1481/*******************************************************************************
1482**
1483** Function BTA_DmSetEIRConfig
1484**
1485** Description This function is called to override the BTA default EIR parameters.
1486** This funciton is only valid in a system where BTU & App task
1487** are in the same memory space.
1488**
1489** Parameters Pointer to User defined EIR config
1490**
1491** Returns None
1492**
1493*******************************************************************************/
1494BTA_API extern void BTA_DmSetEIRConfig (tBTA_DM_EIR_CONF *p_eir_cfg);
1495
1496/*******************************************************************************
1497**
1498** Function BTA_CheckEirData
1499**
1500** Description This function is called to get EIR data from significant part.
1501**
1502** Parameters p_eir - pointer of EIR significant part
1503** type - finding EIR data type
1504** p_length - return the length of EIR data
1505**
1506** Returns pointer of EIR data
1507**
1508*******************************************************************************/
1509BTA_API extern UINT8 *BTA_CheckEirData( UINT8 *p_eir, UINT8 tag, UINT8 *p_length );
1510
1511/*******************************************************************************
1512**
1513** Function BTA_GetEirService
1514**
1515** Description This function is called to get BTA service mask from EIR.
1516**
1517** Parameters p_eir - pointer of EIR significant part
1518** p_services - return the BTA service mask
1519**
1520** Returns None
1521**
1522*******************************************************************************/
1523BTA_API extern void BTA_GetEirService( UINT8 *p_eir, tBTA_SERVICE_MASK *p_services );
1524
1525/*******************************************************************************
1526**
1527** Function BTA_DmUseSsr
1528**
1529** Description This function is called to check if the connected peer device
1530** supports SSR or not.
1531**
1532** Returns TRUE, if SSR is supported
1533**
1534*******************************************************************************/
1535BTA_API extern BOOLEAN BTA_DmUseSsr( BD_ADDR bd_addr );
1536
1537
1538/*******************************************************************************
1539**
1540** Function BTA_DmSetLocalDiRecord
1541**
1542** Description This function adds a DI record to the local SDP database.
1543**
1544** Returns BTA_SUCCESS if record set sucessfully, otherwise error code.
1545**
1546*******************************************************************************/
1547BTA_API extern tBTA_STATUS BTA_DmSetLocalDiRecord( tBTA_DI_RECORD *p_device_info,
1548 UINT32 *p_handle );
1549
1550/*******************************************************************************
1551**
1552** Function BTA_DmGetLocalDiRecord
1553**
1554** Description Get a specified DI record to the local SDP database. If no
1555** record handle is provided, the primary DI record will be
1556** returned.
1557**
1558** Returns BTA_SUCCESS if record set sucessfully, otherwise error code.
1559**
1560*******************************************************************************/
1561BTA_API extern tBTA_STATUS BTA_DmGetLocalDiRecord( tBTA_DI_GET_RECORD *p_device_info,
1562 UINT32 *p_handle );
1563
1564/*******************************************************************************
1565**
1566** Function BTA_DmDiDiscover
1567**
1568** Description This function queries a remote device for DI information.
1569**
1570** Returns None.
1571**
1572*******************************************************************************/
1573BTA_API extern void BTA_DmDiDiscover( BD_ADDR remote_device, tBTA_DISCOVERY_DB *p_db,
1574 UINT32 len, tBTA_DM_SEARCH_CBACK *p_cback );
1575
1576/*******************************************************************************
1577**
1578** Function BTA_DmGetDiRecord
1579**
1580** Description This function retrieves a remote device's DI record from
1581** the specified database.
1582**
1583** Returns None.
1584**
1585*******************************************************************************/
1586BTA_API extern tBTA_STATUS BTA_DmGetDiRecord( UINT8 get_record_index, tBTA_DI_GET_RECORD *p_device_info,
1587 tBTA_DISCOVERY_DB *p_db );
1588
1589/*******************************************************************************
1590**
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -08001591**
1592** Function BTA_DmCloseACL
1593**
1594** Description This function force to close an ACL connection and remove the
1595** device from the security database list of known devices.
1596**
1597** Parameters: bd_addr - Address of the peer device
1598** remove_dev - remove device or not after link down
1599**
1600** Returns void.
1601**
1602*******************************************************************************/
1603BTA_API extern void BTA_DmCloseACL(BD_ADDR bd_addr, BOOLEAN remove_dev);
1604
1605/*******************************************************************************
1606**
The Android Open Source Project5738f832012-12-12 16:00:35 -08001607** Function BTA_SysFeatures
1608**
1609** Description This function is called to set system features.
1610**
1611** Returns void
1612**
1613*******************************************************************************/
1614BTA_API extern void BTA_SysFeatures (UINT16 sys_features);
1615
1616/*******************************************************************************
1617**
1618** Function bta_dmexecutecallback
1619**
1620** Description This function will request BTA to execute a call back in the context of BTU task
1621** This API was named in lower case because it is only intended
1622** for the internal customers(like BTIF).
1623**
1624** Returns void
1625**
1626*******************************************************************************/
1627BTA_API extern void bta_dmexecutecallback (tBTA_DM_EXEC_CBACK* p_callback, void * p_param);
1628
1629#if (BTM_SCO_HCI_INCLUDED == TRUE)
1630/*******************************************************************************
1631**
1632** Function BTA_DmPcmInitSamples
1633**
1634** Description initialize the down sample converter.
1635**
1636** src_sps: original samples per second (source audio data)
1637** (ex. 44100, 48000)
1638** bits: number of bits per pcm sample (16)
1639** n_channels: number of channels (i.e. mono(1), stereo(2)...)
1640**
1641** Returns none
1642**
1643*******************************************************************************/
1644BTA_API extern void BTA_DmPcmInitSamples (UINT32 src_sps, UINT32 bits, UINT32 n_channels);
1645
1646/**************************************************************************************
1647** Function BTA_DmPcmResample
1648**
1649** Description Down sampling utility to convert higher sampling rate into 8K/16bits
1650** PCM samples.
1651**
1652** Parameters p_src: pointer to the buffer where the original sampling PCM
1653** are stored.
1654** in_bytes: Length of the input PCM sample buffer in byte.
1655** p_dst: pointer to the buffer which is to be used to store
1656** the converted PCM samples.
1657**
1658**
1659** Returns INT32: number of samples converted.
1660**
1661**************************************************************************************/
1662BTA_API extern INT32 BTA_DmPcmResample (void *p_src, UINT32 in_bytes, void *p_dst);
1663#endif
1664
1665#if ((defined BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
1666/* BLE related API functions */
1667/*******************************************************************************
1668**
1669** Function BTA_DmBleSecurityGrant
1670**
1671** Description Grant security request access.
1672**
1673** Parameters: bd_addr - BD address of the peer
1674** res - security grant status.
1675**
1676** Returns void
1677**
1678*******************************************************************************/
1679BTA_API extern void BTA_DmBleSecurityGrant(BD_ADDR bd_addr, tBTA_DM_BLE_SEC_GRANT res);
1680
1681
1682
1683/*******************************************************************************
1684**
1685** Function BTA_DmBleSetBgConnType
1686**
1687** Description This function is called to set BLE connectable mode for a
1688** peripheral device.
1689**
1690** Parameters bg_conn_type: it can be auto connection, or selective connection.
1691** p_select_cback: callback function when selective connection procedure
1692** is being used.
1693**
1694** Returns void
1695**
1696*******************************************************************************/
1697BTA_API extern void BTA_DmBleSetBgConnType(tBTA_DM_BLE_CONN_TYPE bg_conn_type, tBTA_DM_BLE_SEL_CBACK *p_select_cback);
1698
1699/*******************************************************************************
1700**
1701** Function BTA_DmBlePasskeyReply
1702**
1703** Description Send BLE SMP passkey reply.
1704**
1705** Parameters: bd_addr - BD address of the peer
1706** accept - passkey entry sucessful or declined.
1707** passkey - passkey value, must be a 6 digit number,
1708** can be lead by 0.
1709**
1710** Returns void
1711**
1712*******************************************************************************/
1713BTA_API extern void BTA_DmBlePasskeyReply(BD_ADDR bd_addr, BOOLEAN accept, UINT32 passkey);
1714
1715/*******************************************************************************
1716**
1717** Function BTA_DmAddBleDevice
1718**
1719** Description Add a BLE device. This function will be normally called
1720** during host startup to restore all required information
1721** for a LE device stored in the NVRAM.
1722**
1723** Parameters: bd_addr - BD address of the peer
1724** dev_type - Remote device's device type.
1725** addr_type - LE device address type.
1726**
1727** Returns void
1728**
1729*******************************************************************************/
1730BTA_API extern void BTA_DmAddBleDevice(BD_ADDR bd_addr, tBLE_ADDR_TYPE addr_type,
1731 tBT_DEVICE_TYPE dev_type);
1732
1733
1734/*******************************************************************************
1735**
1736** Function BTA_DmAddBleKey
1737**
1738** Description Add/modify LE device information. This function will be
1739** normally called during host startup to restore all required
1740** information stored in the NVRAM.
1741**
1742** Parameters: bd_addr - BD address of the peer
1743** p_le_key - LE key values.
1744** key_type - LE SMP key type.
1745**
1746** Returns void
1747**
1748*******************************************************************************/
1749BTA_API extern void BTA_DmAddBleKey (BD_ADDR bd_addr, tBTA_LE_KEY_VALUE *p_le_key,
1750 tBTA_LE_KEY_TYPE key_type);
1751
1752/*******************************************************************************
1753**
1754** Function BTA_DmSetBlePrefConnParams
1755**
1756** Description This function is called to set the preferred connection
1757** parameters when default connection parameter is not desired.
1758**
1759** Parameters: bd_addr - BD address of the peripheral
1760** min_conn_int - minimum preferred connection interval
1761** max_conn_int - maximum preferred connection interval
1762** slave_latency - preferred slave latency
1763** supervision_tout - preferred supervision timeout
1764**
1765**
1766** Returns void
1767**
1768*******************************************************************************/
1769BTA_API extern void BTA_DmSetBlePrefConnParams(BD_ADDR bd_addr,
1770 UINT16 min_conn_int, UINT16 max_conn_int,
1771 UINT16 slave_latency, UINT16 supervision_tout );
1772
1773/*******************************************************************************
1774**
1775** Function BTA_DmSetBleConnScanParams
1776**
1777** Description This function is called to set scan parameters used in
1778** BLE connection request
1779**
1780** Parameters: bd_addr - BD address of the peripheral
1781** scan_interval - scan interval
1782** scan_window - scan window
1783**
1784** Returns void
1785**
1786*******************************************************************************/
1787BTA_API extern void BTA_DmSetBleConnScanParams(UINT16 scan_interval,
1788 UINT16 scan_window );
1789
1790/*******************************************************************************
1791**
Andre Eisenbach5c44e452013-08-06 18:19:37 -07001792** Function BTA_DmSetBleAdvParams
1793**
1794** Description This function sets the advertising parameters BLE functionality.
1795** It is to be called when device act in peripheral or broadcaster
1796** role.
1797**
1798** Parameters: adv_int_min - adv interval minimum
1799** adv_int_max - adv interval max
1800** p_dir_bda - directed adv initator address
1801**
1802** Returns void
1803**
1804*******************************************************************************/
1805BTA_API extern void BTA_DmSetBleAdvParams (UINT16 adv_int_min, UINT16 adv_int_max,
1806 tBLE_BD_ADDR *p_dir_bda);
1807/*******************************************************************************
1808**
The Android Open Source Project5738f832012-12-12 16:00:35 -08001809** Function BTA_DmSearchExt
1810**
1811** Description This function searches for peer Bluetooth devices. It performs
1812** an inquiry and gets the remote name for devices. Service
1813** discovery is done if services is non zero
1814**
1815** Parameters p_dm_inq: inquiry conditions
1816** services: if service is not empty, service discovery will be done.
1817** for all GATT based service condition, put num_uuid, and
1818** p_uuid is the pointer to the list of UUID values.
1819** p_cback: callback functino when search is completed.
1820**
1821**
1822**
1823** Returns void
1824**
1825*******************************************************************************/
1826BTA_API extern void BTA_DmSearchExt(tBTA_DM_INQ *p_dm_inq, tBTA_SERVICE_MASK_EXT *p_services,
1827 tBTA_DM_SEARCH_CBACK *p_cback);
1828
1829/*******************************************************************************
1830**
1831** Function BTA_DmDiscoverExt
1832**
1833** Description This function does service discovery for services of a
1834** peer device. When services.num_uuid is 0, it indicates all
1835** GATT based services are to be searched; other wise a list of
1836** UUID of interested services should be provided through
1837** services.p_uuid.
1838**
1839**
1840**
1841** Returns void
1842**
1843*******************************************************************************/
1844BTA_API extern void BTA_DmDiscoverExt(BD_ADDR bd_addr, tBTA_SERVICE_MASK_EXT *p_services,
1845 tBTA_DM_SEARCH_CBACK *p_cback, BOOLEAN sdp_search);
1846
1847
1848/*******************************************************************************
1849**
1850** Function BTA_DmSetEncryption
1851**
1852** Description This function is called to ensure that connection is
1853** encrypted. Should be called only on an open connection.
1854** Typically only needed for connections that first want to
1855** bring up unencrypted links, then later encrypt them.
1856**
1857** Parameters: bd_addr - Address of the peer device
1858** p_callback - Pointer to callback function to indicat the
1859** link encryption status
1860** sec_act - This is the security action to indicate
1861** what knid of BLE security level is required for
1862** the BLE link if the BLE is supported
1863** Note: This parameter is ignored for the BR/EDR link
1864** or the BLE is not supported
1865**
1866** Returns void
1867**
1868**
1869*******************************************************************************/
1870BTA_API extern void BTA_DmSetEncryption(BD_ADDR bd_addr, tBTA_DM_ENCRYPT_CBACK *p_callback,
1871 tBTA_DM_BLE_SEC_ACT sec_act);
1872
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -08001873
1874/*******************************************************************************
1875**
1876** Function BTA_DmBleObserve
1877**
1878** Description This procedure keep the device listening for advertising
1879** events from a broadcast device.
1880**
1881** Parameters start: start or stop observe.
1882** duration : Duration of the scan. Continuous scan if 0 is passed
1883** p_results_cb: Callback to be called with scan results
1884**
1885** Returns void
1886**
1887*******************************************************************************/
1888BTA_API extern void BTA_DmBleObserve(BOOLEAN start, UINT8 duration,
1889 tBTA_DM_SEARCH_CBACK *p_results_cb);
1890
1891
The Android Open Source Project5738f832012-12-12 16:00:35 -08001892#endif
1893
1894// btla-specific ++
1895/*******************************************************************************
1896**
1897** Function BTA_DmSetAfhChannelAssessment
1898**
1899** Description This function is called to set the channel assessment mode on or off
1900**
1901** Returns status
1902**
1903*******************************************************************************/
1904BTA_API extern void BTA_DmSetAfhChannelAssessment (BOOLEAN enable_or_disable);
Matthew Xiefc4b2f12013-05-06 20:51:02 -07001905
Andre Eisenbacheeeac992013-11-08 10:23:52 -08001906#if BLE_INCLUDED == TRUE
The Android Open Source Project5738f832012-12-12 16:00:35 -08001907// btla-specific --
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -08001908/*******************************************************************************
1909**
1910** Function BTA_DmBleConfigLocalPrivacy
1911**
1912** Description Enable/disable privacy on the local device
1913**
1914** Parameters: privacy_enable - enable/disabe privacy on remote device.
1915**
1916** Returns void
1917**
1918*******************************************************************************/
1919BTA_API extern void BTA_DmBleConfigLocalPrivacy(BOOLEAN privacy_enable);
1920
1921/*******************************************************************************
1922**
1923** Function BTA_DmBleEnableRemotePrivacy
1924**
1925** Description Enable/disable privacy on a remote device
1926**
1927** Parameters: bd_addr - BD address of the peer
1928** privacy_enable - enable/disabe privacy on remote device.
1929**
1930** Returns void
1931**
1932*******************************************************************************/
1933BTA_API extern void BTA_DmBleEnableRemotePrivacy(BD_ADDR bd_addr, BOOLEAN privacy_enable);
1934
1935
1936/*******************************************************************************
1937**
1938** Function BTA_DmBleSetAdvConfig
1939**
1940** Description This function is called to override the BTA default ADV parameters.
1941**
1942** Parameters Pointer to User defined ADV data structure
1943**
1944** Returns None
1945**
1946*******************************************************************************/
1947BTA_API extern void BTA_DmBleSetAdvConfig (tBTA_BLE_AD_MASK data_mask,
1948 tBTA_BLE_ADV_DATA *p_adv_cfg);
Andre Eisenbacheeeac992013-11-08 10:23:52 -08001949
1950/*******************************************************************************
1951**
1952** Function BTA_DmBleSetScanRsp
1953**
1954** Description This function is called to override the BTA scan response.
1955**
1956** Parameters Pointer to User defined ADV data structure
1957**
1958** Returns None
1959**
1960*******************************************************************************/
1961BTA_API extern void BTA_DmBleSetScanRsp (tBTA_BLE_AD_MASK data_mask,
1962 tBTA_BLE_ADV_DATA *p_adv_cfg);
1963
1964/*******************************************************************************
1965**
1966** Function BTA_DmBleBroadcast
1967**
1968** Description This function starts or stops LE broadcasting.
1969**
1970** Parameters start: start or stop broadcast.
1971**
1972** Returns None
1973**
1974*******************************************************************************/
1975BTA_API extern void BTA_DmBleBroadcast (BOOLEAN start);
1976
Matthew Xiefc4b2f12013-05-06 20:51:02 -07001977#endif
The Android Open Source Project5738f832012-12-12 16:00:35 -08001978
1979#ifdef __cplusplus
1980}
1981#endif
1982
1983#endif /* BTA_API_H */
1984