summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Chris Manton <cmanton@google.com> 2024-07-05 10:40:34 -0700
committer Chris Manton <cmanton@google.com> 2024-08-09 17:56:57 +0000
commit69fe17309810b18f66f443265d9f723a0c9be600 (patch)
tree82a41a11d9549f2166cae8c60bbb1a0d5da0d165
parent551dc422f01f75ca8d45e866248e296d0270dbf5 (diff)
[1/24] Canonical form towards class enumification tBTM_STATUS
Prepare for class enum-ify tBTM_STATUS Bug: 358402071 Test: m . Flag: EXEMPT, Mechanical Refactor Change-Id: Ia2b5b36c696476db8d4fefd59b83714e8d4b1d8b
-rw-r--r--system/bta/ag/bta_ag_sco.cc9
-rw-r--r--system/bta/av/bta_av_aact.cc5
-rw-r--r--system/bta/av/bta_av_main.cc6
-rw-r--r--system/bta/csis/csis_client.cc5
-rw-r--r--system/bta/dm/bta_dm_act.cc34
-rw-r--r--system/bta/dm/bta_dm_device_search.cc3
-rw-r--r--system/bta/dm/bta_dm_disc_legacy.cc5
-rw-r--r--system/bta/dm/bta_dm_pm.cc18
-rw-r--r--system/bta/dm/bta_dm_sec.cc37
-rw-r--r--system/bta/dm/bta_dm_sec_api.cc3
-rw-r--r--system/bta/has/has_client_test.cc6
-rw-r--r--system/bta/hearing_aid/hearing_aid.cc8
-rw-r--r--system/bta/hf_client/bta_hf_client_sco.cc7
-rw-r--r--system/bta/hh/bta_hh_le.cc3
-rw-r--r--system/bta/hh/bta_hh_utils.cc3
-rw-r--r--system/bta/le_audio/client.cc6
-rw-r--r--system/bta/le_audio/le_audio_client_test.cc3
-rw-r--r--system/bta/sys/utl.cc4
-rw-r--r--system/bta/test/bta_ag_test.cc5
-rw-r--r--system/bta/test/bta_dm_test.cc10
-rw-r--r--system/bta/test/bta_sec_test.cc4
-rw-r--r--system/bta/test/bta_test_fixtures.h3
-rw-r--r--system/bta/vc/vc.cc7
-rw-r--r--system/bta/vc/vc_test.cc8
-rw-r--r--system/btif/src/bluetooth.cc4
-rw-r--r--system/btif/src/btif_a2dp_source.cc7
-rw-r--r--system/btif/src/btif_sock_sco.cc20
-rw-r--r--system/main/shim/btm_api.cc21
-rw-r--r--system/main/shim/le_scanning_manager.cc14
-rw-r--r--system/osi/src/stack_power_telemetry.cc2
-rw-r--r--system/osi/test/stack_power_telemetry_test.cc5
-rw-r--r--system/stack/acl/btm_acl.cc25
-rw-r--r--system/stack/acl/btm_pm.cc18
-rw-r--r--system/stack/avdt/avdt_l2c.cc5
-rw-r--r--system/stack/btm/btm_ble.cc5
-rw-r--r--system/stack/btm/btm_ble_adv_filter.cc4
-rw-r--r--system/stack/btm/btm_ble_gap.cc23
-rw-r--r--system/stack/btm/btm_ble_sec.cc58
-rw-r--r--system/stack/btm/btm_devctl.cc23
-rw-r--r--system/stack/btm/btm_inq.cc25
-rw-r--r--system/stack/btm/btm_sco.cc15
-rw-r--r--system/stack/btm/btm_sec.cc98
-rw-r--r--system/stack/btm/btm_sec.h12
-rw-r--r--system/stack/btm/power_mode.h6
-rw-r--r--system/stack/btu/btu_hcif.cc5
-rw-r--r--system/stack/fuzzers/smp_fuzzer.cc3
-rw-r--r--system/stack/gap/gap_ble.cc5
-rw-r--r--system/stack/gatt/gatt_auth.cc5
-rw-r--r--system/stack/include/acl_api.h6
-rw-r--r--system/stack/include/btm_api.h14
-rw-r--r--system/stack/include/btm_ble_api.h6
-rw-r--r--system/stack/include/btm_ble_sec_api.h4
-rw-r--r--system/stack/include/btm_inq.h6
-rw-r--r--system/stack/include/btm_sec_api.h2
-rw-r--r--system/stack/include/l2cap_security_interface.h2
-rw-r--r--system/stack/l2cap/l2c_ble.cc9
-rw-r--r--system/stack/l2cap/l2c_link.cc17
-rw-r--r--system/stack/l2cap/l2c_utils.cc3
-rw-r--r--system/stack/rfcomm/rfc_port_fsm.cc5
-rw-r--r--system/stack/smp/smp_act.cc5
-rw-r--r--system/stack/test/btm/stack_btm_inq_test.cc7
-rw-r--r--system/stack/test/btm/stack_btm_power_mode_test.cc26
-rw-r--r--system/stack/test/rfcomm/stack_rfcomm_test.cc15
-rw-r--r--system/test/headless/read/name.cc3
-rw-r--r--system/test/headless/utils/power_mode_client.h4
-rw-r--r--system/test/mock/mock_main_shim_btm_api.cc24
-rw-r--r--system/test/mock/mock_stack_acl.h14
-rw-r--r--system/test/mock/mock_stack_btm_ble.cc8
-rw-r--r--system/test/mock/mock_stack_btm_ble_gap.cc9
-rw-r--r--system/test/mock/mock_stack_btm_ble_privacy.h3
-rw-r--r--system/test/mock/mock_stack_btm_devctl.cc4
-rw-r--r--system/test/mock/mock_stack_btm_inq.cc9
-rw-r--r--system/test/mock/mock_stack_btm_interface.cc76
-rw-r--r--system/test/mock/mock_stack_btm_sco.cc2
-rw-r--r--system/test/mock/mock_stack_btm_sec.cc16
-rw-r--r--system/test/mock/mock_stack_l2cap_link.cc3
76 files changed, 494 insertions, 418 deletions
diff --git a/system/bta/ag/bta_ag_sco.cc b/system/bta/ag/bta_ag_sco.cc
index befa8aaf1f..34e197c49c 100644
--- a/system/bta/ag/bta_ag_sco.cc
+++ b/system/bta/ag/bta_ag_sco.cc
@@ -41,6 +41,7 @@
#include "stack/btm/btm_sco_hfp_hal.h"
#include "stack/include/btm_api.h"
#include "stack/include/btm_client_interface.h"
+#include "stack/include/btm_status.h"
#include "stack/include/main_thread.h"
#include "types/raw_address.h"
@@ -173,7 +174,7 @@ static void bta_ag_sco_conn_cback(uint16_t sco_idx) {
/* no match found; disconnect sco, init sco variables */
bta_ag_cb.sco.p_curr_scb = nullptr;
bta_ag_cb.sco.state = BTA_AG_SCO_SHUTDOWN_ST;
- if (get_btm_client_interface().sco.BTM_RemoveSco(sco_idx) != BTM_SUCCESS) {
+ if (get_btm_client_interface().sco.BTM_RemoveSco(sco_idx) != tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to remove SCO idx:{}", sco_idx);
}
}
@@ -324,7 +325,7 @@ static bool bta_ag_remove_sco(tBTA_AG_SCB* p_scb, bool only_active) {
/* SCO is connected; set current control block */
bta_ag_cb.sco.p_curr_scb = p_scb;
return true;
- } else if ((status == BTM_SUCCESS) || (status == BTM_UNKNOWN_ADDR)) {
+ } else if ((status == tBTM_STATUS::BTM_SUCCESS) || (status == BTM_UNKNOWN_ADDR)) {
/* If no connection reset the SCO handle */
p_scb->sco_idx = BTM_INVALID_SCO_INDEX;
}
@@ -529,7 +530,7 @@ void bta_ag_create_sco(tBTA_AG_SCB* p_scb, bool is_orig) {
if (is_orig) {
bta_ag_cb.sco.is_local = true;
/* Set eSCO Mode */
- if (get_btm_client_interface().sco.BTM_SetEScoMode(&params) != BTM_SUCCESS) {
+ if (get_btm_client_interface().sco.BTM_SetEScoMode(&params) != tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to set ESCO mode");
}
bta_ag_cb.sco.p_curr_scb = p_scb;
@@ -571,7 +572,7 @@ void bta_ag_create_sco(tBTA_AG_SCB* p_scb, bool is_orig) {
bta_ag_sco_disc_cback);
if (btm_status == BTM_CMD_STARTED) {
if (get_btm_client_interface().sco.BTM_RegForEScoEvts(
- p_scb->sco_idx, bta_ag_esco_connreq_cback) != BTM_SUCCESS) {
+ p_scb->sco_idx, bta_ag_esco_connreq_cback) != tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to register for ESCO events");
}
}
diff --git a/system/bta/av/bta_av_aact.cc b/system/bta/av/bta_av_aact.cc
index 748a8f55c5..5a53e08852 100644
--- a/system/bta/av/bta_av_aact.cc
+++ b/system/bta/av/bta_av_aact.cc
@@ -55,6 +55,7 @@
#include "stack/include/bt_uuid16.h"
#include "stack/include/btm_client_interface.h"
#include "stack/include/btm_log_history.h"
+#include "stack/include/btm_status.h"
#include "stack/include/l2c_api.h"
#include "storage/config_keys.h"
#include "types/hci_role.h"
@@ -1867,7 +1868,7 @@ void bta_av_do_start(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {
* disable sniff mode unconditionally during streaming */
tHCI_ROLE cur_role;
if ((get_btm_client_interface().link_policy.BTM_GetRole(p_scb->PeerAddress(), &cur_role) ==
- BTM_SUCCESS) &&
+ tBTM_STATUS::BTM_SUCCESS) &&
(cur_role == HCI_ROLE_CENTRAL)) {
BTM_block_role_switch_and_sniff_mode_for(p_scb->PeerAddress());
} else {
@@ -2339,7 +2340,7 @@ void bta_av_start_ok(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {
* central.
* disable sniff mode unconditionally during streaming */
if ((get_btm_client_interface().link_policy.BTM_GetRole(p_scb->PeerAddress(), &cur_role) ==
- BTM_SUCCESS) &&
+ tBTM_STATUS::BTM_SUCCESS) &&
(cur_role == HCI_ROLE_CENTRAL)) {
BTM_block_role_switch_and_sniff_mode_for(p_scb->PeerAddress());
} else {
diff --git a/system/bta/av/bta_av_main.cc b/system/bta/av/bta_av_main.cc
index ef6aea40ba..6b8bd2827c 100644
--- a/system/bta/av/bta_av_main.cc
+++ b/system/bta/av/bta_av_main.cc
@@ -44,6 +44,7 @@
#include "stack/include/bt_hdr.h"
#include "stack/include/bt_uuid16.h"
#include "stack/include/btm_client_interface.h"
+#include "stack/include/btm_status.h"
#include "stack/include/hci_error_code.h"
#include "stack/include/sdp_api.h"
#include "storage/config_keys.h"
@@ -921,7 +922,8 @@ static void bta_av_sys_rs_cback(tBTA_SYS_CONN_STATUS /* status */, tHCI_ROLE new
/* restore role switch policy, if role switch failed */
if ((HCI_SUCCESS != hci_status) &&
- (get_btm_client_interface().link_policy.BTM_GetRole(peer_addr, &cur_role) == BTM_SUCCESS) &&
+ (get_btm_client_interface().link_policy.BTM_GetRole(peer_addr, &cur_role) ==
+ tBTM_STATUS::BTM_SUCCESS) &&
(cur_role == HCI_ROLE_PERIPHERAL)) {
get_btm_client_interface().link_policy.BTM_unblock_role_switch_for(peer_addr);
}
@@ -1079,7 +1081,7 @@ bool bta_av_switch_if_needed(tBTA_AV_SCB* p_scb) {
bool bta_av_link_role_ok(tBTA_AV_SCB* p_scb, uint8_t bits) {
tHCI_ROLE role;
if (get_btm_client_interface().link_policy.BTM_GetRole(p_scb->PeerAddress(), &role) !=
- BTM_SUCCESS) {
+ tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to find link role for device:{}", p_scb->PeerAddress());
return true;
}
diff --git a/system/bta/csis/csis_client.cc b/system/bta/csis/csis_client.cc
index 122c9ac29c..546f340817 100644
--- a/system/bta/csis/csis_client.cc
+++ b/system/bta/csis/csis_client.cc
@@ -50,6 +50,7 @@
#include "stack/include/bt_types.h"
#include "stack/include/btm_ble_sec_api.h"
#include "stack/include/btm_client_interface.h"
+#include "stack/include/btm_status.h"
using base::Closure;
using bluetooth::Uuid;
@@ -1845,7 +1846,7 @@ private:
case BTA_GATTC_ENC_CMPL_CB_EVT: {
tBTM_STATUS encryption_status;
if (BTM_IsEncrypted(p_data->enc_cmpl.remote_bda, BT_TRANSPORT_LE)) {
- encryption_status = BTM_SUCCESS;
+ encryption_status = tBTM_STATUS::BTM_SUCCESS;
} else {
encryption_status = BTM_FAILED_ON_SECURITY;
}
@@ -2056,7 +2057,7 @@ private:
return;
}
- if (status != BTM_SUCCESS) {
+ if (status != tBTM_STATUS::BTM_SUCCESS) {
log::error("encryption failed. status: 0x{:02x}", status);
BTA_GATTC_Close(device->conn_id);
diff --git a/system/bta/dm/bta_dm_act.cc b/system/bta/dm/bta_dm_act.cc
index 8b9bd8672a..9f9abcc7c7 100644
--- a/system/bta/dm/bta_dm_act.cc
+++ b/system/bta/dm/bta_dm_act.cc
@@ -59,6 +59,7 @@
#include "stack/include/bt_uuid16.h"
#include "stack/include/btm_client_interface.h"
#include "stack/include/btm_inq.h"
+#include "stack/include/btm_status.h"
#include "stack/include/gatt_api.h"
#include "stack/include/l2c_api.h"
#include "stack/include/main_thread.h"
@@ -235,7 +236,7 @@ void BTA_dm_on_hw_on() {
log::info("Read default class of device [0x{:x}, 0x{:x}, 0x{:x}]", dev_class[0], dev_class[1],
dev_class[2]);
- if (get_btm_client_interface().local.BTM_SetDeviceClass(dev_class) != BTM_SUCCESS) {
+ if (get_btm_client_interface().local.BTM_SetDeviceClass(dev_class) != tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to set local device class:{}", dev_class_text(dev_class));
}
@@ -314,10 +315,10 @@ void bta_dm_disable() {
/* disable all active subsystems */
bta_sys_disable();
- if (BTM_SetDiscoverability(BTM_NON_DISCOVERABLE) != BTM_SUCCESS) {
+ if (BTM_SetDiscoverability(BTM_NON_DISCOVERABLE) != tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to disable classic BR/EDR discoverability");
}
- if (BTM_SetConnectability(BTM_NON_CONNECTABLE) != BTM_SUCCESS) {
+ if (BTM_SetConnectability(BTM_NON_CONNECTABLE) != tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to disable classic BR/EDR connectability");
}
@@ -448,10 +449,10 @@ bool BTA_DmSetVisibility(bt_scan_mode_t mode) {
return false;
}
- if (BTM_SetDiscoverability(disc_mode_param) != BTM_SUCCESS) {
+ if (BTM_SetDiscoverability(disc_mode_param) != tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to set classic BR/EDR discoverability 0x{:04x}", disc_mode_param);
}
- if (BTM_SetConnectability(conn_mode_param) != BTM_SUCCESS) {
+ if (BTM_SetConnectability(conn_mode_param) != tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to set classic BR/EDR connectability 0x{:04x}", conn_mode_param);
}
return true;
@@ -609,11 +610,11 @@ void bta_dm_remove_device(const RawAddress& target) {
// Disconnect LE transport
if (le_connected) {
tBTM_STATUS status = btm_remove_acl(pseudo_addr, BT_TRANSPORT_LE);
- if (status != BTM_SUCCESS && identity_addr != pseudo_addr) {
+ if (status != tBTM_STATUS::BTM_SUCCESS && identity_addr != pseudo_addr) {
status = btm_remove_acl(identity_addr, BT_TRANSPORT_LE);
}
- if (status != BTM_SUCCESS) {
+ if (status != tBTM_STATUS::BTM_SUCCESS) {
le_connected = false;
log::error("Unable to disconnect LE connection {}", pseudo_addr);
}
@@ -622,11 +623,11 @@ void bta_dm_remove_device(const RawAddress& target) {
// Disconnect BR/EDR transport
if (bredr_connected) {
tBTM_STATUS status = btm_remove_acl(identity_addr, BT_TRANSPORT_BR_EDR);
- if (status != BTM_SUCCESS && identity_addr != pseudo_addr) {
+ if (status != tBTM_STATUS::BTM_SUCCESS && identity_addr != pseudo_addr) {
status = btm_remove_acl(pseudo_addr, BT_TRANSPORT_BR_EDR);
}
- if (status != BTM_SUCCESS) {
+ if (status != tBTM_STATUS::BTM_SUCCESS) {
bredr_connected = false;
log::error("Unable to disconnect BR/EDR connection {}", identity_addr);
}
@@ -721,7 +722,7 @@ static void handle_role_change(const RawAddress& bd_addr, tHCI_ROLE new_role,
const tBTM_STATUS status =
get_btm_client_interface().link_policy.BTM_SwitchRoleToCentral(bd_addr);
switch (status) {
- case BTM_SUCCESS:
+ case tBTM_STATUS::BTM_SUCCESS:
log::debug("Role policy already set to central peer:{}", bd_addr);
break;
case BTM_CMD_STARTED:
@@ -1022,7 +1023,7 @@ static void bta_dm_check_av() {
const tBTM_STATUS status =
get_btm_client_interface().link_policy.BTM_SwitchRoleToCentral(p_dev->peer_bdaddr);
switch (status) {
- case BTM_SUCCESS:
+ case tBTM_STATUS::BTM_SUCCESS:
log::debug("Role policy already set to central peer:{}", p_dev->peer_bdaddr);
break;
case BTM_CMD_STARTED:
@@ -1175,7 +1176,7 @@ static void bta_dm_adjust_roles(bool delay_role_switch) {
get_btm_client_interface().link_policy.BTM_SwitchRoleToCentral(
bta_dm_cb.device_list.peer_device[i].peer_bdaddr);
switch (status) {
- case BTM_SUCCESS:
+ case tBTM_STATUS::BTM_SUCCESS:
log::debug("Role policy already set to central peer:{}",
bta_dm_cb.device_list.peer_device[i].peer_bdaddr);
break;
@@ -1257,7 +1258,7 @@ static void bta_dm_set_eir(char* local_name) {
/* if local name is not provided, get it from controller */
if (local_name == NULL) {
if (get_btm_client_interface().local.BTM_ReadLocalDeviceName((const char**)&local_name) !=
- BTM_SUCCESS) {
+ tBTM_STATUS::BTM_SUCCESS) {
log::error("Fail to read local device name for EIR");
}
}
@@ -1441,7 +1442,7 @@ static void bta_dm_set_eir(char* local_name) {
UINT8_TO_STREAM(p, 0); /* terminator of significant part */
}
- if (get_btm_client_interface().eir.BTM_WriteEIR(p_buf) != BTM_SUCCESS) {
+ if (get_btm_client_interface().eir.BTM_WriteEIR(p_buf) != tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to write EIR data");
}
}
@@ -1603,7 +1604,8 @@ void bta_dm_ble_set_data_length(const RawAddress& bd_addr) {
uint16_t max_len =
bluetooth::shim::GetController()->GetLeMaximumDataLength().supported_max_tx_octets_;
- if (get_btm_client_interface().ble.BTM_SetBleDataLength(bd_addr, max_len) != BTM_SUCCESS) {
+ if (get_btm_client_interface().ble.BTM_SetBleDataLength(bd_addr, max_len) !=
+ tBTM_STATUS::BTM_SUCCESS) {
log::info("Unable to set ble data length:{}", max_len);
}
}
@@ -1795,7 +1797,7 @@ void bta_dm_allow_wake_by_hid(std::vector<RawAddress> classic_hid_devices,
// If there are any entries in the classic hid list, we should also make
// the adapter connectable for classic.
if (classic_hid_devices.size() > 0) {
- if (BTM_SetConnectability(BTM_CONNECTABLE) != BTM_SUCCESS) {
+ if (BTM_SetConnectability(BTM_CONNECTABLE) != tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to enable classic BR/EDR connectability");
}
}
diff --git a/system/bta/dm/bta_dm_device_search.cc b/system/bta/dm/bta_dm_device_search.cc
index d4dbe0a5a9..0ef67e0f98 100644
--- a/system/bta/dm/bta_dm_device_search.cc
+++ b/system/bta/dm/bta_dm_device_search.cc
@@ -43,6 +43,7 @@
#include "stack/include/btm_client_interface.h"
#include "stack/include/btm_inq.h"
#include "stack/include/btm_log_history.h"
+#include "stack/include/btm_status.h"
#include "stack/include/main_thread.h"
#include "stack/rnr/remote_name_request.h"
#include "types/raw_address.h"
@@ -107,7 +108,7 @@ void bta_dm_disc_disable_search() {
*
******************************************************************************/
static void bta_dm_search_start(tBTA_DM_API_SEARCH& search) {
- if (get_btm_client_interface().db.BTM_ClearInqDb(nullptr) != BTM_SUCCESS) {
+ if (get_btm_client_interface().db.BTM_ClearInqDb(nullptr) != tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to clear inquiry database for device discovery");
}
/* save search params */
diff --git a/system/bta/dm/bta_dm_disc_legacy.cc b/system/bta/dm/bta_dm_disc_legacy.cc
index e088897e47..5b5d33a8d5 100644
--- a/system/bta/dm/bta_dm_disc_legacy.cc
+++ b/system/bta/dm/bta_dm_disc_legacy.cc
@@ -50,6 +50,7 @@
#include "stack/include/btm_client_interface.h"
#include "stack/include/btm_inq.h"
#include "stack/include/btm_log_history.h"
+#include "stack/include/btm_status.h"
#include "stack/include/gap_api.h" // GAP_BleReadPeerPrefConnParams
#include "stack/include/hidh_api.h"
#include "stack/include/main_thread.h"
@@ -264,7 +265,7 @@ static tBTA_DM_STATE bta_dm_search_get_state() { return bta_dm_search_cb.state;
static void bta_dm_search_start(tBTA_DM_API_SEARCH& search) {
bta_dm_gattc_register();
- if (get_btm_client_interface().db.BTM_ClearInqDb(nullptr) != BTM_SUCCESS) {
+ if (get_btm_client_interface().db.BTM_ClearInqDb(nullptr) != tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to clear inquiry db for device discovery");
}
@@ -1380,7 +1381,7 @@ static void bta_dm_service_search_remname_cback(const RawAddress& bd_addr, DEV_C
if (bta_dm_search_cb.peer_bdaddr == bd_addr) {
rem_name.bd_addr = bd_addr;
bd_name_copy(rem_name.remote_bd_name, bd_name);
- rem_name.status = BTM_SUCCESS;
+ rem_name.status = tBTM_STATUS::BTM_SUCCESS;
rem_name.hci_status = HCI_SUCCESS;
bta_dm_remname_cback(&rem_name);
} else {
diff --git a/system/bta/dm/bta_dm_pm.cc b/system/bta/dm/bta_dm_pm.cc
index 90c0225eda..487785da13 100644
--- a/system/bta/dm/bta_dm_pm.cc
+++ b/system/bta/dm/bta_dm_pm.cc
@@ -43,6 +43,7 @@
#include "osi/include/properties.h"
#include "stack/include/acl_api.h"
#include "stack/include/btm_client_interface.h"
+#include "stack/include/btm_status.h"
#include "stack/include/main_thread.h"
#include "types/raw_address.h"
@@ -99,7 +100,8 @@ void bta_dm_init_pm(void) {
bta_sys_sniff_register(bta_dm_sniff_cback);
if (get_btm_client_interface().lifecycle.BTM_PmRegister((BTM_PM_REG_SET), &bta_dm_cb.pm_id,
- bta_dm_pm_btm_cback) != BTM_SUCCESS) {
+ bta_dm_pm_btm_cback) !=
+ tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to initialize BTM power manager");
};
}
@@ -123,8 +125,8 @@ void bta_dm_init_pm(void) {
*
******************************************************************************/
void bta_dm_disable_pm(void) {
- if (get_btm_client_interface().lifecycle.BTM_PmRegister(BTM_PM_DEREG, &bta_dm_cb.pm_id,
- bta_dm_pm_btm_cback) != BTM_SUCCESS) {
+ if (get_btm_client_interface().lifecycle.BTM_PmRegister(
+ BTM_PM_DEREG, &bta_dm_cb.pm_id, bta_dm_pm_btm_cback) != tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to terminate BTM power manager");
}
@@ -552,7 +554,7 @@ static void bta_dm_pm_cback(tBTA_SYS_CONN_STATUS status, const tBTA_SYS_ID id, u
if (status == BTA_SYS_SCO_OPEN) {
log::verbose("SCO inactive, reset SSR to zero");
if (get_btm_client_interface().link_policy.BTM_SetSsrParams(peer_addr, 0, 0, 0) !=
- BTM_SUCCESS) {
+ tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to set link into sniff mode peer:{}", peer_addr);
}
} else if (status == BTA_SYS_SCO_CLOSE) {
@@ -867,8 +869,8 @@ static void bta_dm_pm_sniff(tBTA_DM_PEER_DEVICE* p_peer_dev, uint8_t index) {
if (status == BTM_CMD_STORED || status == BTM_CMD_STARTED) {
p_peer_dev->reset_sniff_flags();
p_peer_dev->set_sniff_command_sent();
- } else if (status == BTM_SUCCESS) {
- log::verbose("bta_dm_pm_sniff BTM_SetPowerMode() returns BTM_SUCCESS");
+ } else if (status == tBTM_STATUS::BTM_SUCCESS) {
+ log::verbose("bta_dm_pm_sniff BTM_SetPowerMode() returns tBTM_STATUS::BTM_SUCCESS");
p_peer_dev->reset_sniff_flags();
} else {
log::error("Unable to set power mode peer:{} status:{}", p_peer_dev->peer_bdaddr,
@@ -954,7 +956,7 @@ static void bta_dm_pm_ssr(const RawAddress& peer_addr, const int ssr) {
/* set the SSR parameters. */
if (get_btm_client_interface().link_policy.BTM_SetSsrParams(
peer_addr, p_spec->max_lat, p_spec->min_rmt_to, p_spec->min_loc_to) !=
- BTM_SUCCESS) {
+ tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to set link into sniff mode peer:{}", peer_addr);
}
}
@@ -984,7 +986,7 @@ void bta_dm_pm_active(const RawAddress& peer_addr) {
case BTM_CMD_STARTED:
log::debug("Active power mode started for remote:{}", peer_addr);
break;
- case BTM_SUCCESS:
+ case tBTM_STATUS::BTM_SUCCESS:
log::debug("Active power mode already set for device:{}", peer_addr);
break;
default:
diff --git a/system/bta/dm/bta_dm_sec.cc b/system/bta/dm/bta_dm_sec.cc
index 52d383fb8b..e943907e43 100644
--- a/system/bta/dm/bta_dm_sec.cc
+++ b/system/bta/dm/bta_dm_sec.cc
@@ -80,7 +80,7 @@ void bta_dm_ble_sirk_sec_cb_register(tBTA_DM_SEC_CBACK* p_cback) {
void bta_dm_ble_sirk_confirm_device_reply(const RawAddress& bd_addr, bool accept) {
log::debug("addr:{}", bd_addr);
get_btm_client_interface().security.BTM_BleSirkConfirmDeviceReply(
- bd_addr, accept ? BTM_SUCCESS : BTM_NOT_AUTHORIZED);
+ bd_addr, accept ? tBTM_STATUS::BTM_SUCCESS : BTM_NOT_AUTHORIZED);
}
void bta_dm_consolidate(const RawAddress& identity_addr, const RawAddress& rpa) {
@@ -136,7 +136,7 @@ void bta_dm_bond(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type, tBT_TRANSP
sec_event.auth_cmpl.success = false;
*/
sec_event.auth_cmpl.fail_reason = HCI_ERR_ILLEGAL_COMMAND;
- if (status == BTM_SUCCESS) {
+ if (status == tBTM_STATUS::BTM_SUCCESS) {
sec_event.auth_cmpl.success = true;
} else {
/* delete this device entry from Sec Dev DB */
@@ -155,7 +155,8 @@ void bta_dm_bond_cancel(const RawAddress& bd_addr) {
status = get_btm_client_interface().security.BTM_SecBondCancel(bd_addr);
- if (bta_dm_sec_cb.p_sec_cback && (status != BTM_CMD_STARTED && status != BTM_SUCCESS)) {
+ if (bta_dm_sec_cb.p_sec_cback &&
+ (status != BTM_CMD_STARTED && status != tBTM_STATUS::BTM_SUCCESS)) {
sec_event.bond_cancel_cmpl.result = BTA_FAILURE;
bta_dm_sec_cb.p_sec_cback(BTA_DM_BOND_CANCEL_CMPL_EVT, &sec_event);
@@ -165,8 +166,8 @@ void bta_dm_bond_cancel(const RawAddress& bd_addr) {
/** Send the pin_reply to a request from BTM */
void bta_dm_pin_reply(std::unique_ptr<tBTA_DM_API_PIN_REPLY> msg) {
if (msg->accept) {
- get_btm_client_interface().security.BTM_PINCodeReply(msg->bd_addr, BTM_SUCCESS, msg->pin_len,
- msg->p_pin);
+ get_btm_client_interface().security.BTM_PINCodeReply(msg->bd_addr, tBTM_STATUS::BTM_SUCCESS,
+ msg->pin_len, msg->p_pin);
} else {
get_btm_client_interface().security.BTM_PINCodeReply(msg->bd_addr, BTM_NOT_AUTHORIZED, 0, NULL);
}
@@ -175,13 +176,14 @@ void bta_dm_pin_reply(std::unique_ptr<tBTA_DM_API_PIN_REPLY> msg) {
/** Send the user confirm request reply in response to a request from BTM */
void bta_dm_confirm(const RawAddress& bd_addr, bool accept) {
get_btm_client_interface().security.BTM_SecConfirmReqReply(
- accept ? BTM_SUCCESS : BTM_NOT_AUTHORIZED, BT_TRANSPORT_BR_EDR, bd_addr);
+ accept ? tBTM_STATUS::BTM_SUCCESS : BTM_NOT_AUTHORIZED, BT_TRANSPORT_BR_EDR, bd_addr);
}
/** respond to the OOB data request for the remote device from BTM */
void bta_dm_ci_rmt_oob_act(std::unique_ptr<tBTA_DM_CI_RMT_OOB> msg) {
get_btm_client_interface().security.BTM_RemoteOobDataReply(
- msg->accept ? BTM_SUCCESS : BTM_NOT_AUTHORIZED, msg->bd_addr, msg->c, msg->r);
+ msg->accept ? tBTM_STATUS::BTM_SUCCESS : BTM_NOT_AUTHORIZED, msg->bd_addr, msg->c,
+ msg->r);
}
/*******************************************************************************
@@ -204,7 +206,7 @@ static void bta_dm_pinname_cback(const tBTM_REMOTE_DEV_NAME* p_data) {
sec_event.cfm_req.dev_class = bta_dm_sec_cb.pin_dev_class;
log::info("CoD: sec_event.cfm_req.dev_class = {}", dev_class_text(sec_event.cfm_req.dev_class));
- if (p_result && p_result->status == BTM_SUCCESS) {
+ if (p_result && p_result->status == tBTM_STATUS::BTM_SUCCESS) {
bd_name_copy(sec_event.cfm_req.bd_name, p_result->remote_bd_name);
} else { /* No name found */
sec_event.cfm_req.bd_name[0] = 0;
@@ -225,7 +227,7 @@ static void bta_dm_pinname_cback(const tBTM_REMOTE_DEV_NAME* p_data) {
sec_event.pin_req.bd_addr = bta_dm_sec_cb.pin_bd_addr;
sec_event.pin_req.dev_class = bta_dm_sec_cb.pin_dev_class;
- if (p_result && p_result->status == BTM_SUCCESS) {
+ if (p_result && p_result->status == tBTM_STATUS::BTM_SUCCESS) {
bd_name_copy(sec_event.pin_req.bd_name, p_result->remote_bd_name);
} else { /* No name found */
sec_event.pin_req.bd_name[0] = 0;
@@ -490,7 +492,8 @@ static tBTM_STATUS bta_dm_sp_cback(tBTM_SP_EVT event, tBTM_SP_EVT_DATA* p_data)
case BTM_SP_LOC_OOB_EVT:
// BR/EDR OOB pairing is not supported with Secure Connections
- btif_dm_proc_loc_oob(BT_TRANSPORT_BR_EDR, (bool)(p_data->loc_oob.status == BTM_SUCCESS),
+ btif_dm_proc_loc_oob(BT_TRANSPORT_BR_EDR,
+ (bool)(p_data->loc_oob.status == tBTM_STATUS::BTM_SUCCESS),
p_data->loc_oob.c_192, p_data->loc_oob.r_192);
break;
@@ -582,7 +585,7 @@ static void bta_dm_remove_sec_dev_entry(const RawAddress& remote_bd_addr) {
static void bta_dm_bond_cancel_complete_cback(tBTM_STATUS result) {
tBTA_DM_SEC sec_event;
- if (result == BTM_SUCCESS) {
+ if (result == tBTM_STATUS::BTM_SUCCESS) {
sec_event.bond_cancel_cmpl.result = BTA_SUCCESS;
} else {
sec_event.bond_cancel_cmpl.result = BTA_FAILURE;
@@ -650,7 +653,7 @@ static void ble_io_req(const RawAddress& bd_addr, tBTM_IO_CAP* p_io_cap, tBTM_OO
******************************************************************************/
static tBTM_STATUS bta_dm_ble_smp_cback(tBTM_LE_EVT event, const RawAddress& bda,
tBTM_LE_EVT_DATA* p_data) {
- tBTM_STATUS status = BTM_SUCCESS;
+ tBTM_STATUS status = tBTM_STATUS::BTM_SUCCESS;
tBTA_DM_SEC sec_event;
log::debug("addr:{},event:{}", bda, ble_evt_to_text(event));
@@ -795,12 +798,12 @@ void bta_dm_encrypt_cback(RawAddress bd_addr, tBT_TRANSPORT transport, void* /*
}
log::debug("Encrypted:{:c}, peer:{} transport:{} status:{} callback:{:c}",
- result == BTM_SUCCESS ? 'T' : 'F', bd_addr, bt_transport_text(transport),
+ result == tBTM_STATUS::BTM_SUCCESS ? 'T' : 'F', bd_addr, bt_transport_text(transport),
btm_status_text(result), (p_callback) ? 'T' : 'F');
tBTA_STATUS bta_status = BTA_SUCCESS;
switch (result) {
- case BTM_SUCCESS:
+ case tBTM_STATUS::BTM_SUCCESS:
break;
case BTM_WRONG_MODE:
bta_status = BTA_WRONG_MODE;
@@ -908,7 +911,7 @@ static tBTM_STATUS bta_dm_sirk_verifiction_cback(const RawAddress& bd_addr) {
log::debug("no callback registered");
- return BTM_SUCCESS_NO_SECURITY;
+ return tBTM_STATUS::BTM_SUCCESS_NO_SECURITY;
}
/*******************************************************************************
@@ -961,14 +964,14 @@ void bta_dm_add_ble_device(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
******************************************************************************/
void bta_dm_ble_passkey_reply(const RawAddress& bd_addr, bool accept, uint32_t passkey) {
get_btm_client_interface().security.BTM_BlePasskeyReply(
- bd_addr, accept ? BTM_SUCCESS : BTM_NOT_AUTHORIZED, passkey);
+ bd_addr, accept ? tBTM_STATUS::BTM_SUCCESS : BTM_NOT_AUTHORIZED, passkey);
}
/** This is response to SM numeric comparison request submitted to application.
*/
void bta_dm_ble_confirm_reply(const RawAddress& bd_addr, bool accept) {
get_btm_client_interface().security.BTM_SecConfirmReqReply(
- accept ? BTM_SUCCESS : BTM_NOT_AUTHORIZED, BT_TRANSPORT_LE, bd_addr);
+ accept ? tBTM_STATUS::BTM_SUCCESS : BTM_NOT_AUTHORIZED, BT_TRANSPORT_LE, bd_addr);
}
/** This function set the local device LE privacy settings. */
diff --git a/system/bta/dm/bta_dm_sec_api.cc b/system/bta/dm/bta_dm_sec_api.cc
index 3af6b7ad18..f46bd40197 100644
--- a/system/bta/dm/bta_dm_sec_api.cc
+++ b/system/bta/dm/bta_dm_sec_api.cc
@@ -31,6 +31,7 @@
#include "stack/include/bt_octets.h"
#include "stack/include/btm_ble_sec_api.h"
#include "stack/include/btm_client_interface.h"
+#include "stack/include/btm_status.h"
#include "stack/include/main_thread.h"
#include "types/raw_address.h"
@@ -214,7 +215,7 @@ void BTA_DmBleSecurityGrant(const RawAddress& bd_addr, tBTA_DM_BLE_SEC_GRANT res
const tBTM_STATUS btm_status = [](const tBTA_DM_BLE_SEC_GRANT res) -> tBTM_STATUS {
switch (res) {
case tBTA_DM_BLE_SEC_GRANT::BTA_DM_SEC_GRANTED:
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
case tBTA_DM_BLE_SEC_GRANT::BTA_DM_SEC_PAIR_NOT_SPT:
return static_cast<tBTM_STATUS>(BTA_DM_AUTH_FAIL_BASE + SMP_PAIR_NOT_SUPPORT);
}
diff --git a/system/bta/has/has_client_test.cc b/system/bta/has/has_client_test.cc
index 10d4a2a676..19f0b1d1c3 100644
--- a/system/bta/has/has_client_test.cc
+++ b/system/bta/has/has_client_test.cc
@@ -38,6 +38,7 @@
#include "has_types.h"
#include "mock_csis_client.h"
#include "stack/include/bt_uuid16.h"
+#include "stack/include/btm_status.h"
#include "test/common/mock_functions.h"
#include "types/bt_transport.h"
@@ -634,7 +635,7 @@ protected:
tBTM_SEC_CALLBACK* p_callback, void* p_ref_data,
tBTM_BLE_SEC_ACT sec_act) -> tBTM_STATUS {
InjectEncryptionEvent(bd_addr);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}));
MockCsisClient::SetMockInstanceForTesting(&mock_csis_client_module_);
@@ -1249,7 +1250,8 @@ TEST_F(HasClientTest, test_service_discovery_complete_before_encryption) {
EXPECT_CALL(*callbacks, OnConnectionState(ConnectionState::CONNECTED, test_address)).Times(0);
SetEncryptionResult(test_address, false);
- ON_CALL(btm_interface, SetEncryption(_, _, _, _, _)).WillByDefault(Return(BTM_SUCCESS));
+ ON_CALL(btm_interface, SetEncryption(_, _, _, _, _))
+ .WillByDefault(Return(tBTM_STATUS::BTM_SUCCESS));
TestConnect(test_address);
auto test_conn_id = GetTestConnId(test_address);
diff --git a/system/bta/hearing_aid/hearing_aid.cc b/system/bta/hearing_aid/hearing_aid.cc
index f6b951cf01..39f0ac9f04 100644
--- a/system/bta/hearing_aid/hearing_aid.cc
+++ b/system/bta/hearing_aid/hearing_aid.cc
@@ -48,6 +48,7 @@
#include "stack/include/bt_types.h"
#include "stack/include/bt_uuid16.h"
#include "stack/include/btm_client_interface.h"
+#include "stack/include/btm_status.h"
#include "stack/include/l2c_api.h" // L2CAP_MIN_OFFSET
#include "stack/include/main_thread.h"
#include "types/bluetooth/uuid.h"
@@ -525,7 +526,8 @@ public:
// Set data length
// TODO(jpawlowski: for 16khz only 87 is required, optimize
- if (get_btm_client_interface().ble.BTM_SetBleDataLength(address, 167) != BTM_SUCCESS) {
+ if (get_btm_client_interface().ble.BTM_SetBleDataLength(address, 167) !=
+ tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to set BLE data length peer:{} size:{}", address, 167);
}
@@ -1987,7 +1989,7 @@ static void read_rssi_callback(void* p_void) {
return;
}
- if ((instance) && (p_result->status == BTM_SUCCESS)) {
+ if ((instance) && (p_result->status == tBTM_STATUS::BTM_SUCCESS)) {
instance->OnReadRssiComplete(p_result->rem_bda, p_result->rssi);
}
}
@@ -2083,7 +2085,7 @@ static void hearingaid_gattc_callback(tBTA_GATTC_EVT event, tBTA_GATTC* p_data)
static void encryption_callback(RawAddress address, tBT_TRANSPORT, void*, tBTM_STATUS status) {
if (instance) {
- instance->OnEncryptionComplete(address, status == BTM_SUCCESS ? true : false);
+ instance->OnEncryptionComplete(address, status == tBTM_STATUS::BTM_SUCCESS ? true : false);
}
}
diff --git a/system/bta/hf_client/bta_hf_client_sco.cc b/system/bta/hf_client/bta_hf_client_sco.cc
index 27f35411e9..22b162ed40 100644
--- a/system/bta/hf_client/bta_hf_client_sco.cc
+++ b/system/bta/hf_client/bta_hf_client_sco.cc
@@ -26,6 +26,7 @@
#include "stack/include/bt_hdr.h"
#include "stack/include/btm_api.h"
#include "stack/include/btm_client_interface.h"
+#include "stack/include/btm_status.h"
#define BTA_HF_CLIENT_NO_EDR_ESCO \
(ESCO_PKT_TYPES_MASK_NO_2_EV3 | ESCO_PKT_TYPES_MASK_NO_3_EV3 | ESCO_PKT_TYPES_MASK_NO_2_EV5 | \
@@ -66,7 +67,7 @@ static bool bta_hf_client_sco_remove(tBTA_HF_CLIENT_CB* client_cb) {
removed_started = true;
}
/* If no connection reset the SCO handle */
- else if ((status == BTM_SUCCESS) || (status == BTM_UNKNOWN_ADDR)) {
+ else if ((status == tBTM_STATUS::BTM_SUCCESS) || (status == BTM_UNKNOWN_ADDR)) {
client_cb->sco_idx = BTM_INVALID_SCO_INDEX;
}
}
@@ -252,7 +253,7 @@ static void bta_hf_client_sco_create(tBTA_HF_CLIENT_CB* client_cb, bool is_orig)
/* if initiating set current scb and peer bd addr */
if (is_orig) {
- if (get_btm_client_interface().sco.BTM_SetEScoMode(&params) != BTM_SUCCESS) {
+ if (get_btm_client_interface().sco.BTM_SetEScoMode(&params) != tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to set ESCO mode");
}
/* tell sys to stop av if any */
@@ -264,7 +265,7 @@ static void bta_hf_client_sco_create(tBTA_HF_CLIENT_CB* client_cb, bool is_orig)
bta_hf_client_sco_conn_cback, bta_hf_client_sco_disc_cback);
if (status == BTM_CMD_STARTED && !is_orig) {
if (get_btm_client_interface().sco.BTM_RegForEScoEvts(
- client_cb->sco_idx, bta_hf_client_esco_connreq_cback) == BTM_SUCCESS) {
+ client_cb->sco_idx, bta_hf_client_esco_connreq_cback) == tBTM_STATUS::BTM_SUCCESS) {
log::verbose("SCO registration success");
}
}
diff --git a/system/bta/hh/bta_hh_le.cc b/system/bta/hh/bta_hh_le.cc
index 04a38d65c3..4480b8c30e 100644
--- a/system/bta/hh/bta_hh_le.cc
+++ b/system/bta/hh/bta_hh_le.cc
@@ -39,6 +39,7 @@
#include "stack/include/bt_uuid16.h"
#include "stack/include/btm_client_interface.h"
#include "stack/include/btm_log_history.h"
+#include "stack/include/btm_status.h"
#include "stack/include/l2c_api.h" // L2CA_
#include "stack/include/main_thread.h"
#include "stack/include/srvc_api.h" // tDIS_VALUE
@@ -964,7 +965,7 @@ static void bta_hh_le_encrypt_cback(RawAddress bd_addr, tBT_TRANSPORT transport,
}
// TODO Collapse the duplicated status values
- p_dev_cb->status = (result == BTM_SUCCESS) ? BTA_HH_OK : BTA_HH_ERR_SEC;
+ p_dev_cb->status = (result == tBTM_STATUS::BTM_SUCCESS) ? BTA_HH_OK : BTA_HH_ERR_SEC;
p_dev_cb->btm_status = result;
bta_hh_sm_execute(p_dev_cb, BTA_HH_ENC_CMPL_EVT, NULL);
diff --git a/system/bta/hh/bta_hh_utils.cc b/system/bta/hh/bta_hh_utils.cc
index e924cc59b3..c163c1e5ab 100644
--- a/system/bta/hh/bta_hh_utils.cc
+++ b/system/bta/hh/bta_hh_utils.cc
@@ -29,6 +29,7 @@
#include "os/log.h"
#include "osi/include/allocator.h"
#include "stack/include/btm_client_interface.h"
+#include "stack/include/btm_status.h"
#include "stack/include/sdp_api.h"
#include "types/raw_address.h"
@@ -326,7 +327,7 @@ tBTA_HH_STATUS bta_hh_read_ssr_param(const tAclLinkSpec& link_spec, uint16_t* p_
uint16_t ssr_max_latency;
if (get_btm_client_interface().link_controller.BTM_GetLinkSuperTout(
- p_cb->link_spec.addrt.bda, &ssr_max_latency) != BTM_SUCCESS) {
+ p_cb->link_spec.addrt.bda, &ssr_max_latency) != tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to get supervision timeout for peer:{}", p_cb->link_spec);
return BTA_HH_ERR;
}
diff --git a/system/bta/le_audio/client.cc b/system/bta/le_audio/client.cc
index 4b97acd721..88aaa80123 100644
--- a/system/bta/le_audio/client.cc
+++ b/system/bta/le_audio/client.cc
@@ -2151,7 +2151,7 @@ public:
/* verify bond */
if (BTM_IsEncrypted(address, BT_TRANSPORT_LE)) {
/* if link has been encrypted */
- OnEncryptionComplete(address, BTM_SUCCESS);
+ OnEncryptionComplete(address, tBTM_STATUS::BTM_SUCCESS);
return;
}
@@ -2242,7 +2242,7 @@ public:
return;
}
- if (status != BTM_SUCCESS) {
+ if (status != tBTM_STATUS::BTM_SUCCESS) {
log::error("Encryption failed status: {}", btm_status_text(status));
if (leAudioDevice->GetConnectionState() ==
DeviceConnectState::CONNECTED_BY_USER_GETTING_READY) {
@@ -5809,7 +5809,7 @@ void le_audio_gattc_callback(tBTA_GATTC_EVT event, tBTA_GATTC* p_data) {
case BTA_GATTC_ENC_CMPL_CB_EVT: {
tBTM_STATUS encryption_status;
if (BTM_IsEncrypted(p_data->enc_cmpl.remote_bda, BT_TRANSPORT_LE)) {
- encryption_status = BTM_SUCCESS;
+ encryption_status = tBTM_STATUS::BTM_SUCCESS;
} else {
encryption_status = BTM_FAILED_ON_SECURITY;
}
diff --git a/system/bta/le_audio/le_audio_client_test.cc b/system/bta/le_audio/le_audio_client_test.cc
index 4ffa7f5cc0..755282749c 100644
--- a/system/bta/le_audio/le_audio_client_test.cc
+++ b/system/bta/le_audio/le_audio_client_test.cc
@@ -51,6 +51,7 @@
#include "mock_csis_client.h"
#include "mock_device_groups.h"
#include "mock_state_machine.h"
+#include "stack/include/btm_status.h"
#include "test/common/mock_functions.h"
#include "test/mock/mock_main_shim_entry.h"
#include "test/mock/mock_stack_btm_iso.h"
@@ -4269,7 +4270,7 @@ TEST_F(UnicastTestNoInit, LoadStoredEarbudsCsisGroupedDifferently) {
ON_CALL(mock_btm_interface_, BTM_IsEncrypted(test_address0, _))
.WillByDefault(DoAll(Return(false)));
ON_CALL(mock_btm_interface_, SetEncryption(test_address0, _, _, _, _))
- .WillByDefault(Return(BTM_SUCCESS));
+ .WillByDefault(Return(tBTM_STATUS::BTM_SUCCESS));
/* For background connect, test needs to Inject Connected Event */
InjectConnectedEvent(test_address0, 1);
diff --git a/system/bta/sys/utl.cc b/system/bta/sys/utl.cc
index a556bfab54..aa421d76bb 100644
--- a/system/bta/sys/utl.cc
+++ b/system/bta/sys/utl.cc
@@ -28,6 +28,7 @@
#include "internal_include/bt_target.h"
#include "stack/include/bt_dev_class.h"
#include "stack/include/btm_client_interface.h"
+#include "stack/include/btm_status.h"
/*******************************************************************************
*
@@ -212,10 +213,9 @@ bool utl_set_device_class(tBTA_UTL_COD* p_cod, uint8_t cmd) {
DEV_CLASS dev_class;
FIELDS_TO_COD(dev_class, minor, major, service);
- if (get_btm_client_interface().local.BTM_SetDeviceClass(dev_class) == BTM_SUCCESS) {
+ if (get_btm_client_interface().local.BTM_SetDeviceClass(dev_class) == tBTM_STATUS::BTM_SUCCESS) {
return true;
}
-
return false;
}
diff --git a/system/bta/test/bta_ag_test.cc b/system/bta/test/bta_ag_test.cc
index eefa8d2cc5..eee21f4304 100644
--- a/system/bta/test/bta_ag_test.cc
+++ b/system/bta/test/bta_ag_test.cc
@@ -29,6 +29,7 @@
#include "bta/ag/bta_ag_int.h"
#include "bta/include/bta_ag_swb_aptx.h"
#include "hci/controller_interface_mock.h"
+#include "stack/include/btm_status.h"
#include "test/common/main_handler.h"
#include "test/common/mock_functions.h"
#include "test/fake/fake_osi.h"
@@ -275,7 +276,7 @@ TEST_F_WITH_FLAGS(BtaAgCmdTest, at_hfp_cback__qcs_ev_codec_q0_enabled,
mock_btm_client_interface.sco.BTM_SetEScoMode =
[](enh_esco_params_t* /* p_parms */) -> tBTM_STATUS {
inc_func_call_count("BTM_SetEScoMode");
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
};
mock_btm_client_interface.sco.BTM_CreateSco =
[](const RawAddress* /* remote_bda */, bool /* is_orig */, uint16_t /* pkt_types */,
@@ -315,7 +316,7 @@ TEST_F_WITH_FLAGS(BtaAgCmdTest, handle_swb_at_event__qcs_ev_codec_q1_fallback_to
reset_mock_btm_client_interface();
mock_btm_client_interface.sco.BTM_SetEScoMode = [](enh_esco_params_t* p_parms) -> tBTM_STATUS {
inc_func_call_count("BTM_SetEScoMode");
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
};
mock_btm_client_interface.sco.BTM_CreateSco =
[](const RawAddress* /* remote_bda */, bool /* is_orig */, uint16_t /* pkt_types */,
diff --git a/system/bta/test/bta_dm_test.cc b/system/bta/test/bta_dm_test.cc
index e3309ecee7..e0dc6a6620 100644
--- a/system/bta/test/bta_dm_test.cc
+++ b/system/bta/test/bta_dm_test.cc
@@ -269,12 +269,12 @@ TEST_F(BtaDmTest, bta_dm_encrypt_cback) {
// Encryption with no callback set
device->p_encrypt_cback = nullptr;
- bta_dm_encrypt_cback(kRawAddress, transport, nullptr, BTM_SUCCESS);
+ bta_dm_encrypt_cback(kRawAddress, transport, nullptr, tBTM_STATUS::BTM_SUCCESS);
ASSERT_EQ(0UL, BTA_DM_ENCRYPT_CBACK_queue.size());
// Encryption with callback
device->p_encrypt_cback = BTA_DM_ENCRYPT_CBACK;
- bta_dm_encrypt_cback(kRawAddress, transport, nullptr, BTM_SUCCESS);
+ bta_dm_encrypt_cback(kRawAddress, transport, nullptr, tBTM_STATUS::BTM_SUCCESS);
device->p_encrypt_cback = BTA_DM_ENCRYPT_CBACK;
bta_dm_encrypt_cback(kRawAddress, transport, nullptr, BTM_WRONG_MODE);
device->p_encrypt_cback = BTA_DM_ENCRYPT_CBACK;
@@ -309,7 +309,7 @@ TEST_F(BtaDmTest, bta_dm_remname_cback__typical) {
search_cb.name_discover_done = false;
tBTM_REMOTE_DEV_NAME name = {
- .status = BTM_SUCCESS,
+ .status = tBTM_STATUS::BTM_SUCCESS,
.bd_addr = kRawAddress,
.remote_bd_name = {},
.hci_status = HCI_SUCCESS,
@@ -330,7 +330,7 @@ TEST_F(BtaDmTest, bta_dm_remname_cback__wrong_address) {
search_cb.name_discover_done = false;
tBTM_REMOTE_DEV_NAME name = {
- .status = BTM_SUCCESS,
+ .status = tBTM_STATUS::BTM_SUCCESS,
.bd_addr = kRawAddress2,
.remote_bd_name = {},
.hci_status = HCI_SUCCESS,
@@ -348,7 +348,7 @@ TEST_F(BtaDmTest, bta_dm_remname_cback__HCI_ERR_CONNECTION_EXISTS) {
search_cb.name_discover_done = false;
tBTM_REMOTE_DEV_NAME name = {
- .status = BTM_SUCCESS,
+ .status = tBTM_STATUS::BTM_SUCCESS,
.bd_addr = RawAddress::kEmpty,
.remote_bd_name = {},
.hci_status = HCI_ERR_CONNECTION_EXISTS,
diff --git a/system/bta/test/bta_sec_test.cc b/system/bta/test/bta_sec_test.cc
index e2fafae9c4..9a8594fe65 100644
--- a/system/bta/test/bta_sec_test.cc
+++ b/system/bta/test/bta_sec_test.cc
@@ -21,7 +21,7 @@
#include "bta/dm/bta_dm_sec_int.h"
#include "bta/test/bta_test_fixtures.h"
-#include "btm_status.h"
+#include "stack/include/btm_status.h"
#include "test/mock/mock_stack_btm_inq.h"
#include "test/mock/mock_stack_btm_interface.h"
#include "types/raw_address.h"
@@ -146,7 +146,7 @@ TEST_F(BtaSecTest, bta_dm_sp_cback__BTM_SP_CFM_REQ_EVT_WithoutName_RNRFail) {
static bool callback_sent = false;
mock_btm_client_interface.peer.BTM_ReadRemoteDeviceName =
[](const RawAddress& remote_bda, tBTM_NAME_CMPL_CB* p_cb,
- tBT_TRANSPORT transport) -> tBTM_STATUS { return BTM_SUCCESS; };
+ tBT_TRANSPORT transport) -> tBTM_STATUS { return tBTM_STATUS::BTM_SUCCESS; };
static tBTA_DM_SP_CFM_REQ cfm_req{};
bta_dm_sec_enable([](tBTA_DM_SEC_EVT event, tBTA_DM_SEC* p_data) {
diff --git a/system/bta/test/bta_test_fixtures.h b/system/bta/test/bta_test_fixtures.h
index d38f40ac24..93739dc32f 100644
--- a/system/bta/test/bta_test_fixtures.h
+++ b/system/bta/test/bta_test_fixtures.h
@@ -24,6 +24,7 @@
#include "bta/sys/bta_sys.h"
#include "btm_client_interface.h"
#include "osi/include/allocator.h"
+#include "stack/include/btm_status.h"
#include "stack/include/main_thread.h"
#include "test/common/main_handler.h"
#include "test/common/mock_functions.h"
@@ -70,7 +71,7 @@ protected:
uint8_t* p_num_uuid16) -> uint8_t { return 0; };
mock_btm_client_interface.eir.BTM_WriteEIR = [](BT_HDR* p_buf) -> tBTM_STATUS {
osi_free(p_buf);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
};
mock_btm_client_interface.local.BTM_ReadLocalDeviceNameFromController =
[](tBTM_CMPL_CB* cb) -> tBTM_STATUS { return BTM_CMD_STARTED; };
diff --git a/system/bta/vc/vc.cc b/system/bta/vc/vc.cc
index 1caee41923..ee76ef0525 100644
--- a/system/bta/vc/vc.cc
+++ b/system/bta/vc/vc.cc
@@ -37,6 +37,7 @@
#include "osi/include/osi.h"
#include "stack/btm/btm_sec.h"
#include "stack/include/bt_types.h"
+#include "stack/include/btm_status.h"
#include "types/bluetooth/uuid.h"
#include "types/raw_address.h"
@@ -178,7 +179,7 @@ public:
BTA_GATTC_CancelOpen(gatt_if_, address, false);
if (device->IsEncryptionEnabled()) {
- OnEncryptionComplete(address, BTM_SUCCESS);
+ OnEncryptionComplete(address, tBTM_STATUS::BTM_SUCCESS);
return;
}
@@ -195,7 +196,7 @@ public:
return;
}
- if (success != BTM_SUCCESS) {
+ if (success != tBTM_STATUS::BTM_SUCCESS) {
log::error("encryption failed status: {}", btm_status_text(success));
// If the encryption failed, do not remove the device.
// Disconnect only, since the Android will try to re-enable encryption
@@ -1160,7 +1161,7 @@ private:
case BTA_GATTC_ENC_CMPL_CB_EVT: {
tBTM_STATUS encryption_status;
if (BTM_IsEncrypted(p_data->enc_cmpl.remote_bda, BT_TRANSPORT_LE)) {
- encryption_status = BTM_SUCCESS;
+ encryption_status = tBTM_STATUS::BTM_SUCCESS;
} else {
encryption_status = BTM_FAILED_ON_SECURITY;
}
diff --git a/system/bta/vc/vc_test.cc b/system/bta/vc/vc_test.cc
index 708a0a6b65..2747cfefe9 100644
--- a/system/bta/vc/vc_test.cc
+++ b/system/bta/vc/vc_test.cc
@@ -29,10 +29,12 @@
#include "mock_csis_client.h"
#include "osi/test/alarm_mock.h"
#include "stack/include/bt_uuid16.h"
+#include "stack/include/btm_status.h"
#include "test/common/mock_functions.h"
#include "types.h"
#include "types/bluetooth/uuid.h"
#include "types/raw_address.h"
+
void btif_storage_add_volume_control(const RawAddress& addr, bool auto_conn) {}
struct alarm_t {
@@ -482,10 +484,10 @@ protected:
tBTM_BLE_SEC_ACT sec_act) -> tBTM_STATUS {
if (p_callback) {
p_callback(bd_addr, transport, p_ref_data,
- success ? BTM_SUCCESS : BTM_FAILED_ON_SECURITY);
+ success ? tBTM_STATUS::BTM_SUCCESS : BTM_FAILED_ON_SECURITY);
}
GetEncryptionCompleteEvt(bd_addr);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}));
EXPECT_CALL(btm_interface, SetEncryption(address, _, _, _, BTM_BLE_SEC_ENCRYPT)).Times(1);
}
@@ -803,7 +805,7 @@ TEST_F(VolumeControlTest, test_service_discovery_completed_before_encryption) {
ON_CALL(btm_interface, BTM_IsEncrypted(test_address, _)).WillByDefault(DoAll(Return(false)));
ON_CALL(btm_interface, IsLinkKeyKnown(test_address, _)).WillByDefault(DoAll(Return(true)));
ON_CALL(btm_interface, SetEncryption(test_address, _, _, _, _))
- .WillByDefault(Return(BTM_SUCCESS));
+ .WillByDefault(Return(tBTM_STATUS::BTM_SUCCESS));
EXPECT_CALL(*callbacks, OnConnectionState(ConnectionState::CONNECTED, test_address)).Times(0);
uint16_t conn_id = 1;
diff --git a/system/btif/src/bluetooth.cc b/system/btif/src/bluetooth.cc
index 41fa84c816..6cd064af47 100644
--- a/system/btif/src/bluetooth.cc
+++ b/system/btif/src/bluetooth.cc
@@ -101,6 +101,7 @@
#include "stack/include/a2dp_api.h"
#include "stack/include/avdt_api.h"
#include "stack/include/btm_client_interface.h"
+#include "stack/include/btm_status.h"
#include "stack/include/hfp_lc3_decoder.h"
#include "stack/include/hfp_lc3_encoder.h"
#include "stack/include/hfp_msbc_decoder.h"
@@ -1396,7 +1397,8 @@ void invoke_oob_data_request_cb(tBT_TRANSPORT t, bool valid, Octet16 c, Octet16
log::info("");
bt_oob_data_t oob_data = {};
const char* local_name;
- if (get_btm_client_interface().local.BTM_ReadLocalDeviceName(&local_name) != BTM_SUCCESS) {
+ if (get_btm_client_interface().local.BTM_ReadLocalDeviceName(&local_name) !=
+ tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to read local device name");
}
for (int i = 0; i < BD_NAME_LEN; i++) {
diff --git a/system/btif/src/btif_a2dp_source.cc b/system/btif/src/btif_a2dp_source.cc
index 1b362f6d1a..1047ee7f2c 100644
--- a/system/btif/src/btif_a2dp_source.cc
+++ b/system/btif/src/btif_a2dp_source.cc
@@ -50,6 +50,7 @@
#include "stack/include/acl_api_types.h"
#include "stack/include/bt_hdr.h"
#include "stack/include/btm_client_interface.h"
+#include "stack/include/btm_status.h"
#include "types/raw_address.h"
using bluetooth::audio::a2dp::BluetoothAudioStatus;
@@ -1240,7 +1241,7 @@ static void btm_read_rssi_cb(void* data) {
}
tBTM_RSSI_RESULT* result = (tBTM_RSSI_RESULT*)data;
- if (result->status != BTM_SUCCESS) {
+ if (result->status != tBTM_STATUS::BTM_SUCCESS) {
log::error("unable to read remote RSSI (status {})", result->status);
return;
}
@@ -1258,7 +1259,7 @@ static void btm_read_failed_contact_counter_cb(void* data) {
}
tBTM_FAILED_CONTACT_COUNTER_RESULT* result = (tBTM_FAILED_CONTACT_COUNTER_RESULT*)data;
- if (result->status != BTM_SUCCESS) {
+ if (result->status != tBTM_STATUS::BTM_SUCCESS) {
log::error("unable to read Failed Contact Counter (status {})", result->status);
return;
}
@@ -1277,7 +1278,7 @@ static void btm_read_tx_power_cb(void* data) {
}
tBTM_TX_POWER_RESULT* result = (tBTM_TX_POWER_RESULT*)data;
- if (result->status != BTM_SUCCESS) {
+ if (result->status != tBTM_STATUS::BTM_SUCCESS) {
log::error("unable to read Tx Power (status {})", result->status);
return;
}
diff --git a/system/btif/src/btif_sock_sco.cc b/system/btif/src/btif_sock_sco.cc
index ab541393fe..285f417297 100644
--- a/system/btif/src/btif_sock_sco.cc
+++ b/system/btif/src/btif_sock_sco.cc
@@ -34,6 +34,7 @@
#include "osi/include/thread.h"
#include "stack/include/btm_api.h"
#include "stack/include/btm_client_interface.h"
+#include "stack/include/btm_status.h"
#include "types/raw_address.h"
// This module provides a socket abstraction for SCO connections to a higher
@@ -89,7 +90,7 @@ bt_status_t btsock_sco_init(thread_t* thread_) {
thread = thread_;
enh_esco_params_t params = esco_parameters_for_codec(SCO_CODEC_CVSD_D1, true);
- if (get_btm_client_interface().sco.BTM_SetEScoMode(&params) != BTM_SUCCESS) {
+ if (get_btm_client_interface().sco.BTM_SetEScoMode(&params) != tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to set ESCO parameters");
}
@@ -112,8 +113,8 @@ bt_status_t btsock_sco_listen(int* sock_fd, int /* flags */) {
return BT_STATUS_SOCKET_ERROR;
}
- if (get_btm_client_interface().sco.BTM_RegForEScoEvts(sco_socket->sco_handle,
- connection_request_cb) != BTM_SUCCESS) {
+ if (get_btm_client_interface().sco.BTM_RegForEScoEvts(
+ sco_socket->sco_handle, connection_request_cb) != tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to register for ESCO events");
}
listen_sco_socket = sco_socket;
@@ -199,7 +200,8 @@ static void sco_socket_free_locked(sco_socket_t* sco_socket) {
}
if (sco_socket->sco_handle != BTM_INVALID_SCO_INDEX) {
- if (get_btm_client_interface().sco.BTM_RemoveSco(sco_socket->sco_handle) != BTM_SUCCESS) {
+ if (get_btm_client_interface().sco.BTM_RemoveSco(sco_socket->sco_handle) !=
+ tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to remove SCO handle:{}", sco_socket->sco_handle);
}
}
@@ -270,8 +272,8 @@ static void connection_request_cb(tBTM_ESCO_EVT event, tBTM_ESCO_EVT_DATA* data)
goto error;
}
- if (get_btm_client_interface().sco.BTM_RegForEScoEvts(listen_sco_socket->sco_handle,
- connection_request_cb) != BTM_SUCCESS) {
+ if (get_btm_client_interface().sco.BTM_RegForEScoEvts(
+ listen_sco_socket->sco_handle, connection_request_cb) != tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to register for ESCO events handle:{}", listen_sco_socket->sco_handle);
}
get_btm_client_interface().sco.BTM_EScoConnRsp(conn_data->sco_inx, HCI_SUCCESS, NULL);
@@ -299,7 +301,8 @@ static void connect_completed_cb(uint16_t sco_handle) {
// app-level
// interest in the SCO socket.
if (!sco_socket->socket) {
- if (get_btm_client_interface().sco.BTM_RemoveSco(sco_socket->sco_handle) != BTM_SUCCESS) {
+ if (get_btm_client_interface().sco.BTM_RemoveSco(sco_socket->sco_handle) !=
+ tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to remove SCO handle:{}", sco_socket->sco_handle);
}
list_remove(sco_sockets, sco_socket);
@@ -335,7 +338,8 @@ static void socket_read_ready_cb(socket_t* /* socket */, void* context) {
// routine that the socket is no longer desired and should be torn
// down.
if (sco_socket->connect_completed || sco_socket == listen_sco_socket) {
- if (get_btm_client_interface().sco.BTM_RemoveSco(sco_socket->sco_handle) == BTM_SUCCESS) {
+ if (get_btm_client_interface().sco.BTM_RemoveSco(sco_socket->sco_handle) ==
+ tBTM_STATUS::BTM_SUCCESS) {
list_remove(sco_sockets, sco_socket);
}
if (sco_socket == listen_sco_socket) {
diff --git a/system/main/shim/btm_api.cc b/system/main/shim/btm_api.cc
index 4719b6a589..753dc3d5d7 100644
--- a/system/main/shim/btm_api.cc
+++ b/system/main/shim/btm_api.cc
@@ -29,35 +29,36 @@
#include "main/shim/stack.h"
#include "stack/btm/btm_ble_sec.h"
#include "stack/btm/btm_dev.h"
+#include "stack/include/btm_status.h"
#include "types/raw_address.h"
tBTM_STATUS bluetooth::shim::BTM_ClearEventFilter() {
GetController()->SetEventFilterClearAll();
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
tBTM_STATUS bluetooth::shim::BTM_ClearEventMask() {
GetController()->SetEventMask(0);
GetController()->LeSetEventMask(0);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
tBTM_STATUS bluetooth::shim::BTM_ClearFilterAcceptList() {
Stack::GetInstance()->GetAcl()->ClearFilterAcceptList();
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
tBTM_STATUS bluetooth::shim::BTM_DisconnectAllAcls() {
Stack::GetInstance()->GetAcl()->DisconnectAllForSuspend();
// Stack::GetInstance()->GetAcl()->Shutdown();
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
tBTM_STATUS bluetooth::shim::BTM_SetEventFilterConnectionSetupAllDevices() {
// Autoplumbed
GetController()->SetEventFilterConnectionSetupAllDevices(
bluetooth::hci::AutoAcceptFlag::AUTO_ACCEPT_ON_ROLE_SWITCH_ENABLED);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
tBTM_STATUS bluetooth::shim::BTM_AllowWakeByHid(
@@ -86,7 +87,7 @@ tBTM_STATUS bluetooth::shim::BTM_AllowWakeByHid(
accept_future.wait();
}
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
tBTM_STATUS bluetooth::shim::BTM_RestoreFilterAcceptList(
@@ -108,7 +109,7 @@ tBTM_STATUS bluetooth::shim::BTM_RestoreFilterAcceptList(
accept_future.wait();
}
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
tBTM_STATUS bluetooth::shim::BTM_SetDefaultEventMaskExcept(uint64_t mask, uint64_t le_mask) {
@@ -116,18 +117,18 @@ tBTM_STATUS bluetooth::shim::BTM_SetDefaultEventMaskExcept(uint64_t mask, uint64
uint64_t applied_le_mask = bluetooth::hci::Controller::kDefaultLeEventMask & ~(le_mask);
GetController()->SetEventMask(applied_mask);
GetController()->LeSetEventMask(applied_le_mask);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
tBTM_STATUS bluetooth::shim::BTM_SetEventFilterInquiryResultAllDevices() {
// Autoplumbed
GetController()->SetEventFilterInquiryResultAllDevices();
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
tBTM_STATUS bluetooth::shim::BTM_BleResetId() {
btm_ble_reset_id();
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
size_t bluetooth::shim::BTM_BleGetNumberOfAdvertisingInstancesInUse(void) {
diff --git a/system/main/shim/le_scanning_manager.cc b/system/main/shim/le_scanning_manager.cc
index 605d62a794..30ab1135a6 100644
--- a/system/main/shim/le_scanning_manager.cc
+++ b/system/main/shim/le_scanning_manager.cc
@@ -35,11 +35,11 @@
#include "main/shim/helpers.h"
#include "main/shim/le_scanning_manager.h"
#include "main/shim/shim.h"
-#include "os/log.h"
#include "stack/btm/btm_int_types.h"
#include "stack/include/advertise_data_parser.h"
#include "stack/include/bt_dev_class.h"
#include "stack/include/btm_log_history.h"
+#include "stack/include/btm_status.h"
#include "storage/device.h"
#include "storage/le_device.h"
#include "storage/storage_module.h"
@@ -217,7 +217,7 @@ void BleScannerInterfaceImpl::ScanFilterParamSetup(
bluetooth::shim::GetScanning()->ScanFilterParameterSetup(apcf_action, filter_index,
advertising_filter_parameter);
// TODO refactor callback mechanism
- do_in_jni_thread(base::BindOnce(cb, 0, 0, btm_status_value(BTM_SUCCESS)));
+ do_in_jni_thread(base::BindOnce(cb, 0, 0, btm_status_value(tBTM_STATUS::BTM_SUCCESS)));
}
/** Configure a scan filter condition */
@@ -234,7 +234,7 @@ void BleScannerInterfaceImpl::ScanFilterAdd(int filter_index, std::vector<ApcfCo
new_filters.push_back(command);
}
bluetooth::shim::GetScanning()->ScanFilterAdd(filter_index, new_filters);
- do_in_jni_thread(base::BindOnce(cb, 0, 0, 0, btm_status_value(BTM_SUCCESS)));
+ do_in_jni_thread(base::BindOnce(cb, 0, 0, 0, btm_status_value(tBTM_STATUS::BTM_SUCCESS)));
}
/** Clear all scan filter conditions for specific filter index*/
@@ -250,7 +250,7 @@ void BleScannerInterfaceImpl::ScanFilterEnable(bool enable, EnableCallback cb) {
bluetooth::shim::GetScanning()->ScanFilterEnable(enable);
uint8_t action = enable ? 1 : 0;
- do_in_jni_thread(base::BindOnce(cb, action, btm_status_value(BTM_SUCCESS)));
+ do_in_jni_thread(base::BindOnce(cb, action, btm_status_value(tBTM_STATUS::BTM_SUCCESS)));
}
#if TARGET_FLOSS
@@ -343,7 +343,7 @@ void BleScannerInterfaceImpl::BatchscanConfigStorage(int client_if, int batch_sc
log::info("in shim layer");
bluetooth::shim::GetScanning()->BatchScanConifgStorage(batch_scan_full_max, batch_scan_trunc_max,
batch_scan_notify_threshold, client_if);
- do_in_jni_thread(base::BindOnce(cb, btm_status_value(BTM_SUCCESS)));
+ do_in_jni_thread(base::BindOnce(cb, btm_status_value(tBTM_STATUS::BTM_SUCCESS)));
}
/* Enable batchscan */
@@ -354,14 +354,14 @@ void BleScannerInterfaceImpl::BatchscanEnable(int scan_mode, int scan_interval,
auto batch_scan_discard_rule = static_cast<bluetooth::hci::BatchScanDiscardRule>(discard_rule);
bluetooth::shim::GetScanning()->BatchScanEnable(batch_scan_mode, scan_window, scan_interval,
batch_scan_discard_rule);
- do_in_jni_thread(base::BindOnce(cb, btm_status_value(BTM_SUCCESS)));
+ do_in_jni_thread(base::BindOnce(cb, btm_status_value(tBTM_STATUS::BTM_SUCCESS)));
}
/* Disable batchscan */
void BleScannerInterfaceImpl::BatchscanDisable(Callback cb) {
log::info("in shim layer");
bluetooth::shim::GetScanning()->BatchScanDisable();
- do_in_jni_thread(base::BindOnce(cb, btm_status_value(BTM_SUCCESS)));
+ do_in_jni_thread(base::BindOnce(cb, btm_status_value(tBTM_STATUS::BTM_SUCCESS)));
}
/* Read out batchscan reports */
diff --git a/system/osi/src/stack_power_telemetry.cc b/system/osi/src/stack_power_telemetry.cc
index 06695776df..7f4d513fcc 100644
--- a/system/osi/src/stack_power_telemetry.cc
+++ b/system/osi/src/stack_power_telemetry.cc
@@ -386,7 +386,7 @@ void power_telemetry::PowerTelemetry::LogTxPower(void* res) {
tBTM_TX_POWER_RESULT* result = (tBTM_TX_POWER_RESULT*)res;
LogDataContainer& ldc = pimpl_->GetCurrentLogDataContainer();
- if (result->status != BTM_SUCCESS) {
+ if (result->status != tBTM_STATUS::BTM_SUCCESS) {
return;
}
diff --git a/system/osi/test/stack_power_telemetry_test.cc b/system/osi/test/stack_power_telemetry_test.cc
index cc48518eaa..ccaaf028e9 100644
--- a/system/osi/test/stack_power_telemetry_test.cc
+++ b/system/osi/test/stack_power_telemetry_test.cc
@@ -3,6 +3,7 @@
#include <gtest/gtest.h>
#include "osi/include/stack_power_telemetry.h"
+#include "stack/include/btm_status.h"
#include "types/raw_address.h"
class PowerTelemetryTest : public ::testing::Test {
@@ -97,7 +98,7 @@ TEST_F(PowerTelemetryTest, test_LogTxPower) {
dummy_res.rem_bda = bdaddr;
// Failed Case. Shouldn't crash if no init data
- dummy_res.status = BTM_SUCCESS;
+ dummy_res.status = tBTM_STATUS::BTM_SUCCESS;
void* p = &dummy_res;
power_telemetry::GetInstance().LogTxPower(p);
@@ -269,7 +270,7 @@ TEST_F(PowerTelemetryTest, test_feature_flag) {
LogDataContainer& ldc = power_telemetry::GetInstance().pimpl_->GetCurrentLogDataContainer();
tBTM_TX_POWER_RESULT dummy_res;
dummy_res.rem_bda = bdaddr;
- dummy_res.status = BTM_SUCCESS;
+ dummy_res.status = tBTM_STATUS::BTM_SUCCESS;
void* p = &dummy_res;
power_telemetry::GetInstance().LogLinkDetails(handle, bdaddr, isConnected, true);
diff --git a/system/stack/acl/btm_acl.cc b/system/stack/acl/btm_acl.cc
index c33d3313dd..ecb40830f5 100644
--- a/system/stack/acl/btm_acl.cc
+++ b/system/stack/acl/btm_acl.cc
@@ -71,6 +71,7 @@
#include "stack/include/btm_ble_api.h"
#include "stack/include/btm_client_interface.h"
#include "stack/include/btm_iso_api.h"
+#include "stack/include/btm_status.h"
#include "stack/include/hci_error_code.h"
#include "stack/include/hcimsgs.h"
#include "stack/include/l2cap_acl_interface.h"
@@ -514,7 +515,7 @@ tBTM_STATUS BTM_GetRole(const RawAddress& remote_bd_addr, tHCI_ROLE* p_role) {
return BTM_UNKNOWN_ADDR;
}
*p_role = p_acl->link_role;
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
/*******************************************************************************
@@ -524,7 +525,7 @@ tBTM_STATUS BTM_GetRole(const RawAddress& remote_bd_addr, tHCI_ROLE* p_role) {
* Description This function is called to switch role between central and
* peripheral. If role is already set it will do nothing.
*
- * Returns BTM_SUCCESS if already in specified role.
+ * Returns tBTM_STATUS::BTM_SUCCESS if already in specified role.
* BTM_CMD_STARTED if command issued to controller.
* BTM_NO_RESOURCES if couldn't allocate memory to issue
* command
@@ -548,7 +549,7 @@ tBTM_STATUS BTM_SwitchRoleToCentral(const RawAddress& remote_bd_addr) {
if (p_acl->link_role == HCI_ROLE_CENTRAL) {
log::info("Requested role is already in effect");
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
if (interop_match_addr(INTEROP_DISABLE_ROLE_SWITCH, &remote_bd_addr)) {
@@ -1032,7 +1033,7 @@ tBTM_STATUS BTM_GetLinkSuperTout(const RawAddress& remote_bda, uint16_t* p_timeo
return BTM_UNKNOWN_ADDR;
}
*p_timeout = p_acl->link_super_tout;
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
/*******************************************************************************
@@ -1071,7 +1072,7 @@ tBTM_STATUS BTM_SetLinkSuperTout(const RawAddress& remote_bda, uint16_t timeout)
"Role is peripheral so unable to set supervision timeout:{:.2f}ms "
"bd_addr:{}",
supervision_timeout_to_seconds(timeout), remote_bda);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
}
@@ -1727,7 +1728,7 @@ void btm_read_tx_power_complete(uint8_t* p, uint16_t evt_len, bool is_ble) {
STREAM_TO_UINT8(result.hci_status, p);
if (result.hci_status == HCI_SUCCESS) {
- result.status = BTM_SUCCESS;
+ result.status = tBTM_STATUS::BTM_SUCCESS;
if (!is_ble) {
uint16_t handle;
@@ -1826,7 +1827,7 @@ void btm_read_rssi_complete(uint8_t* p, uint16_t evt_len) {
tACL_CONN* p_acl_cb = internal_.acl_get_connection_from_handle(handle);
if (p_acl_cb != nullptr) {
result.rem_bda = p_acl_cb->remote_addr;
- result.status = BTM_SUCCESS;
+ result.status = tBTM_STATUS::BTM_SUCCESS;
}
}
(*p_cb)(&result);
@@ -1881,7 +1882,7 @@ void btm_read_failed_contact_counter_complete(uint8_t* p) {
STREAM_TO_UINT8(result.hci_status, p);
if (result.hci_status == HCI_SUCCESS) {
- result.status = BTM_SUCCESS;
+ result.status = tBTM_STATUS::BTM_SUCCESS;
STREAM_TO_UINT16(handle, p);
@@ -1927,7 +1928,7 @@ void btm_read_automatic_flush_timeout_complete(uint8_t* p) {
result.status = BTM_ERR_PROCESSING;
if (result.hci_status == HCI_SUCCESS) {
- result.status = BTM_SUCCESS;
+ result.status = tBTM_STATUS::BTM_SUCCESS;
STREAM_TO_UINT16(handle, p);
STREAM_TO_UINT16(result.automatic_flush_timeout, p);
@@ -1950,7 +1951,7 @@ void btm_read_automatic_flush_timeout_complete(uint8_t* p) {
*
* Description This function is called to disconnect an ACL connection
*
- * Returns BTM_SUCCESS if successfully initiated, otherwise
+ * Returns tBTM_STATUS::BTM_SUCCESS if successfully initiated, otherwise
* BTM_UNKNOWN_ADDR.
*
******************************************************************************/
@@ -1973,11 +1974,11 @@ tBTM_STATUS btm_remove_acl(const RawAddress& bd_addr, tBT_TRANSPORT transport) {
"transport:{}",
bd_addr, bt_transport_text(transport));
p_acl->rs_disc_pending = BTM_SEC_DISC_PENDING;
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
disconnect_acl(*p_acl, HCI_ERR_PEER_USER, "stack::acl::btm_acl::btm_remove_acl");
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
void btm_cont_rswitch_from_handle(uint16_t hci_handle) {
diff --git a/system/stack/acl/btm_pm.cc b/system/stack/acl/btm_pm.cc
index 2d566a0367..eb3d8ff6e6 100644
--- a/system/stack/acl/btm_pm.cc
+++ b/system/stack/acl/btm_pm.cc
@@ -120,7 +120,7 @@ static tBTM_STATUS btm_pm_snd_md_req(uint16_t handle, uint8_t pm_id, int link_in
*
* Description register or deregister with power manager
*
- * Returns BTM_SUCCESS if successful,
+ * Returns tBTM_STATUS::BTM_SUCCESS if successful,
* BTM_NO_RESOURCES if no room to hold registration
* BTM_ILLEGAL_VALUE
*
@@ -132,7 +132,7 @@ tBTM_STATUS BTM_PmRegister(uint8_t mask, uint8_t* p_pm_id, tBTM_PM_STATUS_CBACK*
return BTM_ILLEGAL_VALUE;
}
pm_reg_db.mask = BTM_PM_REC_NOT_USED;
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
if (pm_reg_db.mask == BTM_PM_REC_NOT_USED) {
@@ -143,7 +143,7 @@ tBTM_STATUS BTM_PmRegister(uint8_t mask, uint8_t* p_pm_id, tBTM_PM_STATUS_CBACK*
pm_reg_db.cback = p_cb;
pm_reg_db.mask = mask;
*p_pm_id = 0;
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
return BTM_NO_RESOURCES;
@@ -174,7 +174,7 @@ void BTM_PM_OnDisconnected(uint16_t handle) {
* Description store the mode in control block or
* alter ACL connection behavior.
*
- * Returns BTM_SUCCESS if successful,
+ * Returns tBTM_STATUS::BTM_SUCCESS if successful,
* BTM_UNKNOWN_ADDR if bd addr is not active or bad
*
******************************************************************************/
@@ -231,7 +231,7 @@ tBTM_STATUS BTM_SetPowerMode(uint8_t pm_id, const RawAddress& remote_bda,
"Device is already in requested mode {}, interval: {}, max: {}, min: "
"{}",
p_mode->mode, p_cb->interval, p_mode->max, p_mode->min);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
}
@@ -273,7 +273,7 @@ bool BTM_SetLinkPolicyActiveMode(const RawAddress& remote_bda) {
switch (BTM_SetPowerMode(BTM_PM_SET_ONLY_ID, remote_bda, &settings)) {
case BTM_CMD_STORED:
- case BTM_SUCCESS:
+ case tBTM_STATUS::BTM_SUCCESS:
return true;
default:
return false;
@@ -307,7 +307,7 @@ bool BTM_ReadPowerMode(const RawAddress& remote_bda, tBTM_PM_MODE* p_mode) {
* min_loc_to - minimum local timeout
*
*
- * Returns BTM_SUCCESS if the HCI command is issued successful,
+ * Returns tBTM_STATUS::BTM_SUCCESS if the HCI command is issued successful,
* BTM_UNKNOWN_ADDR if bd addr is not active or bad
* BTM_CMD_STORED if the command is stored
*
@@ -322,7 +322,7 @@ tBTM_STATUS BTM_SetSsrParams(const RawAddress& remote_bda, uint16_t max_lat, uin
if (!bluetooth::shim::GetController()->SupportsSniffSubrating()) {
log::info("No controller support for sniff subrating");
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
if (p_cb->state == BTM_PM_ST_ACTIVE || p_cb->state == BTM_PM_ST_SNIFF) {
@@ -331,7 +331,7 @@ tBTM_STATUS BTM_SetSsrParams(const RawAddress& remote_bda, uint16_t max_lat, uin
"min_remote_timeout:0x{:04x} min_local_timeout:0x{:04x}",
power_mode_state_text(p_cb->state), p_cb->state, max_lat, min_rmt_to, min_loc_to);
send_sniff_subrating(p_cb->handle_, remote_bda, max_lat, min_rmt_to, min_loc_to);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
log::info("pm_mode_db state: {}", p_cb->state);
p_cb->max_lat = max_lat;
diff --git a/system/stack/avdt/avdt_l2c.cc b/system/stack/avdt/avdt_l2c.cc
index 8f9a759721..6965625086 100644
--- a/system/stack/avdt/avdt_l2c.cc
+++ b/system/stack/avdt/avdt_l2c.cc
@@ -35,6 +35,7 @@
#include "osi/include/osi.h"
#include "stack/include/acl_api.h"
#include "stack/include/bt_hdr.h"
+#include "stack/include/btm_status.h"
#include "types/raw_address.h"
using namespace bluetooth;
@@ -119,7 +120,7 @@ static void avdt_sec_check_complete_orig(const RawAddress* bd_addr, tBT_TRANSPOR
return;
}
- if (res == BTM_SUCCESS) {
+ if (res == tBTM_STATUS::BTM_SUCCESS) {
/* set channel state */
p_tbl->state = AVDT_AD_ST_CFG;
} else {
@@ -270,7 +271,7 @@ void avdt_l2c_connect_cfm_cback(uint16_t lcid, uint16_t result) {
/* Assume security check is complete */
avdt_sec_check_complete_orig(&p_ccb->peer_addr, BT_TRANSPORT_BR_EDR, nullptr,
- BTM_SUCCESS);
+ tBTM_STATUS::BTM_SUCCESS);
}
}
}
diff --git a/system/stack/btm/btm_ble.cc b/system/stack/btm/btm_ble.cc
index 600d852f2b..3a8d15acc6 100644
--- a/system/stack/btm/btm_ble.cc
+++ b/system/stack/btm/btm_ble.cc
@@ -156,10 +156,7 @@ void read_phy_cb(base::Callback<void(uint8_t tx_phy, uint8_t rx_phy, uint8_t sta
* Description To read the current PHYs for specified LE connection
*
*
- * Returns BTM_SUCCESS if command successfully sent to controller,
- * BTM_MODE_UNSUPPORTED if local controller doesn't support LE
- * 2M or LE Coded PHY,
- * BTM_WRONG_MODE if Device in wrong mode for request.
+ * Returns void
*
******************************************************************************/
void BTM_BleReadPhy(const RawAddress& bd_addr,
diff --git a/system/stack/btm/btm_ble_adv_filter.cc b/system/stack/btm/btm_ble_adv_filter.cc
index afe08ae8ce..1ea86d980c 100644
--- a/system/stack/btm/btm_ble_adv_filter.cc
+++ b/system/stack/btm/btm_ble_adv_filter.cc
@@ -22,11 +22,11 @@
#include <bluetooth/log.h>
#include "btm_ble_api.h"
-#include "os/log.h"
#include "osi/include/allocator.h"
#include "stack/btm/btm_ble_int.h"
#include "stack/btm/btm_int_types.h"
#include "stack/include/bt_types.h"
+#include "stack/include/btm_status.h"
#include "stack/include/btu_hcif.h"
#include "types/bluetooth/uuid.h"
#include "types/raw_address.h"
@@ -140,7 +140,7 @@ static void btm_flt_update_cb(uint8_t expected_ocf, tBTM_BLE_PF_CFG_CBACK cb, ui
return;
}
- tBTM_STATUS btm_status = (status == 0) ? BTM_SUCCESS : BTM_ERR_PROCESSING;
+ tBTM_STATUS btm_status = (status == 0) ? tBTM_STATUS::BTM_SUCCESS : BTM_ERR_PROCESSING;
if (op_subcode == BTM_BLE_META_PF_FEAT_SEL) {
cb.Run(num_avail, static_cast<tBTM_BLE_SCAN_COND_OP>(action), btm_status);
diff --git a/system/stack/btm/btm_ble_gap.cc b/system/stack/btm/btm_ble_gap.cc
index 75570665da..6408c1f3ee 100644
--- a/system/stack/btm/btm_ble_gap.cc
+++ b/system/stack/btm/btm_ble_gap.cc
@@ -61,6 +61,7 @@
#include "stack/include/btm_ble_addr.h"
#include "stack/include/btm_ble_privacy.h"
#include "stack/include/btm_log_history.h"
+#include "stack/include/btm_status.h"
#include "stack/include/gap_api.h"
#include "stack/include/gattdefs.h"
#include "stack/include/hci_error_code.h"
@@ -1005,7 +1006,7 @@ void btm_ble_periodic_adv_sync_established(uint8_t status, uint16_t sync_handle,
/*if (param_len != ADV_SYNC_ESTB_EVT_LEN) {
log::error("[PSync]Invalid event length");
STREAM_TO_UINT8(status, param);
- if (status == BTM_SUCCESS) {
+ if (status == tBTM_STATUS::BTM_SUCCESS) {
STREAM_TO_UINT16(sync_handle, param);
//btsnd_hcic_ble_terminate_periodic_sync(sync_handle);
if (BleScanningManager::IsInitialized()) {
@@ -1303,7 +1304,7 @@ void btm_ble_set_adv_flag(uint16_t connect_mode, uint16_t disc_mode) {
*
* Parameters: combined_mode: discoverability mode.
*
- * Returns BTM_SUCCESS is status set successfully; otherwise failure.
+ * Returns tBTM_STATUS::BTM_SUCCESS is status set successfully; otherwise failure.
*
******************************************************************************/
tBTM_STATUS btm_ble_set_discoverability(uint16_t combined_mode) {
@@ -1311,7 +1312,7 @@ tBTM_STATUS btm_ble_set_discoverability(uint16_t combined_mode) {
uint16_t mode = (combined_mode & BTM_BLE_DISCOVERABLE_MASK);
uint8_t new_mode = BTM_BLE_ADV_ENABLE;
uint8_t evt_type;
- tBTM_STATUS status = BTM_SUCCESS;
+ tBTM_STATUS status = tBTM_STATUS::BTM_SUCCESS;
RawAddress address = RawAddress::kEmpty;
tBLE_ADDR_TYPE init_addr_type = BLE_ADDR_PUBLIC, own_addr_type = p_addr_cb->own_addr_type;
uint16_t adv_int_min, adv_int_max;
@@ -1357,7 +1358,7 @@ tBTM_STATUS btm_ble_set_discoverability(uint16_t combined_mode) {
}
}
- if (status == BTM_SUCCESS && btm_cb.ble_ctr_cb.inq_var.adv_mode != new_mode) {
+ if (status == tBTM_STATUS::BTM_SUCCESS && btm_cb.ble_ctr_cb.inq_var.adv_mode != new_mode) {
if (new_mode == BTM_BLE_ADV_ENABLE) {
status = btm_ble_start_adv();
} else {
@@ -1373,7 +1374,7 @@ tBTM_STATUS btm_ble_set_discoverability(uint16_t combined_mode) {
}
/* set up stop advertising timer */
- if (status == BTM_SUCCESS && mode == BTM_BLE_LIMITED_DISCOVERABLE) {
+ if (status == tBTM_STATUS::BTM_SUCCESS && mode == BTM_BLE_LIMITED_DISCOVERABLE) {
log::verbose("start timer for limited disc mode duration={} ms", BTM_BLE_GAP_LIM_TIMEOUT_MS);
/* start Tgap(lim_timeout) */
alarm_set_on_mloop(btm_cb.ble_ctr_cb.inq_var.inquiry_timer, BTM_BLE_GAP_LIM_TIMEOUT_MS,
@@ -1390,7 +1391,7 @@ tBTM_STATUS btm_ble_set_discoverability(uint16_t combined_mode) {
*
* Parameters: combined_mode: connectability mode.
*
- * Returns BTM_SUCCESS is status set successfully; otherwise failure.
+ * Returns tBTM_STATUS::BTM_SUCCESS is status set successfully; otherwise failure.
*
******************************************************************************/
tBTM_STATUS btm_ble_set_connectability(uint16_t combined_mode) {
@@ -1398,7 +1399,7 @@ tBTM_STATUS btm_ble_set_connectability(uint16_t combined_mode) {
uint16_t mode = (combined_mode & BTM_BLE_CONNECTABLE_MASK);
uint8_t new_mode = BTM_BLE_ADV_ENABLE;
uint8_t evt_type;
- tBTM_STATUS status = BTM_SUCCESS;
+ tBTM_STATUS status = tBTM_STATUS::BTM_SUCCESS;
RawAddress address = RawAddress::kEmpty;
tBLE_ADDR_TYPE peer_addr_type = BLE_ADDR_PUBLIC, own_addr_type = p_addr_cb->own_addr_type;
uint16_t adv_int_min, adv_int_max;
@@ -1439,7 +1440,7 @@ tBTM_STATUS btm_ble_set_connectability(uint16_t combined_mode) {
}
/* update advertising mode */
- if (status == BTM_SUCCESS && new_mode != btm_cb.ble_ctr_cb.inq_var.adv_mode) {
+ if (status == tBTM_STATUS::BTM_SUCCESS && new_mode != btm_cb.ble_ctr_cb.inq_var.adv_mode) {
if (new_mode == BTM_BLE_ADV_ENABLE) {
status = btm_ble_start_adv();
} else {
@@ -1489,7 +1490,7 @@ void btm_send_hci_set_scan_params(uint8_t scan_type, uint16_t scan_int, uint16_t
static void btm_ble_scan_filt_param_cfg_evt(uint8_t /* avbl_space */,
tBTM_BLE_SCAN_COND_OP /* action_type */,
tBTM_STATUS btm_status) {
- if (btm_status != BTM_SUCCESS) {
+ if (btm_status != tBTM_STATUS::BTM_SUCCESS) {
log::error("{}", btm_status_text(btm_status));
} else {
log::verbose("");
@@ -2504,7 +2505,7 @@ static tBTM_STATUS btm_ble_start_adv(void) {
btm_ble_adv_states_operation(btm_ble_set_topology_mask, btm_cb.ble_ctr_cb.inq_var.evt_type);
power_telemetry::GetInstance().LogBleAdvStarted();
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
/*******************************************************************************
@@ -2526,7 +2527,7 @@ static tBTM_STATUS btm_ble_stop_adv(void) {
btm_ble_clear_topology_mask(BTM_BLE_STATE_ALL_ADV_MASK);
power_telemetry::GetInstance().LogBleAdvStopped();
}
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
static void btm_ble_fast_adv_timer_timeout(void* /* data */) {
diff --git a/system/stack/btm/btm_ble_sec.cc b/system/stack/btm/btm_ble_sec.cc
index 8ae50c60d7..3da5926acc 100644
--- a/system/stack/btm/btm_ble_sec.cc
+++ b/system/stack/btm/btm_ble_sec.cc
@@ -230,7 +230,7 @@ const Octet16& BTM_GetDeviceDHK() { return btm_sec_cb.devcb.id_keys.dhk; }
* Description This function is called to grant security process.
*
* Parameters bd_addr - peer device bd address.
- * res - result of the operation BTM_SUCCESS if success.
+ * res - result of the operation tBTM_STATUS::BTM_SUCCESS if success.
* Otherwise, BTM_REPEATED_ATTEMPTS if too many
* attempts.
*
@@ -238,7 +238,8 @@ const Octet16& BTM_GetDeviceDHK() { return btm_sec_cb.devcb.id_keys.dhk; }
*
******************************************************************************/
void BTM_SecurityGrant(const RawAddress& bd_addr, tBTM_STATUS res) {
- const tSMP_STATUS res_smp = (res == BTM_SUCCESS) ? SMP_SUCCESS : SMP_REPEATED_ATTEMPTS;
+ const tSMP_STATUS res_smp =
+ (res == tBTM_STATUS::BTM_SUCCESS) ? SMP_SUCCESS : SMP_REPEATED_ATTEMPTS;
log::verbose("bd_addr:{}, res:{}", bd_addr, smp_status_text(res_smp));
BTM_LogHistory(kBtmLogTag, bd_addr, "Granted",
base::StringPrintf("passkey_status:%s", smp_status_text(res_smp).c_str()));
@@ -255,7 +256,7 @@ void BTM_SecurityGrant(const RawAddress& bd_addr, tBTM_STATUS res) {
*
* Parameters: bd_addr - Address of the device for which passkey was
* requested
- * res - result of the operation BTM_SUCCESS if success
+ * res - result of the operation tBTM_STATUS::BTM_SUCCESS if success
* key_len - length in bytes of the Passkey
* p_passkey - pointer to array with the passkey
*
@@ -268,7 +269,8 @@ void BTM_BlePasskeyReply(const RawAddress& bd_addr, tBTM_STATUS res, uint32_t pa
return;
}
- const tSMP_STATUS res_smp = (res == BTM_SUCCESS) ? SMP_SUCCESS : SMP_PASSKEY_ENTRY_FAIL;
+ const tSMP_STATUS res_smp =
+ (res == tBTM_STATUS::BTM_SUCCESS) ? SMP_SUCCESS : SMP_PASSKEY_ENTRY_FAIL;
BTM_LogHistory(kBtmLogTag, bd_addr, "Passkey reply",
base::StringPrintf("transport:%s authenticate_status:%s",
bt_transport_text(BT_TRANSPORT_LE).c_str(),
@@ -287,7 +289,7 @@ void BTM_BlePasskeyReply(const RawAddress& bd_addr, tBTM_STATUS res, uint32_t pa
*
* Parameters: bd_addr - Address of the device with which numeric
* comparison was requested
- * res - comparison result BTM_SUCCESS if success
+ * res - comparison result tBTM_STATUS::BTM_SUCCESS if success
*
******************************************************************************/
void BTM_BleConfirmReply(const RawAddress& bd_addr, tBTM_STATUS res) {
@@ -297,7 +299,8 @@ void BTM_BleConfirmReply(const RawAddress& bd_addr, tBTM_STATUS res) {
log::error("Unknown device:{}", bd_addr);
return;
}
- const tSMP_STATUS res_smp = (res == BTM_SUCCESS) ? SMP_SUCCESS : SMP_PASSKEY_ENTRY_FAIL;
+ const tSMP_STATUS res_smp =
+ (res == tBTM_STATUS::BTM_SUCCESS) ? SMP_SUCCESS : SMP_PASSKEY_ENTRY_FAIL;
BTM_LogHistory(kBtmLogTag, bd_addr, "Confirm reply",
base::StringPrintf("transport:%s numeric_comparison_authenticate_status:%s",
@@ -330,7 +333,7 @@ void BTM_BleOobDataReply(const RawAddress& bd_addr, tBTM_STATUS res, uint8_t len
return;
}
- const tSMP_STATUS res_smp = (res == BTM_SUCCESS) ? SMP_SUCCESS : SMP_OOB_FAIL;
+ const tSMP_STATUS res_smp = (res == tBTM_STATUS::BTM_SUCCESS) ? SMP_SUCCESS : SMP_OOB_FAIL;
BTM_LogHistory(kBtmLogTag, bd_addr, "Oob data reply",
base::StringPrintf("transport:%s authenticate_status:%s",
bt_transport_text(BT_TRANSPORT_LE).c_str(),
@@ -579,7 +582,7 @@ tBTM_STATUS BTM_SetBleDataLength(const RawAddress& bd_addr, uint16_t tx_pdu_leng
if (p_dev_rec->get_suggested_tx_octets() >= tx_pdu_length) {
log::info("Suggested TX octect already set to controller {} >= {}",
p_dev_rec->get_suggested_tx_octets(), tx_pdu_length);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
uint16_t tx_time = BTM_BLE_DATA_TX_TIME_MAX_LEGACY;
@@ -612,7 +615,7 @@ tBTM_STATUS BTM_SetBleDataLength(const RawAddress& bd_addr, uint16_t tx_pdu_leng
btsnd_hcic_ble_set_data_length(hci_handle, tx_pdu_length, tx_time);
p_dev_rec->set_suggested_tx_octect(tx_pdu_length);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
/*******************************************************************************
@@ -747,7 +750,7 @@ tBTM_STATUS btm_ble_start_sec_check(const RawAddress& bd_addr, uint16_t psm, boo
switch (sec_act) {
case BTM_SEC_OK:
log::debug("Security met");
- p_callback(bd_addr, BT_TRANSPORT_LE, p_ref_data, BTM_SUCCESS);
+ p_callback(bd_addr, BT_TRANSPORT_LE, p_ref_data, tBTM_STATUS::BTM_SUCCESS);
break;
case BTM_SEC_ENCRYPT:
@@ -771,14 +774,14 @@ tBTM_STATUS btm_ble_start_sec_check(const RawAddress& bd_addr, uint16_t psm, boo
}
if (ble_sec_act == BTM_BLE_SEC_NONE && sec_act != BTM_SEC_ENC_PENDING) {
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
l2cble_update_sec_act(bd_addr, sec_act);
BTM_SetEncryption(bd_addr, BT_TRANSPORT_LE, p_callback, p_ref_data, ble_sec_act);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
/*******************************************************************************
@@ -1134,7 +1137,7 @@ tBTM_STATUS btm_ble_set_encryption(const RawAddress& bd_addr, tBTM_BLE_SEC_ACT s
btm_ble_link_sec_check(bd_addr, auth_req, &sec_req_act);
if (sec_req_act == BTM_BLE_SEC_REQ_ACT_NONE || sec_req_act == BTM_BLE_SEC_REQ_ACT_DISCARD) {
log::verbose("no action needed. Ignore");
- cmd = BTM_SUCCESS;
+ cmd = tBTM_STATUS::BTM_SUCCESS;
break;
}
if (link_role == HCI_ROLE_CENTRAL) {
@@ -1186,7 +1189,7 @@ void btm_ble_ltk_request(uint16_t handle, BT_OCTET8 rand, uint16_t ediv) {
}
/** This function is called to start LE encryption.
- * Returns BTM_SUCCESS if encryption was started successfully
+ * Returns tBTM_STATUS::BTM_SUCCESS if encryption was started successfully
*/
tBTM_STATUS btm_ble_start_encrypt(const RawAddress& bda, bool use_stk, Octet16* p_stk) {
tBTM_SEC_CB* p_cb = &btm_sec_cb;
@@ -1298,7 +1301,7 @@ void btm_ble_link_encrypted(const RawAddress& bd_addr, uint8_t encr_enable) {
p_dev_rec->sec_rec.le_link = tSECURITY_STATE::IDLE;
if (p_dev_rec->sec_rec.p_callback && enc_cback) {
if (encr_enable) {
- btm_sec_dev_rec_cback_event(p_dev_rec, BTM_SUCCESS, true);
+ btm_sec_dev_rec_cback_event(p_dev_rec, tBTM_STATUS::BTM_SUCCESS, true);
}
/* LTK missing on peripheral */
else if (p_dev_rec->role_central && (p_dev_rec->sec_rec.sec_status == HCI_ERR_KEY_MISSING)) {
@@ -1399,7 +1402,7 @@ static tBTM_STATUS btm_ble_io_capabilities_req(tBTM_SEC_DEV_REC* p_dev_rec,
callback_rc = (*btm_sec_cb.api.p_le_callback)(BTM_LE_IO_REQ_EVT, p_dev_rec->bd_addr,
(tBTM_LE_EVT_DATA*)p_data);
}
- if ((callback_rc == BTM_SUCCESS) || (BTM_OOB_UNKNOWN != p_data->oob_data)) {
+ if ((callback_rc == tBTM_STATUS::BTM_SUCCESS) || (BTM_OOB_UNKNOWN != p_data->oob_data)) {
p_data->auth_req &= BTM_LE_AUTH_REQ_MASK;
log::verbose("1:p_dev_rec->sec_rec.security_required={}, auth_req:{}",
@@ -1455,7 +1458,7 @@ static tBTM_STATUS btm_ble_io_capabilities_req(tBTM_SEC_DEV_REC* p_dev_rec,
*
******************************************************************************/
static tBTM_STATUS btm_ble_br_keys_req(tBTM_SEC_DEV_REC* p_dev_rec, tBTM_LE_IO_REQ* p_data) {
- tBTM_STATUS callback_rc = BTM_SUCCESS;
+ tBTM_STATUS callback_rc = tBTM_STATUS::BTM_SUCCESS;
log::verbose("p_dev_rec->bd_addr:{}", p_dev_rec->bd_addr);
*p_data = tBTM_LE_IO_REQ{
.io_cap = BTM_IO_CAP_UNKNOWN,
@@ -1526,11 +1529,11 @@ tBTM_STATUS btm_proc_smp_cback(tSMP_EVT event, const RawAddress& bd_addr,
if (event == SMP_SC_LOC_OOB_DATA_UP_EVT) {
btm_sec_cr_loc_oob_data_cback_event(RawAddress{}, p_data->loc_oob_data);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(bd_addr);
- tBTM_STATUS res = BTM_SUCCESS;
+ tBTM_STATUS res = tBTM_STATUS::BTM_SUCCESS;
if (p_dev_rec != NULL) {
switch (event) {
@@ -1576,22 +1579,23 @@ tBTM_STATUS btm_proc_smp_cback(tSMP_EVT event, const RawAddress& bd_addr,
p_dev_rec = btm_find_dev(bd_addr);
if (p_dev_rec == NULL) {
log::error("p_dev_rec is NULL");
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
log::verbose("before update sec_level=0x{:x} sec_flags=0x{:x}", p_data->cmplt.sec_level,
p_dev_rec->sec_rec.sec_flags);
- res = (p_data->cmplt.reason == SMP_SUCCESS) ? BTM_SUCCESS : BTM_ERR_PROCESSING;
+ res = (p_data->cmplt.reason == SMP_SUCCESS) ? tBTM_STATUS::BTM_SUCCESS
+ : BTM_ERR_PROCESSING;
log::verbose("after update result={} sec_level=0x{:x} sec_flags=0x{:x}", res,
p_data->cmplt.sec_level, p_dev_rec->sec_rec.sec_flags);
if (p_data->cmplt.is_pair_cancel && btm_sec_cb.api.p_bond_cancel_cmpl_callback) {
log::verbose("Pairing Cancel completed");
- (*btm_sec_cb.api.p_bond_cancel_cmpl_callback)(BTM_SUCCESS);
+ (*btm_sec_cb.api.p_bond_cancel_cmpl_callback)(tBTM_STATUS::BTM_SUCCESS);
}
- if (res != BTM_SUCCESS && p_data->cmplt.reason != SMP_CONN_TOUT) {
+ if (res != tBTM_STATUS::BTM_SUCCESS && p_data->cmplt.reason != SMP_CONN_TOUT) {
log::verbose("Pairing failed - prepare to remove ACL");
l2cu_start_post_bond_timer(p_dev_rec->ble_hci_handle);
}
@@ -1609,7 +1613,7 @@ tBTM_STATUS btm_proc_smp_cback(tSMP_EVT event, const RawAddress& bd_addr,
btm_sec_cb.pairing_flags = 0;
}
- if (res == BTM_SUCCESS) {
+ if (res == tBTM_STATUS::BTM_SUCCESS) {
p_dev_rec->sec_rec.le_link = tSECURITY_STATE::IDLE;
if (p_dev_rec->sec_rec.bond_type != BOND_TYPE_TEMPORARY) {
@@ -1663,7 +1667,7 @@ tBTM_STATUS btm_proc_smp_cback(tSMP_EVT event, const RawAddress& bd_addr,
log::warn("Unexpected event '{}' for unknown device.", smp_evt_to_text(event));
}
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
/*******************************************************************************
@@ -1764,14 +1768,14 @@ bool BTM_BleVerifySignature(const RawAddress& bd_addr, uint8_t* p_orig, uint16_t
* Description This procedure confirms requested to validate set device.
*
* Parameter bd_addr - BD address of the peer
- * res - confirmation result BTM_SUCCESS if success
+ * res - confirmation result tBTM_STATUS::BTM_SUCCESS if success
*
* Returns void
*
******************************************************************************/
void BTM_BleSirkConfirmDeviceReply(const RawAddress& bd_addr, tBTM_STATUS res) {
tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(bd_addr);
- tSMP_STATUS res_smp = (res == BTM_SUCCESS) ? SMP_SUCCESS : SMP_FAIL;
+ tSMP_STATUS res_smp = (res == tBTM_STATUS::BTM_SUCCESS) ? SMP_SUCCESS : SMP_FAIL;
log::info("bd_addr:{}, result:{}", bd_addr, smp_status_text(res_smp));
diff --git a/system/stack/btm/btm_devctl.cc b/system/stack/btm/btm_devctl.cc
index 034ed48e03..a6fa4d1e91 100644
--- a/system/stack/btm/btm_devctl.cc
+++ b/system/stack/btm/btm_devctl.cc
@@ -45,6 +45,7 @@
#include "stack/include/btm_api.h"
#include "stack/include/btm_ble_privacy.h"
#include "stack/include/btm_inq.h"
+#include "stack/include/btm_status.h"
#include "stack/include/hcidefs.h"
#include "stack/include/l2cap_controller_interface.h"
#include "types/raw_address.h"
@@ -302,11 +303,11 @@ static void decode_controller_support() {
if (bluetooth::shim::GetController()->SupportsRssiWithInquiryResults()) {
if (bluetooth::shim::GetController()->SupportsExtendedInquiryResponse()) {
- if (BTM_SetInquiryMode(BTM_INQ_RESULT_EXTENDED) != BTM_SUCCESS) {
+ if (BTM_SetInquiryMode(BTM_INQ_RESULT_EXTENDED) != tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to set inquiry mode BTM_INQ_RESULT_EXTENDED");
}
} else {
- if (BTM_SetInquiryMode(BTM_INQ_RESULT_WITH_RSSI) != BTM_SUCCESS) {
+ if (BTM_SetInquiryMode(BTM_INQ_RESULT_WITH_RSSI) != tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to set inquiry mode BTM_INQ_RESULT_WITH_RSSI");
}
}
@@ -349,7 +350,7 @@ tBTM_STATUS BTM_SetLocalDeviceName(const char* p_name) {
* Description This function is called to read the local device name.
*
* Returns status of the operation
- * If success, BTM_SUCCESS is returned and p_name points stored
+ * If success, tBTM_STATUS::BTM_SUCCESS is returned and p_name points stored
* local device name
* If BTM doesn't store local device name, BTM_NO_RESOURCES is
* is returned and p_name is set to NULL
@@ -357,7 +358,7 @@ tBTM_STATUS BTM_SetLocalDeviceName(const char* p_name) {
******************************************************************************/
tBTM_STATUS BTM_ReadLocalDeviceName(const char** p_name) {
*p_name = (const char*)btm_sec_cb.cfg.bd_name;
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
/*******************************************************************************
@@ -427,7 +428,7 @@ void btm_read_local_name_complete(uint8_t* p, uint16_t /* evt_len */) {
******************************************************************************/
tBTM_STATUS BTM_SetDeviceClass(DEV_CLASS dev_class) {
if (btm_cb.devcb.dev_class == dev_class) {
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
btm_cb.devcb.dev_class = dev_class;
@@ -438,7 +439,7 @@ tBTM_STATUS BTM_SetDeviceClass(DEV_CLASS dev_class) {
btsnd_hcic_write_dev_class(dev_class);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
/*******************************************************************************
@@ -509,7 +510,7 @@ void BTM_WriteVoiceSettings(uint16_t settings) {
* resetting the controller.
*
* Returns
- * BTM_SUCCESS Command sent.
+ * tBTM_STATUS::BTM_SUCCESS Command sent.
* BTM_NO_RESOURCES If out of resources to send the command.
*
*
@@ -526,12 +527,12 @@ tBTM_STATUS BTM_EnableTestMode(void) {
sizeof(cond));
/* put device to connectable mode */
- if (BTM_SetConnectability(BTM_CONNECTABLE) != BTM_SUCCESS) {
+ if (BTM_SetConnectability(BTM_CONNECTABLE) != tBTM_STATUS::BTM_SUCCESS) {
return BTM_NO_RESOURCES;
}
/* put device to discoverable mode */
- if (BTM_SetDiscoverability(BTM_GENERAL_DISCOVERABLE) != BTM_SUCCESS) {
+ if (BTM_SetDiscoverability(BTM_GENERAL_DISCOVERABLE) != tBTM_STATUS::BTM_SUCCESS) {
return BTM_NO_RESOURCES;
}
@@ -540,7 +541,7 @@ tBTM_STATUS BTM_EnableTestMode(void) {
/* Send the HCI command */
btsnd_hcic_enable_test_mode();
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
/*******************************************************************************
@@ -582,7 +583,7 @@ tBTM_STATUS BTM_DeleteStoredLinkKey(const RawAddress* bd_addr, tBTM_CMPL_CB* p_c
}
#endif
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
/*******************************************************************************
diff --git a/system/stack/btm/btm_inq.cc b/system/stack/btm/btm_inq.cc
index 6ae88a5750..4c3b619388 100644
--- a/system/stack/btm/btm_inq.cc
+++ b/system/stack/btm/btm_inq.cc
@@ -60,6 +60,7 @@
#include "stack/include/bt_uuid16.h"
#include "stack/include/btm_client_interface.h"
#include "stack/include/btm_log_history.h"
+#include "stack/include/btm_status.h"
#include "stack/include/hci_error_code.h"
#include "stack/include/hcidefs.h"
#include "stack/include/hcimsgs.h"
@@ -256,7 +257,7 @@ static bool is_inquery_by_rssi() { return osi_property_get_bool(PROPERTY_INQ_BY_
* scans are enabled. If a value of '0' is entered for window
* or interval, the default values are used.
*
- * Returns BTM_SUCCESS if successful
+ * Returns tBTM_STATUS::BTM_SUCCESS if successful
* BTM_BUSY if a setting of the filter is already in progress
* BTM_NO_RESOURCES if couldn't get a memory pool buffer
* BTM_ILLEGAL_VALUE if a bad parameter was detected
@@ -274,7 +275,7 @@ tBTM_STATUS BTM_SetDiscoverability(uint16_t inq_mode) {
log::verbose("");
if (bluetooth::shim::GetController()->SupportsBle()) {
- if (btm_ble_set_discoverability((uint16_t)(inq_mode)) == BTM_SUCCESS) {
+ if (btm_ble_set_discoverability((uint16_t)(inq_mode)) == tBTM_STATUS::BTM_SUCCESS) {
btm_cb.btm_inq_vars.discoverable_mode &= (~BTM_BLE_DISCOVERABLE_MASK);
btm_cb.btm_inq_vars.discoverable_mode |= (inq_mode & BTM_BLE_DISCOVERABLE_MASK);
}
@@ -345,7 +346,7 @@ tBTM_STATUS BTM_SetDiscoverability(uint16_t inq_mode) {
(void)get_btm_client_interface().local.BTM_SetDeviceClass(cod);
}
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
void BTM_EnableInterlacedInquiryScan() {
@@ -400,7 +401,7 @@ void BTM_EnableInterlacedPageScan() {
*
* Output Params: mode - standard, with RSSI, extended
*
- * Returns BTM_SUCCESS if successful
+ * Returns tBTM_STATUS::BTM_SUCCESS if successful
* BTM_NO_RESOURCES if couldn't get a memory pool buffer
* BTM_ILLEGAL_VALUE if a bad parameter was detected
* BTM_WRONG_MODE if the device is not up.
@@ -428,7 +429,7 @@ tBTM_STATUS BTM_SetInquiryMode(uint8_t mode) {
btsnd_hcic_write_inquiry_mode(mode);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
/*******************************************************************************
@@ -439,7 +440,7 @@ tBTM_STATUS BTM_SetInquiryMode(uint8_t mode) {
* connectable mode. Discoverable mode means page scans are
* enabled.
*
- * Returns BTM_SUCCESS if successful
+ * Returns tBTM_STATUS::BTM_SUCCESS if successful
* BTM_ILLEGAL_VALUE if a bad parameter is detected
* BTM_NO_RESOURCES if could not allocate a message buffer
* BTM_WRONG_MODE if the device is not up.
@@ -449,7 +450,7 @@ tBTM_STATUS BTM_SetConnectability(uint16_t page_mode) {
uint8_t scan_mode = 0;
if (bluetooth::shim::GetController()->SupportsBle()) {
- if (btm_ble_set_connectability(page_mode) != BTM_SUCCESS) {
+ if (btm_ble_set_connectability(page_mode) != tBTM_STATUS::BTM_SUCCESS) {
return BTM_NO_RESOURCES;
}
btm_cb.btm_inq_vars.connectable_mode &= (~BTM_BLE_CONNECTABLE_MASK);
@@ -491,7 +492,7 @@ tBTM_STATUS BTM_SetConnectability(uint16_t page_mode) {
btsnd_hcic_write_scan_enable(scan_mode);
btm_cb.btm_inq_vars.connectable_mode &= (~BTM_CONNECTABLE_MASK);
btm_cb.btm_inq_vars.connectable_mode |= page_mode;
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
/*******************************************************************************
@@ -862,7 +863,7 @@ tBTM_INQ_INFO* BTM_InqDbNext(tBTM_INQ_INFO* p_cur) {
* (NULL clears all entries)
*
* Returns BTM_BUSY if an inquiry, get remote name, or event filter
- * is active, otherwise BTM_SUCCESS
+ * is active, otherwise tBTM_STATUS::BTM_SUCCESS
*
******************************************************************************/
tBTM_STATUS BTM_ClearInqDb(const RawAddress* p_bda) {
@@ -873,7 +874,7 @@ tBTM_STATUS BTM_ClearInqDb(const RawAddress* p_bda) {
btm_clr_inq_db(p_bda);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
/*******************************************************************************
@@ -1738,7 +1739,7 @@ static void btm_process_cancel_complete(tHCI_STATUS status, uint8_t mode) {
* Parameters p_buff - allocated HCI command buffer including extended
* inquriry response
*
- * Returns BTM_SUCCESS - if successful
+ * Returns tBTM_STATUS::BTM_SUCCESS - if successful
* BTM_MODE_UNSUPPORTED - if local device cannot support it
*
******************************************************************************/
@@ -1746,7 +1747,7 @@ tBTM_STATUS BTM_WriteEIR(BT_HDR* p_buff) {
if (bluetooth::shim::GetController()->SupportsExtendedInquiryResponse()) {
log::verbose("Write Extended Inquiry Response to controller");
btsnd_hcic_write_ext_inquiry_response(p_buff, TRUE);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
} else {
osi_free(p_buff);
return BTM_MODE_UNSUPPORTED;
diff --git a/system/stack/btm/btm_sco.cc b/system/stack/btm/btm_sco.cc
index 9d9d239906..8e5dda65c9 100644
--- a/system/stack/btm/btm_sco.cc
+++ b/system/stack/btm/btm_sco.cc
@@ -56,6 +56,7 @@
#include "stack/include/btm_api_types.h"
#include "stack/include/btm_client_interface.h"
#include "stack/include/btm_log_history.h"
+#include "stack/include/btm_status.h"
#include "stack/include/hci_error_code.h"
#include "stack/include/hcimsgs.h"
#include "stack/include/main_thread.h"
@@ -912,7 +913,7 @@ void btm_sco_disc_chk_pend_for_modechange(uint16_t hci_handle) {
{
log::debug("Removing SCO Link handle 0x{:04x}", p->hci_handle);
- if (get_btm_client_interface().sco.BTM_RemoveSco(xx) != BTM_SUCCESS) {
+ if (get_btm_client_interface().sco.BTM_RemoveSco(xx) != tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to remove SCO link:{}", xx);
}
}
@@ -1156,7 +1157,7 @@ tBTM_STATUS BTM_RemoveSco(uint16_t sco_inx) {
p->hci_handle = HCI_INVALID_HANDLE;
p->state = SCO_ST_UNUSED;
p->esco.p_esco_cback = NULL; /* Deregister the eSCO event callback */
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
if (BTM_ReadPowerMode(p->esco.data.bd_addr, &state) && (state == BTM_PM_ST_PENDING)) {
@@ -1183,7 +1184,7 @@ void BTM_RemoveScoByBdaddr(const RawAddress& bda) {
for (xx = 0; xx < BTM_MAX_SCO_LINKS; xx++, p++) {
if (p->rem_bd_known && p->esco.data.bd_addr == bda) {
- if (get_btm_client_interface().sco.BTM_RemoveSco(xx) != BTM_SUCCESS) {
+ if (get_btm_client_interface().sco.BTM_RemoveSco(xx) != tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to remove SCO link:{}", xx);
}
}
@@ -1358,7 +1359,7 @@ const RawAddress* BTM_ReadScoBdAddr(uint16_t sco_inx) {
* desired the feature should be disabled in the
* controller's feature mask.
*
- * Returns BTM_SUCCESS if the successful.
+ * Returns tBTM_STATUS::BTM_SUCCESS if the successful.
* BTM_BUSY if there are one or more active (e)SCO links.
*
******************************************************************************/
@@ -1383,7 +1384,7 @@ tBTM_STATUS BTM_SetEScoMode(enh_esco_params_t* p_parms) {
p_def->transmit_bandwidth, p_def->receive_bandwidth, p_def->max_latency_ms,
p_def->packet_types, p_def->retransmission_effort);
}
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
/*******************************************************************************
@@ -1395,7 +1396,7 @@ tBTM_STATUS BTM_SetEScoMode(enh_esco_params_t* p_parms) {
* connection indication events and change of link parameter
* events.
*
- * Returns BTM_SUCCESS if the successful.
+ * Returns tBTM_STATUS::BTM_SUCCESS if the successful.
* BTM_ILLEGAL_VALUE if there is an illegal sco_inx
* BTM_MODE_UNSUPPORTED if controller version is not BT1.2 or
* later or does not support eSCO.
@@ -1413,7 +1414,7 @@ tBTM_STATUS BTM_RegForEScoEvts(uint16_t sco_inx, tBTM_ESCO_CBACK* p_esco_cback)
if (sco_inx < BTM_MAX_SCO_LINKS && btm_cb.sco_cb.sco_db[sco_inx].state != SCO_ST_UNUSED) {
btm_cb.sco_cb.sco_db[sco_inx].esco.p_esco_cback = p_esco_cback;
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
return BTM_ILLEGAL_VALUE;
}
diff --git a/system/stack/btm/btm_sec.cc b/system/stack/btm/btm_sec.cc
index b62bf69d65..ad792eaca7 100644
--- a/system/stack/btm/btm_sec.cc
+++ b/system/stack/btm/btm_sec.cc
@@ -175,7 +175,7 @@ static bool handleUnexpectedEncryptionChange() {
void NotifyBondingCanceled(tBTM_STATUS /* btm_status */) {
if (btm_sec_cb.api.p_bond_cancel_cmpl_callback) {
- btm_sec_cb.api.p_bond_cancel_cmpl_callback(BTM_SUCCESS);
+ btm_sec_cb.api.p_bond_cancel_cmpl_callback(tBTM_STATUS::BTM_SUCCESS);
}
}
@@ -534,7 +534,7 @@ uint8_t BTM_SecClrServiceByPsm(uint16_t psm) { return btm_sec_cb.RemoveServiceBy
*
* Parameters: bd_addr - Address of the device for which PIN was
* requested
- * res - result of the operation BTM_SUCCESS
+ * res - result of the operation tBTM_STATUS::BTM_SUCCESS
* if success
* pin_len - length in bytes of the PIN Code
* p_pin - pointer to array with the PIN Code
@@ -570,7 +570,7 @@ void BTM_PINCodeReply(const RawAddress& bd_addr, tBTM_STATUS res, uint8_t pin_le
res = BTM_ILLEGAL_VALUE;
}
- if (res != BTM_SUCCESS) {
+ if (res != tBTM_STATUS::BTM_SUCCESS) {
/* if peer started dd OR we started dd and pre-fetch pin was not used send
* negative reply */
if ((btm_sec_cb.pairing_flags & BTM_PAIR_FLAGS_PEER_STARTED_DD) ||
@@ -682,11 +682,11 @@ tBTM_STATUS btm_sec_bond_by_transport(const RawAddress& bd_addr, tBLE_ADDR_TYPE
((p_dev_rec->ble_hci_handle != HCI_INVALID_HANDLE) && transport == BT_TRANSPORT_LE &&
(p_dev_rec->sec_rec.sec_flags & BTM_SEC_LE_AUTHENTICATED))) {
log::warn("BTM_SecBond -> Already Paired");
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
/* Tell controller to get rid of the link key if it has one stored */
- if ((BTM_DeleteStoredLinkKey(&bd_addr, NULL)) != BTM_SUCCESS) {
+ if ((BTM_DeleteStoredLinkKey(&bd_addr, NULL)) != tBTM_STATUS::BTM_SUCCESS) {
log::error("Failed to delete stored link keys");
return BTM_NO_RESOURCES;
}
@@ -797,7 +797,7 @@ tBTM_STATUS btm_sec_bond_by_transport(const RawAddress& bd_addr, tBLE_ADDR_TYPE
*
* Description This function is called to perform bonding with peer device.
* If the connection is already up, but not secure, pairing
- * is attempted. If already paired BTM_SUCCESS is returned.
+ * is attempted. If already paired tBTM_STATUS::BTM_SUCCESS is returned.
*
* Parameters: bd_addr - Address of the device to bond
* transport - doing SSP over BR/EDR or SMP over LE
@@ -867,7 +867,7 @@ tBTM_STATUS BTM_SecBondCancel(const RawAddress& bd_addr) {
BTM_PAIR_FLAGS_WE_STARTED_DD & btm_sec_cb.pairing_flags) {
/* pre-fetching pin for dedicated bonding */
btm_sec_bond_cancel_complete();
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
/* If this BDA is in a bonding procedure */
@@ -897,7 +897,8 @@ tBTM_STATUS BTM_SecBondCancel(const RawAddress& bd_addr) {
return BTM_CMD_STARTED;
}
if (btm_sec_cb.pairing_state == BTM_PAIR_STATE_GET_REM_NAME) {
- if (get_btm_client_interface().peer.BTM_CancelRemoteDeviceName() != BTM_SUCCESS) {
+ if (get_btm_client_interface().peer.BTM_CancelRemoteDeviceName() !=
+ tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to cancel RNR");
}
btm_sec_cb.pairing_flags |= BTM_PAIR_FLAGS_WE_CANCEL_DD;
@@ -916,7 +917,7 @@ tBTM_STATUS BTM_SecBondCancel(const RawAddress& bd_addr) {
*
* Description This function is called to obtain link key type for the
* device.
- * it returns BTM_SUCCESS if link key is available, or
+ * it returns tBTM_STATUS::BTM_SUCCESS if link key is available, or
* BTM_UNKNOWN_ADDR if Security Manager does not know about
* the device or device record does not contain link key info
*
@@ -952,7 +953,7 @@ tBTM_LINK_KEY_TYPE BTM_SecGetDeviceLinkKeyType(const RawAddress& bd_addr) {
* completion. can be set to NULL if not used.
* sec_act - LE security action, unused for BR/EDR
*
- * Returns BTM_SUCCESS - already encrypted
+ * Returns tBTM_STATUS::BTM_SUCCESS - already encrypted
* BTM_PENDING - command will be returned in the callback
* BTM_WRONG_MODE- connection not up.
* BTM_BUSY - security procedures are currently active
@@ -987,10 +988,10 @@ tBTM_STATUS BTM_SetEncryption(const RawAddress& bd_addr, tBT_TRANSPORT transport
"transport:{}",
bd_addr, bt_transport_text(transport));
if (p_callback) {
- do_in_main_thread(
- base::BindOnce(p_callback, bd_addr, transport, p_ref_data, BTM_SUCCESS));
+ do_in_main_thread(base::BindOnce(p_callback, bd_addr, transport, p_ref_data,
+ tBTM_STATUS::BTM_SUCCESS));
}
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
break;
@@ -1012,10 +1013,10 @@ tBTM_STATUS BTM_SetEncryption(const RawAddress& bd_addr, tBT_TRANSPORT transport
"transport:{}",
bd_addr, bt_transport_text(transport));
if (p_callback) {
- do_in_main_thread(
- base::BindOnce(p_callback, bd_addr, transport, p_ref_data, BTM_SUCCESS));
+ do_in_main_thread(base::BindOnce(p_callback, bd_addr, transport, p_ref_data,
+ tBTM_STATUS::BTM_SUCCESS));
}
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
break;
@@ -1049,7 +1050,7 @@ tBTM_STATUS BTM_SetEncryption(const RawAddress& bd_addr, tBT_TRANSPORT transport
p_dev_rec->sec_rec.classic_link, p_dev_rec->sec_rec.sec_flags,
p_dev_rec->sec_rec.security_required, (p_callback) ? 'T' : 'F');
- tBTM_STATUS rc = BTM_SUCCESS;
+ tBTM_STATUS rc = tBTM_STATUS::BTM_SUCCESS;
switch (transport) {
case BT_TRANSPORT_LE:
if (get_btm_client_interface().peer.BTM_IsAclConnectionUp(bd_addr, BT_TRANSPORT_LE)) {
@@ -1131,7 +1132,7 @@ static tBTM_STATUS btm_sec_send_hci_disconnect(tBTM_SEC_DEV_REC* p_dev_rec, tHCI
* Description This function is called to confirm the numeric value for
* Simple Pairing in response to BTM_SP_CFM_REQ_EVT
*
- * Parameters: res - result of the operation BTM_SUCCESS if
+ * Parameters: res - result of the operation tBTM_STATUS::BTM_SUCCESS if
* success
* bd_addr - Address of the peer device
*
@@ -1153,7 +1154,7 @@ void BTM_ConfirmReqReply(tBTM_STATUS res, const RawAddress& bd_addr) {
btm_sec_cb.change_pairing_state(BTM_PAIR_STATE_WAIT_AUTH_COMPLETE);
- if ((res == BTM_SUCCESS) || (res == BTM_SUCCESS_NO_SECURITY)) {
+ if ((res == tBTM_STATUS::BTM_SUCCESS) || (res == tBTM_STATUS::BTM_SUCCESS_NO_SECURITY)) {
acl_set_disconnect_reason(HCI_SUCCESS);
btsnd_hcic_user_conf_reply(bd_addr, true);
@@ -1172,7 +1173,7 @@ void BTM_ConfirmReqReply(tBTM_STATUS res, const RawAddress& bd_addr) {
* Description This function is called to provide the passkey for
* Simple Pairing in response to BTM_SP_KEY_REQ_EVT
*
- * Parameters: res - result of the operation BTM_SUCCESS if success
+ * Parameters: res - result of the operation tBTM_STATUS::BTM_SUCCESS if success
* bd_addr - Address of the peer device
* passkey - numeric value in the range of
* BTM_MIN_PASSKEY_VAL(0) -
@@ -1188,7 +1189,8 @@ void BTM_PasskeyReqReply(tBTM_STATUS res, const RawAddress& bd_addr, uint32_t pa
}
/* If timeout already expired or has been canceled, ignore the reply */
- if ((btm_sec_cb.pairing_state == BTM_PAIR_STATE_WAIT_AUTH_COMPLETE) && (res != BTM_SUCCESS)) {
+ if ((btm_sec_cb.pairing_state == BTM_PAIR_STATE_WAIT_AUTH_COMPLETE) &&
+ (res != tBTM_STATUS::BTM_SUCCESS)) {
tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(bd_addr);
if (p_dev_rec != NULL) {
acl_set_disconnect_reason(HCI_ERR_HOST_REJECT_SECURITY);
@@ -1215,7 +1217,7 @@ void BTM_PasskeyReqReply(tBTM_STATUS res, const RawAddress& bd_addr, uint32_t pa
btm_sec_cb.change_pairing_state(BTM_PAIR_STATE_WAIT_AUTH_COMPLETE);
- if (res != BTM_SUCCESS) {
+ if (res != tBTM_STATUS::BTM_SUCCESS) {
/* use BTM_PAIR_STATE_WAIT_AUTH_COMPLETE to report authentication failed
* event */
acl_set_disconnect_reason(HCI_ERR_HOST_REJECT_SECURITY);
@@ -1267,7 +1269,7 @@ void BTM_RemoteOobDataReply(tBTM_STATUS res, const RawAddress& bd_addr, const Oc
btm_sec_cb.change_pairing_state(BTM_PAIR_STATE_WAIT_AUTH_COMPLETE);
- if (res != BTM_SUCCESS) {
+ if (res != tBTM_STATUS::BTM_SUCCESS) {
/* use BTM_PAIR_STATE_WAIT_AUTH_COMPLETE to report authentication failed
* event */
acl_set_disconnect_reason(HCI_ERR_HOST_REJECT_SECURITY);
@@ -1429,7 +1431,7 @@ tBTM_STATUS btm_sec_l2cap_access_req_by_requirement(const RawAddress& bd_addr,
"is_initiator:{}",
bd_addr, security_required, is_originator);
- tBTM_STATUS rc = BTM_SUCCESS;
+ tBTM_STATUS rc = tBTM_STATUS::BTM_SUCCESS;
bool chk_acp_auth_done = false;
/* should check PSM range in LE connection oriented L2CAP connection */
constexpr tBT_TRANSPORT transport = BT_TRANSPORT_BR_EDR;
@@ -1476,7 +1478,7 @@ tBTM_STATUS btm_sec_l2cap_access_req_by_requirement(const RawAddress& bd_addr,
(((security_required & BTM_SEC_OUT_FLAGS) ==
(BTM_SEC_OUT_AUTHENTICATE | BTM_SEC_OUT_ENCRYPT)) &&
btm_dev_encrypted(p_dev_rec))) {
- rc = BTM_SUCCESS;
+ rc = tBTM_STATUS::BTM_SUCCESS;
}
} else {
if (((security_required & BTM_SEC_IN_FLAGS) == 0) ||
@@ -1489,17 +1491,17 @@ tBTM_STATUS btm_sec_l2cap_access_req_by_requirement(const RawAddress& bd_addr,
if (((security_required & BTM_SEC_IN_MIN_16_DIGIT_PIN) == 0) ||
(((security_required & BTM_SEC_IN_MIN_16_DIGIT_PIN) == BTM_SEC_IN_MIN_16_DIGIT_PIN) &&
btm_dev_16_digit_authenticated(p_dev_rec))) {
- rc = BTM_SUCCESS;
+ rc = tBTM_STATUS::BTM_SUCCESS;
}
}
}
- if ((rc == BTM_SUCCESS) && (security_required & BTM_SEC_MODE4_LEVEL4) &&
+ if ((rc == tBTM_STATUS::BTM_SUCCESS) && (security_required & BTM_SEC_MODE4_LEVEL4) &&
(p_dev_rec->sec_rec.link_key_type != BTM_LKEY_TYPE_AUTH_COMB_P_256)) {
rc = BTM_CMD_STARTED;
}
- if (rc == BTM_SUCCESS) {
+ if (rc == tBTM_STATUS::BTM_SUCCESS) {
if (access_secure_service_from_temp_bond(p_dev_rec, is_originator, security_required)) {
log::error(
"Trying to access a secure service from a temp bonding, "
@@ -1573,7 +1575,7 @@ tBTM_STATUS btm_sec_l2cap_access_req_by_requirement(const RawAddress& bd_addr,
p_dev_rec->sec_rec.classic_link = tSECURITY_STATE::DELAY_FOR_ENC;
(*p_callback)(bd_addr, transport, p_ref_data, rc);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
}
@@ -1646,8 +1648,8 @@ tBTM_STATUS btm_sec_l2cap_access_req(const RawAddress& bd_addr, uint16_t psm, bo
/* Services level0 by default have no security */
if (psm == BT_PSM_SDP) {
log::debug("No security required for SDP");
- (*p_callback)(bd_addr, transport, p_ref_data, BTM_SUCCESS_NO_SECURITY);
- return BTM_SUCCESS;
+ (*p_callback)(bd_addr, transport, p_ref_data, tBTM_STATUS::BTM_SUCCESS_NO_SECURITY);
+ return tBTM_STATUS::BTM_SUCCESS;
}
uint16_t security_required;
@@ -1717,7 +1719,7 @@ tBTM_STATUS btm_sec_mx_access_request(const RawAddress& bd_addr, bool is_origina
(((security_required & BTM_SEC_OUT_FLAGS) ==
(BTM_SEC_OUT_AUTHENTICATE | BTM_SEC_OUT_ENCRYPT)) &&
btm_dev_encrypted(p_dev_rec))) {
- rc = BTM_SUCCESS;
+ rc = tBTM_STATUS::BTM_SUCCESS;
}
} else {
if (((security_required & BTM_SEC_IN_FLAGS) == 0) ||
@@ -1730,11 +1732,11 @@ tBTM_STATUS btm_sec_mx_access_request(const RawAddress& bd_addr, bool is_origina
if (((security_required & BTM_SEC_IN_MIN_16_DIGIT_PIN) == 0) ||
(((security_required & BTM_SEC_IN_MIN_16_DIGIT_PIN) == BTM_SEC_IN_MIN_16_DIGIT_PIN) &&
btm_dev_16_digit_authenticated(p_dev_rec))) {
- rc = BTM_SUCCESS;
+ rc = tBTM_STATUS::BTM_SUCCESS;
}
}
}
- if ((rc == BTM_SUCCESS) && (security_required & BTM_SEC_MODE4_LEVEL4) &&
+ if ((rc == tBTM_STATUS::BTM_SUCCESS) && (security_required & BTM_SEC_MODE4_LEVEL4) &&
(p_dev_rec->sec_rec.link_key_type != BTM_LKEY_TYPE_AUTH_COMB_P_256)) {
rc = BTM_CMD_STARTED;
}
@@ -1748,7 +1750,7 @@ tBTM_STATUS btm_sec_mx_access_request(const RawAddress& bd_addr, bool is_origina
if (rc == BTM_CMD_STARTED) {
btm_sec_queue_mx_request(bd_addr, BT_PSM_RFCOMM, is_originator, security_required, p_callback,
p_ref_data);
- } else /* rc == BTM_SUCCESS */
+ } else /* rc == tBTM_STATUS::BTM_SUCCESS */
{
if (access_secure_service_from_temp_bond(p_dev_rec, is_originator, security_required)) {
log::error(
@@ -1897,7 +1899,7 @@ static void btm_sec_bond_cancel_complete(void) {
/* Notify application that the cancel succeeded */
if (btm_sec_cb.api.p_bond_cancel_cmpl_callback) {
- btm_sec_cb.api.p_bond_cancel_cmpl_callback(BTM_SUCCESS);
+ btm_sec_cb.api.p_bond_cancel_cmpl_callback(tBTM_STATUS::BTM_SUCCESS);
}
}
}
@@ -2047,7 +2049,7 @@ void btm_sec_abort_access_req(const RawAddress& bd_addr) {
* Description This function is called to create an ACL connection for
* the dedicated bonding process
*
- * Returns BTM_SUCCESS if an ACL connection is already up
+ * Returns tBTM_STATUS::BTM_SUCCESS if an ACL connection is already up
* BTM_CMD_STARTED if the ACL connection has been requested
* BTM_NO_RESOURCES if failed to start the ACL connection
*
@@ -2059,7 +2061,7 @@ static tBTM_STATUS btm_sec_dd_create_conn(tBTM_SEC_DEV_REC* p_dev_rec) {
/* If already connected, start pending security procedure */
if (get_btm_client_interface().peer.BTM_IsAclConnectionUp(p_dev_rec->bd_addr,
BT_TRANSPORT_BR_EDR)) {
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
return BTM_CMD_STARTED;
} else if (status == BTM_NO_RESOURCES) {
@@ -2316,7 +2318,7 @@ void btm_sec_rmt_name_request_complete(const RawAddress* p_bd_addr, const uint8_
/* Both we and the peer are 2.1 - continue to create connection */
else {
tBTM_STATUS req_status = btm_sec_dd_create_conn(p_dev_rec);
- if (req_status == BTM_SUCCESS) {
+ if (req_status == tBTM_STATUS::BTM_SUCCESS) {
await_connection = false;
} else if (req_status != BTM_CMD_STARTED) {
log::warn("failed to start connection");
@@ -2749,7 +2751,7 @@ void btm_proc_sp_req_evt(tBTM_SP_EVT event, const RawAddress bda, const uint32_t
* right now */
} else if ((event == BTM_SP_CFM_REQ_EVT) && (evt_data.cfm_req.just_works)) {
/* automatically reply with just works if no sp_cback */
- status = BTM_SUCCESS;
+ status = tBTM_STATUS::BTM_SUCCESS;
}
if (event == BTM_SP_CFM_REQ_EVT) {
@@ -3104,7 +3106,7 @@ void btm_sec_auth_complete(uint16_t handle, tHCI_STATUS status) {
tHCI_ROLE role = HCI_ROLE_UNKNOWN;
if (get_btm_client_interface().link_policy.BTM_GetRole(p_dev_rec->bd_addr, &role) !=
- BTM_SUCCESS) {
+ tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to get link role peer:{}", p_dev_rec->bd_addr);
}
if (role == HCI_ROLE_CENTRAL) {
@@ -3286,7 +3288,7 @@ void btm_sec_encrypt_change(uint16_t handle, tHCI_STATUS status, uint8_t encr_en
}
tHCI_ROLE role = HCI_ROLE_UNKNOWN;
if (get_btm_client_interface().link_policy.BTM_GetRole(p_dev_rec->bd_addr, &role) !=
- BTM_SUCCESS) {
+ tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to get link policy role peer:{}", p_dev_rec->bd_addr);
}
if (p_dev_rec->sec_rec.new_encryption_key_is_p256) {
@@ -3722,7 +3724,7 @@ tBTM_STATUS btm_sec_disconnect(uint16_t handle, tHCI_STATUS reason, std::string
if (!p_dev_rec) {
acl_disconnect_from_handle(handle, reason,
"stack::btm::btm_sec::btm_sec_disconnect No security record");
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
/* If we are in the process of bonding we need to tell client that auth failed
@@ -4391,7 +4393,7 @@ void btm_sec_update_clock_offset(uint16_t handle, uint16_t clock_offset) {
* the peer will not be established. This function in this
* case performs only authorization.
*
- * Returns BTM_SUCCESS - permission is granted
+ * Returns tBTM_STATUS::BTM_SUCCESS - permission is granted
* BTM_CMD_STARTED - in process
* BTM_NO_RESOURCES - permission declined
*
@@ -4520,7 +4522,7 @@ tBTM_STATUS btm_sec_execute_procedure(tBTM_SEC_DEV_REC* p_dev_rec) {
log::verbose("Security Manager: access granted");
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
/*******************************************************************************
@@ -4589,7 +4591,7 @@ static void btm_sec_auth_timer_timeout(void* data) {
log::info("device is already authenticated");
if (p_dev_rec->sec_rec.p_callback) {
(*p_dev_rec->sec_rec.p_callback)(p_dev_rec->bd_addr, BT_TRANSPORT_BR_EDR,
- p_dev_rec->sec_rec.p_ref_data, BTM_SUCCESS);
+ p_dev_rec->sec_rec.p_ref_data, tBTM_STATUS::BTM_SUCCESS);
}
} else if (p_dev_rec->sec_rec.classic_link == tSECURITY_STATE::AUTHENTICATING) {
log::info("device is in the process of authenticating");
@@ -4833,7 +4835,7 @@ static bool btm_sec_check_prefetch_pin(tBTM_SEC_DEV_REC* p_dev_rec) {
/* If we got a PIN, use that, else try to get one */
if (btm_sec_cb.pin_code_len) {
- BTM_PINCodeReply(p_dev_rec->bd_addr, BTM_SUCCESS, btm_sec_cb.pin_code_len,
+ BTM_PINCodeReply(p_dev_rec->bd_addr, tBTM_STATUS::BTM_SUCCESS, btm_sec_cb.pin_code_len,
btm_sec_cb.pin_code);
} else {
/* pin was not supplied - pre-fetch pin code now */
@@ -4895,7 +4897,7 @@ static void btm_sec_check_pending_enc_req(tBTM_SEC_DEV_REC* p_dev_rec, tBT_TRANS
return;
}
- const tBTM_STATUS res = encr_enable ? BTM_SUCCESS : BTM_ERR_PROCESSING;
+ const tBTM_STATUS res = encr_enable ? tBTM_STATUS::BTM_SUCCESS : BTM_ERR_PROCESSING;
list_t* list = fixed_queue_get_list(btm_sec_cb.sec_pending_q);
for (const list_node_t* node = list_begin(list); node != list_end(list);) {
tBTM_SEC_QUEUE_ENTRY* p_e = (tBTM_SEC_QUEUE_ENTRY*)list_node(node);
diff --git a/system/stack/btm/btm_sec.h b/system/stack/btm/btm_sec.h
index 8ec45f7a4d..82cc4c4df4 100644
--- a/system/stack/btm/btm_sec.h
+++ b/system/stack/btm/btm_sec.h
@@ -167,7 +167,7 @@ uint8_t BTM_SecClrServiceByPsm(uint16_t psm);
*
* Parameters: bd_addr - Address of the device for which PIN was
* requested
- * res - result of the operation BTM_SUCCESS
+ * res - result of the operation tBTM_STATUS::BTM_SUCCESS
* if success
* pin_len - length in bytes of the PIN Code
* p_pin - pointer to array with the PIN Code
@@ -196,7 +196,7 @@ tBTM_STATUS btm_sec_bond_by_transport(const RawAddress& bd_addr, tBLE_ADDR_TYPE
*
* Description This function is called to perform bonding with peer device.
* If the connection is already up, but not secure, pairing
- * is attempted. If already paired BTM_SUCCESS is returned.
+ * is attempted. If already paired tBTM_STATUS::BTM_SUCCESS is returned.
*
* Parameters: bd_addr - Address of the device to bond
* transport - doing SSP over BR/EDR or SMP over LE
@@ -225,7 +225,7 @@ tBTM_STATUS BTM_SecBondCancel(const RawAddress& bd_addr);
*
* Description This function is called to obtain link key type for the
* device.
- * it returns BTM_SUCCESS if link key is available, or
+ * it returns tBTM_STATUS::BTM_SUCCESS if link key is available, or
* BTM_UNKNOWN_ADDR if Security Manager does not know about
* the device or device record does not contain link key info
*
@@ -255,7 +255,7 @@ tBTM_LINK_KEY_TYPE BTM_SecGetDeviceLinkKeyType(const RawAddress& bd_addr);
* completion. can be set to NULL if not used.
* sec_act - LE security action, unused for BR/EDR
*
- * Returns BTM_SUCCESS - already encrypted
+ * Returns tBTM_STATUS::BTM_SUCCESS - already encrypted
* BTM_PENDING - command will be returned in the callback
* BTM_WRONG_MODE- connection not up.
* BTM_BUSY - security procedures are currently active
@@ -276,7 +276,7 @@ bool BTM_SecIsSecurityPending(const RawAddress& bd_addr);
* Description This function is called to confirm the numeric value for
* Simple Pairing in response to BTM_SP_CFM_REQ_EVT
*
- * Parameters: res - result of the operation BTM_SUCCESS if
+ * Parameters: res - result of the operation tBTM_STATUS::BTM_SUCCESS if
* success
* bd_addr - Address of the peer device
*
@@ -290,7 +290,7 @@ void BTM_ConfirmReqReply(tBTM_STATUS res, const RawAddress& bd_addr);
* Description This function is called to provide the passkey for
* Simple Pairing in response to BTM_SP_KEY_REQ_EVT
*
- * Parameters: res - result of the operation BTM_SUCCESS if success
+ * Parameters: res - result of the operation tBTM_STATUS::BTM_SUCCESS if success
* bd_addr - Address of the peer device
* passkey - numeric value in the range of
* BTM_MIN_PASSKEY_VAL(0) -
diff --git a/system/stack/btm/power_mode.h b/system/stack/btm/power_mode.h
index 402937c14c..c31b6b3607 100644
--- a/system/stack/btm/power_mode.h
+++ b/system/stack/btm/power_mode.h
@@ -209,7 +209,7 @@ inline void set_le_scan_mode_to_ctrl_state(uint32_t duty_cycle, tBTM_CONTRL_STAT
*
* Description register or deregister with power manager
*
- * Returns BTM_SUCCESS if successful,
+ * Returns tBTM_STATUS::BTM_SUCCESS if successful,
* BTM_NO_RESOURCES if no room to hold registration
* BTM_ILLEGAL_VALUE
*
@@ -229,7 +229,7 @@ void BTM_PM_OnDisconnected(uint16_t handle);
* Description store the mode in control block or
* alter ACL connection behavior.
*
- * Returns BTM_SUCCESS if successful,
+ * Returns tBTM_STATUS::BTM_SUCCESS if successful,
* BTM_UNKNOWN_ADDR if bd addr is not active or bad
*
******************************************************************************/
@@ -250,7 +250,7 @@ bool BTM_SetLinkPolicyActiveMode(const RawAddress& remote_bda);
* min_loc_to - minimum local timeout
*
*
- * Returns BTM_SUCCESS if the HCI command is issued successful,
+ * Returns tBTM_STATUS::BTM_SUCCESS if the HCI command is issued successful,
* BTM_UNKNOWN_ADDR if bd addr is not active or bad
* BTM_CMD_STORED if the command is stored
*
diff --git a/system/stack/btu/btu_hcif.cc b/system/stack/btu/btu_hcif.cc
index 63e4a2047a..584912973d 100644
--- a/system/stack/btu/btu_hcif.cc
+++ b/system/stack/btu/btu_hcif.cc
@@ -46,6 +46,7 @@
#include "stack/include/btm_ble_addr.h"
#include "stack/include/btm_iso_api.h"
#include "stack/include/btm_sec_api_types.h"
+#include "stack/include/btm_status.h"
#include "stack/include/dev_hci_link_interface.h"
#include "stack/include/hci_error_code.h"
#include "stack/include/hci_evt_length.h"
@@ -1220,7 +1221,7 @@ void btu_hcif_read_local_oob_complete(const uint8_t* p, uint16_t evt_len) {
}
STREAM_TO_UINT8(status, p);
if (status == HCI_SUCCESS) {
- evt_data.status = BTM_SUCCESS;
+ evt_data.status = tBTM_STATUS::BTM_SUCCESS;
} else {
evt_data.status = BTM_ERR_PROCESSING;
}
@@ -1246,7 +1247,7 @@ void btu_hcif_read_local_oob_extended_complete(const uint8_t* p, uint16_t evt_le
uint8_t status;
STREAM_TO_UINT8(status, p);
if (status == HCI_SUCCESS) {
- evt_data.status = BTM_SUCCESS;
+ evt_data.status = tBTM_STATUS::BTM_SUCCESS;
} else {
evt_data.status = BTM_ERR_PROCESSING;
}
diff --git a/system/stack/fuzzers/smp_fuzzer.cc b/system/stack/fuzzers/smp_fuzzer.cc
index e79ab313c8..89a90c06a7 100644
--- a/system/stack/fuzzers/smp_fuzzer.cc
+++ b/system/stack/fuzzers/smp_fuzzer.cc
@@ -23,6 +23,7 @@
#include "common/message_loop_thread.h"
#include "osi/include/allocator.h"
#include "stack/include/bt_hdr.h"
+#include "stack/include/btm_status.h"
#include "stack/include/smp_api.h"
#include "stack/smp/smp_int.h"
#include "test/fake/fake_osi.h"
@@ -167,7 +168,7 @@ tBTM_STATUS smp_callback(tSMP_EVT event, const RawAddress& bd_addr, const tSMP_E
default:
break;
}
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
void Fuzz(const uint8_t* data, size_t size) {
diff --git a/system/stack/gap/gap_ble.cc b/system/stack/gap/gap_ble.cc
index 3b55c031ca..9f09ce4b44 100644
--- a/system/stack/gap/gap_ble.cc
+++ b/system/stack/gap/gap_ble.cc
@@ -28,6 +28,7 @@
#include "stack/include/bt_types.h"
#include "stack/include/bt_uuid16.h"
#include "stack/include/btm_client_interface.h"
+#include "stack/include/btm_status.h"
#include "types/bluetooth/uuid.h"
#include "types/bt_transport.h"
#include "types/raw_address.h"
@@ -143,7 +144,7 @@ tGATT_STATUS read_attr_value(uint16_t handle, tGATT_VALUE* p_value, bool is_long
switch (db_attr.uuid) {
case GATT_UUID_GAP_DEVICE_NAME:
if (get_btm_client_interface().local.BTM_ReadLocalDeviceName((const char**)&p_dev_name) !=
- BTM_SUCCESS) {
+ tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to read local device name");
};
if (strlen((char*)p_dev_name) > GATT_MAX_ATTR_LEN) {
@@ -514,7 +515,7 @@ void GAP_BleAttrDBUpdate(uint16_t attr_uuid, tGAP_BLE_ATTR_VALUE* p_value) {
case GATT_UUID_GAP_DEVICE_NAME:
if (get_btm_client_interface().local.BTM_SetLocalDeviceName(
- (const char*)p_value->p_dev_name) != BTM_SUCCESS) {
+ (const char*)p_value->p_dev_name) != tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to set local name");
}
break;
diff --git a/system/stack/gatt/gatt_auth.cc b/system/stack/gatt/gatt_auth.cc
index 8b893e2354..a89ec1e08f 100644
--- a/system/stack/gatt/gatt_auth.cc
+++ b/system/stack/gatt/gatt_auth.cc
@@ -36,6 +36,7 @@
#include "stack/include/bt_hdr.h"
#include "stack/include/bt_types.h"
#include "stack/include/btm_ble_sec_api.h"
+#include "stack/include/btm_status.h"
#include "types/raw_address.h"
using namespace bluetooth;
@@ -175,7 +176,7 @@ static void gatt_enc_cmpl_cback(RawAddress bd_addr, tBT_TRANSPORT transport, voi
if (p_clcb != NULL) {
bool status = false;
- if (result == BTM_SUCCESS) {
+ if (result == tBTM_STATUS::BTM_SUCCESS) {
if (gatt_get_sec_act(p_tcb) == GATT_SEC_ENCRYPT_MITM) {
status = BTM_IsLinkKeyAuthed(bd_addr, transport);
} else {
@@ -432,7 +433,7 @@ bool gatt_security_check_start(tGATT_CLCB* p_clcb) {
gatt_convert_sec_action(gatt_sec_act, &btm_ble_sec_act);
tBTM_STATUS btm_status = BTM_SetEncryption(p_tcb->peer_bda, p_tcb->transport,
gatt_enc_cmpl_cback, NULL, btm_ble_sec_act);
- if ((btm_status != BTM_SUCCESS) && (btm_status != BTM_CMD_STARTED)) {
+ if ((btm_status != tBTM_STATUS::BTM_SUCCESS) && (btm_status != BTM_CMD_STARTED)) {
log::error("BTM_SetEncryption failed btm_status={}", btm_status);
gatt_set_sec_act(p_tcb, GATT_SEC_NONE);
gatt_set_ch_state(p_tcb, GATT_CH_OPEN);
diff --git a/system/stack/include/acl_api.h b/system/stack/include/acl_api.h
index 850c396647..c11f179f58 100644
--- a/system/stack/include/acl_api.h
+++ b/system/stack/include/acl_api.h
@@ -88,7 +88,7 @@ bool BTM_IsAclConnectionUpAndHandleValid(const RawAddress& remote_bda, tBT_TRANS
* Description This function is called to get the role of the local device
* for the ACL connection with the specified remote device
*
- * Returns BTM_SUCCESS if connection exists.
+ * Returns tBTM_STATUS::BTM_SUCCESS if connection exists.
* BTM_UNKNOWN_ADDR if no active link with bd addr specified
*
******************************************************************************/
@@ -101,7 +101,7 @@ tBTM_STATUS BTM_GetRole(const RawAddress& remote_bd_addr, tHCI_ROLE* p_role);
* Description This function is called to switch role between central and
* peripheral. If role is already set it will do nothing.
*
- * Returns BTM_SUCCESS if already in specified role.
+ * Returns tBTM_STATUS::BTM_SUCCESS if already in specified role.
* BTM_CMD_STARTED if command issued to controller.
* BTM_NO_RESOURCES if memory couldn't be allocated to issue
* the command
@@ -262,7 +262,7 @@ void btm_acl_notif_conn_collision(const RawAddress& bda);
* BTM_ACL_MODE_HOLD
* BTM_ACL_MODE_SNIFF
* BTM_ACL_MODE_PARK
- * (valid only if return code is BTM_SUCCESS)
+ * (valid only if return code is tBTM_STATUS::BTM_SUCCESS)
*
* Returns true if successful, false otherwise.
*
diff --git a/system/stack/include/btm_api.h b/system/stack/include/btm_api.h
index eda4caed27..be4c4c57db 100644
--- a/system/stack/include/btm_api.h
+++ b/system/stack/include/btm_api.h
@@ -79,7 +79,7 @@ void BTM_reset_complete();
*
* Description This function is called to set the local device class
*
- * Returns BTM_SUCCESS if successful, otherwise an error
+ * Returns tBTM_STATUS::BTM_SUCCESS if successful, otherwise an error
*
******************************************************************************/
[[nodiscard]] tBTM_STATUS BTM_SetDeviceClass(DEV_CLASS dev_class);
@@ -91,7 +91,7 @@ void BTM_reset_complete();
* Description This function is called to read the local device name.
*
* Returns status of the operation
- * If success, BTM_SUCCESS is returned and p_name points stored
+ * If success, tBTM_STATUS::BTM_SUCCESS is returned and p_name points stored
* local device name
* If BTM doesn't store local device name, BTM_NO_RESOURCES is
* is returned and p_name is set to NULL
@@ -161,7 +161,7 @@ void BTM_WriteVoiceSettings(uint16_t settings);
* resetting the controller.
*
* Returns
- * BTM_SUCCESS Command sent.
+ * tBTM_STATUS::BTM_SUCCESS Command sent.
* BTM_NO_RESOURCES If out of resources to send the command.
*
*
@@ -303,7 +303,7 @@ void BTM_WriteVoiceSettings(uint16_t settings);
* (NULL clears all entries)
*
* Returns BTM_BUSY if an inquiry, get remote name, or event filter
- * is active, otherwise BTM_SUCCESS
+ * is active, otherwise tBTM_STATUS::BTM_SUCCESS
*
******************************************************************************/
[[nodiscard]] tBTM_STATUS BTM_ClearInqDb(const RawAddress* p_bda);
@@ -377,7 +377,7 @@ void BTM_RemoveScoByBdaddr(const RawAddress& bda);
* BTM_CreateSco. It can be called only when there are no
* active (e)SCO links.
*
- * Returns BTM_SUCCESS if the successful.
+ * Returns tBTM_STATUS::BTM_SUCCESS if the successful.
* BTM_BUSY if there are one or more active (e)SCO links.
*
******************************************************************************/
@@ -392,7 +392,7 @@ void BTM_RemoveScoByBdaddr(const RawAddress& bda);
* connection indication events and change of link parameter
* events.
*
- * Returns BTM_SUCCESS if the successful.
+ * Returns tBTM_STATUS::BTM_SUCCESS if the successful.
* BTM_ILLEGAL_VALUE if there is an illegal sco_inx
*
******************************************************************************/
@@ -512,7 +512,7 @@ void BTM_RequestPeerSCA(const RawAddress& remote_bda, tBT_TRANSPORT transport);
* Parameters p_buff - allocated HCI command buffer including extended
* inquriry response
*
- * Returns BTM_SUCCESS - if successful
+ * Returns tBTM_STATUS::BTM_SUCCESS - if successful
* BTM_MODE_UNSUPPORTED - if local device cannot support it
*
******************************************************************************/
diff --git a/system/stack/include/btm_ble_api.h b/system/stack/include/btm_ble_api.h
index 78c2a8bbde..689c8f9be3 100644
--- a/system/stack/include/btm_ble_api.h
+++ b/system/stack/include/btm_ble_api.h
@@ -309,7 +309,7 @@ tBTM_STATUS BTM_BleGetEnergyInfo(tBTM_BLE_ENERGY_INFO_CBACK* p_ener_cback);
*
* Description Set the maximum BLE transmission packet size
*
- * Returns BTM_SUCCESS if success; otherwise failed.
+ * Returns tBTM_STATUS::BTM_SUCCESS if success; otherwise failed.
*
******************************************************************************/
tBTM_STATUS BTM_SetBleDataLength(const RawAddress& bd_addr, uint16_t tx_pdu_length);
@@ -321,7 +321,7 @@ tBTM_STATUS BTM_SetBleDataLength(const RawAddress& bd_addr, uint16_t tx_pdu_leng
* Description To read the current PHYs for specified LE connection
*
*
- * Returns BTM_SUCCESS if success; otherwise failed.
+ * Returns tBTM_STATUS::BTM_SUCCESS if success; otherwise failed.
*
******************************************************************************/
void BTM_BleReadPhy(const RawAddress& bd_addr,
@@ -334,7 +334,7 @@ void BTM_BleReadPhy(const RawAddress& bd_addr,
* Description To set PHY preferences for specified LE connection
*
*
- * Returns BTM_SUCCESS if success; otherwise failed.
+ * Returns tBTM_STATUS::BTM_SUCCESS if success; otherwise failed.
*
******************************************************************************/
void BTM_BleSetPhy(const RawAddress& bd_addr, uint8_t tx_phys, uint8_t rx_phys,
diff --git a/system/stack/include/btm_ble_sec_api.h b/system/stack/include/btm_ble_sec_api.h
index 364ca7e4f7..a25a0f3ba6 100644
--- a/system/stack/include/btm_ble_sec_api.h
+++ b/system/stack/include/btm_ble_sec_api.h
@@ -77,7 +77,7 @@ const Octet16& BTM_GetDeviceDHK();
* Description This function is called to grant security process.
*
* Parameters bd_addr - peer device bd address.
- * res - result of the operation BTM_SUCCESS if success.
+ * res - result of the operation tBTM_STATUS::BTM_SUCCESS if success.
* Otherwise, BTM_REPEATED_ATTEMPTS is too many
* attempts.
*
@@ -112,7 +112,7 @@ void BTM_BlePasskeyReply(const RawAddress& bd_addr, tBTM_STATUS res, uint32_t pa
*
* Parameters: bd_addr - Address of the device with which numeric
* comparison was requested
- * res - comparison result BTM_SUCCESS if success
+ * res - comparison result tBTM_STATUS::BTM_SUCCESS if success
*
******************************************************************************/
void BTM_BleConfirmReply(const RawAddress& bd_addr, tBTM_STATUS res);
diff --git a/system/stack/include/btm_inq.h b/system/stack/include/btm_inq.h
index 40a8f5b29c..f4233d2c17 100644
--- a/system/stack/include/btm_inq.h
+++ b/system/stack/include/btm_inq.h
@@ -31,7 +31,7 @@
* scans are enabled. If a value of '0' is entered for window
* or interval, the default values are used.
*
- * Returns BTM_SUCCESS if successful
+ * Returns tBTM_STATUS::BTM_SUCCESS if successful
* BTM_BUSY if a setting of the filter is already in progress
* BTM_NO_RESOURCES if couldn't get a memory pool buffer
* BTM_ILLEGAL_VALUE if a bad parameter was detected
@@ -105,7 +105,7 @@ void BTM_CancelInquiry(void);
* connectable mode. Discoverable mode means page scans are
* enabled.
*
- * Returns BTM_SUCCESS if successful
+ * Returns tBTM_STATUS::BTM_SUCCESS if successful
* BTM_ILLEGAL_VALUE if a bad parameter is detected
* BTM_NO_RESOURCES if could not allocate a message buffer
* BTM_WRONG_MODE if the device is not up.
@@ -123,7 +123,7 @@ void BTM_CancelInquiry(void);
* Input Params: BTM_INQ_RESULT_STANDARD, BTM_INQ_RESULT_WITH_RSSI or
* BTM_INQ_RESULT_EXTENDED
*
- * Returns BTM_SUCCESS if successful
+ * Returns tBTM_STATUS::BTM_SUCCESS if successful
* BTM_NO_RESOURCES if couldn't get a memory pool buffer
* BTM_ILLEGAL_VALUE if a bad parameter was detected
* BTM_WRONG_MODE if the device is not up.
diff --git a/system/stack/include/btm_sec_api.h b/system/stack/include/btm_sec_api.h
index eb7aad3471..680b5b6fdd 100644
--- a/system/stack/include/btm_sec_api.h
+++ b/system/stack/include/btm_sec_api.h
@@ -101,7 +101,7 @@ tBTM_STATUS BTM_DeleteStoredLinkKey(const RawAddress* bd_addr, tBTM_CMPL_CB* p_c
* Description This procedure confirms requested to validate set device.
*
* Parameter bd_addr - BD address of the peer
- * res - confirmation result BTM_SUCCESS if success
+ * res - confirmation result tBTM_STATUS::BTM_SUCCESS if success
*
* Returns void
*
diff --git a/system/stack/include/l2cap_security_interface.h b/system/stack/include/l2cap_security_interface.h
index 8d8b22c3ea..8897da11d3 100644
--- a/system/stack/include/l2cap_security_interface.h
+++ b/system/stack/include/l2cap_security_interface.h
@@ -33,7 +33,7 @@ void l2cu_resubmit_pending_sec_req(const RawAddress* p_bda);
// Establish ACL link to remote device for Security Manager/Pairing.
// Returns BTM_CMD_STARTED if already connecting, BTM_NO_RESOURCES if can't
-// allocate lcb, BTM_SUCCESS if initiated the connection
+// allocate lcb, tBTM_STATUS::BTM_SUCCESS if initiated the connection
tBTM_STATUS l2cu_ConnectAclForSecurity(const RawAddress& bd_addr);
void l2cble_update_sec_act(const RawAddress& bd_addr, uint16_t sec_act);
diff --git a/system/stack/l2cap/l2c_ble.cc b/system/stack/l2cap/l2c_ble.cc
index 28dece895b..2ef8232525 100644
--- a/system/stack/l2cap/l2c_ble.cc
+++ b/system/stack/l2cap/l2c_ble.cc
@@ -50,6 +50,7 @@
#include "stack/include/btm_ble_api.h"
#include "stack/include/btm_client_interface.h"
#include "stack/include/btm_log_history.h"
+#include "stack/include/btm_status.h"
#include "stack/include/l2c_api.h"
#include "stack/include/l2cap_acl_interface.h"
#include "stack/include/l2cdefs.h"
@@ -1076,7 +1077,7 @@ void l2cble_update_data_length(tL2C_LCB* p_lcb) {
/* update TX data length if changed */
if (p_lcb->tx_data_len != tx_mtu) {
if (get_btm_client_interface().ble.BTM_SetBleDataLength(p_lcb->remote_bd_addr, tx_mtu) !=
- BTM_SUCCESS) {
+ tBTM_STATUS::BTM_SUCCESS) {
log::warn("Unable to set BLE data length peer:{} mtu:{}", p_lcb->remote_bd_addr, tx_mtu);
}
}
@@ -1259,7 +1260,7 @@ void l2cble_sec_comp(RawAddress bda, tBT_TRANSPORT transport, void* /* p_ref_dat
return;
}
- if (btm_status != BTM_SUCCESS) {
+ if (btm_status != tBTM_STATUS::BTM_SUCCESS) {
(*(p_buf->p_callback))(bda, BT_TRANSPORT_LE, p_buf->p_ref_data, btm_status);
osi_free(p_buf);
} else {
@@ -1285,7 +1286,7 @@ void l2cble_sec_comp(RawAddress bda, tBT_TRANSPORT transport, void* /* p_ref_dat
while (!fixed_queue_is_empty(p_lcb->le_sec_pending_q)) {
p_buf = (tL2CAP_SEC_DATA*)fixed_queue_dequeue(p_lcb->le_sec_pending_q);
- if (btm_status != BTM_SUCCESS) {
+ if (btm_status != tBTM_STATUS::BTM_SUCCESS) {
(*(p_buf->p_callback))(bda, BT_TRANSPORT_LE, p_buf->p_ref_data, btm_status);
osi_free(p_buf);
} else {
@@ -1342,7 +1343,7 @@ tL2CAP_LE_RESULT_CODE l2ble_sec_access_req(const RawAddress& bd_addr, uint16_t p
btm_ble_start_sec_check(bd_addr, psm, is_originator, &l2cble_sec_comp, p_ref_data);
switch (result) {
- case BTM_SUCCESS:
+ case tBTM_STATUS::BTM_SUCCESS:
return L2CAP_LE_RESULT_CONN_OK;
case BTM_ILLEGAL_VALUE:
return L2CAP_LE_RESULT_NO_PSM;
diff --git a/system/stack/l2cap/l2c_link.cc b/system/stack/l2cap/l2c_link.cc
index bd5968cf45..b116778f4a 100644
--- a/system/stack/l2cap/l2c_link.cc
+++ b/system/stack/l2cap/l2c_link.cc
@@ -38,6 +38,7 @@
#include "stack/include/acl_api.h"
#include "stack/include/bt_hdr.h"
#include "stack/include/bt_types.h"
+#include "stack/include/btm_status.h"
#include "stack/include/hci_error_code.h"
#include "stack/include/l2cap_acl_interface.h"
#include "stack/include/l2cap_hci_link_interface.h"
@@ -192,8 +193,8 @@ void l2c_link_sec_comp(RawAddress p_bda, tBT_TRANSPORT transport, void* p_ref_da
log::debug("btm_status={}, BD_ADDR={}, transport={}", btm_status_text(btm_status), p_bda,
bt_transport_text(transport));
- if (btm_status == BTM_SUCCESS_NO_SECURITY) {
- btm_status = BTM_SUCCESS;
+ if (btm_status == tBTM_STATUS::BTM_SUCCESS_NO_SECURITY) {
+ btm_status = tBTM_STATUS::BTM_SUCCESS;
}
/* Save the parameters */
@@ -230,11 +231,11 @@ void l2c_link_sec_comp(RawAddress p_bda, tBT_TRANSPORT transport, void* p_ref_da
}
switch (btm_status) {
- case BTM_SUCCESS:
+ case tBTM_STATUS::BTM_SUCCESS:
l2c_csm_execute(p_ccb, L2CEVT_SEC_COMP, &ci);
break;
- case BTM_DELAY_CHECK:
+ case tBTM_STATUS::BTM_DELAY_CHECK:
/* start a timer - encryption change not received before L2CAP connect
* req */
alarm_set_on_mloop(p_ccb->l2c_ccb_timer, L2CAP_DELAY_CHECK_SM4_TIMEOUT_MS,
@@ -252,11 +253,11 @@ void l2c_link_sec_comp(RawAddress p_bda, tBT_TRANSPORT transport, void* p_ref_da
if (p_ccb == p_ref_data) {
switch (btm_status) {
- case BTM_SUCCESS:
+ case tBTM_STATUS::BTM_SUCCESS:
l2c_csm_execute(p_ccb, L2CEVT_SEC_COMP, &ci);
break;
- case BTM_DELAY_CHECK:
+ case tBTM_STATUS::BTM_DELAY_CHECK:
/* start a timer - encryption change not received before L2CAP
* connect req */
alarm_set_on_mloop(p_ccb->l2c_ccb_timer, L2CAP_DELAY_CHECK_SM4_TIMEOUT_MS,
@@ -475,7 +476,7 @@ void l2c_link_timeout(tL2C_LCB* p_lcb) {
} else if (rc == BTM_CMD_STARTED) {
p_lcb->link_state = LST_DISCONNECTING;
timeout_ms = L2CAP_LINK_DISCONNECT_TIMEOUT_MS;
- } else if (rc == BTM_SUCCESS) {
+ } else if (rc == tBTM_STATUS::BTM_SUCCESS) {
l2cu_process_fixed_disc_cback(p_lcb);
/* BTM SEC will make sure that link is release (probably after pairing
* is done) */
@@ -1197,7 +1198,7 @@ tBTM_STATUS l2cu_ConnectAclForSecurity(const RawAddress& bd_addr) {
}
l2cu_create_conn_br_edr(p_lcb);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
void l2cble_update_sec_act(const RawAddress& bd_addr, uint16_t sec_act) {
diff --git a/system/stack/l2cap/l2c_utils.cc b/system/stack/l2cap/l2c_utils.cc
index 6cac520eda..666f59c417 100644
--- a/system/stack/l2cap/l2c_utils.cc
+++ b/system/stack/l2cap/l2c_utils.cc
@@ -40,6 +40,7 @@
#include "stack/include/bt_hdr.h"
#include "stack/include/bt_types.h"
#include "stack/include/btm_client_interface.h"
+#include "stack/include/btm_status.h"
#include "stack/include/hci_error_code.h"
#include "stack/include/hcidefs.h"
#include "stack/include/l2c_api.h"
@@ -2792,7 +2793,7 @@ void l2cu_no_dynamic_ccbs(tL2C_LCB* p_lcb) {
l2cu_process_fixed_disc_cback(p_lcb);
p_lcb->link_state = LST_DISCONNECTING;
timeout_ms = L2CAP_LINK_DISCONNECT_TIMEOUT_MS;
- } else if (rc == BTM_SUCCESS) {
+ } else if (rc == tBTM_STATUS::BTM_SUCCESS) {
l2cu_process_fixed_disc_cback(p_lcb);
/* BTM SEC will make sure that link is release (probably after pairing is
* done) */
diff --git a/system/stack/rfcomm/rfc_port_fsm.cc b/system/stack/rfcomm/rfc_port_fsm.cc
index 49d33eec18..eee62d89f0 100644
--- a/system/stack/rfcomm/rfc_port_fsm.cc
+++ b/system/stack/rfcomm/rfc_port_fsm.cc
@@ -36,6 +36,7 @@
#include "stack/btm/btm_sec.h"
#include "stack/include/bt_hdr.h"
#include "stack/include/bt_uuid16.h"
+#include "stack/include/btm_status.h"
#include "stack/l2cap/l2c_int.h"
#include "stack/rfcomm/port_int.h"
#include "stack/rfcomm/rfc_int.h"
@@ -290,7 +291,7 @@ void rfc_port_sm_sabme_wait_ua(tPORT* p_port, tRFC_PORT_EVENT event, void* p_dat
void rfc_port_sm_term_wait_sec_check(tPORT* p_port, tRFC_PORT_EVENT event, void* p_data) {
switch (event) {
case RFC_PORT_EVENT_SEC_COMPLETE:
- if (*((tBTM_STATUS*)p_data) != BTM_SUCCESS) {
+ if (*((tBTM_STATUS*)p_data) != tBTM_STATUS::BTM_SUCCESS) {
log::error("Security check failed result:{} state:{} port_handle:{}",
btm_status_text(*((tBTM_STATUS*)p_data)),
rfcomm_port_state_text(p_port->rfc.state), p_port->handle);
@@ -392,7 +393,7 @@ void rfc_port_sm_term_wait_sec_check(tPORT* p_port, tRFC_PORT_EVENT event, void*
void rfc_port_sm_orig_wait_sec_check(tPORT* p_port, tRFC_PORT_EVENT event, void* p_data) {
switch (event) {
case RFC_PORT_EVENT_SEC_COMPLETE:
- if (*((tBTM_STATUS*)p_data) != BTM_SUCCESS) {
+ if (*((tBTM_STATUS*)p_data) != tBTM_STATUS::BTM_SUCCESS) {
log::error("Security check failed result:{} state:{} port_handle:{}",
btm_status_text(*((tBTM_STATUS*)p_data)),
rfcomm_port_state_text(p_port->rfc.state), p_port->handle);
diff --git a/system/stack/smp/smp_act.cc b/system/stack/smp/smp_act.cc
index 03aa801fbe..6341187535 100644
--- a/system/stack/smp/smp_act.cc
+++ b/system/stack/smp/smp_act.cc
@@ -38,6 +38,7 @@
#include "stack/include/bt_types.h"
#include "stack/include/btm_client_interface.h"
#include "stack/include/btm_log_history.h"
+#include "stack/include/btm_status.h"
#include "stack/include/smp_api_types.h"
#include "types/raw_address.h"
@@ -157,7 +158,7 @@ void smp_send_app_cback(tSMP_CB* p_cb, tSMP_INT_DATA* p_data) {
callback_rc = (*p_cb->p_callback)(p_cb->cb_evt, p_cb->pairing_bda, &cb_data);
- if (callback_rc == BTM_SUCCESS) {
+ if (callback_rc == tBTM_STATUS::BTM_SUCCESS) {
switch (p_cb->cb_evt) {
case SMP_IO_CAP_REQ_EVT:
p_cb->loc_auth_req = cb_data.io_req.auth_req;
@@ -1226,7 +1227,7 @@ void smp_sirk_verify(tSMP_CB* p_cb, tSMP_INT_DATA* p_data) {
callback_rc = (*p_cb->p_callback)(p_cb->cb_evt, p_cb->pairing_bda, nullptr);
/* There is no member validator callback - device is by default valid */
- if (callback_rc == BTM_SUCCESS_NO_SECURITY) {
+ if (callback_rc == tBTM_STATUS::BTM_SUCCESS_NO_SECURITY) {
BTM_LogHistory(kBtmLogTag, p_cb->pairing_bda, "SIRK verification",
base::StringPrintf("Device validated due to no security"));
diff --git a/system/stack/test/btm/stack_btm_inq_test.cc b/system/stack/test/btm/stack_btm_inq_test.cc
index f4c8f0a9f4..a745569a23 100644
--- a/system/stack/test/btm/stack_btm_inq_test.cc
+++ b/system/stack/test/btm/stack_btm_inq_test.cc
@@ -27,6 +27,7 @@
#include "hci/hci_packets.h"
#include "stack/btm/btm_int_types.h"
#include "stack/include/btm_inq.h"
+#include "stack/include/btm_status.h"
#include "stack/include/hci_error_code.h"
#include "stack/include/inq_hci_link_interface.h"
#include "stack/include/main_thread.h"
@@ -117,7 +118,7 @@ TEST_F(BtmInqActiveTest, btm_process_remote_name__typical) {
ASSERT_EQ(1, get_func_call_count("alarm_cancel"));
ASSERT_TRUE(gBTM_REMOTE_DEV_NAME_sent);
- ASSERT_EQ(BTM_SUCCESS, gBTM_REMOTE_DEV_NAME.status);
+ ASSERT_EQ(tBTM_STATUS::BTM_SUCCESS, gBTM_REMOTE_DEV_NAME.status);
ASSERT_EQ(HCI_SUCCESS, gBTM_REMOTE_DEV_NAME.hci_status);
ASSERT_EQ(kRawAddress, gBTM_REMOTE_DEV_NAME.bd_addr);
ASSERT_STREQ((char*)kBdName, (char*)gBTM_REMOTE_DEV_NAME.remote_bd_name);
@@ -132,7 +133,7 @@ TEST_F(BtmInqActiveTest, btm_process_remote_name__no_name) {
ASSERT_EQ(1, get_func_call_count("alarm_cancel"));
ASSERT_TRUE(gBTM_REMOTE_DEV_NAME_sent);
- ASSERT_EQ(BTM_SUCCESS, gBTM_REMOTE_DEV_NAME.status);
+ ASSERT_EQ(tBTM_STATUS::BTM_SUCCESS, gBTM_REMOTE_DEV_NAME.status);
ASSERT_EQ(HCI_SUCCESS, gBTM_REMOTE_DEV_NAME.hci_status);
ASSERT_EQ(kRawAddress, gBTM_REMOTE_DEV_NAME.bd_addr);
ASSERT_STREQ((char*)kEmptyName, (char*)gBTM_REMOTE_DEV_NAME.remote_bd_name);
@@ -162,7 +163,7 @@ TEST_F(BtmInqActiveTest, btm_process_remote_name__no_address) {
ASSERT_EQ(1, get_func_call_count("alarm_cancel"));
ASSERT_TRUE(gBTM_REMOTE_DEV_NAME_sent);
- ASSERT_EQ(BTM_SUCCESS, gBTM_REMOTE_DEV_NAME.status);
+ ASSERT_EQ(tBTM_STATUS::BTM_SUCCESS, gBTM_REMOTE_DEV_NAME.status);
ASSERT_EQ(HCI_SUCCESS, gBTM_REMOTE_DEV_NAME.hci_status);
ASSERT_EQ(RawAddress::kEmpty, gBTM_REMOTE_DEV_NAME.bd_addr);
ASSERT_STREQ((char*)kBdName, (char*)gBTM_REMOTE_DEV_NAME.remote_bd_name);
diff --git a/system/stack/test/btm/stack_btm_power_mode_test.cc b/system/stack/test/btm/stack_btm_power_mode_test.cc
index 0ec6b7fc71..21ce003ff7 100644
--- a/system/stack/test/btm/stack_btm_power_mode_test.cc
+++ b/system/stack/test/btm/stack_btm_power_mode_test.cc
@@ -21,6 +21,7 @@
#include "hci/controller_interface_mock.h"
#include "stack/include/acl_api.h"
#include "stack/include/acl_hci_link_interface.h"
+#include "stack/include/btm_status.h"
#include "stack/include/hci_error_code.h"
#include "test/common/mock_functions.h"
#include "test/mock/mock_main_shim_entry.h"
@@ -52,20 +53,21 @@ protected:
bluetooth::hci::testing::mock_controller_ = &controller_;
power_mode_callback_queue.clear();
reset_mock_function_count_map();
- ASSERT_EQ(BTM_SUCCESS, BTM_PmRegister(BTM_PM_REG_SET, &pm_id_,
- [](const RawAddress& p_bda, tBTM_PM_STATUS status,
- uint16_t value, tHCI_STATUS hci_status) {
- power_mode_callback_queue.push_back(power_mode_callback{
- .bd_addr = p_bda,
- .status = status,
- .value = value,
- .hci_status = hci_status,
- });
- }));
+ ASSERT_EQ(tBTM_STATUS::BTM_SUCCESS,
+ BTM_PmRegister(BTM_PM_REG_SET, &pm_id_,
+ [](const RawAddress& p_bda, tBTM_PM_STATUS status, uint16_t value,
+ tHCI_STATUS hci_status) {
+ power_mode_callback_queue.push_back(power_mode_callback{
+ .bd_addr = p_bda,
+ .status = status,
+ .value = value,
+ .hci_status = hci_status,
+ });
+ }));
}
void TearDown() override {
- ASSERT_EQ(BTM_SUCCESS,
+ ASSERT_EQ(tBTM_STATUS::BTM_SUCCESS,
BTM_PmRegister(BTM_PM_DEREG, &pm_id_,
[](const RawAddress& /* p_bda */, tBTM_PM_STATUS /* status */,
uint16_t /* value */, tHCI_STATUS /* hci_status */) {}));
@@ -96,7 +98,7 @@ TEST_F(StackBtmPowerMode, BTM_SetPowerMode__Undefined) {
TEST_F(StackBtmPowerModeConnected, BTM_SetPowerMode__AlreadyActive) {
tBTM_PM_PWR_MD mode = {};
- ASSERT_EQ(BTM_SUCCESS, ::BTM_SetPowerMode(pm_id_, kRawAddress, &mode));
+ ASSERT_EQ(tBTM_STATUS::BTM_SUCCESS, ::BTM_SetPowerMode(pm_id_, kRawAddress, &mode));
}
TEST_F(StackBtmPowerModeConnected, BTM_SetPowerMode__ActiveToSniff) {
diff --git a/system/stack/test/rfcomm/stack_rfcomm_test.cc b/system/stack/test/rfcomm/stack_rfcomm_test.cc
index 86e030cc3e..669836d362 100644
--- a/system/stack/test/rfcomm/stack_rfcomm_test.cc
+++ b/system/stack/test/rfcomm/stack_rfcomm_test.cc
@@ -26,6 +26,7 @@
#include "osi/include/allocator.h"
#include "stack/include/bt_hdr.h"
#include "stack/include/bt_psm_types.h"
+#include "stack/include/btm_status.h"
#include "stack/include/l2c_api.h"
#include "stack/include/l2cdefs.h"
#include "stack/include/port_api.h"
@@ -200,7 +201,7 @@ public:
MultiplexingProtocolAccessRequest(peer_addr, BT_PSM_RFCOMM, false,
BTM_SEC_PROTO_RFCOMM, scn, NotNull(), NotNull()))
.WillOnce(DoAll(SaveArg<5>(&security_callback), SaveArg<6>(&p_port),
- Return(BTM_SUCCESS)));
+ Return(tBTM_STATUS::BTM_SUCCESS)));
// sabm_channel_dlci should be freed by this method
l2cap_appl_info_.pL2CA_DataInd_Cb(lcid, sabm_channel_dlci);
@@ -213,7 +214,7 @@ public:
EXPECT_CALL(l2cap_interface_, DataWrite(lcid, BtHdrEqual(ua_channel_dlci)))
.WillOnce(Return(tL2CAP_DW_RESULT::SUCCESS));
ASSERT_TRUE(security_callback);
- security_callback(peer_addr, BT_TRANSPORT_BR_EDR, p_port, BTM_SUCCESS);
+ security_callback(peer_addr, BT_TRANSPORT_BR_EDR, p_port, tBTM_STATUS::BTM_SUCCESS);
osi_free(ua_channel_dlci);
log::verbose("Step 4");
@@ -321,7 +322,7 @@ public:
MultiplexingProtocolAccessRequest(peer_addr, BT_PSM_RFCOMM, true,
BTM_SEC_PROTO_RFCOMM, scn, NotNull(), NotNull()))
.WillOnce(DoAll(SaveArg<5>(&security_callback), SaveArg<6>(&p_port),
- Return(BTM_SUCCESS)));
+ Return(tBTM_STATUS::BTM_SUCCESS)));
l2cap_appl_info_.pL2CA_DataInd_Cb(lcid, uih_pn_channel_3_accept);
log::verbose("Step 3");
@@ -331,7 +332,7 @@ public:
EXPECT_CALL(l2cap_interface_, DataWrite(lcid, BtHdrEqual(sabm_channel_3)))
.WillOnce(Return(tL2CAP_DW_RESULT::SUCCESS));
ASSERT_TRUE(security_callback);
- security_callback(peer_addr, BT_TRANSPORT_BR_EDR, p_port, BTM_SUCCESS);
+ security_callback(peer_addr, BT_TRANSPORT_BR_EDR, p_port, tBTM_STATUS::BTM_SUCCESS);
osi_free(sabm_channel_3);
log::verbose("Step 4");
@@ -737,8 +738,8 @@ TEST_F(StackRfcommTest, DISABLED_TestConnectionCollision) {
MultiplexingProtocolAccessRequest(test_address, BT_PSM_RFCOMM, false,
BTM_SEC_PROTO_RFCOMM, test_server_scn, NotNull(),
NotNull()))
- .WillOnce(
- DoAll(SaveArg<5>(&security_callback), SaveArg<6>(&p_port), Return(BTM_SUCCESS)));
+ .WillOnce(DoAll(SaveArg<5>(&security_callback), SaveArg<6>(&p_port),
+ Return(tBTM_STATUS::BTM_SUCCESS)));
l2cap_appl_info_.pL2CA_DataInd_Cb(new_lcid, sabm_server_scn);
log::verbose("Step 10");
@@ -751,7 +752,7 @@ TEST_F(StackRfcommTest, DISABLED_TestConnectionCollision) {
// Callback should come from server port instead, client port will timeout
// in 20 seconds
EXPECT_CALL(rfcomm_callback_, PortManagementCallback(PORT_SUCCESS, server_handle, 0));
- security_callback(test_address, BT_TRANSPORT_BR_EDR, p_port, BTM_SUCCESS);
+ security_callback(test_address, BT_TRANSPORT_BR_EDR, p_port, tBTM_STATUS::BTM_SUCCESS);
osi_free(ua_server_scn);
log::verbose("Step 11");
diff --git a/system/test/headless/read/name.cc b/system/test/headless/read/name.cc
index 32e013715b..41c81088a1 100644
--- a/system/test/headless/read/name.cc
+++ b/system/test/headless/read/name.cc
@@ -23,6 +23,7 @@
#include "stack/btm/neighbor_inquiry.h"
#include "stack/include/bt_name.h"
#include "stack/include/btm_client_interface.h"
+#include "stack/include/btm_status.h"
#include "test/headless/get_options.h"
#include "test/headless/headless.h"
#include "types/raw_address.h"
@@ -59,7 +60,7 @@ int bluetooth::test::headless::Name::Run() {
tBTM_REMOTE_DEV_NAME name_packet = future.get();
switch (name_packet.status) {
- case BTM_SUCCESS: {
+ case tBTM_STATUS::BTM_SUCCESS: {
char buf[BD_NAME_LEN];
memcpy(buf, name_packet.remote_bd_name, BD_NAME_LEN);
std::string name(buf);
diff --git a/system/test/headless/utils/power_mode_client.h b/system/test/headless/utils/power_mode_client.h
index 90e7372d48..994aeea21d 100644
--- a/system/test/headless/utils/power_mode_client.h
+++ b/system/test/headless/utils/power_mode_client.h
@@ -181,7 +181,7 @@ public:
});
});
- log::assert_that(BTM_SUCCESS == btm_status, "Failed to register power mode:{}",
+ log::assert_that(tBTM_STATUS::BTM_SUCCESS == btm_status, "Failed to register power mode:{}",
btm_status_text(btm_status));
}
@@ -190,7 +190,7 @@ public:
BTM_PM_DEREG, &pm_id_,
[]([[maybe_unused]] const RawAddress& bd_addr, [[maybe_unused]] tBTM_PM_STATUS status,
[[maybe_unused]] uint16_t value, [[maybe_unused]] tHCI_STATUS hci_status) {});
- log::assert_that(BTM_SUCCESS == status, "assert failed: BTM_SUCCESS == status");
+ log::assert_that(tBTM_STATUS::BTM_SUCCESS == status, "assert failed: BTM_SUCCESS == status");
}
Client GetClient(const RawAddress bd_addr) { return Client(pm_id_, bd_addr); }
diff --git a/system/test/mock/mock_main_shim_btm_api.cc b/system/test/mock/mock_main_shim_btm_api.cc
index 9f2ba178f5..e65ea2e136 100644
--- a/system/test/mock/mock_main_shim_btm_api.cc
+++ b/system/test/mock/mock_main_shim_btm_api.cc
@@ -22,64 +22,62 @@
#include <cstdint>
#include "main/shim/btm_api.h"
-#include "stack/include/bt_octets.h"
-#include "stack/include/btm_ble_api_types.h"
+#include "stack/include/btm_status.h"
#include "test/common/mock_functions.h"
-#include "types/bt_transport.h"
#include "types/raw_address.h"
tBTM_STATUS bluetooth::shim::BTM_ClearEventFilter() {
inc_func_call_count(__func__);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
tBTM_STATUS bluetooth::shim::BTM_ClearEventMask() {
inc_func_call_count(__func__);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
tBTM_STATUS bluetooth::shim::BTM_ClearFilterAcceptList() {
inc_func_call_count(__func__);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
tBTM_STATUS bluetooth::shim::BTM_DisconnectAllAcls() {
inc_func_call_count(__func__);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
tBTM_STATUS bluetooth::shim::BTM_SetEventFilterConnectionSetupAllDevices() {
inc_func_call_count(__func__);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
tBTM_STATUS bluetooth::shim::BTM_AllowWakeByHid(
std::vector<RawAddress> /* classic_hid_devices */,
std::vector<std::pair<RawAddress, uint8_t>> /* le_hid_devices */) {
inc_func_call_count(__func__);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
tBTM_STATUS bluetooth::shim::BTM_RestoreFilterAcceptList(
std::vector<std::pair<RawAddress, uint8_t>> /* le_devices */) {
inc_func_call_count(__func__);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
tBTM_STATUS bluetooth::shim::BTM_SetDefaultEventMaskExcept(uint64_t /* mask */,
uint64_t /* le_mask */) {
inc_func_call_count(__func__);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
tBTM_STATUS bluetooth::shim::BTM_SetEventFilterInquiryResultAllDevices() {
inc_func_call_count(__func__);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
tBTM_STATUS bluetooth::shim::BTM_BleResetId() {
inc_func_call_count(__func__);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
size_t bluetooth::shim::BTM_BleGetNumberOfAdvertisingInstancesInUse() {
inc_func_call_count(__func__);
diff --git a/system/test/mock/mock_stack_acl.h b/system/test/mock/mock_stack_acl.h
index 01c0daa20a..d175d230a0 100644
--- a/system/test/mock/mock_stack_acl.h
+++ b/system/test/mock/mock_stack_acl.h
@@ -29,8 +29,8 @@
#include "hci/class_of_device.h"
#include "stack/acl/acl.h"
#include "stack/btm/security_device_record.h"
-#include "stack/include/acl_client_callbacks.h"
#include "stack/include/bt_hdr.h"
+#include "stack/include/btm_status.h"
#include "types/raw_address.h"
// Mocked compile conditionals, if any
@@ -278,7 +278,9 @@ extern struct acl_get_connection_from_handle acl_get_connection_from_handle;
// Returns: tBTM_STATUS
struct BTM_ReadFailedContactCounter {
std::function<tBTM_STATUS(const RawAddress& remote_bda, tBTM_CMPL_CB* p_cb)> body{
- [](const RawAddress& /* remote_bda */, tBTM_CMPL_CB* /* p_cb */) { return BTM_SUCCESS; }};
+ [](const RawAddress& /* remote_bda */, tBTM_CMPL_CB* /* p_cb */) {
+ return tBTM_STATUS::BTM_SUCCESS;
+ }};
tBTM_STATUS operator()(const RawAddress& remote_bda, tBTM_CMPL_CB* p_cb) {
return body(remote_bda, p_cb);
}
@@ -291,7 +293,7 @@ struct BTM_ReadTxPower {
std::function<tBTM_STATUS(const RawAddress& remote_bda, tBT_TRANSPORT transport,
tBTM_CMPL_CB* p_cb)>
body{[](const RawAddress& /* remote_bda */, tBT_TRANSPORT /* transport */,
- tBTM_CMPL_CB* /* p_cb */) { return BTM_SUCCESS; }};
+ tBTM_CMPL_CB* /* p_cb */) { return tBTM_STATUS::BTM_SUCCESS; }};
tBTM_STATUS operator()(const RawAddress& remote_bda, tBT_TRANSPORT transport,
tBTM_CMPL_CB* p_cb) {
return body(remote_bda, transport, p_cb);
@@ -303,7 +305,9 @@ extern struct BTM_ReadTxPower BTM_ReadTxPower;
// Returns: tBTM_STATUS
struct BTM_SetLinkSuperTout {
std::function<tBTM_STATUS(const RawAddress& remote_bda, uint16_t timeout)> body{
- [](const RawAddress& /* remote_bda */, uint16_t /* timeout */) { return BTM_SUCCESS; }};
+ [](const RawAddress& /* remote_bda */, uint16_t /* timeout */) {
+ return tBTM_STATUS::BTM_SUCCESS;
+ }};
tBTM_STATUS operator()(const RawAddress& remote_bda, uint16_t timeout) {
return body(remote_bda, timeout);
}
@@ -315,7 +319,7 @@ extern struct BTM_SetLinkSuperTout BTM_SetLinkSuperTout;
struct btm_remove_acl {
std::function<tBTM_STATUS(const RawAddress& bd_addr, tBT_TRANSPORT transport)> body{
[](const RawAddress& /* bd_addr */, tBT_TRANSPORT /* transport */) {
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}};
tBTM_STATUS operator()(const RawAddress& bd_addr, tBT_TRANSPORT transport) {
return body(bd_addr, transport);
diff --git a/system/test/mock/mock_stack_btm_ble.cc b/system/test/mock/mock_stack_btm_ble.cc
index ac06443e94..e90ef51077 100644
--- a/system/test/mock/mock_stack_btm_ble.cc
+++ b/system/test/mock/mock_stack_btm_ble.cc
@@ -101,11 +101,11 @@ const Octet16 BTM_GetDeviceIDRoot::return_value{0xd5, 0xcb, 0x84, 0x54, 0xd1, 0x
bool btm_ble_get_acl_remote_addr::return_value = false;
bool btm_ble_get_enc_key_type::return_value = false;
uint8_t btm_ble_read_sec_key_size::return_value = 0;
-tBTM_STATUS btm_ble_set_encryption::return_value = BTM_SUCCESS;
-tBTM_STATUS btm_ble_start_encrypt::return_value = BTM_SUCCESS;
-tBTM_STATUS btm_ble_start_sec_check::return_value = BTM_SUCCESS;
+tBTM_STATUS btm_ble_set_encryption::return_value = tBTM_STATUS::BTM_SUCCESS;
+tBTM_STATUS btm_ble_start_encrypt::return_value = tBTM_STATUS::BTM_SUCCESS;
+tBTM_STATUS btm_ble_start_sec_check::return_value = tBTM_STATUS::BTM_SUCCESS;
bool btm_get_local_div::return_value = false;
-tBTM_STATUS btm_proc_smp_cback::return_value = BTM_SUCCESS;
+tBTM_STATUS btm_proc_smp_cback::return_value = tBTM_STATUS::BTM_SUCCESS;
} // namespace stack_btm_ble
} // namespace mock
diff --git a/system/test/mock/mock_stack_btm_ble_gap.cc b/system/test/mock/mock_stack_btm_ble_gap.cc
index 18dd412e44..bfb7870778 100644
--- a/system/test/mock/mock_stack_btm_ble_gap.cc
+++ b/system/test/mock/mock_stack_btm_ble_gap.cc
@@ -26,6 +26,7 @@
#include "stack/btm/btm_ble_int_types.h"
#include "stack/include/bt_dev_class.h"
#include "stack/include/btm_api_types.h"
+#include "stack/include/btm_status.h"
#include "stack/include/hci_error_code.h"
#include "test/common/mock_functions.h"
#include "types/ble_address_with_type.h"
@@ -76,19 +77,19 @@ void BTM_BleTargetAnnouncementObserve(bool /* enable */, tBTM_INQ_RESULTS_CB* /*
}
tBTM_STATUS btm_ble_read_remote_name(const RawAddress& /* remote_bda */, tBTM_CMPL_CB* /* p_cb */) {
inc_func_call_count(__func__);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
tBTM_STATUS btm_ble_set_connectability(uint16_t /* combined_mode */) {
inc_func_call_count(__func__);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
tBTM_STATUS btm_ble_set_discoverability(uint16_t /* combined_mode */) {
inc_func_call_count(__func__);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
tBTM_STATUS btm_ble_start_inquiry(uint8_t /* duration */) {
inc_func_call_count(__func__);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
void BTM_BleGetDynamicAudioBuffer(
tBTM_BT_DYNAMIC_AUDIO_BUFFER_CB /* p_dynamic_audio_buffer_cb*/[]) {
diff --git a/system/test/mock/mock_stack_btm_ble_privacy.h b/system/test/mock/mock_stack_btm_ble_privacy.h
index b035466f49..357e7adf3d 100644
--- a/system/test/mock/mock_stack_btm_ble_privacy.h
+++ b/system/test/mock/mock_stack_btm_ble_privacy.h
@@ -26,6 +26,7 @@
// Original included files, if any
#include "stack/btm/security_device_record.h"
+#include "stack/include/btm_status.h"
// Mocked compile conditionals, if any
namespace test {
@@ -75,7 +76,7 @@ extern struct btm_ble_read_resolving_list_entry_complete btm_ble_read_resolving_
// Returns: tBTM_STATUS
struct btm_ble_remove_resolving_list_entry {
std::function<tBTM_STATUS(tBTM_SEC_DEV_REC* p_dev_rec)> body{
- [](tBTM_SEC_DEV_REC* /* p_dev_rec */) { return BTM_SUCCESS; }};
+ [](tBTM_SEC_DEV_REC* /* p_dev_rec */) { return tBTM_STATUS::BTM_SUCCESS; }};
tBTM_STATUS operator()(tBTM_SEC_DEV_REC* p_dev_rec) { return body(p_dev_rec); }
};
extern struct btm_ble_remove_resolving_list_entry btm_ble_remove_resolving_list_entry;
diff --git a/system/test/mock/mock_stack_btm_devctl.cc b/system/test/mock/mock_stack_btm_devctl.cc
index 2daa72402b..e3f4cb2a74 100644
--- a/system/test/mock/mock_stack_btm_devctl.cc
+++ b/system/test/mock/mock_stack_btm_devctl.cc
@@ -39,11 +39,11 @@ namespace stack_btm_devctl {
tBTM_STATUS BTM_DeleteStoredLinkKey(const RawAddress* /* bd_addr */, tBTM_CMPL_CB* /* p_cb */) {
inc_func_call_count(__func__);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
tBTM_STATUS BTM_EnableTestMode(void) {
inc_func_call_count(__func__);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
DEV_CLASS BTM_ReadDeviceClass(void) {
inc_func_call_count(__func__);
diff --git a/system/test/mock/mock_stack_btm_inq.cc b/system/test/mock/mock_stack_btm_inq.cc
index ae49b8a16f..06b0738d1c 100644
--- a/system/test/mock/mock_stack_btm_inq.cc
+++ b/system/test/mock/mock_stack_btm_inq.cc
@@ -24,6 +24,7 @@
#include <cstdint>
+#include "stack/include/btm_status.h"
#include "test/common/mock_functions.h"
// Original usings
@@ -69,10 +70,10 @@ namespace stack_btm_inq {
bool BTM_HasEirService::return_value = false;
uint16_t BTM_IsInquiryActive::return_value = 0;
-tBTM_STATUS BTM_SetConnectability::return_value = BTM_SUCCESS;
-tBTM_STATUS BTM_SetDiscoverability::return_value = BTM_SUCCESS;
-tBTM_STATUS BTM_SetInquiryMode::return_value = BTM_SUCCESS;
-tBTM_STATUS BTM_StartInquiry::return_value = BTM_SUCCESS;
+tBTM_STATUS BTM_SetConnectability::return_value = tBTM_STATUS::BTM_SUCCESS;
+tBTM_STATUS BTM_SetDiscoverability::return_value = tBTM_STATUS::BTM_SUCCESS;
+tBTM_STATUS BTM_SetInquiryMode::return_value = tBTM_STATUS::BTM_SUCCESS;
+tBTM_STATUS BTM_StartInquiry::return_value = tBTM_STATUS::BTM_SUCCESS;
tINQ_DB_ENT* btm_inq_db_find::return_value = nullptr;
tINQ_DB_ENT* btm_inq_db_new::return_value = nullptr;
bool btm_inq_find_bdaddr::return_value = false;
diff --git a/system/test/mock/mock_stack_btm_interface.cc b/system/test/mock/mock_stack_btm_interface.cc
index b07dd75a49..2e902a1c1d 100644
--- a/system/test/mock/mock_stack_btm_interface.cc
+++ b/system/test/mock/mock_stack_btm_interface.cc
@@ -35,7 +35,7 @@ struct btm_client_interface_t default_btm_client_interface = {
.lifecycle = {
.BTM_PmRegister = [](uint8_t /* mask */, uint8_t* /* p_pm_id */,
tBTM_PM_STATUS_CBACK* /* p_cb */) -> tBTM_STATUS {
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
},
.ACL_RegisterClient = [](struct acl_client_callback_s* /* callbacks */) {},
.ACL_UnregisterClient = [](struct acl_client_callback_s* /* callbacks */) {},
@@ -54,10 +54,14 @@ struct btm_client_interface_t default_btm_client_interface = {
tBT_TRANSPORT /* transport */) -> bool {
return false;
},
- .BTM_CancelRemoteDeviceName = []() -> tBTM_STATUS { return BTM_SUCCESS; },
- .BTM_ReadRemoteDeviceName =
- [](const RawAddress& /* remote_bda */, tBTM_NAME_CMPL_CB* /* p_cb */,
- tBT_TRANSPORT /* transport */) -> tBTM_STATUS { return BTM_SUCCESS; },
+ .BTM_CancelRemoteDeviceName = []() -> tBTM_STATUS {
+ return tBTM_STATUS::BTM_SUCCESS;
+ },
+ .BTM_ReadRemoteDeviceName = [](const RawAddress& /* remote_bda */,
+ tBTM_NAME_CMPL_CB* /* p_cb */,
+ tBT_TRANSPORT /* transport */) -> tBTM_STATUS {
+ return tBTM_STATUS::BTM_SUCCESS;
+ },
.BTM_ReadRemoteFeatures = [](const RawAddress& /* addr */) -> uint8_t* {
return hci_feature_bytes_per_page;
},
@@ -85,17 +89,17 @@ struct btm_client_interface_t default_btm_client_interface = {
tBT_TRANSPORT /* transport */) -> uint16_t { return 0; },
},
.link_policy = {
- .BTM_GetRole = [](const RawAddress& /* remote_bd_addr */,
- tHCI_ROLE* /* p_role */) -> tBTM_STATUS { return BTM_SUCCESS; },
+ .BTM_GetRole = [](const RawAddress& /* remote_bd_addr */, tHCI_ROLE* /* p_role */)
+ -> tBTM_STATUS { return tBTM_STATUS::BTM_SUCCESS; },
.BTM_SetPowerMode = [](uint8_t /* pm_id */, const RawAddress& /* remote_bda */,
const tBTM_PM_PWR_MD* /* p_mode */) -> tBTM_STATUS {
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
},
.BTM_SetSsrParams = [](RawAddress const& /* bd_addr */, uint16_t /* max_lat */,
uint16_t /* min_rmt_to */, uint16_t /* min_loc_to */)
- -> tBTM_STATUS { return BTM_SUCCESS; },
+ -> tBTM_STATUS { return tBTM_STATUS::BTM_SUCCESS; },
.BTM_SwitchRoleToCentral = [](const RawAddress& /* remote_bd_addr */)
- -> tBTM_STATUS { return BTM_SUCCESS; },
+ -> tBTM_STATUS { return tBTM_STATUS::BTM_SUCCESS; },
.BTM_block_role_switch_for = [](const RawAddress& /* peer_addr */) {},
.BTM_block_sniff_mode_for = [](const RawAddress& /* peer_addr */) {},
.BTM_default_unblock_role_switch = []() {},
@@ -106,10 +110,10 @@ struct btm_client_interface_t default_btm_client_interface = {
.link_controller = {
.BTM_GetLinkSuperTout = [](const RawAddress& /* remote_bda */,
uint16_t* /* p_timeout */) -> tBTM_STATUS {
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
},
- .BTM_ReadRSSI = [](const RawAddress& /* remote_bda */,
- tBTM_CMPL_CB* /* p_cb */) -> tBTM_STATUS { return BTM_SUCCESS; },
+ .BTM_ReadRSSI = [](const RawAddress& /* remote_bda */, tBTM_CMPL_CB* /* p_cb */)
+ -> tBTM_STATUS { return tBTM_STATUS::BTM_SUCCESS; },
},
.security = {
.BTM_Sec_Init = []() {},
@@ -130,10 +134,12 @@ struct btm_client_interface_t default_btm_client_interface = {
tBTM_LE_KEY_VALUE* /* p_le_key */,
tBTM_LE_KEY_TYPE /* key_type */) {},
.BTM_SecClearSecurityFlags = [](const RawAddress& /* bd_addr */) {},
- .BTM_SetEncryption =
- [](const RawAddress& /* bd_addr */, tBT_TRANSPORT /* transport */,
- tBTM_SEC_CALLBACK* /* p_callback */, void* /* p_ref_data */,
- tBTM_BLE_SEC_ACT /* sec_act */) -> tBTM_STATUS { return BTM_SUCCESS; },
+ .BTM_SetEncryption = [](const RawAddress& /* bd_addr */,
+ tBT_TRANSPORT /* transport */,
+ tBTM_SEC_CALLBACK* /* p_callback */, void* /* p_ref_data */,
+ tBTM_BLE_SEC_ACT /* sec_act */) -> tBTM_STATUS {
+ return tBTM_STATUS::BTM_SUCCESS;
+ },
.BTM_IsEncrypted = [](const RawAddress& /* bd_addr */,
tBT_TRANSPORT /* transport */) -> bool { return false; },
.BTM_SecIsSecurityPending = [](const RawAddress& /* bd_addr */) -> bool {
@@ -145,9 +151,9 @@ struct btm_client_interface_t default_btm_client_interface = {
.BTM_SecClrServiceByPsm = [](uint16_t /* psm */) -> uint8_t { return 0; },
.BTM_SecBond = [](const RawAddress& /* bd_addr */, tBLE_ADDR_TYPE /* addr_type */,
tBT_TRANSPORT /* transport */, tBT_DEVICE_TYPE /* device_type */)
- -> tBTM_STATUS { return BTM_SUCCESS; },
+ -> tBTM_STATUS { return tBTM_STATUS::BTM_SUCCESS; },
.BTM_SecBondCancel = [](const RawAddress& /* bd_addr */) -> tBTM_STATUS {
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
},
.BTM_RemoteOobDataReply = [](tBTM_STATUS /* res */, const RawAddress& /* bd_addr */,
@@ -171,15 +177,15 @@ struct btm_client_interface_t default_btm_client_interface = {
},
.ble = {
.BTM_BleGetEnergyInfo = [](tBTM_BLE_ENERGY_INFO_CBACK* /* p_ener_cback */)
- -> tBTM_STATUS { return BTM_SUCCESS; },
+ -> tBTM_STATUS { return tBTM_STATUS::BTM_SUCCESS; },
.BTM_BleObserve = [](bool /* start */, uint8_t /* duration */,
tBTM_INQ_RESULTS_CB* /* p_results_cb */,
tBTM_CMPL_CB* /* p_cmpl_cb */) -> tBTM_STATUS {
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
},
.BTM_SetBleDataLength = [](const RawAddress& /* bd_addr */,
uint16_t /* tx_pdu_length */) -> tBTM_STATUS {
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
},
.BTM_BleReadControllerFeatures =
[](tBTM_BLE_CTRL_FEATURES_CBACK* /* p_vsc_cback */) {},
@@ -199,19 +205,21 @@ struct btm_client_interface_t default_btm_client_interface = {
.BTM_CreateSco = [](const RawAddress* /* remote_bda */, bool /* is_orig */,
uint16_t /* pkt_types */, uint16_t* /* p_sco_inx */,
tBTM_SCO_CB* /* p_conn_cb */, tBTM_SCO_CB* /* p_disc_cb */)
- -> tBTM_STATUS { return BTM_SUCCESS; },
+ -> tBTM_STATUS { return tBTM_STATUS::BTM_SUCCESS; },
.BTM_RegForEScoEvts = [](uint16_t /* sco_inx */,
tBTM_ESCO_CBACK* /* p_esco_cback */) -> tBTM_STATUS {
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
+ },
+ .BTM_RemoveSco = [](uint16_t /* sco_inx */) -> tBTM_STATUS {
+ return tBTM_STATUS::BTM_SUCCESS;
},
- .BTM_RemoveSco = [](uint16_t /* sco_inx */) -> tBTM_STATUS { return BTM_SUCCESS; },
.BTM_RemoveScoByBdaddr = [](const RawAddress& /* bd_addr */) {},
.BTM_WriteVoiceSettings = [](uint16_t /* settings */) {},
.BTM_EScoConnRsp = [](uint16_t /* sco_inx */, tHCI_STATUS /* hci_status */,
enh_esco_params_t* /* p_parms */) {},
.BTM_GetNumScoLinks = []() -> uint8_t { return 0; },
.BTM_SetEScoMode = [](enh_esco_params_t* /* p_parms */) -> tBTM_STATUS {
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
},
.BTM_GetScoDebugDump = []() -> tBTM_SCO_DEBUG_DUMP { return {}; },
.BTM_IsScoActiveByBdaddr = [](const RawAddress& /* remote_bda */) -> bool {
@@ -220,21 +228,23 @@ struct btm_client_interface_t default_btm_client_interface = {
},
.local = {
.BTM_ReadLocalDeviceName = [](const char** /* p_name */) -> tBTM_STATUS {
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
},
.BTM_ReadLocalDeviceNameFromController = [](tBTM_CMPL_CB* /* p_rln_cmpl_cback */)
- -> tBTM_STATUS { return BTM_SUCCESS; },
+ -> tBTM_STATUS { return tBTM_STATUS::BTM_SUCCESS; },
.BTM_SetLocalDeviceName = [](const char* /* p_name */) -> tBTM_STATUS {
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
},
.BTM_SetDeviceClass = [](DEV_CLASS /* dev_class */) -> tBTM_STATUS {
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
},
.BTM_IsDeviceUp = []() -> bool { return true; },
.BTM_ReadDeviceClass = []() -> DEV_CLASS { return kDevClassEmpty; },
},
.eir = {
- .BTM_WriteEIR = [](BT_HDR* /* p_buff */) -> tBTM_STATUS { return BTM_SUCCESS; },
+ .BTM_WriteEIR = [](BT_HDR* /* p_buff */) -> tBTM_STATUS {
+ return tBTM_STATUS::BTM_SUCCESS;
+ },
.BTM_GetEirSupportedServices = [](uint32_t* /* p_eir_uuid */, uint8_t** /* p */,
uint8_t /* max_num_uuid16 */,
uint8_t* /* p_num_uuid16 */) -> uint8_t {
@@ -256,7 +266,7 @@ struct btm_client_interface_t default_btm_client_interface = {
return nullptr;
},
.BTM_ClearInqDb = [](const RawAddress* /* p_bda */) -> tBTM_STATUS {
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
},
},
.vendor =
@@ -271,7 +281,7 @@ struct btm_client_interface_t default_btm_client_interface = {
void BTM_BleReadControllerFeatures(void (*)(tHCI_ERROR_CODE)) {}
tBTM_STATUS BTM_BleGetEnergyInfo(tBTM_BLE_ENERGY_INFO_CBACK* /* p_ener_cback */) {
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
// Initialize the working btm client interface to the default
diff --git a/system/test/mock/mock_stack_btm_sco.cc b/system/test/mock/mock_stack_btm_sco.cc
index d46e55972d..23b91658ba 100644
--- a/system/test/mock/mock_stack_btm_sco.cc
+++ b/system/test/mock/mock_stack_btm_sco.cc
@@ -42,7 +42,7 @@ tBTM_STATUS BTM_CreateSco(const RawAddress* /* remote_bda */, bool /* is_orig */
uint16_t /* pkt_types */, uint16_t* /* p_sco_inx */,
tBTM_SCO_CB* /* p_conn_cb */, tBTM_SCO_CB* /* p_disc_cb */) {
inc_func_call_count(__func__);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
uint8_t BTM_GetNumScoLinks(void) {
inc_func_call_count(__func__);
diff --git a/system/test/mock/mock_stack_btm_sec.cc b/system/test/mock/mock_stack_btm_sec.cc
index a0c4fe41de..9d8c98c775 100644
--- a/system/test/mock/mock_stack_btm_sec.cc
+++ b/system/test/mock/mock_stack_btm_sec.cc
@@ -118,23 +118,23 @@ bool BTM_IsLinkKeyAuthed::return_value = false;
bool BTM_IsLinkKeyKnown::return_value = false;
bool BTM_PeerSupportsSecureConnections::return_value = false;
bool BTM_SecAddRmtNameNotifyCallback::return_value = false;
-tBTM_STATUS BTM_SecBond::return_value = BTM_SUCCESS;
-tBTM_STATUS BTM_SecBondCancel::return_value = BTM_SUCCESS;
+tBTM_STATUS BTM_SecBond::return_value = tBTM_STATUS::BTM_SUCCESS;
+tBTM_STATUS BTM_SecBondCancel::return_value = tBTM_STATUS::BTM_SUCCESS;
uint8_t BTM_SecClrService::return_value = 0;
uint8_t BTM_SecClrServiceByPsm::return_value = 0;
bool BTM_SecDeleteRmtNameNotifyCallback::return_value = false;
tBTM_LINK_KEY_TYPE BTM_SecGetDeviceLinkKeyType::return_value = 0;
bool BTM_SecIsSecurityPending::return_value = false;
bool BTM_SecRegister::return_value = false;
-tBTM_STATUS BTM_SetEncryption::return_value = BTM_SUCCESS;
+tBTM_STATUS BTM_SetEncryption::return_value = tBTM_STATUS::BTM_SUCCESS;
bool BTM_SetSecurityLevel::return_value = false;
const DEV_CLASS btm_get_dev_class::return_value = kDevClassEmpty;
-tBTM_STATUS btm_sec_bond_by_transport::return_value = BTM_SUCCESS;
-tBTM_STATUS btm_sec_disconnect::return_value = BTM_SUCCESS;
+tBTM_STATUS btm_sec_bond_by_transport::return_value = tBTM_STATUS::BTM_SUCCESS;
+tBTM_STATUS btm_sec_disconnect::return_value = tBTM_STATUS::BTM_SUCCESS;
bool btm_sec_is_a_bonded_dev::return_value = false;
-tBTM_STATUS btm_sec_l2cap_access_req::return_value = BTM_SUCCESS;
-tBTM_STATUS btm_sec_l2cap_access_req_by_requirement::return_value = BTM_SUCCESS;
-tBTM_STATUS btm_sec_mx_access_request::return_value = BTM_SUCCESS;
+tBTM_STATUS btm_sec_l2cap_access_req::return_value = tBTM_STATUS::BTM_SUCCESS;
+tBTM_STATUS btm_sec_l2cap_access_req_by_requirement::return_value = tBTM_STATUS::BTM_SUCCESS;
+tBTM_STATUS btm_sec_mx_access_request::return_value = tBTM_STATUS::BTM_SUCCESS;
bool BTM_IsRemoteNameKnown::return_value = false;
diff --git a/system/test/mock/mock_stack_l2cap_link.cc b/system/test/mock/mock_stack_l2cap_link.cc
index 224c37a64d..cc05d9a566 100644
--- a/system/test/mock/mock_stack_l2cap_link.cc
+++ b/system/test/mock/mock_stack_l2cap_link.cc
@@ -21,6 +21,7 @@
#include <cstdint>
#include "stack/include/bt_hdr.h"
+#include "stack/include/btm_status.h"
#include "stack/l2cap/l2c_int.h"
#include "test/common/mock_functions.h"
#include "types/raw_address.h"
@@ -35,7 +36,7 @@ bool l2c_link_hci_disc_comp(uint16_t /* handle */, tHCI_REASON /* reason */) {
}
tBTM_STATUS l2cu_ConnectAclForSecurity(const RawAddress& /* bd_addr */) {
inc_func_call_count(__func__);
- return BTM_SUCCESS;
+ return tBTM_STATUS::BTM_SUCCESS;
}
tL2C_CCB* l2cu_get_next_channel_in_rr(tL2C_LCB* /* p_lcb */) {
inc_func_call_count(__func__);