1 /****************************************************************************** 2 * 3 * Copyright 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 <cstdint> 29 #include <vector> 30 31 #include "bt_target.h" // Must be first to define build configuration 32 33 #include "osi/include/log.h" 34 #include "stack/include/bt_types.h" 35 #include "stack/include/btm_api_types.h" 36 #include "stack/include/btm_ble_api_types.h" 37 #include "stack/include/hci_error_code.h" 38 #include "stack/include/sdp_api.h" 39 #include "types/ble_address_with_type.h" 40 #include "types/bluetooth/uuid.h" 41 #include "types/bt_transport.h" 42 #include "types/raw_address.h" 43 44 /***************************************************************************** 45 * Constants and data types 46 ****************************************************************************/ 47 48 /* Status Return Value */ 49 typedef enum : uint8_t { 50 BTA_SUCCESS = 0, /* Successful operation. */ 51 BTA_FAILURE = 1, /* Generic failure. */ 52 BTA_PENDING = 2, /* API cannot be completed right now */ 53 BTA_BUSY = 3, 54 BTA_NO_RESOURCES = 4, 55 BTA_WRONG_MODE = 5, 56 } tBTA_STATUS; 57 58 /* 59 * Service ID 60 */ 61 62 #define BTA_A2DP_SOURCE_SERVICE_ID 3 /* A2DP Source profile. */ 63 #define BTA_HSP_SERVICE_ID 5 /* Headset profile. */ 64 #define BTA_HFP_SERVICE_ID 6 /* Hands-free profile. */ 65 #define BTA_BIP_SERVICE_ID 13 /* Basic Imaging profile */ 66 #define BTA_A2DP_SINK_SERVICE_ID 18 /* A2DP Sink */ 67 #define BTA_HID_SERVICE_ID 20 /* HID */ 68 #define BTA_HFP_HS_SERVICE_ID 24 /* HSP HS role */ 69 #define BTA_SDP_SERVICE_ID 29 /* SDP Search */ 70 #define BTA_HIDD_SERVICE_ID 30 /* HID Device */ 71 72 /* BLE profile service ID */ 73 #define BTA_BLE_SERVICE_ID 31 /* GATT profile */ 74 #define BTA_USER_SERVICE_ID 32 /* User requested UUID */ 75 #define BTA_MAX_SERVICE_ID 33 76 77 /* service IDs (BTM_SEC_SERVICE_FIRST_EMPTY + 1) to (BTM_SEC_MAX_SERVICES - 1) 78 * are used by BTA JV */ 79 #define BTA_FIRST_JV_SERVICE_ID (BTM_SEC_SERVICE_FIRST_EMPTY + 1) 80 #define BTA_LAST_JV_SERVICE_ID (BTM_SEC_MAX_SERVICES - 1) 81 82 typedef uint8_t tBTA_SERVICE_ID; 83 84 /* Service ID Mask */ 85 #define BTA_RES_SERVICE_MASK 0x00000001 /* Reserved */ 86 #define BTA_HSP_SERVICE_MASK 0x00000020 /* HSP AG role. */ 87 #define BTA_HFP_SERVICE_MASK 0x00000040 /* HFP AG role */ 88 #define BTA_HL_SERVICE_MASK 0x08000000 /* Health Device Profile */ 89 90 #define BTA_BLE_SERVICE_MASK 0x40000000 /* GATT based service */ 91 #define BTA_ALL_SERVICE_MASK 0x7FFFFFFF /* All services supported by BTA. */ 92 #define BTA_USER_SERVICE_MASK 0x80000000 /* Message Notification Profile */ 93 94 typedef uint32_t tBTA_SERVICE_MASK; 95 96 /* Security Setting Mask */ 97 #define BTA_SEC_AUTHENTICATE \ 98 (BTM_SEC_IN_AUTHENTICATE | \ 99 BTM_SEC_OUT_AUTHENTICATE) /* Authentication required. */ 100 #define BTA_SEC_ENCRYPT \ 101 (BTM_SEC_IN_ENCRYPT | BTM_SEC_OUT_ENCRYPT) /* Encryption required. */ 102 103 typedef uint16_t tBTA_SEC; 104 105 #define BTA_APP_ID_PAN_MULTI 0xFE /* app id for pan multiple connection */ 106 #define BTA_ALL_APP_ID 0xFF 107 108 /* Discoverable Modes */ 109 #define BTA_DM_NON_DISC BTM_NON_DISCOVERABLE /* Device is not discoverable. */ 110 #define BTA_DM_GENERAL_DISC \ 111 BTM_GENERAL_DISCOVERABLE /* General discoverable. \ 112 */ 113 typedef uint16_t 114 tBTA_DM_DISC; /* this discoverability mode is a bit mask among BR mode and 115 LE mode */ 116 117 /* Connectable Modes */ 118 #define BTA_DM_NON_CONN BTM_NON_CONNECTABLE /* Device is not connectable. */ 119 #define BTA_DM_CONN BTM_CONNECTABLE /* Device is connectable. */ 120 121 typedef uint16_t tBTA_DM_CONN; 122 123 /* Central/peripheral preferred roles */ 124 typedef enum : uint8_t { 125 BTA_ANY_ROLE = 0x00, 126 BTA_CENTRAL_ROLE_PREF = 0x01, 127 BTA_CENTRAL_ROLE_ONLY = 0x02, 128 /* Used for PANU only, skip role switch to central */ 129 BTA_PERIPHERAL_ROLE_ONLY = 0x03, 130 } tBTA_PREF_ROLES; 131 132 inline tBTA_PREF_ROLES toBTA_PREF_ROLES(uint8_t role) { 133 ASSERT_LOG(role <= BTA_PERIPHERAL_ROLE_ONLY, 134 "Passing illegal preferred role:0x%02x [0x%02x<=>0x%02x]", role, 135 BTA_ANY_ROLE, BTA_PERIPHERAL_ROLE_ONLY); 136 return static_cast<tBTA_PREF_ROLES>(role); 137 } 138 139 #define CASE_RETURN_TEXT(code) \ 140 case code: \ 141 return #code 142 143 inline std::string preferred_role_text(const tBTA_PREF_ROLES& role) { 144 switch (role) { 145 CASE_RETURN_TEXT(BTA_ANY_ROLE); 146 CASE_RETURN_TEXT(BTA_CENTRAL_ROLE_PREF); 147 CASE_RETURN_TEXT(BTA_CENTRAL_ROLE_ONLY); 148 CASE_RETURN_TEXT(BTA_PERIPHERAL_ROLE_ONLY); 149 default: 150 return std::string("UNKNOWN:%hhu", role); 151 } 152 } 153 #undef CASE_RETURN_TEXT 154 155 enum { 156 157 BTA_DM_NO_SCATTERNET, /* Device doesn't support scatternet, it might 158 support "role switch during connection" for 159 an incoming connection, when it already has 160 another connection in central role */ 161 BTA_DM_PARTIAL_SCATTERNET, /* Device supports partial scatternet. It can have 162 simultaneous connection in Central and 163 Peripheral roles for short period of time */ 164 BTA_DM_FULL_SCATTERNET /* Device can have simultaneous connection in central 165 and peripheral roles */ 166 167 }; 168 169 typedef struct { 170 uint8_t bta_dm_eir_min_name_len; /* minimum length of local name when it is 171 shortened */ 172 #if (BTA_EIR_CANNED_UUID_LIST == TRUE) 173 uint8_t bta_dm_eir_uuid16_len; /* length of 16-bit UUIDs */ 174 uint8_t* bta_dm_eir_uuid16; /* 16-bit UUIDs */ 175 #else 176 uint32_t uuid_mask[BTM_EIR_SERVICE_ARRAY_SIZE]; /* mask of UUID list in EIR */ 177 #endif 178 int8_t* bta_dm_eir_inq_tx_power; /* Inquiry TX power */ 179 uint8_t bta_dm_eir_flag_len; /* length of flags in bytes */ 180 uint8_t* bta_dm_eir_flags; /* flags for EIR */ 181 uint8_t bta_dm_eir_manufac_spec_len; /* length of manufacturer specific in 182 bytes */ 183 uint8_t* bta_dm_eir_manufac_spec; /* manufacturer specific */ 184 uint8_t bta_dm_eir_additional_len; /* length of additional data in bytes */ 185 uint8_t* bta_dm_eir_additional; /* additional data */ 186 } tBTA_DM_EIR_CONF; 187 188 typedef uint8_t tBTA_DM_BLE_RSSI_ALERT_TYPE; 189 190 /* Security Callback Events */ 191 #define BTA_DM_PIN_REQ_EVT 2 /* PIN request. */ 192 #define BTA_DM_AUTH_CMPL_EVT 3 /* Authentication complete indication. */ 193 #define BTA_DM_AUTHORIZE_EVT 4 /* Authorization request. */ 194 #define BTA_DM_LINK_UP_EVT 5 /* Connection UP event */ 195 #define BTA_DM_LINK_DOWN_EVT 6 /* Connection DOWN event */ 196 #define BTA_DM_BOND_CANCEL_CMPL_EVT 9 /* Bond cancel complete indication */ 197 #define BTA_DM_SP_CFM_REQ_EVT \ 198 10 /* Simple Pairing User Confirmation request. \ 199 */ 200 #define BTA_DM_SP_KEY_NOTIF_EVT 11 /* Simple Pairing Passkey Notification */ 201 #define BTA_DM_BLE_KEY_EVT 15 /* BLE SMP key event for peer device keys */ 202 #define BTA_DM_BLE_SEC_REQ_EVT 16 /* BLE SMP security request */ 203 #define BTA_DM_BLE_PASSKEY_NOTIF_EVT 17 /* SMP passkey notification event */ 204 #define BTA_DM_BLE_PASSKEY_REQ_EVT 18 /* SMP passkey request event */ 205 #define BTA_DM_BLE_OOB_REQ_EVT 19 /* SMP OOB request event */ 206 #define BTA_DM_BLE_LOCAL_IR_EVT 20 /* BLE local IR event */ 207 #define BTA_DM_BLE_LOCAL_ER_EVT 21 /* BLE local ER event */ 208 #define BTA_DM_BLE_NC_REQ_EVT 22 /* SMP Numeric Comparison request event */ 209 #define BTA_DM_SP_RMT_OOB_EXT_EVT \ 210 23 /* Simple Pairing Remote OOB Extended Data request. */ 211 #define BTA_DM_BLE_AUTH_CMPL_EVT 24 /* BLE Auth complete */ 212 #define BTA_DM_DEV_UNPAIRED_EVT 25 213 #define BTA_DM_LE_FEATURES_READ \ 214 27 /* Cotroller specific LE features are read \ 215 */ 216 #define BTA_DM_ENER_INFO_READ 28 /* Energy info read */ 217 #define BTA_DM_BLE_SC_OOB_REQ_EVT 29 /* SMP SC OOB request event */ 218 #define BTA_DM_BLE_CONSENT_REQ_EVT 30 /* SMP consent request event */ 219 #define BTA_DM_BLE_SC_CR_LOC_OOB_EVT \ 220 31 /* SMP SC Create Local OOB request event */ 221 typedef uint8_t tBTA_DM_SEC_EVT; 222 223 /* Structure associated with BTA_DM_PIN_REQ_EVT */ 224 typedef struct { 225 /* Note: First 3 data members must be, bd_addr, dev_class, and bd_name in 226 * order */ 227 RawAddress bd_addr; /* BD address peer device. */ 228 DEV_CLASS dev_class; /* Class of Device */ 229 BD_NAME bd_name; /* Name of peer device. */ 230 bool min_16_digit; /* true if the pin returned must be at least 16 digits */ 231 } tBTA_DM_PIN_REQ; 232 233 /* BLE related definition */ 234 235 #define BTA_DM_AUTH_FAIL_BASE (HCI_ERR_MAX_ERR + 10) 236 237 /* Converts SMP error codes defined in smp_api.h to SMP auth fail reasons below. 238 */ 239 #define BTA_DM_AUTH_CONVERT_SMP_CODE(x) (BTA_DM_AUTH_FAIL_BASE + (x)) 240 241 #define BTA_DM_AUTH_SMP_PAIR_AUTH_FAIL \ 242 (BTA_DM_AUTH_FAIL_BASE + SMP_PAIR_AUTH_FAIL) 243 #define BTA_DM_AUTH_SMP_CONFIRM_VALUE_FAIL \ 244 (BTA_DM_AUTH_FAIL_BASE + SMP_CONFIRM_VALUE_ERR) 245 #define BTA_DM_AUTH_SMP_PAIR_NOT_SUPPORT \ 246 (BTA_DM_AUTH_FAIL_BASE + SMP_PAIR_NOT_SUPPORT) 247 #define BTA_DM_AUTH_SMP_UNKNOWN_ERR \ 248 (BTA_DM_AUTH_FAIL_BASE + SMP_PAIR_FAIL_UNKNOWN) 249 #define BTA_DM_AUTH_SMP_CONN_TOUT (BTA_DM_AUTH_FAIL_BASE + SMP_CONN_TOUT) 250 251 typedef uint8_t tBTA_LE_KEY_TYPE; /* can be used as a bit mask */ 252 253 typedef union { 254 tBTM_LE_PENC_KEYS penc_key; /* received peer encryption key */ 255 tBTM_LE_PCSRK_KEYS psrk_key; /* received peer device SRK */ 256 tBTM_LE_PID_KEYS pid_key; /* peer device ID key */ 257 tBTM_LE_LENC_KEYS 258 lenc_key; /* local encryption reproduction keys LTK = = d1(ER,DIV,0)*/ 259 tBTM_LE_LCSRK_KEYS lcsrk_key; /* local device CSRK = d1(ER,DIV,1)*/ 260 tBTM_LE_PID_KEYS lid_key; /* local device ID key for the particular remote */ 261 } tBTA_LE_KEY_VALUE; 262 263 #define BTA_BLE_LOCAL_KEY_TYPE_ID 1 264 #define BTA_BLE_LOCAL_KEY_TYPE_ER 2 265 typedef uint8_t tBTA_DM_BLE_LOCAL_KEY_MASK; 266 267 typedef struct { 268 Octet16 ir; 269 Octet16 irk; 270 Octet16 dhk; 271 } tBTA_BLE_LOCAL_ID_KEYS; 272 273 #define BTA_DM_SEC_GRANTED BTA_SUCCESS 274 #define BTA_DM_SEC_PAIR_NOT_SPT BTA_DM_AUTH_SMP_PAIR_NOT_SUPPORT 275 typedef uint8_t tBTA_DM_BLE_SEC_GRANT; 276 277 /* Structure associated with BTA_DM_BLE_SEC_REQ_EVT */ 278 typedef struct { 279 RawAddress bd_addr; /* peer address */ 280 BD_NAME bd_name; /* peer device name */ 281 } tBTA_DM_BLE_SEC_REQ; 282 283 typedef struct { 284 RawAddress bd_addr; /* peer address */ 285 tBTM_LE_KEY_TYPE key_type; 286 tBTM_LE_KEY_VALUE* p_key_value; 287 } tBTA_DM_BLE_KEY; 288 289 /* Structure associated with BTA_DM_AUTH_CMPL_EVT */ 290 typedef struct { 291 RawAddress bd_addr; /* BD address peer device. */ 292 BD_NAME bd_name; /* Name of peer device. */ 293 bool key_present; /* Valid link key value in key element */ 294 LinkKey key; /* Link key associated with peer device. */ 295 uint8_t key_type; /* The type of Link Key */ 296 bool success; /* true of authentication succeeded, false if failed. */ 297 tHCI_REASON 298 fail_reason; /* The HCI reason/error code for when success=false */ 299 tBLE_ADDR_TYPE addr_type; /* Peer device address type */ 300 tBT_DEVICE_TYPE dev_type; 301 } tBTA_DM_AUTH_CMPL; 302 303 /* Structure associated with BTA_DM_LINK_UP_EVT */ 304 typedef struct { 305 RawAddress bd_addr; /* BD address peer device. */ 306 } tBTA_DM_LINK_UP; 307 308 /* Structure associated with BTA_DM_LINK_DOWN_EVT */ 309 typedef struct { 310 RawAddress bd_addr; /* BD address peer device. */ 311 } tBTA_DM_LINK_DOWN; 312 313 #define BTA_AUTH_SP_YES \ 314 BTM_AUTH_SP_YES /* 1 MITM Protection Required - Single Profile/non-bonding \ 315 Use IO Capabilities to determine authentication procedure \ 316 */ 317 318 #define BTA_AUTH_DD_BOND \ 319 BTM_AUTH_DD_BOND /* 2 this bit is set for dedicated bonding */ 320 #define BTA_AUTH_GEN_BOND \ 321 BTM_AUTH_SPGB_NO /* 4 this bit is set for general bonding */ 322 #define BTA_AUTH_BONDS \ 323 BTM_AUTH_BONDS /* 6 the general/dedicated bonding bits */ 324 325 #define BTA_LE_AUTH_REQ_SC_MITM_BOND BTM_LE_AUTH_REQ_SC_MITM_BOND /* 1101 */ 326 327 /* Structure associated with BTA_DM_SP_CFM_REQ_EVT */ 328 typedef struct { 329 /* Note: First 3 data members must be, bd_addr, dev_class, and bd_name in 330 * order */ 331 RawAddress bd_addr; /* peer address */ 332 DEV_CLASS dev_class; /* peer CoD */ 333 BD_NAME bd_name; /* peer device name */ 334 uint32_t num_val; /* the numeric value for comparison. If just_works, do not 335 show this number to UI */ 336 bool just_works; /* true, if "Just Works" association model */ 337 tBTM_AUTH_REQ loc_auth_req; /* Authentication required for local device */ 338 tBTM_AUTH_REQ rmt_auth_req; /* Authentication required for peer device */ 339 tBTM_IO_CAP loc_io_caps; /* IO Capabilities of local device */ 340 tBTM_AUTH_REQ rmt_io_caps; /* IO Capabilities of remote device */ 341 } tBTA_DM_SP_CFM_REQ; 342 343 /* Structure associated with BTA_DM_SP_KEY_NOTIF_EVT */ 344 typedef struct { 345 /* Note: First 3 data members must be, bd_addr, dev_class, and bd_name in 346 * order */ 347 RawAddress bd_addr; /* peer address */ 348 DEV_CLASS dev_class; /* peer CoD */ 349 BD_NAME bd_name; /* peer device name */ 350 uint32_t passkey; /* the numeric value for comparison. If just_works, do not 351 show this number to UI */ 352 } tBTA_DM_SP_KEY_NOTIF; 353 354 /* Structure associated with BTA_DM_SP_RMT_OOB_EVT */ 355 typedef struct { 356 /* Note: First 3 data members must be, bd_addr, dev_class, and bd_name in 357 * order */ 358 RawAddress bd_addr; /* peer address */ 359 DEV_CLASS dev_class; /* peer CoD */ 360 BD_NAME bd_name; /* peer device name */ 361 } tBTA_DM_SP_RMT_OOB; 362 363 /* Structure associated with BTA_DM_BOND_CANCEL_CMPL_EVT */ 364 typedef struct { 365 tBTA_STATUS result; /* true of bond cancel succeeded, false if failed. */ 366 } tBTA_DM_BOND_CANCEL_CMPL; 367 368 typedef struct { 369 Octet16 local_oob_c; /* Local OOB Data Confirmation/Commitment */ 370 Octet16 local_oob_r; /* Local OOB Data Randomizer */ 371 } tBTA_DM_LOC_OOB_DATA; 372 373 /* Union of all security callback structures */ 374 typedef union { 375 tBTA_DM_PIN_REQ pin_req; /* PIN request. */ 376 tBTA_DM_AUTH_CMPL auth_cmpl; /* Authentication complete indication. */ 377 tBTA_DM_LINK_UP link_up; /* ACL connection down event */ 378 tBTA_DM_LINK_DOWN link_down; /* ACL connection down event */ 379 tBTA_DM_SP_CFM_REQ cfm_req; /* user confirm request */ 380 tBTA_DM_SP_KEY_NOTIF key_notif; /* passkey notification */ 381 tBTA_DM_SP_RMT_OOB rmt_oob; /* remote oob */ 382 tBTA_DM_BOND_CANCEL_CMPL 383 bond_cancel_cmpl; /* Bond Cancel Complete indication */ 384 tBTA_DM_BLE_SEC_REQ ble_req; /* BLE SMP related request */ 385 tBTA_DM_BLE_KEY ble_key; /* BLE SMP keys used when pairing */ 386 tBTA_BLE_LOCAL_ID_KEYS ble_id_keys; /* IR event */ 387 Octet16 ble_er; /* ER event data */ 388 tBTA_DM_LOC_OOB_DATA local_oob_data; /* Local OOB data generated by us */ 389 } tBTA_DM_SEC; 390 391 /* Security callback */ 392 typedef void(tBTA_DM_SEC_CBACK)(tBTA_DM_SEC_EVT event, tBTA_DM_SEC* p_data); 393 394 #define BTA_DM_BLE_PF_LIST_LOGIC_OR 1 395 #define BTA_DM_BLE_PF_FILT_LOGIC_OR 0 396 397 /* Search callback events */ 398 #define BTA_DM_INQ_RES_EVT 0 /* Inquiry result for a peer device. */ 399 #define BTA_DM_INQ_CMPL_EVT 1 /* Inquiry complete. */ 400 #define BTA_DM_DISC_RES_EVT 2 /* Discovery result for a peer device. */ 401 #define BTA_DM_DISC_BLE_RES_EVT \ 402 3 /* Discovery result for BLE GATT based servoce on a peer device. */ 403 #define BTA_DM_DISC_CMPL_EVT 4 /* Discovery complete. */ 404 #define BTA_DM_SEARCH_CANCEL_CMPL_EVT 6 /* Search cancelled */ 405 406 typedef uint8_t tBTA_DM_SEARCH_EVT; 407 408 /* Structure associated with BTA_DM_INQ_RES_EVT */ 409 typedef struct { 410 RawAddress bd_addr; /* BD address peer device. */ 411 DEV_CLASS dev_class; /* Device class of peer device. */ 412 bool remt_name_not_required; /* Application sets this flag if it already knows 413 the name of the device */ 414 /* If the device name is known to application BTA skips the remote name 415 * request */ 416 bool is_limited; /* true, if the limited inquiry bit is set in the CoD */ 417 int8_t rssi; /* The rssi value */ 418 uint8_t* p_eir; /* received EIR */ 419 uint16_t eir_len; /* received EIR length */ 420 uint8_t inq_result_type; 421 tBLE_ADDR_TYPE ble_addr_type; 422 uint16_t ble_evt_type; 423 uint8_t ble_primary_phy; 424 uint8_t ble_secondary_phy; 425 uint8_t ble_advertising_sid; 426 int8_t ble_tx_power; 427 uint16_t ble_periodic_adv_int; 428 tBT_DEVICE_TYPE device_type; 429 uint8_t flag; 430 RawAddress original_bda; /* original address to pass up to GattService#onScanResult */ 431 } tBTA_DM_INQ_RES; 432 433 /* Structure associated with BTA_DM_INQ_CMPL_EVT */ 434 typedef struct { 435 uint8_t num_resps; /* Number of inquiry responses. */ 436 } tBTA_DM_INQ_CMPL; 437 438 /* Structure associated with BTA_DM_DISC_RES_EVT */ 439 typedef struct { 440 RawAddress bd_addr; /* BD address peer device. */ 441 BD_NAME bd_name; /* Name of peer device. */ 442 tBTA_SERVICE_MASK services; /* Services found on peer device. */ 443 tBT_DEVICE_TYPE device_type; /* device type in case it is BLE device */ 444 uint32_t num_uuids; 445 bluetooth::Uuid* p_uuid_list; 446 tBTA_STATUS result; 447 } tBTA_DM_DISC_RES; 448 449 /* Structure associated with tBTA_DM_DISC_BLE_RES */ 450 typedef struct { 451 RawAddress bd_addr; /* BD address peer device. */ 452 BD_NAME bd_name; /* Name of peer device. */ 453 std::vector<bluetooth::Uuid>* 454 services; /* GATT based Services UUID found on peer device. */ 455 } tBTA_DM_DISC_BLE_RES; 456 457 /* Union of all search callback structures */ 458 typedef union { 459 tBTA_DM_INQ_RES inq_res; /* Inquiry result for a peer device. */ 460 tBTA_DM_INQ_CMPL inq_cmpl; /* Inquiry complete. */ 461 tBTA_DM_DISC_RES disc_res; /* Discovery result for a peer device. */ 462 tBTA_DM_DISC_BLE_RES 463 disc_ble_res; /* discovery result for GATT based service */ 464 } tBTA_DM_SEARCH; 465 466 /* Search callback */ 467 typedef void(tBTA_DM_SEARCH_CBACK)(tBTA_DM_SEARCH_EVT event, 468 tBTA_DM_SEARCH* p_data); 469 470 /* Execute call back */ 471 typedef void(tBTA_DM_EXEC_CBACK)(void* p_param); 472 473 /* Encryption callback*/ 474 typedef void(tBTA_DM_ENCRYPT_CBACK)(const RawAddress& bd_addr, 475 tBT_TRANSPORT transport, 476 tBTA_STATUS result); 477 478 #define BTA_DM_CONTRL_UNKNOWN 0 /* Unknown state */ 479 480 typedef uint8_t tBTA_DM_CONTRL_STATE; 481 482 typedef void(tBTA_BLE_ENERGY_INFO_CBACK)(tBTM_BLE_TX_TIME_MS tx_time, 483 tBTM_BLE_RX_TIME_MS rx_time, 484 tBTM_BLE_IDLE_TIME_MS idle_time, 485 tBTM_BLE_ENERGY_USED energy_used, 486 tBTA_DM_CONTRL_STATE ctrl_state, 487 tBTA_STATUS status); 488 489 /* Maximum service name length */ 490 #define BTA_SERVICE_NAME_LEN 35 491 492 typedef enum : uint8_t { 493 /* power mode actions */ 494 BTA_DM_PM_NO_ACTION = 0x00, /* no change to the current pm setting */ 495 BTA_DM_PM_PARK = 0x10, /* prefers park mode */ 496 BTA_DM_PM_SNIFF = 0x20, /* prefers sniff mode */ 497 BTA_DM_PM_SNIFF1 = 0x21, /* prefers sniff1 mode */ 498 BTA_DM_PM_SNIFF2 = 0x22, /* prefers sniff2 mode */ 499 BTA_DM_PM_SNIFF3 = 0x23, /* prefers sniff3 mode */ 500 BTA_DM_PM_SNIFF4 = 0x24, /* prefers sniff4 mode */ 501 BTA_DM_PM_SNIFF5 = 0x25, /* prefers sniff5 mode */ 502 BTA_DM_PM_SNIFF6 = 0x26, /* prefers sniff6 mode */ 503 BTA_DM_PM_SNIFF7 = 0x27, /* prefers sniff7 mode */ 504 BTA_DM_PM_SNIFF_USER0 = 505 0x28, /* prefers user-defined sniff0 mode (testtool only) */ 506 BTA_DM_PM_SNIFF_USER1 = 507 0x29, /* prefers user-defined sniff1 mode (testtool only) */ 508 BTA_DM_PM_ACTIVE = 0x40, /* prefers active mode */ 509 BTA_DM_PM_RETRY = 0x80, /* retry power mode based on current settings */ 510 BTA_DM_PM_SUSPEND = 0x04, /* prefers suspend mode */ 511 BTA_DM_PM_NO_PREF = 0x01, /* service has no preference on power mode setting. 512 eg. connection to \ service got closed */ 513 BTA_DM_PM_SNIFF_MASK = 0x0f, // Masks the sniff submode 514 } tBTA_DM_PM_ACTION_BITMASK; 515 typedef uint8_t tBTA_DM_PM_ACTION; 516 517 /* index to bta_dm_ssr_spec */ 518 enum { 519 BTA_DM_PM_SSR0 = 0, 520 /* BTA_DM_PM_SSR1 will be dedicated for \ 521 HH SSR setting entry, no other profile can use it */ 522 BTA_DM_PM_SSR1 = 1, 523 BTA_DM_PM_SSR2 = 2, 524 BTA_DM_PM_SSR3 = 3, 525 BTA_DM_PM_SSR4 = 4, 526 }; 527 528 #define BTA_DM_PM_NUM_EVTS 9 529 530 #ifndef BTA_DM_PM_PARK_IDX 531 #define BTA_DM_PM_PARK_IDX \ 532 6 /* the actual index to bta_dm_pm_md[] for PARK mode */ 533 #endif 534 535 #ifndef BTA_DM_PM_SNIFF_A2DP_IDX 536 #define BTA_DM_PM_SNIFF_A2DP_IDX BTA_DM_PM_SNIFF 537 #endif 538 539 #ifndef BTA_DM_PM_SNIFF_HD_IDLE_IDX 540 #define BTA_DM_PM_SNIFF_HD_IDLE_IDX BTA_DM_PM_SNIFF2 541 #endif 542 543 #ifndef BTA_DM_PM_SNIFF_SCO_OPEN_IDX 544 #define BTA_DM_PM_SNIFF_SCO_OPEN_IDX BTA_DM_PM_SNIFF3 545 #endif 546 547 #ifndef BTA_DM_PM_SNIFF_HD_ACTIVE_IDX 548 #define BTA_DM_PM_SNIFF_HD_ACTIVE_IDX BTA_DM_PM_SNIFF4 549 #endif 550 551 #ifndef BTA_DM_PM_SNIFF_HH_OPEN_IDX 552 #define BTA_DM_PM_SNIFF_HH_OPEN_IDX BTA_DM_PM_SNIFF2 553 #endif 554 555 #ifndef BTA_DM_PM_SNIFF_HH_ACTIVE_IDX 556 #define BTA_DM_PM_SNIFF_HH_ACTIVE_IDX BTA_DM_PM_SNIFF2 557 #endif 558 559 #ifndef BTA_DM_PM_SNIFF_HH_IDLE_IDX 560 #define BTA_DM_PM_SNIFF_HH_IDLE_IDX BTA_DM_PM_SNIFF2 561 #endif 562 563 #ifndef BTA_DM_PM_HH_OPEN_DELAY 564 #define BTA_DM_PM_HH_OPEN_DELAY 30000 565 #endif 566 567 #ifndef BTA_DM_PM_HH_ACTIVE_DELAY 568 #define BTA_DM_PM_HH_ACTIVE_DELAY 30000 569 #endif 570 571 #ifndef BTA_DM_PM_HH_IDLE_DELAY 572 #define BTA_DM_PM_HH_IDLE_DELAY 30000 573 #endif 574 575 /* The Sniff Parameters defined below must be ordered from highest 576 * latency (biggest interval) to lowest latency. If there is a conflict 577 * among the connected services the setting with the lowest latency will 578 * be selected. If a device should override a sniff parameter then it 579 * must insure that order is maintained. 580 */ 581 #ifndef BTA_DM_PM_SNIFF_MAX 582 #define BTA_DM_PM_SNIFF_MAX 800 583 #define BTA_DM_PM_SNIFF_MIN 400 584 #define BTA_DM_PM_SNIFF_ATTEMPT 4 585 #define BTA_DM_PM_SNIFF_TIMEOUT 1 586 #endif 587 588 #ifndef BTA_DM_PM_SNIFF1_MAX 589 #define BTA_DM_PM_SNIFF1_MAX 400 590 #define BTA_DM_PM_SNIFF1_MIN 200 591 #define BTA_DM_PM_SNIFF1_ATTEMPT 4 592 #define BTA_DM_PM_SNIFF1_TIMEOUT 1 593 #endif 594 595 #ifndef BTA_DM_PM_SNIFF2_MAX 596 #define BTA_DM_PM_SNIFF2_MAX 54 597 #define BTA_DM_PM_SNIFF2_MIN 30 598 #define BTA_DM_PM_SNIFF2_ATTEMPT 4 599 #define BTA_DM_PM_SNIFF2_TIMEOUT 1 600 #endif 601 602 #ifndef BTA_DM_PM_SNIFF3_MAX 603 #define BTA_DM_PM_SNIFF3_MAX 150 604 #define BTA_DM_PM_SNIFF3_MIN 50 605 #define BTA_DM_PM_SNIFF3_ATTEMPT 4 606 #define BTA_DM_PM_SNIFF3_TIMEOUT 1 607 #endif 608 609 #ifndef BTA_DM_PM_SNIFF4_MAX 610 #define BTA_DM_PM_SNIFF4_MAX 18 611 #define BTA_DM_PM_SNIFF4_MIN 10 612 #define BTA_DM_PM_SNIFF4_ATTEMPT 4 613 #define BTA_DM_PM_SNIFF4_TIMEOUT 1 614 #endif 615 616 #ifndef BTA_DM_PM_SNIFF5_MAX 617 #define BTA_DM_PM_SNIFF5_MAX 36 618 #define BTA_DM_PM_SNIFF5_MIN 30 619 #define BTA_DM_PM_SNIFF5_ATTEMPT 2 620 #define BTA_DM_PM_SNIFF5_TIMEOUT 0 621 #endif 622 623 #ifndef BTA_DM_PM_SNIFF6_MAX 624 #define BTA_DM_PM_SNIFF6_MAX 18 625 #define BTA_DM_PM_SNIFF6_MIN 14 626 #define BTA_DM_PM_SNIFF6_ATTEMPT 1 627 #define BTA_DM_PM_SNIFF6_TIMEOUT 0 628 #endif 629 630 #ifndef BTA_DM_PM_PARK_MAX 631 #define BTA_DM_PM_PARK_MAX 800 632 #define BTA_DM_PM_PARK_MIN 400 633 #define BTA_DM_PM_PARK_ATTEMPT 0 634 #define BTA_DM_PM_PARK_TIMEOUT 0 635 #endif 636 637 /* Device Identification (DI) data structure 638 */ 639 640 #ifndef BTA_DI_NUM_MAX 641 #define BTA_DI_NUM_MAX 3 642 #endif 643 644 #define IMMEDIATE_DELY_MODE 0x00 645 #define ALLOW_ALL_FILTER 0x00 646 #define LOWEST_RSSI_VALUE 129 647 648 /***************************************************************************** 649 * External Function Declarations 650 ****************************************************************************/ 651 652 void BTA_dm_init(); 653 654 /******************************************************************************* 655 * 656 * Function BTA_EnableTestMode 657 * 658 * Description Enables bluetooth device under test mode 659 * 660 * 661 * Returns tBTA_STATUS 662 * 663 ******************************************************************************/ 664 extern void BTA_EnableTestMode(void); 665 666 /******************************************************************************* 667 * 668 * Function BTA_DmSetDeviceName 669 * 670 * Description This function sets the Bluetooth name of the local device. 671 * 672 * 673 * Returns void 674 * 675 ******************************************************************************/ 676 extern void BTA_DmSetDeviceName(char* p_name); 677 678 /******************************************************************************* 679 * 680 * Function BTA_DmSetVisibility 681 * 682 * Description This function sets the Bluetooth connectable,discoverable, 683 * pairable and conn paired only modesmodes of the local 684 * device. 685 * This controls whether other Bluetooth devices can find and 686 * connect to the local device. 687 * 688 * 689 * Returns void 690 * 691 ******************************************************************************/ 692 extern bool BTA_DmSetVisibility(bt_scan_mode_t mode); 693 694 /******************************************************************************* 695 * 696 * Function BTA_DmSearch 697 * 698 * Description This function searches for peer Bluetooth devices. It 699 * first performs an inquiry; for each device found from the 700 * inquiry it gets the remote name of the device. If 701 * parameter services is nonzero, service discovery will be 702 * performed on each device for the services specified. If the 703 * parameter is_bonding_or_sdp is true, the request will be 704 * queued until bonding or sdp completes 705 * 706 * 707 * Returns void 708 * 709 ******************************************************************************/ 710 extern void BTA_DmSearch(tBTA_DM_SEARCH_CBACK* p_cback, bool is_bonding_or_sdp); 711 712 /******************************************************************************* 713 * 714 * Function BTA_DmSearchCancel 715 * 716 * Description This function cancels a search that has been initiated 717 * by calling BTA_DmSearch(). 718 * 719 * 720 * Returns void 721 * 722 ******************************************************************************/ 723 extern void BTA_DmSearchCancel(void); 724 725 /******************************************************************************* 726 * 727 * Function BTA_DmDiscover 728 * 729 * Description This function performs service discovery for the services 730 * of a particular peer device. 731 * 732 * 733 * Returns void 734 * 735 ******************************************************************************/ 736 extern void BTA_DmDiscover(const RawAddress& bd_addr, 737 tBTA_DM_SEARCH_CBACK* p_cback, 738 tBT_TRANSPORT transport, bool is_bonding_or_sdp); 739 740 /******************************************************************************* 741 * 742 * Function BTA_DmGetCachedRemoteName 743 * 744 * Description Retieve cached remote name if available 745 * 746 * Returns BTA_SUCCESS if cached name was retrieved 747 * BTA_FAILURE if cached name is not available 748 * 749 ******************************************************************************/ 750 tBTA_STATUS BTA_DmGetCachedRemoteName(const RawAddress& remote_device, 751 uint8_t** pp_cached_name); 752 753 /******************************************************************************* 754 * 755 * Function BTA_DmBond 756 * 757 * Description This function initiates a bonding procedure with a peer 758 * device by designated transport. The bonding procedure 759 * enables authentication and optionally encryption on the 760 * Bluetooth link. 761 * 762 * 763 * Returns void 764 * 765 ******************************************************************************/ 766 extern void BTA_DmBond(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type, 767 tBT_TRANSPORT transport, int device_type); 768 769 /******************************************************************************* 770 * 771 * Function BTA_DmBondCancel 772 * 773 * Description This function cancels a bonding procedure with a peer 774 * device. 775 * 776 * 777 * Returns void 778 * 779 ******************************************************************************/ 780 extern void BTA_DmBondCancel(const RawAddress& bd_addr); 781 782 /******************************************************************************* 783 * 784 * Function BTA_DmPinReply 785 * 786 * Description This function provides a PIN when one is requested by DM 787 * during a bonding procedure. The application should call 788 * this function after the security callback is called with 789 * a BTA_DM_PIN_REQ_EVT. 790 * 791 * 792 * Returns void 793 * 794 ******************************************************************************/ 795 extern void BTA_DmPinReply(const RawAddress& bd_addr, bool accept, 796 uint8_t pin_len, uint8_t* p_pin); 797 798 /******************************************************************************* 799 * 800 * Function BTA_DmLocalOob 801 * 802 * Description This function retrieves the OOB data from local controller. 803 * The result is reported by bta_dm_co_loc_oob(). 804 * 805 * Returns void 806 * 807 ******************************************************************************/ 808 extern void BTA_DmLocalOob(void); 809 810 /******************************************************************************* 811 * 812 * Function BTA_DmConfirm 813 * 814 * Description This function accepts or rejects the numerical value of the 815 * Simple Pairing process on BTA_DM_SP_CFM_REQ_EVT 816 * 817 * Returns void 818 * 819 ******************************************************************************/ 820 extern void BTA_DmConfirm(const RawAddress& bd_addr, bool accept); 821 822 /******************************************************************************* 823 * 824 * Function BTA_DmAddDevice 825 * 826 * Description This function adds a device to the security database list 827 * of peer devices. This function would typically be called 828 * at system startup to initialize the security database with 829 * known peer devices. This is a direct execution function 830 * that may lock task scheduling on some platforms. 831 * 832 * Returns void 833 * 834 ******************************************************************************/ 835 extern void BTA_DmAddDevice(const RawAddress& bd_addr, DEV_CLASS dev_class, 836 const LinkKey& link_key, uint8_t key_type, 837 uint8_t pin_length); 838 839 /******************************************************************************* 840 * 841 * Function BTA_DmRemoveDevice 842 * 843 * Description This function removes a device from the security database. 844 * This is a direct execution function that may lock task 845 * scheduling on some platforms. 846 * 847 * 848 * Returns BTA_SUCCESS if successful. 849 * BTA_FAIL if operation failed. 850 * 851 ******************************************************************************/ 852 extern tBTA_STATUS BTA_DmRemoveDevice(const RawAddress& bd_addr); 853 854 /******************************************************************************* 855 * 856 * Function BTA_GetEirService 857 * 858 * Description This function is called to get BTA service mask from EIR. 859 * 860 * Parameters p_eir - pointer of EIR significant part 861 * eir_len - EIR length 862 * p_services - return the BTA service mask 863 * 864 * Returns None 865 * 866 ******************************************************************************/ 867 extern void BTA_GetEirService(uint8_t* p_eir, size_t eir_len, 868 tBTA_SERVICE_MASK* p_services); 869 870 /******************************************************************************* 871 * 872 * Function BTA_AddEirUuid 873 * 874 * Description Request to add a new service class UUID to the local 875 * device's EIR data. 876 * 877 * Parameters uuid16 - The service class UUID you wish to add 878 * 879 * Returns void 880 * 881 ******************************************************************************/ 882 extern void BTA_AddEirUuid(uint16_t uuid16); 883 884 /******************************************************************************* 885 * 886 * Function BTA_RemoveEirUuid 887 * 888 * Description Request to remove a service class UID from the local 889 * device's EIR data. 890 * 891 * Parameters uuid16 - The service class UUID you wish to remove 892 * 893 * Returns void 894 * 895 ******************************************************************************/ 896 extern void BTA_RemoveEirUuid(uint16_t uuid16); 897 898 /******************************************************************************* 899 * 900 * Function BTA_DmGetConnectionState 901 * 902 * Description Returns whether the remote device is currently connected. 903 * 904 * Returns true if the device is NOT connected, false otherwise. 905 * 906 ******************************************************************************/ 907 extern bool BTA_DmGetConnectionState(const RawAddress& bd_addr); 908 909 /******************************************************************************* 910 * 911 * Function BTA_DmSetLocalDiRecord 912 * 913 * Description This function adds a DI record to the local SDP database. 914 * 915 * Returns BTA_SUCCESS if record set sucessfully, otherwise error code. 916 * 917 ******************************************************************************/ 918 extern tBTA_STATUS BTA_DmSetLocalDiRecord(tSDP_DI_RECORD* p_device_info, 919 uint32_t* p_handle); 920 921 /******************************************************************************* 922 * 923 * 924 * Function BTA_DmCloseACL 925 * 926 * Description This function force to close an ACL connection and remove 927 the 928 * device from the security database list of known devices. 929 * 930 * Parameters: bd_addr - Address of the peer device 931 * remove_dev - remove device or not after link down 932 * transport - which transport to close 933 934 * 935 * Returns void. 936 * 937 ******************************************************************************/ 938 extern void BTA_DmCloseACL(const RawAddress& bd_addr, bool remove_dev, 939 tBT_TRANSPORT transport); 940 941 /* BLE related API functions */ 942 /******************************************************************************* 943 * 944 * Function BTA_DmBleSecurityGrant 945 * 946 * Description Grant security request access. 947 * 948 * Parameters: bd_addr - BD address of the peer 949 * res - security grant status. 950 * 951 * Returns void 952 * 953 ******************************************************************************/ 954 extern void BTA_DmBleSecurityGrant(const RawAddress& bd_addr, 955 tBTA_DM_BLE_SEC_GRANT res); 956 957 /******************************************************************************* 958 * 959 * Function BTA_DmBlePasskeyReply 960 * 961 * Description Send BLE SMP passkey reply. 962 * 963 * Parameters: bd_addr - BD address of the peer 964 * accept - passkey entry sucessful or declined. 965 * passkey - passkey value, must be a 6 digit number, 966 * can be lead by 0. 967 * 968 * Returns void 969 * 970 ******************************************************************************/ 971 extern void BTA_DmBlePasskeyReply(const RawAddress& bd_addr, bool accept, 972 uint32_t passkey); 973 974 /******************************************************************************* 975 * 976 * Function BTA_DmBleConfirmReply 977 * 978 * Description Send BLE SMP SC user confirmation reply. 979 * 980 * Parameters: bd_addr - BD address of the peer 981 * accept - numbers to compare are the same or 982 * different. 983 * 984 * Returns void 985 * 986 ******************************************************************************/ 987 extern void BTA_DmBleConfirmReply(const RawAddress& bd_addr, bool accept); 988 989 /******************************************************************************* 990 * 991 * Function BTA_DmAddBleDevice 992 * 993 * Description Add a BLE device. This function will be normally called 994 * during host startup to restore all required information 995 * for a LE device stored in the NVRAM. 996 * 997 * Parameters: bd_addr - BD address of the peer 998 * dev_type - Remote device's device type. 999 * addr_type - LE device address type. 1000 * 1001 * Returns void 1002 * 1003 ******************************************************************************/ 1004 extern void BTA_DmAddBleDevice(const RawAddress& bd_addr, 1005 tBLE_ADDR_TYPE addr_type, 1006 tBT_DEVICE_TYPE dev_type); 1007 1008 /******************************************************************************* 1009 * 1010 * Function BTA_DmAddBleKey 1011 * 1012 * Description Add/modify LE device information. This function will be 1013 * normally called during host startup to restore all required 1014 * information stored in the NVRAM. 1015 * 1016 * Parameters: bd_addr - BD address of the peer 1017 * p_le_key - LE key values. 1018 * key_type - LE SMP key type. 1019 * 1020 * Returns void 1021 * 1022 ******************************************************************************/ 1023 extern void BTA_DmAddBleKey(const RawAddress& bd_addr, 1024 tBTA_LE_KEY_VALUE* p_le_key, 1025 tBTM_LE_KEY_TYPE key_type); 1026 1027 /******************************************************************************* 1028 * 1029 * Function BTA_DmSetBlePrefConnParams 1030 * 1031 * Description This function is called to set the preferred connection 1032 * parameters when default connection parameter is not desired. 1033 * 1034 * Parameters: bd_addr - BD address of the peripheral 1035 * min_conn_int - minimum preferred connection interval 1036 * max_conn_int - maximum preferred connection interval 1037 * peripheral_latency - preferred peripheral latency 1038 * supervision_tout - preferred supervision timeout 1039 * 1040 * 1041 * Returns void 1042 * 1043 ******************************************************************************/ 1044 extern void BTA_DmSetBlePrefConnParams(const RawAddress& bd_addr, 1045 uint16_t min_conn_int, 1046 uint16_t max_conn_int, 1047 uint16_t peripheral_latency, 1048 uint16_t supervision_tout); 1049 1050 /******************************************************************************* 1051 * 1052 * Function BTA_DmSetEncryption 1053 * 1054 * Description This function is called to ensure that connection is 1055 * encrypted. Should be called only on an open connection. 1056 * Typically only needed for connections that first want to 1057 * bring up unencrypted links, then later encrypt them. 1058 * 1059 * Parameters: bd_addr - Address of the peer device 1060 * transport - transport of the link to be encruypted 1061 * p_callback - Pointer to callback function to indicat the 1062 * link encryption status 1063 * sec_act - This is the security action to indicate 1064 * what kind of BLE security level is required 1065 * for the BLE link if BLE is supported 1066 * Note: This parameter is ignored for 1067 * BR/EDR or if BLE is not supported. 1068 * 1069 * Returns void 1070 * 1071 * 1072 ******************************************************************************/ 1073 extern void BTA_DmSetEncryption(const RawAddress& bd_addr, 1074 tBT_TRANSPORT transport, 1075 tBTA_DM_ENCRYPT_CBACK* p_callback, 1076 tBTM_BLE_SEC_ACT sec_act); 1077 1078 /******************************************************************************* 1079 * 1080 * Function BTA_DmBleObserve 1081 * 1082 * Description This procedure keep the device listening for advertising 1083 * events from a broadcast device. 1084 * 1085 * Parameters start: start or stop observe. 1086 * duration : Duration of the scan. Continuous scan if 0 is 1087 * passed 1088 * p_results_cb: Callback to be called with scan results 1089 * 1090 * Returns void 1091 * 1092 ******************************************************************************/ 1093 extern void BTA_DmBleObserve(bool start, uint8_t duration, 1094 tBTA_DM_SEARCH_CBACK* p_results_cb); 1095 1096 /******************************************************************************* 1097 * 1098 * Function BTA_DmBleConfigLocalPrivacy 1099 * 1100 * Description Enable/disable privacy on the local device 1101 * 1102 * Parameters: privacy_enable - enable/disabe privacy on remote device. 1103 * 1104 * Returns void 1105 * 1106 ******************************************************************************/ 1107 extern void BTA_DmBleConfigLocalPrivacy(bool privacy_enable); 1108 1109 /******************************************************************************* 1110 * 1111 * Function BTA_DmBleEnableRemotePrivacy 1112 * 1113 * Description Enable/disable privacy on a remote device 1114 * 1115 * Parameters: bd_addr - BD address of the peer 1116 * privacy_enable - enable/disabe privacy on remote device. 1117 * 1118 * Returns void 1119 * 1120 ******************************************************************************/ 1121 extern void BTA_DmBleEnableRemotePrivacy(const RawAddress& bd_addr, 1122 bool privacy_enable); 1123 1124 /******************************************************************************* 1125 * 1126 * Function BTA_DmBleUpdateConnectionParams 1127 * 1128 * Description Update connection parameters, can only be used when 1129 * connection is up. 1130 * 1131 * Parameters: bd_addr - BD address of the peer 1132 * min_int - minimum connection interval, [0x0004 ~ 0x4000] 1133 * max_int - maximum connection interval, [0x0004 ~ 0x4000] 1134 * latency - peripheral latency [0 ~ 500] 1135 * timeout - supervision timeout [0x000a ~ 0xc80] 1136 * 1137 * Returns void 1138 * 1139 ******************************************************************************/ 1140 extern void BTA_DmBleUpdateConnectionParams(const RawAddress& bd_addr, 1141 uint16_t min_int, uint16_t max_int, 1142 uint16_t latency, uint16_t timeout, 1143 uint16_t min_ce_len, 1144 uint16_t max_ce_len); 1145 1146 /******************************************************************************* 1147 * 1148 * Function BTA_DmBleSetDataLength 1149 * 1150 * Description This function is to set maximum LE data packet size 1151 * 1152 * Returns void 1153 * 1154 ******************************************************************************/ 1155 extern void BTA_DmBleRequestMaxTxDataLength(const RawAddress& remote_device); 1156 1157 /******************************************************************************* 1158 * 1159 * Function BTA_DmBleGetEnergyInfo 1160 * 1161 * Description This function is called to obtain the energy info 1162 * 1163 * Parameters p_cmpl_cback - Command complete callback 1164 * 1165 * Returns void 1166 * 1167 ******************************************************************************/ 1168 extern void BTA_DmBleGetEnergyInfo(tBTA_BLE_ENERGY_INFO_CBACK* p_cmpl_cback); 1169 1170 /******************************************************************************* 1171 * 1172 * Function BTA_BrcmInit 1173 * 1174 * Description This function initializes Broadcom specific VS handler in 1175 * BTA 1176 * 1177 * Returns void 1178 * 1179 ******************************************************************************/ 1180 extern void BTA_VendorInit(void); 1181 1182 #endif /* BTA_API_H */ 1183