From 11e328e0d45269dfd5831a67e1f980c1fb14fd76 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Fri, 25 Sep 2020 15:32:40 -0700 Subject: [PATCH] Remove L2CA_ErtmConnectRsp Just use L2CA_ConnectRsp. Bug: 159815595 Tag: #refactor Test: compile & verify basic functions working Change-Id: Ie95ed09c9d2e79fabd9d6eae6a038a6896a8e558 --- main/shim/l2c_api.cc | 11 +---------- main/shim/l2c_api.h | 16 ---------------- main/shim/l2cap.cc | 2 +- main/shim/l2cap.h | 3 +-- stack/avct/avct_l2c_br.cc | 2 +- stack/gap/gap_conn.cc | 3 +-- stack/include/l2c_api.h | 16 ---------------- stack/l2cap/l2c_api.cc | 22 ---------------------- 8 files changed, 5 insertions(+), 70 deletions(-) diff --git a/main/shim/l2c_api.cc b/main/shim/l2c_api.cc index da6f01534..34dd015de 100644 --- a/main/shim/l2c_api.cc +++ b/main/shim/l2c_api.cc @@ -103,19 +103,10 @@ uint16_t bluetooth::shim::L2CA_ConnectReq(uint16_t psm, return shim_l2cap.CreateConnection(psm, raw_address); } -bool bluetooth::shim::L2CA_ErtmConnectRsp(const RawAddress& p_bd_addr, - uint8_t id, uint16_t lcid, - uint16_t result, uint16_t status, - tL2CAP_ERTM_INFO* p_ertm_info) { - return shim_l2cap.ConnectResponse(p_bd_addr, id, lcid, result, status, - p_ertm_info); -} - bool bluetooth::shim::L2CA_ConnectRsp(const RawAddress& p_bd_addr, uint8_t id, uint16_t lcid, uint16_t result, uint16_t status) { - return bluetooth::shim::L2CA_ErtmConnectRsp(p_bd_addr, id, lcid, result, - status, nullptr); + return shim_l2cap.ConnectResponse(p_bd_addr, id, lcid, result, status); } bool bluetooth::shim::L2CA_ConfigReq(uint16_t cid, tL2CAP_CFG_INFO* cfg_info) { diff --git a/main/shim/l2c_api.h b/main/shim/l2c_api.h index 2c2da0837..5fae24f1a 100644 --- a/main/shim/l2c_api.h +++ b/main/shim/l2c_api.h @@ -189,22 +189,6 @@ bool L2CA_GetPeerLECocConfig(uint16_t lcid, tL2CAP_LE_CFG_INFO* peer_cfg); /******************************************************************************* * - * Function L2CA_ErtmConnectRsp - * - * Description Higher layers call this function to accept an incoming - * L2CAP connection, for which they had gotten an connect - * indication callback, and for which the higher layer wants - * to use Enhanced Retransmission Mode. - * - * Returns true for success, false for failure - * - ******************************************************************************/ -bool L2CA_ErtmConnectRsp(const RawAddress& p_bd_addr, uint8_t id, uint16_t lcid, - uint16_t result, uint16_t status, - tL2CAP_ERTM_INFO* p_ertm_info); - -/******************************************************************************* - * * Function L2CA_ConfigReq * * Description Higher layers call this function to send configuration. diff --git a/main/shim/l2cap.cc b/main/shim/l2cap.cc index f8a9dbe26..09ba5bc01 100644 --- a/main/shim/l2cap.cc +++ b/main/shim/l2cap.cc @@ -349,7 +349,7 @@ void bluetooth::shim::legacy::L2cap::SetDownstreamCallbacks(uint16_t cid) { bool bluetooth::shim::legacy::L2cap::ConnectResponse( const RawAddress& raw_address, uint8_t signal_id, uint16_t cid, - uint16_t result, uint16_t status, tL2CAP_ERTM_INFO* ertm_info) { + uint16_t result, uint16_t status) { CHECK(ConnectionExists(cid)); LOG_DEBUG( "%s Silently dropping client connect response as channel is " diff --git a/main/shim/l2cap.h b/main/shim/l2cap.h index 74b46ba46..c710a9708 100644 --- a/main/shim/l2cap.h +++ b/main/shim/l2cap.h @@ -84,8 +84,7 @@ class L2cap { // Legacy API entry points bool ConnectResponse(const RawAddress& raw_address, uint8_t signal_id, - uint16_t cid, uint16_t result, uint16_t status, - tL2CAP_ERTM_INFO* ertm_info); + uint16_t cid, uint16_t result, uint16_t status); bool ConfigRequest(uint16_t cid, const tL2CAP_CFG_INFO* config_info); bool ConfigResponse(uint16_t cid, const tL2CAP_CFG_INFO* config_info); bool DisconnectRequest(uint16_t cid); diff --git a/stack/avct/avct_l2c_br.cc b/stack/avct/avct_l2c_br.cc index cfc64e148..bc04d3813 100644 --- a/stack/avct/avct_l2c_br.cc +++ b/stack/avct/avct_l2c_br.cc @@ -90,7 +90,7 @@ void avct_l2c_br_connect_ind_cback(const RawAddress& bd_addr, uint16_t lcid, ertm_info.preferred_mode = L2CAP_FCR_ERTM_MODE; /* Send L2CAP connect rsp */ - L2CA_ErtmConnectRsp(bd_addr, id, lcid, result, 0, &ertm_info); + L2CA_ConnectRsp(bd_addr, id, lcid, result, 0); /* if result ok, proceed with connection */ if (result == L2CAP_CONN_OK) { diff --git a/stack/gap/gap_conn.cc b/stack/gap/gap_conn.cc index 961d8273a..494862927 100644 --- a/stack/gap/gap_conn.cc +++ b/stack/gap/gap_conn.cc @@ -615,8 +615,7 @@ static void gap_connect_ind(const RawAddress& bd_addr, uint16_t l2cap_cid, /* Send response to the L2CAP layer. */ if (p_ccb->transport == BT_TRANSPORT_BR_EDR) - L2CA_ErtmConnectRsp(bd_addr, l2cap_id, l2cap_cid, L2CAP_CONN_OK, - L2CAP_CONN_OK, &p_ccb->ertm_info); + L2CA_ConnectRsp(bd_addr, l2cap_id, l2cap_cid, L2CAP_CONN_OK, L2CAP_CONN_OK); if (p_ccb->transport == BT_TRANSPORT_LE) { L2CA_ConnectLECocRsp(bd_addr, l2cap_id, l2cap_cid, L2CAP_CONN_OK, diff --git a/stack/include/l2c_api.h b/stack/include/l2c_api.h index c20468312..2757feeae 100644 --- a/stack/include/l2c_api.h +++ b/stack/include/l2c_api.h @@ -448,22 +448,6 @@ extern bool L2CA_GetPeerLECocConfig(uint16_t lcid, /******************************************************************************* * - * Function L2CA_ErtmConnectRsp - * - * Description Higher layers call this function to accept an incoming - * L2CAP connection, for which they had gotten an connect - * indication callback, and for which the higher layer wants - * to use Enhanced Retransmission Mode. - * - * Returns true for success, false for failure - * - ******************************************************************************/ -extern bool L2CA_ErtmConnectRsp(const RawAddress& p_bd_addr, uint8_t id, - uint16_t lcid, uint16_t result, uint16_t status, - tL2CAP_ERTM_INFO* p_ertm_info); - -/******************************************************************************* - * * Function L2CA_DisconnectReq * * Description Higher layers call this function to disconnect a channel. diff --git a/stack/l2cap/l2c_api.cc b/stack/l2cap/l2c_api.cc index fc853634d..339355ac9 100644 --- a/stack/l2cap/l2c_api.cc +++ b/stack/l2cap/l2c_api.cc @@ -715,28 +715,6 @@ bool L2CA_ConnectRsp(const RawAddress& p_bd_addr, uint8_t id, uint16_t lcid, status); } - return L2CA_ErtmConnectRsp(p_bd_addr, id, lcid, result, status, NULL); -} - -/******************************************************************************* - * - * Function L2CA_ErtmConnectRsp - * - * Description Higher layers call this function to accept an incoming - * L2CAP connection, for which they had gotten an connect - * indication callback. - * - * Returns true for success, false for failure - * - ******************************************************************************/ -bool L2CA_ErtmConnectRsp(const RawAddress& p_bd_addr, uint8_t id, uint16_t lcid, - uint16_t result, uint16_t status, - tL2CAP_ERTM_INFO* p_ertm_info) { - if (bluetooth::shim::is_gd_shim_enabled()) { - return bluetooth::shim::L2CA_ErtmConnectRsp(p_bd_addr, id, lcid, result, - status, p_ertm_info); - } - tL2C_LCB* p_lcb; tL2C_CCB* p_ccb; -- 2.11.0