1 /****************************************************************************** 2 * 3 * Copyright (C) 1999-2012 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 file contains the main Bluetooth Manager (BTM) internal 22 * definitions. 23 * 24 ******************************************************************************/ 25 26 #ifndef BTM_BLE_INT_H 27 #define BTM_BLE_INT_H 28 29 #include "common/bt_target.h" 30 #include "osi/fixed_queue.h" 31 #include "stack/hcidefs.h" 32 #include "stack/btm_ble_api.h" 33 #include "btm_int.h" 34 35 #if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE 36 #include "stack/smp_api.h" 37 #endif 38 39 40 /* scanning enable status */ 41 #define BTM_BLE_SCAN_ENABLE 0x01 42 #define BTM_BLE_SCAN_DISABLE 0x00 43 44 /* advertising enable status */ 45 #define BTM_BLE_ADV_ENABLE 0x01 46 #define BTM_BLE_ADV_DISABLE 0x00 47 48 /* use the high 4 bits unused by inquiry mode */ 49 #define BTM_BLE_SELECT_SCAN 0x20 50 #define BTM_BLE_NAME_REQUEST 0x40 51 #define BTM_BLE_OBSERVE 0x80 52 53 #define BTM_BLE_MAX_WL_ENTRY 1 54 #define BTM_BLE_AD_DATA_LEN 31 55 56 #define BTM_BLE_ENC_MASK 0x03 57 58 #define BTM_BLE_DUPLICATE_DISABLE 0 59 #define BTM_BLE_DUPLICATE_ENABLE 1 60 #define BTM_BLE_DUPLICATE_MAX BTM_BLE_DUPLICATE_ENABLE 61 62 #define BTM_BLE_GAP_DISC_SCAN_INT 18 /* Interval(scan_int) = 11.25 ms= 0x0010 * 0.625 ms */ 63 #define BTM_BLE_GAP_DISC_SCAN_WIN 18 /* scan_window = 11.25 ms= 0x0010 * 0.625 ms */ 64 #define BTM_BLE_GAP_ADV_INT 512 /* Tgap(gen_disc) = 1.28 s= 512 * 0.625 ms */ 65 #define BTM_BLE_GAP_LIM_TOUT 180 /* Tgap(lim_timeout) = 180s max */ 66 #define BTM_BLE_LOW_LATENCY_SCAN_INT 8000 /* Interval(scan_int) = 5s= 8000 * 0.625 ms */ 67 #define BTM_BLE_LOW_LATENCY_SCAN_WIN 8000 /* scan_window = 5s= 8000 * 0.625 ms */ 68 69 70 #define BTM_BLE_GAP_ADV_FAST_INT_1 48 /* TGAP(adv_fast_interval1) = 30(used) ~ 60 ms = 48 *0.625 */ 71 #define BTM_BLE_GAP_ADV_FAST_INT_2 160 /* TGAP(adv_fast_interval2) = 100(used) ~ 150 ms = 160 * 0.625 ms */ 72 #define BTM_BLE_GAP_ADV_SLOW_INT 2048 /* Tgap(adv_slow_interval) = 1.28 s= 512 * 0.625 ms */ 73 #define BTM_BLE_GAP_ADV_DIR_MAX_INT 800 /* Tgap(dir_conn_adv_int_max) = 500 ms = 800 * 0.625 ms */ 74 #define BTM_BLE_GAP_ADV_DIR_MIN_INT 400 /* Tgap(dir_conn_adv_int_min) = 250 ms = 400 * 0.625 ms */ 75 76 #define BTM_BLE_GAP_FAST_ADV_TOUT 30 77 78 #define BTM_BLE_SEC_REQ_ACT_NONE 0 79 #define BTM_BLE_SEC_REQ_ACT_ENCRYPT 1 /* encrypt the link using current key or key refresh */ 80 #define BTM_BLE_SEC_REQ_ACT_PAIR 2 81 #define BTM_BLE_SEC_REQ_ACT_DISCARD 3 /* discard the sec request while encryption is started but not completed */ 82 typedef UINT8 tBTM_BLE_SEC_REQ_ACT; 83 84 #define BLE_STATIC_PRIVATE_MSB_MASK 0x3f 85 #define BLE_RESOLVE_ADDR_MSB 0x40 /* most significant bit, bit7, bit6 is 01 to be resolvable random */ 86 #define BLE_RESOLVE_ADDR_MASK 0xc0 /* bit 6, and bit7 */ 87 #define BTM_BLE_IS_RESOLVE_BDA(x) ((x[0] & BLE_RESOLVE_ADDR_MASK) == BLE_RESOLVE_ADDR_MSB) 88 89 /* LE scan activity bit mask, continue with LE inquiry bits */ 90 #define BTM_LE_SELECT_CONN_ACTIVE 0x0040 /* selection connection is in progress */ 91 #define BTM_LE_OBSERVE_ACTIVE 0x0080 /* observe is in progress */ 92 #define BTM_LE_DISCOVER_ACTIVE 0x0100 /* scan is in progress */ 93 94 /* BLE scan activity mask checking */ 95 #define BTM_BLE_IS_SCAN_ACTIVE(x) ((x) & BTM_BLE_SCAN_ACTIVE_MASK) 96 #define BTM_BLE_IS_INQ_ACTIVE(x) ((x) & BTM_BLE_INQUIRY_MASK) 97 #define BTM_BLE_IS_OBS_ACTIVE(x) ((x) & BTM_LE_OBSERVE_ACTIVE) 98 #define BTM_BLE_IS_DISCO_ACTIVE(x) ((x) & BTM_LE_DISCOVER_ACTIVE) 99 #define BTM_BLE_IS_SEL_CONN_ACTIVE(x) ((x) & BTM_LE_SELECT_CONN_ACTIVE) 100 101 /* BLE ADDR type ID bit */ 102 #define BLE_ADDR_TYPE_ID_BIT 0x02 103 104 #define BTM_VSC_CHIP_CAPABILITY_L_VERSION 55 105 #define BTM_VSC_CHIP_CAPABILITY_M_VERSION 95 106 107 typedef enum { 108 BTM_BLE_IDLE, 109 BTM_BLE_SCANNING, 110 BTM_BLE_SCAN_PENDING, 111 BTM_BLE_STOP_SCAN, 112 BTM_BLE_ADVERTISING, 113 BTM_BLE_ADV_PENDING, 114 BTM_BLE_STOP_ADV, 115 }tBTM_BLE_GAP_STATE; 116 117 typedef struct { 118 UINT16 data_mask; 119 UINT8 *p_flags; 120 UINT8 ad_data[BTM_BLE_AD_DATA_LEN]; 121 UINT8 *p_pad; 122 } tBTM_BLE_LOCAL_ADV_DATA; 123 124 typedef struct { 125 UINT32 inq_count; /* Used for determining if a response has already been */ 126 /* received for the current inquiry operation. (We do not */ 127 /* want to flood the caller with multiple responses from */ 128 /* the same device. */ 129 BOOLEAN scan_rsp; 130 tBLE_BD_ADDR le_bda; 131 } tINQ_LE_BDADDR; 132 133 #define BTM_BLE_ADV_DATA_LEN_MAX 31 134 #define BTM_BLE_CACHE_ADV_DATA_MAX 62 135 #if (BLE_50_FEATURE_SUPPORT == TRUE) 136 #define BTM_BLE_EXT_ADV_DATA_LEN_MAX 251 137 #define BTM_BLE_PERIODIC_ADV_DATA_LEN_MAX 252 138 139 #define BTM_BLE_ADV_DATA_OP_INTERMEDIATE_FRAG 0 140 #define BTM_BLE_ADV_DATA_OP_FIRST_FRAG 1 141 #define BTM_BLE_ADV_DATA_OP_LAST_FRAG 2 142 #define BTM_BLE_ADV_DATA_OP_COMPLETE 3 143 #define BTM_BLE_ADV_DATA_OP_UNCHANGED_DATA 4 144 #endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) 145 146 #define BTM_BLE_ISVALID_PARAM(x, min, max) (((x) >= (min) && (x) <= (max)) || ((x) == BTM_BLE_CONN_PARAM_UNDEF)) 147 148 #define BTM_BLE_PRIVATE_ADDR_INT 900 /* 15 minutes minimum for random address refreshing */ 149 150 typedef struct { 151 UINT16 discoverable_mode; 152 UINT16 connectable_mode; 153 BOOLEAN scan_params_set; 154 UINT32 scan_window; 155 UINT32 scan_interval; 156 UINT8 scan_type; /* current scan type: active or passive */ 157 UINT8 scan_duplicate_filter; /* duplicate filter enabled for scan */ 158 UINT16 adv_interval_min; 159 UINT16 adv_interval_max; 160 tBTM_BLE_AFP afp; /* advertising filter policy */ 161 tBTM_BLE_SFP sfp; /* scanning filter policy */ 162 tBTM_START_ADV_CMPL_CBACK *p_adv_cb; 163 tBTM_START_STOP_ADV_CMPL_CBACK *p_stop_adv_cb; 164 tBLE_ADDR_TYPE adv_addr_type; 165 UINT8 evt_type; 166 UINT8 adv_mode; 167 tBLE_BD_ADDR direct_bda; 168 tBTM_BLE_EVT directed_conn; 169 BOOLEAN fast_adv_on; 170 TIMER_LIST_ENT fast_adv_timer; 171 172 UINT8 adv_len; 173 UINT8 adv_data_cache[BTM_BLE_CACHE_ADV_DATA_MAX]; 174 BD_ADDR adv_addr; 175 /* inquiry BD addr database */ 176 UINT8 num_bd_entries; 177 UINT8 max_bd_entries; 178 tBTM_BLE_LOCAL_ADV_DATA adv_data; 179 tBTM_BLE_ADV_CHNL_MAP adv_chnl_map; 180 181 TIMER_LIST_ENT inq_timer_ent; 182 BOOLEAN scan_rsp; 183 tBTM_BLE_GAP_STATE state; /* Current state that the inquiry process is in */ 184 INT8 tx_power; 185 } tBTM_BLE_INQ_CB; 186 187 188 /* random address resolving complete callback */ 189 typedef void (tBTM_BLE_RESOLVE_CBACK) (void *match_rec, void *p); 190 191 typedef void (tBTM_BLE_ADDR_CBACK) (BD_ADDR_PTR static_random, void *p); 192 193 #define BTM_BLE_GAP_ADDR_BIT_RANDOM (1<<0) 194 #define BTM_BLE_GAP_ADDR_BIT_RESOLVABLE (1<<1) 195 196 /* random address management control block */ 197 typedef struct { 198 tBLE_ADDR_TYPE own_addr_type; /* local device LE address type */ 199 UINT8 exist_addr_bit; 200 BD_ADDR static_rand_addr; 201 BD_ADDR resolvale_addr; 202 BD_ADDR private_addr; 203 BD_ADDR random_bda; 204 BOOLEAN busy; 205 tBTM_SEC_DEV_REC *p_dev_rec; 206 tBTM_BLE_RESOLVE_CBACK *p_resolve_cback; 207 tBTM_BLE_ADDR_CBACK *p_generate_cback; 208 void *p; 209 TIMER_LIST_ENT raddr_timer_ent; 210 tBTM_SET_LOCAL_PRIVACY_CBACK *set_local_privacy_cback; 211 } tBTM_LE_RANDOM_CB; 212 213 #define BTM_BLE_MAX_BG_CONN_DEV_NUM 10 214 215 typedef struct { 216 UINT16 min_conn_int; 217 UINT16 max_conn_int; 218 UINT16 slave_latency; 219 UINT16 supervision_tout; 220 221 } tBTM_LE_CONN_PRAMS; 222 223 224 typedef struct { 225 BD_ADDR bd_addr; 226 UINT8 attr; 227 BOOLEAN is_connected; 228 BOOLEAN in_use; 229 } tBTM_LE_BG_CONN_DEV; 230 231 /* white list using state as a bit mask */ 232 #define BTM_BLE_WL_IDLE 0 233 #define BTM_BLE_WL_INIT 1 234 #define BTM_BLE_WL_SCAN 2 235 #define BTM_BLE_WL_ADV 4 236 typedef UINT8 tBTM_BLE_WL_STATE; 237 238 /* resolving list using state as a bit mask */ 239 #define BTM_BLE_RL_IDLE 0 240 #define BTM_BLE_RL_INIT 1 241 #define BTM_BLE_RL_SCAN 2 242 #define BTM_BLE_RL_ADV 4 243 typedef UINT8 tBTM_BLE_RL_STATE; 244 245 /* BLE connection state */ 246 #define BLE_CONN_IDLE 0 247 #define BLE_DIR_CONN 1 248 #define BLE_BG_CONN 2 249 #define BLE_CONN_CANCEL 3 250 typedef UINT8 tBTM_BLE_CONN_ST; 251 252 typedef struct { 253 void *p_param; 254 } tBTM_BLE_CONN_REQ; 255 256 /* LE state request */ 257 #define BTM_BLE_STATE_INVALID 0 258 #define BTM_BLE_STATE_CONN_ADV 1 259 #define BTM_BLE_STATE_INIT 2 260 #define BTM_BLE_STATE_MASTER 3 261 #define BTM_BLE_STATE_SLAVE 4 262 #define BTM_BLE_STATE_LO_DUTY_DIR_ADV 5 263 #define BTM_BLE_STATE_HI_DUTY_DIR_ADV 6 264 #define BTM_BLE_STATE_NON_CONN_ADV 7 265 #define BTM_BLE_STATE_PASSIVE_SCAN 8 266 #define BTM_BLE_STATE_ACTIVE_SCAN 9 267 #define BTM_BLE_STATE_SCAN_ADV 10 268 #define BTM_BLE_STATE_MAX 11 269 typedef UINT8 tBTM_BLE_STATE; 270 271 #define BTM_BLE_STATE_CONN_ADV_BIT 0x0001 272 #define BTM_BLE_STATE_INIT_BIT 0x0002 273 #define BTM_BLE_STATE_MASTER_BIT 0x0004 274 #define BTM_BLE_STATE_SLAVE_BIT 0x0008 275 #define BTM_BLE_STATE_LO_DUTY_DIR_ADV_BIT 0x0010 276 #define BTM_BLE_STATE_HI_DUTY_DIR_ADV_BIT 0x0020 277 #define BTM_BLE_STATE_NON_CONN_ADV_BIT 0x0040 278 #define BTM_BLE_STATE_PASSIVE_SCAN_BIT 0x0080 279 #define BTM_BLE_STATE_ACTIVE_SCAN_BIT 0x0100 280 #define BTM_BLE_STATE_SCAN_ADV_BIT 0x0200 281 typedef UINT16 tBTM_BLE_STATE_MASK; 282 283 #define BTM_BLE_STATE_ALL_MASK 0x03ff 284 #define BTM_BLE_STATE_ALL_ADV_MASK (BTM_BLE_STATE_CONN_ADV_BIT|BTM_BLE_STATE_LO_DUTY_DIR_ADV_BIT|BTM_BLE_STATE_HI_DUTY_DIR_ADV_BIT|BTM_BLE_STATE_SCAN_ADV_BIT) 285 #define BTM_BLE_STATE_ALL_SCAN_MASK (BTM_BLE_STATE_PASSIVE_SCAN_BIT|BTM_BLE_STATE_ACTIVE_SCAN_BIT) 286 #define BTM_BLE_STATE_ALL_CONN_MASK (BTM_BLE_STATE_MASTER_BIT|BTM_BLE_STATE_SLAVE_BIT) 287 288 #ifndef BTM_LE_RESOLVING_LIST_MAX 289 #define BTM_LE_RESOLVING_LIST_MAX 0x20 290 #endif 291 292 #define BTM_DUPLICATE_SCAN_EXCEPTIONAL_INFO_ADV_ADDR 0 293 #define BTM_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_LINK_ID 1 294 #define BTM_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_BEACON_TYPE 2 295 #define BTM_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_PROV_SRV_ADV 3 296 #define BTM_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_PROXY_SRV_ADV 4 297 298 typedef struct { 299 BD_ADDR *resolve_q_random_pseudo; 300 UINT8 *resolve_q_action; 301 UINT8 q_next; 302 UINT8 q_pending; 303 } tBTM_BLE_RESOLVE_Q; 304 305 typedef struct { 306 BOOLEAN in_use; 307 BOOLEAN to_add; 308 BD_ADDR bd_addr; 309 tBLE_ADDR_TYPE addr_type; 310 UINT8 attr; 311 } tBTM_BLE_WL_OP; 312 313 /* BLE privacy mode */ 314 #define BTM_PRIVACY_NONE 0 /* BLE no privacy */ 315 #define BTM_PRIVACY_1_1 1 /* BLE privacy 1.1, do not support privacy 1.0 */ 316 #define BTM_PRIVACY_1_2 2 /* BLE privacy 1.2 */ 317 #define BTM_PRIVACY_MIXED 3 /* BLE privacy mixed mode, broadcom propietary mode */ 318 typedef UINT8 tBTM_PRIVACY_MODE; 319 320 /* data length change event callback */ 321 typedef void (tBTM_DATA_LENGTH_CHANGE_CBACK) (UINT16 max_tx_length, UINT16 max_rx_length); 322 323 /* Define BLE Device Management control structure 324 */ 325 typedef struct { 326 UINT16 scan_activity; /* LE scan activity mask */ 327 328 /***************************************************** 329 ** BLE Inquiry 330 *****************************************************/ 331 tBTM_BLE_INQ_CB inq_var; 332 333 /* observer callback and timer */ 334 tBTM_INQ_RESULTS_CB *p_obs_results_cb; 335 tBTM_CMPL_CB *p_obs_cmpl_cb; 336 tBTM_INQ_DIS_CB *p_obs_discard_cb; 337 TIMER_LIST_ENT obs_timer_ent; 338 339 /* scan callback and timer */ 340 tBTM_INQ_RESULTS_CB *p_scan_results_cb; 341 tBTM_CMPL_CB *p_scan_cmpl_cb; 342 TIMER_LIST_ENT scan_timer_ent; 343 344 /* background connection procedure cb value */ 345 tBTM_BLE_CONN_TYPE bg_conn_type; 346 UINT32 scan_int; 347 UINT32 scan_win; 348 tBTM_BLE_SEL_CBACK *p_select_cback; 349 /* white list information */ 350 UINT8 white_list_avail_size; 351 tBTM_ADD_WHITELIST_CBACK *add_wl_cb; 352 tBTM_BLE_WL_STATE wl_state; 353 354 fixed_queue_t *conn_pending_q; 355 tBTM_BLE_CONN_ST conn_state; 356 357 /* random address management control block */ 358 tBTM_LE_RANDOM_CB addr_mgnt_cb; 359 360 BOOLEAN enabled; 361 362 #if BLE_PRIVACY_SPT == TRUE 363 BOOLEAN mixed_mode; /* privacy 1.2 mixed mode is on or not */ 364 tBTM_PRIVACY_MODE privacy_mode; /* privacy mode */ 365 UINT8 resolving_list_avail_size; /* resolving list available size */ 366 tBTM_BLE_RESOLVE_Q resolving_list_pend_q; /* Resolving list queue */ 367 tBTM_BLE_RL_STATE suspended_rl_state; /* Suspended resolving list state */ 368 UINT8 *irk_list_mask; /* IRK list availability mask, up to max entry bits */ 369 tBTM_BLE_RL_STATE rl_state; /* Resolving list state */ 370 #endif 371 372 tBTM_BLE_WL_OP wl_op_q[BTM_BLE_MAX_BG_CONN_DEV_NUM]; 373 374 /* current BLE link state */ 375 tBTM_BLE_STATE_MASK cur_states; /* bit mask of tBTM_BLE_STATE */ 376 UINT8 link_count[2]; /* total link count master and slave*/ 377 tBTM_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK *update_exceptional_list_cmp_cb; 378 } tBTM_BLE_CB; 379 380 #ifdef __cplusplus 381 extern "C" { 382 #endif 383 384 void btm_ble_timeout(TIMER_LIST_ENT *p_tle); 385 void btm_ble_process_adv_pkt (UINT8 *p); 386 void btm_ble_process_adv_discard_evt(UINT8 *p); 387 void btm_ble_proc_scan_rsp_rpt (UINT8 *p); 388 tBTM_STATUS btm_ble_read_remote_name(BD_ADDR remote_bda, tBTM_INQ_INFO *p_cur, tBTM_CMPL_CB *p_cb); 389 BOOLEAN btm_ble_cancel_remote_name(BD_ADDR remote_bda); 390 391 tBTM_STATUS btm_ble_set_discoverability(UINT16 combined_mode); 392 tBTM_STATUS btm_ble_set_connectability(UINT16 combined_mode); 393 tBTM_STATUS btm_ble_start_inquiry (UINT8 mode, UINT8 duration); 394 void btm_ble_stop_scan(void); 395 void btm_clear_all_pending_le_entry(void); 396 397 BOOLEAN btm_ble_send_extended_scan_params(UINT8 scan_type, UINT32 scan_int, 398 UINT32 scan_win, UINT8 addr_type_own, 399 UINT8 scan_filter_policy); 400 void btm_ble_stop_inquiry(void); 401 void btm_ble_init (void); 402 void btm_ble_free (void); 403 void btm_ble_connected (UINT8 *bda, UINT16 handle, UINT8 enc_mode, UINT8 role, tBLE_ADDR_TYPE addr_type, BOOLEAN addr_matched); 404 void btm_ble_read_remote_features_complete(UINT8 *p); 405 void btm_ble_write_adv_enable_complete(UINT8 *p); 406 void btm_ble_conn_complete(UINT8 *p, UINT16 evt_len, BOOLEAN enhanced); 407 void btm_read_ble_local_supported_states_complete(UINT8 *p, UINT16 evt_len); 408 tBTM_BLE_CONN_ST btm_ble_get_conn_st(void); 409 void btm_ble_set_conn_st(tBTM_BLE_CONN_ST new_st); 410 UINT8 *btm_ble_build_adv_data(tBTM_BLE_AD_MASK *p_data_mask, UINT8 **p_dst, 411 tBTM_BLE_ADV_DATA *p_data); 412 tBTM_STATUS btm_ble_start_adv(void); 413 tBTM_STATUS btm_ble_stop_adv(void); 414 tBTM_STATUS btm_ble_start_scan(void); 415 void btm_ble_create_ll_conn_complete (UINT8 status); 416 void btm_ble_create_conn_cancel_complete (UINT8 *p); 417 418 /* LE security function from btm_sec.c */ 419 #if SMP_INCLUDED == TRUE 420 void btm_ble_link_sec_check(BD_ADDR bd_addr, tBTM_LE_AUTH_REQ auth_req, tBTM_BLE_SEC_REQ_ACT *p_sec_req_act); 421 void btm_ble_ltk_request_reply(BD_ADDR bda, BOOLEAN use_stk, BT_OCTET16 stk); 422 UINT8 btm_proc_smp_cback(tSMP_EVT event, BD_ADDR bd_addr, tSMP_EVT_DATA *p_data); 423 tBTM_STATUS btm_ble_set_encryption (BD_ADDR bd_addr, void *p_ref_data, UINT8 link_role); 424 void btm_ble_ltk_request(UINT16 handle, UINT8 rand[8], UINT16 ediv); 425 tBTM_STATUS btm_ble_start_encrypt(BD_ADDR bda, BOOLEAN use_stk, BT_OCTET16 stk); 426 void btm_ble_link_encrypted(BD_ADDR bd_addr, UINT8 encr_enable); 427 #endif 428 429 /* LE device management functions */ 430 void btm_ble_reset_id( void ); 431 432 /* security related functions */ 433 void btm_ble_increment_sign_ctr(BD_ADDR bd_addr, BOOLEAN is_local ); 434 BOOLEAN btm_get_local_div (BD_ADDR bd_addr, UINT16 *p_div); 435 BOOLEAN btm_ble_get_enc_key_type(BD_ADDR bd_addr, UINT8 *p_key_types); 436 437 void btm_ble_test_command_complete(UINT8 *p); 438 void btm_ble_rand_enc_complete (UINT8 *p, UINT16 op_code, tBTM_RAND_ENC_CB *p_enc_cplt_cback); 439 440 void btm_sec_save_le_key(BD_ADDR bd_addr, tBTM_LE_KEY_TYPE key_type, tBTM_LE_KEY_VALUE *p_keys, BOOLEAN pass_to_application); 441 void btm_ble_update_sec_key_size(BD_ADDR bd_addr, UINT8 enc_key_size); 442 UINT8 btm_ble_read_sec_key_size(BD_ADDR bd_addr); 443 444 /* white list function */ 445 BOOLEAN btm_update_dev_to_white_list(BOOLEAN to_add, BD_ADDR bd_addr, tBLE_ADDR_TYPE addr_type, tBTM_ADD_WHITELIST_CBACK *add_wl_cb); 446 void btm_update_scanner_filter_policy(tBTM_BLE_SFP scan_policy); 447 void btm_update_adv_filter_policy(tBTM_BLE_AFP adv_policy); 448 void btm_ble_clear_white_list (void); 449 void btm_read_white_list_size_complete(UINT8 *p, UINT16 evt_len); 450 void btm_ble_add_2_white_list_complete(UINT8 status); 451 void btm_ble_remove_from_white_list_complete(UINT8 *p, UINT16 evt_len); 452 void btm_ble_clear_white_list_complete(UINT8 *p, UINT16 evt_len); 453 void btm_ble_white_list_init(UINT8 white_list_size); 454 455 /* background connection function */ 456 BOOLEAN btm_ble_suspend_bg_conn(void); 457 BOOLEAN btm_ble_resume_bg_conn(void); 458 void btm_ble_initiate_select_conn(BD_ADDR bda); 459 BOOLEAN btm_ble_start_auto_conn(BOOLEAN start); 460 BOOLEAN btm_ble_start_select_conn(BOOLEAN start, tBTM_BLE_SEL_CBACK *p_select_cback); 461 BOOLEAN btm_ble_renew_bg_conn_params(BOOLEAN add, BD_ADDR bd_addr); 462 void btm_write_dir_conn_wl(BD_ADDR target_addr); 463 BOOLEAN btm_ble_update_mode_operation(UINT8 link_role, BD_ADDR bda, UINT8 status); 464 BOOLEAN btm_execute_wl_dev_operation(void); 465 void btm_ble_update_link_topology_mask(UINT8 role, BOOLEAN increase); 466 467 /* direct connection utility */ 468 BOOLEAN btm_send_pending_direct_conn(void); 469 void btm_ble_enqueue_direct_conn_req(void *p_param); 470 471 /* BLE address management */ 472 void btm_gen_resolvable_private_addr (void *p_cmd_cplt_cback); 473 void btm_gen_non_resolvable_private_addr (tBTM_BLE_ADDR_CBACK *p_cback, void *p); 474 void btm_ble_resolve_random_addr(BD_ADDR random_bda, tBTM_BLE_RESOLVE_CBACK *p_cback, void *p); 475 void btm_gen_resolve_paddr_low(tBTM_RAND_ENC *p); 476 477 /* privacy function */ 478 #if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE) 479 /* BLE address mapping with CS feature */ 480 BOOLEAN btm_identity_addr_to_random_pseudo(BD_ADDR bd_addr, UINT8 *p_addr_type, BOOLEAN refresh); 481 BOOLEAN btm_random_pseudo_to_identity_addr(BD_ADDR random_pseudo, UINT8 *p_static_addr_type); 482 void btm_ble_refresh_peer_resolvable_private_addr(BD_ADDR pseudo_bda, BD_ADDR rra, UINT8 rra_type); 483 void btm_ble_refresh_local_resolvable_private_addr(BD_ADDR pseudo_addr, BD_ADDR local_rpa); 484 void btm_ble_read_resolving_list_entry_complete(UINT8 *p, UINT16 evt_len) ; 485 void btm_ble_remove_resolving_list_entry_complete(UINT8 *p, UINT16 evt_len); 486 void btm_ble_add_resolving_list_entry_complete(UINT8 *p, UINT16 evt_len); 487 void btm_ble_clear_resolving_list_complete(UINT8 *p, UINT16 evt_len); 488 void btm_read_ble_resolving_list_size_complete (UINT8 *p, UINT16 evt_len); 489 void btm_ble_enable_resolving_list(UINT8); 490 BOOLEAN btm_ble_disable_resolving_list(UINT8 rl_mask, BOOLEAN to_resume); 491 void btm_ble_enable_resolving_list_for_platform (UINT8 rl_mask); 492 void btm_ble_resolving_list_init(UINT8 max_irk_list_sz); 493 void btm_ble_resolving_list_cleanup(void); 494 #endif 495 496 void btm_ble_multi_adv_configure_rpa (tBTM_BLE_MULTI_ADV_INST *p_inst); 497 void btm_ble_multi_adv_init(void); 498 void *btm_ble_multi_adv_get_ref(UINT8 inst_id); 499 void btm_ble_multi_adv_cleanup(void); 500 void btm_ble_multi_adv_reenable(UINT8 inst_id); 501 void btm_ble_multi_adv_enb_privacy(BOOLEAN enable); 502 char btm_ble_map_adv_tx_power(int tx_power_index); 503 void btm_ble_batchscan_init(void); 504 void btm_ble_batchscan_cleanup(void); 505 void btm_ble_adv_filter_init(void); 506 void btm_ble_adv_filter_cleanup(void); 507 BOOLEAN btm_ble_topology_check(tBTM_BLE_STATE_MASK request); 508 BOOLEAN btm_ble_clear_topology_mask(tBTM_BLE_STATE_MASK request_state); 509 BOOLEAN btm_ble_set_topology_mask(tBTM_BLE_STATE_MASK request_state); 510 tBTM_BLE_STATE_MASK btm_ble_get_topology_mask(void); 511 512 #if BTM_BLE_CONFORMANCE_TESTING == TRUE 513 void btm_ble_set_no_disc_if_pair_fail (BOOLEAN disble_disc); 514 void btm_ble_set_test_mac_value (BOOLEAN enable, UINT8 *p_test_mac_val); 515 void btm_ble_set_test_local_sign_cntr_value(BOOLEAN enable, UINT32 test_local_sign_cntr); 516 void btm_set_random_address(BD_ADDR random_bda); 517 void btm_ble_set_keep_rfu_in_auth_req(BOOLEAN keep_rfu); 518 #endif 519 520 BOOLEAN btm_get_current_conn_params(BD_ADDR bda, UINT16 *interval, UINT16 *latency, UINT16 *timeout); 521 522 #if (BLE_50_FEATURE_SUPPORT == TRUE) 523 void btm_ble_update_phy_evt(tBTM_BLE_UPDATE_PHY *params); 524 void btm_ble_scan_timeout_evt(void); 525 void btm_ble_adv_set_terminated_evt(tBTM_BLE_ADV_TERMINAT *params); 526 void btm_ble_ext_adv_report_evt(tBTM_BLE_EXT_ADV_REPORT *params); 527 void btm_ble_scan_req_received_evt(tBTM_BLE_SCAN_REQ_RECEIVED *params); 528 void btm_ble_channel_select_algorithm_evt(tBTM_BLE_CHANNEL_SEL_ALG *params); 529 void btm_ble_periodic_adv_report_evt(tBTM_PERIOD_ADV_REPORT *params); 530 void btm_ble_periodic_adv_sync_lost_evt(tBTM_BLE_PERIOD_ADV_SYNC_LOST *params); 531 void btm_ble_periodic_adv_sync_establish_evt(tBTM_BLE_PERIOD_ADV_SYNC_ESTAB *params); 532 #endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) 533 534 /* 535 #ifdef __cplusplus 536 } 537 #endif 538 */ 539 #endif 540