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