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