squash again

squash the commit.
component/bt:Added the update_white_list & set_prefer_conn_params API to the bt project.

component/bt: Added the get white list size API & delete the read adv tx power API.

component/bt: Change the esp_gap_ble_api.h esp_ble_gap_set_prefer_conn_params API docs.

changed btm_find_dev to btm_find_or_alloc_dev

component/bt: Change the rssi API deep copy method.

component/bt: Change the code as comment in the gitlab.

squash the commit.
component/bt:Added the update_white_list & set_prefer_conn_params API to the bt project.

component/bt: Added the get white list size API & delete the read adv tx power API.

component/bt: Change the esp_gap_ble_api.h esp_ble_gap_set_prefer_conn_params API docs.

changed btm_find_dev to btm_find_or_alloc_dev

component/bt: Change the rssi API deep copy method.

component/bt: Change the code as comment in the gitlab.

component/bt: change the ESP_BLE_CONN_PARAM_UNDEF redefinition error.

component/bt: Change the ESP_BLE_IS_VALID_PARAM function with the compile error.
This commit is contained in:
Yulong
2017-08-14 23:24:36 -04:00
parent 3d7ec475d1
commit 8925a90d40
15 changed files with 408 additions and 17 deletions

View File

@@ -1906,9 +1906,11 @@ tBTM_STATUS BTM_ReadRSSI (BD_ADDR remote_bda, tBTM_CMPL_CB *p_cb)
BTM_TRACE_API ("BTM_ReadRSSI: RemBdAddr: %02x%02x%02x%02x%02x%02x\n",
remote_bda[0], remote_bda[1], remote_bda[2],
remote_bda[3], remote_bda[4], remote_bda[5]);
tBTM_RSSI_RESULTS result;
/* If someone already waiting on the version, do not allow another */
if (btm_cb.devcb.p_rssi_cmpl_cb) {
result.status = BTM_BUSY;
(*p_cb)(&result);
return (BTM_BUSY);
}
@@ -1929,6 +1931,8 @@ tBTM_STATUS BTM_ReadRSSI (BD_ADDR remote_bda, tBTM_CMPL_CB *p_cb)
if (!btsnd_hcic_read_rssi (p->hci_handle)) {
btm_cb.devcb.p_rssi_cmpl_cb = NULL;
btu_stop_timer (&btm_cb.devcb.rssi_timer);
result.status = BTM_NO_RESOURCES;
(*p_cb)(&result);
return (BTM_NO_RESOURCES);
} else {
return (BTM_CMD_STARTED);
@@ -2038,6 +2042,43 @@ tBTM_STATUS BTM_ReadTxPower (BD_ADDR remote_bda, tBT_TRANSPORT transport, tBTM_C
/* If here, no BD Addr found */
return (BTM_UNKNOWN_ADDR);
}
tBTM_STATUS BTM_BleReadAdvTxPower(tBTM_CMPL_CB *p_cb)
{
BOOLEAN ret;
tBTM_TX_POWER_RESULTS result;
/* If someone already waiting on the version, do not allow another */
if (btm_cb.devcb.p_tx_power_cmpl_cb) {
result.status = BTM_BUSY;
(*p_cb)(&result);
return (BTM_BUSY);
}
btm_cb.devcb.p_tx_power_cmpl_cb = p_cb;
btu_start_timer (&btm_cb.devcb.tx_power_timer, BTU_TTYPE_BTM_ACL,
BTM_DEV_REPLY_TIMEOUT);
ret = btsnd_hcic_ble_read_adv_chnl_tx_power();
if(!ret) {
btm_cb.devcb.p_tx_power_cmpl_cb = NULL;
btu_stop_timer (&btm_cb.devcb.tx_power_timer);
result.status = BTM_NO_RESOURCES;
(*p_cb)(&result);
return (BTM_NO_RESOURCES);
} else {
return BTM_CMD_STARTED;
}
}
void BTM_BleGetWhiteListSize(uint16_t *length)
{
tBTM_BLE_CB *p_cb = &btm_cb.ble_ctr_cb;
if (p_cb->white_list_avail_size == 0) {
BTM_TRACE_ERROR("%s Whitelist full.", __func__);
}
*length = p_cb->white_list_avail_size;
return;
}
/*******************************************************************************
**
** Function btm_read_tx_power_complete

View File

@@ -542,7 +542,7 @@ void BTM_BleSetPrefConnParams (BD_ADDR bd_addr,
UINT16 min_conn_int, UINT16 max_conn_int,
UINT16 slave_latency, UINT16 supervision_tout)
{
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (bd_addr);
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_or_alloc_dev (bd_addr);
BTM_TRACE_API ("BTM_BleSetPrefConnParams min: %u max: %u latency: %u \
tout: %u",

View File

@@ -258,18 +258,22 @@ BOOLEAN btm_update_dev_to_white_list(BOOLEAN to_add, BD_ADDR bd_addr)
tBTM_BLE_CB *p_cb = &btm_cb.ble_ctr_cb;
if (to_add && p_cb->white_list_avail_size == 0) {
BTM_TRACE_ERROR("%s Whitelist full, unable to add device", __func__);
BTM_TRACE_DEBUG("%s Whitelist full, unable to add device", __func__);
return FALSE;
}
if (to_add) {
/* added the bd_addr to the connection hash map queue */
background_connection_add((bt_bdaddr_t *)bd_addr);
} else {
/* remove the bd_addr to the connection hash map queue */
background_connection_remove((bt_bdaddr_t *)bd_addr);
}
/* stop the auto connect */
btm_suspend_wl_activity(p_cb->wl_state);
/* save the bd_addr to the btm_cb env */
btm_enq_wl_dev_operation(to_add, bd_addr);
/* save the ba_addr to the controller white list & start the auto connet */
btm_resume_wl_activity(p_cb->wl_state);
return TRUE;
}

View File

@@ -246,10 +246,7 @@ void BTM_BleRegiseterConnParamCallback(tBTM_UPDATE_CONN_PARAM_CBACK *update_conn
*******************************************************************************/
BOOLEAN BTM_BleUpdateAdvWhitelist(BOOLEAN add_remove, BD_ADDR remote_bda)
{
UNUSED(add_remove);
UNUSED(remote_bda);
return FALSE;
return btm_update_dev_to_white_list(add_remove, remote_bda);
}
/*******************************************************************************
@@ -3164,7 +3161,8 @@ tBTM_STATUS btm_ble_start_adv(void)
}
#endif
if (p_cb->afp != AP_SCAN_CONN_ALL) {
btm_execute_wl_dev_operation();
//find the device in the btm dev buffer and write it to the controller white list
btm_execute_wl_dev_operation();
btm_cb.ble_ctr_cb.wl_state |= BTM_BLE_WL_ADV;
}

View File

@@ -2833,6 +2833,11 @@ tBTM_STATUS BTM_ReadRSSI (BD_ADDR remote_bda, tBTM_CMPL_CB *p_cb);
tBTM_STATUS BTM_ReadTxPower (BD_ADDR remote_bda,
tBT_TRANSPORT transport, tBTM_CMPL_CB *p_cb);
tBTM_STATUS BTM_BleReadAdvTxPower(tBTM_CMPL_CB *p_cb);
void BTM_BleGetWhiteListSize(uint16_t *length);
/*******************************************************************************
**
** Function BTM_ReadLinkQuality