blob: 9f2ee283578527bb8696adc67d1b93744ee30f36 [file] [log] [blame]
The Android Open Source Project5738f832012-12-12 16:00:35 -08001/******************************************************************************
2 *
Jakub Pawlowski5b790fe2017-09-18 09:00:20 -07003 * Copyright 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
Jakub Pawlowski70984322016-12-16 10:43:49 -080028#include <hardware/bt_common_types.h>
29#include <memory>
The Android Open Source Project5738f832012-12-12 16:00:35 -080030#include "bt_target.h"
31#include "bt_types.h"
32#include "btm_api.h"
The Android Open Source Project5738f832012-12-12 16:00:35 -080033#include "btm_ble_api.h"
The Android Open Source Project5738f832012-12-12 16:00:35 -080034
35/*****************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -080036 * Constants and data types
37 ****************************************************************************/
The Android Open Source Project5738f832012-12-12 16:00:35 -080038
39/* Status Return Value */
Myles Watsoncd1fd072016-11-09 13:17:43 -080040#define BTA_SUCCESS 0 /* Successful operation. */
41#define BTA_FAILURE 1 /* Generic failure. */
42#define BTA_PENDING 2 /* API cannot be completed right now */
43#define BTA_BUSY 3
44#define BTA_NO_RESOURCES 4
45#define BTA_WRONG_MODE 5
The Android Open Source Project5738f832012-12-12 16:00:35 -080046
Marie Janssene9e58ce2016-06-17 14:12:17 -070047typedef uint8_t tBTA_STATUS;
The Android Open Source Project5738f832012-12-12 16:00:35 -080048
49/*
50 * Service ID
51 *
Myles Watsoncd1fd072016-11-09 13:17:43 -080052 * NOTES: When you add a new Service ID for BTA AND require to change the value
53 * of BTA_MAX_SERVICE_ID,
54 * make sure that the correct security ID of the new service from
55 * Security service definitions (btm_api.h)
56 * should be added to bta_service_id_to_btm_srv_id_lkup_tbl table in
57 * bta_dm_act.c.
The Android Open Source Project5738f832012-12-12 16:00:35 -080058 */
59
Myles Watsoncd1fd072016-11-09 13:17:43 -080060#define BTA_RES_SERVICE_ID 0 /* Reserved */
61#define BTA_SPP_SERVICE_ID 1 /* Serial port profile. */
62#define BTA_DUN_SERVICE_ID 2 /* Dial-up networking profile. */
63#define BTA_A2DP_SOURCE_SERVICE_ID 3 /* A2DP Source profile. */
64#define BTA_LAP_SERVICE_ID 4 /* LAN access profile. */
65#define BTA_HSP_SERVICE_ID 5 /* Headset profile. */
66#define BTA_HFP_SERVICE_ID 6 /* Hands-free profile. */
67#define BTA_OPP_SERVICE_ID 7 /* Object push */
68#define BTA_FTP_SERVICE_ID 8 /* File transfer */
69#define BTA_CTP_SERVICE_ID 9 /* Cordless Terminal */
70#define BTA_ICP_SERVICE_ID 10 /* Intercom Terminal */
71#define BTA_SYNC_SERVICE_ID 11 /* Synchronization */
72#define BTA_BPP_SERVICE_ID 12 /* Basic printing profile */
73#define BTA_BIP_SERVICE_ID 13 /* Basic Imaging profile */
74#define BTA_PANU_SERVICE_ID 14 /* PAN User */
75#define BTA_NAP_SERVICE_ID 15 /* PAN Network access point */
76#define BTA_GN_SERVICE_ID 16 /* PAN Group Ad-hoc networks */
77#define BTA_SAP_SERVICE_ID 17 /* SIM Access profile */
78#define BTA_A2DP_SINK_SERVICE_ID 18 /* A2DP Sink */
79#define BTA_AVRCP_SERVICE_ID 19 /* A/V remote control */
80#define BTA_HID_SERVICE_ID 20 /* HID */
81#define BTA_VDP_SERVICE_ID 21 /* Video distribution */
82#define BTA_PBAP_SERVICE_ID 22 /* PhoneBook Access Server*/
83#define BTA_HSP_HS_SERVICE_ID 23 /* HFP HS role */
84#define BTA_HFP_HS_SERVICE_ID 24 /* HSP HS role */
85#define BTA_MAP_SERVICE_ID 25 /* Message Access Profile */
86#define BTA_MN_SERVICE_ID 26 /* Message Notification Service */
87#define BTA_HDP_SERVICE_ID 27 /* Health Device Profile */
Hemant Gupta8843cc82014-04-18 12:34:55 +053088#define BTA_PCE_SERVICE_ID 28 /* PhoneBook Access Client */
89#define BTA_SDP_SERVICE_ID 29 /* SDP Search */
90#define BTA_HIDD_SERVICE_ID 30 /* HID Device */
Myles Watson99791212016-11-18 08:42:23 -080091
The Android Open Source Project5738f832012-12-12 16:00:35 -080092/* BLE profile service ID */
Hemant Gupta8843cc82014-04-18 12:34:55 +053093#define BTA_BLE_SERVICE_ID 31 /* GATT profile */
94#define BTA_USER_SERVICE_ID 32 /* User requested UUID */
95#define BTA_MAX_SERVICE_ID 33
Myles Watson99791212016-11-18 08:42:23 -080096
The Android Open Source Project5738f832012-12-12 16:00:35 -080097/* service IDs (BTM_SEC_SERVICE_FIRST_EMPTY + 1) to (BTM_SEC_MAX_SERVICES - 1)
98 * are used by BTA JV */
Myles Watsoncd1fd072016-11-09 13:17:43 -080099#define BTA_FIRST_JV_SERVICE_ID (BTM_SEC_SERVICE_FIRST_EMPTY + 1)
100#define BTA_LAST_JV_SERVICE_ID (BTM_SEC_MAX_SERVICES - 1)
The Android Open Source Project5738f832012-12-12 16:00:35 -0800101
Marie Janssene9e58ce2016-06-17 14:12:17 -0700102typedef uint8_t tBTA_SERVICE_ID;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800103
104/* Service ID Mask */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800105#define BTA_RES_SERVICE_MASK 0x00000001 /* Reserved */
106#define BTA_SPP_SERVICE_MASK 0x00000002 /* Serial port profile. */
107#define BTA_DUN_SERVICE_MASK 0x00000004 /* Dial-up networking profile. */
108#define BTA_FAX_SERVICE_MASK 0x00000008 /* Fax profile. */
109#define BTA_LAP_SERVICE_MASK 0x00000010 /* LAN access profile. */
110#define BTA_HSP_SERVICE_MASK 0x00000020 /* HSP AG role. */
111#define BTA_HFP_SERVICE_MASK 0x00000040 /* HFP AG role */
112#define BTA_OPP_SERVICE_MASK 0x00000080 /* Object push */
113#define BTA_FTP_SERVICE_MASK 0x00000100 /* File transfer */
114#define BTA_CTP_SERVICE_MASK 0x00000200 /* Cordless Terminal */
115#define BTA_ICP_SERVICE_MASK 0x00000400 /* Intercom Terminal */
116#define BTA_SYNC_SERVICE_MASK 0x00000800 /* Synchronization */
117#define BTA_BPP_SERVICE_MASK 0x00001000 /* Print server */
118#define BTA_BIP_SERVICE_MASK 0x00002000 /* Basic Imaging */
119#define BTA_PANU_SERVICE_MASK 0x00004000 /* PAN User */
120#define BTA_NAP_SERVICE_MASK 0x00008000 /* PAN Network access point */
121#define BTA_GN_SERVICE_MASK 0x00010000 /* PAN Group Ad-hoc networks */
122#define BTA_SAP_SERVICE_MASK 0x00020000 /* PAN Group Ad-hoc networks */
123#define BTA_A2DP_SERVICE_MASK 0x00040000 /* Advanced audio distribution */
124#define BTA_AVRCP_SERVICE_MASK 0x00080000 /* A/V remote control */
125#define BTA_HID_SERVICE_MASK 0x00100000 /* HID */
126#define BTA_VDP_SERVICE_MASK 0x00200000 /* Video distribution */
127#define BTA_PBAP_SERVICE_MASK 0x00400000 /* Phone Book Server */
128#define BTA_HSP_HS_SERVICE_MASK 0x00800000 /* HFP HS role */
129#define BTA_HFP_HS_SERVICE_MASK 0x01000000 /* HSP HS role */
130#define BTA_MAS_SERVICE_MASK 0x02000000 /* Message Access Profile */
131#define BTA_MN_SERVICE_MASK 0x04000000 /* Message Notification Profile */
132#define BTA_HL_SERVICE_MASK 0x08000000 /* Health Device Profile */
133#define BTA_PCE_SERVICE_MASK 0x10000000 /* Phone Book Client */
Hemant Gupta8843cc82014-04-18 12:34:55 +0530134#define BTA_HIDD_SERVICE_MASK 0x20000000 /* HID Device */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800135
Hemant Gupta8843cc82014-04-18 12:34:55 +0530136#define BTA_BLE_SERVICE_MASK 0x40000000 /* GATT based service */
137#define BTA_ALL_SERVICE_MASK 0x7FFFFFFF /* All services supported by BTA. */
138#define BTA_USER_SERVICE_MASK 0x80000000 /* 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;
Jakub Pawlowski819e2ec2017-07-10 09:56:09 -0700146 bluetooth::Uuid* p_uuid;
Myles Watsoncd1fd072016-11-09 13:17:43 -0800147} 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 {
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700280 RawAddress bd_addr; /* BD address of device to filter. */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800281 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. */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800294} tBTA_DM_INQ;
295
Myles Watsoncd1fd072016-11-09 13:17:43 -0800296typedef struct {
297 uint8_t bta_dm_eir_min_name_len; /* minimum length of local name when it is
298 shortened */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800299#if (BTA_EIR_CANNED_UUID_LIST == TRUE)
Myles Watsoncd1fd072016-11-09 13:17:43 -0800300 uint8_t bta_dm_eir_uuid16_len; /* length of 16-bit UUIDs */
301 uint8_t* bta_dm_eir_uuid16; /* 16-bit UUIDs */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800302#else
Myles Watsoncd1fd072016-11-09 13:17:43 -0800303 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 -0800304#endif
Myles Watsoncd1fd072016-11-09 13:17:43 -0800305 int8_t* bta_dm_eir_inq_tx_power; /* Inquiry TX power */
306 uint8_t bta_dm_eir_flag_len; /* length of flags in bytes */
307 uint8_t* bta_dm_eir_flags; /* flags for EIR */
308 uint8_t bta_dm_eir_manufac_spec_len; /* length of manufacturer specific in
309 bytes */
310 uint8_t* bta_dm_eir_manufac_spec; /* manufacturer specific */
311 uint8_t bta_dm_eir_additional_len; /* length of additional data in bytes */
312 uint8_t* bta_dm_eir_additional; /* additional data */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800313} tBTA_DM_EIR_CONF;
314
Wei Wanga6ce7752014-05-20 06:30:32 +0000315/* advertising filter policy */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800316typedef tBTM_BLE_AFP tBTA_BLE_AFP;
Wei Wanga6ce7752014-05-20 06:30:32 +0000317
Myles Watsoncd1fd072016-11-09 13:17:43 -0800318enum {
319 BTA_BLE_BATCH_SCAN_MODE_PASS = 1,
320 BTA_BLE_BATCH_SCAN_MODE_ACTI = 2,
321 BTA_BLE_BATCH_SCAN_MODE_PASS_ACTI = 3
Satya Callojic4e25962014-05-10 23:46:24 -0700322};
Marie Janssene9e58ce2016-06-17 14:12:17 -0700323typedef uint8_t tBTA_BLE_BATCH_SCAN_MODE;
Satya Callojic4e25962014-05-10 23:46:24 -0700324
Myles Watsoncd1fd072016-11-09 13:17:43 -0800325enum { BTA_BLE_DISCARD_OLD_ITEMS = 0, BTA_BLE_DISCARD_LOWER_RSSI_ITEMS = 1 };
Marie Janssene9e58ce2016-06-17 14:12:17 -0700326typedef uint8_t tBTA_BLE_DISCARD_RULE;
Satya Callojic4e25962014-05-10 23:46:24 -0700327
Myles Watsoncd1fd072016-11-09 13:17:43 -0800328enum { BTA_BLE_ADV_SEEN_FIRST_TIME = 0, BTA_BLE_ADV_TRACKING_TIMEOUT = 1 };
Marie Janssene9e58ce2016-06-17 14:12:17 -0700329typedef uint8_t tBTA_BLE_ADV_CHANGE_REASON;
Satya Callojic4e25962014-05-10 23:46:24 -0700330
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800331/* BLE customer specific feature function type definitions */
332/* data type used on customer specific feature for RSSI monitoring */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800333#define BTA_BLE_RSSI_ALERT_HI 0
334#define BTA_BLE_RSSI_ALERT_RANGE 1
335#define BTA_BLE_RSSI_ALERT_LO 2
Marie Janssene9e58ce2016-06-17 14:12:17 -0700336typedef uint8_t tBTA_DM_BLE_RSSI_ALERT_TYPE;
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800337
Myles Watsoncd1fd072016-11-09 13:17:43 -0800338#define BTA_BLE_RSSI_ALERT_NONE BTM_BLE_RSSI_ALERT_NONE /* (0) */
339#define BTA_BLE_RSSI_ALERT_HI_BIT BTM_BLE_RSSI_ALERT_HI_BIT /* (1) */
340#define BTA_BLE_RSSI_ALERT_RANGE_BIT \
341 BTM_BLE_RSSI_ALERT_RANGE_BIT /* (1 << 1) */
342#define BTA_BLE_RSSI_ALERT_LO_BIT BTM_BLE_RSSI_ALERT_LO_BIT /* (1 << 2) */
343typedef uint8_t tBTA_DM_BLE_RSSI_ALERT_MASK;
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800344
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700345typedef void(tBTA_DM_BLE_RSSI_CBACK)(const RawAddress& bd_addr,
Myles Watsoncd1fd072016-11-09 13:17:43 -0800346 tBTA_DM_BLE_RSSI_ALERT_TYPE alert_type,
347 int8_t rssi);
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800348
Marie Janssene9e58ce2016-06-17 14:12:17 -0700349typedef int8_t tBTA_DM_RSSI_VALUE;
350typedef uint8_t tBTA_DM_LINK_QUALITY_VALUE;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800351
Marie Janssene9e58ce2016-06-17 14:12:17 -0700352typedef uint8_t tBTA_SIG_STRENGTH_MASK;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800353
The Android Open Source Project5738f832012-12-12 16:00:35 -0800354/* Security Callback Events */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800355#define BTA_DM_ENABLE_EVT 0 /* Enable Event */
356#define BTA_DM_DISABLE_EVT 1 /* Disable Event */
357#define BTA_DM_PIN_REQ_EVT 2 /* PIN request. */
358#define BTA_DM_AUTH_CMPL_EVT 3 /* Authentication complete indication. */
359#define BTA_DM_AUTHORIZE_EVT 4 /* Authorization request. */
360#define BTA_DM_LINK_UP_EVT 5 /* Connection UP event */
361#define BTA_DM_LINK_DOWN_EVT 6 /* Connection DOWN event */
362#define BTA_DM_SIG_STRENGTH_EVT \
363 7 /* Signal strength for bluetooth connection \
364 */
365#define BTA_DM_BUSY_LEVEL_EVT 8 /* System busy level */
366#define BTA_DM_BOND_CANCEL_CMPL_EVT 9 /* Bond cancel complete indication */
367#define BTA_DM_SP_CFM_REQ_EVT \
368 10 /* Simple Pairing User Confirmation request. \
369 */
370#define BTA_DM_SP_KEY_NOTIF_EVT 11 /* Simple Pairing Passkey Notification */
371#define BTA_DM_SP_RMT_OOB_EVT 12 /* Simple Pairing Remote OOB Data request. */
372#define BTA_DM_SP_KEYPRESS_EVT 13 /* Key press notification event. */
373#define BTA_DM_ROLE_CHG_EVT 14 /* Role Change event. */
374#define BTA_DM_BLE_KEY_EVT 15 /* BLE SMP key event for peer device keys */
375#define BTA_DM_BLE_SEC_REQ_EVT 16 /* BLE SMP security request */
376#define BTA_DM_BLE_PASSKEY_NOTIF_EVT 17 /* SMP passkey notification event */
377#define BTA_DM_BLE_PASSKEY_REQ_EVT 18 /* SMP passkey request event */
378#define BTA_DM_BLE_OOB_REQ_EVT 19 /* SMP OOB request event */
379#define BTA_DM_BLE_LOCAL_IR_EVT 20 /* BLE local IR event */
380#define BTA_DM_BLE_LOCAL_ER_EVT 21 /* BLE local ER event */
381#define BTA_DM_BLE_NC_REQ_EVT 22 /* SMP Numeric Comparison request event */
382#define BTA_DM_SP_RMT_OOB_EXT_EVT \
383 23 /* Simple Pairing Remote OOB Extended Data request. */
384#define BTA_DM_BLE_AUTH_CMPL_EVT 24 /* BLE Auth complete */
385#define BTA_DM_DEV_UNPAIRED_EVT 25
386#define BTA_DM_HW_ERROR_EVT 26 /* BT Chip H/W error */
387#define BTA_DM_LE_FEATURES_READ \
388 27 /* Cotroller specific LE features are read \
389 */
390#define BTA_DM_ENER_INFO_READ 28 /* Energy info read */
391#define BTA_DM_BLE_SC_OOB_REQ_EVT 29 /* SMP SC OOB request event */
Marie Janssene9e58ce2016-06-17 14:12:17 -0700392typedef uint8_t tBTA_DM_SEC_EVT;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800393
394/* Structure associated with BTA_DM_ENABLE_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800395typedef struct { tBTA_STATUS status; } tBTA_DM_ENABLE;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800396
397/* Structure associated with BTA_DM_PIN_REQ_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800398typedef struct {
399 /* Note: First 3 data members must be, bd_addr, dev_class, and bd_name in
400 * order */
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700401 RawAddress bd_addr; /* BD address peer device. */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800402 DEV_CLASS dev_class; /* Class of Device */
403 BD_NAME bd_name; /* Name of peer device. */
404 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 -0800405} tBTA_DM_PIN_REQ;
406
407/* BLE related definition */
408
Myles Watsoncd1fd072016-11-09 13:17:43 -0800409#define BTA_DM_AUTH_FAIL_BASE (HCI_ERR_MAX_ERR + 10)
Jacky Cheung07c78922016-07-06 15:11:30 -0700410
Myles Watsoncd1fd072016-11-09 13:17:43 -0800411/* Converts SMP error codes defined in smp_api.h to SMP auth fail reasons below.
412 */
413#define BTA_DM_AUTH_CONVERT_SMP_CODE(x) (BTA_DM_AUTH_FAIL_BASE + (x))
Jacky Cheung07c78922016-07-06 15:11:30 -0700414
Myles Watsoncd1fd072016-11-09 13:17:43 -0800415#define BTA_DM_AUTH_SMP_PASSKEY_FAIL \
416 (BTA_DM_AUTH_FAIL_BASE + SMP_PASSKEY_ENTRY_FAIL)
417#define BTA_DM_AUTH_SMP_OOB_FAIL (BTA_DM_AUTH_FAIL_BASE + SMP_OOB_FAIL)
418#define BTA_DM_AUTH_SMP_PAIR_AUTH_FAIL \
419 (BTA_DM_AUTH_FAIL_BASE + SMP_PAIR_AUTH_FAIL)
420#define BTA_DM_AUTH_SMP_CONFIRM_VALUE_FAIL \
421 (BTA_DM_AUTH_FAIL_BASE + SMP_CONFIRM_VALUE_ERR)
422#define BTA_DM_AUTH_SMP_PAIR_NOT_SUPPORT \
423 (BTA_DM_AUTH_FAIL_BASE + SMP_PAIR_NOT_SUPPORT)
424#define BTA_DM_AUTH_SMP_ENC_KEY_SIZE (BTA_DM_AUTH_FAIL_BASE + SMP_ENC_KEY_SIZE)
425#define BTA_DM_AUTH_SMP_INVALID_CMD (BTA_DM_AUTH_FAIL_BASE + SMP_INVALID_CMD)
426#define BTA_DM_AUTH_SMP_UNKNOWN_ERR \
427 (BTA_DM_AUTH_FAIL_BASE + SMP_PAIR_FAIL_UNKNOWN)
428#define BTA_DM_AUTH_SMP_REPEATED_ATTEMPT \
429 (BTA_DM_AUTH_FAIL_BASE + SMP_REPEATED_ATTEMPTS)
430#define BTA_DM_AUTH_SMP_INVALID_PARAMETERS \
431 (BTA_DM_AUTH_FAIL_BASE + SMP_INVALID_PARAMETERS)
432#define BTA_DM_AUTH_SMP_INTERNAL_ERR \
433 (BTA_DM_AUTH_FAIL_BASE + SMP_PAIR_INTERNAL_ERR)
434#define BTA_DM_AUTH_SMP_UNKNOWN_IO (BTA_DM_AUTH_FAIL_BASE + SMP_UNKNOWN_IO_CAP)
435#define BTA_DM_AUTH_SMP_INIT_FAIL (BTA_DM_AUTH_FAIL_BASE + SMP_INIT_FAIL)
436#define BTA_DM_AUTH_SMP_CONFIRM_FAIL (BTA_DM_AUTH_FAIL_BASE + SMP_CONFIRM_FAIL)
437#define BTA_DM_AUTH_SMP_BUSY (BTA_DM_AUTH_FAIL_BASE + SMP_BUSY)
438#define BTA_DM_AUTH_SMP_ENC_FAIL (BTA_DM_AUTH_FAIL_BASE + SMP_ENC_FAIL)
439#define BTA_DM_AUTH_SMP_RSP_TIMEOUT (BTA_DM_AUTH_FAIL_BASE + SMP_RSP_TIMEOUT)
440#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 -0800441
442/* connection parameter boundary value and dummy value */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800443#define BTA_DM_BLE_SCAN_INT_MIN BTM_BLE_SCAN_INT_MIN
444#define BTA_DM_BLE_SCAN_INT_MAX BTM_BLE_SCAN_INT_MAX
445#define BTA_DM_BLE_SCAN_WIN_MIN BTM_BLE_SCAN_WIN_MIN
446#define BTA_DM_BLE_SCAN_WIN_MAX BTM_BLE_SCAN_WIN_MAX
447#define BTA_DM_BLE_CONN_INT_MIN BTM_BLE_CONN_INT_MIN
448#define BTA_DM_BLE_CONN_INT_MAX BTM_BLE_CONN_INT_MAX
449#define BTA_DM_BLE_CONN_LATENCY_MAX BTM_BLE_CONN_LATENCY_MAX
450#define BTA_DM_BLE_CONN_SUP_TOUT_MIN BTM_BLE_CONN_SUP_TOUT_MIN
451#define BTA_DM_BLE_CONN_SUP_TOUT_MAX BTM_BLE_CONN_SUP_TOUT_MAX
452#define BTA_DM_BLE_CONN_PARAM_UNDEF \
453 BTM_BLE_CONN_PARAM_UNDEF /* use this value when a specific value not to be \
454 overwritten */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800455
Myles Watsoncd1fd072016-11-09 13:17:43 -0800456#define BTA_LE_KEY_PENC \
457 BTM_LE_KEY_PENC /* encryption information of peer device */
458#define BTA_LE_KEY_PID BTM_LE_KEY_PID /* identity key of the peer device */
459#define BTA_LE_KEY_PCSRK BTM_LE_KEY_PCSRK /* peer SRK */
460#define BTA_LE_KEY_LENC \
461 BTM_LE_KEY_LENC /* master role security information:div */
462#define BTA_LE_KEY_LID BTM_LE_KEY_LID /* master device ID key */
463#define BTA_LE_KEY_LCSRK \
464 BTM_LE_KEY_LCSRK /* local CSRK has been deliver to peer */
Marie Janssene9e58ce2016-06-17 14:12:17 -0700465typedef uint8_t tBTA_LE_KEY_TYPE; /* can be used as a bit mask */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800466
Myles Watsoncd1fd072016-11-09 13:17:43 -0800467typedef tBTM_LE_PENC_KEYS tBTA_LE_PENC_KEYS;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800468typedef tBTM_LE_PCSRK_KEYS tBTA_LE_PCSRK_KEYS;
Myles Watsoncd1fd072016-11-09 13:17:43 -0800469typedef tBTM_LE_LENC_KEYS tBTA_LE_LENC_KEYS;
470typedef tBTM_LE_LCSRK_KEYS tBTA_LE_LCSRK_KEYS;
471typedef tBTM_LE_PID_KEYS tBTA_LE_PID_KEYS;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800472
Myles Watsoncd1fd072016-11-09 13:17:43 -0800473typedef union {
474 tBTA_LE_PENC_KEYS penc_key; /* received peer encryption key */
475 tBTA_LE_PCSRK_KEYS psrk_key; /* received peer device SRK */
476 tBTA_LE_PID_KEYS pid_key; /* peer device ID key */
477 tBTA_LE_LENC_KEYS
478 lenc_key; /* local encryption reproduction keys LTK = = d1(ER,DIV,0)*/
479 tBTA_LE_LCSRK_KEYS lcsrk_key; /* local device CSRK = d1(ER,DIV,1)*/
480 tBTA_LE_PID_KEYS lid_key; /* local device ID key for the particular remote */
481} tBTA_LE_KEY_VALUE;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800482
Myles Watsoncd1fd072016-11-09 13:17:43 -0800483#define BTA_BLE_LOCAL_KEY_TYPE_ID 1
484#define BTA_BLE_LOCAL_KEY_TYPE_ER 2
Marie Janssene9e58ce2016-06-17 14:12:17 -0700485typedef uint8_t tBTA_DM_BLE_LOCAL_KEY_MASK;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800486
Myles Watsoncd1fd072016-11-09 13:17:43 -0800487typedef struct {
488 BT_OCTET16 ir;
489 BT_OCTET16 irk;
490 BT_OCTET16 dhk;
491} tBTA_BLE_LOCAL_ID_KEYS;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800492
Myles Watsoncd1fd072016-11-09 13:17:43 -0800493#define BTA_DM_SEC_GRANTED BTA_SUCCESS
494#define BTA_DM_SEC_PAIR_NOT_SPT BTA_DM_AUTH_SMP_PAIR_NOT_SUPPORT
495#define BTA_DM_SEC_REP_ATTEMPTS BTA_DM_AUTH_SMP_REPEATED_ATTEMPT
Marie Janssene9e58ce2016-06-17 14:12:17 -0700496typedef uint8_t tBTA_DM_BLE_SEC_GRANT;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800497
The Android Open Source Project5738f832012-12-12 16:00:35 -0800498/* Structure associated with BTA_DM_BLE_SEC_REQ_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800499typedef struct {
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700500 RawAddress bd_addr; /* peer address */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800501 BD_NAME bd_name; /* peer device name */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800502} tBTA_DM_BLE_SEC_REQ;
503
Myles Watsoncd1fd072016-11-09 13:17:43 -0800504typedef struct {
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700505 RawAddress bd_addr; /* peer address */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800506 tBTM_LE_KEY_TYPE key_type;
507 tBTM_LE_KEY_VALUE* p_key_value;
508} tBTA_DM_BLE_KEY;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800509
510/* Structure associated with BTA_DM_AUTH_CMPL_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800511typedef struct {
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700512 RawAddress bd_addr; /* BD address peer device. */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800513 BD_NAME bd_name; /* Name of peer device. */
514 bool key_present; /* Valid link key value in key element */
515 LINK_KEY key; /* Link key associated with peer device. */
516 uint8_t key_type; /* The type of Link Key */
517 bool success; /* true of authentication succeeded, false if failed. */
518 uint8_t fail_reason; /* The HCI reason/error code for when success=false */
519 tBLE_ADDR_TYPE addr_type; /* Peer device address type */
520 tBT_DEVICE_TYPE dev_type;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800521} tBTA_DM_AUTH_CMPL;
522
The Android Open Source Project5738f832012-12-12 16:00:35 -0800523/* Structure associated with BTA_DM_AUTHORIZE_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800524typedef struct {
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700525 RawAddress bd_addr; /* BD address peer device. */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800526 BD_NAME bd_name; /* Name of peer device. */
527 tBTA_SERVICE_ID service; /* Service ID to authorize. */
528 DEV_CLASS dev_class;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800529} tBTA_DM_AUTHORIZE;
530
531/* Structure associated with BTA_DM_LINK_UP_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800532typedef struct {
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700533 RawAddress bd_addr; /* BD address peer device. */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800534 tBTA_TRANSPORT link_type;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800535} tBTA_DM_LINK_UP;
536
537/* Structure associated with BTA_DM_LINK_DOWN_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800538typedef struct {
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700539 RawAddress bd_addr; /* BD address peer device. */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800540 uint8_t status; /* connection open/closed */
541 bool is_removed; /* true if device is removed when link is down */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800542 tBTA_TRANSPORT link_type;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800543} tBTA_DM_LINK_DOWN;
544
545/* Structure associated with BTA_DM_ROLE_CHG_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800546typedef struct {
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700547 RawAddress bd_addr; /* BD address peer device. */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800548 uint8_t new_role; /* the new connection role */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800549} tBTA_DM_ROLE_CHG;
550
The Android Open Source Project5738f832012-12-12 16:00:35 -0800551/* Structure associated with BTA_DM_BUSY_LEVEL_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800552typedef struct {
553 uint8_t level; /* when paging or inquiring, level is 10.
554 Otherwise, the number of ACL links */
555 uint8_t level_flags; /* indicates individual flags */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800556} tBTA_DM_BUSY_LEVEL;
557
Myles Watson2e8e9f42016-11-14 16:45:15 -0800558#define BTA_IO_CAP_OUT BTM_IO_CAP_OUT /* 0 DisplayOnly */
559#define BTA_IO_CAP_IO BTM_IO_CAP_IO /* 1 DisplayYesNo */
560#define BTA_IO_CAP_IN BTM_IO_CAP_IN /* 2 KeyboardOnly */
561#define BTA_IO_CAP_NONE BTM_IO_CAP_NONE /* 3 NoInputNoOutput */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800562#define BTA_IO_CAP_KBDISP BTM_IO_CAP_KBDISP /* 4 Keyboard display */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800563typedef tBTM_IO_CAP tBTA_IO_CAP;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800564
Myles Watsoncd1fd072016-11-09 13:17:43 -0800565#define BTA_AUTH_SP_NO \
566 BTM_AUTH_SP_NO /* 0 MITM Protection Not Required - Single \
567 Profile/non-bonding \
568 Numeric comparison with automatic accept allowed */
569#define BTA_AUTH_SP_YES \
570 BTM_AUTH_SP_YES /* 1 MITM Protection Required - Single Profile/non-bonding \
571 Use IO Capabilities to determine authentication procedure \
572 */
573#define BTA_AUTH_AP_NO \
574 BTM_AUTH_AP_NO /* 2 MITM Protection Not Required - All Profiles/dedicated \
575 bonding \
576 Numeric comparison with automatic accept allowed */
577#define BTA_AUTH_AP_YES \
578 BTM_AUTH_AP_YES /* 3 MITM Protection Required - All Profiles/dedicated \
579 bonding \
580 Use IO Capabilities to determine authentication procedure \
581 */
582#define BTA_AUTH_SPGB_NO \
583 BTM_AUTH_SPGB_NO /* 4 MITM Protection Not Required - Single Profiles/general \
584 bonding \
585 Numeric comparison with automatic accept allowed */
586#define BTA_AUTH_SPGB_YES \
587 BTM_AUTH_SPGB_YES /* 5 MITM Protection Required - Single Profiles/general \
588 bonding \
589 Use IO Capabilities to determine authentication \
590 procedure */
591typedef tBTM_AUTH_REQ tBTA_AUTH_REQ;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800592
Myles Watsoncd1fd072016-11-09 13:17:43 -0800593#define BTA_AUTH_DD_BOND \
594 BTM_AUTH_DD_BOND /* 2 this bit is set for dedicated bonding */
595#define BTA_AUTH_GEN_BOND \
596 BTM_AUTH_SPGB_NO /* 4 this bit is set for general bonding */
597#define BTA_AUTH_BONDS \
598 BTM_AUTH_BONDS /* 6 the general/dedicated bonding bits */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800599
Myles Watsoncd1fd072016-11-09 13:17:43 -0800600#define BTA_LE_AUTH_NO_BOND BTM_LE_AUTH_REQ_NO_BOND /* 0*/
601#define BTA_LE_AUTH_BOND BTM_LE_AUTH_REQ_BOND /* 1 << 0 */
602#define BTA_LE_AUTH_REQ_MITM BTM_LE_AUTH_REQ_MITM /* 1 << 2 */
Satya Calloji444a8da2015-03-06 10:38:22 -0800603
Myles Watsoncd1fd072016-11-09 13:17:43 -0800604#define BTA_LE_AUTH_REQ_SC_ONLY BTM_LE_AUTH_REQ_SC_ONLY /* 1 << 3 */
605#define BTA_LE_AUTH_REQ_SC_BOND BTM_LE_AUTH_REQ_SC_BOND /* 1001 */
606#define BTA_LE_AUTH_REQ_SC_MITM BTM_LE_AUTH_REQ_SC_MITM /* 1100 */
607#define BTA_LE_AUTH_REQ_SC_MITM_BOND BTM_LE_AUTH_REQ_SC_MITM_BOND /* 1101 */
608typedef tBTM_LE_AUTH_REQ
609 tBTA_LE_AUTH_REQ; /* combination of the above bit pattern */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800610
Myles Watsoncd1fd072016-11-09 13:17:43 -0800611#define BTA_OOB_NONE BTM_OOB_NONE
612#define BTA_OOB_PRESENT BTM_OOB_PRESENT
613#define BTA_OOB_UNKNOWN BTM_OOB_UNKNOWN
Jakub Pawlowski175da702015-11-12 15:00:58 -0800614
Myles Watsoncd1fd072016-11-09 13:17:43 -0800615typedef tBTM_OOB_DATA tBTA_OOB_DATA;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800616
617/* Structure associated with BTA_DM_SP_CFM_REQ_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800618typedef struct {
619 /* Note: First 3 data members must be, bd_addr, dev_class, and bd_name in
620 * order */
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700621 RawAddress bd_addr; /* peer address */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800622 DEV_CLASS dev_class; /* peer CoD */
623 BD_NAME bd_name; /* peer device name */
624 uint32_t num_val; /* the numeric value for comparison. If just_works, do not
625 show this number to UI */
626 bool just_works; /* true, if "Just Works" association model */
627 tBTA_AUTH_REQ loc_auth_req; /* Authentication required for local device */
628 tBTA_AUTH_REQ rmt_auth_req; /* Authentication required for peer device */
629 tBTA_IO_CAP loc_io_caps; /* IO Capabilities of local device */
630 tBTA_AUTH_REQ rmt_io_caps; /* IO Capabilities of remote device */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800631} tBTA_DM_SP_CFM_REQ;
632
Myles Watsoncd1fd072016-11-09 13:17:43 -0800633enum {
634 BTA_SP_KEY_STARTED, /* passkey entry started */
635 BTA_SP_KEY_ENTERED, /* passkey digit entered */
636 BTA_SP_KEY_ERASED, /* passkey digit erased */
637 BTA_SP_KEY_CLEARED, /* passkey cleared */
638 BTA_SP_KEY_COMPLT /* passkey entry completed */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800639};
Myles Watsoncd1fd072016-11-09 13:17:43 -0800640typedef uint8_t tBTA_SP_KEY_TYPE;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800641
642/* Structure associated with BTA_DM_SP_KEYPRESS_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800643typedef struct {
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700644 RawAddress bd_addr; /* peer address */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800645 tBTA_SP_KEY_TYPE notif_type;
646} tBTA_DM_SP_KEY_PRESS;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800647
648/* Structure associated with BTA_DM_SP_KEY_NOTIF_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800649typedef struct {
650 /* Note: First 3 data members must be, bd_addr, dev_class, and bd_name in
651 * order */
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700652 RawAddress bd_addr; /* peer address */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800653 DEV_CLASS dev_class; /* peer CoD */
654 BD_NAME bd_name; /* peer device name */
655 uint32_t passkey; /* the numeric value for comparison. If just_works, do not
656 show this number to UI */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800657} tBTA_DM_SP_KEY_NOTIF;
658
659/* Structure associated with BTA_DM_SP_RMT_OOB_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800660typedef struct {
661 /* Note: First 3 data members must be, bd_addr, dev_class, and bd_name in
662 * order */
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700663 RawAddress bd_addr; /* peer address */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800664 DEV_CLASS dev_class; /* peer CoD */
665 BD_NAME bd_name; /* peer device name */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800666} tBTA_DM_SP_RMT_OOB;
667
668/* Structure associated with BTA_DM_BOND_CANCEL_CMPL_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800669typedef struct {
670 tBTA_STATUS result; /* true of bond cancel succeeded, false if failed. */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800671} tBTA_DM_BOND_CANCEL_CMPL;
672
673/* Union of all security callback structures */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800674typedef union {
675 tBTA_DM_ENABLE enable; /* BTA enabled */
676 tBTA_DM_PIN_REQ pin_req; /* PIN request. */
677 tBTA_DM_AUTH_CMPL auth_cmpl; /* Authentication complete indication. */
678 tBTA_DM_AUTHORIZE authorize; /* Authorization request. */
679 tBTA_DM_LINK_UP link_up; /* ACL connection down event */
680 tBTA_DM_LINK_DOWN link_down; /* ACL connection down event */
681 tBTA_DM_BUSY_LEVEL busy_level; /* System busy level */
682 tBTA_DM_SP_CFM_REQ cfm_req; /* user confirm request */
683 tBTA_DM_SP_KEY_NOTIF key_notif; /* passkey notification */
684 tBTA_DM_SP_RMT_OOB rmt_oob; /* remote oob */
685 tBTA_DM_BOND_CANCEL_CMPL
686 bond_cancel_cmpl; /* Bond Cancel Complete indication */
687 tBTA_DM_SP_KEY_PRESS key_press; /* key press notification event */
688 tBTA_DM_ROLE_CHG role_chg; /* role change event */
689 tBTA_DM_BLE_SEC_REQ ble_req; /* BLE SMP related request */
690 tBTA_DM_BLE_KEY ble_key; /* BLE SMP keys used when pairing */
691 tBTA_BLE_LOCAL_ID_KEYS ble_id_keys; /* IR event */
692 BT_OCTET16 ble_er; /* ER event data */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800693} tBTA_DM_SEC;
694
695/* Security callback */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800696typedef 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 -0800697
Myles Watsoncd1fd072016-11-09 13:17:43 -0800698#define BTA_DM_BLE_PF_LIST_LOGIC_OR 1
Myles Watsoncd1fd072016-11-09 13:17:43 -0800699#define BTA_DM_BLE_PF_FILT_LOGIC_OR 0
Satya Calloji1a9247a2014-06-05 13:15:15 -0700700
The Android Open Source Project5738f832012-12-12 16:00:35 -0800701/* Search callback events */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800702#define BTA_DM_INQ_RES_EVT 0 /* Inquiry result for a peer device. */
703#define BTA_DM_INQ_CMPL_EVT 1 /* Inquiry complete. */
704#define BTA_DM_DISC_RES_EVT 2 /* Discovery result for a peer device. */
705#define BTA_DM_DISC_BLE_RES_EVT \
706 3 /* Discovery result for BLE GATT based servoce on a peer device. */
707#define BTA_DM_DISC_CMPL_EVT 4 /* Discovery complete. */
708#define BTA_DM_DI_DISC_CMPL_EVT 5 /* Discovery complete. */
709#define BTA_DM_SEARCH_CANCEL_CMPL_EVT 6 /* Search cancelled */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800710
Marie Janssene9e58ce2016-06-17 14:12:17 -0700711typedef uint8_t tBTA_DM_SEARCH_EVT;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800712
Myles Watsoncd1fd072016-11-09 13:17:43 -0800713#define BTA_DM_INQ_RES_IGNORE_RSSI \
714 BTM_INQ_RES_IGNORE_RSSI /* 0x7f RSSI value not supplied (ignore it) */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800715
716/* Structure associated with BTA_DM_INQ_RES_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800717typedef struct {
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700718 RawAddress bd_addr; /* BD address peer device. */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800719 DEV_CLASS dev_class; /* Device class of peer device. */
720 bool remt_name_not_required; /* Application sets this flag if it already knows
721 the name of the device */
722 /* If the device name is known to application BTA skips the remote name
723 * request */
724 bool is_limited; /* true, if the limited inquiry bit is set in the CoD */
725 int8_t rssi; /* The rssi value */
726 uint8_t* p_eir; /* received EIR */
Jakub Pawlowskif7100bb2017-02-13 14:31:52 -0800727 uint16_t eir_len; /* received EIR length */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800728 uint8_t inq_result_type;
729 uint8_t ble_addr_type;
Jakub Pawlowskid64bf4f2017-01-27 05:53:07 -0800730 uint16_t ble_evt_type;
Jakub Pawlowski7de0f9b2017-01-27 08:06:20 -0800731 uint8_t ble_primary_phy;
732 uint8_t ble_secondary_phy;
733 uint8_t ble_advertising_sid;
734 int8_t ble_tx_power;
735 uint16_t ble_periodic_adv_int;
Myles Watsoncd1fd072016-11-09 13:17:43 -0800736 tBT_DEVICE_TYPE device_type;
737 uint8_t flag;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800738} tBTA_DM_INQ_RES;
739
740/* Structure associated with BTA_DM_INQ_CMPL_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800741typedef struct {
742 uint8_t num_resps; /* Number of inquiry responses. */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800743} tBTA_DM_INQ_CMPL;
744
745/* Structure associated with BTA_DM_DI_DISC_CMPL_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800746typedef struct {
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700747 RawAddress bd_addr; /* BD address peer device. */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800748 uint8_t num_record; /* Number of DI record */
749 tBTA_STATUS result;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800750} tBTA_DM_DI_DISC_CMPL;
751
752/* Structure associated with BTA_DM_DISC_RES_EVT */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800753typedef struct {
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700754 RawAddress bd_addr; /* BD address peer device. */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800755 BD_NAME bd_name; /* Name of peer device. */
756 tBTA_SERVICE_MASK services; /* Services found on peer device. */
757 uint8_t* p_raw_data; /* Raw data for discovery DB */
758 uint32_t raw_data_size; /* size of raw data */
759 tBT_DEVICE_TYPE device_type; /* device type in case it is BLE device */
760 uint32_t num_uuids;
Jakub Pawlowski819e2ec2017-07-10 09:56:09 -0700761 bluetooth::Uuid* p_uuid_list;
Myles Watsoncd1fd072016-11-09 13:17:43 -0800762 tBTA_STATUS result;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800763} tBTA_DM_DISC_RES;
764
765/* Structure associated with tBTA_DM_DISC_BLE_RES */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800766typedef struct {
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700767 RawAddress bd_addr; /* BD address peer device. */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800768 BD_NAME bd_name; /* Name of peer device. */
Jakub Pawlowski819e2ec2017-07-10 09:56:09 -0700769 bluetooth::Uuid service; /* GATT based Services UUID found on peer device. */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800770} tBTA_DM_DISC_BLE_RES;
771
The Android Open Source Project5738f832012-12-12 16:00:35 -0800772/* Union of all search callback structures */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800773typedef union {
774 tBTA_DM_INQ_RES inq_res; /* Inquiry result for a peer device. */
775 tBTA_DM_INQ_CMPL inq_cmpl; /* Inquiry complete. */
776 tBTA_DM_DISC_RES disc_res; /* Discovery result for a peer device. */
777 tBTA_DM_DISC_BLE_RES
778 disc_ble_res; /* discovery result for GATT based service */
779 tBTA_DM_DI_DISC_CMPL di_disc; /* DI discovery result for a peer device */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800780
781} tBTA_DM_SEARCH;
782
783/* Search callback */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800784typedef void(tBTA_DM_SEARCH_CBACK)(tBTA_DM_SEARCH_EVT event,
785 tBTA_DM_SEARCH* p_data);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800786
787/* Execute call back */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800788typedef void(tBTA_DM_EXEC_CBACK)(void* p_param);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800789
790/* Encryption callback*/
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700791typedef void(tBTA_DM_ENCRYPT_CBACK)(const RawAddress& bd_addr,
Jakub Pawlowskic2276b02017-06-09 16:00:25 -0700792 tBTA_TRANSPORT transport,
Myles Watsoncd1fd072016-11-09 13:17:43 -0800793 tBTA_STATUS result);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800794
Myles Watsoncd1fd072016-11-09 13:17:43 -0800795#define BTA_DM_BLE_SEC_NONE BTM_BLE_SEC_NONE
796#define BTA_DM_BLE_SEC_ENCRYPT BTM_BLE_SEC_ENCRYPT
797#define BTA_DM_BLE_SEC_NO_MITM BTM_BLE_SEC_ENCRYPT_NO_MITM
798#define BTA_DM_BLE_SEC_MITM BTM_BLE_SEC_ENCRYPT_MITM
799typedef tBTM_BLE_SEC_ACT tBTA_DM_BLE_SEC_ACT;
Satya Callojic4e25962014-05-10 23:46:24 -0700800
Myles Watsoncd1fd072016-11-09 13:17:43 -0800801typedef tBTM_BLE_TX_TIME_MS tBTA_DM_BLE_TX_TIME_MS;
802typedef tBTM_BLE_RX_TIME_MS tBTA_DM_BLE_RX_TIME_MS;
803typedef tBTM_BLE_IDLE_TIME_MS tBTA_DM_BLE_IDLE_TIME_MS;
804typedef tBTM_BLE_ENERGY_USED tBTA_DM_BLE_ENERGY_USED;
Satya Callojie5ba8842014-07-03 17:18:02 -0700805
Myles Watsoncd1fd072016-11-09 13:17:43 -0800806#define BTA_DM_CONTRL_UNKNOWN 0 /* Unknown state */
807#define BTA_DM_CONTRL_ACTIVE 1 /* ACL link on, SCO link ongoing, sniff mode */
808#define BTA_DM_CONTRL_SCAN \
809 2 /* Scan state - paging/inquiry/trying to \
810 connect*/
811#define BTA_DM_CONTRL_IDLE \
812 3 /* Idle state - page scan, LE advt, inquiry scan \
813 */
Satya Callojie5ba8842014-07-03 17:18:02 -0700814
Marie Janssene9e58ce2016-06-17 14:12:17 -0700815typedef uint8_t tBTA_DM_CONTRL_STATE;
Satya Callojie5ba8842014-07-03 17:18:02 -0700816
Marie Janssene9e58ce2016-06-17 14:12:17 -0700817typedef uint8_t tBTA_DM_BLE_ADV_STATE;
818typedef uint8_t tBTA_DM_BLE_ADV_INFO_PRESENT;
819typedef uint8_t tBTA_DM_BLE_RSSI_VALUE;
820typedef uint16_t tBTA_DM_BLE_ADV_INFO_TIMESTAMP;
Satya Callojif5387072015-02-09 17:40:52 -0800821
Myles Watsoncd1fd072016-11-09 13:17:43 -0800822typedef void(tBTA_BLE_ENERGY_INFO_CBACK)(tBTA_DM_BLE_TX_TIME_MS tx_time,
823 tBTA_DM_BLE_RX_TIME_MS rx_time,
824 tBTA_DM_BLE_IDLE_TIME_MS idle_time,
825 tBTA_DM_BLE_ENERGY_USED energy_used,
826 tBTA_DM_CONTRL_STATE ctrl_state,
827 tBTA_STATUS status);
Satya Callojie5ba8842014-07-03 17:18:02 -0700828
The Android Open Source Project5738f832012-12-12 16:00:35 -0800829/* Maximum service name length */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800830#define BTA_SERVICE_NAME_LEN 35
831#define BTA_SERVICE_DESP_LEN BTA_SERVICE_NAME_LEN
832#define BTA_PROVIDER_NAME_LEN BTA_SERVICE_NAME_LEN
The Android Open Source Project5738f832012-12-12 16:00:35 -0800833
834/* link policy masks */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800835#define BTA_DM_LP_SWITCH HCI_ENABLE_MASTER_SLAVE_SWITCH
836#define BTA_DM_LP_HOLD HCI_ENABLE_HOLD_MODE
837#define BTA_DM_LP_SNIFF HCI_ENABLE_SNIFF_MODE
838#define BTA_DM_LP_PARK HCI_ENABLE_PARK_MODE
Marie Janssene9e58ce2016-06-17 14:12:17 -0700839typedef uint16_t tBTA_DM_LP_MASK;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800840
841/* power mode actions */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800842#define BTA_DM_PM_NO_ACTION 0x00 /* no change to the current pm setting */
843#define BTA_DM_PM_PARK 0x10 /* prefers park mode */
844#define BTA_DM_PM_SNIFF 0x20 /* prefers sniff mode */
845#define BTA_DM_PM_SNIFF1 0x21 /* prefers sniff1 mode */
846#define BTA_DM_PM_SNIFF2 0x22 /* prefers sniff2 mode */
847#define BTA_DM_PM_SNIFF3 0x23 /* prefers sniff3 mode */
848#define BTA_DM_PM_SNIFF4 0x24 /* prefers sniff4 mode */
849#define BTA_DM_PM_SNIFF5 0x25 /* prefers sniff5 mode */
850#define BTA_DM_PM_SNIFF6 0x26 /* prefers sniff6 mode */
851#define BTA_DM_PM_SNIFF7 0x27 /* prefers sniff7 mode */
852#define BTA_DM_PM_SNIFF_USER0 \
853 0x28 /* prefers user-defined sniff0 mode (testtool only) */
854#define BTA_DM_PM_SNIFF_USER1 \
855 0x29 /* prefers user-defined sniff1 mode (testtool only) */
856#define BTA_DM_PM_ACTIVE 0x40 /* prefers active mode */
857#define BTA_DM_PM_RETRY 0x80 /* retry power mode based on current settings */
858#define BTA_DM_PM_SUSPEND 0x04 /* prefers suspend mode */
859#define BTA_DM_PM_NO_PREF \
860 0x01 /* service has no prefernce on power mode setting. eg. connection to \
861 service got closed */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800862
Marie Janssene9e58ce2016-06-17 14:12:17 -0700863typedef uint8_t tBTA_DM_PM_ACTION;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800864
865/* index to bta_dm_ssr_spec */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800866#define BTA_DM_PM_SSR0 0
867#define BTA_DM_PM_SSR1 \
868 1 /* BTA_DM_PM_SSR1 will be dedicated for \
869 HH SSR setting entry, no other profile can use it */
870#define BTA_DM_PM_SSR2 2
871#define BTA_DM_PM_SSR3 3
872#define BTA_DM_PM_SSR4 4
873#define BTA_DM_PM_SSR5 5
874#define BTA_DM_PM_SSR6 6
The Android Open Source Project5738f832012-12-12 16:00:35 -0800875
Myles Watsoncd1fd072016-11-09 13:17:43 -0800876#define BTA_DM_PM_NUM_EVTS 9
The Android Open Source Project5738f832012-12-12 16:00:35 -0800877
878#ifndef BTA_DM_PM_PARK_IDX
Myles Watsoncd1fd072016-11-09 13:17:43 -0800879#define BTA_DM_PM_PARK_IDX \
Kim Low18985be2017-12-20 15:11:08 -0800880 6 /* the actual index to bta_dm_pm_md[] for PARK mode */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800881#endif
882
Adam Hampson63399d92014-05-19 16:23:45 -0700883#ifndef BTA_DM_PM_SNIFF_A2DP_IDX
Myles Watsoncd1fd072016-11-09 13:17:43 -0800884#define BTA_DM_PM_SNIFF_A2DP_IDX BTA_DM_PM_SNIFF
Adam Hampson63399d92014-05-19 16:23:45 -0700885#endif
886
887#ifndef BTA_DM_PM_SNIFF_HD_IDLE_IDX
Myles Watsoncd1fd072016-11-09 13:17:43 -0800888#define BTA_DM_PM_SNIFF_HD_IDLE_IDX BTA_DM_PM_SNIFF2
Adam Hampson63399d92014-05-19 16:23:45 -0700889#endif
890
891#ifndef BTA_DM_PM_SNIFF_SCO_OPEN_IDX
Myles Watsoncd1fd072016-11-09 13:17:43 -0800892#define BTA_DM_PM_SNIFF_SCO_OPEN_IDX BTA_DM_PM_SNIFF3
Adam Hampson63399d92014-05-19 16:23:45 -0700893#endif
894
895#ifndef BTA_DM_PM_SNIFF_HD_ACTIVE_IDX
896#define BTA_DM_PM_SNIFF_HD_ACTIVE_IDX BTA_DM_PM_SNIFF4
897#endif
898
899#ifndef BTA_DM_PM_SNIFF_HH_OPEN_IDX
900#define BTA_DM_PM_SNIFF_HH_OPEN_IDX BTA_DM_PM_SNIFF2
901#endif
902
903#ifndef BTA_DM_PM_SNIFF_HH_ACTIVE_IDX
904#define BTA_DM_PM_SNIFF_HH_ACTIVE_IDX BTA_DM_PM_SNIFF2
905#endif
906
907#ifndef BTA_DM_PM_SNIFF_HH_IDLE_IDX
908#define BTA_DM_PM_SNIFF_HH_IDLE_IDX BTA_DM_PM_SNIFF2
909#endif
910
Adam Hampson63399d92014-05-19 16:23:45 -0700911#ifndef BTA_DM_PM_HH_OPEN_DELAY
912#define BTA_DM_PM_HH_OPEN_DELAY 30000
913#endif
914
915#ifndef BTA_DM_PM_HH_ACTIVE_DELAY
916#define BTA_DM_PM_HH_ACTIVE_DELAY 30000
917#endif
918
919#ifndef BTA_DM_PM_HH_IDLE_DELAY
920#define BTA_DM_PM_HH_IDLE_DELAY 30000
921#endif
922
923/* The Sniff Parameters defined below must be ordered from highest
924 * latency (biggest interval) to lowest latency. If there is a conflict
925 * among the connected services the setting with the lowest latency will
926 * be selected. If a device should override a sniff parameter then it
927 * must insure that order is maintained.
928 */
929#ifndef BTA_DM_PM_SNIFF_MAX
Myles Watsoncd1fd072016-11-09 13:17:43 -0800930#define BTA_DM_PM_SNIFF_MAX 800
931#define BTA_DM_PM_SNIFF_MIN 400
932#define BTA_DM_PM_SNIFF_ATTEMPT 4
933#define BTA_DM_PM_SNIFF_TIMEOUT 1
Adam Hampson63399d92014-05-19 16:23:45 -0700934#endif
935
936#ifndef BTA_DM_PM_SNIFF1_MAX
Myles Watsoncd1fd072016-11-09 13:17:43 -0800937#define BTA_DM_PM_SNIFF1_MAX 400
938#define BTA_DM_PM_SNIFF1_MIN 200
Adam Hampson63399d92014-05-19 16:23:45 -0700939#define BTA_DM_PM_SNIFF1_ATTEMPT 4
940#define BTA_DM_PM_SNIFF1_TIMEOUT 1
941#endif
942
943#ifndef BTA_DM_PM_SNIFF2_MAX
Hemant Gupta8843cc82014-04-18 12:34:55 +0530944#define BTA_DM_PM_SNIFF2_MAX 54
945#define BTA_DM_PM_SNIFF2_MIN 30
Adam Hampson63399d92014-05-19 16:23:45 -0700946#define BTA_DM_PM_SNIFF2_ATTEMPT 4
947#define BTA_DM_PM_SNIFF2_TIMEOUT 1
948#endif
949
950#ifndef BTA_DM_PM_SNIFF3_MAX
Myles Watsoncd1fd072016-11-09 13:17:43 -0800951#define BTA_DM_PM_SNIFF3_MAX 150
952#define BTA_DM_PM_SNIFF3_MIN 50
Adam Hampson63399d92014-05-19 16:23:45 -0700953#define BTA_DM_PM_SNIFF3_ATTEMPT 4
954#define BTA_DM_PM_SNIFF3_TIMEOUT 1
955#endif
956
957#ifndef BTA_DM_PM_SNIFF4_MAX
Ivan Podogovbe6d6ce2017-01-03 21:20:33 +0000958#define BTA_DM_PM_SNIFF4_MAX 18
959#define BTA_DM_PM_SNIFF4_MIN 10
Adam Hampson63399d92014-05-19 16:23:45 -0700960#define BTA_DM_PM_SNIFF4_ATTEMPT 4
961#define BTA_DM_PM_SNIFF4_TIMEOUT 1
962#endif
963
Pavlin Radoslavov1076b7b2015-07-22 22:49:26 -0700964#ifndef BTA_DM_PM_SNIFF5_MAX
Myles Watsoncd1fd072016-11-09 13:17:43 -0800965#define BTA_DM_PM_SNIFF5_MAX 36
966#define BTA_DM_PM_SNIFF5_MIN 30
Pavlin Radoslavov1076b7b2015-07-22 22:49:26 -0700967#define BTA_DM_PM_SNIFF5_ATTEMPT 2
968#define BTA_DM_PM_SNIFF5_TIMEOUT 0
969#endif
970
Kim Low18985be2017-12-20 15:11:08 -0800971#ifndef BTA_DM_PM_SNIFF6_MAX
972#define BTA_DM_PM_SNIFF6_MAX 18
973#define BTA_DM_PM_SNIFF6_MIN 14
974#define BTA_DM_PM_SNIFF6_ATTEMPT 1
975#define BTA_DM_PM_SNIFF6_TIMEOUT 0
976#endif
977
Adam Hampson63399d92014-05-19 16:23:45 -0700978#ifndef BTA_DM_PM_PARK_MAX
Myles Watsoncd1fd072016-11-09 13:17:43 -0800979#define BTA_DM_PM_PARK_MAX 800
980#define BTA_DM_PM_PARK_MIN 400
981#define BTA_DM_PM_PARK_ATTEMPT 0
982#define BTA_DM_PM_PARK_TIMEOUT 0
Adam Hampson63399d92014-05-19 16:23:45 -0700983#endif
984
The Android Open Source Project5738f832012-12-12 16:00:35 -0800985/* Switch callback events */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800986#define BTA_DM_SWITCH_CMPL_EVT 0 /* Completion of the Switch API */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800987
Marie Janssene9e58ce2016-06-17 14:12:17 -0700988typedef uint8_t tBTA_DM_SWITCH_EVT;
Myles Watsoncd1fd072016-11-09 13:17:43 -0800989typedef void(tBTA_DM_SWITCH_CBACK)(tBTA_DM_SWITCH_EVT event,
990 tBTA_STATUS status);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800991
992/* Audio routing out configuration */
Myles Watsoncd1fd072016-11-09 13:17:43 -0800993#define BTA_DM_ROUTE_NONE 0x00 /* No Audio output */
994#define BTA_DM_ROUTE_DAC 0x01 /* routing over analog output */
995#define BTA_DM_ROUTE_I2S 0x02 /* routing over digital (I2S) output */
996#define BTA_DM_ROUTE_BT_MONO 0x04 /* routing over SCO */
997#define BTA_DM_ROUTE_BT_STEREO 0x08 /* routing over BT Stereo */
998#define BTA_DM_ROUTE_HOST 0x10 /* routing over Host */
999#define BTA_DM_ROUTE_FMTX 0x20 /* routing over FMTX */
1000#define BTA_DM_ROUTE_FMRX 0x40 /* routing over FMRX */
1001#define BTA_DM_ROUTE_BTSNK 0x80 /* routing over BT SNK */
The Android Open Source Project5738f832012-12-12 16:00:35 -08001002
Marie Janssene9e58ce2016-06-17 14:12:17 -07001003typedef uint8_t tBTA_DM_ROUTE_PATH;
The Android Open Source Project5738f832012-12-12 16:00:35 -08001004
The Android Open Source Project5738f832012-12-12 16:00:35 -08001005/* Device Identification (DI) data structure
1006*/
1007/* Used to set the DI record */
Myles Watsoncd1fd072016-11-09 13:17:43 -08001008typedef tSDP_DI_RECORD tBTA_DI_RECORD;
The Android Open Source Project5738f832012-12-12 16:00:35 -08001009/* Used to get the DI record */
Myles Watsoncd1fd072016-11-09 13:17:43 -08001010typedef tSDP_DI_GET_RECORD tBTA_DI_GET_RECORD;
The Android Open Source Project5738f832012-12-12 16:00:35 -08001011/* SDP discovery database */
Myles Watsoncd1fd072016-11-09 13:17:43 -08001012typedef tSDP_DISCOVERY_DB tBTA_DISCOVERY_DB;
The Android Open Source Project5738f832012-12-12 16:00:35 -08001013
Myles Watsoncd1fd072016-11-09 13:17:43 -08001014#ifndef BTA_DI_NUM_MAX
1015#define BTA_DI_NUM_MAX 3
The Android Open Source Project5738f832012-12-12 16:00:35 -08001016#endif
1017
Andre Eisenbach3aa60542013-03-22 18:00:51 -07001018/* Device features mask definitions */
Myles Watsoncd1fd072016-11-09 13:17:43 -08001019#define BTA_FEATURE_BYTES_PER_PAGE BTM_FEATURE_BYTES_PER_PAGE
1020#define BTA_EXT_FEATURES_PAGE_MAX BTM_EXT_FEATURES_PAGE_MAX
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -07001021/* ACL type
1022*/
Myles Watsoncd1fd072016-11-09 13:17:43 -08001023#define BTA_DM_LINK_TYPE_BR_EDR 0x01
1024#define BTA_DM_LINK_TYPE_LE 0x02
1025#define BTA_DM_LINK_TYPE_ALL 0xFF
Marie Janssene9e58ce2016-06-17 14:12:17 -07001026typedef uint8_t tBTA_DM_LINK_TYPE;
Andre Eisenbach3aa60542013-03-22 18:00:51 -07001027
Myles Watsoncd1fd072016-11-09 13:17:43 -08001028#define IMMEDIATE_DELY_MODE 0x00
1029#define ONFOUND_DELY_MODE 0x01
1030#define BATCH_DELY_MODE 0x02
1031#define ALLOW_ALL_FILTER 0x00
1032#define LOWEST_RSSI_VALUE 129
Satya Calloji6e2d9db2014-07-08 16:18:58 -07001033
The Android Open Source Project5738f832012-12-12 16:00:35 -08001034/*****************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001035 * External Function Declarations
1036 ****************************************************************************/
The Android Open Source Project5738f832012-12-12 16:00:35 -08001037
1038/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001039 *
1040 * Function BTA_EnableBluetooth
1041 *
1042 * Description This function initializes BTA and prepares BTA and the
1043 * Bluetooth protocol stack for use. This function is
1044 * typically called at startup or when Bluetooth services
1045 * are required by the phone. This function must be called
1046 * before calling any other API function.
1047 *
1048 *
1049 * Returns BTA_SUCCESS if successful.
1050 * BTA_FAIL if internal failure.
1051 *
1052 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08001053extern tBTA_STATUS BTA_EnableBluetooth(tBTA_DM_SEC_CBACK* p_cback);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001054
1055/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001056 *
1057 * Function BTA_DisableBluetooth
1058 *
1059 * Description This function disables BTA and the Bluetooth protocol
1060 * stack. It is called when BTA is no longer being used
1061 * by any application in the system.
1062 *
1063 *
1064 * Returns void
1065 *
1066 ******************************************************************************/
June R. Tate-Gans24933b52014-09-24 15:25:02 -07001067extern tBTA_STATUS BTA_DisableBluetooth(void);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001068
1069/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001070 *
1071 * Function BTA_EnableTestMode
1072 *
1073 * Description Enables bluetooth device under test mode
1074 *
1075 *
1076 * Returns tBTA_STATUS
1077 *
1078 ******************************************************************************/
Jakub Pawlowski154be112018-01-22 10:22:43 -08001079extern void BTA_EnableTestMode(void);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001080
1081/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001082 *
1083 * Function BTA_DisableTestMode
1084 *
1085 * Description Disable bluetooth device under test mode
1086 *
1087 *
1088 * Returns None
1089 *
1090 ******************************************************************************/
June R. Tate-Gans24933b52014-09-24 15:25:02 -07001091extern void BTA_DisableTestMode(void);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001092
1093/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001094 *
1095 * Function BTA_DmSetDeviceName
1096 *
1097 * Description This function sets the Bluetooth name of the local device.
1098 *
1099 *
1100 * Returns void
1101 *
1102 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08001103extern void BTA_DmSetDeviceName(char* p_name);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001104
1105/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001106 *
1107 * Function BTA_DmSetVisibility
1108 *
1109 * Description This function sets the Bluetooth connectable,discoverable,
Myles Watsoncd1fd072016-11-09 13:17:43 -08001110 * pairable and conn paired only modesmodes of the local
Myles Watson1baaae32016-11-09 14:25:23 -08001111 * device.
Myles Watsoncd1fd072016-11-09 13:17:43 -08001112 * This controls whether other Bluetooth devices can find and
Myles Watson1baaae32016-11-09 14:25:23 -08001113 * connect to the local device.
Myles Watson8af480e2016-11-09 10:40:23 -08001114 *
1115 *
1116 * Returns void
1117 *
1118 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08001119extern void BTA_DmSetVisibility(tBTA_DM_DISC disc_mode, tBTA_DM_CONN conn_mode,
1120 uint8_t pairable_mode, uint8_t conn_filter);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001121
1122/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001123 *
1124 * Function BTA_DmSearch
1125 *
1126 * Description This function searches for peer Bluetooth devices. It
1127 * first performs an inquiry; for each device found from the
1128 * inquiry it gets the remote name of the device. If
1129 * parameter services is nonzero, service discovery will be
1130 * performed on each device for the services specified.
1131 *
1132 *
1133 * Returns void
1134 *
1135 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08001136extern void BTA_DmSearch(tBTA_DM_INQ* p_dm_inq, tBTA_SERVICE_MASK services,
1137 tBTA_DM_SEARCH_CBACK* p_cback);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001138
1139/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001140 *
1141 * Function BTA_DmSearchCancel
1142 *
1143 * Description This function cancels a search that has been initiated
1144 * by calling BTA_DmSearch().
1145 *
1146 *
1147 * Returns void
1148 *
1149 ******************************************************************************/
June R. Tate-Gans24933b52014-09-24 15:25:02 -07001150extern void BTA_DmSearchCancel(void);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001151
1152/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001153 *
1154 * Function BTA_DmDiscover
1155 *
1156 * Description This function performs service discovery for the services
1157 * of a particular peer device.
1158 *
1159 *
1160 * Returns void
1161 *
1162 ******************************************************************************/
Jakub Pawlowskia484a882017-06-24 17:30:18 -07001163extern void BTA_DmDiscover(const RawAddress& bd_addr,
Jakub Pawlowskic2276b02017-06-09 16:00:25 -07001164 tBTA_SERVICE_MASK services,
Myles Watsoncd1fd072016-11-09 13:17:43 -08001165 tBTA_DM_SEARCH_CBACK* p_cback, bool sdp_search);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001166
The Android Open Source Project5738f832012-12-12 16:00:35 -08001167/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001168 *
1169 * Function BTA_DmDiscoverUUID
1170 *
1171 * Description This function performs service discovery for the services
1172 * of a particular peer device.
1173 *
1174 *
1175 * Returns void
1176 *
1177 ******************************************************************************/
Jakub Pawlowski819e2ec2017-07-10 09:56:09 -07001178extern void BTA_DmDiscoverUUID(const RawAddress& bd_addr,
1179 const bluetooth::Uuid& uuid,
Myles Watsoncd1fd072016-11-09 13:17:43 -08001180 tBTA_DM_SEARCH_CBACK* p_cback, bool sdp_search);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001181
1182/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001183 *
1184 * Function BTA_DmGetCachedRemoteName
1185 *
1186 * Description Retieve cached remote name if available
1187 *
1188 * Returns BTA_SUCCESS if cached name was retrieved
1189 * BTA_FAILURE if cached name is not available
1190 *
1191 ******************************************************************************/
Jakub Pawlowskia484a882017-06-24 17:30:18 -07001192tBTA_STATUS BTA_DmGetCachedRemoteName(const RawAddress& remote_device,
Myles Watsoncd1fd072016-11-09 13:17:43 -08001193 uint8_t** pp_cached_name);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001194
1195/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001196 *
1197 * Function BTA_DmBond
1198 *
1199 * Description This function initiates a bonding procedure with a peer
1200 * device. The bonding procedure enables authentication
1201 * and optionally encryption on the Bluetooth link.
1202 *
1203 *
1204 * Returns void
1205 *
1206 ******************************************************************************/
Jakub Pawlowskia484a882017-06-24 17:30:18 -07001207extern void BTA_DmBond(const RawAddress& bd_addr);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001208
1209/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001210 *
1211 * Function BTA_DmBondByTransport
1212 *
1213 * Description This function initiates a bonding procedure with a peer
Myles Watsoncd1fd072016-11-09 13:17:43 -08001214 * device by designated transport. The bonding procedure
Myles Watson1baaae32016-11-09 14:25:23 -08001215 * enables authentication and optionally encryption on the
1216 * Bluetooth link.
Myles Watson8af480e2016-11-09 10:40:23 -08001217 *
1218 *
1219 * Returns void
1220 *
1221 ******************************************************************************/
Jakub Pawlowskia484a882017-06-24 17:30:18 -07001222extern void BTA_DmBondByTransport(const RawAddress& bd_addr,
Jakub Pawlowskic2276b02017-06-09 16:00:25 -07001223 tBTA_TRANSPORT transport);
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -07001224
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -07001225/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001226 *
1227 * Function BTA_DmBondCancel
1228 *
1229 * Description This function cancels a bonding procedure with a peer
1230 * device.
1231 *
1232 *
1233 * Returns void
1234 *
1235 ******************************************************************************/
Jakub Pawlowskia484a882017-06-24 17:30:18 -07001236extern void BTA_DmBondCancel(const RawAddress& bd_addr);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001237
1238/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001239 *
1240 * Function BTA_DmPinReply
1241 *
1242 * Description This function provides a PIN when one is requested by DM
1243 * during a bonding procedure. The application should call
1244 * this function after the security callback is called with
1245 * a BTA_DM_PIN_REQ_EVT.
1246 *
1247 *
1248 * Returns void
1249 *
1250 ******************************************************************************/
Jakub Pawlowskia484a882017-06-24 17:30:18 -07001251extern void BTA_DmPinReply(const RawAddress& bd_addr, bool accept,
Jakub Pawlowskic2276b02017-06-09 16:00:25 -07001252 uint8_t pin_len, uint8_t* p_pin);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001253
The Android Open Source Project5738f832012-12-12 16:00:35 -08001254/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001255 *
1256 * Function BTA_DmLocalOob
1257 *
1258 * Description This function retrieves the OOB data from local controller.
1259 * The result is reported by bta_dm_co_loc_oob().
1260 *
1261 * Returns void
1262 *
1263 ******************************************************************************/
June R. Tate-Gans24933b52014-09-24 15:25:02 -07001264extern void BTA_DmLocalOob(void);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001265
1266/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001267 *
1268 * Function BTA_DmConfirm
1269 *
1270 * Description This function accepts or rejects the numerical value of the
1271 * Simple Pairing process on BTA_DM_SP_CFM_REQ_EVT
1272 *
1273 * Returns void
1274 *
1275 ******************************************************************************/
Jakub Pawlowskia484a882017-06-24 17:30:18 -07001276extern void BTA_DmConfirm(const RawAddress& bd_addr, bool accept);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001277
1278/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001279 *
1280 * Function BTA_DmAddDevice
1281 *
1282 * Description This function adds a device to the security database list
1283 * of peer devices. This function would typically be called
1284 * at system startup to initialize the security database with
1285 * known peer devices. This is a direct execution function
1286 * that may lock task scheduling on some platforms.
1287 *
1288 * Returns void
1289 *
1290 ******************************************************************************/
Jakub Pawlowskia484a882017-06-24 17:30:18 -07001291extern void BTA_DmAddDevice(const RawAddress& bd_addr, DEV_CLASS dev_class,
June R. Tate-Gans24933b52014-09-24 15:25:02 -07001292 LINK_KEY link_key, tBTA_SERVICE_MASK trusted_mask,
Marie Janssene9e58ce2016-06-17 14:12:17 -07001293 bool is_trusted, uint8_t key_type,
1294 tBTA_IO_CAP io_cap, uint8_t pin_length);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001295
1296/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001297 *
1298 * Function BTA_DmRemoveDevice
1299 *
1300 * Description This function removes a device from the security database.
1301 * This is a direct execution function that may lock task
1302 * scheduling on some platforms.
1303 *
1304 *
1305 * Returns BTA_SUCCESS if successful.
1306 * BTA_FAIL if operation failed.
1307 *
1308 ******************************************************************************/
Jakub Pawlowskia484a882017-06-24 17:30:18 -07001309extern tBTA_STATUS BTA_DmRemoveDevice(const RawAddress& bd_addr);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001310
1311/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001312 *
1313 * Function BTA_GetEirService
1314 *
1315 * Description This function is called to get BTA service mask from EIR.
1316 *
1317 * Parameters p_eir - pointer of EIR significant part
Jakub Pawlowski0595ca02017-02-07 12:15:06 -08001318 * eir_len - EIR length
Myles Watson8af480e2016-11-09 10:40:23 -08001319 * p_services - return the BTA service mask
1320 *
1321 * Returns None
1322 *
1323 ******************************************************************************/
Jakub Pawlowski0595ca02017-02-07 12:15:06 -08001324extern void BTA_GetEirService(uint8_t* p_eir, size_t eir_len,
1325 tBTA_SERVICE_MASK* p_services);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001326
Andre Eisenbach5c0b0522014-06-18 12:20:37 -07001327/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001328 *
1329 * Function BTA_DmGetConnectionState
1330 *
1331 * Description Returns whether the remote device is currently connected.
1332 *
1333 * Returns 0 if the device is NOT connected.
1334 *
1335 ******************************************************************************/
Jakub Pawlowskia484a882017-06-24 17:30:18 -07001336extern uint16_t BTA_DmGetConnectionState(const RawAddress& bd_addr);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001337
1338/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001339 *
1340 * Function BTA_DmSetLocalDiRecord
1341 *
1342 * Description This function adds a DI record to the local SDP database.
1343 *
1344 * Returns BTA_SUCCESS if record set sucessfully, otherwise error code.
1345 *
1346 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08001347extern tBTA_STATUS BTA_DmSetLocalDiRecord(tBTA_DI_RECORD* p_device_info,
1348 uint32_t* p_handle);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001349
1350/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001351 *
1352 *
1353 * Function BTA_DmCloseACL
1354 *
Myles Watsoncd1fd072016-11-09 13:17:43 -08001355 * Description This function force to close an ACL connection and remove
1356 the
Myles Watson8af480e2016-11-09 10:40:23 -08001357 * device from the security database list of known devices.
1358 *
1359 * Parameters: bd_addr - Address of the peer device
1360 * remove_dev - remove device or not after link down
1361 * transport - which transport to close
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -07001362
Myles Watson8af480e2016-11-09 10:40:23 -08001363 *
1364 * Returns void.
1365 *
1366 ******************************************************************************/
Jakub Pawlowskia484a882017-06-24 17:30:18 -07001367extern void BTA_DmCloseACL(const RawAddress& bd_addr, bool remove_dev,
Myles Watsoncd1fd072016-11-09 13:17:43 -08001368 tBTA_TRANSPORT transport);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001369
The Android Open Source Project5738f832012-12-12 16:00:35 -08001370/* BLE related API functions */
1371/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001372 *
1373 * Function BTA_DmBleSecurityGrant
1374 *
1375 * Description Grant security request access.
1376 *
1377 * Parameters: bd_addr - BD address of the peer
1378 * res - security grant status.
1379 *
1380 * Returns void
1381 *
1382 ******************************************************************************/
Jakub Pawlowskia484a882017-06-24 17:30:18 -07001383extern void BTA_DmBleSecurityGrant(const RawAddress& bd_addr,
Jakub Pawlowskic2276b02017-06-09 16:00:25 -07001384 tBTA_DM_BLE_SEC_GRANT res);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001385
Jakub Pawlowski83211b02016-12-07 11:25:15 -08001386/**
1387 * Set BLE connectable mode to auto connect
1388 */
1389extern void BTA_DmBleStartAutoConn();
The Android Open Source Project5738f832012-12-12 16:00:35 -08001390
1391/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001392 *
1393 * Function BTA_DmBlePasskeyReply
1394 *
1395 * Description Send BLE SMP passkey reply.
1396 *
1397 * Parameters: bd_addr - BD address of the peer
1398 * accept - passkey entry sucessful or declined.
1399 * passkey - passkey value, must be a 6 digit number,
1400 * can be lead by 0.
1401 *
1402 * Returns void
1403 *
1404 ******************************************************************************/
Jakub Pawlowskia484a882017-06-24 17:30:18 -07001405extern void BTA_DmBlePasskeyReply(const RawAddress& bd_addr, bool accept,
Myles Watsoncd1fd072016-11-09 13:17:43 -08001406 uint32_t passkey);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001407
1408/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001409 *
1410 * Function BTA_DmBleConfirmReply
1411 *
1412 * Description Send BLE SMP SC user confirmation reply.
1413 *
1414 * Parameters: bd_addr - BD address of the peer
Myles Watsoncd1fd072016-11-09 13:17:43 -08001415 * accept - numbers to compare are the same or
Myles Watson1baaae32016-11-09 14:25:23 -08001416 * different.
Myles Watson8af480e2016-11-09 10:40:23 -08001417 *
1418 * Returns void
1419 *
1420 ******************************************************************************/
Jakub Pawlowskia484a882017-06-24 17:30:18 -07001421extern void BTA_DmBleConfirmReply(const RawAddress& bd_addr, bool accept);
Satya Calloji444a8da2015-03-06 10:38:22 -08001422
1423/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001424 *
1425 * Function BTA_DmAddBleDevice
1426 *
1427 * Description Add a BLE device. This function will be normally called
1428 * during host startup to restore all required information
1429 * for a LE device stored in the NVRAM.
1430 *
1431 * Parameters: bd_addr - BD address of the peer
1432 * dev_type - Remote device's device type.
1433 * addr_type - LE device address type.
1434 *
1435 * Returns void
1436 *
1437 ******************************************************************************/
Jakub Pawlowskia484a882017-06-24 17:30:18 -07001438extern void BTA_DmAddBleDevice(const RawAddress& bd_addr,
Jakub Pawlowskic2276b02017-06-09 16:00:25 -07001439 tBLE_ADDR_TYPE addr_type,
June R. Tate-Gans24933b52014-09-24 15:25:02 -07001440 tBT_DEVICE_TYPE dev_type);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001441
The Android Open Source Project5738f832012-12-12 16:00:35 -08001442/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001443 *
1444 * Function BTA_DmAddBleKey
1445 *
1446 * Description Add/modify LE device information. This function will be
1447 * normally called during host startup to restore all required
1448 * information stored in the NVRAM.
1449 *
1450 * Parameters: bd_addr - BD address of the peer
1451 * p_le_key - LE key values.
1452 * key_type - LE SMP key type.
1453 *
1454 * Returns void
1455 *
1456 ******************************************************************************/
Jakub Pawlowskia484a882017-06-24 17:30:18 -07001457extern void BTA_DmAddBleKey(const RawAddress& bd_addr,
Jakub Pawlowskic2276b02017-06-09 16:00:25 -07001458 tBTA_LE_KEY_VALUE* p_le_key,
Myles Watsoncd1fd072016-11-09 13:17:43 -08001459 tBTA_LE_KEY_TYPE key_type);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001460
1461/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001462 *
1463 * Function BTA_DmSetBlePrefConnParams
1464 *
1465 * Description This function is called to set the preferred connection
1466 * parameters when default connection parameter is not desired.
1467 *
1468 * Parameters: bd_addr - BD address of the peripheral
1469 * min_conn_int - minimum preferred connection interval
1470 * max_conn_int - maximum preferred connection interval
1471 * slave_latency - preferred slave latency
1472 * supervision_tout - preferred supervision timeout
1473 *
1474 *
1475 * Returns void
1476 *
1477 ******************************************************************************/
Jakub Pawlowskia484a882017-06-24 17:30:18 -07001478extern void BTA_DmSetBlePrefConnParams(const RawAddress& bd_addr,
Myles Watsoncd1fd072016-11-09 13:17:43 -08001479 uint16_t min_conn_int,
1480 uint16_t max_conn_int,
1481 uint16_t slave_latency,
1482 uint16_t supervision_tout);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001483
1484/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001485 *
1486 * Function BTA_DmSetBleConnScanParams
1487 *
1488 * Description This function is called to set scan parameters used in
1489 * BLE connection request
1490 *
1491 * Parameters: scan_interval - scan interval
1492 * scan_window - scan window
1493 *
1494 * Returns void
1495 *
1496 ******************************************************************************/
Marie Janssene9e58ce2016-06-17 14:12:17 -07001497extern void BTA_DmSetBleConnScanParams(uint32_t scan_interval,
1498 uint32_t scan_window);
Satya Calloji5725fc62015-03-31 13:24:32 -07001499
1500/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001501 *
Myles Watson8af480e2016-11-09 10:40:23 -08001502 * Function BTA_DmSearchExt
1503 *
Myles Watsoncd1fd072016-11-09 13:17:43 -08001504 * Description This function searches for peer Bluetooth devices. It
Myles Watson1baaae32016-11-09 14:25:23 -08001505 * performs an inquiry and gets the remote name for devices.
1506 * Service discovery is done if services is non zero
Myles Watson8af480e2016-11-09 10:40:23 -08001507 *
1508 * Parameters p_dm_inq: inquiry conditions
Myles Watsoncd1fd072016-11-09 13:17:43 -08001509 * services: if service is not empty, service discovery will be
Myles Watson1baaae32016-11-09 14:25:23 -08001510 * done.
Myles Watsoncd1fd072016-11-09 13:17:43 -08001511 * for all GATT based service condition, put
Myles Watson1baaae32016-11-09 14:25:23 -08001512 * num_uuid, and p_uuid is the pointer to the list of
1513 * UUID values.
Myles Watson8af480e2016-11-09 10:40:23 -08001514 * p_cback: callback functino when search is completed.
1515 *
1516 *
1517 *
1518 * Returns void
1519 *
1520 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08001521extern void BTA_DmSearchExt(tBTA_DM_INQ* p_dm_inq,
1522 tBTA_SERVICE_MASK_EXT* p_services,
1523 tBTA_DM_SEARCH_CBACK* p_cback);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001524
1525/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001526 *
1527 * Function BTA_DmDiscoverExt
1528 *
1529 * Description This function does service discovery for services of a
1530 * peer device. When services.num_uuid is 0, it indicates all
1531 * GATT based services are to be searched; other wise a list of
1532 * UUID of interested services should be provided through
1533 * services.p_uuid.
1534 *
1535 *
1536 *
1537 * Returns void
1538 *
1539 ******************************************************************************/
Jakub Pawlowskia484a882017-06-24 17:30:18 -07001540extern void BTA_DmDiscoverExt(const RawAddress& bd_addr,
Myles Watsoncd1fd072016-11-09 13:17:43 -08001541 tBTA_SERVICE_MASK_EXT* p_services,
1542 tBTA_DM_SEARCH_CBACK* p_cback, bool sdp_search);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001543
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -07001544/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001545 *
1546 * Function BTA_DmDiscoverByTransport
1547 *
1548 * Description This function does service discovery on particular transport
1549 * for services of a
1550 * peer device. When services.num_uuid is 0, it indicates all
1551 * GATT based services are to be searched; other wise a list of
1552 * UUID of interested services should be provided through
1553 * p_services->p_uuid.
1554 *
1555 *
1556 *
1557 * Returns void
1558 *
1559 ******************************************************************************/
Jakub Pawlowskia484a882017-06-24 17:30:18 -07001560extern void BTA_DmDiscoverByTransport(const RawAddress& bd_addr,
Myles Watsoncd1fd072016-11-09 13:17:43 -08001561 tBTA_SERVICE_MASK_EXT* p_services,
1562 tBTA_DM_SEARCH_CBACK* p_cback,
1563 bool sdp_search,
June R. Tate-Gans24933b52014-09-24 15:25:02 -07001564 tBTA_TRANSPORT transport);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001565
1566/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001567 *
1568 * Function BTA_DmSetEncryption
1569 *
1570 * Description This function is called to ensure that connection is
1571 * encrypted. Should be called only on an open connection.
1572 * Typically only needed for connections that first want to
1573 * bring up unencrypted links, then later encrypt them.
1574 *
1575 * Parameters: bd_addr - Address of the peer device
1576 * transport - transport of the link to be encruypted
1577 * p_callback - Pointer to callback function to indicat the
1578 * link encryption status
1579 * sec_act - This is the security action to indicate
Myles Watson1baaae32016-11-09 14:25:23 -08001580 * what kind of BLE security level is required
1581 * for the BLE link if BLE is supported
1582 * Note: This parameter is ignored for
1583 * BR/EDR or if BLE is not supported.
Myles Watson8af480e2016-11-09 10:40:23 -08001584 *
1585 * Returns void
1586 *
1587 *
1588 ******************************************************************************/
Jakub Pawlowskia484a882017-06-24 17:30:18 -07001589extern void BTA_DmSetEncryption(const RawAddress& bd_addr,
Jakub Pawlowskic2276b02017-06-09 16:00:25 -07001590 tBTA_TRANSPORT transport,
Myles Watsoncd1fd072016-11-09 13:17:43 -08001591 tBTA_DM_ENCRYPT_CBACK* p_callback,
June R. Tate-Gans24933b52014-09-24 15:25:02 -07001592 tBTA_DM_BLE_SEC_ACT sec_act);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001593
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -08001594/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001595 *
1596 * Function BTA_DmBleObserve
1597 *
1598 * Description This procedure keep the device listening for advertising
1599 * events from a broadcast device.
1600 *
1601 * Parameters start: start or stop observe.
Myles Watsoncd1fd072016-11-09 13:17:43 -08001602 * duration : Duration of the scan. Continuous scan if 0 is
Myles Watson1baaae32016-11-09 14:25:23 -08001603 * passed
Myles Watson8af480e2016-11-09 10:40:23 -08001604 * p_results_cb: Callback to be called with scan results
1605 *
1606 * Returns void
1607 *
1608 ******************************************************************************/
Marie Janssene9e58ce2016-06-17 14:12:17 -07001609extern void BTA_DmBleObserve(bool start, uint8_t duration,
Myles Watsoncd1fd072016-11-09 13:17:43 -08001610 tBTA_DM_SEARCH_CBACK* p_results_cb);
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -08001611
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -08001612/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001613 *
1614 * Function BTA_DmBleConfigLocalPrivacy
1615 *
1616 * Description Enable/disable privacy on the local device
1617 *
1618 * Parameters: privacy_enable - enable/disabe privacy on remote device.
1619 *
1620 * Returns void
1621 *
1622 ******************************************************************************/
Marie Janssene9e58ce2016-06-17 14:12:17 -07001623extern void BTA_DmBleConfigLocalPrivacy(bool privacy_enable);
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -08001624
1625/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001626 *
1627 * Function BTA_DmBleEnableRemotePrivacy
1628 *
1629 * Description Enable/disable privacy on a remote device
1630 *
1631 * Parameters: bd_addr - BD address of the peer
1632 * privacy_enable - enable/disabe privacy on remote device.
1633 *
1634 * Returns void
1635 *
1636 ******************************************************************************/
Jakub Pawlowskia484a882017-06-24 17:30:18 -07001637extern void BTA_DmBleEnableRemotePrivacy(const RawAddress& bd_addr,
Jakub Pawlowskic2276b02017-06-09 16:00:25 -07001638 bool privacy_enable);
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -08001639
Jakub Pawlowski6a966612016-08-16 03:25:45 -07001640/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001641 *
1642 * Function BTA_DmBleUpdateConnectionParams
1643 *
Myles Watsoncd1fd072016-11-09 13:17:43 -08001644 * Description Update connection parameters, can only be used when
Myles Watson1baaae32016-11-09 14:25:23 -08001645 * connection is up.
Myles Watson8af480e2016-11-09 10:40:23 -08001646 *
1647 * Parameters: bd_addr - BD address of the peer
Myles Watson1baaae32016-11-09 14:25:23 -08001648 * min_int - minimum connection interval, [0x0004 ~ 0x4000]
1649 * max_int - maximum connection interval, [0x0004 ~ 0x4000]
1650 * latency - slave latency [0 ~ 500]
1651 * timeout - supervision timeout [0x000a ~ 0xc80]
Myles Watson8af480e2016-11-09 10:40:23 -08001652 *
1653 * Returns void
1654 *
1655 ******************************************************************************/
Jakub Pawlowskia484a882017-06-24 17:30:18 -07001656extern void BTA_DmBleUpdateConnectionParams(const RawAddress& bd_addr,
Myles Watsoncd1fd072016-11-09 13:17:43 -08001657 uint16_t min_int, uint16_t max_int,
Stanley Tnga0b984e2018-03-19 12:48:04 -07001658 uint16_t latency, uint16_t timeout,
1659 uint16_t min_ce_len,
1660 uint16_t max_ce_len);
Satya Callojic4e25962014-05-10 23:46:24 -07001661
1662/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001663 *
1664 * Function BTA_DmBleSetDataLength
1665 *
1666 * Description This function is to set maximum LE data packet size
1667 *
1668 * Returns void
1669 *
1670 ******************************************************************************/
Jakub Pawlowskia484a882017-06-24 17:30:18 -07001671extern void BTA_DmBleSetDataLength(const RawAddress& remote_device,
Myles Watsoncd1fd072016-11-09 13:17:43 -08001672 uint16_t tx_data_length);
Priti Aghera636d6712014-12-18 13:55:48 -08001673
1674/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001675 *
Myles Watson8af480e2016-11-09 10:40:23 -08001676 * Function BTA_DmBleGetEnergyInfo
1677 *
1678 * Description This function is called to obtain the energy info
1679 *
1680 * Parameters p_cmpl_cback - Command complete callback
1681 *
1682 * Returns void
1683 *
1684 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08001685extern void BTA_DmBleGetEnergyInfo(tBTA_BLE_ENERGY_INFO_CBACK* p_cmpl_cback);
Satya Callojie5ba8842014-07-03 17:18:02 -07001686
Prerepa Viswanadham16fe0822014-08-07 11:38:06 -07001687/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001688 *
1689 * Function BTA_BrcmInit
1690 *
Myles Watsoncd1fd072016-11-09 13:17:43 -08001691 * Description This function initializes Broadcom specific VS handler in
Myles Watson1baaae32016-11-09 14:25:23 -08001692 * BTA
Myles Watson8af480e2016-11-09 10:40:23 -08001693 *
1694 * Returns void
1695 *
1696 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08001697extern void BTA_VendorInit(void);
Prerepa Viswanadham16fe0822014-08-07 11:38:06 -07001698
1699/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -08001700 *
1701 * Function BTA_BrcmCleanup
1702 *
Myles Watsoncd1fd072016-11-09 13:17:43 -08001703 * Description This function frees up Broadcom specific VS specific dynamic
Myles Watson1baaae32016-11-09 14:25:23 -08001704 * memory
Myles Watson8af480e2016-11-09 10:40:23 -08001705 *
1706 * Returns void
1707 *
1708 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -08001709extern void BTA_VendorCleanup(void);
Prerepa Viswanadham16fe0822014-08-07 11:38:06 -07001710
The Android Open Source Project5738f832012-12-12 16:00:35 -08001711#endif /* BTA_API_H */