diff options
author | 2024-06-04 15:29:49 -0700 | |
---|---|---|
committer | 2024-06-19 05:13:54 +0000 | |
commit | 5df466a6c9eb63232fa57b91d674d134f3488da1 (patch) | |
tree | 6620336262a6a78e6003d6e64e39de804d7cb7fb | |
parent | eee44c7d08bacccde6580c08932704c2448c0a12 (diff) |
Streamline enum stack::l2cap::tL2CAP_DW_RESULT
Bug: 344992630
Test: m .
Flag: EXEMPT, Mechanical Refactor
Change-Id: I58c45c5c40e155e0e4c5b6bb3bc50333ca798037
30 files changed, 78 insertions, 84 deletions
diff --git a/system/main/shim/l2c_api.h b/system/main/shim/l2c_api.h index 7f359cafef..d668d175ff 100644 --- a/system/main/shim/l2c_api.h +++ b/system/main/shim/l2c_api.h @@ -216,11 +216,11 @@ bool L2CA_DisconnectLECocReq(uint16_t cid); * * Description Higher layers call this function to write data. * - * Returns tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS, if data accepted, else + * Returns tL2CAP_DW_RESULT::SUCCESS, if data accepted, else * false - * tL2CAP_DW_RESULT::L2CAP_DW_CONGESTED, if data accepted + * tL2CAP_DW_RESULT::CONGESTED, if data accepted * and the channel is congested - * tL2CAP_DW_RESULT::L2CAP_DW_FAILED, if error + * tL2CAP_DW_RESULT::FAILED, if error * ******************************************************************************/ uint8_t L2CA_DataWrite(uint16_t cid, BT_HDR* p_data); @@ -355,8 +355,8 @@ bool L2CA_ConnectFixedChnl(uint16_t fixed_cid, const RawAddress& bd_addr); * BD Address of remote * Pointer to buffer of type BT_HDR * - * Return value tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS, if data accepted - * tL2CAP_DW_RESULT::L2CAP_DW_FAILED, if error + * Return value tL2CAP_DW_RESULT::SUCCESS, if data accepted + * tL2CAP_DW_RESULT::FAILED, if error * ******************************************************************************/ uint16_t L2CA_SendFixedChnlData(uint16_t fixed_cid, const RawAddress& rem_bda, diff --git a/system/stack/arbiter/acl_arbiter.cc b/system/stack/arbiter/acl_arbiter.cc index c7f43271cc..c2fc1c04ba 100644 --- a/system/stack/arbiter/acl_arbiter.cc +++ b/system/stack/arbiter/acl_arbiter.cc @@ -117,7 +117,7 @@ void AclArbiter::SendPacketToPeer(uint8_t tcb_idx, p_buf->offset = L2CAP_MIN_OFFSET; p_buf->len = buffer.size(); if (L2CA_SendFixedChnlData(L2CAP_ATT_CID, p_tcb->peer_bda, p_buf) != - tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS) { + tL2CAP_DW_RESULT::SUCCESS) { log::warn("Unable to send L2CAP data peer:{} fixed_cid:{} len:{}", p_tcb->peer_bda, L2CAP_ATT_CID, p_buf->len); } diff --git a/system/stack/avct/avct_bcb_act.cc b/system/stack/avct/avct_bcb_act.cc index 2ef6eb4124..853d3b6638 100644 --- a/system/stack/avct/avct_bcb_act.cc +++ b/system/stack/avct/avct_bcb_act.cc @@ -476,8 +476,7 @@ void avct_bcb_send_msg(tAVCT_BCB* p_bcb, tAVCT_LCB_EVT* p_data) { p_buf->layer_specific = AVCT_DATA_BROWSE; /* send message to L2CAP */ - if (L2CA_DataWrite(p_bcb->ch_lcid, p_buf) != - tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS) { + if (L2CA_DataWrite(p_bcb->ch_lcid, p_buf) != tL2CAP_DW_RESULT::SUCCESS) { log::warn("Unable to write L2CAP data peer:{} cid:{}", p_bcb->peer_addr, p_bcb->ch_lcid); } @@ -583,8 +582,7 @@ void avct_bcb_msg_ind(tAVCT_BCB* p_bcb, tAVCT_LCB_EVT* p_data) { AVCT_BUILD_HDR(p, label, AVCT_PKT_TYPE_SINGLE, AVCT_REJ); UINT16_TO_BE_STREAM(p, pid); p_buf->layer_specific = AVCT_DATA_BROWSE; - if (L2CA_DataWrite(p_bcb->ch_lcid, p_buf) != - tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS) { + if (L2CA_DataWrite(p_bcb->ch_lcid, p_buf) != tL2CAP_DW_RESULT::SUCCESS) { log::warn("Unable to write L2CAP data peer:{} cid:{}", p_bcb->peer_addr, p_bcb->ch_lcid); } diff --git a/system/stack/avct/avct_lcb_act.cc b/system/stack/avct/avct_lcb_act.cc index 981f9cc9ec..1f38cfeb9b 100644 --- a/system/stack/avct/avct_lcb_act.cc +++ b/system/stack/avct/avct_lcb_act.cc @@ -508,7 +508,7 @@ void avct_lcb_cong_ind(tAVCT_LCB* p_lcb, tAVCT_LCB_EVT* p_data) { while (!p_lcb->cong && (p_buf = (BT_HDR*)fixed_queue_try_dequeue(p_lcb->tx_q)) != NULL) { if (L2CA_DataWrite(p_lcb->ch_lcid, p_buf) == - tL2CAP_DW_RESULT::L2CAP_DW_CONGESTED) { + tL2CAP_DW_RESULT::CONGESTED) { p_lcb->cong = true; } } @@ -621,7 +621,7 @@ void avct_lcb_send_msg(tAVCT_LCB* p_lcb, tAVCT_LCB_EVT* p_data) { /* send message to L2CAP */ else { if (L2CA_DataWrite(p_lcb->ch_lcid, p_buf) == - tL2CAP_DW_RESULT::L2CAP_DW_CONGESTED) { + tL2CAP_DW_RESULT::CONGESTED) { p_lcb->cong = true; } } @@ -725,8 +725,7 @@ void avct_lcb_msg_ind(tAVCT_LCB* p_lcb, tAVCT_LCB_EVT* p_data) { p = (uint8_t*)(p_buf + 1) + p_buf->offset; AVCT_BUILD_HDR(p, label, AVCT_PKT_TYPE_SINGLE, AVCT_REJ); UINT16_TO_BE_STREAM(p, pid); - if (L2CA_DataWrite(p_lcb->ch_lcid, p_buf) != - tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS) { + if (L2CA_DataWrite(p_lcb->ch_lcid, p_buf) != tL2CAP_DW_RESULT::SUCCESS) { log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}", p_lcb->peer_addr, p_lcb->ch_lcid, p_buf->len); } diff --git a/system/stack/bnep/bnep_main.cc b/system/stack/bnep/bnep_main.cc index 1a269d9228..7572d2d13d 100644 --- a/system/stack/bnep/bnep_main.cc +++ b/system/stack/bnep/bnep_main.cc @@ -304,8 +304,7 @@ static void bnep_congestion_ind(uint16_t l2cap_cid, bool is_congested) { if (!p_buf) break; - if (L2CA_DataWrite(l2cap_cid, p_buf) != - tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS) { + if (L2CA_DataWrite(l2cap_cid, p_buf) != tL2CAP_DW_RESULT::SUCCESS) { log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}", p_bcb->rem_bda, l2cap_cid, p_buf->len); } diff --git a/system/stack/bnep/bnep_utils.cc b/system/stack/bnep/bnep_utils.cc index 113937c493..f1ccfc1d3b 100644 --- a/system/stack/bnep/bnep_utils.cc +++ b/system/stack/bnep/bnep_utils.cc @@ -415,8 +415,7 @@ void bnepu_check_send_packet(tBNEP_CONN* p_bcb, BT_HDR* p_buf) { fixed_queue_enqueue(p_bcb->xmit_q, p_buf); } } else { - if (L2CA_DataWrite(p_bcb->l2cap_cid, p_buf) != - tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS) { + if (L2CA_DataWrite(p_bcb->l2cap_cid, p_buf) != tL2CAP_DW_RESULT::SUCCESS) { log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}", p_bcb->rem_bda, p_bcb->l2cap_cid, p_buf->len); } diff --git a/system/stack/fuzzers/avrc_fuzzer.cc b/system/stack/fuzzers/avrc_fuzzer.cc index 387e427f13..69c58bcc4b 100644 --- a/system/stack/fuzzers/avrc_fuzzer.cc +++ b/system/stack/fuzzers/avrc_fuzzer.cc @@ -62,7 +62,7 @@ class FakeBtStack { log::assert_that(cid == kDummyCid, "assert failed: cid == kDummyCid"); ConsumeData((const uint8_t*)hdr, hdr->offset + hdr->len); osi_free(hdr); - return tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS; + return tL2CAP_DW_RESULT::SUCCESS; }; test::mock::stack_l2cap_api::L2CA_DisconnectReq.body = [](uint16_t cid) { log::assert_that(cid == kDummyCid, "assert failed: cid == kDummyCid"); diff --git a/system/stack/fuzzers/bnep_fuzzer.cc b/system/stack/fuzzers/bnep_fuzzer.cc index e7f396d71f..34ec0fb118 100644 --- a/system/stack/fuzzers/bnep_fuzzer.cc +++ b/system/stack/fuzzers/bnep_fuzzer.cc @@ -56,7 +56,7 @@ class FakeBtStack { bluetooth::log::assert_that(cid == kDummyCid, "assert failed: cid == kDummyCid"); osi_free(p_data); - return tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS; + return tL2CAP_DW_RESULT::SUCCESS; }; test::mock::stack_l2cap_api::L2CA_DisconnectReq.body = [](uint16_t cid) { bluetooth::log::assert_that(cid == kDummyCid, diff --git a/system/stack/fuzzers/gatt_fuzzer.cc b/system/stack/fuzzers/gatt_fuzzer.cc index 63a086443d..a5a1c6aa96 100644 --- a/system/stack/fuzzers/gatt_fuzzer.cc +++ b/system/stack/fuzzers/gatt_fuzzer.cc @@ -86,7 +86,7 @@ class FakeBtStack { test::mock::stack_l2cap_api::L2CA_DataWrite.body = [](uint16_t lcid, BT_HDR* hdr) { osi_free(hdr); - return tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS; + return tL2CAP_DW_RESULT::SUCCESS; }; test::mock::stack_l2cap_api::L2CA_DisconnectReq.body = [](uint16_t) { return true; @@ -94,7 +94,7 @@ class FakeBtStack { test::mock::stack_l2cap_api::L2CA_SendFixedChnlData.body = [](uint16_t cid, const RawAddress& addr, BT_HDR* hdr) { osi_free(hdr); - return tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS; + return tL2CAP_DW_RESULT::SUCCESS; }; test::mock::stack_l2cap_api::L2CA_RegisterFixedChannel.body = [](uint16_t fixed_cid, tL2CAP_FIXED_CHNL_REG* p_freg) { diff --git a/system/stack/fuzzers/sdp_fuzzer.cc b/system/stack/fuzzers/sdp_fuzzer.cc index 9a03b5b28f..4d607aa350 100644 --- a/system/stack/fuzzers/sdp_fuzzer.cc +++ b/system/stack/fuzzers/sdp_fuzzer.cc @@ -91,7 +91,7 @@ class FakeL2cap { [](uint16_t cid, BT_HDR* p_data) -> tL2CAP_DW_RESULT { auto len = p_data->len; osi_free(p_data); - return tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS; + return tL2CAP_DW_RESULT::SUCCESS; }; test::mock::stack_l2cap_api::L2CA_DisconnectReq.body = [](uint16_t lcid) { return true; diff --git a/system/stack/fuzzers/smp_fuzzer.cc b/system/stack/fuzzers/smp_fuzzer.cc index 31e030c249..96302f408a 100644 --- a/system/stack/fuzzers/smp_fuzzer.cc +++ b/system/stack/fuzzers/smp_fuzzer.cc @@ -94,7 +94,7 @@ class FakeBtStack { test::mock::stack_l2cap_api::L2CA_SendFixedChnlData.body = [](uint16_t cid, const RawAddress& addr, BT_HDR* hdr) { osi_free(hdr); - return tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS; + return tL2CAP_DW_RESULT::SUCCESS; }; test::mock::stack_l2cap_api::L2CA_RegisterFixedChannel.body = [](uint16_t fixed_cid, tL2CAP_FIXED_CHNL_REG* p_freg) { diff --git a/system/stack/gap/gap_conn.cc b/system/stack/gap/gap_conn.cc index 8e379c4c16..fd43479252 100644 --- a/system/stack/gap/gap_conn.cc +++ b/system/stack/gap/gap_conn.cc @@ -441,10 +441,10 @@ static bool gap_try_write_queued_data(tGAP_CCB* p_ccb) { status = L2CA_DataWrite(p_ccb->connection_id, p_buf); } - if (status == tL2CAP_DW_RESULT::L2CAP_DW_CONGESTED) { + if (status == tL2CAP_DW_RESULT::CONGESTED) { p_ccb->is_congested = true; return true; - } else if (status != tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS) + } else if (status != tL2CAP_DW_RESULT::SUCCESS) return false; } return true; diff --git a/system/stack/gatt/att_protocol.cc b/system/stack/gatt/att_protocol.cc index 4294c149b7..f1892128bf 100644 --- a/system/stack/gatt/att_protocol.cc +++ b/system/stack/gatt/att_protocol.cc @@ -383,10 +383,10 @@ tGATT_STATUS attp_send_msg_to_l2cap(tGATT_TCB& tcb, uint16_t lcid, l2cap_ret = L2CA_DataWrite(lcid, p_toL2CAP); } - if (l2cap_ret == tL2CAP_DW_RESULT::L2CAP_DW_FAILED) { + if (l2cap_ret == tL2CAP_DW_RESULT::FAILED) { log::error("failed to write data to L2CAP"); return GATT_INTERNAL_ERROR; - } else if (l2cap_ret == tL2CAP_DW_RESULT::L2CAP_DW_CONGESTED) { + } else if (l2cap_ret == tL2CAP_DW_RESULT::CONGESTED) { log::verbose("ATT congested, message accepted"); return GATT_CONGESTED; } diff --git a/system/stack/hid/hidd_conn.cc b/system/stack/hid/hidd_conn.cc index 95fce1df1e..1b96262d7a 100644 --- a/system/stack/hid/hidd_conn.cc +++ b/system/stack/hid/hidd_conn.cc @@ -89,7 +89,7 @@ static void hidd_check_config_done() { // send outstanding data on intr if (hd_cb.pending_data) { if (L2CA_DataWrite(p_hcon->intr_cid, hd_cb.pending_data) != - tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS) { + tL2CAP_DW_RESULT::SUCCESS) { log::warn("Unable to write L2CAP data cid:{} len:{}", p_hcon->intr_cid, hd_cb.pending_data->len); } @@ -822,7 +822,7 @@ tHID_STATUS hidd_conn_send_data(uint8_t channel, uint8_t msg_type, log::verbose("report sent"); - if (L2CA_DataWrite(cid, p_buf) == tL2CAP_DW_RESULT::L2CAP_DW_FAILED) { + if (L2CA_DataWrite(cid, p_buf) == tL2CAP_DW_RESULT::FAILED) { log_counter_metrics(android::bluetooth::CodePathCounterKeyEnum:: HIDD_ERR_CONGESTED_AT_DATA_WRITE, 1); diff --git a/system/stack/hid/hidh_conn.cc b/system/stack/hid/hidh_conn.cc index 3e8699be1b..d4d3de523d 100644 --- a/system/stack/hid/hidh_conn.cc +++ b/system/stack/hid/hidh_conn.cc @@ -848,7 +848,7 @@ tHID_STATUS hidh_conn_snd_data(uint8_t dhandle, uint8_t trans_type, /* Send the buffer through L2CAP */ if ((p_hcon->conn_flags & HID_CONN_FLAGS_CONGESTED) || - (L2CA_DataWrite(cid, p_buf) == tL2CAP_DW_RESULT::L2CAP_DW_FAILED)) { + (L2CA_DataWrite(cid, p_buf) == tL2CAP_DW_RESULT::FAILED)) { log_counter_metrics(android::bluetooth::CodePathCounterKeyEnum:: HIDH_ERR_CONGESTED_AT_SEND_DATA, 1); diff --git a/system/stack/include/l2c_api.h b/system/stack/include/l2c_api.h index ed45627fba..d02f77367f 100644 --- a/system/stack/include/l2c_api.h +++ b/system/stack/include/l2c_api.h @@ -53,9 +53,9 @@ /* result code for L2CA_DataWrite() */ enum class tL2CAP_DW_RESULT : uint8_t { - L2CAP_DW_FAILED = 0, - L2CAP_DW_SUCCESS = 1, - L2CAP_DW_CONGESTED = 2, + FAILED = 0, + SUCCESS = 1, + CONGESTED = 2, }; /* Values for priority parameter to L2CA_SetAclPriority */ diff --git a/system/stack/l2cap/l2c_api.cc b/system/stack/l2cap/l2c_api.cc index 0befad885c..c16e23e7c3 100644 --- a/system/stack/l2cap/l2c_api.cc +++ b/system/stack/l2cap/l2c_api.cc @@ -1302,13 +1302,13 @@ tL2CAP_DW_RESULT L2CA_SendFixedChnlData(uint16_t fixed_cid, NULL)) { log::warn("No service registered or invalid CID: 0x{:04x}", fixed_cid); osi_free(p_buf); - return (tL2CAP_DW_RESULT::L2CAP_DW_FAILED); + return (tL2CAP_DW_RESULT::FAILED); } if (!BTM_IsDeviceUp()) { log::warn("Controller is not ready CID: 0x{:04x}", fixed_cid); osi_free(p_buf); - return (tL2CAP_DW_RESULT::L2CAP_DW_FAILED); + return (tL2CAP_DW_RESULT::FAILED); } p_lcb = l2cu_find_lcb_by_bd_addr(rem_bda, transport); @@ -1317,7 +1317,7 @@ tL2CAP_DW_RESULT L2CA_SendFixedChnlData(uint16_t fixed_cid, log::warn("Link is disconnecting or does not exist CID: 0x{:04x}", fixed_cid); osi_free(p_buf); - return (tL2CAP_DW_RESULT::L2CAP_DW_FAILED); + return (tL2CAP_DW_RESULT::FAILED); } tL2C_BLE_FIXED_CHNLS_MASK peer_channel_mask; @@ -1331,7 +1331,7 @@ tL2CAP_DW_RESULT L2CA_SendFixedChnlData(uint16_t fixed_cid, if ((peer_channel_mask & (1 << fixed_cid)) == 0) { log::warn("Peer does not support fixed channel CID: 0x{:04x}", fixed_cid); osi_free(p_buf); - return (tL2CAP_DW_RESULT::L2CAP_DW_FAILED); + return (tL2CAP_DW_RESULT::FAILED); } p_buf->event = 0; @@ -1341,7 +1341,7 @@ tL2CAP_DW_RESULT L2CA_SendFixedChnlData(uint16_t fixed_cid, if (!l2cu_initialize_fixed_ccb(p_lcb, fixed_cid)) { log::warn("No channel control block found for CID: 0x{:4x}", fixed_cid); osi_free(p_buf); - return (tL2CAP_DW_RESULT::L2CAP_DW_FAILED); + return (tL2CAP_DW_RESULT::FAILED); } } @@ -1355,7 +1355,7 @@ tL2CAP_DW_RESULT L2CA_SendFixedChnlData(uint16_t fixed_cid, ->xmit_hold_q), p_lcb->p_fixed_ccbs[fixed_cid - L2CAP_FIRST_FIXED_CHNL]->buff_quota); osi_free(p_buf); - return (tL2CAP_DW_RESULT::L2CAP_DW_FAILED); + return (tL2CAP_DW_RESULT::FAILED); } log::debug("Enqueued data for CID: 0x{:04x} len:{}", fixed_cid, p_buf->len); @@ -1373,10 +1373,10 @@ tL2CAP_DW_RESULT L2CA_SendFixedChnlData(uint16_t fixed_cid, if (p_lcb->p_fixed_ccbs[fixed_cid - L2CAP_FIRST_FIXED_CHNL]->cong_sent) { log::debug("Link congested for CID: 0x{:04x}", fixed_cid); - return (tL2CAP_DW_RESULT::L2CAP_DW_CONGESTED); + return (tL2CAP_DW_RESULT::CONGESTED); } - return (tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS); + return (tL2CAP_DW_RESULT::SUCCESS); } /******************************************************************************* diff --git a/system/stack/l2cap/l2c_main.cc b/system/stack/l2cap/l2c_main.cc index 7fe9ec1931..ba851c38d5 100644 --- a/system/stack/l2cap/l2c_main.cc +++ b/system/stack/l2cap/l2c_main.cc @@ -913,7 +913,7 @@ tL2CAP_DW_RESULT l2c_data_write(uint16_t cid, BT_HDR* p_data, uint16_t flags) { if (!p_ccb) { log::warn("L2CAP - no CCB for L2CA_DataWrite, CID: {}", cid); osi_free(p_data); - return (tL2CAP_DW_RESULT::L2CAP_DW_FAILED); + return (tL2CAP_DW_RESULT::FAILED); } /* Sending message bigger than mtu size of peer is a violation of protocol */ @@ -930,7 +930,7 @@ tL2CAP_DW_RESULT l2c_data_write(uint16_t cid, BT_HDR* p_data, uint16_t flags) { "size: len={} mtu={}", cid, p_data->len, mtu); osi_free(p_data); - return (tL2CAP_DW_RESULT::L2CAP_DW_FAILED); + return (tL2CAP_DW_RESULT::FAILED); } /* channel based, packet based flushable or non-flushable */ @@ -945,12 +945,12 @@ tL2CAP_DW_RESULT l2c_data_write(uint16_t cid, BT_HDR* p_data, uint16_t flags) { p_ccb->buff_quota); osi_free(p_data); - return (tL2CAP_DW_RESULT::L2CAP_DW_FAILED); + return (tL2CAP_DW_RESULT::FAILED); } l2c_csm_execute(p_ccb, L2CEVT_L2CA_DATA_WRITE, p_data); - if (p_ccb->cong_sent) return (tL2CAP_DW_RESULT::L2CAP_DW_CONGESTED); + if (p_ccb->cong_sent) return (tL2CAP_DW_RESULT::CONGESTED); - return (tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS); + return (tL2CAP_DW_RESULT::SUCCESS); } diff --git a/system/stack/rfcomm/rfc_ts_frames.cc b/system/stack/rfcomm/rfc_ts_frames.cc index acc756c584..068dd022d6 100644 --- a/system/stack/rfcomm/rfc_ts_frames.cc +++ b/system/stack/rfcomm/rfc_ts_frames.cc @@ -201,8 +201,7 @@ void rfc_send_buf_uih(tRFC_MCB* p_mcb, uint8_t dlci, BT_HDR* p_buf) { if (dlci == RFCOMM_MX_DLCI) { rfc_check_send_cmd(p_mcb, p_buf); } else { - if (L2CA_DataWrite(p_mcb->lcid, p_buf) != - tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS) { + if (L2CA_DataWrite(p_mcb->lcid, p_buf) != tL2CAP_DW_RESULT::SUCCESS) { log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}", p_mcb->bd_addr, p_mcb->lcid, p_buf->len); } diff --git a/system/stack/rfcomm/rfc_utils.cc b/system/stack/rfcomm/rfc_utils.cc index 0a3214400f..06da90fb13 100644 --- a/system/stack/rfcomm/rfc_utils.cc +++ b/system/stack/rfcomm/rfc_utils.cc @@ -426,7 +426,7 @@ void rfc_check_send_cmd(tRFC_MCB* p_mcb, BT_HDR* p_buf) { while (!p_mcb->l2cap_congested) { BT_HDR* p = (BT_HDR*)fixed_queue_try_dequeue(p_mcb->cmd_q); if (p == NULL) break; - if (L2CA_DataWrite(p_mcb->lcid, p) != tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS) { + if (L2CA_DataWrite(p_mcb->lcid, p) != tL2CAP_DW_RESULT::SUCCESS) { log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}", p_mcb->bd_addr, p_mcb->lcid, p->len); } diff --git a/system/stack/sdp/sdp_discovery.cc b/system/stack/sdp/sdp_discovery.cc index 11c8f389f5..b8dbaf832f 100644 --- a/system/stack/sdp/sdp_discovery.cc +++ b/system/stack/sdp/sdp_discovery.cc @@ -178,7 +178,7 @@ static void sdp_snd_service_search_req(tCONN_CB* p_ccb, uint8_t cont_len, p_cmd->len = (uint16_t)(p - p_start); if (L2CA_DataWrite(p_ccb->connection_id, p_cmd) != - tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS) { + tL2CAP_DW_RESULT::SUCCESS) { log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}", p_ccb->device_address, p_ccb->connection_id, p_cmd->len); } @@ -689,7 +689,7 @@ static void process_service_search_attr_rsp(tCONN_CB* p_ccb, uint8_t* p_reply, p_msg->len = p - p_start; if (L2CA_DataWrite(p_ccb->connection_id, p_msg) != - tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS) { + tL2CAP_DW_RESULT::SUCCESS) { log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}", p_ccb->device_address, p_ccb->connection_id, p_msg->len); } @@ -864,7 +864,7 @@ static void process_service_attr_rsp(tCONN_CB* p_ccb, uint8_t* p_reply, p_msg->len = (uint16_t)(p - p_start); if (L2CA_DataWrite(p_ccb->connection_id, p_msg) != - tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS) { + tL2CAP_DW_RESULT::SUCCESS) { log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}", p_ccb->device_address, p_ccb->connection_id, p_msg->len); } diff --git a/system/stack/sdp/sdp_server.cc b/system/stack/sdp/sdp_server.cc index 3902991645..f7c68eec83 100644 --- a/system/stack/sdp/sdp_server.cc +++ b/system/stack/sdp/sdp_server.cc @@ -304,7 +304,7 @@ static void process_service_search(tCONN_CB* p_ccb, uint16_t trans_num, /* Send the buffer through L2CAP */ if (L2CA_DataWrite(p_ccb->connection_id, p_buf) != - tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS) { + tL2CAP_DW_RESULT::SUCCESS) { log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}", p_ccb->device_address, p_ccb->connection_id, p_buf->len); } @@ -703,7 +703,7 @@ static void process_service_attr_req(tCONN_CB* p_ccb, uint16_t trans_num, /* Send the buffer through L2CAP */ if (L2CA_DataWrite(p_ccb->connection_id, p_buf) != - tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS) { + tL2CAP_DW_RESULT::SUCCESS) { log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}", p_ccb->device_address, p_ccb->connection_id, p_buf->len); } @@ -1182,7 +1182,7 @@ static void process_service_search_attr_req(tCONN_CB* p_ccb, uint16_t trans_num, /* Send the buffer through L2CAP */ if (L2CA_DataWrite(p_ccb->connection_id, p_buf) != - tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS) { + tL2CAP_DW_RESULT::SUCCESS) { log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}", p_ccb->device_address, p_ccb->connection_id, p_buf->len); } diff --git a/system/stack/sdp/sdp_utils.cc b/system/stack/sdp/sdp_utils.cc index d22148f7f7..4e5069130e 100644 --- a/system/stack/sdp/sdp_utils.cc +++ b/system/stack/sdp/sdp_utils.cc @@ -740,7 +740,7 @@ void sdpu_build_n_send_error(tCONN_CB* p_ccb, uint16_t trans_num, /* Send the buffer through L2CAP */ if (L2CA_DataWrite(p_ccb->connection_id, p_buf) != - tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS) { + tL2CAP_DW_RESULT::SUCCESS) { log::warn("Unable to write L2CAP data cid:{}", p_ccb->connection_id); } } diff --git a/system/stack/smp/smp_utils.cc b/system/stack/smp/smp_utils.cc index eb586f32ff..72892169da 100644 --- a/system/stack/smp/smp_utils.cc +++ b/system/stack/smp/smp_utils.cc @@ -368,7 +368,7 @@ bool smp_send_msg_to_L2CAP(const RawAddress& rem_bda, BT_HDR* p_toL2CAP) { /* Unacked needs to be incremented before calling SendFixedChnlData */ smp_cb.total_tx_unacked++; l2cap_ret = L2CA_SendFixedChnlData(fixed_cid, rem_bda, p_toL2CAP); - if (l2cap_ret == tL2CAP_DW_RESULT::L2CAP_DW_FAILED) { + if (l2cap_ret == tL2CAP_DW_RESULT::FAILED) { smp_cb.total_tx_unacked--; log::error("SMP failed to pass msg to L2CAP"); return false; @@ -378,7 +378,7 @@ bool smp_send_msg_to_L2CAP(const RawAddress& rem_bda, BT_HDR* p_toL2CAP) { } l2cap_ret = L2CA_SendFixedChnlData(fixed_cid, rem_bda, p_toL2CAP); - if (l2cap_ret == tL2CAP_DW_RESULT::L2CAP_DW_FAILED) { + if (l2cap_ret == tL2CAP_DW_RESULT::FAILED) { log::error("SMP failed to pass msg to L2CAP"); return false; } else { diff --git a/system/stack/test/rfcomm/stack_rfcomm_test.cc b/system/stack/test/rfcomm/stack_rfcomm_test.cc index 0a54a2f599..c30593a6d8 100644 --- a/system/stack/test/rfcomm/stack_rfcomm_test.cc +++ b/system/stack/test/rfcomm/stack_rfcomm_test.cc @@ -179,7 +179,7 @@ class StackRfcommTest : public Test { BT_HDR* ua_channel_0 = AllocateWrappedOutgoingL2capAclPacket( CreateQuickUaPacket(RFCOMM_MX_DLCI, lcid, acl_handle)); EXPECT_CALL(l2cap_interface_, DataWrite(lcid, BtHdrEqual(ua_channel_0))) - .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS)); + .WillOnce(Return(tL2CAP_DW_RESULT::SUCCESS)); // Packet should be freed by RFCOMM l2cap_appl_info_.pL2CA_DataInd_Cb(lcid, sabm_channel_0); osi_free(ua_channel_0); @@ -200,7 +200,7 @@ class StackRfcommTest : public Test { lcid, acl_handle)); EXPECT_CALL(l2cap_interface_, DataWrite(lcid, BtHdrEqual(uih_pn_rsp_to_peer))) - .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS)); + .WillOnce(Return(tL2CAP_DW_RESULT::SUCCESS)); // uih_pn_cmd_from_peer should be freed by this method l2cap_appl_info_.pL2CA_DataInd_Cb(lcid, uih_pn_cmd_from_peer); osi_free(uih_pn_rsp_to_peer); @@ -228,7 +228,7 @@ class StackRfcommTest : public Test { BT_HDR* ua_channel_dlci = AllocateWrappedOutgoingL2capAclPacket( CreateQuickUaPacket(GetDlci(false, scn), lcid, acl_handle)); EXPECT_CALL(l2cap_interface_, DataWrite(lcid, BtHdrEqual(ua_channel_dlci))) - .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS)); + .WillOnce(Return(tL2CAP_DW_RESULT::SUCCESS)); ASSERT_TRUE(security_callback); security_callback(peer_addr, BT_TRANSPORT_BR_EDR, p_port, BTM_SUCCESS); osi_free(ua_channel_dlci); @@ -244,13 +244,13 @@ class StackRfcommTest : public Test { // We also have to do modem configuration ourself EXPECT_CALL(l2cap_interface_, DataWrite(lcid, BtHdrEqual(uih_msc_response_to_peer))) - .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS)); + .WillOnce(Return(tL2CAP_DW_RESULT::SUCCESS)); BT_HDR* uih_msc_cmd_to_peer = AllocateWrappedOutgoingL2capAclPacket( CreateQuickMscPacket(false, GetDlci(false, scn), lcid, acl_handle, true, false, true, true, false, true)); EXPECT_CALL(l2cap_interface_, DataWrite(lcid, BtHdrEqual(uih_msc_cmd_to_peer))) - .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS)); + .WillOnce(Return(tL2CAP_DW_RESULT::SUCCESS)); // uih_msc_cmd_from_peer should be freed by this method l2cap_appl_info_.pL2CA_DataInd_Cb(lcid, uih_msc_cmd_from_peer); osi_free(uih_msc_response_to_peer); @@ -281,7 +281,7 @@ class StackRfcommTest : public Test { } else { EXPECT_CALL(l2cap_interface_, DataWrite(lcid, BtHdrEqual(uih_pn_channel_3))) - .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS)); + .WillOnce(Return(tL2CAP_DW_RESULT::SUCCESS)); } ASSERT_EQ(RFCOMM_CreateConnectionWithSecurity(uuid, scn, false, mtu, peer_bd_addr, client_handle, @@ -317,7 +317,7 @@ class StackRfcommTest : public Test { BT_HDR* sabm_channel_0 = AllocateWrappedOutgoingL2capAclPacket( CreateQuickSabmPacket(RFCOMM_MX_DLCI, lcid, acl_handle)); EXPECT_CALL(l2cap_interface_, DataWrite(lcid, BtHdrEqual(sabm_channel_0))) - .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS)); + .WillOnce(Return(tL2CAP_DW_RESULT::SUCCESS)); l2cap_appl_info_.pL2CA_ConfigInd_Cb(lcid, &cfg_req); osi_free(sabm_channel_0); } @@ -340,7 +340,7 @@ class StackRfcommTest : public Test { RFCOMM_K_MAX, lcid, acl_handle)); EXPECT_CALL(l2cap_interface_, DataWrite(lcid, BtHdrEqual(uih_pn_channel_3))) - .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS)); + .WillOnce(Return(tL2CAP_DW_RESULT::SUCCESS)); l2cap_appl_info_.pL2CA_DataInd_Cb(lcid, ua_channel_0); osi_free(uih_pn_channel_3); } @@ -367,7 +367,7 @@ class StackRfcommTest : public Test { BT_HDR* sabm_channel_3 = AllocateWrappedOutgoingL2capAclPacket( CreateQuickSabmPacket(GetDlci(false, scn), lcid, acl_handle)); EXPECT_CALL(l2cap_interface_, DataWrite(lcid, BtHdrEqual(sabm_channel_3))) - .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS)); + .WillOnce(Return(tL2CAP_DW_RESULT::SUCCESS)); ASSERT_TRUE(security_callback); security_callback(peer_addr, BT_TRANSPORT_BR_EDR, p_port, BTM_SUCCESS); osi_free(sabm_channel_3); @@ -382,7 +382,7 @@ class StackRfcommTest : public Test { CreateQuickMscPacket(true, GetDlci(false, scn), lcid, acl_handle, true, false, true, true, false, true)); EXPECT_CALL(l2cap_interface_, DataWrite(lcid, BtHdrEqual(uih_msc_cmd))) - .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS)); + .WillOnce(Return(tL2CAP_DW_RESULT::SUCCESS)); BT_HDR* ua_channel_3 = AllocateWrappedIncomingL2capAclPacket( CreateQuickUaPacket(GetDlci(false, scn), lcid, acl_handle)); l2cap_appl_info_.pL2CA_DataInd_Cb(lcid, ua_channel_3); @@ -405,7 +405,7 @@ class StackRfcommTest : public Test { false, true, true, false, true)); EXPECT_CALL(l2cap_interface_, DataWrite(lcid, BtHdrEqual(uih_msc_response_to_peer))) - .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS)); + .WillOnce(Return(tL2CAP_DW_RESULT::SUCCESS)); l2cap_appl_info_.pL2CA_DataInd_Cb(lcid, uih_msc_cmd_from_peer); osi_free(uih_msc_response_to_peer); } @@ -421,7 +421,7 @@ class StackRfcommTest : public Test { credits, message)); uint16_t transmitted_length = 0; EXPECT_CALL(l2cap_interface_, DataWrite(lcid, BtHdrEqual(data_packet))) - .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS)); + .WillOnce(Return(tL2CAP_DW_RESULT::SUCCESS)); ASSERT_EQ(PORT_WriteData(port_handle, message.data(), message.size(), &transmitted_length), PORT_SUCCESS); @@ -795,7 +795,7 @@ TEST_F(StackRfcommTest, DISABLED_TestConnectionCollision) { BT_HDR* ua_channel_0 = AllocateWrappedOutgoingL2capAclPacket( CreateQuickUaPacket(RFCOMM_MX_DLCI, new_lcid, acl_handle)); EXPECT_CALL(l2cap_interface_, DataWrite(new_lcid, BtHdrEqual(ua_channel_0))) - .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS)); + .WillOnce(Return(tL2CAP_DW_RESULT::SUCCESS)); // And immediately try to configure test_peer_scn BT_HDR* uih_pn_cmd_to_peer = AllocateWrappedOutgoingL2capAclPacket( CreateQuickPnPacket(false, GetDlci(true, test_peer_scn), true, test_mtu, @@ -803,7 +803,7 @@ TEST_F(StackRfcommTest, DISABLED_TestConnectionCollision) { new_lcid, acl_handle)); EXPECT_CALL(l2cap_interface_, DataWrite(new_lcid, BtHdrEqual(uih_pn_cmd_to_peer))) - .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS)); + .WillOnce(Return(tL2CAP_DW_RESULT::SUCCESS)); // Packet should be freed by this method l2cap_appl_info_.pL2CA_DataInd_Cb(new_lcid, sabm_channel_0); osi_free(ua_channel_0); @@ -823,7 +823,7 @@ TEST_F(StackRfcommTest, DISABLED_TestConnectionCollision) { EXPECT_CALL(l2cap_interface_, DataWrite(new_lcid, BtHdrEqual(uih_pn_rsp_to_peer))) .Times(1) - .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS)); + .WillOnce(Return(tL2CAP_DW_RESULT::SUCCESS)); l2cap_appl_info_.pL2CA_DataInd_Cb(new_lcid, uih_pn_cmd_from_peer); osi_free(uih_pn_rsp_to_peer); @@ -851,7 +851,7 @@ TEST_F(StackRfcommTest, DISABLED_TestConnectionCollision) { AllocateWrappedOutgoingL2capAclPacket(CreateQuickUaPacket( GetDlci(false, test_server_scn), new_lcid, acl_handle)); EXPECT_CALL(l2cap_interface_, DataWrite(new_lcid, BtHdrEqual(ua_server_scn))) - .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS)); + .WillOnce(Return(tL2CAP_DW_RESULT::SUCCESS)); // Callback should come from server port instead, client port will timeout // in 20 seconds EXPECT_CALL(rfcomm_callback_, @@ -870,13 +870,13 @@ TEST_F(StackRfcommTest, DISABLED_TestConnectionCollision) { // MPX_CTRL Modem Status Response (MSC) EXPECT_CALL(l2cap_interface_, DataWrite(new_lcid, BtHdrEqual(uih_msc_rsp_to_peer))) - .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS)); + .WillOnce(Return(tL2CAP_DW_RESULT::SUCCESS)); BT_HDR* uih_msc_cmd_to_peer = AllocateWrappedOutgoingL2capAclPacket( CreateQuickMscPacket(false, GetDlci(false, test_server_scn), new_lcid, acl_handle, true, false, true, true, false, true)); EXPECT_CALL(l2cap_interface_, DataWrite(new_lcid, BtHdrEqual(uih_msc_cmd_to_peer))) - .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS)); + .WillOnce(Return(tL2CAP_DW_RESULT::SUCCESS)); l2cap_appl_info_.pL2CA_DataInd_Cb(new_lcid, uih_msc_cmd_from_peer); osi_free(uih_msc_rsp_to_peer); osi_free(uih_msc_cmd_to_peer); diff --git a/system/stack/test/sdp/stack_sdp_parse_test.cc b/system/stack/test/sdp/stack_sdp_parse_test.cc index 5822a59671..425c068c9e 100644 --- a/system/stack/test/sdp/stack_sdp_parse_test.cc +++ b/system/stack/test/sdp/stack_sdp_parse_test.cc @@ -63,7 +63,7 @@ class StackSdpParserWithMocksTest : public ::testing::Test { test::mock::stack_l2cap_api::L2CA_DataWrite.body = [](uint16_t /* cid */, BT_HDR* p_data) { osi_free_and_reset((void**)&p_data); - return tL2CAP_DW_RESULT::L2CAP_DW_FAILED; + return tL2CAP_DW_RESULT::FAILED; }; test::mock::stack_l2cap_api::L2CA_DisconnectReq.body = [](uint16_t /* cid */) { return true; }; diff --git a/system/stack/test/sdp/stack_sdp_test.cc b/system/stack/test/sdp/stack_sdp_test.cc index ffbf325b8e..3dae98b571 100644 --- a/system/stack/test/sdp/stack_sdp_test.cc +++ b/system/stack/test/sdp/stack_sdp_test.cc @@ -52,7 +52,7 @@ class StackSdpWithMocksTest : public ::testing::Test { test::mock::stack_l2cap_api::L2CA_DataWrite.body = [](uint16_t /* cid */, BT_HDR* p_data) -> tL2CAP_DW_RESULT { osi_free_and_reset((void**)&p_data); - return tL2CAP_DW_RESULT::L2CAP_DW_FAILED; + return tL2CAP_DW_RESULT::FAILED; }; test::mock::stack_l2cap_api::L2CA_DisconnectReq.body = [](uint16_t /* cid */) { return true; }; diff --git a/system/stack/test/sdp/stack_sdp_utils_test.cc b/system/stack/test/sdp/stack_sdp_utils_test.cc index db1c224f96..b32227b718 100644 --- a/system/stack/test/sdp/stack_sdp_utils_test.cc +++ b/system/stack/test/sdp/stack_sdp_utils_test.cc @@ -257,7 +257,7 @@ class StackSdpMockAndFakeTest : public ::testing::Test { test::mock::stack_l2cap_api::L2CA_DataWrite.body = [](uint16_t /* cid */, BT_HDR* p_data) -> tL2CAP_DW_RESULT { osi_free_and_reset((void**)&p_data); - return tL2CAP_DW_RESULT::L2CAP_DW_FAILED; + return tL2CAP_DW_RESULT::FAILED; }; test::mock::stack_l2cap_api::L2CA_DisconnectReq.body = [](uint16_t /* cid */) { return true; }; diff --git a/system/test/mock/mock_stack_l2cap_api.h b/system/test/mock/mock_stack_l2cap_api.h index c383e83c15..2b0a13b68d 100644 --- a/system/test/mock/mock_stack_l2cap_api.h +++ b/system/test/mock/mock_stack_l2cap_api.h @@ -379,7 +379,7 @@ struct L2CA_SendFixedChnlData { BT_HDR* p_buf)> body{[](uint16_t /* fixed_cid */, const RawAddress& /* rem_bda */, BT_HDR* /* p_buf */) -> tL2CAP_DW_RESULT { - return tL2CAP_DW_RESULT::L2CAP_DW_FAILED; + return tL2CAP_DW_RESULT::FAILED; }}; tL2CAP_DW_RESULT operator()(uint16_t fixed_cid, const RawAddress& rem_bda, BT_HDR* p_buf) { @@ -428,7 +428,7 @@ extern struct L2CA_MarkLeLinkAsActive L2CA_MarkLeLinkAsActive; struct L2CA_DataWrite { std::function<tL2CAP_DW_RESULT(uint16_t cid, BT_HDR* p_data)> body{ [](uint16_t /* cid */, BT_HDR* /* p_data */) -> tL2CAP_DW_RESULT { - return tL2CAP_DW_RESULT::L2CAP_DW_FAILED; + return tL2CAP_DW_RESULT::FAILED; }}; tL2CAP_DW_RESULT operator()(uint16_t cid, BT_HDR* p_data) { return body(cid, p_data); @@ -441,7 +441,7 @@ extern struct L2CA_DataWrite L2CA_DataWrite; struct L2CA_LECocDataWrite { std::function<tL2CAP_DW_RESULT(uint16_t cid, BT_HDR* p_data)> body{ [](uint16_t /* cid */, BT_HDR* /* p_data */) -> tL2CAP_DW_RESULT { - return tL2CAP_DW_RESULT::L2CAP_DW_FAILED; + return tL2CAP_DW_RESULT::FAILED; }}; tL2CAP_DW_RESULT operator()(uint16_t cid, BT_HDR* p_data) { return body(cid, p_data); diff --git a/system/test/mock/mock_stack_l2cap_main.cc b/system/test/mock/mock_stack_l2cap_main.cc index 98cb699ee5..5504d89325 100644 --- a/system/test/mock/mock_stack_l2cap_main.cc +++ b/system/test/mock/mock_stack_l2cap_main.cc @@ -27,7 +27,7 @@ tL2CAP_DW_RESULT l2c_data_write(uint16_t /* cid */, BT_HDR* /* p_data */, uint16_t /* flags */) { inc_func_call_count(__func__); - return tL2CAP_DW_RESULT::L2CAP_DW_FAILED; + return tL2CAP_DW_RESULT::FAILED; } void l2c_ccb_timer_timeout(void* /* data */) { inc_func_call_count(__func__); } void l2c_fcrb_ack_timer_timeout(void* /* data */) { |