bt : fix read rssi conflict when in dual mode

This commit is contained in:
Tian Hao 2018-06-21 21:43:46 +08:00
parent 4df08f9815
commit e3d3ed5a06
8 changed files with 15 additions and 24 deletions

View File

@ -602,16 +602,16 @@ void bta_dm_ble_read_adv_tx_power(tBTA_DM_MSG *p_data)
if (p_data->read_tx_power.read_tx_power_cb != NULL) {
BTM_BleReadAdvTxPower(p_data->read_tx_power.read_tx_power_cb);
} else {
APPL_TRACE_ERROR("%s(), the callback function cann't be NULL.", __func__);
APPL_TRACE_ERROR("%s(), the callback function can't be NULL.", __func__);
}
}
void bta_dm_ble_read_rssi(tBTA_DM_MSG *p_data)
{
if (p_data->rssi.read_rssi_cb != NULL) {
BTM_ReadRSSI(p_data->rssi.remote_addr, p_data->rssi.read_rssi_cb);
BTM_ReadRSSI(p_data->rssi.remote_addr, p_data->rssi.transport, p_data->rssi.read_rssi_cb);
} else {
APPL_TRACE_ERROR("%s(), the callback function cann't be NULL.", __func__);
APPL_TRACE_ERROR("%s(), the callback function can't be NULL.", __func__);
}
}
@ -4665,7 +4665,7 @@ void bta_dm_ble_set_rand_address(tBTA_DM_MSG *p_data)
void bta_dm_ble_stop_advertising(tBTA_DM_MSG *p_data)
{
if (p_data->hdr.event != BTA_DM_API_BLE_STOP_ADV_EVT) {
APPL_TRACE_ERROR("Invalid BTA event,cann't stop the BLE adverting\n");
APPL_TRACE_ERROR("Invalid BTA event,can't stop the BLE adverting\n");
}
btm_ble_stop_adv();

View File

@ -206,12 +206,13 @@ void BTA_DmBleReadAdvTxPower(tBTA_CMPL_CB *cmpl_cb)
}
}
void BTA_DmBleReadRSSI(BD_ADDR remote_addr, tBTA_CMPL_CB *cmpl_cb)
void BTA_DmBleReadRSSI(BD_ADDR remote_addr, tBTA_TRANSPORT transport, tBTA_CMPL_CB *cmpl_cb)
{
tBTA_DM_API_READ_RSSI *p_msg;
if ((p_msg = (tBTA_DM_API_READ_RSSI *)osi_malloc(sizeof(tBTA_DM_API_READ_RSSI))) != NULL) {
p_msg->hdr.event = BTA_DM_API_BLE_READ_RSSI_EVT;
memcpy(p_msg->remote_addr, remote_addr, sizeof(BD_ADDR));
p_msg->transport = transport;
p_msg->read_rssi_cb = cmpl_cb;
bta_sys_sendmsg(p_msg);
}

View File

@ -196,6 +196,7 @@ typedef struct {
typedef struct {
BT_HDR hdr;
BD_ADDR remote_addr;
tBTA_TRANSPORT transport;
tBTA_CMPL_CB *read_rssi_cb;
}tBTA_DM_API_READ_RSSI;

View File

@ -1428,7 +1428,7 @@ extern void BTA_DmUpdateWhiteList(BOOLEAN add_remove, BD_ADDR remote_addr, tBTA
extern void BTA_DmBleReadAdvTxPower(tBTA_CMPL_CB *cmpl_cb);
extern void BTA_DmBleReadRSSI(BD_ADDR remote_addr, tBTA_CMPL_CB *cmpl_cb);
extern void BTA_DmBleReadRSSI(BD_ADDR remote_addr, tBTA_TRANSPORT transport, tBTA_CMPL_CB *cmpl_cb);
/*******************************************************************************
**

View File

@ -1018,7 +1018,7 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
BTA_DmUpdateWhiteList(arg->update_white_list.add_remove, arg->update_white_list.remote_bda, btc_add_whitelist_complete_callback);
break;
case BTC_GAP_BLE_ACT_READ_RSSI:
BTA_DmBleReadRSSI(arg->read_rssi.remote_addr, btc_read_ble_rssi_cmpl_callback);
BTA_DmBleReadRSSI(arg->read_rssi.remote_addr, BTA_TRANSPORT_LE, btc_read_ble_rssi_cmpl_callback);
break;
case BTC_GAP_BLE_ACT_SET_CONN_PARAMS:
BTA_DmSetBlePrefConnParams(arg->set_conn_params.bd_addr, arg->set_conn_params.min_conn_int,

View File

@ -632,7 +632,7 @@ static void btc_gap_bt_read_rssi_delta_cmpl_callback(void *p_data)
static void btc_gap_bt_read_rssi_delta(btc_gap_bt_args_t *arg)
{
BTA_DmBleReadRSSI(arg->read_rssi_delta.bda.address, btc_gap_bt_read_rssi_delta_cmpl_callback);
BTA_DmBleReadRSSI(arg->read_rssi_delta.bda.address, BTA_TRANSPORT_BR_EDR, btc_gap_bt_read_rssi_delta_cmpl_callback);
}
esp_err_t btc_gap_bt_remove_bond_device(btc_gap_bt_args_t *arg)

View File

@ -1905,14 +1905,10 @@ void btm_qos_setup_complete (UINT8 status, UINT16 handle, FLOW_SPEC *p_flow)
** Returns BTM_CMD_STARTED if successfully initiated or error code
**
*******************************************************************************/
tBTM_STATUS BTM_ReadRSSI (BD_ADDR remote_bda, tBTM_CMPL_CB *p_cb)
tBTM_STATUS BTM_ReadRSSI (BD_ADDR remote_bda, tBT_TRANSPORT transport, tBTM_CMPL_CB *p_cb)
{
tACL_CONN *p;
tBT_TRANSPORT transport = BT_TRANSPORT_BR_EDR;
#if BLE_INCLUDED == TRUE
tBT_DEVICE_TYPE dev_type;
tBLE_ADDR_TYPE addr_type;
#endif
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]);
@ -1924,13 +1920,6 @@ tBTM_STATUS BTM_ReadRSSI (BD_ADDR remote_bda, tBTM_CMPL_CB *p_cb)
return (BTM_BUSY);
}
#if BLE_INCLUDED == TRUE
BTM_ReadDevInfo(remote_bda, &dev_type, &addr_type);
if (dev_type == BT_DEVICE_TYPE_BLE) {
transport = BT_TRANSPORT_LE;
}
#endif
p = btm_bda_to_acl(remote_bda, transport);
if (p != (tACL_CONN *)NULL) {
btu_start_timer (&btm_cb.devcb.rssi_timer, BTU_TTYPE_BTM_ACL,

View File

@ -2811,8 +2811,8 @@ tBTM_STATUS BTM_SwitchRole (BD_ADDR remote_bd_addr,
**
** Function BTM_ReadRSSI
**
** Description This function is called to read the link policy settings.
** The address of link policy results are returned in the callback.
** Description This function is called to read the RSSI for a particular transport.
** The RSSI of results are returned in the callback.
** (tBTM_RSSI_RESULTS)
**
** Returns BTM_CMD_STARTED if command issued to controller.
@ -2822,7 +2822,7 @@ tBTM_STATUS BTM_SwitchRole (BD_ADDR remote_bd_addr,
**
*******************************************************************************/
//extern
tBTM_STATUS BTM_ReadRSSI (BD_ADDR remote_bda, tBTM_CMPL_CB *p_cb);
tBTM_STATUS BTM_ReadRSSI (BD_ADDR remote_bda, tBT_TRANSPORT transport, tBTM_CMPL_CB *p_cb);
/*******************************************************************************