}));
}
+/* This function set a random address to local controller. It also temporarily
+ * disable scans and adv before sending the command to the controller. */
+void btm_ble_set_random_address(BD_ADDR random_bda) {
+ tBTM_LE_RANDOM_CB* p_cb = &btm_cb.ble_ctr_cb.addr_mgnt_cb;
+ tBTM_BLE_CB* p_ble_cb = &btm_cb.ble_ctr_cb;
+ bool adv_mode = btm_cb.ble_ctr_cb.inq_var.adv_mode;
+
+ BTM_TRACE_DEBUG("%s", __func__);
+ if (btm_ble_get_conn_st() == BLE_DIR_CONN) {
+ BTM_TRACE_ERROR("%s: Cannot set random address. Direct conn ongoing",
+ __func__);
+ return;
+ }
+
+ if (adv_mode == BTM_BLE_ADV_ENABLE)
+ btsnd_hcic_ble_set_adv_enable(BTM_BLE_ADV_DISABLE);
+ if (BTM_BLE_IS_SCAN_ACTIVE(p_ble_cb->scan_activity)) btm_ble_stop_scan();
+ btm_ble_suspend_bg_conn();
+
+ memcpy(p_cb->private_addr, random_bda, BD_ADDR_LEN);
+ btsnd_hcic_ble_set_random_addr(p_cb->private_addr);
+
+ if (adv_mode == BTM_BLE_ADV_ENABLE)
+ btsnd_hcic_ble_set_adv_enable(BTM_BLE_ADV_ENABLE);
+ if (BTM_BLE_IS_SCAN_ACTIVE(p_ble_cb->scan_activity)) btm_ble_start_scan();
+ btm_ble_resume_bg_conn();
+}
+
#if BTM_BLE_CONFORMANCE_TESTING == TRUE
/*******************************************************************************
*
p_cb->private_addr[4] = p->param_buf[1];
p_cb->private_addr[3] = p->param_buf[2];
/* set it to controller */
- btsnd_hcic_ble_set_random_addr(p_cb->private_addr);
+ btm_ble_set_random_address(p_cb->private_addr);
p_cb->own_addr_type = BLE_ADDR_RANDOM;
extern bool btm_ble_topology_check(tBTM_BLE_STATE_MASK request);
extern bool btm_ble_clear_topology_mask(tBTM_BLE_STATE_MASK request_state);
extern bool btm_ble_set_topology_mask(tBTM_BLE_STATE_MASK request_state);
+extern void btm_ble_set_random_address(BD_ADDR random_bda);
#if (BTM_BLE_CONFORMANCE_TESTING == TRUE)
extern void btm_ble_set_no_disc_if_pair_fail(bool disble_disc);