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 "common/bt_target.h" 29 #include "stack/bt_types.h" 30 #include "stack/btm_api.h" 31 // #include "uipc_msg.h" 32 #include "stack/sdp_api.h" 33 34 // #if BLE_INCLUDED == TRUE 35 #include "stack/btm_ble_api.h" 36 // #endif 37 38 /***************************************************************************** 39 ** Constants and data types 40 *****************************************************************************/ 41 42 /* Status Return Value */ 43 #define BTA_SUCCESS 0 /* Successful operation. */ 44 #define BTA_FAILURE 1 /* Generic failure. */ 45 #define BTA_PENDING 2 /* API cannot be completed right now */ 46 #define BTA_BUSY 3 47 #define BTA_NO_RESOURCES 4 48 #define BTA_WRONG_MODE 5 49 #define BTA_EIR_TOO_LARGE 6 50 51 typedef UINT8 tBTA_STATUS; 52 53 /* 54 * Service ID 55 * 56 * NOTES: When you add a new Service ID for BTA AND require to change the value of BTA_MAX_SERVICE_ID, 57 * make sure that the correct security ID of the new service from Security service definitions (stack/btm_api.h) 58 * should be added to bta_service_id_to_btm_srv_id_lkup_tbl table in bta_dm_act.c. 59 */ 60 61 #define BTA_RES_SERVICE_ID 0 /* Reserved */ 62 #define BTA_SPP_SERVICE_ID 1 /* Serial port profile. */ 63 #define BTA_DUN_SERVICE_ID 2 /* Dial-up networking profile. */ 64 #define BTA_A2DP_SOURCE_SERVICE_ID 3 /* A2DP Source profile. */ 65 #define BTA_LAP_SERVICE_ID 4 /* LAN access profile. */ 66 #define BTA_HSP_SERVICE_ID 5 /* Headset profile. */ 67 #define BTA_HFP_SERVICE_ID 6 /* Hands-free profile. */ 68 #define BTA_OPP_SERVICE_ID 7 /* Object push */ 69 #define BTA_FTP_SERVICE_ID 8 /* File transfer */ 70 #define BTA_CTP_SERVICE_ID 9 /* Cordless Terminal */ 71 #define BTA_ICP_SERVICE_ID 10 /* Intercom Terminal */ 72 #define BTA_SYNC_SERVICE_ID 11 /* Synchronization */ 73 #define BTA_BPP_SERVICE_ID 12 /* Basic printing profile */ 74 #define BTA_BIP_SERVICE_ID 13 /* Basic Imaging profile */ 75 #define BTA_PANU_SERVICE_ID 14 /* PAN User */ 76 #define BTA_NAP_SERVICE_ID 15 /* PAN Network access point */ 77 #define BTA_GN_SERVICE_ID 16 /* PAN Group Ad-hoc networks */ 78 #define BTA_SAP_SERVICE_ID 17 /* SIM Access profile */ 79 #define BTA_A2DP_SINK_SERVICE_ID 18 /* A2DP Sink */ 80 #define BTA_AVRCP_SERVICE_ID 19 /* A/V remote control */ 81 #define BTA_HID_SERVICE_ID 20 /* HID Host*/ 82 #define BTA_VDP_SERVICE_ID 21 /* Video distribution */ 83 #define BTA_PBAP_SERVICE_ID 22 /* PhoneBook Access Server*/ 84 #define BTA_HSP_HS_SERVICE_ID 23 /* HFP HS role */ 85 #define BTA_HFP_HS_SERVICE_ID 24 /* HSP HS role */ 86 #define BTA_MAP_SERVICE_ID 25 /* Message Access Profile */ 87 #define BTA_MN_SERVICE_ID 26 /* Message Notification Service */ 88 #define BTA_HDP_SERVICE_ID 27 /* Health Device Profile */ 89 #define BTA_PCE_SERVICE_ID 28 /* PhoneBook Access Client*/ 90 #define BTA_SDP_SERVICE_ID 29 /* SDP Search*/ 91 #if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE 92 /* BLE profile service ID */ 93 #define BTA_BLE_SERVICE_ID 30 /* GATT profile */ 94 95 // btla-specific ++ 96 #define BTA_USER_SERVICE_ID 31 /* User requested UUID */ 97 98 #define BTA_MAX_SERVICE_ID 32 99 // btla-specific -- 100 #else 101 #define BTA_USER_SERVICE_ID 30 /* User requested UUID */ 102 #define BTA_MAX_SERVICE_ID 31 103 #endif 104 /* service IDs (BTM_SEC_SERVICE_FIRST_EMPTY + 1) to (BTM_SEC_MAX_SERVICES - 1) 105 * are used by BTA JV */ 106 #define BTA_FIRST_JV_SERVICE_ID (BTM_SEC_SERVICE_FIRST_EMPTY + 1) 107 #define BTA_LAST_JV_SERVICE_ID (BTM_SEC_MAX_SERVICES - 1) 108 109 typedef UINT8 tBTA_SERVICE_ID; 110 111 /* Service ID Mask */ 112 #define BTA_RES_SERVICE_MASK 0x00000001 /* Reserved */ 113 #define BTA_SPP_SERVICE_MASK 0x00000002 /* Serial port profile. */ 114 #define BTA_DUN_SERVICE_MASK 0x00000004 /* Dial-up networking profile. */ 115 #define BTA_FAX_SERVICE_MASK 0x00000008 /* Fax profile. */ 116 #define BTA_LAP_SERVICE_MASK 0x00000010 /* LAN access profile. */ 117 #define BTA_HSP_SERVICE_MASK 0x00000020 /* HSP AG role. */ 118 #define BTA_HFP_SERVICE_MASK 0x00000040 /* HFP AG role */ 119 #define BTA_OPP_SERVICE_MASK 0x00000080 /* Object push */ 120 #define BTA_FTP_SERVICE_MASK 0x00000100 /* File transfer */ 121 #define BTA_CTP_SERVICE_MASK 0x00000200 /* Cordless Terminal */ 122 #define BTA_ICP_SERVICE_MASK 0x00000400 /* Intercom Terminal */ 123 #define BTA_SYNC_SERVICE_MASK 0x00000800 /* Synchronization */ 124 #define BTA_BPP_SERVICE_MASK 0x00001000 /* Print server */ 125 #define BTA_BIP_SERVICE_MASK 0x00002000 /* Basic Imaging */ 126 #define BTA_PANU_SERVICE_MASK 0x00004000 /* PAN User */ 127 #define BTA_NAP_SERVICE_MASK 0x00008000 /* PAN Network access point */ 128 #define BTA_GN_SERVICE_MASK 0x00010000 /* PAN Group Ad-hoc networks */ 129 #define BTA_SAP_SERVICE_MASK 0x00020000 /* PAN Group Ad-hoc networks */ 130 #define BTA_A2DP_SERVICE_MASK 0x00040000 /* Advanced audio distribution */ 131 #define BTA_AVRCP_SERVICE_MASK 0x00080000 /* A/V remote control */ 132 #define BTA_HID_SERVICE_MASK 0x00100000 /* HID */ 133 #define BTA_VDP_SERVICE_MASK 0x00200000 /* Video distribution */ 134 #define BTA_PBAP_SERVICE_MASK 0x00400000 /* Phone Book Server */ 135 #define BTA_HSP_HS_SERVICE_MASK 0x00800000 /* HFP HS role */ 136 #define BTA_HFP_HS_SERVICE_MASK 0x01000000 /* HSP HS role */ 137 #define BTA_MAS_SERVICE_MASK 0x02000000 /* Message Access Profile */ 138 #define BTA_MN_SERVICE_MASK 0x04000000 /* Message Notification Profile */ 139 #define BTA_HL_SERVICE_MASK 0x08000000 /* Health Device Profile */ 140 #define BTA_PCE_SERVICE_MASK 0x10000000 /* Phone Book Client */ 141 142 #if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE 143 #define BTA_BLE_SERVICE_MASK 0x20000000 /* GATT based service */ 144 // btla-specific ++ 145 #define BTA_USER_SERVICE_MASK 0x40000000 /* Message Notification Profile */ 146 // btla-specific -- 147 #else 148 // btla-specific ++ 149 #define BTA_USER_SERVICE_MASK 0x20000000 /* Message Notification Profile */ 150 // btla-specific -- 151 #endif 152 153 #if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE 154 #define BTA_ALL_SERVICE_MASK 0x3FFFFFFF /* All services supported by BTA. */ 155 #else 156 #define BTA_ALL_SERVICE_MASK 0x1FFFFFFF /* All services supported by BTA. */ 157 #endif 158 159 typedef UINT32 tBTA_SERVICE_MASK; 160 161 /* extended service mask, including mask with one or more GATT UUID */ 162 typedef struct { 163 tBTA_SERVICE_MASK srvc_mask; 164 UINT8 num_uuid; 165 tBT_UUID *p_uuid; 166 } tBTA_SERVICE_MASK_EXT; 167 168 /* Security Setting Mask */ 169 #define BTA_SEC_NONE BTM_SEC_NONE /* No security. */ 170 #define BTA_SEC_AUTHORIZE (BTM_SEC_IN_AUTHORIZE ) /* Authorization required (only needed for out going connection )*/ 171 #define BTA_SEC_AUTHENTICATE (BTM_SEC_IN_AUTHENTICATE | BTM_SEC_OUT_AUTHENTICATE) /* Authentication required. */ 172 #define BTA_SEC_ENCRYPT (BTM_SEC_IN_ENCRYPT | BTM_SEC_OUT_ENCRYPT) /* Encryption required. */ 173 #define BTA_SEC_MODE4_LEVEL4 (BTM_SEC_MODE4_LEVEL4) /* Mode 4 level 4 service, i.e. incoming/outgoing MITM and P-256 encryption */ 174 #define BTA_SEC_MITM (BTM_SEC_IN_MITM | BTM_SEC_OUT_MITM) /* Man-In-The_Middle protection */ 175 #define BTA_SEC_IN_16_DIGITS (BTM_SEC_IN_MIN_16_DIGIT_PIN) /* Min 16 digit for pin code */ 176 177 typedef UINT16 tBTA_SEC; 178 179 typedef tBTM_GET_DEV_NAME_CBACK tBTA_GET_DEV_NAME_CBACK; 180 181 /* Ignore for Discoverable, Connectable, Pairable and Connectable Paired only device modes */ 182 #define BTA_DM_IGNORE 0x00FF 183 184 /* Ignore for Discoverable, Connectable only for LE modes */ 185 #define BTA_DM_LE_IGNORE 0xFF00 186 187 #define BTA_APP_ID_1 1 /* PM example profile 1 */ 188 #define BTA_APP_ID_PAN_MULTI 0xFE /* app id for pan multiple connection */ 189 #define BTA_ALL_APP_ID 0xFF 190 191 /* Discoverable Modes */ 192 #define BTA_DM_NON_DISC BTM_NON_DISCOVERABLE /* Device is not discoverable. */ 193 #define BTA_DM_GENERAL_DISC BTM_GENERAL_DISCOVERABLE /* General discoverable. */ 194 #define BTA_DM_LIMITED_DISC BTM_LIMITED_DISCOVERABLE /* Limited discoverable. */ 195 #if ((defined BLE_INCLUDED) && (BLE_INCLUDED == TRUE)) 196 #define BTA_DM_BLE_NON_DISCOVERABLE BTM_BLE_NON_DISCOVERABLE /* Device is not LE discoverable */ 197 #define BTA_DM_BLE_GENERAL_DISCOVERABLE BTM_BLE_GENERAL_DISCOVERABLE /* Device is LE General discoverable */ 198 #define BTA_DM_BLE_LIMITED_DISCOVERABLE BTM_BLE_LIMITED_DISCOVERABLE /* Device is LE Limited discoverable */ 199 #endif 200 typedef UINT16 tBTA_DM_DISC; /* this discoverability mode is a bit mask among BR mode and LE mode */ 201 202 /* Connectable Modes */ 203 #define BTA_DM_NON_CONN BTM_NON_CONNECTABLE /* Device is not connectable. */ 204 #define BTA_DM_CONN BTM_CONNECTABLE /* Device is connectable. */ 205 #if ((defined BLE_INCLUDED) && (BLE_INCLUDED == TRUE)) 206 #define BTA_DM_BLE_NON_CONNECTABLE BTM_BLE_NON_CONNECTABLE /* Device is LE non-connectable. */ 207 #define BTA_DM_BLE_CONNECTABLE BTM_BLE_CONNECTABLE /* Device is LE connectable. */ 208 #endif 209 210 // btla-specific ++ 211 typedef UINT16 tBTA_DM_CONN; 212 213 #define BTA_TRANSPORT_UNKNOWN 0 214 #define BTA_TRANSPORT_BR_EDR BT_TRANSPORT_BR_EDR 215 #define BTA_TRANSPORT_LE BT_TRANSPORT_LE 216 typedef tBT_TRANSPORT tBTA_TRANSPORT; 217 218 /* Pairable Modes */ 219 #define BTA_DM_PAIRABLE 1 220 #define BTA_DM_NON_PAIRABLE 0 221 222 /* Connectable Paired Only Mode */ 223 #define BTA_DM_CONN_ALL 0 224 #define BTA_DM_CONN_PAIRED 1 225 226 /* Inquiry Modes */ 227 #define BTA_DM_INQUIRY_NONE BTM_INQUIRY_NONE /*No BR inquiry. */ 228 #define BTA_DM_GENERAL_INQUIRY BTM_GENERAL_INQUIRY /* Perform general inquiry. */ 229 #define BTA_DM_LIMITED_INQUIRY BTM_LIMITED_INQUIRY /* Perform limited inquiry. */ 230 231 #if ((defined BLE_INCLUDED) && (BLE_INCLUDED == TRUE)) 232 #define BTA_BLE_INQUIRY_NONE BTM_BLE_INQUIRY_NONE 233 #define BTA_BLE_GENERAL_INQUIRY BTM_BLE_GENERAL_INQUIRY /* Perform LE general inquiry. */ 234 #define BTA_BLE_LIMITED_INQUIRY BTM_BLE_LIMITED_INQUIRY /* Perform LE limited inquiry. */ 235 #endif 236 typedef UINT8 tBTA_DM_INQ_MODE; 237 238 /* Inquiry Filter Type */ 239 #define BTA_DM_INQ_CLR BTM_CLR_INQUIRY_FILTER /* Clear inquiry filter. */ 240 #define BTA_DM_INQ_DEV_CLASS BTM_FILTER_COND_DEVICE_CLASS /* Filter on device class. */ 241 #define BTA_DM_INQ_BD_ADDR BTM_FILTER_COND_BD_ADDR /* Filter on a specific BD address. */ 242 243 typedef UINT8 tBTA_DM_INQ_FILT; 244 245 /* Authorize Response */ 246 #define BTA_DM_AUTH_PERM 0 /* Authorized for future connections to the service */ 247 #define BTA_DM_AUTH_TEMP 1 /* Authorized for current connection only */ 248 #define BTA_DM_NOT_AUTH 2 /* Not authorized for the service */ 249 250 typedef UINT8 tBTA_AUTH_RESP; 251 252 /* M/S preferred roles */ 253 #define BTA_ANY_ROLE 0x00 254 #define BTA_MASTER_ROLE_PREF 0x01 255 #define BTA_MASTER_ROLE_ONLY 0x02 256 #define BTA_SLAVE_ROLE_ONLY 0x03 /* Used for PANU only, skip role switch to master */ 257 258 typedef UINT8 tBTA_PREF_ROLES; 259 260 enum { 261 262 BTA_DM_NO_SCATTERNET, /* Device doesn't support scatternet, it might 263 support "role switch during connection" for 264 an incoming connection, when it already has 265 another connection in master role */ 266 BTA_DM_PARTIAL_SCATTERNET, /* Device supports partial scatternet. It can have 267 simulateous connection in Master and Slave roles 268 for short period of time */ 269 BTA_DM_FULL_SCATTERNET /* Device can have simultaneous connection in master 270 and slave roles */ 271 272 }; 273 274 275 /* Inquiry filter device class condition */ 276 typedef struct { 277 DEV_CLASS dev_class; /* device class of interest */ 278 DEV_CLASS dev_class_mask; /* mask to determine the bits of device class of interest */ 279 } tBTA_DM_COD_COND; 280 281 282 /* Inquiry Filter Condition */ 283 typedef union { 284 BD_ADDR bd_addr; /* BD address of device to filter. */ 285 tBTA_DM_COD_COND dev_class_cond; /* Device class filter condition */ 286 } tBTA_DM_INQ_COND; 287 288 /* Inquiry Parameters */ 289 typedef struct { 290 tBTA_DM_INQ_MODE mode; /* Inquiry mode, limited or general. */ 291 UINT8 duration; /* Inquiry duration in 1.28 sec units. */ 292 UINT8 max_resps; /* Maximum inquiry responses. Set to zero for unlimited responses. */ 293 BOOLEAN report_dup; /* report duplicated inquiry response with higher RSSI value */ 294 tBTA_DM_INQ_FILT filter_type; /* Filter condition type. */ 295 tBTA_DM_INQ_COND filter_cond; /* Filter condition data. */ 296 #if (defined(BTA_HOST_INTERLEAVE_SEARCH) && BTA_HOST_INTERLEAVE_SEARCH == TRUE) 297 UINT8 intl_duration[4];/*duration array storing the interleave scan's time portions*/ 298 #endif 299 } tBTA_DM_INQ; 300 301 /* Config EIR callback */ 302 typedef void (tBTA_DM_CONFIG_EIR_CBACK) (tBTA_STATUS status, UINT8 eir_type_num, UINT8 *eir_type); 303 304 typedef struct { 305 BOOLEAN bta_dm_eir_fec_required; /* FEC required */ 306 UINT8 bta_dm_eir_min_name_len; /* minimum length of local name when it is shortened */ 307 308 BOOLEAN bta_dm_eir_included_uuid; /* Included UUIDs or not */ 309 #if (BTA_EIR_CANNED_UUID_LIST == TRUE) 310 UINT8 bta_dm_eir_uuid16_len; /* length of 16-bit UUIDs */ 311 UINT8 *bta_dm_eir_uuid16; /* 16-bit UUIDs */ 312 #else 313 UINT32 uuid_mask[BTM_EIR_SERVICE_ARRAY_SIZE]; /* mask of UUID list in EIR */ 314 #endif 315 316 BOOLEAN bta_dm_eir_included_tx_power; /* Included inquiry TX power or not */ 317 INT8 bta_dm_eir_inq_tx_power; /* Inquiry TX power */ 318 319 UINT8 bta_dm_eir_flags; /* flags for EIR */ 320 UINT8 bta_dm_eir_manufac_spec_len; /* length of manufacturer specific in bytes */ 321 UINT8 *bta_dm_eir_manufac_spec; /* manufacturer specific */ 322 UINT8 bta_dm_eir_url_len; /* length of URL in bytes */ 323 UINT8 *bta_dm_eir_url; /* URL data */ 324 325 tBTA_DM_CONFIG_EIR_CBACK *config_eir_callback; /* callback */ 326 } tBTA_DM_EIR_CONF; 327 328 // #if BLE_INCLUDED == TRUE 329 /* ADV data flag bit definition used for BTM_BLE_AD_TYPE_FLAG */ 330 #define BTA_BLE_LIMIT_DISC_FLAG BTM_BLE_LIMIT_DISC_FLAG 331 #define BTA_BLE_GEN_DISC_FLAG BTM_BLE_GEN_DISC_FLAG 332 #define BTA_BLE_BREDR_NOT_SPT BTM_BLE_BREDR_NOT_SPT 333 #define BTA_BLE_DMT_CONTROLLER_SPT BTM_BLE_DMT_CONTROLLER_SPT 334 #define BTA_BLE_DMT_HOST_SPT BTM_BLE_DMT_HOST_SPT 335 #define BTA_BLE_NON_LIMIT_DISC_FLAG BTM_BLE_NON_LIMIT_DISC_FLAG 336 #define BTA_BLE_ADV_FLAG_MASK BTM_BLE_ADV_FLAG_MASK 337 #define BTA_BLE_LIMIT_DISC_MASK BTM_BLE_LIMIT_DISC_MASK 338 339 /* ADV data bit mask */ 340 #define BTA_BLE_AD_BIT_DEV_NAME BTM_BLE_AD_BIT_DEV_NAME 341 #define BTA_BLE_AD_BIT_FLAGS BTM_BLE_AD_BIT_FLAGS 342 #define BTA_BLE_AD_BIT_MANU BTM_BLE_AD_BIT_MANU 343 #define BTA_BLE_AD_BIT_TX_PWR BTM_BLE_AD_BIT_TX_PWR 344 #define BTA_BLE_AD_BIT_INT_RANGE BTM_BLE_AD_BIT_INT_RANGE 345 #define BTA_BLE_AD_BIT_SERVICE BTM_BLE_AD_BIT_SERVICE 346 #define BTA_BLE_AD_BIT_APPEARANCE BTM_BLE_AD_BIT_APPEARANCE 347 #define BTA_BLE_AD_BIT_PROPRIETARY BTM_BLE_AD_BIT_PROPRIETARY 348 #define BTA_DM_BLE_AD_BIT_SERVICE_SOL BTM_BLE_AD_BIT_SERVICE_SOL 349 #define BTA_DM_BLE_AD_BIT_SERVICE_DATA BTM_BLE_AD_BIT_SERVICE_DATA 350 #define BTA_DM_BLE_AD_BIT_SIGN_DATA BTM_BLE_AD_BIT_SIGN_DATA 351 #define BTA_DM_BLE_AD_BIT_SERVICE_128SOL BTM_BLE_AD_BIT_SERVICE_128SOL 352 #define BTA_DM_BLE_AD_BIT_PUBLIC_ADDR BTM_BLE_AD_BIT_PUBLIC_ADDR 353 #define BTA_DM_BLE_AD_BIT_RANDOM_ADDR BTM_BLE_AD_BIT_RANDOM_ADDR 354 #define BTA_DM_BLE_AD_BIT_SERVICE_128 BTM_BLE_AD_BIT_SERVICE_128 /*128-bit Service UUIDs*/ 355 356 typedef tBTM_BLE_AD_MASK tBTA_BLE_AD_MASK; 357 358 /* slave preferred connection interval range */ 359 typedef struct { 360 UINT16 low; 361 UINT16 hi; 362 363 } tBTA_BLE_INT_RANGE; 364 365 /* Service tag supported in the device */ 366 typedef struct { 367 UINT8 num_service; 368 BOOLEAN list_cmpl; 369 UINT16 *p_uuid; 370 } tBTA_BLE_SERVICE; 371 372 373 typedef struct { 374 UINT8 len; 375 UINT8 *p_val; 376 } tBTA_BLE_MANU; 377 378 typedef struct { 379 UINT8 adv_type; 380 UINT8 len; 381 UINT8 *p_val; /* number of len byte */ 382 } tBTA_BLE_PROP_ELEM; 383 384 /* vendor proprietary adv type */ 385 typedef struct { 386 UINT8 num_elem; 387 tBTA_BLE_PROP_ELEM *p_elem; 388 } tBTA_BLE_PROPRIETARY; 389 390 typedef struct { 391 tBT_UUID service_uuid; 392 UINT8 len; 393 UINT8 *p_val; 394 } tBTA_BLE_SERVICE_DATA; 395 396 typedef tBTM_BLE_128SERVICE tBTA_BLE_128SERVICE; 397 typedef tBTM_BLE_32SERVICE tBTA_BLE_32SERVICE; 398 399 typedef struct { 400 tBTA_BLE_INT_RANGE int_range; /* slave prefered conn interval range */ 401 tBTA_BLE_MANU *p_manu; /* manufacturer data */ 402 tBTA_BLE_SERVICE *p_services; /* 16 bits services */ 403 tBTA_BLE_128SERVICE *p_services_128b; /* 128 bits service */ 404 tBTA_BLE_32SERVICE *p_service_32b; /* 32 bits Service UUID */ 405 tBTA_BLE_SERVICE *p_sol_services; /* 16 bits services Solicitation UUIDs */ 406 tBTA_BLE_32SERVICE *p_sol_service_32b; /* List of 32 bit Service Solicitation UUIDs */ 407 tBTA_BLE_128SERVICE *p_sol_service_128b;/* List of 128 bit Service Solicitation UUIDs */ 408 tBTA_BLE_PROPRIETARY *p_proprietary; /* proprietary data */ 409 tBTA_BLE_SERVICE_DATA *p_service_data; /* service data */ 410 UINT16 appearance; /* appearance data */ 411 UINT8 flag; 412 UINT8 tx_power; 413 } tBTA_BLE_ADV_DATA; 414 415 typedef void (tBTA_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK) (tBTA_STATUS status, uint8_t subcode, uint32_t length, uint8_t *device_info); 416 417 typedef void (tBTA_SET_ADV_DATA_CMPL_CBACK) (tBTA_STATUS status); 418 419 typedef tBTM_START_ADV_CMPL_CBACK tBTA_START_ADV_CMPL_CBACK; 420 421 typedef tBTM_START_STOP_ADV_CMPL_CBACK tBTA_START_STOP_ADV_CMPL_CBACK; 422 423 typedef tBTM_UPDATE_WHITELIST_CBACK tBTA_UPDATE_WHITELIST_CBACK; 424 425 typedef tBTM_SET_PKT_DATA_LENGTH_CBACK tBTA_SET_PKT_DATA_LENGTH_CBACK; 426 427 typedef tBTM_SET_RAND_ADDR_CBACK tBTA_SET_RAND_ADDR_CBACK; 428 429 typedef tBTM_SET_LOCAL_PRIVACY_CBACK tBTA_SET_LOCAL_PRIVACY_CBACK; 430 431 typedef tBTM_CMPL_CB tBTA_CMPL_CB; 432 433 typedef tBTM_TX_POWER_RESULTS tBTA_TX_POWER_RESULTS; 434 435 typedef tBTM_RSSI_RESULTS tBTA_RSSI_RESULTS; 436 437 typedef tBTM_SET_AFH_CHANNELS_RESULTS tBTA_SET_AFH_CHANNELS_RESULTS; 438 typedef tBTM_BLE_SET_CHANNELS_RESULTS tBTA_BLE_SET_CHANNELS_RESULTS; 439 440 typedef tBTM_REMOTE_DEV_NAME tBTA_REMOTE_DEV_NAME; 441 442 /* advertising channel map */ 443 #define BTA_BLE_ADV_CHNL_37 BTM_BLE_ADV_CHNL_37 444 #define BTA_BLE_ADV_CHNL_38 BTM_BLE_ADV_CHNL_38 445 #define BTA_BLE_ADV_CHNL_39 BTM_BLE_ADV_CHNL_39 446 typedef tBTM_BLE_ADV_CHNL_MAP tBTA_BLE_ADV_CHNL_MAP; /* use as a bit mask */ 447 448 /* advertising filter policy */ 449 typedef tBTM_BLE_AFP tBTA_BLE_AFP; 450 451 /* adv event type */ 452 #define BTA_BLE_CONNECT_EVT BTM_BLE_CONNECT_EVT /* Connectable undirected advertising */ 453 #define BTA_BLE_CONNECT_DIR_EVT BTM_BLE_CONNECT_DIR_EVT /* Connectable directed advertising */ 454 #define BTA_BLE_DISCOVER_EVT BTM_BLE_DISCOVER_EVT /* Scannable undirected advertising */ 455 #define BTA_BLE_NON_CONNECT_EVT BTM_BLE_NON_CONNECT_EVT /* Non connectable undirected advertising */ 456 typedef UINT8 tBTA_BLE_ADV_EVT; 457 458 /* adv tx power level */ 459 #define BTA_BLE_ADV_TX_POWER_MIN 0 /* minimum tx power */ 460 #define BTA_BLE_ADV_TX_POWER_LOW 1 /* low tx power */ 461 #define BTA_BLE_ADV_TX_POWER_MID 2 /* middle tx power */ 462 #define BTA_BLE_ADV_TX_POWER_UPPER 3 /* upper tx power */ 463 #define BTA_BLE_ADV_TX_POWER_MAX 4 /* maximum tx power */ 464 typedef UINT8 tBTA_BLE_ADV_TX_POWER; 465 466 /* advertising instance parameters */ 467 typedef struct { 468 UINT16 adv_int_min; /* minimum adv interval */ 469 UINT16 adv_int_max; /* maximum adv interval */ 470 tBTA_BLE_ADV_EVT adv_type; /* adv event type */ 471 tBTA_BLE_ADV_CHNL_MAP channel_map; /* adv channel map */ 472 tBTA_BLE_AFP adv_filter_policy; /* advertising filter policy */ 473 tBTA_BLE_ADV_TX_POWER tx_power; /* adv tx power */ 474 } tBTA_BLE_ADV_PARAMS; 475 476 /* These are the fields returned in each device adv packet. It 477 ** is returned in the results callback if registered. 478 */ 479 typedef struct { 480 UINT8 conn_mode; 481 tBTA_BLE_AD_MASK ad_mask; /* mask of the valid adv data field */ 482 UINT8 flag; 483 UINT8 tx_power_level; 484 UINT8 remote_name_len; 485 UINT8 *p_remote_name; 486 tBTA_BLE_SERVICE service; 487 } tBTA_BLE_INQ_DATA; 488 489 enum { 490 BTA_BLE_BATCH_SCAN_MODE_PASS = 1, 491 BTA_BLE_BATCH_SCAN_MODE_ACTI = 2, 492 BTA_BLE_BATCH_SCAN_MODE_PASS_ACTI = 3 493 }; 494 typedef UINT8 tBTA_BLE_BATCH_SCAN_MODE; 495 496 enum { 497 BTA_BLE_DISCARD_OLD_ITEMS = 0, 498 BTA_BLE_DISCARD_LOWER_RSSI_ITEMS = 1 499 }; 500 typedef UINT8 tBTA_BLE_DISCARD_RULE; 501 502 enum { 503 BTA_BLE_ADV_SEEN_FIRST_TIME = 0, 504 BTA_BLE_ADV_TRACKING_TIMEOUT = 1 505 }; 506 typedef UINT8 tBTA_BLE_ADV_CHANGE_REASON; 507 508 enum { 509 BTA_BLE_BATCH_SCAN_ENB_EVT = 1, 510 BTA_BLE_BATCH_SCAN_CFG_STRG_EVT = 2, 511 BTA_BLE_BATCH_SCAN_DATA_EVT = 3, 512 BTA_BLE_BATCH_SCAN_THRES_EVT = 4, 513 BTA_BLE_BATCH_SCAN_PARAM_EVT = 5, 514 BTA_BLE_BATCH_SCAN_DIS_EVT = 6 515 }; 516 typedef tBTM_BLE_BATCH_SCAN_EVT tBTA_BLE_BATCH_SCAN_EVT; 517 518 typedef tBTM_BLE_TRACK_ADV_ACTION tBTA_BLE_TRACK_ADV_ACTION; 519 // #endif 520 521 /* BLE customer specific feature function type definitions */ 522 /* data type used on customer specific feature for RSSI monitoring */ 523 #define BTA_BLE_RSSI_ALERT_HI 0 524 #define BTA_BLE_RSSI_ALERT_RANGE 1 525 #define BTA_BLE_RSSI_ALERT_LO 2 526 typedef UINT8 tBTA_DM_BLE_RSSI_ALERT_TYPE; 527 528 #define BTA_BLE_RSSI_ALERT_NONE BTM_BLE_RSSI_ALERT_NONE /* (0) */ 529 #define BTA_BLE_RSSI_ALERT_HI_BIT BTM_BLE_RSSI_ALERT_HI_BIT /* (1) */ 530 #define BTA_BLE_RSSI_ALERT_RANGE_BIT BTM_BLE_RSSI_ALERT_RANGE_BIT /* (1 << 1) */ 531 #define BTA_BLE_RSSI_ALERT_LO_BIT BTM_BLE_RSSI_ALERT_LO_BIT /* (1 << 2) */ 532 typedef UINT8 tBTA_DM_BLE_RSSI_ALERT_MASK; 533 534 535 typedef void (tBTA_DM_BLE_RSSI_CBACK) (BD_ADDR bd_addr, tBTA_DM_BLE_RSSI_ALERT_TYPE alert_type, INT8 rssi); 536 537 /* max number of filter spot for different filter type */ 538 #define BTA_DM_BLE_MAX_UUID_FILTER BTM_BLE_MAX_UUID_FILTER /* 8 */ 539 #define BTA_DM_BLE_MAX_ADDR_FILTER BTM_BLE_MAX_ADDR_FILTER /* 8 */ 540 #define BTA_DM_BLE_PF_STR_COND_MAX BTM_BLE_PF_STR_COND_MAX /* 4 apply to manu data , or local name */ 541 #define BTA_DM_BLE_PF_STR_LEN_MAX BTM_BLE_PF_STR_LEN_MAX /* match for first 20 bytes */ 542 543 #define BTA_DM_BLE_PF_LOGIC_OR 0 544 #define BTA_DM_BLE_PF_LOGIC_AND 1 545 typedef UINT8 tBTA_DM_BLE_PF_LOGIC_TYPE; 546 547 enum { 548 BTA_DM_BLE_SCAN_COND_ADD, 549 BTA_DM_BLE_SCAN_COND_DELETE, 550 BTA_DM_BLE_SCAN_COND_CLEAR = 2 551 }; 552 typedef UINT8 tBTA_DM_BLE_SCAN_COND_OP; 553 554 /* ADV payload filtering vendor specific call event */ 555 enum { 556 BTA_BLE_SCAN_PF_ENABLE_EVT = 7, 557 BTA_BLE_SCAN_PF_COND_EVT 558 }; 559 560 /* filter selection bit index */ 561 #define BTA_DM_BLE_PF_ADDR_FILTER BTM_BLE_PF_ADDR_FILTER 562 #define BTA_DM_BLE_PF_SRVC_DATA BTM_BLE_PF_SRVC_DATA 563 #define BTA_DM_BLE_PF_SRVC_UUID BTM_BLE_PF_SRVC_UUID 564 #define BTA_DM_BLE_PF_SRVC_SOL_UUID BTM_BLE_PF_SRVC_SOL_UUID 565 #define BTA_DM_BLE_PF_LOCAL_NAME BTM_BLE_PF_LOCAL_NAME 566 #define BTA_DM_BLE_PF_MANU_DATA BTM_BLE_PF_MANU_DATA 567 #define BTA_DM_BLE_PF_SRVC_DATA_PATTERN BTM_BLE_PF_SRVC_DATA_PATTERN 568 #define BTA_DM_BLE_PF_TYPE_ALL BTM_BLE_PF_TYPE_ALL 569 #define BTA_DM_BLE_PF_TYPE_MAX BTM_BLE_PF_TYPE_MAX 570 typedef UINT8 tBTA_DM_BLE_PF_COND_TYPE; 571 572 typedef union { 573 UINT16 uuid16_mask; 574 UINT32 uuid32_mask; 575 UINT8 uuid128_mask[LEN_UUID_128]; 576 } tBTA_DM_BLE_PF_COND_MASK; 577 578 typedef struct { 579 tBLE_BD_ADDR *p_target_addr; /* target address, if NULL, generic UUID filter */ 580 tBT_UUID uuid; /* UUID condition */ 581 tBTA_DM_BLE_PF_LOGIC_TYPE cond_logic; /* AND/OR */ 582 tBTA_DM_BLE_PF_COND_MASK *p_uuid_mask; /* UUID condition mask, if NULL, match exact as UUID condition */ 583 } tBTA_DM_BLE_PF_UUID_COND; 584 585 typedef struct { 586 UINT8 data_len; /* <= 20 bytes */ 587 UINT8 *p_data; 588 } tBTA_DM_BLE_PF_LOCAL_NAME_COND; 589 590 typedef struct { 591 UINT16 company_id; /* company ID */ 592 UINT8 data_len; /* <= 20 bytes */ 593 UINT8 *p_pattern; 594 UINT16 company_id_mask; /* UUID value mask */ 595 UINT8 *p_pattern_mask; /* Manufacturer data matching mask, same length 596 as data pattern, set to all 0xff, match exact data */ 597 } tBTA_DM_BLE_PF_MANU_COND; 598 599 typedef struct { 600 UINT16 uuid; /* service ID */ 601 UINT8 data_len; /* <= 20 bytes */ 602 UINT8 *p_pattern; 603 UINT8 *p_pattern_mask; /* Service data matching mask, same length 604 as data pattern, set to all 0xff, match exact data */ 605 } tBTA_DM_BLE_PF_SRVC_PATTERN_COND; 606 607 typedef union { 608 tBLE_BD_ADDR target_addr; 609 tBTA_DM_BLE_PF_LOCAL_NAME_COND local_name; /* local name filtering */ 610 tBTA_DM_BLE_PF_MANU_COND manu_data; /* manufacturer data filtering */ 611 tBTA_DM_BLE_PF_UUID_COND srvc_uuid; /* service UUID filtering */ 612 tBTA_DM_BLE_PF_UUID_COND solicitate_uuid; /* solicited service UUID filtering */ 613 tBTA_DM_BLE_PF_SRVC_PATTERN_COND srvc_data; /* service data pattern */ 614 } tBTA_DM_BLE_PF_COND_PARAM; 615 616 typedef UINT8 tBTA_DM_BLE_PF_FILT_INDEX; 617 typedef UINT8 tBTA_DM_BLE_PF_AVBL_SPACE; 618 619 typedef INT8 tBTA_DM_RSSI_VALUE; 620 typedef UINT8 tBTA_DM_LINK_QUALITY_VALUE; 621 622 623 typedef UINT8 tBTA_SIG_STRENGTH_MASK; 624 625 626 /* Security Callback Events */ 627 #define BTA_DM_ENABLE_EVT 0 /* Enable Event */ 628 #define BTA_DM_DISABLE_EVT 1 /* Disable Event */ 629 #define BTA_DM_PIN_REQ_EVT 2 /* PIN request. */ 630 #define BTA_DM_AUTH_CMPL_EVT 3 /* Authentication complete indication. */ 631 #define BTA_DM_AUTHORIZE_EVT 4 /* Authorization request. */ 632 #define BTA_DM_LINK_UP_EVT 5 /* Connection UP event */ 633 #define BTA_DM_LINK_DOWN_EVT 6 /* Connection DOWN event */ 634 #define BTA_DM_SIG_STRENGTH_EVT 7 /* Signal strength for bluetooth connection */ 635 #define BTA_DM_BUSY_LEVEL_EVT 8 /* System busy level */ 636 #define BTA_DM_BOND_CANCEL_CMPL_EVT 9 /* Bond cancel complete indication */ 637 #define BTA_DM_SP_CFM_REQ_EVT 10 /* Simple Pairing User Confirmation request. */ 638 #define BTA_DM_SP_KEY_NOTIF_EVT 11 /* Simple Pairing Passkey Notification */ 639 #define BTA_DM_SP_RMT_OOB_EVT 12 /* Simple Pairing Remote OOB Data request. */ 640 #define BTA_DM_SP_KEYPRESS_EVT 13 /* Key press notification event. */ 641 #define BTA_DM_ROLE_CHG_EVT 14 /* Role Change event. */ 642 #define BTA_DM_BLE_KEY_EVT 15 /* BLE SMP key event for peer device keys */ 643 #define BTA_DM_BLE_SEC_REQ_EVT 16 /* BLE SMP security request */ 644 #define BTA_DM_BLE_PASSKEY_NOTIF_EVT 17 /* SMP passkey notification event */ 645 #define BTA_DM_BLE_PASSKEY_REQ_EVT 18 /* SMP passkey request event */ 646 #define BTA_DM_BLE_OOB_REQ_EVT 19 /* SMP OOB request event */ 647 #define BTA_DM_BLE_LOCAL_IR_EVT 20 /* BLE local IR event */ 648 #define BTA_DM_BLE_LOCAL_ER_EVT 21 /* BLE local ER event */ 649 #define BTA_DM_BLE_NC_REQ_EVT 22 /* SMP Numeric Comparison request event */ 650 // btla-specific ++ 651 #define BTA_DM_SP_RMT_OOB_EXT_EVT 23 /* Simple Pairing Remote OOB Extended Data request. */ 652 #define BTA_DM_BLE_AUTH_CMPL_EVT 24 /* BLE Auth complete */ 653 // btla-specific -- 654 #define BTA_DM_DEV_UNPAIRED_EVT 25 /* BT unpair event */ 655 #define BTA_DM_HW_ERROR_EVT 26 /* BT Chip H/W error */ 656 #define BTA_DM_LE_FEATURES_READ 27 /* Cotroller specific LE features are read */ 657 #define BTA_DM_ENER_INFO_READ 28 /* Energy info read */ 658 #define BTA_DM_BLE_DEV_UNPAIRED_EVT 29 /* BLE unpair event */ 659 #define BTA_DM_SP_KEY_REQ_EVT 30 /* Simple Pairing Passkey request */ 660 #define BTA_DM_PM_MODE_CHG_EVT 31 /* Mode changed event */ 661 #define BTA_DM_ACL_LINK_STAT_EVT 32 /* ACL connection status report event */ 662 #define BTA_DM_BLE_SC_OOB_REQ_EVT 33 /* BLE SMP SC OOB request event */ 663 #define BTA_DM_BLE_SC_CR_LOC_OOB_EVT 34 /* BLE SMP SC Create Local OOB request event */ 664 665 typedef UINT8 tBTA_DM_SEC_EVT; 666 667 /* Structure associated with BTA_DM_ENABLE_EVT */ 668 typedef struct { 669 tBTA_STATUS status; 670 } tBTA_DM_ENABLE; 671 672 /* Structure associated with BTA_DM_PIN_REQ_EVT */ 673 typedef struct { 674 /* Note: First 3 data members must be, bd_addr, dev_class, and bd_name in order */ 675 BD_ADDR bd_addr; /* BD address peer device. */ 676 DEV_CLASS dev_class; /* Class of Device */ 677 BD_NAME bd_name; /* Name of peer device. */ 678 BOOLEAN min_16_digit; /* TRUE if the pin returned must be at least 16 digits */ 679 } tBTA_DM_PIN_REQ; 680 681 /* BLE related definition */ 682 #if (SMP_INCLUDED == TRUE) 683 #define BTA_DM_AUTH_FAIL_BASE (HCI_ERR_MAX_ERR + 10) 684 #define BTA_DM_AUTH_CONVERT_SMP_CODE(x) (BTA_DM_AUTH_FAIL_BASE + (x)) 685 #define BTA_DM_AUTH_SMP_PASSKEY_FAIL BTA_DM_AUTH_CONVERT_SMP_CODE (SMP_PASSKEY_ENTRY_FAIL) 686 #define BTA_DM_AUTH_SMP_OOB_FAIL (BTA_DM_AUTH_FAIL_BASE + SMP_OOB_FAIL) 687 #define BTA_DM_AUTH_SMP_PAIR_AUTH_FAIL (BTA_DM_AUTH_FAIL_BASE + SMP_PAIR_AUTH_FAIL) 688 #define BTA_DM_AUTH_SMP_CONFIRM_VALUE_FAIL (BTA_DM_AUTH_FAIL_BASE + SMP_CONFIRM_VALUE_ERR) 689 #define BTA_DM_AUTH_SMP_PAIR_NOT_SUPPORT (BTA_DM_AUTH_FAIL_BASE + SMP_PAIR_NOT_SUPPORT) 690 #define BTA_DM_AUTH_SMP_ENC_KEY_SIZE (BTA_DM_AUTH_FAIL_BASE + SMP_ENC_KEY_SIZE) 691 #define BTA_DM_AUTH_SMP_INVALID_CMD (BTA_DM_AUTH_FAIL_BASE + SMP_INVALID_CMD) 692 #define BTA_DM_AUTH_SMP_UNKNOWN_ERR (BTA_DM_AUTH_FAIL_BASE + SMP_PAIR_FAIL_UNKNOWN) 693 #define BTA_DM_AUTH_SMP_REPEATED_ATTEMPT (BTA_DM_AUTH_FAIL_BASE + SMP_REPEATED_ATTEMPTS) 694 #define BTA_DM_AUTH_SMP_INVALID_PARAMETERS (BTA_DM_AUTH_FAIL_BASE + SMP_INVALID_PARAMETERS) 695 #define BTA_DM_AUTH_SMP_INTERNAL_ERR (BTA_DM_AUTH_FAIL_BASE + SMP_PAIR_INTERNAL_ERR) 696 #define BTA_DM_AUTH_SMP_UNKNOWN_IO (BTA_DM_AUTH_FAIL_BASE + SMP_UNKNOWN_IO_CAP) 697 #define BTA_DM_AUTH_SMP_INIT_FAIL (BTA_DM_AUTH_FAIL_BASE + SMP_INIT_FAIL) 698 #define BTA_DM_AUTH_SMP_CONFIRM_FAIL (BTA_DM_AUTH_FAIL_BASE + SMP_CONFIRM_FAIL) 699 #define BTA_DM_AUTH_SMP_BUSY (BTA_DM_AUTH_FAIL_BASE + SMP_BUSY) 700 #define BTA_DM_AUTH_SMP_ENC_FAIL (BTA_DM_AUTH_FAIL_BASE + SMP_ENC_FAIL) 701 #define BTA_DM_AUTH_SMP_RSP_TIMEOUT (BTA_DM_AUTH_FAIL_BASE + SMP_RSP_TIMEOUT) 702 #endif ///SMP_INCLUDED == TRUE 703 /* connection parameter boundary value and dummy value */ 704 #define BTA_DM_BLE_SCAN_INT_MIN BTM_BLE_SCAN_INT_MIN 705 #define BTA_DM_BLE_SCAN_INT_MAX BTM_BLE_SCAN_INT_MAX 706 #define BTA_DM_BLE_SCAN_WIN_MIN BTM_BLE_SCAN_WIN_MIN 707 #define BTA_DM_BLE_SCAN_WIN_MAX BTM_BLE_SCAN_WIN_MAX 708 #define BTA_DM_BLE_CONN_INT_MIN BTM_BLE_CONN_INT_MIN 709 #define BTA_DM_BLE_CONN_INT_MAX BTM_BLE_CONN_INT_MAX 710 #define BTA_DM_BLE_CONN_LATENCY_MAX BTM_BLE_CONN_LATENCY_MAX 711 #define BTA_DM_BLE_CONN_SUP_TOUT_MIN BTM_BLE_CONN_SUP_TOUT_MIN 712 #define BTA_DM_BLE_CONN_SUP_TOUT_MAX BTM_BLE_CONN_SUP_TOUT_MAX 713 #define BTA_DM_BLE_CONN_PARAM_UNDEF BTM_BLE_CONN_PARAM_UNDEF /* use this value when a specific value not to be overwritten */ 714 715 #if (SMP_INCLUDED == TRUE) 716 #define BTA_LE_KEY_PENC BTM_LE_KEY_PENC /* encryption information of peer device */ 717 #define BTA_LE_KEY_PID BTM_LE_KEY_PID /* identity key of the peer device */ 718 #define BTA_LE_KEY_PCSRK BTM_LE_KEY_PCSRK /* peer SRK */ 719 #define BTA_LE_KEY_LENC BTM_LE_KEY_LENC /* master role security information:div */ 720 #define BTA_LE_KEY_LID BTM_LE_KEY_LID /* master device ID key */ 721 #define BTA_LE_KEY_LCSRK BTM_LE_KEY_LCSRK /* local CSRK has been deliver to peer */ 722 #endif ///SMP_INCLUDED == TRUE 723 typedef UINT8 tBTA_LE_KEY_TYPE; /* can be used as a bit mask */ 724 725 726 typedef tBTM_LE_PENC_KEYS tBTA_LE_PENC_KEYS ; 727 typedef tBTM_LE_PCSRK_KEYS tBTA_LE_PCSRK_KEYS; 728 typedef tBTM_LE_LENC_KEYS tBTA_LE_LENC_KEYS ; 729 typedef tBTM_LE_LCSRK_KEYS tBTA_LE_LCSRK_KEYS ; 730 typedef tBTM_LE_PID_KEYS tBTA_LE_PID_KEYS ; 731 732 typedef union { 733 tBTA_LE_PENC_KEYS penc_key; /* received peer encryption key */ 734 tBTA_LE_PCSRK_KEYS psrk_key; /* received peer device SRK */ 735 tBTA_LE_PID_KEYS pid_key; /* peer device ID key */ 736 tBTA_LE_LENC_KEYS lenc_key; /* local encryption reproduction keys LTK = = d1(ER,DIV,0)*/ 737 tBTA_LE_LCSRK_KEYS lcsrk_key; /* local device CSRK = d1(ER,DIV,1)*/ 738 tBTA_LE_PID_KEYS lid_key; /* local device ID key for the particular remote */ 739 } tBTA_LE_KEY_VALUE; 740 741 #define BTA_BLE_LOCAL_KEY_TYPE_ID 1 742 #define BTA_BLE_LOCAL_KEY_TYPE_ER 2 743 typedef UINT8 tBTA_DM_BLE_LOCAL_KEY_MASK; 744 745 typedef struct { 746 BT_OCTET16 ir; 747 BT_OCTET16 irk; 748 BT_OCTET16 dhk; 749 } tBTA_BLE_LOCAL_ID_KEYS; 750 #if (SMP_INCLUDED == TRUE) 751 #define BTA_DM_SEC_GRANTED BTA_SUCCESS 752 #define BTA_DM_SEC_PAIR_NOT_SPT BTA_DM_AUTH_SMP_PAIR_NOT_SUPPORT 753 #define BTA_DM_SEC_REP_ATTEMPTS BTA_DM_AUTH_SMP_REPEATED_ATTEMPT 754 #endif ///SMP_INCLUDED == TRUE 755 typedef UINT8 tBTA_DM_BLE_SEC_GRANT; 756 757 758 #define BTA_DM_BLE_ONN_NONE BTM_BLE_CONN_NONE 759 #define BTA_DM_BLE_CONN_AUTO BTM_BLE_CONN_AUTO 760 #define BTA_DM_BLE_CONN_SELECTIVE BTM_BLE_CONN_SELECTIVE 761 typedef UINT8 tBTA_DM_BLE_CONN_TYPE; 762 763 typedef BOOLEAN (tBTA_DM_BLE_SEL_CBACK)(BD_ADDR random_bda, UINT8 *p_remote_name); 764 765 typedef tBTM_LE_UPDATE_CONN_PRAMS tBTA_LE_UPDATE_CONN_PRAMS; 766 typedef tBTM_UPDATE_CONN_PARAM_CBACK tBTA_UPDATE_CONN_PARAM_CBACK; 767 768 769 /* Structure associated with BTA_DM_BLE_SEC_REQ_EVT */ 770 typedef struct { 771 BD_ADDR bd_addr; /* peer address */ 772 BD_NAME bd_name; /* peer device name */ 773 } tBTA_DM_BLE_SEC_REQ; 774 775 typedef struct { 776 BD_ADDR bd_addr; /* peer address */ 777 tBTM_LE_KEY_TYPE key_type; 778 tBTM_LE_KEY_VALUE *p_key_value; 779 } tBTA_DM_BLE_KEY; 780 781 /* Structure associated with BTA_DM_AUTH_CMPL_EVT */ 782 typedef struct { 783 BD_ADDR bd_addr; /* BD address peer device. */ 784 BD_NAME bd_name; /* Name of peer device. */ 785 BOOLEAN key_present; /* Valid link key value in key element */ 786 LINK_KEY key; /* Link key associated with peer device. */ 787 UINT8 key_type; /* The type of Link Key */ 788 BOOLEAN success; /* TRUE of authentication succeeded, FALSE if failed. */ 789 UINT8 fail_reason; /* The HCI reason/error code for when success=FALSE */ 790 tBLE_ADDR_TYPE addr_type; /* Peer device address type */ 791 tBT_DEVICE_TYPE dev_type; 792 UINT8 auth_mode; 793 BOOLEAN sc_support; /* Denotes if peer device supported secure connection while bonding. */ 794 } tBTA_DM_AUTH_CMPL; 795 796 797 /* Structure associated with BTA_DM_AUTHORIZE_EVT */ 798 typedef struct { 799 BD_ADDR bd_addr; /* BD address peer device. */ 800 BD_NAME bd_name; /* Name of peer device. */ 801 tBTA_SERVICE_ID service; /* Service ID to authorize. */ 802 // btla-specific ++ 803 DEV_CLASS dev_class; 804 // btla-specific -- 805 } tBTA_DM_AUTHORIZE; 806 807 /* Structure associated with BTA_DM_LINK_UP_EVT */ 808 typedef struct { 809 BOOLEAN sc_downgrade; /* Security downgrade state. */ 810 BD_ADDR bd_addr; /* BD address peer device. */ 811 #if BLE_INCLUDED == TRUE 812 tBTA_TRANSPORT link_type; 813 #endif 814 } tBTA_DM_LINK_UP; 815 816 /* Structure associated with BTA_DM_LINK_DOWN_EVT */ 817 typedef struct { 818 BD_ADDR bd_addr; /* BD address peer device. */ 819 UINT8 status; /* connection open/closed */ 820 UINT8 reason; /* link down reason */ 821 BOOLEAN is_removed; /* TRUE if device is removed when link is down */ 822 #if BLE_INCLUDED == TRUE 823 tBTA_TRANSPORT link_type; 824 #endif 825 } tBTA_DM_LINK_DOWN; 826 827 enum { 828 BTA_ACL_LINK_STAT_CONN_CMPL, 829 BTA_ACL_LINK_STAT_DISCONN_CMPL 830 }; 831 typedef UINT8 tBTA_ACL_LINK_STAT_EVT; 832 833 typedef struct { 834 UINT8 status; /* ACL link connection status */ 835 UINT16 handle; /* ACL connection handle */ 836 BD_ADDR bd_addr; /* peer bluetooth address */ 837 } tBTA_DM_ACL_CONN_CMPL_STAT; 838 839 typedef struct { 840 UINT8 reason; /* ACL link disconnection reason */ 841 UINT16 handle; /* ACL connection handle */ 842 BD_ADDR bd_addr; /* peer bluetooth address */ 843 } tBTA_DM_ACL_DISCONN_CMPL_STAT; 844 845 /* Structure associated with BTA_DM_ACL_LINK_STAT_EVT */ 846 typedef struct { 847 tBTA_ACL_LINK_STAT_EVT event; /* ACL link event */ 848 union { 849 tBTA_DM_ACL_CONN_CMPL_STAT conn_cmpl; 850 tBTA_DM_ACL_DISCONN_CMPL_STAT disconn_cmpl; 851 } link_act; 852 } tBTA_DM_ACL_LINK_STAT; 853 854 /* Structure associated with BTA_DM_ROLE_CHG_EVT */ 855 typedef struct { 856 BD_ADDR bd_addr; /* BD address peer device. */ 857 UINT8 new_role; /* the new connection role */ 858 } tBTA_DM_ROLE_CHG; 859 860 /* Structure associated with BTA_DM_BUSY_LEVEL_EVT */ 861 typedef struct { 862 UINT8 level; /* when paging or inquiring, level is 10. 863 Otherwise, the number of ACL links */ 864 UINT8 level_flags; /* indicates individual flags */ 865 } tBTA_DM_BUSY_LEVEL; 866 867 #define BTA_IO_CAP_OUT BTM_IO_CAP_OUT /* 0 DisplayOnly */ 868 #define BTA_IO_CAP_IO BTM_IO_CAP_IO /* 1 DisplayYesNo */ 869 #define BTA_IO_CAP_IN BTM_IO_CAP_IN /* 2 KeyboardOnly */ 870 #define BTA_IO_CAP_NONE BTM_IO_CAP_NONE /* 3 NoInputNoOutput */ 871 #if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE 872 #define BTA_IO_CAP_KBDISP BTM_IO_CAP_KBDISP /* 4 Keyboard display */ 873 #endif 874 typedef tBTM_IO_CAP tBTA_IO_CAP; 875 876 #define BTA_AUTH_SP_NO BTM_AUTH_SP_NO /* 0 MITM Protection Not Required - Single Profile/non-bonding 877 Numeric comparison with automatic accept allowed */ 878 #define BTA_AUTH_SP_YES BTM_AUTH_SP_YES /* 1 MITM Protection Required - Single Profile/non-bonding 879 Use IO Capabilities to determine authentication procedure */ 880 #define BTA_AUTH_AP_NO BTM_AUTH_AP_NO /* 2 MITM Protection Not Required - All Profiles/dedicated bonding 881 Numeric comparison with automatic accept allowed */ 882 #define BTA_AUTH_AP_YES BTM_AUTH_AP_YES /* 3 MITM Protection Required - All Profiles/dedicated bonding 883 Use IO Capabilities to determine authentication procedure */ 884 #define BTA_AUTH_SPGB_NO BTM_AUTH_SPGB_NO /* 4 MITM Protection Not Required - Single Profiles/general bonding 885 Numeric comparison with automatic accept allowed */ 886 #define BTA_AUTH_SPGB_YES BTM_AUTH_SPGB_YES /* 5 MITM Protection Required - Single Profiles/general bonding 887 Use IO Capabilities to determine authentication procedure */ 888 typedef tBTM_AUTH_REQ tBTA_AUTH_REQ; 889 890 #define BTA_AUTH_DD_BOND BTM_AUTH_DD_BOND /* 2 this bit is set for dedicated bonding */ 891 #define BTA_AUTH_GEN_BOND BTM_AUTH_SPGB_NO /* 4 this bit is set for general bonding */ 892 #define BTA_AUTH_BONDS BTM_AUTH_BONDS /* 6 the general/dedicated bonding bits */ 893 894 #if (SMP_INCLUDED == TRUE) 895 #define BTA_LE_AUTH_NO_BOND BTM_LE_AUTH_REQ_NO_BOND /* 0*/ 896 #define BTA_LE_AUTH_BOND BTM_LE_AUTH_REQ_BOND /* 1 << 0 */ 897 #define BTA_LE_AUTH_REQ_MITM BTM_LE_AUTH_REQ_MITM /* 1 << 2 */ 898 899 #define BTA_LE_AUTH_REQ_SC_ONLY BTM_LE_AUTH_REQ_SC_ONLY /* 1 << 3 */ 900 #define BTA_LE_AUTH_REQ_SC_BOND BTM_LE_AUTH_REQ_SC_BOND /* 1001 */ 901 #define BTA_LE_AUTH_REQ_SC_MITM BTM_LE_AUTH_REQ_SC_MITM /* 1100 */ 902 #define BTA_LE_AUTH_REQ_SC_MITM_BOND BTM_LE_AUTH_REQ_SC_MITM_BOND /* 1101 */ 903 #endif ///SMP_INCLUDED == TRUE 904 typedef tBTM_LE_AUTH_REQ tBTA_LE_AUTH_REQ; /* combination of the above bit pattern */ 905 906 #define BTA_OOB_NONE BTM_OOB_NONE 907 #define BTA_OOB_PRESENT BTM_OOB_PRESENT 908 #if BTM_OOB_INCLUDED == TRUE 909 #define BTA_OOB_UNKNOWN BTM_OOB_UNKNOWN 910 #endif 911 typedef tBTM_OOB_DATA tBTA_OOB_DATA; 912 913 #define BTA_PM_MD_ACTIVE BTM_PM_MD_ACTIVE /* 0 Active mode */ 914 #define BTA_PM_MD_HOLD BTM_PM_MD_HOLD /* 1 Hold mode */ 915 #define BTA_PM_MD_SNIFF BTM_PM_MD_SNIFF /* 2 Sniff mode */ 916 #define BTA_PM_MD_PARK BTM_PM_MD_PARK /* 3 Park state */ 917 typedef tBTM_PM_MODE tBTA_PM_MODE; 918 919 /* Structure associated with BTA_DM_SP_CFM_REQ_EVT */ 920 typedef struct { 921 /* Note: First 3 data members must be, bd_addr, dev_class, and bd_name in order */ 922 BD_ADDR bd_addr; /* peer address */ 923 DEV_CLASS dev_class; /* peer CoD */ 924 BD_NAME bd_name; /* peer device name */ 925 UINT32 num_val; /* the numeric value for comparison. If just_works, do not show this number to UI */ 926 BOOLEAN just_works; /* TRUE, if "Just Works" association model */ 927 tBTA_AUTH_REQ loc_auth_req; /* Authentication required for local device */ 928 tBTA_AUTH_REQ rmt_auth_req; /* Authentication required for peer device */ 929 tBTA_IO_CAP loc_io_caps; /* IO Capabilities of local device */ 930 tBTA_AUTH_REQ rmt_io_caps; /* IO Capabilities of remote device */ 931 } tBTA_DM_SP_CFM_REQ; 932 933 /* Structure associated with tBTA_DM_SP_KEY_REQ */ 934 typedef struct { 935 BD_ADDR bd_addr; /* peer address */ 936 DEV_CLASS dev_class; /* peer CoD */ 937 BD_NAME bd_name; /* peer device name */ 938 } tBTA_DM_SP_KEY_REQ; 939 940 enum { 941 BTA_SP_KEY_STARTED, /* passkey entry started */ 942 BTA_SP_KEY_ENTERED, /* passkey digit entered */ 943 BTA_SP_KEY_ERASED, /* passkey digit erased */ 944 BTA_SP_KEY_CLEARED, /* passkey cleared */ 945 BTA_SP_KEY_COMPLT /* passkey entry completed */ 946 }; 947 typedef UINT8 tBTA_SP_KEY_TYPE; 948 949 /* Structure associated with BTA_DM_SP_KEYPRESS_EVT */ 950 typedef struct { 951 BD_ADDR bd_addr; /* peer address */ 952 tBTA_SP_KEY_TYPE notif_type; 953 } tBTA_DM_SP_KEY_PRESS; 954 955 /* Structure associated with BTA_DM_SP_KEY_NOTIF_EVT */ 956 typedef struct { 957 /* Note: First 3 data members must be, bd_addr, dev_class, and bd_name in order */ 958 BD_ADDR bd_addr; /* peer address */ 959 DEV_CLASS dev_class; /* peer CoD */ 960 BD_NAME bd_name; /* peer device name */ 961 UINT32 passkey; /* the numeric value for comparison. If just_works, do not show this number to UI */ 962 } tBTA_DM_SP_KEY_NOTIF; 963 964 /* Structure associated with BTA_DM_SP_RMT_OOB_EVT */ 965 typedef struct { 966 /* Note: First 3 data members must be, bd_addr, dev_class, and bd_name in order */ 967 BD_ADDR bd_addr; /* peer address */ 968 DEV_CLASS dev_class; /* peer CoD */ 969 BD_NAME bd_name; /* peer device name */ 970 } tBTA_DM_SP_RMT_OOB; 971 972 /* Structure associated with BTA_DM_BOND_CANCEL_CMPL_EVT */ 973 typedef struct { 974 tBTA_STATUS result; /* TRUE of bond cancel succeeded, FALSE if failed. */ 975 } tBTA_DM_BOND_CANCEL_CMPL; 976 977 /* Structure associated with BTA_DM_PM_MODE_CHG_EVT */ 978 typedef struct { 979 BD_ADDR bd_addr; /* BD address peer device. */ 980 tBTA_PM_MODE mode; /* the new connection role */ 981 } tBTA_DM_MODE_CHG; 982 983 typedef struct { 984 BT_OCTET16 local_oob_c; /* Local OOB Data Confirmation/Commitment */ 985 BT_OCTET16 local_oob_r; /* Local OOB Data Randomizer */ 986 } tBTA_DM_LOC_OOB_DATA; 987 988 /* Union of all security callback structures */ 989 typedef union { 990 tBTA_DM_ENABLE enable; /* BTA enabled */ 991 tBTA_DM_PIN_REQ pin_req; /* PIN request. */ 992 tBTA_DM_AUTH_CMPL auth_cmpl; /* Authentication complete indication. */ 993 tBTA_DM_AUTHORIZE authorize; /* Authorization request. */ 994 tBTA_DM_LINK_UP link_up; /* ACL connection up event */ 995 tBTA_DM_LINK_DOWN link_down; /* ACL connection down event */ 996 tBTA_DM_ACL_LINK_STAT acl_link_stat; /* ACL link status event */ 997 tBTA_DM_BUSY_LEVEL busy_level; /* System busy level */ 998 tBTA_DM_SP_CFM_REQ cfm_req; /* user confirm request */ 999 tBTA_DM_SP_KEY_REQ key_req; /* user passkey request */ 1000 tBTA_DM_SP_KEY_NOTIF key_notif; /* passkey notification */ 1001 tBTA_DM_SP_RMT_OOB rmt_oob; /* remote oob */ 1002 tBTA_DM_BOND_CANCEL_CMPL bond_cancel_cmpl; /* Bond Cancel Complete indication */ 1003 tBTA_DM_SP_KEY_PRESS key_press; /* key press notification event */ 1004 tBTA_DM_ROLE_CHG role_chg; /* role change event */ 1005 tBTA_DM_BLE_SEC_REQ ble_req; /* BLE SMP related request */ 1006 tBTA_DM_BLE_KEY ble_key; /* BLE SMP keys used when pairing */ 1007 tBTA_BLE_LOCAL_ID_KEYS ble_id_keys; /* IR event */ 1008 BT_OCTET16 ble_er; /* ER event data */ 1009 #if BTA_DM_PM_INCLUDED 1010 tBTA_DM_MODE_CHG mode_chg; /* mode change event */ 1011 #endif ///BTA_DM_PM_INCLUDED 1012 tBTA_DM_LOC_OOB_DATA local_oob_data; /* Local OOB data generated by us */ 1013 } tBTA_DM_SEC; 1014 1015 /* Security callback */ 1016 typedef void (tBTA_DM_SEC_CBACK)(tBTA_DM_SEC_EVT event, tBTA_DM_SEC *p_data); 1017 1018 #define BTA_BLE_MULTI_ADV_ILLEGAL 0 1019 1020 /* multi adv callback event */ 1021 #define BTA_BLE_MULTI_ADV_ENB_EVT 1 1022 #define BTA_BLE_MULTI_ADV_DISABLE_EVT 2 1023 #define BTA_BLE_MULTI_ADV_PARAM_EVT 3 1024 #define BTA_BLE_MULTI_ADV_DATA_EVT 4 1025 1026 typedef UINT8 tBTA_BLE_MULTI_ADV_EVT; 1027 1028 /* multi adv callback */ 1029 typedef void (tBTA_BLE_MULTI_ADV_CBACK)(tBTA_BLE_MULTI_ADV_EVT event, 1030 UINT8 inst_id, void *p_ref, tBTA_STATUS status); 1031 typedef UINT32 tBTA_DM_BLE_REF_VALUE; 1032 1033 #define BTA_DM_BLE_PF_ENABLE_EVT BTM_BLE_PF_ENABLE 1034 #define BTA_DM_BLE_PF_CONFIG_EVT BTM_BLE_PF_CONFIG 1035 typedef UINT8 tBTA_DM_BLE_PF_EVT; 1036 1037 #define BTA_DM_BLE_PF_ENABLE 1 1038 #define BTA_DM_BLE_PF_CONFIG 2 1039 typedef UINT8 tBTA_DM_BLE_PF_ACTION; 1040 1041 /* Config callback */ 1042 typedef void (tBTA_DM_BLE_PF_CFG_CBACK) (tBTA_DM_BLE_PF_ACTION action, 1043 tBTA_DM_BLE_PF_COND_TYPE cfg_cond, 1044 tBTA_DM_BLE_PF_AVBL_SPACE avbl_space, tBTA_STATUS status, 1045 tBTA_DM_BLE_REF_VALUE ref_value); 1046 /* Param callback */ 1047 typedef void (tBTA_DM_BLE_PF_PARAM_CBACK) (UINT8 action_type, tBTA_DM_BLE_PF_AVBL_SPACE avbl_space, 1048 tBTA_DM_BLE_REF_VALUE ref_value, tBTA_STATUS status); 1049 1050 /* Status callback */ 1051 typedef void (tBTA_DM_BLE_PF_STATUS_CBACK) (UINT8 action, tBTA_STATUS status, 1052 tBTA_DM_BLE_REF_VALUE ref_value); 1053 1054 1055 #define BTA_DM_BLE_PF_BRDCAST_ADDR_FILT 1 1056 #define BTA_DM_BLE_PF_SERV_DATA_CHG_FILT 2 1057 #define BTA_DM_BLE_PF_SERV_UUID 4 1058 #define BTA_DM_BLE_PF_SERV_SOLC_UUID 8 1059 #define BTA_DM_BLE_PF_LOC_NAME_CHECK 16 1060 #define BTA_DM_BLE_PF_MANUF_NAME_CHECK 32 1061 #define BTA_DM_BLE_PF_SERV_DATA_CHECK 64 1062 typedef UINT16 tBTA_DM_BLE_PF_FEAT_SEL; 1063 1064 #define BTA_DM_BLE_PF_LIST_LOGIC_OR 1 1065 #define BTA_DM_BLE_PF_LIST_LOGIC_AND 2 1066 typedef UINT16 tBTA_DM_BLE_PF_LIST_LOGIC_TYPE; 1067 1068 #define BTA_DM_BLE_PF_FILT_LOGIC_OR 0 1069 #define BTA_DM_BLE_PF_FILT_LOGIC_AND 1 1070 typedef UINT16 tBTA_DM_BLE_PF_FILT_LOGIC_TYPE; 1071 1072 typedef UINT8 tBTA_DM_BLE_PF_RSSI_THRESHOLD; 1073 typedef UINT8 tBTA_DM_BLE_PF_DELIVERY_MODE; 1074 typedef UINT16 tBTA_DM_BLE_PF_TIMEOUT; 1075 typedef UINT8 tBTA_DM_BLE_PF_TIMEOUT_CNT; 1076 typedef UINT16 tBTA_DM_BLE_PF_ADV_TRACK_ENTRIES; 1077 1078 typedef struct { 1079 tBTA_DM_BLE_PF_FEAT_SEL feat_seln; 1080 tBTA_DM_BLE_PF_LIST_LOGIC_TYPE list_logic_type; 1081 tBTA_DM_BLE_PF_FILT_LOGIC_TYPE filt_logic_type; 1082 tBTA_DM_BLE_PF_RSSI_THRESHOLD rssi_high_thres; 1083 tBTA_DM_BLE_PF_RSSI_THRESHOLD rssi_low_thres; 1084 tBTA_DM_BLE_PF_DELIVERY_MODE dely_mode; 1085 tBTA_DM_BLE_PF_TIMEOUT found_timeout; 1086 tBTA_DM_BLE_PF_TIMEOUT lost_timeout; 1087 tBTA_DM_BLE_PF_TIMEOUT_CNT found_timeout_cnt; 1088 tBTA_DM_BLE_PF_ADV_TRACK_ENTRIES num_of_tracking_entries; 1089 } tBTA_DM_BLE_PF_FILT_PARAMS; 1090 1091 /* Search callback events */ 1092 #define BTA_DM_INQ_RES_EVT 0 /* Inquiry result for a peer device. */ 1093 #define BTA_DM_INQ_CMPL_EVT 1 /* Inquiry complete. */ 1094 #define BTA_DM_DISC_RES_EVT 2 /* Discovery result for a peer device. */ 1095 #define BTA_DM_DISC_BLE_RES_EVT 3 /* Discovery result for BLE GATT based servoce on a peer device. */ 1096 #define BTA_DM_DISC_CMPL_EVT 4 /* Discovery complete. */ 1097 #define BTA_DM_DI_DISC_CMPL_EVT 5 /* Discovery complete. */ 1098 #define BTA_DM_SEARCH_CANCEL_CMPL_EVT 6 /* Search cancelled */ 1099 #define BTA_DM_INQ_DISCARD_NUM_EVT 7 /* The number of inquiry discarded packets */ 1100 1101 typedef UINT8 tBTA_DM_SEARCH_EVT; 1102 1103 #define BTA_DM_INQ_RES_IGNORE_RSSI BTM_INQ_RES_IGNORE_RSSI /* 0x7f RSSI value not supplied (ignore it) */ 1104 1105 /* Structure associated with BTA_DM_INQ_RES_EVT */ 1106 typedef struct { 1107 BD_ADDR bd_addr; /* BD address peer device. */ 1108 DEV_CLASS dev_class; /* Device class of peer device. */ 1109 BOOLEAN remt_name_not_required; /* Application sets this flag if it already knows the name of the device */ 1110 /* If the device name is known to application BTA skips the remote name request */ 1111 BOOLEAN is_limited; /* TRUE, if the limited inquiry bit is set in the CoD */ 1112 INT8 rssi; /* The rssi value */ 1113 UINT8 *p_eir; /* Received EIR */ 1114 #if (BLE_INCLUDED == TRUE) 1115 UINT8 inq_result_type; 1116 UINT8 ble_addr_type; 1117 tBTM_BLE_EVT_TYPE ble_evt_type; 1118 tBT_DEVICE_TYPE device_type; 1119 UINT8 flag; 1120 UINT8 adv_data_len; 1121 UINT8 scan_rsp_len; 1122 #endif 1123 1124 } tBTA_DM_INQ_RES; 1125 1126 /* Structure associated with BTA_DM_INQ_CMPL_EVT */ 1127 typedef struct { 1128 UINT8 num_resps; /* Number of inquiry responses. */ 1129 } tBTA_DM_INQ_CMPL; 1130 1131 /* Structure associated with BTA_DM_INQ_DISCARD_NUM_EVT */ 1132 typedef struct { 1133 UINT32 num_dis; /* The number of inquiry discarded packets. */ 1134 } tBTA_DM_INQ_DISCARD; 1135 1136 /* Structure associated with BTA_DM_DI_DISC_CMPL_EVT */ 1137 typedef struct { 1138 BD_ADDR bd_addr; /* BD address peer device. */ 1139 UINT8 num_record; /* Number of DI record */ 1140 tBTA_STATUS result; 1141 } tBTA_DM_DI_DISC_CMPL; 1142 1143 /* Structure associated with BTA_DM_DISC_RES_EVT */ 1144 typedef struct { 1145 BD_ADDR bd_addr; /* BD address peer device. */ 1146 BD_NAME bd_name; /* Name of peer device. */ 1147 tBTA_SERVICE_MASK services; /* Services found on peer device. */ 1148 // btla-specific ++ 1149 UINT8 *p_raw_data; /* Raw data for discovery DB */ 1150 UINT32 raw_data_size; /* Size of raw data */ 1151 tBT_DEVICE_TYPE device_type; /* device type in case it is BLE device */ 1152 UINT32 num_uuids; 1153 UINT8 *p_uuid_list; 1154 // btla-specific -- 1155 tBTA_STATUS result; 1156 } tBTA_DM_DISC_RES; 1157 1158 /* Structure associated with tBTA_DM_DISC_BLE_RES */ 1159 typedef struct { 1160 BD_ADDR bd_addr; /* BD address peer device. */ 1161 BD_NAME bd_name; /* Name of peer device. */ 1162 tBT_UUID service; /* GATT based Services UUID found on peer device. */ 1163 } tBTA_DM_DISC_BLE_RES; 1164 1165 /* Structure associated with tBTA_DM_RMTNAME_CMPL */ 1166 typedef struct { 1167 BD_ADDR bd_addr; 1168 BD_NAME bd_name; 1169 tBTA_CMPL_CB *read_rmtname_cb; 1170 } tBTA_DM_RMTNAME_CMPL; 1171 1172 /* Union of all search callback structures */ 1173 typedef union { 1174 tBTA_DM_INQ_RES inq_res; /* Inquiry result for a peer device. */ 1175 tBTA_DM_INQ_CMPL inq_cmpl; /* Inquiry complete. */ 1176 tBTA_DM_DISC_RES disc_res; /* Discovery result for a peer device. */ 1177 tBTA_DM_DISC_BLE_RES disc_ble_res; /* Discovery result for GATT based service */ 1178 tBTA_DM_DI_DISC_CMPL di_disc; /* DI discovery result for a peer device */ 1179 tBTA_DM_INQ_DISCARD inq_dis; /* the discarded packets information of inquiry */ 1180 tBTA_DM_RMTNAME_CMPL rmt_name; /* the remote name information */ 1181 } tBTA_DM_SEARCH; 1182 1183 /* Structure of search callback event and structures */ 1184 typedef struct { 1185 tBTA_DM_SEARCH_EVT event; /* Search callback events */ 1186 UINT16 len; /* Length of p_data */ 1187 tBTA_DM_SEARCH *p_data; /* Union of all search callback structures */ 1188 } tBTA_DM_SEARCH_PARAM; 1189 1190 /* Search callback */ 1191 typedef void (tBTA_DM_SEARCH_CBACK)(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH *p_data); 1192 1193 /* Execute call back */ 1194 typedef void (tBTA_DM_EXEC_CBACK) (void *p_param); 1195 1196 /* Encryption callback*/ 1197 typedef void (tBTA_DM_ENCRYPT_CBACK) (BD_ADDR bd_addr, tBTA_TRANSPORT transport, tBTA_STATUS result); 1198 1199 /* Relate to ESP_BLE_SEC_xxx in esp_gatt_defs.h */ 1200 #if BLE_INCLUDED == TRUE 1201 #define BTA_DM_BLE_SEC_NONE BTM_BLE_SEC_NONE 1202 #define BTA_DM_BLE_SEC_ENCRYPT BTM_BLE_SEC_ENCRYPT 1203 #define BTA_DM_BLE_SEC_NO_MITM BTM_BLE_SEC_ENCRYPT_NO_MITM 1204 #define BTA_DM_BLE_SEC_MITM BTM_BLE_SEC_ENCRYPT_MITM 1205 typedef tBTM_BLE_SEC_ACT tBTA_DM_BLE_SEC_ACT; 1206 1207 typedef tBTM_BLE_TX_TIME_MS tBTA_DM_BLE_TX_TIME_MS; 1208 typedef tBTM_BLE_RX_TIME_MS tBTA_DM_BLE_RX_TIME_MS; 1209 typedef tBTM_BLE_IDLE_TIME_MS tBTA_DM_BLE_IDLE_TIME_MS; 1210 typedef tBTM_BLE_ENERGY_USED tBTA_DM_BLE_ENERGY_USED; 1211 1212 #define BTA_DM_CONTRL_UNKNOWN 0 /* Unknown state */ 1213 #define BTA_DM_CONTRL_ACTIVE 1 /* ACL link on, SCO link ongoing, sniff mode */ 1214 #define BTA_DM_CONTRL_SCAN 2 /* Scan state - paging/inquiry/trying to connect*/ 1215 #define BTA_DM_CONTRL_IDLE 3 /* Idle state - page scan, LE advt, inquiry scan */ 1216 1217 typedef UINT8 tBTA_DM_CONTRL_STATE; 1218 1219 typedef UINT8 tBTA_DM_BLE_ADV_STATE; 1220 typedef UINT8 tBTA_DM_BLE_ADV_INFO_PRESENT; 1221 typedef UINT8 tBTA_DM_BLE_RSSI_VALUE; 1222 typedef UINT16 tBTA_DM_BLE_ADV_INFO_TIMESTAMP; 1223 1224 typedef tBTM_BLE_TRACK_ADV_DATA tBTA_DM_BLE_TRACK_ADV_DATA; 1225 1226 typedef void (tBTA_BLE_SCAN_THRESHOLD_CBACK)(tBTA_DM_BLE_REF_VALUE ref_value); 1227 1228 typedef void (tBTA_BLE_SCAN_REP_CBACK) (tBTA_DM_BLE_REF_VALUE ref_value, UINT8 report_format, 1229 UINT8 num_records, UINT16 data_len, 1230 UINT8 *p_rep_data, tBTA_STATUS status); 1231 1232 typedef void (tBTA_BLE_SCAN_SETUP_CBACK) (tBTA_BLE_BATCH_SCAN_EVT evt, 1233 tBTA_DM_BLE_REF_VALUE ref_value, 1234 tBTA_STATUS status); 1235 1236 typedef void (tBTA_START_STOP_SCAN_CMPL_CBACK) (tBTA_STATUS status); 1237 1238 typedef void (tBTA_START_STOP_ADV_CMPL_CBACK) (tBTA_STATUS status); 1239 1240 typedef void (tBTA_BLE_TRACK_ADV_CMPL_CBACK)(int action, tBTA_STATUS status, 1241 tBTA_DM_BLE_PF_AVBL_SPACE avbl_space, 1242 tBTA_DM_BLE_REF_VALUE ref_value); 1243 1244 typedef void (tBTA_BLE_TRACK_ADV_CBACK)(tBTA_DM_BLE_TRACK_ADV_DATA *p_adv_data); 1245 1246 typedef void (tBTA_BLE_ENERGY_INFO_CBACK)(tBTA_DM_BLE_TX_TIME_MS tx_time, 1247 tBTA_DM_BLE_RX_TIME_MS rx_time, 1248 tBTA_DM_BLE_IDLE_TIME_MS idle_time, 1249 tBTA_DM_BLE_ENERGY_USED energy_used, 1250 tBTA_DM_CONTRL_STATE ctrl_state, 1251 tBTA_STATUS status); 1252 1253 #else 1254 typedef UINT8 tBTA_DM_BLE_SEC_ACT; 1255 #endif 1256 1257 /* Maximum service name length */ 1258 #define BTA_SERVICE_NAME_LEN 35 1259 #define BTA_SERVICE_DESP_LEN BTA_SERVICE_NAME_LEN 1260 #define BTA_PROVIDER_NAME_LEN BTA_SERVICE_NAME_LEN 1261 1262 1263 /* link policy masks */ 1264 #define BTA_DM_LP_SWITCH HCI_ENABLE_MASTER_SLAVE_SWITCH 1265 #define BTA_DM_LP_HOLD HCI_ENABLE_HOLD_MODE 1266 #define BTA_DM_LP_SNIFF HCI_ENABLE_SNIFF_MODE 1267 #define BTA_DM_LP_PARK HCI_ENABLE_PARK_MODE 1268 typedef UINT16 tBTA_DM_LP_MASK; 1269 1270 /* power mode actions */ 1271 #define BTA_DM_PM_NO_ACTION 0x00 /* no change to the current pm setting */ 1272 #define BTA_DM_PM_PARK 0x10 /* prefers park mode */ 1273 #define BTA_DM_PM_SNIFF 0x20 /* prefers sniff mode */ 1274 #define BTA_DM_PM_SNIFF1 0x21 /* prefers sniff1 mode */ 1275 #define BTA_DM_PM_SNIFF2 0x22 /* prefers sniff2 mode */ 1276 #define BTA_DM_PM_SNIFF3 0x23 /* prefers sniff3 mode */ 1277 #define BTA_DM_PM_SNIFF4 0x24 /* prefers sniff4 mode */ 1278 #define BTA_DM_PM_SNIFF5 0x25 /* prefers sniff5 mode */ 1279 #define BTA_DM_PM_SNIFF6 0x26 /* prefers sniff6 mode */ 1280 #define BTA_DM_PM_SNIFF7 0x27 /* prefers sniff7 mode */ 1281 #define BTA_DM_PM_SNIFF_USER0 0x28 /* prefers user-defined sniff0 mode (testtool only) */ 1282 #define BTA_DM_PM_SNIFF_USER1 0x29 /* prefers user-defined sniff1 mode (testtool only) */ 1283 #define BTA_DM_PM_ACTIVE 0x40 /* prefers active mode */ 1284 #define BTA_DM_PM_RETRY 0x80 /* retry power mode based on current settings */ 1285 #define BTA_DM_PM_SUSPEND 0x04 /* prefers suspend mode */ 1286 #define BTA_DM_PM_NO_PREF 0x01 /* service has no preference on power mode setting. eg. connection to service got closed */ 1287 1288 typedef UINT8 tBTA_DM_PM_ACTION; 1289 1290 /* index to bta_dm_ssr_spec */ 1291 #define BTA_DM_PM_SSR0 0 1292 #define BTA_DM_PM_SSR1 1 /* BTA_DM_PM_SSR1 will be dedicated for 1293 HH SSR setting entry, no other profile can use it */ 1294 #define BTA_DM_PM_SSR2 2 1295 #define BTA_DM_PM_SSR3 3 1296 #define BTA_DM_PM_SSR4 4 1297 #define BTA_DM_PM_SSR5 5 1298 #define BTA_DM_PM_SSR6 6 1299 1300 #define BTA_DM_PM_NUM_EVTS 9 1301 1302 #ifndef BTA_DM_PM_PARK_IDX 1303 #define BTA_DM_PM_PARK_IDX 5 /* the actual index to bta_dm_pm_md[] for PARK mode */ 1304 #endif 1305 1306 #ifndef BTA_DM_PM_SNIFF_A2DP_IDX 1307 #define BTA_DM_PM_SNIFF_A2DP_IDX BTA_DM_PM_SNIFF 1308 #endif 1309 1310 #ifndef BTA_DM_PM_SNIFF_AVK_IDLE_IDX 1311 #define BTA_DM_PM_SNIFF_AVK_IDLE_IDX BTA_DM_PM_SNIFF4 1312 #endif 1313 1314 #ifndef BTA_DM_PM_SNIFF_JV_IDX 1315 #define BTA_DM_PM_SNIFF_JV_IDX BTA_DM_PM_SNIFF 1316 #endif 1317 1318 #ifndef BTA_DM_PM_SNIFF_HD_IDLE_IDX 1319 #define BTA_DM_PM_SNIFF_HD_IDLE_IDX BTA_DM_PM_SNIFF4 1320 #endif 1321 1322 #ifndef BTA_DM_PM_SNIFF_SCO_OPEN_IDX 1323 #define BTA_DM_PM_SNIFF_SCO_OPEN_IDX BTA_DM_PM_SNIFF3 1324 #endif 1325 1326 #ifndef BTA_DM_PM_SNIFF_HD_ACTIVE_IDX 1327 #define BTA_DM_PM_SNIFF_HD_ACTIVE_IDX BTA_DM_PM_SNIFF5 1328 #endif 1329 1330 #ifndef BTA_DM_PM_SNIFF_HH_OPEN_IDX 1331 #define BTA_DM_PM_SNIFF_HH_OPEN_IDX BTA_DM_PM_SNIFF4 1332 #endif 1333 1334 #ifndef BTA_DM_PM_SNIFF_HH_ACTIVE_IDX 1335 #define BTA_DM_PM_SNIFF_HH_ACTIVE_IDX BTA_DM_PM_SNIFF4 1336 #endif 1337 1338 #ifndef BTA_DM_PM_SNIFF_HH_IDLE_IDX 1339 #define BTA_DM_PM_SNIFF_HH_IDLE_IDX BTA_DM_PM_SNIFF4 1340 #endif 1341 1342 #ifndef BTA_DM_PM_HH_OPEN_DELAY 1343 #define BTA_DM_PM_HH_OPEN_DELAY 30000 1344 #endif 1345 1346 #ifndef BTA_DM_PM_HH_ACTIVE_DELAY 1347 #define BTA_DM_PM_HH_ACTIVE_DELAY 30000 1348 #endif 1349 1350 #ifndef BTA_DM_PM_HH_IDLE_DELAY 1351 #define BTA_DM_PM_HH_IDLE_DELAY 30000 1352 #endif 1353 1354 /* The Sniff Parameters defined below must be ordered from highest 1355 * latency (biggest interval) to lowest latency. If there is a conflict 1356 * among the connected services the setting with the lowest latency will 1357 * be selected. If a device should override a sniff parameter then it 1358 * must insure that order is maintained. 1359 */ 1360 #ifndef BTA_DM_PM_SNIFF_MAX 1361 #define BTA_DM_PM_SNIFF_MAX 800 1362 #define BTA_DM_PM_SNIFF_MIN 400 1363 #define BTA_DM_PM_SNIFF_ATTEMPT 4 1364 #define BTA_DM_PM_SNIFF_TIMEOUT 1 1365 #endif 1366 1367 #ifndef BTA_DM_PM_SNIFF1_MAX 1368 #define BTA_DM_PM_SNIFF1_MAX 400 1369 #define BTA_DM_PM_SNIFF1_MIN 200 1370 #define BTA_DM_PM_SNIFF1_ATTEMPT 4 1371 #define BTA_DM_PM_SNIFF1_TIMEOUT 1 1372 #endif 1373 1374 #ifndef BTA_DM_PM_SNIFF2_MAX 1375 #define BTA_DM_PM_SNIFF2_MAX 180 //54 1376 #define BTA_DM_PM_SNIFF2_MIN 150 //30 1377 #define BTA_DM_PM_SNIFF2_ATTEMPT 4 1378 #define BTA_DM_PM_SNIFF2_TIMEOUT 1 1379 #endif 1380 1381 #ifndef BTA_DM_PM_SNIFF3_MAX 1382 #define BTA_DM_PM_SNIFF3_MAX 150 1383 #define BTA_DM_PM_SNIFF3_MIN 50 1384 #define BTA_DM_PM_SNIFF3_ATTEMPT 4 1385 #define BTA_DM_PM_SNIFF3_TIMEOUT 1 1386 #endif 1387 1388 #ifndef BTA_DM_PM_SNIFF4_MAX 1389 #define BTA_DM_PM_SNIFF4_MAX 54 //18 1390 #define BTA_DM_PM_SNIFF4_MIN 30 //10 1391 #define BTA_DM_PM_SNIFF4_ATTEMPT 4 1392 #define BTA_DM_PM_SNIFF4_TIMEOUT 1 1393 #endif 1394 1395 #ifndef BTA_DM_PM_SNIFF5_MAX 1396 #define BTA_DM_PM_SNIFF5_MAX 18 1397 #define BTA_DM_PM_SNIFF5_MIN 10 1398 #define BTA_DM_PM_SNIFF5_ATTEMPT 4 1399 #define BTA_DM_PM_SNIFF5_TIMEOUT 1 1400 #endif 1401 1402 #ifndef BTA_DM_PM_PARK_MAX 1403 #define BTA_DM_PM_PARK_MAX 800 1404 #define BTA_DM_PM_PARK_MIN 400 1405 #define BTA_DM_PM_PARK_ATTEMPT 0 1406 #define BTA_DM_PM_PARK_TIMEOUT 0 1407 #endif 1408 1409 1410 /* Switch callback events */ 1411 #define BTA_DM_SWITCH_CMPL_EVT 0 /* Completion of the Switch API */ 1412 1413 typedef UINT8 tBTA_DM_SWITCH_EVT; 1414 typedef void (tBTA_DM_SWITCH_CBACK)(tBTA_DM_SWITCH_EVT event, tBTA_STATUS status); 1415 1416 /* Audio routing out configuration */ 1417 #define BTA_DM_ROUTE_NONE 0x00 /* No Audio output */ 1418 #define BTA_DM_ROUTE_DAC 0x01 /* routing over analog output */ 1419 #define BTA_DM_ROUTE_I2S 0x02 /* routing over digital (I2S) output */ 1420 #define BTA_DM_ROUTE_BT_MONO 0x04 /* routing over SCO */ 1421 #define BTA_DM_ROUTE_BT_STEREO 0x08 /* routing over BT Stereo */ 1422 #define BTA_DM_ROUTE_HOST 0x10 /* routing over Host */ 1423 #define BTA_DM_ROUTE_FMTX 0x20 /* routing over FMTX */ 1424 #define BTA_DM_ROUTE_FMRX 0x40 /* routing over FMRX */ 1425 #define BTA_DM_ROUTE_BTSNK 0x80 /* routing over BT SNK */ 1426 1427 typedef UINT8 tBTA_DM_ROUTE_PATH; 1428 1429 #if (SDP_INCLUDED == TRUE) 1430 /* Device Identification (DI) data structure 1431 */ 1432 /* Used to set the DI record */ 1433 typedef tSDP_DI_RECORD tBTA_DI_RECORD; 1434 /* Used to get the DI record */ 1435 typedef tSDP_DI_GET_RECORD tBTA_DI_GET_RECORD; 1436 /* SDP discovery database */ 1437 typedef tSDP_DISCOVERY_DB tBTA_DISCOVERY_DB; 1438 #endif ///SDP_INCLUDED == TRUE 1439 1440 #ifndef BTA_DI_NUM_MAX 1441 #define BTA_DI_NUM_MAX 3 1442 #endif 1443 1444 /* Device features mask definitions */ 1445 #define BTA_FEATURE_BYTES_PER_PAGE BTM_FEATURE_BYTES_PER_PAGE 1446 #define BTA_EXT_FEATURES_PAGE_MAX BTM_EXT_FEATURES_PAGE_MAX 1447 /* ACL type 1448 */ 1449 #define BTA_DM_LINK_TYPE_BR_EDR 0x01 1450 #define BTA_DM_LINK_TYPE_LE 0x02 1451 #define BTA_DM_LINK_TYPE_ALL 0xFF 1452 typedef UINT8 tBTA_DM_LINK_TYPE; 1453 1454 #define IMMEDIATE_DELY_MODE 0x00 1455 #define ONFOUND_DELY_MODE 0x01 1456 #define BATCH_DELY_MODE 0x02 1457 #define ALLOW_ALL_FILTER 0x00 1458 #define LOWEST_RSSI_VALUE 129 1459 #if (BLE_50_FEATURE_SUPPORT == TRUE) 1460 #define BTA_DM_BLE_GAP_SET_EXT_ADV_PROP_CONNECTABLE (1 << 0) 1461 #define BTA_DM_BLE_GAP_SET_EXT_ADV_PROP_SCANNABLE (1 << 1) 1462 #define BTA_DM_BLE_GAP_SET_EXT_ADV_PROP_DIRECTED (1 << 2) 1463 #define BTA_DM_BLE_GAP_SET_EXT_ADV_PROP_HD_DIRECTED (1 << 3) 1464 #define BTA_DM_BLE_GAP_SET_EXT_ADV_PROP_LEGACY (1 << 4) 1465 #define BTA_DM_BLE_GAP_SET_EXT_ADV_PROP_ANON_ADV (1 << 5) 1466 #define BTA_DM_BLE_GAP_SET_EXT_ADV_PROP_INCLUDE_TX_PWR (1 << 6) 1467 #define BTA_DM_BLE_GAP_SET_EXT_ADV_PROP_MASK (0x7F) 1468 1469 #define BTA_DM_BLE_GAP_SET_EXT_ADV_PROP_LEGACY_IND (ESP_BLE_GAP_SET_EXT_ADV_PROP_LEGACY |\ 1470 ESP_BLE_GAP_SET_EXT_ADV_PROP_CONNECTABLE |\ 1471 ESP_BLE_GAP_SET_EXT_ADV_PROP_SCANNABLE) 1472 #define BTA_DM_BLE_GAP_SET_EXT_ADV_PROP_LEGACY_LD_DIR (ESP_BLE_GAP_SET_EXT_ADV_PROP_LEGACY |\ 1473 ESP_BLE_GAP_SET_EXT_ADV_PROP_CONNECTABLE |\ 1474 ESP_BLE_GAP_SET_EXT_ADV_PROP_DIRECTED) 1475 #define BTA_DM_BLE_GAP_SET_EXT_ADV_PROP_LEGACY_HD_DIR (ESP_BLE_GAP_SET_EXT_ADV_PROP_LEGACY |\ 1476 ESP_BLE_GAP_SET_EXT_ADV_PROP_CONNECTABLE |\ 1477 ESP_BLE_GAP_SET_EXT_ADV_PROP_HD_DIRECTED) 1478 #define BTA_DM_BLE_GAP_SET_EXT_ADV_PROP_LEGACY_SCAN (ESP_BLE_GAP_SET_EXT_ADV_PROP_LEGACY |\ 1479 ESP_BLE_GAP_SET_EXT_ADV_PROP_SCANNABLE) 1480 #define BTA_DM_BLE_GAP_SET_EXT_ADV_PROP_LEGACY_NONCONN (ESP_BLE_GAP_SET_EXT_ADV_PROP_LEGACY) 1481 typedef UINT16 tBTA_DM_BLE_EXT_ADV_TYPE_MASK; 1482 1483 1484 #define BTA_DM_BLE_GAP_PHY_1M 1 1485 #define BTA_DM_BLE_GAP_PHY_2M 2 1486 #define BTA_DM_BLE_GAP_PHY_CODED 3 1487 typedef UINT8 tBTA_DM_BLE_GAP_PHY; 1488 1489 #define BTA_DM_BLE_GAP_PHY_NO_TX_PREF_MASK (0x01) 1490 #define BTA_DM_BLE_GAP_PHY_NO_RX_PREF_MASK (0x02) 1491 #define BTA_DM_BLE_GAP_PHY_1M_PREF_MASK (0x03) 1492 #define BTA_DM_BLE_GAP_PHY_2M_PREF_MASK (0x04) 1493 #define BTA_DM_BLE_GAP_PHY_CODED_PREF_MASK (0x05) 1494 typedef UINT8 tBTA_DM_BLE_GAP_PHY_MASK; 1495 1496 #define BTA_DM_BLE_GAP_EXT_SCAN_UNCODE_MASK 0x01 1497 #define BTA_DM_BLE_GAP_EXT_SCAN_CODE_MASK 0x02 1498 typedef UINT8 tBTA_DM_BLE_EXT_SCAN_CFG_MASK; 1499 1500 1501 typedef struct { 1502 tBTA_DM_BLE_EXT_ADV_TYPE_MASK type; 1503 UINT32 interval_min; 1504 UINT32 interval_max; 1505 tBTA_BLE_ADV_CHNL_MAP channel_map; 1506 tBLE_ADDR_TYPE own_addr_type; 1507 tBLE_ADDR_TYPE peer_addr_type; 1508 BD_ADDR peer_addr; 1509 tBTA_BLE_AFP filter_policy; 1510 INT8 tx_power; 1511 tBTA_DM_BLE_GAP_PHY primary_phy; 1512 UINT8 max_skip; 1513 tBTA_DM_BLE_GAP_PHY secondary_phy; 1514 UINT8 sid; 1515 BOOLEAN scan_req_notif; 1516 } tBTA_DM_BLE_GAP_EXT_ADV_PARAMS; 1517 1518 typedef struct { 1519 UINT8 instance; 1520 int duration; 1521 int max_events; 1522 } tBTA_DM_BLE_EXT_ADV; 1523 1524 typedef struct { 1525 UINT16 interval_min; 1526 UINT16 interval_max; 1527 UINT8 properties; 1528 } tBTA_DM_BLE_Periodic_Adv_Params; 1529 1530 typedef struct { 1531 UINT8 filter_policy; 1532 UINT8 sid; 1533 tBLE_ADDR_TYPE addr_type; 1534 BD_ADDR addr; 1535 UINT16 skip; 1536 UINT16 sync_timeout; 1537 } tBTA_DM_BLE_Periodic_Sync_Params; 1538 1539 typedef struct { 1540 tBLE_SCAN_MODE scan_type; 1541 UINT16 scan_interval; 1542 UINT16 scan_window; 1543 } tBTA_DM_BLE_EXT_SCAN_CFG; 1544 1545 typedef struct { 1546 tBLE_ADDR_TYPE own_addr_type; 1547 UINT8 filter_policy; 1548 UINT8 scan_duplicate; 1549 tBTA_DM_BLE_EXT_SCAN_CFG_MASK cfg_mask; 1550 tBTA_DM_BLE_EXT_SCAN_CFG uncoded_cfg; 1551 tBTA_DM_BLE_EXT_SCAN_CFG coded_cfg; 1552 } tBTA_DM_BLE_EXT_SCAN_PARAMS; 1553 1554 typedef struct { 1555 UINT16 scan_interval; 1556 UINT16 scan_window; 1557 UINT16 interval_min; 1558 UINT16 interval_max; 1559 UINT16 latency; 1560 UINT16 supervision_timeout; 1561 UINT16 min_ce_len; 1562 UINT16 max_ce_len; 1563 } tBTA_DM_BLE_CONN_PARAMS; 1564 1565 #define BTA_DM_BLE_5_GAP_READ_PHY_COMPLETE_EVT BTM_BLE_5_GAP_READ_PHY_COMPLETE_EVT 1566 #define BTA_DM_BLE_5_GAP_SET_PREFERED_DEFAULT_PHY_COMPLETE_EVT BTM_BLE_5_GAP_SET_PREFERED_DEFAULT_PHY_COMPLETE_EVT 1567 #define BTA_DM_BLE_5_GAP_SET_PREFERED_PHY_COMPLETE_EVT BTM_BLE_5_GAP_SET_PREFERED_PHY_COMPLETE_EVT 1568 #define BTA_DM_BLE_5_GAP_EXT_ADV_SET_RAND_ADDR_COMPLETE_EVT BTM_BLE_5_GAP_EXT_ADV_SET_RAND_ADDR_COMPLETE_EVT 1569 #define BTA_DM_BLE_5_GAP_EXT_ADV_SET_PARAMS_COMPLETE_EVT BTM_BLE_5_GAP_EXT_ADV_SET_PARAMS_COMPLETE_EVT 1570 #define BTA_DM_BLE_5_GAP_EXT_ADV_DATA_SET_COMPLETE_EVT BTM_BLE_5_GAP_EXT_ADV_DATA_SET_COMPLETE_EVT 1571 #define BTA_DM_BLE_5_GAP_EXT_SCAN_RSP_DATA_SET_COMPLETE_EVT BTM_BLE_5_GAP_EXT_SCAN_RSP_DATA_SET_COMPLETE_EVT 1572 #define BTA_DM_BLE_5_GAP_EXT_ADV_START_COMPLETE_EVT BTM_BLE_5_GAP_EXT_ADV_START_COMPLETE_EVT 1573 #define BTA_DM_BLE_5_GAP_EXT_ADV_STOP_COMPLETE_EVT BTM_BLE_5_GAP_EXT_ADV_STOP_COMPLETE_EVT 1574 #define BTA_DM_BLE_5_GAP_EXT_ADV_SET_REMOVE_COMPLETE_EVT BTM_BLE_5_GAP_EXT_ADV_SET_REMOVE_COMPLETE_EVT 1575 #define BTA_DM_BLE_5_GAP_EXT_ADV_SET_CLEAR_COMPLETE_EVT BTM_BLE_5_GAP_EXT_ADV_SET_CLEAR_COMPLETE_EVT 1576 #define BTA_DM_BLE_5_GAP_PERIODIC_ADV_SET_PARAMS_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_SET_PARAMS_COMPLETE_EVT 1577 #define BTA_DM_BLE_5_GAP_PERIODIC_ADV_DATA_SET_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_DATA_SET_COMPLETE_EVT 1578 #define BTA_DM_BLE_5_GAP_PERIODIC_ADV_START_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_START_COMPLETE_EVT 1579 #define BTA_DM_BLE_5_GAP_PERIODIC_ADV_STOP_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_STOP_COMPLETE_EVT 1580 #define BTA_DM_BLE_5_GAP_PERIODIC_ADV_CREATE_SYNC_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_CREATE_SYNC_COMPLETE_EVT 1581 #define BTA_DM_BLE_5_GAP_PERIODIC_ADV_SYNC_CANCEL_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_SYNC_CANCEL_COMPLETE_EVT 1582 #define BTA_DM_BLE_5_GAP_PERIODIC_ADV_SYNC_TERMINATE_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_SYNC_TERMINATE_COMPLETE_EVT 1583 #define BTA_DM_BLE_5_GAP_PERIODIC_ADV_ADD_DEV_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_ADD_DEV_COMPLETE_EVT 1584 #define BTA_DM_BLE_5_GAP_PERIODIC_ADV_REMOVE_DEV_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_REMOVE_DEV_COMPLETE_EVT 1585 #define BTA_DM_BLE_5_GAP_PERIODIC_ADV_CLEAR_DEV_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_CLEAR_DEV_COMPLETE_EVT 1586 #define BTA_DM_BLE_5_GAP_SET_EXT_SCAN_PARAMS_COMPLETE_EVT BTM_BLE_5_GAP_SET_EXT_SCAN_PARAMS_COMPLETE_EVT 1587 #define BTA_DM_BLE_5_GAP_EXT_SCAN_START_COMPLETE_EVT BTM_BLE_5_GAP_EXT_SCAN_START_COMPLETE_EVT 1588 #define BTA_DM_BLE_5_GAP_EXT_SCAN_STOP_COMPLETE_EVT BTM_BLE_5_GAP_EXT_SCAN_STOP_COMPLETE_EVT 1589 #define BTA_DM_BLE_5_GAP_PREFER_EXT_CONN_PARAMS_SET_COMPLETE_EVT BTM_BLE_5_GAP_PREFER_EXT_CONN_PARAMS_SET_COMPLETE_EVT 1590 #define BTA_DM_BLE_5_GAP_PHY_UPDATE_COMPLETE_EVT BTM_BLE_5_GAP_PHY_UPDATE_COMPLETE_EVT 1591 #define BTA_DM_BLE_5_GAP_EXT_ADV_REPORT_EVT BTM_BLE_5_GAP_EXT_ADV_REPORT_EVT 1592 #define BTA_DM_BLE_5_GAP_SCAN_TIMEOUT_EVT BTM_BLE_5_GAP_SCAN_TIMEOUT_EVT 1593 #define BTA_DM_BLE_5_GAP_ADV_TERMINATED_EVT BTM_BLE_5_GAP_ADV_TERMINATED_EVT 1594 #define BTA_DM_BLE_5_GAP_SCAN_REQ_RECEIVED_EVT BTM_BLE_5_GAP_SCAN_REQ_RECEIVED_EVT 1595 #define BTA_DM_BLE_5_GAP_CHANNEL_SELETE_ALGORITHM_EVT BTM_BLE_5_GAP_CHANNEL_SELETE_ALGORITHM_EVT 1596 #define BTA_DM_BLE_5_GAP_PERIODIC_ADV_REPORT_EVT BTM_BLE_5_GAP_PERIODIC_ADV_REPORT_EVT 1597 #define BTA_DM_BLE_5_GAP_PERIODIC_ADV_SYNC_LOST_EVT BTM_BLE_5_GAP_PERIODIC_ADV_SYNC_LOST_EVT 1598 #define BTA_DM_BLE_5_GAP_PERIODIC_ADV_SYNC_ESTAB_EVT BTM_BLE_5_GAP_PERIODIC_ADV_SYNC_ESTAB_EVT 1599 #define BTA_DM_BLE_5_GAP_UNKNOWN_EVT BTM_BLE_5_GAP_UNKNOWN_EVT 1600 typedef tBTM_BLE_5_GAP_EVENT tBTA_DM_BLE_5_GAP_EVENT; 1601 1602 typedef tBTM_BLE_5_GAP_CB_PARAMS tBTA_DM_BLE_5_GAP_CB_PARAMS; 1603 typedef tBTM_BLE_5_HCI_CBACK tBTA_DM_BLE_5_HCI_CBCAK; 1604 1605 extern tBTM_BLE_5_HCI_CBACK ble_5_hci_cb; 1606 1607 #endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) 1608 1609 /***************************************************************************** 1610 ** External Function Declarations 1611 *****************************************************************************/ 1612 #ifdef __cplusplus 1613 extern "C" 1614 { 1615 #endif 1616 1617 /******************************************************************************* 1618 ** 1619 ** Function BTA_EnableBluetooth 1620 ** 1621 ** Description This function initializes BTA and prepares BTA and the 1622 ** Bluetooth protocol stack for use. This function is 1623 ** typically called at startup or when Bluetooth services 1624 ** are required by the phone. This function must be called 1625 ** before calling any other API function. 1626 ** 1627 ** 1628 ** Returns BTA_SUCCESS if successful. 1629 ** BTA_FAIL if internal failure. 1630 ** 1631 *******************************************************************************/ 1632 extern tBTA_STATUS BTA_EnableBluetooth(tBTA_DM_SEC_CBACK *p_cback); 1633 1634 /******************************************************************************* 1635 ** 1636 ** Function BTA_DisableBluetooth 1637 ** 1638 ** Description This function disables BTA and the Bluetooth protocol 1639 ** stack. It is called when BTA is no longer being used 1640 ** by any application in the system. 1641 ** 1642 ** 1643 ** Returns void 1644 ** 1645 *******************************************************************************/ 1646 extern tBTA_STATUS BTA_DisableBluetooth(void); 1647 1648 /******************************************************************************* 1649 ** 1650 ** Function BTA_EnableTestMode 1651 ** 1652 ** Description Enables bluetooth device under test mode 1653 ** 1654 ** 1655 ** Returns tBTA_STATUS 1656 ** 1657 *******************************************************************************/ 1658 extern tBTA_STATUS BTA_EnableTestMode(void); 1659 1660 /******************************************************************************* 1661 ** 1662 ** Function BTA_DisableTestMode 1663 ** 1664 ** Description Disable bluetooth device under test mode 1665 ** 1666 ** 1667 ** Returns None 1668 ** 1669 *******************************************************************************/ 1670 extern void BTA_DisableTestMode(void); 1671 1672 /******************************************************************************* 1673 ** 1674 ** Function BTA_DmSetDeviceName 1675 ** 1676 ** Description This function sets the Bluetooth name of the local device. 1677 ** 1678 ** 1679 ** Returns void 1680 ** 1681 *******************************************************************************/ 1682 extern void BTA_DmSetDeviceName(const char *p_name); 1683 1684 /******************************************************************************* 1685 ** 1686 ** Function BTA_DmGetDeviceName 1687 ** 1688 ** Description This function gets the Bluetooth name of the local device. 1689 ** 1690 ** 1691 ** Returns void 1692 ** 1693 *******************************************************************************/ 1694 extern void BTA_DmGetDeviceName(tBTA_GET_DEV_NAME_CBACK *p_cback); 1695 1696 /******************************************************************************* 1697 ** 1698 ** Function BTA_DmGetRemoteName 1699 ** 1700 ** Description This function gets the peer device's Bluetooth name. 1701 ** 1702 ** 1703 ** Returns void 1704 ** 1705 *******************************************************************************/ 1706 extern void BTA_DmGetRemoteName(BD_ADDR remote_addr, tBTA_CMPL_CB *read_remote_name_cb); 1707 1708 /******************************************************************************* 1709 ** 1710 ** Function BTA_DmConfigEir 1711 ** 1712 ** Description This function config EIR data of the local device. 1713 ** 1714 ** 1715 ** Returns void 1716 ** 1717 *******************************************************************************/ 1718 extern void BTA_DmConfigEir(tBTA_DM_EIR_CONF *eir_config); 1719 1720 /******************************************************************************* 1721 ** 1722 ** Function BTA_DmSetAfhChannels 1723 ** 1724 ** Description This function sets the AFH channels 1725 ** 1726 ** 1727 ** Returns void 1728 ** 1729 *******************************************************************************/ 1730 void BTA_DmSetAfhChannels(const uint8_t *channels, tBTA_CMPL_CB *set_afh_cb); 1731 1732 #if (BTA_DM_QOS_INCLUDED == TRUE) 1733 /******************************************************************************* 1734 ** 1735 ** Function BTA_DmSetQos 1736 ** 1737 ** Description This function sets the QOS 1738 ** 1739 ** 1740 ** Returns void 1741 ** 1742 *******************************************************************************/ 1743 void BTA_DmSetQos(BD_ADDR bd_addr, UINT32 t_poll, tBTM_CMPL_CB *p_cb); 1744 #endif /// (BTA_DM_QOS_INCLUDED == TRUE) 1745 1746 #if (BLE_INCLUDED == TRUE) 1747 /******************************************************************************* 1748 ** 1749 ** Function BTA_DmBleSetChannels 1750 ** 1751 ** Description This function sets BLE channels 1752 ** 1753 ** 1754 ** Returns void 1755 ** 1756 *******************************************************************************/ 1757 void BTA_DmBleSetChannels(const uint8_t *channels, tBTA_CMPL_CB *set_channels_cb); 1758 1759 extern void BTA_DmUpdateWhiteList(BOOLEAN add_remove, BD_ADDR remote_addr, tBLE_ADDR_TYPE addr_type, tBTA_UPDATE_WHITELIST_CBACK *update_wl_cb); 1760 1761 extern void BTA_DmClearWhiteList(tBTA_UPDATE_WHITELIST_CBACK *update_wl_cb); 1762 1763 extern void BTA_DmBleReadAdvTxPower(tBTA_CMPL_CB *cmpl_cb); 1764 #endif ///BLE_INCLUDED == TRUE 1765 1766 extern void BTA_DmReadRSSI(BD_ADDR remote_addr, tBTA_TRANSPORT transport, tBTA_CMPL_CB *cmpl_cb); 1767 1768 /******************************************************************************* 1769 ** 1770 ** Function BTA_DmSetVisibility 1771 ** 1772 ** Description This function sets the Bluetooth connectable,discoverable, 1773 ** pairable and conn paired only modesmodes of the local device. 1774 ** This controls whether other Bluetooth devices can find and connect to 1775 ** the local device. 1776 ** 1777 ** 1778 ** Returns void 1779 ** 1780 *******************************************************************************/ 1781 extern void BTA_DmSetVisibility(tBTA_DM_DISC disc_mode, tBTA_DM_CONN conn_mode, UINT8 pairable_mode, UINT8 conn_filter); 1782 1783 /******************************************************************************* 1784 ** 1785 ** Function BTA_DmSearch 1786 ** 1787 ** Description This function searches for peer Bluetooth devices. It 1788 ** first performs an inquiry; for each device found from the 1789 ** inquiry it gets the remote name of the device. If 1790 ** parameter services is nonzero, service discovery will be 1791 ** performed on each device for the services specified. 1792 ** 1793 ** 1794 ** Returns void 1795 ** 1796 *******************************************************************************/ 1797 extern void BTA_DmSearch(tBTA_DM_INQ *p_dm_inq, tBTA_SERVICE_MASK services, 1798 tBTA_DM_SEARCH_CBACK *p_cback); 1799 1800 /******************************************************************************* 1801 ** 1802 ** Function BTA_DmSearchCancel 1803 ** 1804 ** Description This function cancels a search that has been initiated 1805 ** by calling BTA_DmSearch(). 1806 ** 1807 ** 1808 ** Returns void 1809 ** 1810 *******************************************************************************/ 1811 extern void BTA_DmSearchCancel(void); 1812 1813 /******************************************************************************* 1814 ** 1815 ** Function BTA_DmDiscover 1816 ** 1817 ** Description This function performs service discovery for the services 1818 ** of a particular peer device. 1819 ** 1820 ** 1821 ** Returns void 1822 ** 1823 *******************************************************************************/ 1824 #if (SDP_INCLUDED == TRUE) 1825 extern void BTA_DmDiscover(BD_ADDR bd_addr, tBTA_SERVICE_MASK services, 1826 tBTA_DM_SEARCH_CBACK *p_cback, BOOLEAN sdp_search); 1827 // btla-specific ++ 1828 /******************************************************************************* 1829 ** 1830 ** Function BTA_DmDiscoverUUID 1831 ** 1832 ** Description This function performs service discovery for the services 1833 ** of a particular peer device. 1834 ** 1835 ** 1836 ** Returns void 1837 ** 1838 *******************************************************************************/ 1839 extern void BTA_DmDiscoverUUID(BD_ADDR bd_addr, tSDP_UUID *uuid, 1840 tBTA_DM_SEARCH_CBACK *p_cback, BOOLEAN sdp_search); 1841 #endif ///SDP_INCLUDED == TRUE 1842 /******************************************************************************* 1843 ** 1844 ** Function BTA_DmGetCachedRemoteName 1845 ** 1846 ** Description Retieve cached remote name if available 1847 ** 1848 ** Returns BTA_SUCCESS if cached name was retrieved 1849 ** BTA_FAILURE if cached name is not available 1850 ** 1851 *******************************************************************************/ 1852 tBTA_STATUS BTA_DmGetCachedRemoteName(BD_ADDR remote_device, UINT8 **pp_cached_name); 1853 // btla-specific -- 1854 1855 /******************************************************************************* 1856 ** 1857 ** Function BTA_DmBond 1858 ** 1859 ** Description This function initiates a bonding procedure with a peer 1860 ** device. The bonding procedure enables authentication 1861 ** and optionally encryption on the Bluetooth link. 1862 ** 1863 ** 1864 ** Returns void 1865 ** 1866 *******************************************************************************/ 1867 extern void BTA_DmBond(BD_ADDR bd_addr); 1868 1869 /******************************************************************************* 1870 ** 1871 ** Function BTA_DmBondByTransport 1872 ** 1873 ** Description This function initiates a bonding procedure with a peer 1874 ** device by designated transport. The bonding procedure enables 1875 ** authentication and optionally encryption on the Bluetooth link. 1876 ** 1877 ** 1878 ** Returns void 1879 ** 1880 *******************************************************************************/ 1881 extern void BTA_DmBondByTransport(BD_ADDR bd_addr, tBTA_TRANSPORT transport); 1882 1883 1884 /******************************************************************************* 1885 ** 1886 ** Function BTA_DmBondCancel 1887 ** 1888 ** Description This function cancels a bonding procedure with a peer 1889 ** device. 1890 ** 1891 ** 1892 ** Returns void 1893 ** 1894 *******************************************************************************/ 1895 extern void BTA_DmBondCancel(BD_ADDR bd_addr); 1896 1897 /******************************************************************************* 1898 ** 1899 ** Function BTA_DMSetPinType 1900 ** 1901 ** Description This function sets pin type as BTM_PIN_TYPE_FIXED or BTM_PIN_TYPE_VARIABLE 1902 ** 1903 ** 1904 ** Returns void 1905 ** 1906 *******************************************************************************/ 1907 extern void BTA_DMSetPinType (UINT8 pin_type, UINT8 *pin_code, UINT8 pin_code_len); 1908 1909 /******************************************************************************* 1910 ** 1911 ** Function BTA_DmPinReply 1912 ** 1913 ** Description This function provides a PIN when one is requested by DM 1914 ** during a bonding procedure. The application should call 1915 ** this function after the security callback is called with 1916 ** a BTA_DM_PIN_REQ_EVT. 1917 ** 1918 ** 1919 ** Returns void 1920 ** 1921 *******************************************************************************/ 1922 extern void BTA_DmPinReply(BD_ADDR bd_addr, BOOLEAN accept, UINT8 pin_len, 1923 UINT8 *p_pin); 1924 1925 #if (BTM_OOB_INCLUDED == TRUE) 1926 /******************************************************************************* 1927 ** 1928 ** Function BTA_DmLocalOob 1929 ** 1930 ** Description This function retrieves the OOB data from local controller. 1931 ** The result is reported by bta_dm_co_loc_oob(). 1932 ** 1933 ** Returns void 1934 ** 1935 *******************************************************************************/ 1936 extern void BTA_DmLocalOob(void); 1937 1938 /******************************************************************************* 1939 ** 1940 ** Function BTA_DmOobReply 1941 ** 1942 ** This function is called to provide the OOB data for 1943 ** SMP in response to BTA_LE_OOB_REQ_EVT 1944 ** 1945 ** Parameters: bd_addr - Address of the peer device 1946 ** len - length of simple pairing Randomizer C 1947 ** p_value - simple pairing Randomizer C. 1948 ** 1949 ** Returns void 1950 ** 1951 *******************************************************************************/ 1952 extern void BTA_DmOobReply(BD_ADDR bd_addr, UINT8 len, UINT8 *p_value); 1953 1954 /******************************************************************************* 1955 ** 1956 ** Function BTA_DmSecureConnectionOobReply 1957 ** 1958 ** This function is called to provide the OOB data for 1959 ** SMP in response to BTA_LE_OOB_REQ_EVT when secure connection 1960 ** 1961 ** Parameters: bd_addr - Address of the peer device 1962 ** p_c - Pointer to Confirmation 1963 ** p_r - Pointer to Randomizer 1964 ** 1965 ** Returns void 1966 ** 1967 *******************************************************************************/ 1968 extern void BTA_DmSecureConnectionOobReply(BD_ADDR bd_addr, UINT8 *p_c, UINT8 *p_r); 1969 /******************************************************************************* 1970 ** 1971 ** Function BTA_DmSecureConnectionCreateOobData 1972 ** 1973 ** This function is called to create the OOB data for 1974 ** SMP when secure connection 1975 ** 1976 ** Returns void 1977 ** 1978 *******************************************************************************/ 1979 extern void BTA_DmSecureConnectionCreateOobData(void); 1980 #endif /* BTM_OOB_INCLUDED */ 1981 1982 /******************************************************************************* 1983 ** 1984 ** Function BTA_DmConfirm 1985 ** 1986 ** Description This function accepts or rejects the numerical value of the 1987 ** Simple Pairing process on BTA_DM_SP_CFM_REQ_EVT 1988 ** 1989 ** Returns void 1990 ** 1991 *******************************************************************************/ 1992 extern void BTA_DmConfirm(BD_ADDR bd_addr, BOOLEAN accept); 1993 1994 /******************************************************************************* 1995 ** 1996 ** Function BTA_DmPasskeyReqReply 1997 ** 1998 ** Description This function is called to provide the passkey for 1999 ** Simple Pairing in response to BTA_DM_SP_KEY_REQ_EVT 2000 ** 2001 ** Returns void 2002 ** 2003 *******************************************************************************/ 2004 extern void BTA_DmPasskeyReqReply(BOOLEAN accept, BD_ADDR bd_addr, UINT32 passkey); 2005 2006 /******************************************************************************* 2007 ** 2008 ** Function BTA_DmAddDevice 2009 ** 2010 ** Description This function adds a device to the security database list 2011 ** of peer devices. This function would typically be called 2012 ** at system startup to initialize the security database with 2013 ** known peer devices. This is a direct execution function 2014 ** that may lock task scheduling on some platforms. 2015 ** 2016 ** Returns void 2017 ** 2018 *******************************************************************************/ 2019 extern void BTA_DmAddDevice(BD_ADDR bd_addr, DEV_CLASS dev_class, 2020 LINK_KEY link_key, tBTA_SERVICE_MASK trusted_mask, 2021 BOOLEAN is_trusted, UINT8 key_type, 2022 tBTA_IO_CAP io_cap, UINT8 pin_length, 2023 UINT8 sc_support); 2024 2025 /******************************************************************************* 2026 ** 2027 ** Function BTA_DmRemoveDevice 2028 ** 2029 ** Description This function removes a device from the security database. 2030 ** This is a direct execution function that may lock task 2031 ** scheduling on some platforms. 2032 ** 2033 ** 2034 ** Returns BTA_SUCCESS if successful. 2035 ** BTA_FAIL if operation failed. 2036 ** 2037 *******************************************************************************/ 2038 extern tBTA_STATUS BTA_DmRemoveDevice(BD_ADDR bd_addr, tBT_TRANSPORT transport); 2039 2040 /******************************************************************************* 2041 ** 2042 ** Function BTA_GetEirService 2043 ** 2044 ** Description This function is called to get BTA service mask from EIR. 2045 ** 2046 ** Parameters p_eir - pointer of EIR significant part 2047 ** p_services - return the BTA service mask 2048 ** 2049 ** Returns None 2050 ** 2051 *******************************************************************************/ 2052 extern void BTA_GetEirService( UINT8 *p_eir, tBTA_SERVICE_MASK *p_services ); 2053 2054 /******************************************************************************* 2055 ** 2056 ** Function BTA_DmGetConnectionState 2057 ** 2058 ** Description Returns whether the remote device is currently connected. 2059 ** 2060 ** Returns 0 if the device is NOT connected. 2061 ** 2062 *******************************************************************************/ 2063 extern UINT16 BTA_DmGetConnectionState( BD_ADDR bd_addr ); 2064 2065 #if (SDP_INCLUDED == TRUE) 2066 /******************************************************************************* 2067 ** 2068 ** Function BTA_DmSetLocalDiRecord 2069 ** 2070 ** Description This function adds a DI record to the local SDP database. 2071 ** 2072 ** Returns BTA_SUCCESS if record set successfully, otherwise error code. 2073 ** 2074 *******************************************************************************/ 2075 extern tBTA_STATUS BTA_DmSetLocalDiRecord( tBTA_DI_RECORD *p_device_info, 2076 UINT32 *p_handle ); 2077 #endif ///SDP_INCLUDED == TRUE 2078 /******************************************************************************* 2079 ** 2080 ** 2081 ** Function BTA_DmCloseACL 2082 ** 2083 ** Description This function force to close an ACL connection and remove the 2084 ** device from the security database list of known devices. 2085 ** 2086 ** Parameters: bd_addr - Address of the peer device 2087 ** remove_dev - remove device or not after link down 2088 ** transport - which transport to close 2089 2090 ** 2091 ** Returns void. 2092 ** 2093 *******************************************************************************/ 2094 extern void BTA_DmCloseACL(BD_ADDR bd_addr, BOOLEAN remove_dev, tBTA_TRANSPORT transport); 2095 2096 /******************************************************************************* 2097 ** 2098 ** Function bta_dmexecutecallback 2099 ** 2100 ** Description This function will request BTA to execute a call back in the context of BTU task 2101 ** This API was named in lower case because it is only intended 2102 ** for the internal customers(like BTIF). 2103 ** 2104 ** Returns void 2105 ** 2106 *******************************************************************************/ 2107 extern void bta_dmexecutecallback (tBTA_DM_EXEC_CBACK *p_callback, void *p_param); 2108 2109 #if (BTM_SCO_HCI_INCLUDED == TRUE) 2110 /******************************************************************************* 2111 ** 2112 ** Function BTA_DmPcmInitSamples 2113 ** 2114 ** Description initialize the down sample converter. 2115 ** 2116 ** src_sps: original samples per second (source audio data) 2117 ** (ex. 44100, 48000) 2118 ** bits: number of bits per pcm sample (16) 2119 ** n_channels: number of channels (i.e. mono(1), stereo(2)...) 2120 ** 2121 ** Returns none 2122 ** 2123 *******************************************************************************/ 2124 extern void BTA_DmPcmInitSamples (UINT32 src_sps, UINT32 bits, UINT32 n_channels); 2125 2126 /******************************************************************************* 2127 ** 2128 ** Function BTA_DmPcmDeinitSamples 2129 ** 2130 ** Description Deinitialize the down sample converter. 2131 ** 2132 ** Returns none 2133 ** 2134 *******************************************************************************/ 2135 extern void BTA_DmPcmDeinitSamples(void); 2136 2137 /************************************************************************************** 2138 ** Function BTA_DmPcmResample 2139 ** 2140 ** Description Down sampling utility to convert higher sampling rate into 8K/16bits 2141 ** PCM samples. 2142 ** 2143 ** Parameters p_src: pointer to the buffer where the original sampling PCM 2144 ** are stored. 2145 ** in_bytes: Length of the input PCM sample buffer in byte. 2146 ** p_dst: pointer to the buffer which is to be used to store 2147 ** the converted PCM samples. 2148 ** 2149 ** 2150 ** Returns INT32: number of samples converted. 2151 ** 2152 **************************************************************************************/ 2153 extern INT32 BTA_DmPcmResample (void *p_src, UINT32 in_bytes, void *p_dst); 2154 #endif 2155 2156 #if ((defined BLE_INCLUDED) && (BLE_INCLUDED == TRUE)) 2157 /* BLE related API functions */ 2158 /******************************************************************************* 2159 ** 2160 ** Function BTA_DmBleSecurityGrant 2161 ** 2162 ** Description Grant security request access. 2163 ** 2164 ** Parameters: bd_addr - BD address of the peer 2165 ** res - security grant status. 2166 ** 2167 ** Returns void 2168 ** 2169 *******************************************************************************/ 2170 extern void BTA_DmBleSecurityGrant(BD_ADDR bd_addr, tBTA_DM_BLE_SEC_GRANT res); 2171 2172 2173 2174 /******************************************************************************* 2175 ** 2176 ** Function BTA_DmBleSetBgConnType 2177 ** 2178 ** Description This function is called to set BLE connectable mode for a 2179 ** peripheral device. 2180 ** 2181 ** Parameters bg_conn_type: it can be auto connection, or selective connection. 2182 ** p_select_cback: callback function when selective connection procedure 2183 ** is being used. 2184 ** 2185 ** Returns void 2186 ** 2187 *******************************************************************************/ 2188 extern void BTA_DmBleSetBgConnType(tBTA_DM_BLE_CONN_TYPE bg_conn_type, tBTA_DM_BLE_SEL_CBACK *p_select_cback); 2189 2190 /******************************************************************************* 2191 ** 2192 ** Function BTA_DmBlePasskeyReply 2193 ** 2194 ** Description Send BLE SMP passkey reply. 2195 ** 2196 ** Parameters: bd_addr - BD address of the peer 2197 ** accept - passkey entry sucessful or declined. 2198 ** passkey - passkey value, must be a 6 digit number, 2199 ** can be lead by 0. 2200 ** 2201 ** Returns void 2202 ** 2203 *******************************************************************************/ 2204 extern void BTA_DmBlePasskeyReply(BD_ADDR bd_addr, BOOLEAN accept, UINT32 passkey); 2205 2206 /******************************************************************************* 2207 ** 2208 ** Function BTA_DmBleSetStaticPasskey 2209 ** 2210 ** Description Set BLE SMP static passkey. 2211 ** 2212 ** Parameters: add - add static passkey when add is true 2213 ** clear static passkey when add is false 2214 ** passkey - static passkey value 2215 ** 2216 ** 2217 ** Returns void 2218 ** 2219 *******************************************************************************/ 2220 extern void BTA_DmBleSetStaticPasskey(bool add, uint32_t passkey); 2221 2222 /******************************************************************************* 2223 ** 2224 ** Function BTA_DmBleConfirmReply 2225 ** 2226 ** Description Send BLE SMP SC user confirmation reply. 2227 ** 2228 ** Parameters: bd_addr - BD address of the peer 2229 ** accept - numbers to compare are the same or different. 2230 ** 2231 ** Returns void 2232 ** 2233 *******************************************************************************/ 2234 extern void BTA_DmBleConfirmReply(BD_ADDR bd_addr, BOOLEAN accept); 2235 2236 /******************************************************************************* 2237 ** 2238 ** Function BTA_DmAddBleDevice 2239 ** 2240 ** Description Add a BLE device. This function will be normally called 2241 ** during host startup to restore all required information 2242 ** for a LE device stored in the NVRAM. 2243 ** 2244 ** Parameters: bd_addr - BD address of the peer 2245 ** dev_type - Remote device's device type. 2246 ** auth_mode - auth mode 2247 ** addr_type - LE device address type. 2248 ** 2249 ** Returns void 2250 ** 2251 *******************************************************************************/ 2252 extern void BTA_DmAddBleDevice(BD_ADDR bd_addr, tBLE_ADDR_TYPE addr_type, int auth_mode, 2253 tBT_DEVICE_TYPE dev_type); 2254 2255 2256 /******************************************************************************* 2257 ** 2258 ** Function BTA_DmAddBleKey 2259 ** 2260 ** Description Add/modify LE device information. This function will be 2261 ** normally called during host startup to restore all required 2262 ** information stored in the NVRAM. 2263 ** 2264 ** Parameters: bd_addr - BD address of the peer 2265 ** p_le_key - LE key values. 2266 ** key_type - LE SMP key type. 2267 ** 2268 ** Returns void 2269 ** 2270 *******************************************************************************/ 2271 extern void BTA_DmAddBleKey (BD_ADDR bd_addr, 2272 tBTA_LE_KEY_VALUE *p_le_key, 2273 tBTA_LE_KEY_TYPE key_type); 2274 2275 /******************************************************************************* 2276 ** 2277 ** Function BTA_DmSetBlePrefConnParams 2278 ** 2279 ** Description This function is called to set the preferred connection 2280 ** parameters when default connection parameter is not desired. 2281 ** 2282 ** Parameters: bd_addr - BD address of the peripheral 2283 ** min_conn_int - minimum preferred connection interval 2284 ** max_conn_int - maximum preferred connection interval 2285 ** slave_latency - preferred slave latency 2286 ** supervision_tout - preferred supervision timeout 2287 ** 2288 ** 2289 ** Returns void 2290 ** 2291 *******************************************************************************/ 2292 extern void BTA_DmSetBlePrefConnParams(BD_ADDR bd_addr, 2293 UINT16 min_conn_int, UINT16 max_conn_int, 2294 UINT16 slave_latency, UINT16 supervision_tout ); 2295 2296 /******************************************************************************* 2297 ** 2298 ** Function BTA_DmSetBleConnScanParams 2299 ** 2300 ** Description This function is called to set scan parameters used in 2301 ** BLE connection request 2302 ** 2303 ** Parameters: scan_interval - scan interval 2304 ** scan_window - scan window 2305 ** 2306 ** Returns void 2307 ** 2308 *******************************************************************************/ 2309 extern void BTA_DmSetBleConnScanParams(UINT32 scan_interval, 2310 UINT32 scan_window); 2311 2312 /******************************************************************************* 2313 ** 2314 ** Function BTA_DmSetBleScanParams 2315 ** 2316 ** Description This function is called to set scan parameters 2317 ** 2318 ** Parameters: client_if - Client IF 2319 ** scan_interval - scan interval 2320 ** scan_window - scan window 2321 ** scan_mode - scan mode 2322 ** scan_param_setup_status_cback - Set scan param status callback 2323 ** 2324 ** Returns void 2325 ** 2326 *******************************************************************************/ 2327 extern void BTA_DmSetBleScanParams(tGATT_IF client_if, UINT32 scan_interval, 2328 UINT32 scan_window, tBLE_SCAN_MODE scan_mode, 2329 tBLE_SCAN_PARAM_SETUP_CBACK scan_param_setup_status_cback); 2330 2331 2332 /******************************************************************************* 2333 ** 2334 ** Function BTA_DmSetBleScanFilterParams 2335 ** 2336 ** Description This function is called to set scan parameters 2337 ** 2338 ** Parameters: client_if - Client IF 2339 ** scan_interval - scan interval 2340 ** scan_window - scan window 2341 ** scan_mode - scan mode 2342 ** scan_duplicate_filter - scan duplicate filter 2343 ** scan_param_setup_status_cback - Set scan param status callback 2344 ** 2345 ** Returns void 2346 ** 2347 *******************************************************************************/ 2348 extern void BTA_DmSetBleScanFilterParams(tGATT_IF client_if, UINT32 scan_interval, 2349 UINT32 scan_window, tBLE_SCAN_MODE scan_mode, UINT8 scan_fil_poilcy, 2350 UINT8 addr_type_own, UINT8 scan_duplicate_filter, tBLE_SCAN_PARAM_SETUP_CBACK scan_param_setup_cback); 2351 2352 2353 /******************************************************************************* 2354 ** 2355 ** Function BTA_DmSetBleAdvParams 2356 ** 2357 ** Description This function sets the advertising parameters BLE functionality. 2358 ** It is to be called when device act in peripheral or broadcaster 2359 ** role. 2360 ** 2361 ** Parameters: adv_int_min - adv interval minimum 2362 ** adv_int_max - adv interval max 2363 ** p_dir_bda - directed adv initator address 2364 ** 2365 ** Returns void 2366 ** 2367 *******************************************************************************/ 2368 extern void BTA_DmSetBleAdvParams (UINT16 adv_int_min, UINT16 adv_int_max, 2369 tBLE_BD_ADDR *p_dir_bda); 2370 2371 extern void BTA_DmSetBleAdvParamsAll (UINT16 adv_int_min, UINT16 adv_int_max, 2372 UINT8 adv_type, tBLE_ADDR_TYPE addr_type_own, 2373 tBTM_BLE_ADV_CHNL_MAP chnl_map, tBTM_BLE_AFP adv_fil_pol, 2374 tBLE_BD_ADDR *p_dir_bda, tBTA_START_ADV_CMPL_CBACK p_start_adv_cb); 2375 2376 2377 /******************************************************************************* 2378 ** 2379 ** Function BTA_DmSearchExt 2380 ** 2381 ** Description This function searches for peer Bluetooth devices. It performs 2382 ** an inquiry and gets the remote name for devices. Service 2383 ** discovery is done if services is non zero 2384 ** 2385 ** Parameters p_dm_inq: inquiry conditions 2386 ** services: if service is not empty, service discovery will be done. 2387 ** for all GATT based service condition, put num_uuid, and 2388 ** p_uuid is the pointer to the list of UUID values. 2389 ** p_cback: callback functino when search is completed. 2390 ** 2391 ** 2392 ** 2393 ** Returns void 2394 ** 2395 *******************************************************************************/ 2396 extern void BTA_DmSearchExt(tBTA_DM_INQ *p_dm_inq, tBTA_SERVICE_MASK_EXT *p_services, 2397 tBTA_DM_SEARCH_CBACK *p_cback); 2398 2399 /******************************************************************************* 2400 ** 2401 ** Function BTA_DmDiscoverExt 2402 ** 2403 ** Description This function does service discovery for services of a 2404 ** peer device. When services.num_uuid is 0, it indicates all 2405 ** GATT based services are to be searched; other wise a list of 2406 ** UUID of interested services should be provided through 2407 ** services.p_uuid. 2408 ** 2409 ** 2410 ** 2411 ** Returns void 2412 ** 2413 *******************************************************************************/ 2414 extern void BTA_DmDiscoverExt(BD_ADDR bd_addr, tBTA_SERVICE_MASK_EXT *p_services, 2415 tBTA_DM_SEARCH_CBACK *p_cback, BOOLEAN sdp_search); 2416 2417 /******************************************************************************* 2418 ** 2419 ** Function BTA_DmDiscoverByTransport 2420 ** 2421 ** Description This function does service discovery on particular transport 2422 ** for services of a 2423 ** peer device. When services.num_uuid is 0, it indicates all 2424 ** GATT based services are to be searched; other wise a list of 2425 ** UUID of interested services should be provided through 2426 ** p_services->p_uuid. 2427 ** 2428 ** 2429 ** 2430 ** Returns void 2431 ** 2432 *******************************************************************************/ 2433 extern void BTA_DmDiscoverByTransport(BD_ADDR bd_addr, tBTA_SERVICE_MASK_EXT *p_services, 2434 tBTA_DM_SEARCH_CBACK *p_cback, BOOLEAN sdp_search, 2435 tBTA_TRANSPORT transport); 2436 2437 /******************************************************************************* 2438 ** 2439 ** Function BTA_DmSetEncryption 2440 ** 2441 ** Description This function is called to ensure that connection is 2442 ** encrypted. Should be called only on an open connection. 2443 ** Typically only needed for connections that first want to 2444 ** bring up unencrypted links, then later encrypt them. 2445 ** 2446 ** Parameters: bd_addr - Address of the peer device 2447 ** transport - transport of the link to be encruypted 2448 ** p_callback - Pointer to callback function to indicat the 2449 ** link encryption status 2450 ** sec_act - This is the security action to indicate 2451 ** what knid of BLE security level is required for 2452 ** the BLE link if the BLE is supported 2453 ** Note: This parameter is ignored for the BR/EDR link 2454 ** or the BLE is not supported 2455 ** 2456 ** Returns void 2457 ** 2458 ** 2459 *******************************************************************************/ 2460 extern void BTA_DmSetEncryption(BD_ADDR bd_addr, tBTA_TRANSPORT transport, 2461 tBTA_DM_ENCRYPT_CBACK *p_callback, 2462 tBTA_DM_BLE_SEC_ACT sec_act); 2463 2464 2465 /******************************************************************************* 2466 ** 2467 ** Function BTA_DmBleObserve 2468 ** 2469 ** Description This procedure keep the device listening for advertising 2470 ** events from a broadcast device. 2471 ** 2472 ** Parameters start: start or stop observe. 2473 ** duration : Duration of the scan. Continuous scan if 0 is passed 2474 ** p_results_cb: Callback to be called with scan results 2475 ** 2476 ** Returns void 2477 ** 2478 *******************************************************************************/ 2479 extern void BTA_DmBleObserve(BOOLEAN start, UINT32 duration, 2480 tBTA_DM_SEARCH_CBACK *p_results_cb, 2481 tBTA_START_STOP_SCAN_CMPL_CBACK *p_start_stop_scan_cb); 2482 2483 /******************************************************************************* 2484 ** 2485 ** Function BTA_DmBleScan 2486 ** 2487 ** Description This procedure keep the device listening for advertising 2488 ** events from a broadcast device. 2489 ** 2490 ** Parameters start: start or stop observe. 2491 ** duration : Duration of the scan. Continuous scan if 0 is passed 2492 ** p_results_cb: Callback to be called with scan results 2493 ** 2494 ** Returns void 2495 ** 2496 *******************************************************************************/ 2497 extern void BTA_DmBleScan(BOOLEAN start, UINT32 duration, 2498 tBTA_DM_SEARCH_CBACK *p_results_cb, 2499 tBTA_START_STOP_SCAN_CMPL_CBACK *p_start_stop_scan_cb); 2500 2501 extern void BTA_DmBleStopAdvertising(void); 2502 2503 extern void BTA_DmSetRandAddress(BD_ADDR rand_addr, tBTA_SET_RAND_ADDR_CBACK *p_set_rand_addr_cback); 2504 extern void BTA_DmClearRandAddress(void); 2505 2506 #endif 2507 2508 #if BLE_INCLUDED == TRUE 2509 // btla-specific -- 2510 /******************************************************************************* 2511 ** 2512 ** Function BTA_DmBleConfigLocalPrivacy 2513 ** 2514 ** Description Enable/disable privacy on the local device 2515 ** 2516 ** Parameters: privacy_enable - enable/disabe privacy on remote device. 2517 ** set_local_privacy_cback -callback to be called with result 2518 ** Returns void 2519 ** 2520 *******************************************************************************/ 2521 extern void BTA_DmBleConfigLocalPrivacy(BOOLEAN privacy_enable, tBTA_SET_LOCAL_PRIVACY_CBACK *set_local_privacy_cback); 2522 2523 /******************************************************************************* 2524 ** 2525 ** Function BTA_DmBleConfigLocalIcon 2526 ** 2527 ** Description set gap local icon 2528 ** 2529 ** Parameters: icon - appearance value. 2530 ** 2531 ** Returns void 2532 ** 2533 *******************************************************************************/ 2534 extern void BTA_DmBleConfigLocalIcon(uint16_t icon); 2535 2536 /******************************************************************************* 2537 ** 2538 ** Function BTA_DmBleEnableRemotePrivacy 2539 ** 2540 ** Description Enable/disable privacy on a remote device 2541 ** 2542 ** Parameters: bd_addr - BD address of the peer 2543 ** privacy_enable - enable/disabe privacy on remote device. 2544 ** 2545 ** Returns void 2546 ** 2547 *******************************************************************************/ 2548 extern void BTA_DmBleEnableRemotePrivacy(BD_ADDR bd_addr, BOOLEAN privacy_enable); 2549 2550 2551 /******************************************************************************* 2552 ** 2553 ** Function BTA_DmBleSetAdvConfig 2554 ** 2555 ** Description This function is called to override the BTA default ADV parameters. 2556 ** 2557 ** Parameters Pointer to User defined ADV data structure 2558 ** 2559 ** Returns None 2560 ** 2561 *******************************************************************************/ 2562 extern void BTA_DmBleSetAdvConfig (tBTA_BLE_AD_MASK data_mask, 2563 tBTA_BLE_ADV_DATA *p_adv_cfg, 2564 tBTA_SET_ADV_DATA_CMPL_CBACK *p_adv_data_cback); 2565 2566 /******************************************************************************* 2567 ** 2568 ** Function BTA_DmBleSetAdvConfigRaw 2569 ** 2570 ** Description This function is called to set raw Advertising data 2571 ** 2572 ** Parameters p_raw_adv : raw advertising data. 2573 ** raw_adv_len : raw advertising data length. 2574 ** p_adv_data_cback : set adv data complete callback. 2575 ** 2576 ** Returns None 2577 ** 2578 *******************************************************************************/ 2579 extern void BTA_DmBleSetAdvConfigRaw (UINT8 *p_raw_adv, UINT32 raw_adv_len, 2580 tBTA_SET_ADV_DATA_CMPL_CBACK *p_adv_data_cback); 2581 2582 /******************************************************************************* 2583 ** 2584 ** Function BTA_DmBleSetLongAdv 2585 ** 2586 ** Description This function is called to set long Advertising data 2587 ** 2588 ** Parameters adv_data : long advertising data. 2589 ** adv_data_len : long advertising data length. 2590 ** p_adv_data_cback : set long adv data complete callback. 2591 ** 2592 ** Returns None 2593 ** 2594 *******************************************************************************/ 2595 void BTA_DmBleSetLongAdv (UINT8 *adv_data, UINT32 adv_data_len, 2596 tBTA_SET_ADV_DATA_CMPL_CBACK *p_adv_data_cback); 2597 2598 /******************************************************************************* 2599 ** 2600 ** Function BTA_DmBleSetScanRsp 2601 ** 2602 ** Description This function is called to override the BTA scan response. 2603 ** 2604 ** Parameters Pointer to User defined ADV data structure 2605 ** 2606 ** Returns None 2607 ** 2608 *******************************************************************************/ 2609 extern void BTA_DmBleSetScanRsp (tBTA_BLE_AD_MASK data_mask, 2610 tBTA_BLE_ADV_DATA *p_adv_cfg, 2611 tBTA_SET_ADV_DATA_CMPL_CBACK *p_adv_data_cback); 2612 2613 /******************************************************************************* 2614 ** 2615 ** Function BTA_DmBleSetScanRspRaw 2616 ** 2617 ** Description This function is called to set raw scan response data 2618 ** 2619 ** Parameters p_raw_scan_rsp : raw scan_rspertising data. 2620 ** raw_scan_rsp_len : raw scan_rspertising data length. 2621 ** p_scan_rsp_data_cback : set scan_rsp data complete callback. 2622 ** 2623 ** Returns None 2624 ** 2625 *******************************************************************************/ 2626 extern void BTA_DmBleSetScanRspRaw (UINT8 *p_raw_scan_rsp, UINT32 raw_scan_rsp_len, 2627 tBTA_SET_ADV_DATA_CMPL_CBACK *p_scan_rsp_data_cback); 2628 2629 /******************************************************************************* 2630 ** 2631 ** Function BTA_DmUpdateDuplicateExceptionalList 2632 ** 2633 ** Description This function is called to update duplicate scan exceptional list 2634 ** 2635 ** Parameters subcode : add, remove or clean duplicate scan exceptional list. 2636 ** type : device info type. 2637 ** device_info: device info 2638 ** p_update_duplicate_ignore_list_cback : update complete callback. 2639 ** 2640 ** Returns None 2641 ** 2642 *******************************************************************************/ 2643 extern void BTA_DmUpdateDuplicateExceptionalList(UINT8 subcode, UINT32 type, 2644 BD_ADDR device_info, 2645 tBTA_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK p_update_duplicate_exceptional_list_cback); 2646 2647 /******************************************************************************* 2648 ** 2649 ** Function BTA_DmBleBroadcast 2650 ** 2651 ** Description This function starts or stops LE broadcasting. 2652 ** 2653 ** Parameters start: start or stop broadcast. 2654 ** p_start_stop_adv_cb: stop broadcast completed event 2655 ** 2656 ** Returns None 2657 ** 2658 *******************************************************************************/ 2659 extern void BTA_DmBleBroadcast (BOOLEAN start, tBTA_START_STOP_ADV_CMPL_CBACK *p_start_stop_adv_cb); 2660 2661 2662 /******************************************************************************* 2663 ** 2664 ** Function BTA_BleEnableAdvInstance 2665 ** 2666 ** Description This function enables the Multi ADV instance feature 2667 ** 2668 ** Parameters p_params Pointer to ADV param user defined structure 2669 ** p_cback Pointer to Multi ADV callback structure 2670 ** p_ref - Reference pointer 2671 ** 2672 ** Returns None 2673 ** 2674 *******************************************************************************/ 2675 extern void BTA_BleEnableAdvInstance (tBTA_BLE_ADV_PARAMS *p_params, 2676 tBTA_BLE_MULTI_ADV_CBACK *p_cback, void *p_ref); 2677 2678 /******************************************************************************* 2679 ** 2680 ** Function BTA_BleUpdateAdvInstParam 2681 ** 2682 ** Description This function updates the Multi ADV instance params 2683 ** 2684 ** Parameters inst_id Instance ID 2685 ** p_params Pointer to ADV param user defined structure 2686 ** 2687 ** Returns None 2688 ** 2689 *******************************************************************************/ 2690 extern void BTA_BleUpdateAdvInstParam (UINT8 inst_id, 2691 tBTA_BLE_ADV_PARAMS *p_params); 2692 2693 /******************************************************************************* 2694 ** 2695 ** Function BTA_BleCfgAdvInstData 2696 ** 2697 ** Description This function is called to configure the ADV instance data 2698 ** 2699 ** Parameters inst_id - Instance ID 2700 ** is_scan_rsp - Boolean value Scan response 2701 ** Pointer to User defined ADV data structure 2702 ** Returns None 2703 ** 2704 *******************************************************************************/ 2705 extern void BTA_BleCfgAdvInstData (UINT8 inst_id, BOOLEAN is_scan_rsp, 2706 tBTA_BLE_AD_MASK data_mask, tBTA_BLE_ADV_DATA *p_data); 2707 2708 /******************************************************************************* 2709 ** 2710 ** Function BTA_BleDisableAdvInstance 2711 ** 2712 ** Description This function is called to disable the ADV instance 2713 ** 2714 ** Parameters inst_id - Instance ID to be disabled 2715 ** 2716 ** Returns None 2717 ** 2718 *******************************************************************************/ 2719 extern void BTA_BleDisableAdvInstance(UINT8 inst_id); 2720 2721 /******************************************************************************* 2722 ** 2723 ** Function BTA_DmBleUpdateConnectionParams 2724 ** 2725 ** Description Update connection parameters, can only be used when connection is up. 2726 ** 2727 ** Parameters: bd_addr - BD address of the peer 2728 ** min_int - minimum connection interval, [0x0004~ 0x4000] 2729 ** max_int - maximum connection interval, [0x0004~ 0x4000] 2730 ** latency - slave latency [0 ~ 500] 2731 ** timeout - supervision timeout [0x000a ~ 0xc80] 2732 ** 2733 ** Returns void 2734 ** 2735 *******************************************************************************/ 2736 extern void BTA_DmBleUpdateConnectionParams(BD_ADDR bd_addr, UINT16 min_int, 2737 UINT16 max_int, UINT16 latency, UINT16 timeout); 2738 2739 /******************************************************************************* 2740 ** 2741 ** Function BTA_DmBleDisconnect 2742 ** 2743 ** Description This function is to disconnect the ble connection 2744 ** 2745 ** Returns void 2746 ** 2747 *******************************************************************************/ 2748 extern void BTA_DmBleDisconnect(BD_ADDR bd_addr); 2749 2750 /******************************************************************************* 2751 ** 2752 ** Function BTA_DmBleSetDataLength 2753 ** 2754 ** Description This function is to set maximum LE data packet size 2755 ** 2756 ** Returns void 2757 ** 2758 *******************************************************************************/ 2759 extern void BTA_DmBleSetDataLength(BD_ADDR remote_device, UINT16 tx_data_length, tBTA_SET_PKT_DATA_LENGTH_CBACK *p_set_pkt_data_cback); 2760 2761 /******************************************************************************* 2762 ** 2763 ** Function BTA_DmBleSetStorageParams 2764 ** 2765 ** Description This function is called to set the storage parameters 2766 ** 2767 ** Parameters batch_scan_full_max -Max storage space (in %) allocated to full scanning 2768 ** batch_scan_trunc_max -Max storage space (in %) allocated to truncated scanning 2769 ** batch_scan_notify_threshold - Setup notification level based on total space 2770 ** consumed by both pools. Setting it to 0 will disable threshold notification 2771 ** p_setup_cback - Setup callback 2772 ** p_thres_cback - Threshold callback 2773 ** p_rep_cback - Reports callback 2774 ** ref_value - Reference value 2775 ** 2776 ** Returns None 2777 ** 2778 *******************************************************************************/ 2779 extern void BTA_DmBleSetStorageParams(UINT8 batch_scan_full_max, 2780 UINT8 batch_scan_trunc_max, 2781 UINT8 batch_scan_notify_threshold, 2782 tBTA_BLE_SCAN_SETUP_CBACK *p_setup_cback, 2783 tBTA_BLE_SCAN_THRESHOLD_CBACK *p_thres_cback, 2784 tBTA_BLE_SCAN_REP_CBACK *p_rep_cback, 2785 tBTA_DM_BLE_REF_VALUE ref_value); 2786 2787 /******************************************************************************* 2788 ** 2789 ** Function BTA_DmBleEnableBatchScan 2790 ** 2791 ** Description This function is called to enable the batch scan 2792 ** 2793 ** Parameters scan_mode -Batch scan mode 2794 ** scan_interval - Scan interval 2795 ** scan_window - Scan window 2796 ** discard_rule -Discard rules 2797 ** addr_type - Address type 2798 ** ref_value - Reference value 2799 ** 2800 ** Returns None 2801 ** 2802 *******************************************************************************/ 2803 extern void BTA_DmBleEnableBatchScan(tBTA_BLE_BATCH_SCAN_MODE scan_mode, 2804 UINT32 scan_interval, UINT32 scan_window, 2805 tBTA_BLE_DISCARD_RULE discard_rule, 2806 tBLE_ADDR_TYPE addr_type, 2807 tBTA_DM_BLE_REF_VALUE ref_value); 2808 2809 /******************************************************************************* 2810 ** 2811 ** Function BTA_DmBleReadScanReports 2812 ** 2813 ** Description This function is called to read the batch scan reports 2814 ** 2815 ** Parameters scan_mode -Batch scan mode 2816 ** ref_value - Reference value 2817 ** 2818 ** Returns None 2819 ** 2820 *******************************************************************************/ 2821 extern void BTA_DmBleReadScanReports(tBTA_BLE_BATCH_SCAN_MODE scan_type, 2822 tBTA_DM_BLE_REF_VALUE ref_value); 2823 2824 /******************************************************************************* 2825 ** 2826 ** Function BTA_DmBleDisableBatchScan 2827 ** 2828 ** Description This function is called to disable the batch scanning 2829 ** 2830 ** Parameters ref_value - Reference value 2831 ** 2832 ** Returns None 2833 ** 2834 *******************************************************************************/ 2835 extern void BTA_DmBleDisableBatchScan(tBTA_DM_BLE_REF_VALUE ref_value); 2836 2837 /******************************************************************************* 2838 ** 2839 ** Function BTA_DmEnableScanFilter 2840 ** 2841 ** Description This function is called to enable the adv data payload filter 2842 ** 2843 ** Parameters action - enable or disable the APCF feature 2844 ** p_cmpl_cback - Command completed callback 2845 ** ref_value - Reference value 2846 ** 2847 ** Returns void 2848 ** 2849 *******************************************************************************/ 2850 extern void BTA_DmEnableScanFilter(UINT8 action, 2851 tBTA_DM_BLE_PF_STATUS_CBACK *p_cmpl_cback, 2852 tBTA_DM_BLE_REF_VALUE ref_value); 2853 2854 /******************************************************************************* 2855 ** 2856 ** Function BTA_DmBleScanFilterSetup 2857 ** 2858 ** Description This function is called to setup the filter params 2859 ** 2860 ** Parameters p_target: enable the filter condition on a target device; if NULL 2861 ** filt_index - Filter index 2862 ** p_filt_params -Filter parameters 2863 ** ref_value - Reference value 2864 ** action - Add, delete or clear 2865 ** p_cmpl_back - Command completed callback 2866 ** 2867 ** Returns void 2868 ** 2869 *******************************************************************************/ 2870 extern void BTA_DmBleScanFilterSetup(UINT8 action, 2871 tBTA_DM_BLE_PF_FILT_INDEX filt_index, 2872 tBTA_DM_BLE_PF_FILT_PARAMS *p_filt_params, 2873 tBLE_BD_ADDR *p_target, 2874 tBTA_DM_BLE_PF_PARAM_CBACK *p_cmpl_cback, 2875 tBTA_DM_BLE_REF_VALUE ref_value); 2876 2877 /******************************************************************************* 2878 ** 2879 ** Function BTA_DmBleCfgFilterCondition 2880 ** 2881 ** Description This function is called to configure the adv data payload filter 2882 ** condition. 2883 ** 2884 ** Parameters action: to read/write/clear 2885 ** cond_type: filter condition type 2886 ** filt_index - Filter index 2887 ** p_cond: filter condition parameter 2888 ** p_cmpl_back - Command completed callback 2889 ** ref_value - Reference value 2890 ** 2891 ** Returns void 2892 ** 2893 *******************************************************************************/ 2894 extern void BTA_DmBleCfgFilterCondition(tBTA_DM_BLE_SCAN_COND_OP action, 2895 tBTA_DM_BLE_PF_COND_TYPE cond_type, 2896 tBTA_DM_BLE_PF_FILT_INDEX filt_index, 2897 tBTA_DM_BLE_PF_COND_PARAM *p_cond, 2898 tBTA_DM_BLE_PF_CFG_CBACK *p_cmpl_cback, 2899 tBTA_DM_BLE_REF_VALUE ref_value); 2900 2901 2902 /******************************************************************************* 2903 ** 2904 ** Function BTA_DmBleTrackAdvertiser 2905 ** 2906 ** Description This function is called to track the advertiser 2907 ** 2908 ** Parameters ref_value - Reference value 2909 ** p_track_adv_cback - ADV callback 2910 ** 2911 ** Returns None 2912 ** 2913 *******************************************************************************/ 2914 extern void BTA_DmBleTrackAdvertiser(tBTA_DM_BLE_REF_VALUE ref_value, 2915 tBTA_BLE_TRACK_ADV_CBACK *p_track_adv_cback); 2916 2917 /******************************************************************************* 2918 ** 2919 ** Function BTA_DmBleGetEnergyInfo 2920 ** 2921 ** Description This function is called to obtain the energy info 2922 ** 2923 ** Parameters p_cmpl_cback - Command complete callback 2924 ** 2925 ** Returns void 2926 ** 2927 *******************************************************************************/ 2928 extern void BTA_DmBleGetEnergyInfo(tBTA_BLE_ENERGY_INFO_CBACK *p_cmpl_cback); 2929 2930 /******************************************************************************* 2931 ** 2932 ** Function BTA_BrcmInit 2933 ** 2934 ** Description This function initializes Broadcom specific VS handler in BTA 2935 ** 2936 ** Returns void 2937 ** 2938 *******************************************************************************/ 2939 extern void BTA_VendorInit (void); 2940 2941 /******************************************************************************* 2942 ** 2943 ** Function BTA_BrcmCleanup 2944 ** 2945 ** Description This function frees up Broadcom specific VS specific dynamic memory 2946 ** 2947 ** Returns void 2948 ** 2949 *******************************************************************************/ 2950 extern void BTA_VendorCleanup (void); 2951 2952 #if (BLE_50_FEATURE_SUPPORT == TRUE) 2953 extern void BTA_DmBleGapReadPHY(BD_ADDR addr); 2954 2955 extern void BTA_DmBleGapSetPreferedDefaultPHY(tBTA_DM_BLE_GAP_PHY_MASK tx_phy_mask, 2956 tBTA_DM_BLE_GAP_PHY_MASK rx_phy_mask); 2957 2958 extern void BTA_DmBleGapSetPreferedPHY(BD_ADDR addr, 2959 UINT8 all_phys, 2960 tBTA_DM_BLE_GAP_PHY_MASK tx_phy_mask, 2961 tBTA_DM_BLE_GAP_PHY_MASK rx_phy_mask, 2962 UINT16 phy_options); 2963 2964 extern void BTA_DmBleGapExtAdvSetRandaddr(UINT16 instance, BD_ADDR addr); 2965 2966 extern void BTA_DmBleGapExtAdvSetParams(UINT16 instance, 2967 const tBTA_DM_BLE_GAP_EXT_ADV_PARAMS *params); 2968 2969 extern void BTA_DmBleGapConfigExtAdvDataRaw(BOOLEAN is_scan_rsp, UINT8 instance, UINT16 length, 2970 const UINT8 *data); 2971 2972 extern void BTA_DmBleGapStartExtAdv(UINT8 num, tBTA_DM_BLE_EXT_ADV *ext_adv); 2973 2974 extern void BTA_DmBleGapExtAdvEnable(BOOLEAN enable, UINT8 num, tBTA_DM_BLE_EXT_ADV *ext_adv); 2975 2976 extern void BTA_DmBleGapExtAdvSetRemove(UINT8 instance); 2977 2978 extern void BTA_DmBleGapExtAdvSetClear(void); 2979 2980 extern void BTA_DmBleGapPeriodicAdvSetParams(UINT8 instance, 2981 tBTA_DM_BLE_Periodic_Adv_Params *params); 2982 2983 extern void BTA_DmBleGapPeriodicAdvCfgDataRaw(UINT8 instance, UINT16 length, 2984 const UINT8 *data); 2985 2986 extern void BTA_DmBleGapPeriodicAdvEnable(BOOLEAN enable, UINT8 instance); 2987 2988 extern void BTA_DmBleGapPeriodicAdvCreateSync(tBTA_DM_BLE_Periodic_Sync_Params *params); 2989 2990 extern void BTA_DmBleGapPeriodicAdvSyncCancel(void); 2991 2992 extern void BTA_DmBleGapPeriodicAdvSyncTerm(UINT16 sync_handle); 2993 2994 extern void BTA_DmBleGapPeriodicAdvAddDevToList(tBLE_ADDR_TYPE addr_type, 2995 BD_ADDR addr, 2996 UINT16 sid); 2997 2998 extern void BTA_DmBleGapPeriodicAdvRemoveDevFromList(tBLE_ADDR_TYPE addr_type, 2999 BD_ADDR addr, 3000 UINT16 sid); 3001 3002 extern void BTA_DmBleGapPeriodicAdvClearDev(void); 3003 3004 extern void BTA_DmBleGapSetExtScanParams(tBTA_DM_BLE_EXT_SCAN_PARAMS *params); 3005 3006 extern void BTA_DmBleGapExtScan(BOOLEAN start, UINT32 duration, UINT16 period); 3007 3008 extern void BTA_DmBleGapPreferExtConnectParamsSet(BD_ADDR bd_addr, 3009 UINT8 phy_mask, 3010 const tBTA_DM_BLE_CONN_PARAMS *phy_1m_conn_params, 3011 const tBTA_DM_BLE_CONN_PARAMS *phy_2m_conn_params, 3012 const tBTA_DM_BLE_CONN_PARAMS *phy_coded_conn_params); 3013 3014 extern void BTA_DmBleGapExtConnect(tBLE_ADDR_TYPE own_addr_type, const BD_ADDR peer_addr); 3015 #endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) 3016 3017 #endif 3018 3019 enum { 3020 BTA_COEX_EVT_SCAN_STARTED = 1, 3021 BTA_COEX_EVT_SCAN_STOPPED, 3022 BTA_COEX_EVT_ACL_CONNECTED, 3023 BTA_COEX_EVT_ACL_DISCONNECTED, 3024 BTA_COEX_EVT_STREAMING_STARTED, 3025 BTA_COEX_EVT_STREAMING_STOPPED, 3026 BTA_COEX_EVT_SNIFF_ENTER, 3027 BTA_COEX_EVT_SNIFF_EXIT, 3028 BTA_COEX_EVT_A2DP_PAUSED_ENTER, 3029 BTA_COEX_EVT_A2DP_PAUSED_EXIT, 3030 }; 3031 3032 extern void BTA_DmCoexEventTrigger(uint32_t event); 3033 3034 #ifdef __cplusplus 3035 } 3036 #endif 3037 3038 #endif /* BTA_API_H */ 3039