summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Chris Manton <cmanton@google.com> 2024-06-04 15:06:42 -0700
committer Chris Manton <cmanton@google.com> 2024-06-17 23:56:14 +0000
commitcab59faa105464718b8030947b6712c236705983 (patch)
tree8e712ff4473b44191cd5056e10bcfe1286ff891f
parent6e4d5693c15e8cbecb2dfc0dd5bcde1d8e0d2653 (diff)
Class-enumify stack::l2cap::tL2CAP_DW_RESULT
Bug: 344991872 Test: m . Flag: EXEMPT, Mechanical Refactor Change-Id: I925537804979745d42b47d081130817097322ba6
-rw-r--r--system/main/shim/l2c_api.h13
-rw-r--r--system/stack/arbiter/acl_arbiter.cc2
-rw-r--r--system/stack/avct/avct_bcb_act.cc6
-rw-r--r--system/stack/avct/avct_lcb_act.cc9
-rw-r--r--system/stack/bnep/bnep_main.cc3
-rw-r--r--system/stack/bnep/bnep_utils.cc3
-rw-r--r--system/stack/fuzzers/avrc_fuzzer.cc2
-rw-r--r--system/stack/fuzzers/bnep_fuzzer.cc2
-rw-r--r--system/stack/fuzzers/gatt_fuzzer.cc4
-rw-r--r--system/stack/fuzzers/sdp_fuzzer.cc2
-rw-r--r--system/stack/fuzzers/smp_fuzzer.cc2
-rw-r--r--system/stack/gap/gap_conn.cc4
-rw-r--r--system/stack/gatt/att_protocol.cc4
-rw-r--r--system/stack/hid/hidd_conn.cc4
-rw-r--r--system/stack/hid/hidh_conn.cc2
-rw-r--r--system/stack/include/l2c_api.h17
-rw-r--r--system/stack/l2cap/l2c_api.cc29
-rw-r--r--system/stack/l2cap/l2c_main.cc19
-rw-r--r--system/stack/rfcomm/rfc_ts_frames.cc3
-rw-r--r--system/stack/rfcomm/rfc_utils.cc2
-rw-r--r--system/stack/sdp/sdp_discovery.cc9
-rw-r--r--system/stack/sdp/sdp_server.cc9
-rw-r--r--system/stack/sdp/sdp_utils.cc3
-rw-r--r--system/stack/smp/smp_utils.cc4
-rw-r--r--system/stack/test/rfcomm/stack_rfcomm_test.cc36
-rw-r--r--system/stack/test/sdp/stack_sdp_parse_test.cc2
-rw-r--r--system/stack/test/sdp/stack_sdp_test.cc2
-rw-r--r--system/stack/test/sdp/stack_sdp_utils_test.cc2
-rw-r--r--system/test/mock/mock_stack_l2cap_api.h6
-rw-r--r--system/test/mock/mock_stack_l2cap_main.cc2
30 files changed, 113 insertions, 94 deletions
diff --git a/system/main/shim/l2c_api.h b/system/main/shim/l2c_api.h
index 88bd3bcd4f..7f359cafef 100644
--- a/system/main/shim/l2c_api.h
+++ b/system/main/shim/l2c_api.h
@@ -216,10 +216,11 @@ bool L2CA_DisconnectLECocReq(uint16_t cid);
*
* Description Higher layers call this function to write data.
*
- * Returns L2CAP_DW_SUCCESS, if data accepted, else false
- * L2CAP_DW_CONGESTED, if data accepted and the channel is
- * congested
- * L2CAP_DW_FAILED, if error
+ * Returns tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS, if data accepted, else
+ * false
+ * tL2CAP_DW_RESULT::L2CAP_DW_CONGESTED, if data accepted
+ * and the channel is congested
+ * tL2CAP_DW_RESULT::L2CAP_DW_FAILED, if error
*
******************************************************************************/
uint8_t L2CA_DataWrite(uint16_t cid, BT_HDR* p_data);
@@ -354,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 L2CAP_DW_SUCCESS, if data accepted
- * L2CAP_DW_FAILED, if error
+ * Return value tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS, if data accepted
+ * tL2CAP_DW_RESULT::L2CAP_DW_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 ff3a671eb1..c7f43271cc 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) !=
- L2CAP_DW_SUCCESS) {
+ tL2CAP_DW_RESULT::L2CAP_DW_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 c4ad431904..2ef6eb4124 100644
--- a/system/stack/avct/avct_bcb_act.cc
+++ b/system/stack/avct/avct_bcb_act.cc
@@ -476,7 +476,8 @@ 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) != L2CAP_DW_SUCCESS) {
+ if (L2CA_DataWrite(p_bcb->ch_lcid, p_buf) !=
+ tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS) {
log::warn("Unable to write L2CAP data peer:{} cid:{}", p_bcb->peer_addr,
p_bcb->ch_lcid);
}
@@ -582,7 +583,8 @@ 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) != L2CAP_DW_SUCCESS) {
+ if (L2CA_DataWrite(p_bcb->ch_lcid, p_buf) !=
+ tL2CAP_DW_RESULT::L2CAP_DW_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 b035721b0d..981f9cc9ec 100644
--- a/system/stack/avct/avct_lcb_act.cc
+++ b/system/stack/avct/avct_lcb_act.cc
@@ -507,7 +507,8 @@ void avct_lcb_cong_ind(tAVCT_LCB* p_lcb, tAVCT_LCB_EVT* p_data) {
if (!p_lcb->cong && !fixed_queue_is_empty(p_lcb->tx_q)) {
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) == L2CAP_DW_CONGESTED) {
+ if (L2CA_DataWrite(p_lcb->ch_lcid, p_buf) ==
+ tL2CAP_DW_RESULT::L2CAP_DW_CONGESTED) {
p_lcb->cong = true;
}
}
@@ -619,7 +620,8 @@ 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) == L2CAP_DW_CONGESTED) {
+ if (L2CA_DataWrite(p_lcb->ch_lcid, p_buf) ==
+ tL2CAP_DW_RESULT::L2CAP_DW_CONGESTED) {
p_lcb->cong = true;
}
}
@@ -723,7 +725,8 @@ 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) != L2CAP_DW_SUCCESS) {
+ if (L2CA_DataWrite(p_lcb->ch_lcid, p_buf) !=
+ tL2CAP_DW_RESULT::L2CAP_DW_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 e761f129a9..1a269d9228 100644
--- a/system/stack/bnep/bnep_main.cc
+++ b/system/stack/bnep/bnep_main.cc
@@ -304,7 +304,8 @@ static void bnep_congestion_ind(uint16_t l2cap_cid, bool is_congested) {
if (!p_buf) break;
- if (L2CA_DataWrite(l2cap_cid, p_buf) != L2CAP_DW_SUCCESS) {
+ if (L2CA_DataWrite(l2cap_cid, p_buf) !=
+ tL2CAP_DW_RESULT::L2CAP_DW_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 7129ccf690..113937c493 100644
--- a/system/stack/bnep/bnep_utils.cc
+++ b/system/stack/bnep/bnep_utils.cc
@@ -415,7 +415,8 @@ 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) != L2CAP_DW_SUCCESS) {
+ if (L2CA_DataWrite(p_bcb->l2cap_cid, p_buf) !=
+ tL2CAP_DW_RESULT::L2CAP_DW_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 dfffe6a181..387e427f13 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 L2CAP_DW_SUCCESS;
+ return tL2CAP_DW_RESULT::L2CAP_DW_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 99edaa4d13..e7f396d71f 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 L2CAP_DW_SUCCESS;
+ return tL2CAP_DW_RESULT::L2CAP_DW_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 8691f7689b..63a086443d 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 L2CAP_DW_SUCCESS;
+ return tL2CAP_DW_RESULT::L2CAP_DW_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 L2CAP_DW_SUCCESS;
+ return tL2CAP_DW_RESULT::L2CAP_DW_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 8f7c2d3dcf..9a03b5b28f 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 L2CAP_DW_SUCCESS;
+ return tL2CAP_DW_RESULT::L2CAP_DW_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 7a80902a96..31e030c249 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 L2CAP_DW_SUCCESS;
+ return tL2CAP_DW_RESULT::L2CAP_DW_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 fe0164bde1..8e379c4c16 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 == L2CAP_DW_CONGESTED) {
+ if (status == tL2CAP_DW_RESULT::L2CAP_DW_CONGESTED) {
p_ccb->is_congested = true;
return true;
- } else if (status != L2CAP_DW_SUCCESS)
+ } else if (status != tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS)
return false;
}
return true;
diff --git a/system/stack/gatt/att_protocol.cc b/system/stack/gatt/att_protocol.cc
index 9fcb2c9b43..4294c149b7 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 == L2CAP_DW_FAILED) {
+ if (l2cap_ret == tL2CAP_DW_RESULT::L2CAP_DW_FAILED) {
log::error("failed to write data to L2CAP");
return GATT_INTERNAL_ERROR;
- } else if (l2cap_ret == L2CAP_DW_CONGESTED) {
+ } else if (l2cap_ret == tL2CAP_DW_RESULT::L2CAP_DW_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 c6debe12f1..95fce1df1e 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) !=
- L2CAP_DW_SUCCESS) {
+ tL2CAP_DW_RESULT::L2CAP_DW_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) == L2CAP_DW_FAILED) {
+ if (L2CA_DataWrite(cid, p_buf) == tL2CAP_DW_RESULT::L2CAP_DW_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 e3d90fe09c..3e8699be1b 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) == L2CAP_DW_FAILED)) {
+ (L2CA_DataWrite(cid, p_buf) == tL2CAP_DW_RESULT::L2CAP_DW_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 855d0d7da6..ed45627fba 100644
--- a/system/stack/include/l2c_api.h
+++ b/system/stack/include/l2c_api.h
@@ -52,11 +52,11 @@
#define L2CAP_FCS_LENGTH 2
/* result code for L2CA_DataWrite() */
-typedef enum : uint8_t {
+enum class tL2CAP_DW_RESULT : uint8_t {
L2CAP_DW_FAILED = 0,
L2CAP_DW_SUCCESS = 1,
L2CAP_DW_CONGESTED = 2,
-} tL2CAP_DW_RESULT;
+};
/* Values for priority parameter to L2CA_SetAclPriority */
typedef enum : uint8_t {
@@ -578,10 +578,11 @@ void L2CA_DeregisterLECoc(uint16_t psm);
*
* Description Higher layers call this function to write data.
*
- * Returns L2CAP_DW_SUCCESS, if data accepted, else false
- * L2CAP_DW_CONGESTED, if data accepted and the channel is
- * congested
- * L2CAP_DW_FAILED, if error
+ * Returns tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS, if data accepted, else
+ * false
+ * tL2CAP_DW_RESULT::L2CAP_DW_CONGESTED, if data accepted and
+ * the channel is congested
+ * tL2CAP_DW_RESULT::L2CAP_DW_FAILED, if error
*
******************************************************************************/
[[nodiscard]] tL2CAP_DW_RESULT L2CA_DataWrite(uint16_t cid, BT_HDR* p_data);
@@ -806,8 +807,8 @@ typedef struct {
* BD Address of remote
* Pointer to buffer of type BT_HDR
*
- * Return value L2CAP_DW_SUCCESS, if data accepted
- * L2CAP_DW_FAILED, if error
+ * Return value tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS, if data accepted
+ * tL2CAP_DW_RESULT::L2CAP_DW_FAILED, if error
*
******************************************************************************/
[[nodiscard]] tL2CAP_DW_RESULT L2CA_SendFixedChnlData(uint16_t fixed_cid,
diff --git a/system/stack/l2cap/l2c_api.cc b/system/stack/l2cap/l2c_api.cc
index f43c139c6a..0befad885c 100644
--- a/system/stack/l2cap/l2c_api.cc
+++ b/system/stack/l2cap/l2c_api.cc
@@ -1283,8 +1283,8 @@ bool L2CA_ConnectFixedChnl(uint16_t fixed_cid, const RawAddress& rem_bda) {
* BD Address of remote
* Pointer to buffer of type BT_HDR
*
- * Return value L2CAP_DW_SUCCESS, if data accepted
- * L2CAP_DW_FAILED, if error
+ * Return value tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS, if data accepted
+ * tL2CAP_DW_RESULT::L2CAP_DW_FAILED, if error
*
******************************************************************************/
tL2CAP_DW_RESULT L2CA_SendFixedChnlData(uint16_t fixed_cid,
@@ -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 (L2CAP_DW_FAILED);
+ return (tL2CAP_DW_RESULT::L2CAP_DW_FAILED);
}
if (!BTM_IsDeviceUp()) {
log::warn("Controller is not ready CID: 0x{:04x}", fixed_cid);
osi_free(p_buf);
- return (L2CAP_DW_FAILED);
+ return (tL2CAP_DW_RESULT::L2CAP_DW_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 (L2CAP_DW_FAILED);
+ return (tL2CAP_DW_RESULT::L2CAP_DW_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 (L2CAP_DW_FAILED);
+ return (tL2CAP_DW_RESULT::L2CAP_DW_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 (L2CAP_DW_FAILED);
+ return (tL2CAP_DW_RESULT::L2CAP_DW_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 (L2CAP_DW_FAILED);
+ return (tL2CAP_DW_RESULT::L2CAP_DW_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 (L2CAP_DW_CONGESTED);
+ return (tL2CAP_DW_RESULT::L2CAP_DW_CONGESTED);
}
- return (L2CAP_DW_SUCCESS);
+ return (tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS);
}
/*******************************************************************************
@@ -1496,10 +1496,11 @@ bool L2CA_MarkLeLinkAsActive(const RawAddress& rem_bda) {
*
* Description Higher layers call this function to write data.
*
- * Returns L2CAP_DW_SUCCESS, if data accepted, else false
- * L2CAP_DW_CONGESTED, if data accepted and the channel is
- * congested
- * L2CAP_DW_FAILED, if error
+ * Returns tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS, if data accepted, else
+ * false
+ * tL2CAP_DW_RESULT::L2CAP_DW_CONGESTED, if data accepted
+ * and the channel is congested
+ * tL2CAP_DW_RESULT::L2CAP_DW_FAILED, if error
*
******************************************************************************/
tL2CAP_DW_RESULT L2CA_DataWrite(uint16_t cid, BT_HDR* p_data) {
diff --git a/system/stack/l2cap/l2c_main.cc b/system/stack/l2cap/l2c_main.cc
index dd17a5f841..7fe9ec1931 100644
--- a/system/stack/l2cap/l2c_main.cc
+++ b/system/stack/l2cap/l2c_main.cc
@@ -900,10 +900,11 @@ void l2c_lcb_timer_timeout(void* data) {
*
* Description API functions call this function to write data.
*
- * Returns L2CAP_DW_SUCCESS, if data accepted, else false
- * L2CAP_DW_CONGESTED, if data accepted and the channel is
- * congested
- * L2CAP_DW_FAILED, if error
+ * Returns tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS, if data accepted,
+ * else false
+ * tL2CAP_DW_RESULT::L2CAP_DW_CONGESTED, if data accepted
+ * and the channel is congested
+ * tL2CAP_DW_RESULT::L2CAP_DW_FAILED, if error
*
******************************************************************************/
tL2CAP_DW_RESULT l2c_data_write(uint16_t cid, BT_HDR* p_data, uint16_t flags) {
@@ -912,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 (L2CAP_DW_FAILED);
+ return (tL2CAP_DW_RESULT::L2CAP_DW_FAILED);
}
/* Sending message bigger than mtu size of peer is a violation of protocol */
@@ -929,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 (L2CAP_DW_FAILED);
+ return (tL2CAP_DW_RESULT::L2CAP_DW_FAILED);
}
/* channel based, packet based flushable or non-flushable */
@@ -944,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 (L2CAP_DW_FAILED);
+ return (tL2CAP_DW_RESULT::L2CAP_DW_FAILED);
}
l2c_csm_execute(p_ccb, L2CEVT_L2CA_DATA_WRITE, p_data);
- if (p_ccb->cong_sent) return (L2CAP_DW_CONGESTED);
+ if (p_ccb->cong_sent) return (tL2CAP_DW_RESULT::L2CAP_DW_CONGESTED);
- return (L2CAP_DW_SUCCESS);
+ return (tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS);
}
diff --git a/system/stack/rfcomm/rfc_ts_frames.cc b/system/stack/rfcomm/rfc_ts_frames.cc
index dd20e82c0d..acc756c584 100644
--- a/system/stack/rfcomm/rfc_ts_frames.cc
+++ b/system/stack/rfcomm/rfc_ts_frames.cc
@@ -201,7 +201,8 @@ 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) != L2CAP_DW_SUCCESS) {
+ if (L2CA_DataWrite(p_mcb->lcid, p_buf) !=
+ tL2CAP_DW_RESULT::L2CAP_DW_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 ccb21a82cb..0a3214400f 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) != L2CAP_DW_SUCCESS) {
+ if (L2CA_DataWrite(p_mcb->lcid, p) != tL2CAP_DW_RESULT::L2CAP_DW_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 b1166290e7..11c8f389f5 100644
--- a/system/stack/sdp/sdp_discovery.cc
+++ b/system/stack/sdp/sdp_discovery.cc
@@ -177,7 +177,8 @@ static void sdp_snd_service_search_req(tCONN_CB* p_ccb, uint8_t cont_len,
/* Set the length of the SDP data in the buffer */
p_cmd->len = (uint16_t)(p - p_start);
- if (L2CA_DataWrite(p_ccb->connection_id, p_cmd) != L2CAP_DW_SUCCESS) {
+ if (L2CA_DataWrite(p_ccb->connection_id, p_cmd) !=
+ tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS) {
log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}",
p_ccb->device_address, p_ccb->connection_id, p_cmd->len);
}
@@ -687,7 +688,8 @@ static void process_service_search_attr_rsp(tCONN_CB* p_ccb, uint8_t* p_reply,
/* Set the length of the SDP data in the buffer */
p_msg->len = p - p_start;
- if (L2CA_DataWrite(p_ccb->connection_id, p_msg) != L2CAP_DW_SUCCESS) {
+ if (L2CA_DataWrite(p_ccb->connection_id, p_msg) !=
+ tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS) {
log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}",
p_ccb->device_address, p_ccb->connection_id, p_msg->len);
}
@@ -861,7 +863,8 @@ static void process_service_attr_rsp(tCONN_CB* p_ccb, uint8_t* p_reply,
/* Set the length of the SDP data in the buffer */
p_msg->len = (uint16_t)(p - p_start);
- if (L2CA_DataWrite(p_ccb->connection_id, p_msg) != L2CAP_DW_SUCCESS) {
+ if (L2CA_DataWrite(p_ccb->connection_id, p_msg) !=
+ tL2CAP_DW_RESULT::L2CAP_DW_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 0b2012e57c..3902991645 100644
--- a/system/stack/sdp/sdp_server.cc
+++ b/system/stack/sdp/sdp_server.cc
@@ -303,7 +303,8 @@ static void process_service_search(tCONN_CB* p_ccb, uint16_t trans_num,
p_buf->len = p_rsp - p_rsp_start;
/* Send the buffer through L2CAP */
- if (L2CA_DataWrite(p_ccb->connection_id, p_buf) != L2CAP_DW_SUCCESS) {
+ if (L2CA_DataWrite(p_ccb->connection_id, p_buf) !=
+ tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS) {
log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}",
p_ccb->device_address, p_ccb->connection_id, p_buf->len);
}
@@ -701,7 +702,8 @@ static void process_service_attr_req(tCONN_CB* p_ccb, uint16_t trans_num,
p_buf->len = p_rsp - p_rsp_start;
/* Send the buffer through L2CAP */
- if (L2CA_DataWrite(p_ccb->connection_id, p_buf) != L2CAP_DW_SUCCESS) {
+ if (L2CA_DataWrite(p_ccb->connection_id, p_buf) !=
+ tL2CAP_DW_RESULT::L2CAP_DW_SUCCESS) {
log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}",
p_ccb->device_address, p_ccb->connection_id, p_buf->len);
}
@@ -1179,7 +1181,8 @@ static void process_service_search_attr_req(tCONN_CB* p_ccb, uint16_t trans_num,
p_buf->len = p_rsp - p_rsp_start;
/* Send the buffer through L2CAP */
- if (L2CA_DataWrite(p_ccb->connection_id, p_buf) != L2CAP_DW_SUCCESS) {
+ if (L2CA_DataWrite(p_ccb->connection_id, p_buf) !=
+ tL2CAP_DW_RESULT::L2CAP_DW_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 a9b1d29ad8..d22148f7f7 100644
--- a/system/stack/sdp/sdp_utils.cc
+++ b/system/stack/sdp/sdp_utils.cc
@@ -739,7 +739,8 @@ void sdpu_build_n_send_error(tCONN_CB* p_ccb, uint16_t trans_num,
p_buf->len = p_rsp - p_rsp_start;
/* Send the buffer through L2CAP */
- if (L2CA_DataWrite(p_ccb->connection_id, p_buf) != L2CAP_DW_SUCCESS) {
+ if (L2CA_DataWrite(p_ccb->connection_id, p_buf) !=
+ tL2CAP_DW_RESULT::L2CAP_DW_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 60cd2310dc..eb586f32ff 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 == L2CAP_DW_FAILED) {
+ if (l2cap_ret == tL2CAP_DW_RESULT::L2CAP_DW_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 == L2CAP_DW_FAILED) {
+ if (l2cap_ret == tL2CAP_DW_RESULT::L2CAP_DW_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 a0c417605c..0a54a2f599 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(L2CAP_DW_SUCCESS));
+ .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_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(L2CAP_DW_SUCCESS));
+ .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_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(L2CAP_DW_SUCCESS));
+ .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_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(L2CAP_DW_SUCCESS));
+ .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_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(L2CAP_DW_SUCCESS));
+ .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_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(L2CAP_DW_SUCCESS));
+ .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_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(L2CAP_DW_SUCCESS));
+ .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_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(L2CAP_DW_SUCCESS));
+ .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_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(L2CAP_DW_SUCCESS));
+ .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_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(L2CAP_DW_SUCCESS));
+ .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_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(L2CAP_DW_SUCCESS));
+ .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_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(L2CAP_DW_SUCCESS));
+ .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_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(L2CAP_DW_SUCCESS));
+ .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_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(L2CAP_DW_SUCCESS));
+ .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_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(L2CAP_DW_SUCCESS));
+ .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_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(L2CAP_DW_SUCCESS));
+ .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_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(L2CAP_DW_SUCCESS));
+ .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_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(L2CAP_DW_SUCCESS));
+ .WillOnce(Return(tL2CAP_DW_RESULT::L2CAP_DW_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 0d5f339d9d..5822a59671 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 L2CAP_DW_FAILED;
+ return tL2CAP_DW_RESULT::L2CAP_DW_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 aa3db3c9eb..ffbf325b8e 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 L2CAP_DW_FAILED;
+ return tL2CAP_DW_RESULT::L2CAP_DW_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 21ddc87fd3..db1c224f96 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 L2CAP_DW_FAILED;
+ return tL2CAP_DW_RESULT::L2CAP_DW_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 f4249ef244..c383e83c15 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 L2CAP_DW_FAILED;
+ return tL2CAP_DW_RESULT::L2CAP_DW_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 L2CAP_DW_FAILED;
+ return tL2CAP_DW_RESULT::L2CAP_DW_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 L2CAP_DW_FAILED;
+ return tL2CAP_DW_RESULT::L2CAP_DW_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 68729ad4de..98cb699ee5 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 L2CAP_DW_FAILED;
+ return tL2CAP_DW_RESULT::L2CAP_DW_FAILED;
}
void l2c_ccb_timer_timeout(void* /* data */) { inc_func_call_count(__func__); }
void l2c_fcrb_ack_timer_timeout(void* /* data */) {