Loading system/bta/gatt/bta_gattc_act.cc +15 −14 Original line number Diff line number Diff line Loading @@ -255,8 +255,7 @@ void bta_gattc_process_api_open(const tBTA_GATTC_DATA* p_msg) { tBTA_GATTC_RCB* p_clreg = bta_gattc_cl_get_regcb(p_msg->api_conn.client_if); if (!p_clreg) { LOG(ERROR) << __func__ << ": Failed, unknown client_if=" << +p_msg->api_conn.client_if; LOG_ERROR("Failed, unknown client_if=%d", +p_msg->api_conn.client_if); return; } Loading @@ -268,10 +267,10 @@ void bta_gattc_process_api_open(const tBTA_GATTC_DATA* p_msg) { tBTA_GATTC_CLCB* p_clcb = bta_gattc_find_alloc_clcb( p_msg->api_conn.client_if, p_msg->api_conn.remote_bda, p_msg->api_conn.transport); if (p_clcb != NULL) { if (p_clcb != nullptr) { bta_gattc_sm_execute(p_clcb, event, p_msg); } else { LOG(ERROR) << "No resources to open a new connection."; LOG_ERROR("No resources to open a new connection."); bta_gattc_send_open_cback(p_clreg, GATT_NO_RESOURCES, p_msg->api_conn.remote_bda, GATT_INVALID_CONN_ID, Loading Loading @@ -367,7 +366,6 @@ void bta_gattc_open(tBTA_GATTC_CLCB* p_clcb, const tBTA_GATTC_DATA* p_data) { p_data->api_conn.transport, p_data->api_conn.opportunistic, p_data->api_conn.initiating_phys)) { LOG(ERROR) << "Connection open failure"; bta_gattc_sm_execute(p_clcb, BTA_GATTC_INT_OPEN_FAIL_EVT, p_data); return; } Loading Loading @@ -396,8 +394,8 @@ static void bta_gattc_init_bk_conn(const tBTA_GATTC_API_OPEN* p_data, /* always call open to hold a connection */ if (!GATT_Connect(p_data->client_if, p_data->remote_bda, false, p_data->transport, false)) { LOG(ERROR) << __func__ << " unable to connect to remote bd_addr=" << p_data->remote_bda; LOG_ERROR("Unable to connect to remote bd_addr=%s", p_data->remote_bda.ToString().c_str()); bta_gattc_send_open_cback(p_clreg, GATT_ERROR, p_data->remote_bda, GATT_INVALID_CONN_ID, BT_TRANSPORT_LE, 0); return; Loading @@ -406,7 +404,7 @@ static void bta_gattc_init_bk_conn(const tBTA_GATTC_API_OPEN* p_data, uint16_t conn_id; if (!GATT_GetConnIdIfConnected(p_data->client_if, p_data->remote_bda, &conn_id, p_data->transport)) { LOG_WARN("Not a connected remote device"); LOG_INFO("Not a connected remote device yet"); return; } Loading Loading @@ -442,7 +440,9 @@ void bta_gattc_cancel_bk_conn(const tBTA_GATTC_API_CANCEL_OPEN* p_data) { if (GATT_CancelConnect(p_data->client_if, p_data->remote_bda, false)) { cb_data.status = GATT_SUCCESS; } else { LOG(ERROR) << __func__ << ": failed"; LOG_ERROR("failed for client_if=%d, remote_bda=%s, is_direct=false", static_cast<int>(p_data->client_if), p_data->remote_bda.ToString().c_str()); } } p_clreg = bta_gattc_cl_get_regcb(p_data->client_if); Loading Loading @@ -577,16 +577,17 @@ void bta_gattc_close(tBTA_GATTC_CLCB* p_clcb, const tBTA_GATTC_DATA* p_data) { tBTA_GATTC cb_data = { .close = { .client_if = p_clcb->p_rcb->client_if, .conn_id = p_clcb->bta_conn_id, .reason = GATT_CONN_OK, .remote_bda = p_clcb->bda, .status = GATT_SUCCESS, .client_if = p_clcb->p_rcb->client_if, .remote_bda = p_clcb->bda, .reason = GATT_CONN_OK, }, }; if (p_clcb->transport == BT_TRANSPORT_BR_EDR) if (p_clcb->transport == BT_TRANSPORT_BR_EDR) { bta_sys_conn_close(BTA_ID_GATTC, BTA_ALL_APP_ID, p_clcb->bda); } bta_gattc_clcb_dealloc(p_clcb); Loading system/bta/gatt/bta_gatts_act.cc +8 −6 Original line number Diff line number Diff line Loading @@ -489,18 +489,20 @@ void bta_gatts_close(UNUSED_ATTR tBTA_GATTS_CB* p_cb, tBTA_GATTS_DATA* p_msg) { if (GATT_GetConnectionInfor(p_msg->hdr.layer_specific, &gatt_if, remote_bda, &transport)) { if (GATT_Disconnect(p_msg->hdr.layer_specific) != GATT_SUCCESS) { LOG(ERROR) << __func__ << ": fail conn_id=" << loghex(p_msg->hdr.layer_specific); } else { status = GATT_SUCCESS; LOG_DEBUG("Disconnecting gatt_if=%d, remote_bda=%s, transport=%d", +gatt_if, remote_bda.ToString().c_str(), transport); status = GATT_Disconnect(p_msg->hdr.layer_specific); if (status != GATT_SUCCESS) { LOG_ERROR("fail conn_id=%d", +p_msg->hdr.layer_specific); status = GATT_ERROR; } p_rcb = bta_gatts_find_app_rcb_by_app_if(gatt_if); if (p_rcb && p_rcb->p_cback) { if (transport == BT_TRANSPORT_BR_EDR) if (transport == BT_TRANSPORT_BR_EDR) { bta_sys_conn_close(BTA_ID_GATTS, BTA_ALL_APP_ID, remote_bda); } tBTA_GATTS bta_gatts; bta_gatts.status = status; Loading system/btif/src/btif_gatt_client.cc +10 −4 Original line number Diff line number Diff line Loading @@ -344,12 +344,15 @@ void btif_gattc_open_impl(int client_if, RawAddress address, bool is_direct, else transport = BT_TRANSPORT_BR_EDR; break; default: LOG_ERROR("Unknown device type %d", +device_type); break; } } // Connect! LOG_INFO("%s Transport=%d, device type=%d, address type =%d, phy=%d", __func__, transport, device_type, addr_type, initiating_phys); LOG_INFO("Transport=%d, device type=%d, address type =%d, phy=%d", transport, device_type, addr_type, initiating_phys); BTA_GATTC_Open(client_if, address, is_direct, transport, opportunistic, initiating_phys); } Loading @@ -365,11 +368,14 @@ static bt_status_t btif_gattc_open(int client_if, const RawAddress& bd_addr, } void btif_gattc_close_impl(int client_if, RawAddress address, int conn_id) { LOG_INFO("client_if=%d, conn_id=%d, address=%s", client_if, conn_id, PRIVATE_ADDRESS(address)); // Disconnect established connections if (conn_id != 0) if (conn_id != 0) { BTA_GATTC_Close(conn_id); else } else { BTA_GATTC_CancelOpen(client_if, address, true); } // Cancel pending background connections (remove from acceptlist) BTA_GATTC_CancelOpen(client_if, address, false); Loading system/stack/btm/btm_ble.cc +8 −8 Original line number Diff line number Diff line Loading @@ -65,7 +65,7 @@ void BTM_SecAddBleDevice(const RawAddress& bd_addr, tBT_DEVICE_TYPE dev_type, return bluetooth::shim::BTM_SecAddBleDevice(bd_addr, dev_type, addr_type); } BTM_TRACE_DEBUG("%s: dev_type=0x%x", __func__, dev_type); LOG_DEBUG("dev_type=0x%x", dev_type); tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(bd_addr); if (!p_dev_rec) { Loading @@ -81,26 +81,26 @@ void BTM_SecAddBleDevice(const RawAddress& bd_addr, tBT_DEVICE_TYPE dev_type, p_dev_rec->conn_params.supervision_tout = BTM_BLE_CONN_PARAM_UNDEF; p_dev_rec->conn_params.peripheral_latency = BTM_BLE_CONN_PARAM_UNDEF; BTM_TRACE_DEBUG("%s: Device added, handle=0x%x, p_dev_rec=%p, bd_addr=%s", __func__, p_dev_rec->ble_hci_handle, p_dev_rec, bd_addr.ToString().c_str()); LOG_DEBUG("Device added, handle=0x%x, p_dev_rec=%p, bd_addr=%s", p_dev_rec->ble_hci_handle, p_dev_rec, bd_addr.ToString().c_str()); } memset(p_dev_rec->sec_bd_name, 0, sizeof(tBTM_BD_NAME)); p_dev_rec->device_type |= dev_type; if (is_ble_addr_type_known(addr_type)) if (is_ble_addr_type_known(addr_type)) { p_dev_rec->ble.SetAddressType(addr_type); else } else { LOG_WARN( "Please do not update device record from anonymous le advertisement"); } /* sync up with the Inq Data base*/ tBTM_INQ_INFO* p_info = BTM_InqDbRead(bd_addr); if (p_info) { p_info->results.ble_addr_type = p_dev_rec->ble.AddressType(); p_info->results.device_type = p_dev_rec->device_type; BTM_TRACE_DEBUG("InqDb device_type =0x%x addr_type=0x%x", LOG_DEBUG("InqDb device_type =0x%x addr_type=0x%x", p_info->results.device_type, p_info->results.ble_addr_type); } } Loading system/stack/btm/btm_ble_bgconn.cc +1 −3 Original line number Diff line number Diff line Loading @@ -239,7 +239,5 @@ void BTM_AcceptlistClear() { LOG_WARN("Controller does not support Le"); return; } bluetooth::shim::ACL_IgnoreAllLeConnections(); return; } Loading
system/bta/gatt/bta_gattc_act.cc +15 −14 Original line number Diff line number Diff line Loading @@ -255,8 +255,7 @@ void bta_gattc_process_api_open(const tBTA_GATTC_DATA* p_msg) { tBTA_GATTC_RCB* p_clreg = bta_gattc_cl_get_regcb(p_msg->api_conn.client_if); if (!p_clreg) { LOG(ERROR) << __func__ << ": Failed, unknown client_if=" << +p_msg->api_conn.client_if; LOG_ERROR("Failed, unknown client_if=%d", +p_msg->api_conn.client_if); return; } Loading @@ -268,10 +267,10 @@ void bta_gattc_process_api_open(const tBTA_GATTC_DATA* p_msg) { tBTA_GATTC_CLCB* p_clcb = bta_gattc_find_alloc_clcb( p_msg->api_conn.client_if, p_msg->api_conn.remote_bda, p_msg->api_conn.transport); if (p_clcb != NULL) { if (p_clcb != nullptr) { bta_gattc_sm_execute(p_clcb, event, p_msg); } else { LOG(ERROR) << "No resources to open a new connection."; LOG_ERROR("No resources to open a new connection."); bta_gattc_send_open_cback(p_clreg, GATT_NO_RESOURCES, p_msg->api_conn.remote_bda, GATT_INVALID_CONN_ID, Loading Loading @@ -367,7 +366,6 @@ void bta_gattc_open(tBTA_GATTC_CLCB* p_clcb, const tBTA_GATTC_DATA* p_data) { p_data->api_conn.transport, p_data->api_conn.opportunistic, p_data->api_conn.initiating_phys)) { LOG(ERROR) << "Connection open failure"; bta_gattc_sm_execute(p_clcb, BTA_GATTC_INT_OPEN_FAIL_EVT, p_data); return; } Loading Loading @@ -396,8 +394,8 @@ static void bta_gattc_init_bk_conn(const tBTA_GATTC_API_OPEN* p_data, /* always call open to hold a connection */ if (!GATT_Connect(p_data->client_if, p_data->remote_bda, false, p_data->transport, false)) { LOG(ERROR) << __func__ << " unable to connect to remote bd_addr=" << p_data->remote_bda; LOG_ERROR("Unable to connect to remote bd_addr=%s", p_data->remote_bda.ToString().c_str()); bta_gattc_send_open_cback(p_clreg, GATT_ERROR, p_data->remote_bda, GATT_INVALID_CONN_ID, BT_TRANSPORT_LE, 0); return; Loading @@ -406,7 +404,7 @@ static void bta_gattc_init_bk_conn(const tBTA_GATTC_API_OPEN* p_data, uint16_t conn_id; if (!GATT_GetConnIdIfConnected(p_data->client_if, p_data->remote_bda, &conn_id, p_data->transport)) { LOG_WARN("Not a connected remote device"); LOG_INFO("Not a connected remote device yet"); return; } Loading Loading @@ -442,7 +440,9 @@ void bta_gattc_cancel_bk_conn(const tBTA_GATTC_API_CANCEL_OPEN* p_data) { if (GATT_CancelConnect(p_data->client_if, p_data->remote_bda, false)) { cb_data.status = GATT_SUCCESS; } else { LOG(ERROR) << __func__ << ": failed"; LOG_ERROR("failed for client_if=%d, remote_bda=%s, is_direct=false", static_cast<int>(p_data->client_if), p_data->remote_bda.ToString().c_str()); } } p_clreg = bta_gattc_cl_get_regcb(p_data->client_if); Loading Loading @@ -577,16 +577,17 @@ void bta_gattc_close(tBTA_GATTC_CLCB* p_clcb, const tBTA_GATTC_DATA* p_data) { tBTA_GATTC cb_data = { .close = { .client_if = p_clcb->p_rcb->client_if, .conn_id = p_clcb->bta_conn_id, .reason = GATT_CONN_OK, .remote_bda = p_clcb->bda, .status = GATT_SUCCESS, .client_if = p_clcb->p_rcb->client_if, .remote_bda = p_clcb->bda, .reason = GATT_CONN_OK, }, }; if (p_clcb->transport == BT_TRANSPORT_BR_EDR) if (p_clcb->transport == BT_TRANSPORT_BR_EDR) { bta_sys_conn_close(BTA_ID_GATTC, BTA_ALL_APP_ID, p_clcb->bda); } bta_gattc_clcb_dealloc(p_clcb); Loading
system/bta/gatt/bta_gatts_act.cc +8 −6 Original line number Diff line number Diff line Loading @@ -489,18 +489,20 @@ void bta_gatts_close(UNUSED_ATTR tBTA_GATTS_CB* p_cb, tBTA_GATTS_DATA* p_msg) { if (GATT_GetConnectionInfor(p_msg->hdr.layer_specific, &gatt_if, remote_bda, &transport)) { if (GATT_Disconnect(p_msg->hdr.layer_specific) != GATT_SUCCESS) { LOG(ERROR) << __func__ << ": fail conn_id=" << loghex(p_msg->hdr.layer_specific); } else { status = GATT_SUCCESS; LOG_DEBUG("Disconnecting gatt_if=%d, remote_bda=%s, transport=%d", +gatt_if, remote_bda.ToString().c_str(), transport); status = GATT_Disconnect(p_msg->hdr.layer_specific); if (status != GATT_SUCCESS) { LOG_ERROR("fail conn_id=%d", +p_msg->hdr.layer_specific); status = GATT_ERROR; } p_rcb = bta_gatts_find_app_rcb_by_app_if(gatt_if); if (p_rcb && p_rcb->p_cback) { if (transport == BT_TRANSPORT_BR_EDR) if (transport == BT_TRANSPORT_BR_EDR) { bta_sys_conn_close(BTA_ID_GATTS, BTA_ALL_APP_ID, remote_bda); } tBTA_GATTS bta_gatts; bta_gatts.status = status; Loading
system/btif/src/btif_gatt_client.cc +10 −4 Original line number Diff line number Diff line Loading @@ -344,12 +344,15 @@ void btif_gattc_open_impl(int client_if, RawAddress address, bool is_direct, else transport = BT_TRANSPORT_BR_EDR; break; default: LOG_ERROR("Unknown device type %d", +device_type); break; } } // Connect! LOG_INFO("%s Transport=%d, device type=%d, address type =%d, phy=%d", __func__, transport, device_type, addr_type, initiating_phys); LOG_INFO("Transport=%d, device type=%d, address type =%d, phy=%d", transport, device_type, addr_type, initiating_phys); BTA_GATTC_Open(client_if, address, is_direct, transport, opportunistic, initiating_phys); } Loading @@ -365,11 +368,14 @@ static bt_status_t btif_gattc_open(int client_if, const RawAddress& bd_addr, } void btif_gattc_close_impl(int client_if, RawAddress address, int conn_id) { LOG_INFO("client_if=%d, conn_id=%d, address=%s", client_if, conn_id, PRIVATE_ADDRESS(address)); // Disconnect established connections if (conn_id != 0) if (conn_id != 0) { BTA_GATTC_Close(conn_id); else } else { BTA_GATTC_CancelOpen(client_if, address, true); } // Cancel pending background connections (remove from acceptlist) BTA_GATTC_CancelOpen(client_if, address, false); Loading
system/stack/btm/btm_ble.cc +8 −8 Original line number Diff line number Diff line Loading @@ -65,7 +65,7 @@ void BTM_SecAddBleDevice(const RawAddress& bd_addr, tBT_DEVICE_TYPE dev_type, return bluetooth::shim::BTM_SecAddBleDevice(bd_addr, dev_type, addr_type); } BTM_TRACE_DEBUG("%s: dev_type=0x%x", __func__, dev_type); LOG_DEBUG("dev_type=0x%x", dev_type); tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(bd_addr); if (!p_dev_rec) { Loading @@ -81,26 +81,26 @@ void BTM_SecAddBleDevice(const RawAddress& bd_addr, tBT_DEVICE_TYPE dev_type, p_dev_rec->conn_params.supervision_tout = BTM_BLE_CONN_PARAM_UNDEF; p_dev_rec->conn_params.peripheral_latency = BTM_BLE_CONN_PARAM_UNDEF; BTM_TRACE_DEBUG("%s: Device added, handle=0x%x, p_dev_rec=%p, bd_addr=%s", __func__, p_dev_rec->ble_hci_handle, p_dev_rec, bd_addr.ToString().c_str()); LOG_DEBUG("Device added, handle=0x%x, p_dev_rec=%p, bd_addr=%s", p_dev_rec->ble_hci_handle, p_dev_rec, bd_addr.ToString().c_str()); } memset(p_dev_rec->sec_bd_name, 0, sizeof(tBTM_BD_NAME)); p_dev_rec->device_type |= dev_type; if (is_ble_addr_type_known(addr_type)) if (is_ble_addr_type_known(addr_type)) { p_dev_rec->ble.SetAddressType(addr_type); else } else { LOG_WARN( "Please do not update device record from anonymous le advertisement"); } /* sync up with the Inq Data base*/ tBTM_INQ_INFO* p_info = BTM_InqDbRead(bd_addr); if (p_info) { p_info->results.ble_addr_type = p_dev_rec->ble.AddressType(); p_info->results.device_type = p_dev_rec->device_type; BTM_TRACE_DEBUG("InqDb device_type =0x%x addr_type=0x%x", LOG_DEBUG("InqDb device_type =0x%x addr_type=0x%x", p_info->results.device_type, p_info->results.ble_addr_type); } } Loading
system/stack/btm/btm_ble_bgconn.cc +1 −3 Original line number Diff line number Diff line Loading @@ -239,7 +239,5 @@ void BTM_AcceptlistClear() { LOG_WARN("Controller does not support Le"); return; } bluetooth::shim::ACL_IgnoreAllLeConnections(); return; }