blob: 14a33b8e8a4d6ee41fc0f6a3996bb00c17bf9473 [file] [log] [blame]
The Android Open Source Project5738f832012-12-12 16:00:35 -08001/******************************************************************************
2 *
Satya Callojic4e25962014-05-10 23:46:24 -07003 * Copyright (C) 2003-2014 Broadcom Corporation
The Android Open Source Project5738f832012-12-12 16:00:35 -08004 *
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
The Android Open Source Project5738f832012-12-12 16:00:35 -080028#include "bt_target.h"
29#include "bt_types.h"
30#include "btm_api.h"
The Android Open Source Project5738f832012-12-12 16:00:35 -080031#include "btm_ble_api.h"
The Android Open Source Project5738f832012-12-12 16:00:35 -080032
Bryce Lee3d6accf2016-05-10 17:10:09 -070033#ifdef __cplusplus
34extern "C" {
35#endif
36
The Android Open Source Project5738f832012-12-12 16:00:35 -080037/*****************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -080038 * Constants and data types
39 ****************************************************************************/
The Android Open Source Project5738f832012-12-12 16:00:35 -080040
41/* Status Return Value */
Myles Watsoncd1fd072016-11-09 13:17:43 -080042#define BTA_SUCCESS 0 /* Successful operation. */
43#define BTA_FAILURE 1 /* Generic failure. */
44#define BTA_PENDING 2 /* API cannot be completed right now */
45#define BTA_BUSY 3
46#define BTA_NO_RESOURCES 4
47#define BTA_WRONG_MODE 5
The Android Open Source Project5738f832012-12-12 16:00:35 -080048
Marie Janssene9e58ce2016-06-17 14:12:17 -070049typedef uint8_t tBTA_STATUS;
The Android Open Source Project5738f832012-12-12 16:00:35 -080050
51/*
52 * Service ID
53 *
Myles Watsoncd1fd072016-11-09 13:17:43 -080054 * NOTES: When you add a new Service ID for BTA AND require to change the value
55 * of BTA_MAX_SERVICE_ID,
56 * make sure that the correct security ID of the new service from
57 * Security service definitions (btm_api.h)
58 * should be added to bta_service_id_to_btm_srv_id_lkup_tbl table in
59 * bta_dm_act.c.
The Android Open Source Project5738f832012-12-12 16:00:35 -080060 */
61
Myles Watsoncd1fd072016-11-09 13:17:43 -080062#define BTA_RES_SERVICE_ID 0 /* Reserved */
63#define BTA_SPP_SERVICE_ID 1 /* Serial port profile. */
64#define BTA_DUN_SERVICE_ID 2 /* Dial-up networking profile. */
65#define BTA_A2DP_SOURCE_SERVICE_ID 3 /* A2DP Source profile. */
66#define BTA_LAP_SERVICE_ID 4 /* LAN access profile. */
67#define BTA_HSP_SERVICE_ID 5 /* Headset profile. */
68#define BTA_HFP_SERVICE_ID 6 /* Hands-free profile. */
69#define BTA_OPP_SERVICE_ID 7 /* Object push */
70#define BTA_FTP_SERVICE_ID 8 /* File transfer */
71#define BTA_CTP_SERVICE_ID 9 /* Cordless Terminal */
72#define BTA_ICP_SERVICE_ID 10 /* Intercom Terminal */
73#define BTA_SYNC_SERVICE_ID 11 /* Synchronization */
74#define BTA_BPP_SERVICE_ID 12 /* Basic printing profile */
75#define BTA_BIP_SERVICE_ID 13 /* Basic Imaging profile */
76#define BTA_PANU_SERVICE_ID 14 /* PAN User */
77#define BTA_NAP_SERVICE_ID 15 /* PAN Network access point */
78#define BTA_GN_SERVICE_ID 16 /* PAN Group Ad-hoc networks */
79#define BTA_SAP_SERVICE_ID 17 /* SIM Access profile */
80#define BTA_A2DP_SINK_SERVICE_ID 18 /* A2DP Sink */
81#define BTA_AVRCP_SERVICE_ID 19 /* A/V remote control */
82#define BTA_HID_SERVICE_ID 20 /* HID */
83#define BTA_VDP_SERVICE_ID 21 /* Video distribution */
84#define BTA_PBAP_SERVICE_ID 22 /* PhoneBook Access Server*/
85#define BTA_HSP_HS_SERVICE_ID 23 /* HFP HS role */
86#define BTA_HFP_HS_SERVICE_ID 24 /* HSP HS role */
87#define BTA_MAP_SERVICE_ID 25 /* Message Access Profile */
88#define BTA_MN_SERVICE_ID 26 /* Message Notification Service */
89#define BTA_HDP_SERVICE_ID 27 /* Health Device Profile */
90#define BTA_PCE_SERVICE_ID 28 /* PhoneBook Access Client*/
91#define BTA_SDP_SERVICE_ID 29 /* SDP Search*/
Myles Watson99791212016-11-18 08:42:23 -080092
The Android Open Source Project5738f832012-12-12 16:00:35 -080093/* BLE profile service ID */
Myles Watson99791212016-11-18 08:42:23 -080094#define BTA_BLE_SERVICE_ID 30 /* GATT profile */
Myles Watsoncd1fd072016-11-09 13:17:43 -080095#define BTA_USER_SERVICE_ID 31 /* User requested UUID */
Myles Watsoncd1fd072016-11-09 13:17:43 -080096#define BTA_MAX_SERVICE_ID 32
Myles Watson99791212016-11-18 08:42:23 -080097
The Android Open Source Project5738f832012-12-12 16:00:35 -080098/* service IDs (BTM_SEC_SERVICE_FIRST_EMPTY + 1) to (BTM_SEC_MAX_SERVICES - 1)
99 * are used by BTA JV */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800100#define BTA_FIRST_JV_SERVICE_ID (BTM_SEC_SERVICE_FIRST_EMPTY + 1)
101#define BTA_LAST_JV_SERVICE_ID (BTM_SEC_MAX_SERVICES - 1)
The Android Open Source Project5738f832012-12-12 16:00:35 -0800102
Marie Janssene9e58ce2016-06-17 14:12:17 -0700103typedef uint8_t tBTA_SERVICE_ID;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800104
105/* Service ID Mask */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800106#define BTA_RES_SERVICE_MASK 0x00000001 /* Reserved */
107#define BTA_SPP_SERVICE_MASK 0x00000002 /* Serial port profile. */
108#define BTA_DUN_SERVICE_MASK 0x00000004 /* Dial-up networking profile. */
109#define BTA_FAX_SERVICE_MASK 0x00000008 /* Fax profile. */
110#define BTA_LAP_SERVICE_MASK 0x00000010 /* LAN access profile. */
111#define BTA_HSP_SERVICE_MASK 0x00000020 /* HSP AG role. */
112#define BTA_HFP_SERVICE_MASK 0x00000040 /* HFP AG role */
113#define BTA_OPP_SERVICE_MASK 0x00000080 /* Object push */
114#define BTA_FTP_SERVICE_MASK 0x00000100 /* File transfer */
115#define BTA_CTP_SERVICE_MASK 0x00000200 /* Cordless Terminal */
116#define BTA_ICP_SERVICE_MASK 0x00000400 /* Intercom Terminal */
117#define BTA_SYNC_SERVICE_MASK 0x00000800 /* Synchronization */
118#define BTA_BPP_SERVICE_MASK 0x00001000 /* Print server */
119#define BTA_BIP_SERVICE_MASK 0x00002000 /* Basic Imaging */
120#define BTA_PANU_SERVICE_MASK 0x00004000 /* PAN User */
121#define BTA_NAP_SERVICE_MASK 0x00008000 /* PAN Network access point */
122#define BTA_GN_SERVICE_MASK 0x00010000 /* PAN Group Ad-hoc networks */
123#define BTA_SAP_SERVICE_MASK 0x00020000 /* PAN Group Ad-hoc networks */
124#define BTA_A2DP_SERVICE_MASK 0x00040000 /* Advanced audio distribution */
125#define BTA_AVRCP_SERVICE_MASK 0x00080000 /* A/V remote control */
126#define BTA_HID_SERVICE_MASK 0x00100000 /* HID */
127#define BTA_VDP_SERVICE_MASK 0x00200000 /* Video distribution */
128#define BTA_PBAP_SERVICE_MASK 0x00400000 /* Phone Book Server */
129#define BTA_HSP_HS_SERVICE_MASK 0x00800000 /* HFP HS role */
130#define BTA_HFP_HS_SERVICE_MASK 0x01000000 /* HSP HS role */
131#define BTA_MAS_SERVICE_MASK 0x02000000 /* Message Access Profile */
132#define BTA_MN_SERVICE_MASK 0x04000000 /* Message Notification Profile */
133#define BTA_HL_SERVICE_MASK 0x08000000 /* Health Device Profile */
134#define BTA_PCE_SERVICE_MASK 0x10000000 /* Phone Book Client */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800135
Myles Watsoncd1fd072016-11-09 13:17:43 -0800136#define BTA_BLE_SERVICE_MASK 0x20000000 /* GATT based service */
Myles Watson99791212016-11-18 08:42:23 -0800137#define BTA_ALL_SERVICE_MASK 0x3FFFFFFF /* All services supported by BTA. */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800138#define BTA_USER_SERVICE_MASK 0x40000000 /* Message Notification Profile */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800139
Marie Janssene9e58ce2016-06-17 14:12:17 -0700140typedef uint32_t tBTA_SERVICE_MASK;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800141
142/* extended service mask, including mask with one or more GATT UUID */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800143typedef struct {
144 tBTA_SERVICE_MASK srvc_mask;
145 uint8_t num_uuid;
146 tBT_UUID* p_uuid;
147} tBTA_SERVICE_MASK_EXT;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800148
149/* Security Setting Mask */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800150#define BTA_SEC_NONE BTM_SEC_NONE /* No security. */
151#define BTA_SEC_AUTHORIZE \
152 (BTM_SEC_IN_AUTHORIZE) /* Authorization required (only needed for out \
153 going connection )*/
154#define BTA_SEC_AUTHENTICATE \
155 (BTM_SEC_IN_AUTHENTICATE | \
156 BTM_SEC_OUT_AUTHENTICATE) /* Authentication required. */
157#define BTA_SEC_ENCRYPT \
158 (BTM_SEC_IN_ENCRYPT | BTM_SEC_OUT_ENCRYPT) /* Encryption required. */
159#define BTA_SEC_MODE4_LEVEL4 \
160 (BTM_SEC_MODE4_LEVEL4) /* Mode 4 level 4 service, i.e. incoming/outgoing \
161 MITM and P-256 encryption */
162#define BTA_SEC_MITM \
163 (BTM_SEC_IN_MITM | BTM_SEC_OUT_MITM) /* Man-In-The_Middle protection */
164#define BTA_SEC_IN_16_DIGITS \
165 (BTM_SEC_IN_MIN_16_DIGIT_PIN) /* Min 16 digit for pin code */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800166
Marie Janssene9e58ce2016-06-17 14:12:17 -0700167typedef uint16_t tBTA_SEC;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800168
Myles Watsoncd1fd072016-11-09 13:17:43 -0800169/* Ignore for Discoverable, Connectable, Pairable and Connectable Paired only
170 * device modes */
171#define BTA_DM_IGNORE 0x00FF
The Android Open Source Project5738f832012-12-12 16:00:35 -0800172
VenkatRaghavan VijayaRaghavan76356ae2015-04-21 11:32:29 -0700173/* Ignore for Discoverable, Connectable only for LE modes */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800174#define BTA_DM_LE_IGNORE 0xFF00
The Android Open Source Project5738f832012-12-12 16:00:35 -0800175
Myles Watsoncd1fd072016-11-09 13:17:43 -0800176#define BTA_APP_ID_PAN_MULTI 0xFE /* app id for pan multiple connection */
177#define BTA_ALL_APP_ID 0xFF
The Android Open Source Project5738f832012-12-12 16:00:35 -0800178
179/* Discoverable Modes */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800180#define BTA_DM_NON_DISC BTM_NON_DISCOVERABLE /* Device is not discoverable. */
181#define BTA_DM_GENERAL_DISC \
182 BTM_GENERAL_DISCOVERABLE /* General discoverable. \
183 */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800184#define BTA_DM_BLE_NON_DISCOVERABLE \
185 BTM_BLE_NON_DISCOVERABLE /* Device is not LE discoverable */
186#define BTA_DM_BLE_GENERAL_DISCOVERABLE \
187 BTM_BLE_GENERAL_DISCOVERABLE /* Device is LE General discoverable */
188#define BTA_DM_BLE_LIMITED_DISCOVERABLE \
189 BTM_BLE_LIMITED_DISCOVERABLE /* Device is LE Limited discoverable */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800190typedef uint16_t
191 tBTA_DM_DISC; /* this discoverability mode is a bit mask among BR mode and
192 LE mode */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800193
194/* Connectable Modes */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800195#define BTA_DM_NON_CONN BTM_NON_CONNECTABLE /* Device is not connectable. */
196#define BTA_DM_CONN BTM_CONNECTABLE /* Device is connectable. */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800197#define BTA_DM_BLE_NON_CONNECTABLE \
198 BTM_BLE_NON_CONNECTABLE /* Device is LE non-connectable. */
199#define BTA_DM_BLE_CONNECTABLE \
200 BTM_BLE_CONNECTABLE /* Device is LE connectable. */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800201
Marie Janssene9e58ce2016-06-17 14:12:17 -0700202typedef uint16_t tBTA_DM_CONN;
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -0700203
Myles Watsoncd1fd072016-11-09 13:17:43 -0800204#define BTA_TRANSPORT_UNKNOWN 0
205#define BTA_TRANSPORT_BR_EDR BT_TRANSPORT_BR_EDR
206#define BTA_TRANSPORT_LE BT_TRANSPORT_LE
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -0700207typedef tBT_TRANSPORT tBTA_TRANSPORT;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800208
209/* Pairable Modes */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800210#define BTA_DM_PAIRABLE 1
211#define BTA_DM_NON_PAIRABLE 0
The Android Open Source Project5738f832012-12-12 16:00:35 -0800212
213/* Connectable Paired Only Mode */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800214#define BTA_DM_CONN_ALL 0
215#define BTA_DM_CONN_PAIRED 1
The Android Open Source Project5738f832012-12-12 16:00:35 -0800216
217/* Inquiry Modes */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800218#define BTA_DM_INQUIRY_NONE BTM_INQUIRY_NONE /*No BR inquiry. */
219#define BTA_DM_GENERAL_INQUIRY \
220 BTM_GENERAL_INQUIRY /* Perform general inquiry. */
221#define BTA_DM_LIMITED_INQUIRY \
222 BTM_LIMITED_INQUIRY /* Perform limited inquiry. */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800223
Myles Watsoncd1fd072016-11-09 13:17:43 -0800224#define BTA_BLE_INQUIRY_NONE BTM_BLE_INQUIRY_NONE
225#define BTA_BLE_GENERAL_INQUIRY \
226 BTM_BLE_GENERAL_INQUIRY /* Perform LE general inquiry. */
227#define BTA_BLE_LIMITED_INQUIRY \
228 BTM_BLE_LIMITED_INQUIRY /* Perform LE limited inquiry. */
Marie Janssene9e58ce2016-06-17 14:12:17 -0700229typedef uint8_t tBTA_DM_INQ_MODE;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800230
231/* Inquiry Filter Type */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800232#define BTA_DM_INQ_CLR BTM_CLR_INQUIRY_FILTER /* Clear inquiry filter. */
233#define BTA_DM_INQ_DEV_CLASS \
234 BTM_FILTER_COND_DEVICE_CLASS /* Filter on device class. */
235#define BTA_DM_INQ_BD_ADDR \
236 BTM_FILTER_COND_BD_ADDR /* Filter on a specific BD address. */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800237
Marie Janssene9e58ce2016-06-17 14:12:17 -0700238typedef uint8_t tBTA_DM_INQ_FILT;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800239
240/* Authorize Response */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800241#define BTA_DM_AUTH_PERM \
242 0 /* Authorized for future connections to the service */
243#define BTA_DM_AUTH_TEMP 1 /* Authorized for current connection only */
244#define BTA_DM_NOT_AUTH 2 /* Not authorized for the service */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800245
Marie Janssene9e58ce2016-06-17 14:12:17 -0700246typedef uint8_t tBTA_AUTH_RESP;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800247
248/* M/S preferred roles */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800249#define BTA_ANY_ROLE 0x00
250#define BTA_MASTER_ROLE_PREF 0x01
251#define BTA_MASTER_ROLE_ONLY 0x02
252#define BTA_SLAVE_ROLE_ONLY \
253 0x03 /* Used for PANU only, skip role switch to master */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800254
Marie Janssene9e58ce2016-06-17 14:12:17 -0700255typedef uint8_t tBTA_PREF_ROLES;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800256
Myles Watsoncd1fd072016-11-09 13:17:43 -0800257enum {
The Android Open Source Project5738f832012-12-12 16:00:35 -0800258
Myles Watsoncd1fd072016-11-09 13:17:43 -0800259 BTA_DM_NO_SCATTERNET, /* Device doesn't support scatternet, it might
260 support "role switch during connection" for
261 an incoming connection, when it already has
262 another connection in master role */
263 BTA_DM_PARTIAL_SCATTERNET, /* Device supports partial scatternet. It can have
264 simulateous connection in Master and Slave roles
265 for short period of time */
266 BTA_DM_FULL_SCATTERNET /* Device can have simultaneous connection in master
267 and slave roles */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800268
269};
270
The Android Open Source Project5738f832012-12-12 16:00:35 -0800271/* Inquiry filter device class condition */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800272typedef struct {
273 DEV_CLASS dev_class; /* device class of interest */
274 DEV_CLASS dev_class_mask; /* mask to determine the bits of device class of
275 interest */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800276} tBTA_DM_COD_COND;
277
The Android Open Source Project5738f832012-12-12 16:00:35 -0800278/* Inquiry Filter Condition */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800279typedef union {
280 BD_ADDR bd_addr; /* BD address of device to filter. */
281 tBTA_DM_COD_COND dev_class_cond; /* Device class filter condition */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800282} tBTA_DM_INQ_COND;
283
284/* Inquiry Parameters */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800285typedef struct {
286 tBTA_DM_INQ_MODE mode; /* Inquiry mode, limited or general. */
287 uint8_t duration; /* Inquiry duration in 1.28 sec units. */
288 uint8_t max_resps; /* Maximum inquiry responses. Set to zero for unlimited
289 responses. */
290 bool report_dup; /* report duplicated inquiry response with higher RSSI value
291 */
292 tBTA_DM_INQ_FILT filter_type; /* Filter condition type. */
293 tBTA_DM_INQ_COND filter_cond; /* Filter condition data. */
Marie Janssene9e58ce2016-06-17 14:12:17 -0700294#if (BTA_HOST_INTERLEAVE_SEARCH == TRUE)
Myles Watsoncd1fd072016-11-09 13:17:43 -0800295 uint8_t intl_duration
296 [4]; /*duration array storing the interleave scan's time portions*/
Matthew Xie7f3e4292013-09-30 12:44:10 -0700297#endif
The Android Open Source Project5738f832012-12-12 16:00:35 -0800298} tBTA_DM_INQ;
299
Myles Watsoncd1fd072016-11-09 13:17:43 -0800300typedef struct {
301 uint8_t bta_dm_eir_min_name_len; /* minimum length of local name when it is
302 shortened */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800303#if (BTA_EIR_CANNED_UUID_LIST == TRUE)
Myles Watsoncd1fd072016-11-09 13:17:43 -0800304 uint8_t bta_dm_eir_uuid16_len; /* length of 16-bit UUIDs */
305 uint8_t* bta_dm_eir_uuid16; /* 16-bit UUIDs */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800306#else
Myles Watsoncd1fd072016-11-09 13:17:43 -0800307 uint32_t uuid_mask[BTM_EIR_SERVICE_ARRAY_SIZE]; /* mask of UUID list in EIR */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800308#endif
Myles Watsoncd1fd072016-11-09 13:17:43 -0800309 int8_t* bta_dm_eir_inq_tx_power; /* Inquiry TX power */
310 uint8_t bta_dm_eir_flag_len; /* length of flags in bytes */
311 uint8_t* bta_dm_eir_flags; /* flags for EIR */
312 uint8_t bta_dm_eir_manufac_spec_len; /* length of manufacturer specific in
313 bytes */
314 uint8_t* bta_dm_eir_manufac_spec; /* manufacturer specific */
315 uint8_t bta_dm_eir_additional_len; /* length of additional data in bytes */
316 uint8_t* bta_dm_eir_additional; /* additional data */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800317} tBTA_DM_EIR_CONF;
318
Wei Wanga6ce7752014-05-20 06:30:32 +0000319/* advertising filter policy */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800320typedef tBTM_BLE_AFP tBTA_BLE_AFP;
Wei Wanga6ce7752014-05-20 06:30:32 +0000321
Myles Watsoncd1fd072016-11-09 13:17:43 -0800322enum {
323 BTA_BLE_BATCH_SCAN_MODE_PASS = 1,
324 BTA_BLE_BATCH_SCAN_MODE_ACTI = 2,
325 BTA_BLE_BATCH_SCAN_MODE_PASS_ACTI = 3
Satya Callojic4e25962014-05-10 23:46:24 -0700326};
Marie Janssene9e58ce2016-06-17 14:12:17 -0700327typedef uint8_t tBTA_BLE_BATCH_SCAN_MODE;
Satya Callojic4e25962014-05-10 23:46:24 -0700328
Myles Watsoncd1fd072016-11-09 13:17:43 -0800329enum { BTA_BLE_DISCARD_OLD_ITEMS = 0, BTA_BLE_DISCARD_LOWER_RSSI_ITEMS = 1 };
Marie Janssene9e58ce2016-06-17 14:12:17 -0700330typedef uint8_t tBTA_BLE_DISCARD_RULE;
Satya Callojic4e25962014-05-10 23:46:24 -0700331
Myles Watsoncd1fd072016-11-09 13:17:43 -0800332enum { BTA_BLE_ADV_SEEN_FIRST_TIME = 0, BTA_BLE_ADV_TRACKING_TIMEOUT = 1 };
Marie Janssene9e58ce2016-06-17 14:12:17 -0700333typedef uint8_t tBTA_BLE_ADV_CHANGE_REASON;
Satya Callojic4e25962014-05-10 23:46:24 -0700334
Myles Watsoncd1fd072016-11-09 13:17:43 -0800335enum {
336 BTA_BLE_BATCH_SCAN_ENB_EVT = 1,
337 BTA_BLE_BATCH_SCAN_CFG_STRG_EVT = 2,
338 BTA_BLE_BATCH_SCAN_DATA_EVT = 3,
339 BTA_BLE_BATCH_SCAN_THRES_EVT = 4,
340 BTA_BLE_BATCH_SCAN_PARAM_EVT = 5,
341 BTA_BLE_BATCH_SCAN_DIS_EVT = 6
Satya Callojic4e25962014-05-10 23:46:24 -0700342};
343typedef tBTM_BLE_BATCH_SCAN_EVT tBTA_BLE_BATCH_SCAN_EVT;
344
345typedef tBTM_BLE_TRACK_ADV_ACTION tBTA_BLE_TRACK_ADV_ACTION;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800346
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800347/* BLE customer specific feature function type definitions */
348/* data type used on customer specific feature for RSSI monitoring */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800349#define BTA_BLE_RSSI_ALERT_HI 0
350#define BTA_BLE_RSSI_ALERT_RANGE 1
351#define BTA_BLE_RSSI_ALERT_LO 2
Marie Janssene9e58ce2016-06-17 14:12:17 -0700352typedef uint8_t tBTA_DM_BLE_RSSI_ALERT_TYPE;
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800353
Myles Watsoncd1fd072016-11-09 13:17:43 -0800354#define BTA_BLE_RSSI_ALERT_NONE BTM_BLE_RSSI_ALERT_NONE /* (0) */
355#define BTA_BLE_RSSI_ALERT_HI_BIT BTM_BLE_RSSI_ALERT_HI_BIT /* (1) */
356#define BTA_BLE_RSSI_ALERT_RANGE_BIT \
357 BTM_BLE_RSSI_ALERT_RANGE_BIT /* (1 << 1) */
358#define BTA_BLE_RSSI_ALERT_LO_BIT BTM_BLE_RSSI_ALERT_LO_BIT /* (1 << 2) */
359typedef uint8_t tBTA_DM_BLE_RSSI_ALERT_MASK;
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800360
Myles Watsoncd1fd072016-11-09 13:17:43 -0800361typedef void(tBTA_DM_BLE_RSSI_CBACK)(BD_ADDR bd_addr,
362 tBTA_DM_BLE_RSSI_ALERT_TYPE alert_type,
363 int8_t rssi);
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800364
365/* max number of filter spot for different filter type */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800366#define BTA_DM_BLE_MAX_UUID_FILTER BTM_BLE_MAX_UUID_FILTER /* 8 */
367#define BTA_DM_BLE_MAX_ADDR_FILTER BTM_BLE_MAX_ADDR_FILTER /* 8 */
368#define BTA_DM_BLE_PF_STR_COND_MAX \
369 BTM_BLE_PF_STR_COND_MAX /* 4 apply to manu data , or local name */
370#define BTA_DM_BLE_PF_STR_LEN_MAX \
371 BTM_BLE_PF_STR_LEN_MAX /* match for first 20 bytes */
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800372
Myles Watsoncd1fd072016-11-09 13:17:43 -0800373#define BTA_DM_BLE_PF_LOGIC_OR 0
374#define BTA_DM_BLE_PF_LOGIC_AND 1
Marie Janssene9e58ce2016-06-17 14:12:17 -0700375typedef uint8_t tBTA_DM_BLE_PF_LOGIC_TYPE;
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800376
Myles Watsoncd1fd072016-11-09 13:17:43 -0800377enum {
378 BTA_DM_BLE_SCAN_COND_ADD,
379 BTA_DM_BLE_SCAN_COND_DELETE,
380 BTA_DM_BLE_SCAN_COND_CLEAR = 2
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800381};
Marie Janssene9e58ce2016-06-17 14:12:17 -0700382typedef uint8_t tBTA_DM_BLE_SCAN_COND_OP;
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800383
Satya Calloji1a9247a2014-06-05 13:15:15 -0700384/* ADV payload filtering vendor specific call event */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800385enum { BTA_BLE_SCAN_PF_ENABLE_EVT = 7, BTA_BLE_SCAN_PF_COND_EVT };
Satya Calloji1a9247a2014-06-05 13:15:15 -0700386
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800387/* filter selection bit index */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800388#define BTA_DM_BLE_PF_ADDR_FILTER BTM_BLE_PF_ADDR_FILTER
389#define BTA_DM_BLE_PF_SRVC_DATA BTM_BLE_PF_SRVC_DATA
390#define BTA_DM_BLE_PF_SRVC_UUID BTM_BLE_PF_SRVC_UUID
391#define BTA_DM_BLE_PF_SRVC_SOL_UUID BTM_BLE_PF_SRVC_SOL_UUID
392#define BTA_DM_BLE_PF_LOCAL_NAME BTM_BLE_PF_LOCAL_NAME
393#define BTA_DM_BLE_PF_MANU_DATA BTM_BLE_PF_MANU_DATA
394#define BTA_DM_BLE_PF_SRVC_DATA_PATTERN BTM_BLE_PF_SRVC_DATA_PATTERN
395#define BTA_DM_BLE_PF_TYPE_ALL BTM_BLE_PF_TYPE_ALL
396#define BTA_DM_BLE_PF_TYPE_MAX BTM_BLE_PF_TYPE_MAX
397typedef uint8_t tBTA_DM_BLE_PF_COND_TYPE;
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800398
Myles Watsoncd1fd072016-11-09 13:17:43 -0800399typedef union {
400 uint16_t uuid16_mask;
401 uint32_t uuid32_mask;
402 uint8_t uuid128_mask[LEN_UUID_128];
403} tBTA_DM_BLE_PF_COND_MASK;
Andre Eisenbachb203d472013-11-20 17:23:06 -0800404
Myles Watsoncd1fd072016-11-09 13:17:43 -0800405typedef struct {
406 tBLE_BD_ADDR*
407 p_target_addr; /* target address, if NULL, generic UUID filter */
408 tBT_UUID uuid; /* UUID condition */
409 tBTA_DM_BLE_PF_LOGIC_TYPE cond_logic; /* AND/OR */
410 tBTA_DM_BLE_PF_COND_MASK*
411 p_uuid_mask; /* UUID condition mask, if NULL, match exact as UUID
412 condition */
413} tBTA_DM_BLE_PF_UUID_COND;
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800414
Myles Watsoncd1fd072016-11-09 13:17:43 -0800415typedef struct {
416 uint8_t data_len; /* <= 20 bytes */
417 uint8_t* p_data;
418} tBTA_DM_BLE_PF_LOCAL_NAME_COND;
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800419
Myles Watsoncd1fd072016-11-09 13:17:43 -0800420typedef struct {
421 uint16_t company_id; /* company ID */
422 uint8_t data_len; /* <= 20 bytes */
423 uint8_t* p_pattern;
424 uint16_t company_id_mask; /* UUID value mask */
425 uint8_t*
426 p_pattern_mask; /* Manufacturer data matching mask, same length
427 as data pattern, set to all 0xff, match exact data */
428} tBTA_DM_BLE_PF_MANU_COND;
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800429
Myles Watsoncd1fd072016-11-09 13:17:43 -0800430typedef struct {
431 uint16_t uuid; /* service ID */
432 uint8_t data_len; /* <= 20 bytes */
433 uint8_t* p_pattern;
434 uint8_t*
435 p_pattern_mask; /* Service data matching mask, same length
436 as data pattern, set to all 0xff, match exact data */
437} tBTA_DM_BLE_PF_SRVC_PATTERN_COND;
Andre Eisenbachb203d472013-11-20 17:23:06 -0800438
Myles Watsoncd1fd072016-11-09 13:17:43 -0800439typedef union {
440 tBLE_BD_ADDR target_addr;
441 tBTA_DM_BLE_PF_LOCAL_NAME_COND local_name; /* lcoal name filtering */
442 tBTA_DM_BLE_PF_MANU_COND manu_data; /* manufactuer data filtering */
443 tBTA_DM_BLE_PF_UUID_COND srvc_uuid; /* service UUID filtering */
444 tBTA_DM_BLE_PF_UUID_COND
445 solicitate_uuid; /* solicitated service UUID filtering */
446 tBTA_DM_BLE_PF_SRVC_PATTERN_COND srvc_data; /* service data pattern */
447} tBTA_DM_BLE_PF_COND_PARAM;
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800448
Marie Janssene9e58ce2016-06-17 14:12:17 -0700449typedef uint8_t tBTA_DM_BLE_PF_FILT_INDEX;
450typedef uint8_t tBTA_DM_BLE_PF_AVBL_SPACE;
Satya Calloji1a9247a2014-06-05 13:15:15 -0700451
Marie Janssene9e58ce2016-06-17 14:12:17 -0700452typedef int8_t tBTA_DM_RSSI_VALUE;
453typedef uint8_t tBTA_DM_LINK_QUALITY_VALUE;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800454
Marie Janssene9e58ce2016-06-17 14:12:17 -0700455typedef uint8_t tBTA_SIG_STRENGTH_MASK;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800456
The Android Open Source Project5738f832012-12-12 16:00:35 -0800457/* Security Callback Events */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800458#define BTA_DM_ENABLE_EVT 0 /* Enable Event */
459#define BTA_DM_DISABLE_EVT 1 /* Disable Event */
460#define BTA_DM_PIN_REQ_EVT 2 /* PIN request. */
461#define BTA_DM_AUTH_CMPL_EVT 3 /* Authentication complete indication. */
462#define BTA_DM_AUTHORIZE_EVT 4 /* Authorization request. */
463#define BTA_DM_LINK_UP_EVT 5 /* Connection UP event */
464#define BTA_DM_LINK_DOWN_EVT 6 /* Connection DOWN event */
465#define BTA_DM_SIG_STRENGTH_EVT \
466 7 /* Signal strength for bluetooth connection \
467 */
468#define BTA_DM_BUSY_LEVEL_EVT 8 /* System busy level */
469#define BTA_DM_BOND_CANCEL_CMPL_EVT 9 /* Bond cancel complete indication */
470#define BTA_DM_SP_CFM_REQ_EVT \
471 10 /* Simple Pairing User Confirmation request. \
472 */
473#define BTA_DM_SP_KEY_NOTIF_EVT 11 /* Simple Pairing Passkey Notification */
474#define BTA_DM_SP_RMT_OOB_EVT 12 /* Simple Pairing Remote OOB Data request. */
475#define BTA_DM_SP_KEYPRESS_EVT 13 /* Key press notification event. */
476#define BTA_DM_ROLE_CHG_EVT 14 /* Role Change event. */
477#define BTA_DM_BLE_KEY_EVT 15 /* BLE SMP key event for peer device keys */
478#define BTA_DM_BLE_SEC_REQ_EVT 16 /* BLE SMP security request */
479#define BTA_DM_BLE_PASSKEY_NOTIF_EVT 17 /* SMP passkey notification event */
480#define BTA_DM_BLE_PASSKEY_REQ_EVT 18 /* SMP passkey request event */
481#define BTA_DM_BLE_OOB_REQ_EVT 19 /* SMP OOB request event */
482#define BTA_DM_BLE_LOCAL_IR_EVT 20 /* BLE local IR event */
483#define BTA_DM_BLE_LOCAL_ER_EVT 21 /* BLE local ER event */
484#define BTA_DM_BLE_NC_REQ_EVT 22 /* SMP Numeric Comparison request event */
485#define BTA_DM_SP_RMT_OOB_EXT_EVT \
486 23 /* Simple Pairing Remote OOB Extended Data request. */
487#define BTA_DM_BLE_AUTH_CMPL_EVT 24 /* BLE Auth complete */
488#define BTA_DM_DEV_UNPAIRED_EVT 25
489#define BTA_DM_HW_ERROR_EVT 26 /* BT Chip H/W error */
490#define BTA_DM_LE_FEATURES_READ \
491 27 /* Cotroller specific LE features are read \
492 */
493#define BTA_DM_ENER_INFO_READ 28 /* Energy info read */
494#define BTA_DM_BLE_SC_OOB_REQ_EVT 29 /* SMP SC OOB request event */
Marie Janssene9e58ce2016-06-17 14:12:17 -0700495typedef uint8_t tBTA_DM_SEC_EVT;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800496
497/* Structure associated with BTA_DM_ENABLE_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800498typedef struct { tBTA_STATUS status; } tBTA_DM_ENABLE;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800499
500/* Structure associated with BTA_DM_PIN_REQ_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800501typedef struct {
502 /* Note: First 3 data members must be, bd_addr, dev_class, and bd_name in
503 * order */
504 BD_ADDR bd_addr; /* BD address peer device. */
505 DEV_CLASS dev_class; /* Class of Device */
506 BD_NAME bd_name; /* Name of peer device. */
507 bool min_16_digit; /* true if the pin returned must be at least 16 digits */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800508} tBTA_DM_PIN_REQ;
509
510/* BLE related definition */
511
Myles Watsoncd1fd072016-11-09 13:17:43 -0800512#define BTA_DM_AUTH_FAIL_BASE (HCI_ERR_MAX_ERR + 10)
Jacky Cheung07c78922016-07-06 15:11:30 -0700513
Myles Watsoncd1fd072016-11-09 13:17:43 -0800514/* Converts SMP error codes defined in smp_api.h to SMP auth fail reasons below.
515 */
516#define BTA_DM_AUTH_CONVERT_SMP_CODE(x) (BTA_DM_AUTH_FAIL_BASE + (x))
Jacky Cheung07c78922016-07-06 15:11:30 -0700517
Myles Watsoncd1fd072016-11-09 13:17:43 -0800518#define BTA_DM_AUTH_SMP_PASSKEY_FAIL \
519 (BTA_DM_AUTH_FAIL_BASE + SMP_PASSKEY_ENTRY_FAIL)
520#define BTA_DM_AUTH_SMP_OOB_FAIL (BTA_DM_AUTH_FAIL_BASE + SMP_OOB_FAIL)
521#define BTA_DM_AUTH_SMP_PAIR_AUTH_FAIL \
522 (BTA_DM_AUTH_FAIL_BASE + SMP_PAIR_AUTH_FAIL)
523#define BTA_DM_AUTH_SMP_CONFIRM_VALUE_FAIL \
524 (BTA_DM_AUTH_FAIL_BASE + SMP_CONFIRM_VALUE_ERR)
525#define BTA_DM_AUTH_SMP_PAIR_NOT_SUPPORT \
526 (BTA_DM_AUTH_FAIL_BASE + SMP_PAIR_NOT_SUPPORT)
527#define BTA_DM_AUTH_SMP_ENC_KEY_SIZE (BTA_DM_AUTH_FAIL_BASE + SMP_ENC_KEY_SIZE)
528#define BTA_DM_AUTH_SMP_INVALID_CMD (BTA_DM_AUTH_FAIL_BASE + SMP_INVALID_CMD)
529#define BTA_DM_AUTH_SMP_UNKNOWN_ERR \
530 (BTA_DM_AUTH_FAIL_BASE + SMP_PAIR_FAIL_UNKNOWN)
531#define BTA_DM_AUTH_SMP_REPEATED_ATTEMPT \
532 (BTA_DM_AUTH_FAIL_BASE + SMP_REPEATED_ATTEMPTS)
533#define BTA_DM_AUTH_SMP_INVALID_PARAMETERS \
534 (BTA_DM_AUTH_FAIL_BASE + SMP_INVALID_PARAMETERS)
535#define BTA_DM_AUTH_SMP_INTERNAL_ERR \
536 (BTA_DM_AUTH_FAIL_BASE + SMP_PAIR_INTERNAL_ERR)
537#define BTA_DM_AUTH_SMP_UNKNOWN_IO (BTA_DM_AUTH_FAIL_BASE + SMP_UNKNOWN_IO_CAP)
538#define BTA_DM_AUTH_SMP_INIT_FAIL (BTA_DM_AUTH_FAIL_BASE + SMP_INIT_FAIL)
539#define BTA_DM_AUTH_SMP_CONFIRM_FAIL (BTA_DM_AUTH_FAIL_BASE + SMP_CONFIRM_FAIL)
540#define BTA_DM_AUTH_SMP_BUSY (BTA_DM_AUTH_FAIL_BASE + SMP_BUSY)
541#define BTA_DM_AUTH_SMP_ENC_FAIL (BTA_DM_AUTH_FAIL_BASE + SMP_ENC_FAIL)
542#define BTA_DM_AUTH_SMP_RSP_TIMEOUT (BTA_DM_AUTH_FAIL_BASE + SMP_RSP_TIMEOUT)
543#define BTA_DM_AUTH_SMP_CONN_TOUT (BTA_DM_AUTH_FAIL_BASE + SMP_CONN_TOUT)
The Android Open Source Project5738f832012-12-12 16:00:35 -0800544
545/* connection parameter boundary value and dummy value */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800546#define BTA_DM_BLE_SCAN_INT_MIN BTM_BLE_SCAN_INT_MIN
547#define BTA_DM_BLE_SCAN_INT_MAX BTM_BLE_SCAN_INT_MAX
548#define BTA_DM_BLE_SCAN_WIN_MIN BTM_BLE_SCAN_WIN_MIN
549#define BTA_DM_BLE_SCAN_WIN_MAX BTM_BLE_SCAN_WIN_MAX
550#define BTA_DM_BLE_CONN_INT_MIN BTM_BLE_CONN_INT_MIN
551#define BTA_DM_BLE_CONN_INT_MAX BTM_BLE_CONN_INT_MAX
552#define BTA_DM_BLE_CONN_LATENCY_MAX BTM_BLE_CONN_LATENCY_MAX
553#define BTA_DM_BLE_CONN_SUP_TOUT_MIN BTM_BLE_CONN_SUP_TOUT_MIN
554#define BTA_DM_BLE_CONN_SUP_TOUT_MAX BTM_BLE_CONN_SUP_TOUT_MAX
555#define BTA_DM_BLE_CONN_PARAM_UNDEF \
556 BTM_BLE_CONN_PARAM_UNDEF /* use this value when a specific value not to be \
557 overwritten */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800558
Myles Watsoncd1fd072016-11-09 13:17:43 -0800559#define BTA_LE_KEY_PENC \
560 BTM_LE_KEY_PENC /* encryption information of peer device */
561#define BTA_LE_KEY_PID BTM_LE_KEY_PID /* identity key of the peer device */
562#define BTA_LE_KEY_PCSRK BTM_LE_KEY_PCSRK /* peer SRK */
563#define BTA_LE_KEY_LENC \
564 BTM_LE_KEY_LENC /* master role security information:div */
565#define BTA_LE_KEY_LID BTM_LE_KEY_LID /* master device ID key */
566#define BTA_LE_KEY_LCSRK \
567 BTM_LE_KEY_LCSRK /* local CSRK has been deliver to peer */
Marie Janssene9e58ce2016-06-17 14:12:17 -0700568typedef uint8_t tBTA_LE_KEY_TYPE; /* can be used as a bit mask */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800569
Myles Watsoncd1fd072016-11-09 13:17:43 -0800570typedef tBTM_LE_PENC_KEYS tBTA_LE_PENC_KEYS;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800571typedef tBTM_LE_PCSRK_KEYS tBTA_LE_PCSRK_KEYS;
Myles Watsoncd1fd072016-11-09 13:17:43 -0800572typedef tBTM_LE_LENC_KEYS tBTA_LE_LENC_KEYS;
573typedef tBTM_LE_LCSRK_KEYS tBTA_LE_LCSRK_KEYS;
574typedef tBTM_LE_PID_KEYS tBTA_LE_PID_KEYS;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800575
Myles Watsoncd1fd072016-11-09 13:17:43 -0800576typedef union {
577 tBTA_LE_PENC_KEYS penc_key; /* received peer encryption key */
578 tBTA_LE_PCSRK_KEYS psrk_key; /* received peer device SRK */
579 tBTA_LE_PID_KEYS pid_key; /* peer device ID key */
580 tBTA_LE_LENC_KEYS
581 lenc_key; /* local encryption reproduction keys LTK = = d1(ER,DIV,0)*/
582 tBTA_LE_LCSRK_KEYS lcsrk_key; /* local device CSRK = d1(ER,DIV,1)*/
583 tBTA_LE_PID_KEYS lid_key; /* local device ID key for the particular remote */
584} tBTA_LE_KEY_VALUE;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800585
Myles Watsoncd1fd072016-11-09 13:17:43 -0800586#define BTA_BLE_LOCAL_KEY_TYPE_ID 1
587#define BTA_BLE_LOCAL_KEY_TYPE_ER 2
Marie Janssene9e58ce2016-06-17 14:12:17 -0700588typedef uint8_t tBTA_DM_BLE_LOCAL_KEY_MASK;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800589
Myles Watsoncd1fd072016-11-09 13:17:43 -0800590typedef struct {
591 BT_OCTET16 ir;
592 BT_OCTET16 irk;
593 BT_OCTET16 dhk;
594} tBTA_BLE_LOCAL_ID_KEYS;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800595
Myles Watsoncd1fd072016-11-09 13:17:43 -0800596#define BTA_DM_SEC_GRANTED BTA_SUCCESS
597#define BTA_DM_SEC_PAIR_NOT_SPT BTA_DM_AUTH_SMP_PAIR_NOT_SUPPORT
598#define BTA_DM_SEC_REP_ATTEMPTS BTA_DM_AUTH_SMP_REPEATED_ATTEMPT
Marie Janssene9e58ce2016-06-17 14:12:17 -0700599typedef uint8_t tBTA_DM_BLE_SEC_GRANT;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800600
Myles Watsoncd1fd072016-11-09 13:17:43 -0800601#define BTA_DM_BLE_ONN_NONE BTM_BLE_CONN_NONE
602#define BTA_DM_BLE_CONN_AUTO BTM_BLE_CONN_AUTO
603#define BTA_DM_BLE_CONN_SELECTIVE BTM_BLE_CONN_SELECTIVE
Marie Janssene9e58ce2016-06-17 14:12:17 -0700604typedef uint8_t tBTA_DM_BLE_CONN_TYPE;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800605
Myles Watsoncd1fd072016-11-09 13:17:43 -0800606typedef bool(tBTA_DM_BLE_SEL_CBACK)(BD_ADDR random_bda, uint8_t* p_remote_name);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800607
608/* Structure associated with BTA_DM_BLE_SEC_REQ_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800609typedef struct {
610 BD_ADDR bd_addr; /* peer address */
611 BD_NAME bd_name; /* peer device name */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800612} tBTA_DM_BLE_SEC_REQ;
613
Myles Watsoncd1fd072016-11-09 13:17:43 -0800614typedef struct {
615 BD_ADDR bd_addr; /* peer address */
616 tBTM_LE_KEY_TYPE key_type;
617 tBTM_LE_KEY_VALUE* p_key_value;
618} tBTA_DM_BLE_KEY;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800619
620/* Structure associated with BTA_DM_AUTH_CMPL_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800621typedef struct {
622 BD_ADDR bd_addr; /* BD address peer device. */
623 BD_NAME bd_name; /* Name of peer device. */
624 bool key_present; /* Valid link key value in key element */
625 LINK_KEY key; /* Link key associated with peer device. */
626 uint8_t key_type; /* The type of Link Key */
627 bool success; /* true of authentication succeeded, false if failed. */
628 uint8_t fail_reason; /* The HCI reason/error code for when success=false */
629 tBLE_ADDR_TYPE addr_type; /* Peer device address type */
630 tBT_DEVICE_TYPE dev_type;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800631} tBTA_DM_AUTH_CMPL;
632
The Android Open Source Project5738f832012-12-12 16:00:35 -0800633/* Structure associated with BTA_DM_AUTHORIZE_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800634typedef struct {
635 BD_ADDR bd_addr; /* BD address peer device. */
636 BD_NAME bd_name; /* Name of peer device. */
637 tBTA_SERVICE_ID service; /* Service ID to authorize. */
638 DEV_CLASS dev_class;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800639} tBTA_DM_AUTHORIZE;
640
641/* Structure associated with BTA_DM_LINK_UP_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800642typedef struct {
643 BD_ADDR bd_addr; /* BD address peer device. */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800644 tBTA_TRANSPORT link_type;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800645} tBTA_DM_LINK_UP;
646
647/* Structure associated with BTA_DM_LINK_DOWN_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800648typedef struct {
649 BD_ADDR bd_addr; /* BD address peer device. */
650 uint8_t status; /* connection open/closed */
651 bool is_removed; /* true if device is removed when link is down */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800652 tBTA_TRANSPORT link_type;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800653} tBTA_DM_LINK_DOWN;
654
655/* Structure associated with BTA_DM_ROLE_CHG_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800656typedef struct {
657 BD_ADDR bd_addr; /* BD address peer device. */
658 uint8_t new_role; /* the new connection role */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800659} tBTA_DM_ROLE_CHG;
660
The Android Open Source Project5738f832012-12-12 16:00:35 -0800661/* Structure associated with BTA_DM_BUSY_LEVEL_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800662typedef struct {
663 uint8_t level; /* when paging or inquiring, level is 10.
664 Otherwise, the number of ACL links */
665 uint8_t level_flags; /* indicates individual flags */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800666} tBTA_DM_BUSY_LEVEL;
667
Myles Watson2e8e9f42016-11-14 16:45:15 -0800668#define BTA_IO_CAP_OUT BTM_IO_CAP_OUT /* 0 DisplayOnly */
669#define BTA_IO_CAP_IO BTM_IO_CAP_IO /* 1 DisplayYesNo */
670#define BTA_IO_CAP_IN BTM_IO_CAP_IN /* 2 KeyboardOnly */
671#define BTA_IO_CAP_NONE BTM_IO_CAP_NONE /* 3 NoInputNoOutput */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800672#define BTA_IO_CAP_KBDISP BTM_IO_CAP_KBDISP /* 4 Keyboard display */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800673typedef tBTM_IO_CAP tBTA_IO_CAP;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800674
Myles Watsoncd1fd072016-11-09 13:17:43 -0800675#define BTA_AUTH_SP_NO \
676 BTM_AUTH_SP_NO /* 0 MITM Protection Not Required - Single \
677 Profile/non-bonding \
678 Numeric comparison with automatic accept allowed */
679#define BTA_AUTH_SP_YES \
680 BTM_AUTH_SP_YES /* 1 MITM Protection Required - Single Profile/non-bonding \
681 Use IO Capabilities to determine authentication procedure \
682 */
683#define BTA_AUTH_AP_NO \
684 BTM_AUTH_AP_NO /* 2 MITM Protection Not Required - All Profiles/dedicated \
685 bonding \
686 Numeric comparison with automatic accept allowed */
687#define BTA_AUTH_AP_YES \
688 BTM_AUTH_AP_YES /* 3 MITM Protection Required - All Profiles/dedicated \
689 bonding \
690 Use IO Capabilities to determine authentication procedure \
691 */
692#define BTA_AUTH_SPGB_NO \
693 BTM_AUTH_SPGB_NO /* 4 MITM Protection Not Required - Single Profiles/general \
694 bonding \
695 Numeric comparison with automatic accept allowed */
696#define BTA_AUTH_SPGB_YES \
697 BTM_AUTH_SPGB_YES /* 5 MITM Protection Required - Single Profiles/general \
698 bonding \
699 Use IO Capabilities to determine authentication \
700 procedure */
701typedef tBTM_AUTH_REQ tBTA_AUTH_REQ;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800702
Myles Watsoncd1fd072016-11-09 13:17:43 -0800703#define BTA_AUTH_DD_BOND \
704 BTM_AUTH_DD_BOND /* 2 this bit is set for dedicated bonding */
705#define BTA_AUTH_GEN_BOND \
706 BTM_AUTH_SPGB_NO /* 4 this bit is set for general bonding */
707#define BTA_AUTH_BONDS \
708 BTM_AUTH_BONDS /* 6 the general/dedicated bonding bits */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800709
Myles Watsoncd1fd072016-11-09 13:17:43 -0800710#define BTA_LE_AUTH_NO_BOND BTM_LE_AUTH_REQ_NO_BOND /* 0*/
711#define BTA_LE_AUTH_BOND BTM_LE_AUTH_REQ_BOND /* 1 << 0 */
712#define BTA_LE_AUTH_REQ_MITM BTM_LE_AUTH_REQ_MITM /* 1 << 2 */
Satya Calloji444a8da2015-03-06 10:38:22 -0800713
Myles Watsoncd1fd072016-11-09 13:17:43 -0800714#define BTA_LE_AUTH_REQ_SC_ONLY BTM_LE_AUTH_REQ_SC_ONLY /* 1 << 3 */
715#define BTA_LE_AUTH_REQ_SC_BOND BTM_LE_AUTH_REQ_SC_BOND /* 1001 */
716#define BTA_LE_AUTH_REQ_SC_MITM BTM_LE_AUTH_REQ_SC_MITM /* 1100 */
717#define BTA_LE_AUTH_REQ_SC_MITM_BOND BTM_LE_AUTH_REQ_SC_MITM_BOND /* 1101 */
718typedef tBTM_LE_AUTH_REQ
719 tBTA_LE_AUTH_REQ; /* combination of the above bit pattern */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800720
Myles Watsoncd1fd072016-11-09 13:17:43 -0800721#define BTA_OOB_NONE BTM_OOB_NONE
722#define BTA_OOB_PRESENT BTM_OOB_PRESENT
723#define BTA_OOB_UNKNOWN BTM_OOB_UNKNOWN
Jakub Pawlowski175da702015-11-12 15:00:58 -0800724
Myles Watsoncd1fd072016-11-09 13:17:43 -0800725typedef tBTM_OOB_DATA tBTA_OOB_DATA;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800726
727/* Structure associated with BTA_DM_SP_CFM_REQ_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800728typedef struct {
729 /* Note: First 3 data members must be, bd_addr, dev_class, and bd_name in
730 * order */
731 BD_ADDR bd_addr; /* peer address */
732 DEV_CLASS dev_class; /* peer CoD */
733 BD_NAME bd_name; /* peer device name */
734 uint32_t num_val; /* the numeric value for comparison. If just_works, do not
735 show this number to UI */
736 bool just_works; /* true, if "Just Works" association model */
737 tBTA_AUTH_REQ loc_auth_req; /* Authentication required for local device */
738 tBTA_AUTH_REQ rmt_auth_req; /* Authentication required for peer device */
739 tBTA_IO_CAP loc_io_caps; /* IO Capabilities of local device */
740 tBTA_AUTH_REQ rmt_io_caps; /* IO Capabilities of remote device */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800741} tBTA_DM_SP_CFM_REQ;
742
Myles Watsoncd1fd072016-11-09 13:17:43 -0800743enum {
744 BTA_SP_KEY_STARTED, /* passkey entry started */
745 BTA_SP_KEY_ENTERED, /* passkey digit entered */
746 BTA_SP_KEY_ERASED, /* passkey digit erased */
747 BTA_SP_KEY_CLEARED, /* passkey cleared */
748 BTA_SP_KEY_COMPLT /* passkey entry completed */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800749};
Myles Watsoncd1fd072016-11-09 13:17:43 -0800750typedef uint8_t tBTA_SP_KEY_TYPE;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800751
752/* Structure associated with BTA_DM_SP_KEYPRESS_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800753typedef struct {
754 BD_ADDR bd_addr; /* peer address */
755 tBTA_SP_KEY_TYPE notif_type;
756} tBTA_DM_SP_KEY_PRESS;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800757
758/* Structure associated with BTA_DM_SP_KEY_NOTIF_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800759typedef struct {
760 /* Note: First 3 data members must be, bd_addr, dev_class, and bd_name in
761 * order */
762 BD_ADDR bd_addr; /* peer address */
763 DEV_CLASS dev_class; /* peer CoD */
764 BD_NAME bd_name; /* peer device name */
765 uint32_t passkey; /* the numeric value for comparison. If just_works, do not
766 show this number to UI */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800767} tBTA_DM_SP_KEY_NOTIF;
768
769/* Structure associated with BTA_DM_SP_RMT_OOB_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800770typedef struct {
771 /* Note: First 3 data members must be, bd_addr, dev_class, and bd_name in
772 * order */
773 BD_ADDR bd_addr; /* peer address */
774 DEV_CLASS dev_class; /* peer CoD */
775 BD_NAME bd_name; /* peer device name */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800776} tBTA_DM_SP_RMT_OOB;
777
778/* Structure associated with BTA_DM_BOND_CANCEL_CMPL_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800779typedef struct {
780 tBTA_STATUS result; /* true of bond cancel succeeded, false if failed. */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800781} tBTA_DM_BOND_CANCEL_CMPL;
782
783/* Union of all security callback structures */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800784typedef union {
785 tBTA_DM_ENABLE enable; /* BTA enabled */
786 tBTA_DM_PIN_REQ pin_req; /* PIN request. */
787 tBTA_DM_AUTH_CMPL auth_cmpl; /* Authentication complete indication. */
788 tBTA_DM_AUTHORIZE authorize; /* Authorization request. */
789 tBTA_DM_LINK_UP link_up; /* ACL connection down event */
790 tBTA_DM_LINK_DOWN link_down; /* ACL connection down event */
791 tBTA_DM_BUSY_LEVEL busy_level; /* System busy level */
792 tBTA_DM_SP_CFM_REQ cfm_req; /* user confirm request */
793 tBTA_DM_SP_KEY_NOTIF key_notif; /* passkey notification */
794 tBTA_DM_SP_RMT_OOB rmt_oob; /* remote oob */
795 tBTA_DM_BOND_CANCEL_CMPL
796 bond_cancel_cmpl; /* Bond Cancel Complete indication */
797 tBTA_DM_SP_KEY_PRESS key_press; /* key press notification event */
798 tBTA_DM_ROLE_CHG role_chg; /* role change event */
799 tBTA_DM_BLE_SEC_REQ ble_req; /* BLE SMP related request */
800 tBTA_DM_BLE_KEY ble_key; /* BLE SMP keys used when pairing */
801 tBTA_BLE_LOCAL_ID_KEYS ble_id_keys; /* IR event */
802 BT_OCTET16 ble_er; /* ER event data */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800803} tBTA_DM_SEC;
804
805/* Security callback */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800806typedef void(tBTA_DM_SEC_CBACK)(tBTA_DM_SEC_EVT event, tBTA_DM_SEC* p_data);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800807
Marie Janssene9e58ce2016-06-17 14:12:17 -0700808typedef uint32_t tBTA_DM_BLE_REF_VALUE;
Wei Wanga6ce7752014-05-20 06:30:32 +0000809
Myles Watsoncd1fd072016-11-09 13:17:43 -0800810#define BTA_DM_BLE_PF_ENABLE_EVT BTM_BLE_PF_ENABLE
811#define BTA_DM_BLE_PF_CONFIG_EVT BTM_BLE_PF_CONFIG
Marie Janssene9e58ce2016-06-17 14:12:17 -0700812typedef uint8_t tBTA_DM_BLE_PF_EVT;
Satya Calloji1a9247a2014-06-05 13:15:15 -0700813
Myles Watsoncd1fd072016-11-09 13:17:43 -0800814#define BTA_DM_BLE_PF_ENABLE 1
815#define BTA_DM_BLE_PF_CONFIG 2
Marie Janssene9e58ce2016-06-17 14:12:17 -0700816typedef uint8_t tBTA_DM_BLE_PF_ACTION;
Satya Calloji1a9247a2014-06-05 13:15:15 -0700817
Satya Calloji1a9247a2014-06-05 13:15:15 -0700818/* Config callback */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800819typedef void(tBTA_DM_BLE_PF_CFG_CBACK)(tBTA_DM_BLE_PF_ACTION action,
820 tBTA_DM_BLE_PF_COND_TYPE cfg_cond,
821 tBTA_DM_BLE_PF_AVBL_SPACE avbl_space,
822 tBTA_STATUS status,
823 tBTA_DM_BLE_REF_VALUE ref_value);
Satya Calloji1a9247a2014-06-05 13:15:15 -0700824/* Param callback */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800825typedef void(tBTA_DM_BLE_PF_PARAM_CBACK)(uint8_t action_type,
826 tBTA_DM_BLE_PF_AVBL_SPACE avbl_space,
827 tBTA_DM_BLE_REF_VALUE ref_value,
828 tBTA_STATUS status);
Satya Calloji1a9247a2014-06-05 13:15:15 -0700829
830/* Status callback */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800831typedef void(tBTA_DM_BLE_PF_STATUS_CBACK)(uint8_t action, tBTA_STATUS status,
832 tBTA_DM_BLE_REF_VALUE ref_value);
Satya Calloji1a9247a2014-06-05 13:15:15 -0700833
Myles Watsoncd1fd072016-11-09 13:17:43 -0800834#define BTA_DM_BLE_PF_BRDCAST_ADDR_FILT 1
Satya Calloji1a9247a2014-06-05 13:15:15 -0700835#define BTA_DM_BLE_PF_SERV_DATA_CHG_FILT 2
Myles Watsoncd1fd072016-11-09 13:17:43 -0800836#define BTA_DM_BLE_PF_SERV_UUID 4
837#define BTA_DM_BLE_PF_SERV_SOLC_UUID 8
838#define BTA_DM_BLE_PF_LOC_NAME_CHECK 16
839#define BTA_DM_BLE_PF_MANUF_NAME_CHECK 32
840#define BTA_DM_BLE_PF_SERV_DATA_CHECK 64
Marie Janssene9e58ce2016-06-17 14:12:17 -0700841typedef uint16_t tBTA_DM_BLE_PF_FEAT_SEL;
Satya Calloji1a9247a2014-06-05 13:15:15 -0700842
Myles Watsoncd1fd072016-11-09 13:17:43 -0800843#define BTA_DM_BLE_PF_LIST_LOGIC_OR 1
844#define BTA_DM_BLE_PF_LIST_LOGIC_AND 2
Marie Janssene9e58ce2016-06-17 14:12:17 -0700845typedef uint16_t tBTA_DM_BLE_PF_LIST_LOGIC_TYPE;
Satya Calloji1a9247a2014-06-05 13:15:15 -0700846
Myles Watsoncd1fd072016-11-09 13:17:43 -0800847#define BTA_DM_BLE_PF_FILT_LOGIC_OR 0
848#define BTA_DM_BLE_PF_FILT_LOGIC_AND 1
Marie Janssene9e58ce2016-06-17 14:12:17 -0700849typedef uint16_t tBTA_DM_BLE_PF_FILT_LOGIC_TYPE;
Satya Calloji1a9247a2014-06-05 13:15:15 -0700850
Myles Watsoncd1fd072016-11-09 13:17:43 -0800851typedef uint8_t tBTA_DM_BLE_PF_RSSI_THRESHOLD;
852typedef uint8_t tBTA_DM_BLE_PF_DELIVERY_MODE;
Marie Janssene9e58ce2016-06-17 14:12:17 -0700853typedef uint16_t tBTA_DM_BLE_PF_TIMEOUT;
Myles Watsoncd1fd072016-11-09 13:17:43 -0800854typedef uint8_t tBTA_DM_BLE_PF_TIMEOUT_CNT;
Marie Janssene9e58ce2016-06-17 14:12:17 -0700855typedef uint16_t tBTA_DM_BLE_PF_ADV_TRACK_ENTRIES;
Satya Calloji1a9247a2014-06-05 13:15:15 -0700856
Myles Watsoncd1fd072016-11-09 13:17:43 -0800857typedef struct {
858 tBTA_DM_BLE_PF_FEAT_SEL feat_seln;
859 tBTA_DM_BLE_PF_LIST_LOGIC_TYPE list_logic_type;
860 tBTA_DM_BLE_PF_FILT_LOGIC_TYPE filt_logic_type;
861 tBTA_DM_BLE_PF_RSSI_THRESHOLD rssi_high_thres;
862 tBTA_DM_BLE_PF_RSSI_THRESHOLD rssi_low_thres;
863 tBTA_DM_BLE_PF_DELIVERY_MODE dely_mode;
864 tBTA_DM_BLE_PF_TIMEOUT found_timeout;
865 tBTA_DM_BLE_PF_TIMEOUT lost_timeout;
866 tBTA_DM_BLE_PF_TIMEOUT_CNT found_timeout_cnt;
867 tBTA_DM_BLE_PF_ADV_TRACK_ENTRIES num_of_tracking_entries;
Satya Calloji1a9247a2014-06-05 13:15:15 -0700868} tBTA_DM_BLE_PF_FILT_PARAMS;
869
The Android Open Source Project5738f832012-12-12 16:00:35 -0800870/* Search callback events */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800871#define BTA_DM_INQ_RES_EVT 0 /* Inquiry result for a peer device. */
872#define BTA_DM_INQ_CMPL_EVT 1 /* Inquiry complete. */
873#define BTA_DM_DISC_RES_EVT 2 /* Discovery result for a peer device. */
874#define BTA_DM_DISC_BLE_RES_EVT \
875 3 /* Discovery result for BLE GATT based servoce on a peer device. */
876#define BTA_DM_DISC_CMPL_EVT 4 /* Discovery complete. */
877#define BTA_DM_DI_DISC_CMPL_EVT 5 /* Discovery complete. */
878#define BTA_DM_SEARCH_CANCEL_CMPL_EVT 6 /* Search cancelled */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800879
Marie Janssene9e58ce2016-06-17 14:12:17 -0700880typedef uint8_t tBTA_DM_SEARCH_EVT;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800881
Myles Watsoncd1fd072016-11-09 13:17:43 -0800882#define BTA_DM_INQ_RES_IGNORE_RSSI \
883 BTM_INQ_RES_IGNORE_RSSI /* 0x7f RSSI value not supplied (ignore it) */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800884
885/* Structure associated with BTA_DM_INQ_RES_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800886typedef struct {
887 BD_ADDR bd_addr; /* BD address peer device. */
888 DEV_CLASS dev_class; /* Device class of peer device. */
889 bool remt_name_not_required; /* Application sets this flag if it already knows
890 the name of the device */
891 /* If the device name is known to application BTA skips the remote name
892 * request */
893 bool is_limited; /* true, if the limited inquiry bit is set in the CoD */
894 int8_t rssi; /* The rssi value */
895 uint8_t* p_eir; /* received EIR */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800896 uint8_t inq_result_type;
897 uint8_t ble_addr_type;
898 tBTM_BLE_EVT_TYPE ble_evt_type;
899 tBT_DEVICE_TYPE device_type;
900 uint8_t flag;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800901} tBTA_DM_INQ_RES;
902
903/* Structure associated with BTA_DM_INQ_CMPL_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800904typedef struct {
905 uint8_t num_resps; /* Number of inquiry responses. */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800906} tBTA_DM_INQ_CMPL;
907
908/* Structure associated with BTA_DM_DI_DISC_CMPL_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800909typedef struct {
910 BD_ADDR bd_addr; /* BD address peer device. */
911 uint8_t num_record; /* Number of DI record */
912 tBTA_STATUS result;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800913} tBTA_DM_DI_DISC_CMPL;
914
915/* Structure associated with BTA_DM_DISC_RES_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800916typedef struct {
917 BD_ADDR bd_addr; /* BD address peer device. */
918 BD_NAME bd_name; /* Name of peer device. */
919 tBTA_SERVICE_MASK services; /* Services found on peer device. */
920 uint8_t* p_raw_data; /* Raw data for discovery DB */
921 uint32_t raw_data_size; /* size of raw data */
922 tBT_DEVICE_TYPE device_type; /* device type in case it is BLE device */
923 uint32_t num_uuids;
924 uint8_t* p_uuid_list;
925 tBTA_STATUS result;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800926} tBTA_DM_DISC_RES;
927
928/* Structure associated with tBTA_DM_DISC_BLE_RES */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800929typedef struct {
930 BD_ADDR bd_addr; /* BD address peer device. */
931 BD_NAME bd_name; /* Name of peer device. */
932 tBT_UUID service; /* GATT based Services UUID found on peer device. */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800933} tBTA_DM_DISC_BLE_RES;
934
The Android Open Source Project5738f832012-12-12 16:00:35 -0800935/* Union of all search callback structures */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800936typedef union {
937 tBTA_DM_INQ_RES inq_res; /* Inquiry result for a peer device. */
938 tBTA_DM_INQ_CMPL inq_cmpl; /* Inquiry complete. */
939 tBTA_DM_DISC_RES disc_res; /* Discovery result for a peer device. */
940 tBTA_DM_DISC_BLE_RES
941 disc_ble_res; /* discovery result for GATT based service */
942 tBTA_DM_DI_DISC_CMPL di_disc; /* DI discovery result for a peer device */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800943
944} tBTA_DM_SEARCH;
945
946/* Search callback */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800947typedef void(tBTA_DM_SEARCH_CBACK)(tBTA_DM_SEARCH_EVT event,
948 tBTA_DM_SEARCH* p_data);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800949
950/* Execute call back */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800951typedef void(tBTA_DM_EXEC_CBACK)(void* p_param);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800952
953/* Encryption callback*/
Myles Watsoncd1fd072016-11-09 13:17:43 -0800954typedef void(tBTA_DM_ENCRYPT_CBACK)(BD_ADDR bd_addr, tBTA_TRANSPORT transport,
955 tBTA_STATUS result);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800956
Myles Watsoncd1fd072016-11-09 13:17:43 -0800957#define BTA_DM_BLE_SEC_NONE BTM_BLE_SEC_NONE
958#define BTA_DM_BLE_SEC_ENCRYPT BTM_BLE_SEC_ENCRYPT
959#define BTA_DM_BLE_SEC_NO_MITM BTM_BLE_SEC_ENCRYPT_NO_MITM
960#define BTA_DM_BLE_SEC_MITM BTM_BLE_SEC_ENCRYPT_MITM
961typedef tBTM_BLE_SEC_ACT tBTA_DM_BLE_SEC_ACT;
Satya Callojic4e25962014-05-10 23:46:24 -0700962
Myles Watsoncd1fd072016-11-09 13:17:43 -0800963typedef tBTM_BLE_TX_TIME_MS tBTA_DM_BLE_TX_TIME_MS;
964typedef tBTM_BLE_RX_TIME_MS tBTA_DM_BLE_RX_TIME_MS;
965typedef tBTM_BLE_IDLE_TIME_MS tBTA_DM_BLE_IDLE_TIME_MS;
966typedef tBTM_BLE_ENERGY_USED tBTA_DM_BLE_ENERGY_USED;
Satya Callojie5ba8842014-07-03 17:18:02 -0700967
Myles Watsoncd1fd072016-11-09 13:17:43 -0800968#define BTA_DM_CONTRL_UNKNOWN 0 /* Unknown state */
969#define BTA_DM_CONTRL_ACTIVE 1 /* ACL link on, SCO link ongoing, sniff mode */
970#define BTA_DM_CONTRL_SCAN \
971 2 /* Scan state - paging/inquiry/trying to \
972 connect*/
973#define BTA_DM_CONTRL_IDLE \
974 3 /* Idle state - page scan, LE advt, inquiry scan \
975 */
Satya Callojie5ba8842014-07-03 17:18:02 -0700976
Marie Janssene9e58ce2016-06-17 14:12:17 -0700977typedef uint8_t tBTA_DM_CONTRL_STATE;
Satya Callojie5ba8842014-07-03 17:18:02 -0700978
Marie Janssene9e58ce2016-06-17 14:12:17 -0700979typedef uint8_t tBTA_DM_BLE_ADV_STATE;
980typedef uint8_t tBTA_DM_BLE_ADV_INFO_PRESENT;
981typedef uint8_t tBTA_DM_BLE_RSSI_VALUE;
982typedef uint16_t tBTA_DM_BLE_ADV_INFO_TIMESTAMP;
Satya Callojif5387072015-02-09 17:40:52 -0800983
984typedef tBTM_BLE_TRACK_ADV_DATA tBTA_DM_BLE_TRACK_ADV_DATA;
Satya Callojie5ba8842014-07-03 17:18:02 -0700985
Myles Watsoncd1fd072016-11-09 13:17:43 -0800986typedef void(tBTA_BLE_SCAN_THRESHOLD_CBACK)(tBTA_DM_BLE_REF_VALUE ref_value);
Satya Callojie5ba8842014-07-03 17:18:02 -0700987
Myles Watsoncd1fd072016-11-09 13:17:43 -0800988typedef void(tBTA_BLE_SCAN_REP_CBACK)(tBTA_DM_BLE_REF_VALUE ref_value,
989 uint8_t report_format,
990 uint8_t num_records, uint16_t data_len,
991 uint8_t* p_rep_data, tBTA_STATUS status);
Satya Calloji1acb61c2014-06-14 23:16:18 -0700992
Myles Watsoncd1fd072016-11-09 13:17:43 -0800993typedef void(tBTA_BLE_SCAN_SETUP_CBACK)(tBTA_BLE_BATCH_SCAN_EVT evt,
994 tBTA_DM_BLE_REF_VALUE ref_value,
995 tBTA_STATUS status);
Satya Callojic4e25962014-05-10 23:46:24 -0700996
Myles Watsoncd1fd072016-11-09 13:17:43 -0800997typedef void(tBTA_BLE_TRACK_ADV_CMPL_CBACK)(
998 int action, tBTA_STATUS status, tBTA_DM_BLE_PF_AVBL_SPACE avbl_space,
999 tBTA_DM_BLE_REF_VALUE ref_value);
Satya Calloji1acb61c2014-06-14 23:16:18 -07001000
Myles Watsoncd1fd072016-11-09 13:17:43 -08001001typedef void(tBTA_BLE_TRACK_ADV_CBACK)(tBTA_DM_BLE_TRACK_ADV_DATA* p_adv_data);
Satya Calloji1acb61c2014-06-14 23:16:18 -07001002
Myles Watsoncd1fd072016-11-09 13:17:43 -08001003typedef void(tBTA_BLE_ENERGY_INFO_CBACK)(tBTA_DM_BLE_TX_TIME_MS tx_time,
1004 tBTA_DM_BLE_RX_TIME_MS rx_time,
1005 tBTA_DM_BLE_IDLE_TIME_MS idle_time,
1006 tBTA_DM_BLE_ENERGY_USED energy_used,
1007 tBTA_DM_CONTRL_STATE ctrl_state,
1008 tBTA_STATUS status);
Satya Callojie5ba8842014-07-03 17:18:02 -07001009
The Android Open Source Project5738f832012-12-12 16:00:35 -08001010/* Maximum service name length */
Myles Watsoncd1fd072016-11-09 13:17:43 -08001011#define BTA_SERVICE_NAME_LEN 35
1012#define BTA_SERVICE_DESP_LEN BTA_SERVICE_NAME_LEN
1013#define BTA_PROVIDER_NAME_LEN BTA_SERVICE_NAME_LEN
The Android Open Source Project5738f832012-12-12 16:00:35 -08001014
1015/* link policy masks */
Myles Watsoncd1fd072016-11-09 13:17:43 -08001016#define BTA_DM_LP_SWITCH HCI_ENABLE_MASTER_SLAVE_SWITCH
1017#define BTA_DM_LP_HOLD HCI_ENABLE_HOLD_MODE
1018#define BTA_DM_LP_SNIFF HCI_ENABLE_SNIFF_MODE
1019#define BTA_DM_LP_PARK HCI_ENABLE_PARK_MODE
Marie Janssene9e58ce2016-06-17 14:12:17 -07001020typedef uint16_t tBTA_DM_LP_MASK;
The Android Open Source Project5738f832012-12-12 16:00:35 -08001021
1022/* power mode actions */
Myles Watsoncd1fd072016-11-09 13:17:43 -08001023#define BTA_DM_PM_NO_ACTION 0x00 /* no change to the current pm setting */
1024#define BTA_DM_PM_PARK 0x10 /* prefers park mode */
1025#define BTA_DM_PM_SNIFF 0x20 /* prefers sniff mode */
1026#define BTA_DM_PM_SNIFF1 0x21 /* prefers sniff1 mode */
1027#define BTA_DM_PM_SNIFF2 0x22 /* prefers sniff2 mode */
1028#define BTA_DM_PM_SNIFF3 0x23 /* prefers sniff3 mode */
1029#define BTA_DM_PM_SNIFF4 0x24 /* prefers sniff4 mode */
1030#define BTA_DM_PM_SNIFF5 0x25 /* prefers sniff5 mode */
1031#define BTA_DM_PM_SNIFF6 0x26 /* prefers sniff6 mode */
1032#define BTA_DM_PM_SNIFF7 0x27 /* prefers sniff7 mode */
1033#define BTA_DM_PM_SNIFF_USER0 \
1034 0x28 /* prefers user-defined sniff0 mode (testtool only) */
1035#define BTA_DM_PM_SNIFF_USER1 \
1036 0x29 /* prefers user-defined sniff1 mode (testtool only) */
1037#define BTA_DM_PM_ACTIVE 0x40 /* prefers active mode */
1038#define BTA_DM_PM_RETRY 0x80 /* retry power mode based on current settings */
1039#define BTA_DM_PM_SUSPEND 0x04 /* prefers suspend mode */
1040#define BTA_DM_PM_NO_PREF \
1041 0x01 /* service has no prefernce on power mode setting. eg. connection to \
1042 service got closed */
The Android Open Source Project5738f832012-12-12 16:00:35 -08001043
Marie Janssene9e58ce2016-06-17 14:12:17 -07001044typedef uint8_t tBTA_DM_PM_ACTION;
The Android Open Source Project5738f832012-12-12 16:00:35 -08001045
1046/* index to bta_dm_ssr_spec */
Myles Watsoncd1fd072016-11-09 13:17:43 -08001047#define BTA_DM_PM_SSR0 0
1048#define BTA_DM_PM_SSR1 \
1049 1 /* BTA_DM_PM_SSR1 will be dedicated for \
1050 HH SSR setting entry, no other profile can use it */
1051#define BTA_DM_PM_SSR2 2
1052#define BTA_DM_PM_SSR3 3
1053#define BTA_DM_PM_SSR4 4
1054#define BTA_DM_PM_SSR5 5
1055#define BTA_DM_PM_SSR6 6
The Android Open Source Project5738f832012-12-12 16:00:35 -08001056
Myles Watsoncd1fd072016-11-09 13:17:43 -08001057#define BTA_DM_PM_NUM_EVTS 9
The Android Open Source Project5738f832012-12-12 16:00:35 -08001058
1059#ifndef BTA_DM_PM_PARK_IDX
Myles Watsoncd1fd072016-11-09 13:17:43 -08001060#define BTA_DM_PM_PARK_IDX \
1061 5 /* the actual index to bta_dm_pm_md[] for PARK mode */
The Android Open Source Project5738f832012-12-12 16:00:35 -08001062#endif
1063
Adam Hampson63399d92014-05-19 16:23:45 -07001064#ifndef BTA_DM_PM_SNIFF_A2DP_IDX
Myles Watsoncd1fd072016-11-09 13:17:43 -08001065#define BTA_DM_PM_SNIFF_A2DP_IDX BTA_DM_PM_SNIFF
Adam Hampson63399d92014-05-19 16:23:45 -07001066#endif
1067
1068#ifndef BTA_DM_PM_SNIFF_HD_IDLE_IDX
Myles Watsoncd1fd072016-11-09 13:17:43 -08001069#define BTA_DM_PM_SNIFF_HD_IDLE_IDX BTA_DM_PM_SNIFF2
Adam Hampson63399d92014-05-19 16:23:45 -07001070#endif
1071
1072#ifndef BTA_DM_PM_SNIFF_SCO_OPEN_IDX
Myles Watsoncd1fd072016-11-09 13:17:43 -08001073#define BTA_DM_PM_SNIFF_SCO_OPEN_IDX BTA_DM_PM_SNIFF3
Adam Hampson63399d92014-05-19 16:23:45 -07001074#endif
1075
1076#ifndef BTA_DM_PM_SNIFF_HD_ACTIVE_IDX
1077#define BTA_DM_PM_SNIFF_HD_ACTIVE_IDX BTA_DM_PM_SNIFF4
1078#endif
1079
1080#ifndef BTA_DM_PM_SNIFF_HH_OPEN_IDX
1081#define BTA_DM_PM_SNIFF_HH_OPEN_IDX BTA_DM_PM_SNIFF2
1082#endif
1083
1084#ifndef BTA_DM_PM_SNIFF_HH_ACTIVE_IDX
1085#define BTA_DM_PM_SNIFF_HH_ACTIVE_IDX BTA_DM_PM_SNIFF2
1086#endif
1087
1088#ifndef BTA_DM_PM_SNIFF_HH_IDLE_IDX
1089#define BTA_DM_PM_SNIFF_HH_IDLE_IDX BTA_DM_PM_SNIFF2
1090#endif
1091
Adam Hampson63399d92014-05-19 16:23:45 -07001092#ifndef BTA_DM_PM_HH_OPEN_DELAY
1093#define BTA_DM_PM_HH_OPEN_DELAY 30000
1094#endif
1095
1096#ifndef BTA_DM_PM_HH_ACTIVE_DELAY
1097#define BTA_DM_PM_HH_ACTIVE_DELAY 30000
1098#endif
1099
1100#ifndef BTA_DM_PM_HH_IDLE_DELAY
1101#define BTA_DM_PM_HH_IDLE_DELAY 30000
1102#endif
1103
1104/* The Sniff Parameters defined below must be ordered from highest
1105 * latency (biggest interval) to lowest latency. If there is a conflict
1106 * among the connected services the setting with the lowest latency will
1107 * be selected. If a device should override a sniff parameter then it
1108 * must insure that order is maintained.
1109 */
1110#ifndef BTA_DM_PM_SNIFF_MAX
Myles Watsoncd1fd072016-11-09 13:17:43 -08001111#define BTA_DM_PM_SNIFF_MAX 800
1112#define BTA_DM_PM_SNIFF_MIN 400
1113#define BTA_DM_PM_SNIFF_ATTEMPT 4
1114#define BTA_DM_PM_SNIFF_TIMEOUT 1
Adam Hampson63399d92014-05-19 16:23:45 -07001115#endif
1116
1117#ifndef BTA_DM_PM_SNIFF1_MAX
Myles Watsoncd1fd072016-11-09 13:17:43 -08001118#define BTA_DM_PM_SNIFF1_MAX 400
1119#define BTA_DM_PM_SNIFF1_MIN 200
Adam Hampson63399d92014-05-19 16:23:45 -07001120#define BTA_DM_PM_SNIFF1_ATTEMPT 4
1121#define BTA_DM_PM_SNIFF1_TIMEOUT 1
1122#endif
1123
1124#ifndef BTA_DM_PM_SNIFF2_MAX
Myles Watsoncd1fd072016-11-09 13:17:43 -08001125#define BTA_DM_PM_SNIFF2_MAX 180
1126#define BTA_DM_PM_SNIFF2_MIN 150
Adam Hampson63399d92014-05-19 16:23:45 -07001127#define BTA_DM_PM_SNIFF2_ATTEMPT 4
1128#define BTA_DM_PM_SNIFF2_TIMEOUT 1
1129#endif
1130
1131#ifndef BTA_DM_PM_SNIFF3_MAX
Myles Watsoncd1fd072016-11-09 13:17:43 -08001132#define BTA_DM_PM_SNIFF3_MAX 150
1133#define BTA_DM_PM_SNIFF3_MIN 50
Adam Hampson63399d92014-05-19 16:23:45 -07001134#define BTA_DM_PM_SNIFF3_ATTEMPT 4
1135#define BTA_DM_PM_SNIFF3_TIMEOUT 1
1136#endif
1137
1138#ifndef BTA_DM_PM_SNIFF4_MAX
Myles Watsoncd1fd072016-11-09 13:17:43 -08001139#define BTA_DM_PM_SNIFF4_MAX 54
1140#define BTA_DM_PM_SNIFF4_MIN 30
Adam Hampson63399d92014-05-19 16:23:45 -07001141#define BTA_DM_PM_SNIFF4_ATTEMPT 4
1142#define BTA_DM_PM_SNIFF4_TIMEOUT 1
1143#endif
1144
Pavlin Radoslavov1076b7b2015-07-22 22:49:26 -07001145#ifndef BTA_DM_PM_SNIFF5_MAX
Myles Watsoncd1fd072016-11-09 13:17:43 -08001146#define BTA_DM_PM_SNIFF5_MAX 36
1147#define BTA_DM_PM_SNIFF5_MIN 30
Pavlin Radoslavov1076b7b2015-07-22 22:49:26 -07001148#define BTA_DM_PM_SNIFF5_ATTEMPT 2
1149#define BTA_DM_PM_SNIFF5_TIMEOUT 0
1150#endif
1151
Adam Hampson63399d92014-05-19 16:23:45 -07001152#ifndef BTA_DM_PM_PARK_MAX
Myles Watsoncd1fd072016-11-09 13:17:43 -08001153#define BTA_DM_PM_PARK_MAX 800
1154#define BTA_DM_PM_PARK_MIN 400
1155#define BTA_DM_PM_PARK_ATTEMPT 0
1156#define BTA_DM_PM_PARK_TIMEOUT 0
Adam Hampson63399d92014-05-19 16:23:45 -07001157#endif
1158
The Android Open Source Project5738f832012-12-12 16:00:35 -08001159/* Switch callback events */
Myles Watsoncd1fd072016-11-09 13:17:43 -08001160#define BTA_DM_SWITCH_CMPL_EVT 0 /* Completion of the Switch API */
The Android Open Source Project5738f832012-12-12 16:00:35 -08001161
Marie Janssene9e58ce2016-06-17 14:12:17 -07001162typedef uint8_t tBTA_DM_SWITCH_EVT;
Myles Watsoncd1fd072016-11-09 13:17:43 -08001163typedef void(tBTA_DM_SWITCH_CBACK)(tBTA_DM_SWITCH_EVT event,
1164 tBTA_STATUS status);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001165
1166/* Audio routing out configuration */
Myles Watsoncd1fd072016-11-09 13:17:43 -08001167#define BTA_DM_ROUTE_NONE 0x00 /* No Audio output */
1168#define BTA_DM_ROUTE_DAC 0x01 /* routing over analog output */
1169#define BTA_DM_ROUTE_I2S 0x02 /* routing over digital (I2S) output */
1170#define BTA_DM_ROUTE_BT_MONO 0x04 /* routing over SCO */
1171#define BTA_DM_ROUTE_BT_STEREO 0x08 /* routing over BT Stereo */
1172#define BTA_DM_ROUTE_HOST 0x10 /* routing over Host */
1173#define BTA_DM_ROUTE_FMTX 0x20 /* routing over FMTX */
1174#define BTA_DM_ROUTE_FMRX 0x40 /* routing over FMRX */
1175#define BTA_DM_ROUTE_BTSNK 0x80 /* routing over BT SNK */
The Android Open Source Project5738f832012-12-12 16:00:35 -08001176
Marie Janssene9e58ce2016-06-17 14:12:17 -07001177typedef uint8_t tBTA_DM_ROUTE_PATH;
The Android Open Source Project5738f832012-12-12 16:00:35 -08001178
The Android Open Source Project5738f832012-12-12 16:00:35 -08001179/* Device Identification (DI) data structure
1180*/
1181/* Used to set the DI record */
Myles Watsoncd1fd072016-11-09 13:17:43 -08001182typedef tSDP_DI_RECORD tBTA_DI_RECORD;
The Android Open Source Project5738f832012-12-12 16:00:35 -08001183/* Used to get the DI record */
Myles Watsoncd1fd072016-11-09 13:17:43 -08001184typedef tSDP_DI_GET_RECORD tBTA_DI_GET_RECORD;
The Android Open Source Project5738f832012-12-12 16:00:35 -08001185/* SDP discovery database */
Myles Watsoncd1fd072016-11-09 13:17:43 -08001186typedef tSDP_DISCOVERY_DB tBTA_DISCOVERY_DB;
The Android Open Source Project5738f832012-12-12 16:00:35 -08001187
Myles Watsoncd1fd072016-11-09 13:17:43 -08001188#ifndef BTA_DI_NUM_MAX
1189#define BTA_DI_NUM_MAX 3
The Android Open Source Project5738f832012-12-12 16:00:35 -08001190#endif
1191
Andre Eisenbach3aa60542013-03-22 18:00:51 -07001192/* Device features mask definitions */
Myles Watsoncd1fd072016-11-09 13:17:43 -08001193#define BTA_FEATURE_BYTES_PER_PAGE BTM_FEATURE_BYTES_PER_PAGE
1194#define BTA_EXT_FEATURES_PAGE_MAX BTM_EXT_FEATURES_PAGE_MAX
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -07001195/* ACL type
1196*/
Myles Watsoncd1fd072016-11-09 13:17:43 -08001197#define BTA_DM_LINK_TYPE_BR_EDR 0x01
1198#define BTA_DM_LINK_TYPE_LE 0x02
1199#define BTA_DM_LINK_TYPE_ALL 0xFF
Marie Janssene9e58ce2016-06-17 14:12:17 -07001200typedef uint8_t tBTA_DM_LINK_TYPE;
Andre Eisenbach3aa60542013-03-22 18:00:51 -07001201
Myles Watsoncd1fd072016-11-09 13:17:43 -08001202#define IMMEDIATE_DELY_MODE 0x00
1203#define ONFOUND_DELY_MODE 0x01
1204#define BATCH_DELY_MODE 0x02
1205#define ALLOW_ALL_FILTER 0x00
1206#define LOWEST_RSSI_VALUE 129
Satya Calloji6e2d9db2014-07-08 16:18:58 -07001207
The Android Open Source Project5738f832012-12-12 16:00:35 -08001208/*****************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001209 * External Function Declarations
1210 ****************************************************************************/
The Android Open Source Project5738f832012-12-12 16:00:35 -08001211
1212/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001213 *
1214 * Function BTA_EnableBluetooth
1215 *
1216 * Description This function initializes BTA and prepares BTA and the
1217 * Bluetooth protocol stack for use. This function is
1218 * typically called at startup or when Bluetooth services
1219 * are required by the phone. This function must be called
1220 * before calling any other API function.
1221 *
1222 *
1223 * Returns BTA_SUCCESS if successful.
1224 * BTA_FAIL if internal failure.
1225 *
1226 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08001227extern tBTA_STATUS BTA_EnableBluetooth(tBTA_DM_SEC_CBACK* p_cback);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001228
1229/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001230 *
1231 * Function BTA_DisableBluetooth
1232 *
1233 * Description This function disables BTA and the Bluetooth protocol
1234 * stack. It is called when BTA is no longer being used
1235 * by any application in the system.
1236 *
1237 *
1238 * Returns void
1239 *
1240 ******************************************************************************/
June R. Tate-Gans24933b52014-09-24 15:25:02 -07001241extern tBTA_STATUS BTA_DisableBluetooth(void);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001242
1243/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001244 *
1245 * Function BTA_EnableTestMode
1246 *
1247 * Description Enables bluetooth device under test mode
1248 *
1249 *
1250 * Returns tBTA_STATUS
1251 *
1252 ******************************************************************************/
June R. Tate-Gans24933b52014-09-24 15:25:02 -07001253extern tBTA_STATUS BTA_EnableTestMode(void);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001254
1255/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001256 *
1257 * Function BTA_DisableTestMode
1258 *
1259 * Description Disable bluetooth device under test mode
1260 *
1261 *
1262 * Returns None
1263 *
1264 ******************************************************************************/
June R. Tate-Gans24933b52014-09-24 15:25:02 -07001265extern void BTA_DisableTestMode(void);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001266
1267/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001268 *
1269 * Function BTA_DmSetDeviceName
1270 *
1271 * Description This function sets the Bluetooth name of the local device.
1272 *
1273 *
1274 * Returns void
1275 *
1276 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08001277extern void BTA_DmSetDeviceName(char* p_name);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001278
1279/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001280 *
1281 * Function BTA_DmSetVisibility
1282 *
1283 * Description This function sets the Bluetooth connectable,discoverable,
Myles Watsoncd1fd072016-11-09 13:17:43 -08001284 * pairable and conn paired only modesmodes of the local
Myles Watson1baaae32016-11-09 14:25:23 -08001285 * device.
Myles Watsoncd1fd072016-11-09 13:17:43 -08001286 * This controls whether other Bluetooth devices can find and
Myles Watson1baaae32016-11-09 14:25:23 -08001287 * connect to the local device.
Myles Watson8af480e2016-11-09 10:40:23 -08001288 *
1289 *
1290 * Returns void
1291 *
1292 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08001293extern void BTA_DmSetVisibility(tBTA_DM_DISC disc_mode, tBTA_DM_CONN conn_mode,
1294 uint8_t pairable_mode, uint8_t conn_filter);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001295
1296/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001297 *
1298 * Function BTA_DmSearch
1299 *
1300 * Description This function searches for peer Bluetooth devices. It
1301 * first performs an inquiry; for each device found from the
1302 * inquiry it gets the remote name of the device. If
1303 * parameter services is nonzero, service discovery will be
1304 * performed on each device for the services specified.
1305 *
1306 *
1307 * Returns void
1308 *
1309 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08001310extern void BTA_DmSearch(tBTA_DM_INQ* p_dm_inq, tBTA_SERVICE_MASK services,
1311 tBTA_DM_SEARCH_CBACK* p_cback);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001312
1313/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001314 *
1315 * Function BTA_DmSearchCancel
1316 *
1317 * Description This function cancels a search that has been initiated
1318 * by calling BTA_DmSearch().
1319 *
1320 *
1321 * Returns void
1322 *
1323 ******************************************************************************/
June R. Tate-Gans24933b52014-09-24 15:25:02 -07001324extern void BTA_DmSearchCancel(void);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001325
1326/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001327 *
1328 * Function BTA_DmDiscover
1329 *
1330 * Description This function performs service discovery for the services
1331 * of a particular peer device.
1332 *
1333 *
1334 * Returns void
1335 *
1336 ******************************************************************************/
June R. Tate-Gans24933b52014-09-24 15:25:02 -07001337extern void BTA_DmDiscover(BD_ADDR bd_addr, tBTA_SERVICE_MASK services,
Myles Watsoncd1fd072016-11-09 13:17:43 -08001338 tBTA_DM_SEARCH_CBACK* p_cback, bool sdp_search);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001339
The Android Open Source Project5738f832012-12-12 16:00:35 -08001340/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001341 *
1342 * Function BTA_DmDiscoverUUID
1343 *
1344 * Description This function performs service discovery for the services
1345 * of a particular peer device.
1346 *
1347 *
1348 * Returns void
1349 *
1350 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08001351extern void BTA_DmDiscoverUUID(BD_ADDR bd_addr, tSDP_UUID* uuid,
1352 tBTA_DM_SEARCH_CBACK* p_cback, bool sdp_search);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001353
1354/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001355 *
1356 * Function BTA_DmGetCachedRemoteName
1357 *
1358 * Description Retieve cached remote name if available
1359 *
1360 * Returns BTA_SUCCESS if cached name was retrieved
1361 * BTA_FAILURE if cached name is not available
1362 *
1363 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08001364tBTA_STATUS BTA_DmGetCachedRemoteName(BD_ADDR remote_device,
1365 uint8_t** pp_cached_name);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001366
1367/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001368 *
1369 * Function BTA_DmBond
1370 *
1371 * Description This function initiates a bonding procedure with a peer
1372 * device. The bonding procedure enables authentication
1373 * and optionally encryption on the Bluetooth link.
1374 *
1375 *
1376 * Returns void
1377 *
1378 ******************************************************************************/
June R. Tate-Gans24933b52014-09-24 15:25:02 -07001379extern void BTA_DmBond(BD_ADDR bd_addr);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001380
1381/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001382 *
1383 * Function BTA_DmBondByTransport
1384 *
1385 * Description This function initiates a bonding procedure with a peer
Myles Watsoncd1fd072016-11-09 13:17:43 -08001386 * device by designated transport. The bonding procedure
Myles Watson1baaae32016-11-09 14:25:23 -08001387 * enables authentication and optionally encryption on the
1388 * Bluetooth link.
Myles Watson8af480e2016-11-09 10:40:23 -08001389 *
1390 *
1391 * Returns void
1392 *
1393 ******************************************************************************/
June R. Tate-Gans24933b52014-09-24 15:25:02 -07001394extern void BTA_DmBondByTransport(BD_ADDR bd_addr, tBTA_TRANSPORT transport);
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -07001395
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -07001396/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001397 *
1398 * Function BTA_DmBondCancel
1399 *
1400 * Description This function cancels a bonding procedure with a peer
1401 * device.
1402 *
1403 *
1404 * Returns void
1405 *
1406 ******************************************************************************/
June R. Tate-Gans24933b52014-09-24 15:25:02 -07001407extern void BTA_DmBondCancel(BD_ADDR bd_addr);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001408
1409/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001410 *
1411 * Function BTA_DmPinReply
1412 *
1413 * Description This function provides a PIN when one is requested by DM
1414 * during a bonding procedure. The application should call
1415 * this function after the security callback is called with
1416 * a BTA_DM_PIN_REQ_EVT.
1417 *
1418 *
1419 * Returns void
1420 *
1421 ******************************************************************************/
Marie Janssene9e58ce2016-06-17 14:12:17 -07001422extern void BTA_DmPinReply(BD_ADDR bd_addr, bool accept, uint8_t pin_len,
Myles Watsoncd1fd072016-11-09 13:17:43 -08001423 uint8_t* p_pin);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001424
The Android Open Source Project5738f832012-12-12 16:00:35 -08001425/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001426 *
1427 * Function BTA_DmLocalOob
1428 *
1429 * Description This function retrieves the OOB data from local controller.
1430 * The result is reported by bta_dm_co_loc_oob().
1431 *
1432 * Returns void
1433 *
1434 ******************************************************************************/
June R. Tate-Gans24933b52014-09-24 15:25:02 -07001435extern void BTA_DmLocalOob(void);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001436
1437/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001438 *
1439 * Function BTA_DmConfirm
1440 *
1441 * Description This function accepts or rejects the numerical value of the
1442 * Simple Pairing process on BTA_DM_SP_CFM_REQ_EVT
1443 *
1444 * Returns void
1445 *
1446 ******************************************************************************/
Marie Janssene9e58ce2016-06-17 14:12:17 -07001447extern void BTA_DmConfirm(BD_ADDR bd_addr, bool accept);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001448
1449/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001450 *
1451 * Function BTA_DmAddDevice
1452 *
1453 * Description This function adds a device to the security database list
1454 * of peer devices. This function would typically be called
1455 * at system startup to initialize the security database with
1456 * known peer devices. This is a direct execution function
1457 * that may lock task scheduling on some platforms.
1458 *
1459 * Returns void
1460 *
1461 ******************************************************************************/
June R. Tate-Gans24933b52014-09-24 15:25:02 -07001462extern void BTA_DmAddDevice(BD_ADDR bd_addr, DEV_CLASS dev_class,
1463 LINK_KEY link_key, tBTA_SERVICE_MASK trusted_mask,
Marie Janssene9e58ce2016-06-17 14:12:17 -07001464 bool is_trusted, uint8_t key_type,
1465 tBTA_IO_CAP io_cap, uint8_t pin_length);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001466
1467/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001468 *
1469 * Function BTA_DmRemoveDevice
1470 *
1471 * Description This function removes a device from the security database.
1472 * This is a direct execution function that may lock task
1473 * scheduling on some platforms.
1474 *
1475 *
1476 * Returns BTA_SUCCESS if successful.
1477 * BTA_FAIL if operation failed.
1478 *
1479 ******************************************************************************/
June R. Tate-Gans24933b52014-09-24 15:25:02 -07001480extern tBTA_STATUS BTA_DmRemoveDevice(BD_ADDR bd_addr);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001481
1482/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001483 *
1484 * Function BTA_GetEirService
1485 *
1486 * Description This function is called to get BTA service mask from EIR.
1487 *
1488 * Parameters p_eir - pointer of EIR significant part
1489 * p_services - return the BTA service mask
1490 *
1491 * Returns None
1492 *
1493 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08001494extern void BTA_GetEirService(uint8_t* p_eir, tBTA_SERVICE_MASK* p_services);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001495
Andre Eisenbach5c0b0522014-06-18 12:20:37 -07001496/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001497 *
1498 * Function BTA_DmGetConnectionState
1499 *
1500 * Description Returns whether the remote device is currently connected.
1501 *
1502 * Returns 0 if the device is NOT connected.
1503 *
1504 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08001505extern uint16_t BTA_DmGetConnectionState(const BD_ADDR bd_addr);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001506
1507/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001508 *
1509 * Function BTA_DmSetLocalDiRecord
1510 *
1511 * Description This function adds a DI record to the local SDP database.
1512 *
1513 * Returns BTA_SUCCESS if record set sucessfully, otherwise error code.
1514 *
1515 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08001516extern tBTA_STATUS BTA_DmSetLocalDiRecord(tBTA_DI_RECORD* p_device_info,
1517 uint32_t* p_handle);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001518
1519/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001520 *
1521 *
1522 * Function BTA_DmCloseACL
1523 *
Myles Watsoncd1fd072016-11-09 13:17:43 -08001524 * Description This function force to close an ACL connection and remove
1525 the
Myles Watson8af480e2016-11-09 10:40:23 -08001526 * device from the security database list of known devices.
1527 *
1528 * Parameters: bd_addr - Address of the peer device
1529 * remove_dev - remove device or not after link down
1530 * transport - which transport to close
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -07001531
Myles Watson8af480e2016-11-09 10:40:23 -08001532 *
1533 * Returns void.
1534 *
1535 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08001536extern void BTA_DmCloseACL(BD_ADDR bd_addr, bool remove_dev,
1537 tBTA_TRANSPORT transport);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001538
1539/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001540 *
1541 * Function bta_dmexecutecallback
1542 *
Myles Watsoncd1fd072016-11-09 13:17:43 -08001543 * Description This function will request BTA to execute a call back in the
Myles Watson1baaae32016-11-09 14:25:23 -08001544 * context of BTU task.
Myles Watson8af480e2016-11-09 10:40:23 -08001545 * This API was named in lower case because it is only intended
1546 * for the internal customers(like BTIF).
1547 *
1548 * Returns void
1549 *
1550 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08001551extern void bta_dmexecutecallback(tBTA_DM_EXEC_CBACK* p_callback,
1552 void* p_param);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001553
1554#if (BTM_SCO_HCI_INCLUDED == TRUE)
1555/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001556 *
1557 * Function BTA_DmPcmInitSamples
1558 *
1559 * Description initialize the down sample converter.
1560 *
1561 * src_sps: original samples per second (source audio data)
1562 * (ex. 44100, 48000)
1563 * bits: number of bits per pcm sample (16)
1564 * n_channels: number of channels (i.e. mono(1), stereo(2)...)
1565 *
1566 * Returns none
1567 *
1568 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08001569extern void BTA_DmPcmInitSamples(uint32_t src_sps, uint32_t bits,
1570 uint32_t n_channels);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001571
1572/**************************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001573 * Function BTA_DmPcmResample
1574 *
Myles Watsoncd1fd072016-11-09 13:17:43 -08001575 * Description Down sampling utility to convert higher sampling rate into
Myles Watson1baaae32016-11-09 14:25:23 -08001576 * 8K/16bits
Myles Watson8af480e2016-11-09 10:40:23 -08001577 * PCM samples.
1578 *
1579 * Parameters p_src: pointer to the buffer where the original sampling PCM
1580 * are stored.
1581 * in_bytes: Length of the input PCM sample buffer in byte.
Myles Watson1baaae32016-11-09 14:25:23 -08001582 * p_dst: pointer to the buffer which is to be used to store
1583 * the converted PCM samples.
Myles Watson8af480e2016-11-09 10:40:23 -08001584 *
1585 *
1586 * Returns int32_t: number of samples converted.
1587 *
1588 *************************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08001589extern int32_t BTA_DmPcmResample(void* p_src, uint32_t in_bytes, void* p_dst);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001590#endif
1591
The Android Open Source Project5738f832012-12-12 16:00:35 -08001592/* BLE related API functions */
1593/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001594 *
1595 * Function BTA_DmBleSecurityGrant
1596 *
1597 * Description Grant security request access.
1598 *
1599 * Parameters: bd_addr - BD address of the peer
1600 * res - security grant status.
1601 *
1602 * Returns void
1603 *
1604 ******************************************************************************/
June R. Tate-Gans24933b52014-09-24 15:25:02 -07001605extern void BTA_DmBleSecurityGrant(BD_ADDR bd_addr, tBTA_DM_BLE_SEC_GRANT res);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001606
The Android Open Source Project5738f832012-12-12 16:00:35 -08001607/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001608 *
1609 * Function BTA_DmBleSetBgConnType
1610 *
1611 * Description This function is called to set BLE connectable mode for a
1612 * peripheral device.
1613 *
Myles Watsoncd1fd072016-11-09 13:17:43 -08001614 * Parameters bg_conn_type: it can be auto connection, or selective
Myles Watson1baaae32016-11-09 14:25:23 -08001615 * connection.
Myles Watsoncd1fd072016-11-09 13:17:43 -08001616 * p_select_cback: callback function when selective connection
Myles Watson1baaae32016-11-09 14:25:23 -08001617 * procedure is being used.
Myles Watson8af480e2016-11-09 10:40:23 -08001618 *
1619 * Returns void
1620 *
1621 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08001622extern void BTA_DmBleSetBgConnType(tBTA_DM_BLE_CONN_TYPE bg_conn_type,
1623 tBTA_DM_BLE_SEL_CBACK* p_select_cback);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001624
1625/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001626 *
1627 * Function BTA_DmBlePasskeyReply
1628 *
1629 * Description Send BLE SMP passkey reply.
1630 *
1631 * Parameters: bd_addr - BD address of the peer
1632 * accept - passkey entry sucessful or declined.
1633 * passkey - passkey value, must be a 6 digit number,
1634 * can be lead by 0.
1635 *
1636 * Returns void
1637 *
1638 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08001639extern void BTA_DmBlePasskeyReply(BD_ADDR bd_addr, bool accept,
1640 uint32_t passkey);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001641
1642/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001643 *
1644 * Function BTA_DmBleConfirmReply
1645 *
1646 * Description Send BLE SMP SC user confirmation reply.
1647 *
1648 * Parameters: bd_addr - BD address of the peer
Myles Watsoncd1fd072016-11-09 13:17:43 -08001649 * accept - numbers to compare are the same or
Myles Watson1baaae32016-11-09 14:25:23 -08001650 * different.
Myles Watson8af480e2016-11-09 10:40:23 -08001651 *
1652 * Returns void
1653 *
1654 ******************************************************************************/
Marie Janssene9e58ce2016-06-17 14:12:17 -07001655extern void BTA_DmBleConfirmReply(BD_ADDR bd_addr, bool accept);
Satya Calloji444a8da2015-03-06 10:38:22 -08001656
1657/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001658 *
1659 * Function BTA_DmAddBleDevice
1660 *
1661 * Description Add a BLE device. This function will be normally called
1662 * during host startup to restore all required information
1663 * for a LE device stored in the NVRAM.
1664 *
1665 * Parameters: bd_addr - BD address of the peer
1666 * dev_type - Remote device's device type.
1667 * addr_type - LE device address type.
1668 *
1669 * Returns void
1670 *
1671 ******************************************************************************/
June R. Tate-Gans24933b52014-09-24 15:25:02 -07001672extern void BTA_DmAddBleDevice(BD_ADDR bd_addr, tBLE_ADDR_TYPE addr_type,
1673 tBT_DEVICE_TYPE dev_type);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001674
The Android Open Source Project5738f832012-12-12 16:00:35 -08001675/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001676 *
1677 * Function BTA_DmAddBleKey
1678 *
1679 * Description Add/modify LE device information. This function will be
1680 * normally called during host startup to restore all required
1681 * information stored in the NVRAM.
1682 *
1683 * Parameters: bd_addr - BD address of the peer
1684 * p_le_key - LE key values.
1685 * key_type - LE SMP key type.
1686 *
1687 * Returns void
1688 *
1689 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08001690extern void BTA_DmAddBleKey(BD_ADDR bd_addr, tBTA_LE_KEY_VALUE* p_le_key,
1691 tBTA_LE_KEY_TYPE key_type);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001692
1693/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001694 *
1695 * Function BTA_DmSetBlePrefConnParams
1696 *
1697 * Description This function is called to set the preferred connection
1698 * parameters when default connection parameter is not desired.
1699 *
1700 * Parameters: bd_addr - BD address of the peripheral
1701 * min_conn_int - minimum preferred connection interval
1702 * max_conn_int - maximum preferred connection interval
1703 * slave_latency - preferred slave latency
1704 * supervision_tout - preferred supervision timeout
1705 *
1706 *
1707 * Returns void
1708 *
1709 ******************************************************************************/
Jakub Pawlowski063ca022016-04-25 10:43:02 -07001710extern void BTA_DmSetBlePrefConnParams(const BD_ADDR bd_addr,
Myles Watsoncd1fd072016-11-09 13:17:43 -08001711 uint16_t min_conn_int,
1712 uint16_t max_conn_int,
1713 uint16_t slave_latency,
1714 uint16_t supervision_tout);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001715
1716/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001717 *
1718 * Function BTA_DmSetBleConnScanParams
1719 *
1720 * Description This function is called to set scan parameters used in
1721 * BLE connection request
1722 *
1723 * Parameters: scan_interval - scan interval
1724 * scan_window - scan window
1725 *
1726 * Returns void
1727 *
1728 ******************************************************************************/
Marie Janssene9e58ce2016-06-17 14:12:17 -07001729extern void BTA_DmSetBleConnScanParams(uint32_t scan_interval,
1730 uint32_t scan_window);
Satya Calloji5725fc62015-03-31 13:24:32 -07001731
1732/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001733 *
1734 * Function BTA_DmSetBleScanParams
1735 *
1736 * Description This function is called to set scan parameters
1737 *
1738 * Parameters: client_if - Client IF
1739 * scan_interval - scan interval
1740 * scan_window - scan window
1741 * scan_mode - scan mode
Myles Watsoncd1fd072016-11-09 13:17:43 -08001742 * scan_param_setup_status_cback - Set scan param status
Myles Watson1baaae32016-11-09 14:25:23 -08001743 * callback
Myles Watson8af480e2016-11-09 10:40:23 -08001744 *
1745 * Returns void
1746 *
1747 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08001748extern void BTA_DmSetBleScanParams(
1749 tGATT_IF client_if, uint32_t scan_interval, uint32_t scan_window,
1750 tBLE_SCAN_MODE scan_mode,
1751 tBLE_SCAN_PARAM_SETUP_CBACK scan_param_setup_status_cback);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001752
1753/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001754 *
1755 * Function BTA_DmSetBleAdvParams
1756 *
Myles Watsoncd1fd072016-11-09 13:17:43 -08001757 * Description This function sets the advertising parameters BLE
Myles Watson1baaae32016-11-09 14:25:23 -08001758 * functionality.
Myles Watsoncd1fd072016-11-09 13:17:43 -08001759 * It is to be called when device act in peripheral or
Myles Watson1baaae32016-11-09 14:25:23 -08001760 * broadcaster role.
Myles Watson8af480e2016-11-09 10:40:23 -08001761 *
1762 * Parameters: adv_int_min - adv interval minimum
1763 * adv_int_max - adv interval max
1764 * p_dir_bda - directed adv initator address
1765 *
1766 * Returns void
1767 *
1768 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08001769extern void BTA_DmSetBleAdvParams(uint16_t adv_int_min, uint16_t adv_int_max,
1770 tBLE_BD_ADDR* p_dir_bda);
Andre Eisenbach5c44e452013-08-06 18:19:37 -07001771/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001772 *
1773 * Function BTA_DmSearchExt
1774 *
Myles Watsoncd1fd072016-11-09 13:17:43 -08001775 * Description This function searches for peer Bluetooth devices. It
Myles Watson1baaae32016-11-09 14:25:23 -08001776 * performs an inquiry and gets the remote name for devices.
1777 * Service discovery is done if services is non zero
Myles Watson8af480e2016-11-09 10:40:23 -08001778 *
1779 * Parameters p_dm_inq: inquiry conditions
Myles Watsoncd1fd072016-11-09 13:17:43 -08001780 * services: if service is not empty, service discovery will be
Myles Watson1baaae32016-11-09 14:25:23 -08001781 * done.
Myles Watsoncd1fd072016-11-09 13:17:43 -08001782 * for all GATT based service condition, put
Myles Watson1baaae32016-11-09 14:25:23 -08001783 * num_uuid, and p_uuid is the pointer to the list of
1784 * UUID values.
Myles Watson8af480e2016-11-09 10:40:23 -08001785 * p_cback: callback functino when search is completed.
1786 *
1787 *
1788 *
1789 * Returns void
1790 *
1791 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08001792extern void BTA_DmSearchExt(tBTA_DM_INQ* p_dm_inq,
1793 tBTA_SERVICE_MASK_EXT* p_services,
1794 tBTA_DM_SEARCH_CBACK* p_cback);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001795
1796/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001797 *
1798 * Function BTA_DmDiscoverExt
1799 *
1800 * Description This function does service discovery for services of a
1801 * peer device. When services.num_uuid is 0, it indicates all
1802 * GATT based services are to be searched; other wise a list of
1803 * UUID of interested services should be provided through
1804 * services.p_uuid.
1805 *
1806 *
1807 *
1808 * Returns void
1809 *
1810 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08001811extern void BTA_DmDiscoverExt(BD_ADDR bd_addr,
1812 tBTA_SERVICE_MASK_EXT* p_services,
1813 tBTA_DM_SEARCH_CBACK* p_cback, bool sdp_search);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001814
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -07001815/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001816 *
1817 * Function BTA_DmDiscoverByTransport
1818 *
1819 * Description This function does service discovery on particular transport
1820 * for services of a
1821 * peer device. When services.num_uuid is 0, it indicates all
1822 * GATT based services are to be searched; other wise a list of
1823 * UUID of interested services should be provided through
1824 * p_services->p_uuid.
1825 *
1826 *
1827 *
1828 * Returns void
1829 *
1830 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08001831extern void BTA_DmDiscoverByTransport(BD_ADDR bd_addr,
1832 tBTA_SERVICE_MASK_EXT* p_services,
1833 tBTA_DM_SEARCH_CBACK* p_cback,
1834 bool sdp_search,
June R. Tate-Gans24933b52014-09-24 15:25:02 -07001835 tBTA_TRANSPORT transport);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001836
1837/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001838 *
1839 * Function BTA_DmSetEncryption
1840 *
1841 * Description This function is called to ensure that connection is
1842 * encrypted. Should be called only on an open connection.
1843 * Typically only needed for connections that first want to
1844 * bring up unencrypted links, then later encrypt them.
1845 *
1846 * Parameters: bd_addr - Address of the peer device
1847 * transport - transport of the link to be encruypted
1848 * p_callback - Pointer to callback function to indicat the
1849 * link encryption status
1850 * sec_act - This is the security action to indicate
Myles Watson1baaae32016-11-09 14:25:23 -08001851 * what kind of BLE security level is required
1852 * for the BLE link if BLE is supported
1853 * Note: This parameter is ignored for
1854 * BR/EDR or if BLE is not supported.
Myles Watson8af480e2016-11-09 10:40:23 -08001855 *
1856 * Returns void
1857 *
1858 *
1859 ******************************************************************************/
June R. Tate-Gans24933b52014-09-24 15:25:02 -07001860extern void BTA_DmSetEncryption(BD_ADDR bd_addr, tBTA_TRANSPORT transport,
Myles Watsoncd1fd072016-11-09 13:17:43 -08001861 tBTA_DM_ENCRYPT_CBACK* p_callback,
June R. Tate-Gans24933b52014-09-24 15:25:02 -07001862 tBTA_DM_BLE_SEC_ACT sec_act);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001863
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -08001864/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001865 *
1866 * Function BTA_DmBleObserve
1867 *
1868 * Description This procedure keep the device listening for advertising
1869 * events from a broadcast device.
1870 *
1871 * Parameters start: start or stop observe.
Myles Watsoncd1fd072016-11-09 13:17:43 -08001872 * duration : Duration of the scan. Continuous scan if 0 is
Myles Watson1baaae32016-11-09 14:25:23 -08001873 * passed
Myles Watson8af480e2016-11-09 10:40:23 -08001874 * p_results_cb: Callback to be called with scan results
1875 *
1876 * Returns void
1877 *
1878 ******************************************************************************/
Marie Janssene9e58ce2016-06-17 14:12:17 -07001879extern void BTA_DmBleObserve(bool start, uint8_t duration,
Myles Watsoncd1fd072016-11-09 13:17:43 -08001880 tBTA_DM_SEARCH_CBACK* p_results_cb);
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -08001881
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -08001882/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001883 *
1884 * Function BTA_DmBleConfigLocalPrivacy
1885 *
1886 * Description Enable/disable privacy on the local device
1887 *
1888 * Parameters: privacy_enable - enable/disabe privacy on remote device.
1889 *
1890 * Returns void
1891 *
1892 ******************************************************************************/
Marie Janssene9e58ce2016-06-17 14:12:17 -07001893extern void BTA_DmBleConfigLocalPrivacy(bool privacy_enable);
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -08001894
1895/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001896 *
1897 * Function BTA_DmBleEnableRemotePrivacy
1898 *
1899 * Description Enable/disable privacy on a remote device
1900 *
1901 * Parameters: bd_addr - BD address of the peer
1902 * privacy_enable - enable/disabe privacy on remote device.
1903 *
1904 * Returns void
1905 *
1906 ******************************************************************************/
Marie Janssene9e58ce2016-06-17 14:12:17 -07001907extern void BTA_DmBleEnableRemotePrivacy(BD_ADDR bd_addr, bool privacy_enable);
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -08001908
Jakub Pawlowski6a966612016-08-16 03:25:45 -07001909/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001910 *
1911 * Function BTA_DmBleUpdateConnectionParams
1912 *
Myles Watsoncd1fd072016-11-09 13:17:43 -08001913 * Description Update connection parameters, can only be used when
Myles Watson1baaae32016-11-09 14:25:23 -08001914 * connection is up.
Myles Watson8af480e2016-11-09 10:40:23 -08001915 *
1916 * Parameters: bd_addr - BD address of the peer
Myles Watson1baaae32016-11-09 14:25:23 -08001917 * min_int - minimum connection interval, [0x0004 ~ 0x4000]
1918 * max_int - maximum connection interval, [0x0004 ~ 0x4000]
1919 * latency - slave latency [0 ~ 500]
1920 * timeout - supervision timeout [0x000a ~ 0xc80]
Myles Watson8af480e2016-11-09 10:40:23 -08001921 *
1922 * Returns void
1923 *
1924 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08001925extern void BTA_DmBleUpdateConnectionParams(const BD_ADDR bd_addr,
1926 uint16_t min_int, uint16_t max_int,
1927 uint16_t latency, uint16_t timeout);
Satya Callojic4e25962014-05-10 23:46:24 -07001928
1929/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001930 *
1931 * Function BTA_DmBleSetDataLength
1932 *
1933 * Description This function is to set maximum LE data packet size
1934 *
1935 * Returns void
1936 *
1937 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08001938extern void BTA_DmBleSetDataLength(BD_ADDR remote_device,
1939 uint16_t tx_data_length);
Priti Aghera636d6712014-12-18 13:55:48 -08001940
1941/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001942 *
1943 * Function BTA_DmBleSetStorageParams
1944 *
1945 * Description This function is called to set the storage parameters
1946 *
Myles Watsoncd1fd072016-11-09 13:17:43 -08001947 * Parameters batch_scan_full_max -Max storage space (in %) allocated to
Myles Watson1baaae32016-11-09 14:25:23 -08001948 * full scanning
Myles Watsoncd1fd072016-11-09 13:17:43 -08001949 * batch_scan_trunc_max -Max storage space (in %) allocated to
Myles Watson1baaae32016-11-09 14:25:23 -08001950 * truncated scanning
Myles Watsoncd1fd072016-11-09 13:17:43 -08001951 * batch_scan_notify_threshold - Setup notification level based
Myles Watson1baaae32016-11-09 14:25:23 -08001952 * on total space consumed by
1953 * both pools. Setting it to 0
1954 * will disable threshold
1955 * notification
Myles Watson8af480e2016-11-09 10:40:23 -08001956 * p_setup_cback - Setup callback
1957 * p_thres_cback - Threshold callback
1958 * p_rep_cback - Reports callback
1959 * ref_value - Reference value
1960 *
1961 * Returns None
1962 *
1963 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08001964extern void BTA_DmBleSetStorageParams(
1965 uint8_t batch_scan_full_max, uint8_t batch_scan_trunc_max,
1966 uint8_t batch_scan_notify_threshold,
1967 tBTA_BLE_SCAN_SETUP_CBACK* p_setup_cback,
1968 tBTA_BLE_SCAN_THRESHOLD_CBACK* p_thres_cback,
1969 tBTA_BLE_SCAN_REP_CBACK* p_rep_cback, tBTA_DM_BLE_REF_VALUE ref_value);
Satya Callojic4e25962014-05-10 23:46:24 -07001970
1971/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001972 *
1973 * Function BTA_DmBleEnableBatchScan
1974 *
1975 * Description This function is called to enable the batch scan
1976 *
1977 * Parameters scan_mode -Batch scan mode
1978 * scan_interval - Scan interval
1979 * scan_window - Scan window
1980 * discard_rule -Discard rules
1981 * addr_type - Address type
1982 * ref_value - Reference value
1983 *
1984 * Returns None
1985 *
1986 ******************************************************************************/
Satya Calloji5725fc62015-03-31 13:24:32 -07001987extern void BTA_DmBleEnableBatchScan(tBTA_BLE_BATCH_SCAN_MODE scan_mode,
Myles Watsoncd1fd072016-11-09 13:17:43 -08001988 uint32_t scan_interval,
1989 uint32_t scan_window,
1990 tBTA_BLE_DISCARD_RULE discard_rule,
1991 tBLE_ADDR_TYPE addr_type,
1992 tBTA_DM_BLE_REF_VALUE ref_value);
Satya Callojic4e25962014-05-10 23:46:24 -07001993
1994/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001995 *
1996 * Function BTA_DmBleReadScanReports
1997 *
1998 * Description This function is called to read the batch scan reports
1999 *
2000 * Parameters scan_mode -Batch scan mode
2001 * ref_value - Reference value
2002 *
2003 * Returns None
2004 *
2005 ******************************************************************************/
Satya Calloji5725fc62015-03-31 13:24:32 -07002006extern void BTA_DmBleReadScanReports(tBTA_BLE_BATCH_SCAN_MODE scan_type,
Myles Watsoncd1fd072016-11-09 13:17:43 -08002007 tBTA_DM_BLE_REF_VALUE ref_value);
Satya Callojic4e25962014-05-10 23:46:24 -07002008
2009/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08002010 *
2011 * Function BTA_DmBleDisableBatchScan
2012 *
2013 * Description This function is called to disable the batch scanning
2014 *
2015 * Parameters ref_value - Reference value
2016 *
2017 * Returns None
2018 *
2019 ******************************************************************************/
June R. Tate-Gans24933b52014-09-24 15:25:02 -07002020extern void BTA_DmBleDisableBatchScan(tBTA_DM_BLE_REF_VALUE ref_value);
Satya Callojic4e25962014-05-10 23:46:24 -07002021
Satya Calloji1a9247a2014-06-05 13:15:15 -07002022/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08002023 *
2024 * Function BTA_DmEnableScanFilter
2025 *
Myles Watsoncd1fd072016-11-09 13:17:43 -08002026 * Description This function is called to enable the adv data payload
Myles Watson1baaae32016-11-09 14:25:23 -08002027 * filter
Myles Watson8af480e2016-11-09 10:40:23 -08002028 *
2029 * Parameters action - enable or disable the APCF feature
2030 * p_cmpl_cback - Command completed callback
2031 * ref_value - Reference value
2032 *
2033 * Returns void
2034 *
2035 ******************************************************************************/
Marie Janssene9e58ce2016-06-17 14:12:17 -07002036extern void BTA_DmEnableScanFilter(uint8_t action,
Myles Watsoncd1fd072016-11-09 13:17:43 -08002037 tBTA_DM_BLE_PF_STATUS_CBACK* p_cmpl_cback,
2038 tBTA_DM_BLE_REF_VALUE ref_value);
Satya Calloji1a9247a2014-06-05 13:15:15 -07002039
2040/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08002041 *
2042 * Function BTA_DmBleScanFilterSetup
2043 *
2044 * Description This function is called to setup the filter params
2045 *
Myles Watsoncd1fd072016-11-09 13:17:43 -08002046 * Parameters p_target: enable the filter condition on a target device; if
Myles Watson1baaae32016-11-09 14:25:23 -08002047 * NULL
Myles Watson8af480e2016-11-09 10:40:23 -08002048 * filt_index - Filter index
2049 * p_filt_params -Filter parameters
2050 * ref_value - Reference value
2051 * action - Add, delete or clear
2052 * p_cmpl_back - Command completed callback
2053 *
2054 * Returns void
2055 *
2056 ******************************************************************************/
Marie Janssene9e58ce2016-06-17 14:12:17 -07002057extern void BTA_DmBleScanFilterSetup(uint8_t action,
Myles Watsoncd1fd072016-11-09 13:17:43 -08002058 tBTA_DM_BLE_PF_FILT_INDEX filt_index,
2059 tBTA_DM_BLE_PF_FILT_PARAMS* p_filt_params,
2060 tBLE_BD_ADDR* p_target,
2061 tBTA_DM_BLE_PF_PARAM_CBACK* p_cmpl_cback,
2062 tBTA_DM_BLE_REF_VALUE ref_value);
Satya Calloji1a9247a2014-06-05 13:15:15 -07002063
2064/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08002065 *
2066 * Function BTA_DmBleCfgFilterCondition
2067 *
Myles Watsoncd1fd072016-11-09 13:17:43 -08002068 * Description This function is called to configure the adv data payload
Myles Watson1baaae32016-11-09 14:25:23 -08002069 * filter condition.
Myles Watson8af480e2016-11-09 10:40:23 -08002070 *
2071 * Parameters action: to read/write/clear
2072 * cond_type: filter condition type
2073 * filt_index - Filter index
2074 * p_cond: filter condition parameter
2075 * p_cmpl_back - Command completed callback
2076 * ref_value - Reference value
2077 *
2078 * Returns void
2079 *
2080 ******************************************************************************/
June R. Tate-Gans24933b52014-09-24 15:25:02 -07002081extern void BTA_DmBleCfgFilterCondition(tBTA_DM_BLE_SCAN_COND_OP action,
Myles Watsoncd1fd072016-11-09 13:17:43 -08002082 tBTA_DM_BLE_PF_COND_TYPE cond_type,
2083 tBTA_DM_BLE_PF_FILT_INDEX filt_index,
2084 tBTA_DM_BLE_PF_COND_PARAM* p_cond,
2085 tBTA_DM_BLE_PF_CFG_CBACK* p_cmpl_cback,
2086 tBTA_DM_BLE_REF_VALUE ref_value);
Satya Calloji1acb61c2014-06-14 23:16:18 -07002087
2088/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08002089 *
2090 * Function BTA_DmBleTrackAdvertiser
2091 *
2092 * Description This function is called to track the advertiser
2093 *
2094 * Parameters ref_value - Reference value
2095 * p_track_adv_cback - ADV callback
2096 *
2097 * Returns None
2098 *
2099 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08002100extern void BTA_DmBleTrackAdvertiser(
2101 tBTA_DM_BLE_REF_VALUE ref_value,
2102 tBTA_BLE_TRACK_ADV_CBACK* p_track_adv_cback);
Satya Calloji1acb61c2014-06-14 23:16:18 -07002103
Satya Callojie5ba8842014-07-03 17:18:02 -07002104/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08002105 *
2106 * Function BTA_DmBleGetEnergyInfo
2107 *
2108 * Description This function is called to obtain the energy info
2109 *
2110 * Parameters p_cmpl_cback - Command complete callback
2111 *
2112 * Returns void
2113 *
2114 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08002115extern void BTA_DmBleGetEnergyInfo(tBTA_BLE_ENERGY_INFO_CBACK* p_cmpl_cback);
Satya Callojie5ba8842014-07-03 17:18:02 -07002116
Prerepa Viswanadham16fe0822014-08-07 11:38:06 -07002117/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08002118 *
2119 * Function BTA_BrcmInit
2120 *
Myles Watsoncd1fd072016-11-09 13:17:43 -08002121 * Description This function initializes Broadcom specific VS handler in
Myles Watson1baaae32016-11-09 14:25:23 -08002122 * BTA
Myles Watson8af480e2016-11-09 10:40:23 -08002123 *
2124 * Returns void
2125 *
2126 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08002127extern void BTA_VendorInit(void);
Prerepa Viswanadham16fe0822014-08-07 11:38:06 -07002128
2129/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08002130 *
2131 * Function BTA_BrcmCleanup
2132 *
Myles Watsoncd1fd072016-11-09 13:17:43 -08002133 * Description This function frees up Broadcom specific VS specific dynamic
Myles Watson1baaae32016-11-09 14:25:23 -08002134 * memory
Myles Watson8af480e2016-11-09 10:40:23 -08002135 *
2136 * Returns void
2137 *
2138 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08002139extern void BTA_VendorCleanup(void);
Prerepa Viswanadham16fe0822014-08-07 11:38:06 -07002140
The Android Open Source Project5738f832012-12-12 16:00:35 -08002141#ifdef __cplusplus
2142}
2143#endif
2144
2145#endif /* BTA_API_H */