diff options
| author | 2024-06-20 17:11:40 -0700 | |
|---|---|---|
| committer | 2024-09-10 04:38:23 +0000 | |
| commit | aa5bd18d7894f526c3bfc1cff21abfedd9cc1d7b (patch) | |
| tree | da916318871d98b56c9f25af0fbfad67ef8b2f80 | |
| parent | f7cdbfe395d4e6f76c31524a72266ceaf333b81f (diff) | |
[18/25] stack::gatt Use stack::l2cap::get_interface()
Bug: 343808590
Test: m .
Flag: EXEMPT, Mechanical Refactor
Change-Id: I465c73d81bd3407cf9fcfffaef03dddd70b6cef9
| -rw-r--r-- | system/stack/gatt/att_protocol.cc | 5 | ||||
| -rw-r--r-- | system/stack/gatt/gatt_api.cc | 9 | ||||
| -rw-r--r-- | system/stack/gatt/gatt_db.cc | 3 | ||||
| -rw-r--r-- | system/stack/gatt/gatt_main.cc | 18 | ||||
| -rw-r--r-- | system/stack/test/gatt/stack_gatt_test.cc | 2 | ||||
| -rw-r--r-- | system/test/mock/mock_stack_gatt_main.cc | 1 |
6 files changed, 21 insertions, 17 deletions
diff --git a/system/stack/gatt/att_protocol.cc b/system/stack/gatt/att_protocol.cc index be75b7a124..29e196bfea 100644 --- a/system/stack/gatt/att_protocol.cc +++ b/system/stack/gatt/att_protocol.cc @@ -30,6 +30,7 @@ #include "osi/include/allocator.h" #include "stack/include/bt_hdr.h" #include "stack/include/bt_types.h" +#include "stack/include/l2cap_interface.h" #include "stack/include/l2cdefs.h" #include "types/bluetooth/uuid.h" @@ -370,10 +371,10 @@ tGATT_STATUS attp_send_msg_to_l2cap(tGATT_TCB& tcb, uint16_t lcid, BT_HDR* p_toL if (lcid == L2CAP_ATT_CID) { log::debug("Sending ATT message on att fixed channel"); - l2cap_ret = L2CA_SendFixedChnlData(lcid, tcb.peer_bda, p_toL2CAP); + l2cap_ret = stack::l2cap::get_interface().L2CA_SendFixedChnlData(lcid, tcb.peer_bda, p_toL2CAP); } else { log::debug("Sending ATT message on lcid:{}", lcid); - l2cap_ret = L2CA_DataWrite(lcid, p_toL2CAP); + l2cap_ret = stack::l2cap::get_interface().L2CA_DataWrite(lcid, p_toL2CAP); } if (l2cap_ret == tL2CAP_DW_RESULT::FAILED) { diff --git a/system/stack/gatt/gatt_api.cc b/system/stack/gatt/gatt_api.cc index c77c09b256..6c804e10bc 100644 --- a/system/stack/gatt/gatt_api.cc +++ b/system/stack/gatt/gatt_api.cc @@ -46,6 +46,7 @@ #include "stack/include/bt_uuid16.h" #include "stack/include/btm_client_interface.h" #include "stack/include/l2cap_acl_interface.h" +#include "stack/include/l2cap_interface.h" #include "stack/include/l2cdefs.h" #include "stack/include/sdp_api.h" #include "types/bluetooth/uuid.h" @@ -1190,15 +1191,15 @@ void GATT_SetIdleTimeout(const RawAddress& bd_addr, uint16_t idle_tout, tBT_TRAN tGATT_TCB* p_tcb = gatt_find_tcb_by_addr(bd_addr, transport); if (p_tcb != nullptr) { - status = L2CA_SetLeGattTimeout(bd_addr, idle_tout); + status = stack::l2cap::get_interface().L2CA_SetLeGattTimeout(bd_addr, idle_tout); if (is_active) { - status &= L2CA_MarkLeLinkAsActive(bd_addr); + status &= stack::l2cap::get_interface().L2CA_MarkLeLinkAsActive(bd_addr); } if (idle_tout == GATT_LINK_IDLE_TIMEOUT_WHEN_NO_APP) { - if (!L2CA_SetIdleTimeoutByBdAddr(p_tcb->peer_bda, GATT_LINK_IDLE_TIMEOUT_WHEN_NO_APP, - BT_TRANSPORT_LE)) { + if (!stack::l2cap::get_interface().L2CA_SetIdleTimeoutByBdAddr( + p_tcb->peer_bda, GATT_LINK_IDLE_TIMEOUT_WHEN_NO_APP, BT_TRANSPORT_LE)) { log::warn("Unable to set L2CAP link idle timeout peer:{} transport:{}", p_tcb->peer_bda, bt_transport_text(transport)); } diff --git a/system/stack/gatt/gatt_db.cc b/system/stack/gatt/gatt_db.cc index f15b044663..1fa67c192c 100644 --- a/system/stack/gatt/gatt_db.cc +++ b/system/stack/gatt/gatt_db.cc @@ -26,10 +26,9 @@ #include <string.h> #include "gatt_int.h" -#include "l2c_api.h" -#include "osi/include/osi.h" #include "stack/include/bt_hdr.h" #include "stack/include/bt_types.h" +#include "stack/include/l2cap_types.h" #include "types/bluetooth/uuid.h" using bluetooth::Uuid; diff --git a/system/stack/gatt/gatt_main.cc b/system/stack/gatt/gatt_main.cc index 65979f4897..6a195533cb 100644 --- a/system/stack/gatt/gatt_main.cc +++ b/system/stack/gatt/gatt_main.cc @@ -48,6 +48,7 @@ #include "stack/include/bt_types.h" #include "stack/include/btm_client_interface.h" #include "stack/include/l2cap_acl_interface.h" +#include "stack/include/l2cap_interface.h" #include "stack/include/l2cdefs.h" #include "stack/include/srvc_api.h" // tDIS_VALUE #include "types/raw_address.h" @@ -131,15 +132,15 @@ void gatt_init(void) { // clients exist fixed_reg.default_idle_tout = L2CAP_NO_IDLE_TIMEOUT; - if (!L2CA_RegisterFixedChannel(L2CAP_ATT_CID, &fixed_reg)) { + if (!stack::l2cap::get_interface().L2CA_RegisterFixedChannel(L2CAP_ATT_CID, &fixed_reg)) { log::error("Unable to register L2CAP ATT fixed channel"); } gatt_cb.over_br_enabled = osi_property_get_bool("bluetooth.gatt.over_bredr.enabled", true); /* Now, register with L2CAP for ATT PSM over BR/EDR */ - if (gatt_cb.over_br_enabled && - !L2CA_RegisterWithSecurity(BT_PSM_ATT, dyn_info, false /* enable_snoop */, nullptr, - GATT_MAX_MTU_SIZE, 0, BTM_SEC_NONE)) { + if (gatt_cb.over_br_enabled && !stack::l2cap::get_interface().L2CA_RegisterWithSecurity( + BT_PSM_ATT, dyn_info, false /* enable_snoop */, nullptr, + GATT_MAX_MTU_SIZE, 0, BTM_SEC_NONE)) { log::error("ATT Dynamic Registration failed"); } @@ -223,7 +224,8 @@ bool gatt_connect(const RawAddress& rem_bda, tBLE_ADDR_TYPE addr_type, tGATT_TCB } if (transport != BT_TRANSPORT_LE) { - p_tcb->att_lcid = L2CA_ConnectReqWithSecurity(BT_PSM_ATT, rem_bda, BTM_SEC_NONE); + p_tcb->att_lcid = stack::l2cap::get_interface().L2CA_ConnectReqWithSecurity(BT_PSM_ATT, rem_bda, + BTM_SEC_NONE); return p_tcb->att_lcid != 0; } @@ -308,7 +310,7 @@ bool gatt_disconnect(tGATT_TCB* p_tcb) { */ EattExtension::GetInstance()->Disconnect(p_tcb->peer_bda); } - if (!L2CA_RemoveFixedChnl(L2CAP_ATT_CID, p_tcb->peer_bda)) { + if (!stack::l2cap::get_interface().L2CA_RemoveFixedChnl(L2CAP_ATT_CID, p_tcb->peer_bda)) { log::warn("Unable to remove L2CAP ATT fixed channel peer:{}", p_tcb->peer_bda); } gatt_set_ch_state(p_tcb, GATT_CH_CLOSING); @@ -849,7 +851,7 @@ static void gatt_l2cif_connect_ind_cback(const RawAddress& bd_addr, uint16_t lci /* If we reject the connection, send DisconnectReq */ if (result != tL2CAP_CONN::L2CAP_CONN_OK) { - if (!L2CA_DisconnectReq(lcid)) { + if (!stack::l2cap::get_interface().L2CA_DisconnectReq(lcid)) { log::warn("Unable to disconnect L2CAP peer:{} cid:{}", bd_addr, lcid); } return; @@ -955,7 +957,7 @@ void gatt_l2cif_disconnect_ind_cback(uint16_t lcid, bool /* ack_needed */) { } static void gatt_l2cif_disconnect(uint16_t lcid) { - if (!L2CA_DisconnectReq(lcid)) { + if (!stack::l2cap::get_interface().L2CA_DisconnectReq(lcid)) { log::warn("Unable to disconnect L2CAP cid:{}", lcid); } diff --git a/system/stack/test/gatt/stack_gatt_test.cc b/system/stack/test/gatt/stack_gatt_test.cc index d095741932..3ae3ea1169 100644 --- a/system/stack/test/gatt/stack_gatt_test.cc +++ b/system/stack/test/gatt/stack_gatt_test.cc @@ -30,7 +30,7 @@ #include "stack/gatt/gatt_int.h" #include "stack/include/bt_types.h" #include "stack/include/gatt_api.h" -#include "stack/include/l2c_api.h" +#include "stack/include/l2cap_types.h" #include "stack/sdp/internal/sdp_api.h" #include "test/mock/mock_stack_sdp_legacy_api.h" #include "types/bluetooth/uuid.h" diff --git a/system/test/mock/mock_stack_gatt_main.cc b/system/test/mock/mock_stack_gatt_main.cc index b6476d0e4b..ec4ca1d9ee 100644 --- a/system/test/mock/mock_stack_gatt_main.cc +++ b/system/test/mock/mock_stack_gatt_main.cc @@ -22,6 +22,7 @@ #include "l2c_api.h" #include "stack/gatt/gatt_int.h" #include "stack/include/bt_hdr.h" +#include "stack/include/l2cap_interface.h" #include "test/common/mock_functions.h" #include "types/raw_address.h" |