From d047f92771f0b4168cae430f67b3fc1b06daa535 Mon Sep 17 00:00:00 2001 From: Chris Manton Date: Tue, 9 Feb 2021 18:49:01 -0800 Subject: [PATCH] Use proper types tHCI_STATUS Towards readable code Bug: 163134718 Tag: #refactor Test: gd/cert/run Change-Id: I2ae7248a2503fad7ef22c08ca09b43fcbf877cbf --- stack/acl/btm_ble_connection_establishment.cc | 7 ++++--- stack/btm/btm_ble_gap.cc | 2 +- stack/btm/btm_ble_int.h | 3 ++- stack/btu/btu_hcif.cc | 2 +- stack/include/ble_hci_link_interface.h | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/stack/acl/btm_ble_connection_establishment.cc b/stack/acl/btm_ble_connection_establishment.cc index 1db9646b1..c9a01e7dd 100644 --- a/stack/acl/btm_ble_connection_establishment.cc +++ b/stack/acl/btm_ble_connection_establishment.cc @@ -86,11 +86,11 @@ void btm_send_hci_create_connection( } /** LE connection complete. */ -void btm_ble_create_ll_conn_complete(uint8_t status) { +void btm_ble_create_ll_conn_complete(tHCI_STATUS status) { if (status == HCI_SUCCESS) return; LOG(WARNING) << "LE Create Connection attempt failed, status=" - << loghex(status); + << hci_error_code_text(status); if (status == HCI_ERR_COMMAND_DISALLOWED) { btm_cb.ble_ctr_cb.set_connection_state_connecting(); @@ -235,7 +235,8 @@ void btm_ble_create_conn_cancel_complete(uint8_t* p) { if (btm_cb.ble_ctr_cb.is_connection_state_cancelled()) { btm_cb.ble_ctr_cb.set_connection_state_idle(); btm_ble_clear_topology_mask(BTM_BLE_STATE_INIT_BIT); - btm_ble_update_mode_operation(HCI_ROLE_UNKNOWN, nullptr, status); + btm_ble_update_mode_operation(HCI_ROLE_UNKNOWN, nullptr, + static_cast(status)); } } } diff --git a/stack/btm/btm_ble_gap.cc b/stack/btm/btm_ble_gap.cc index 53c4fdb0c..37e71f480 100644 --- a/stack/btm/btm_ble_gap.cc +++ b/stack/btm/btm_ble_gap.cc @@ -2475,7 +2475,7 @@ void btm_ble_decrement_link_topology_mask(uint8_t link_role) { * ******************************************************************************/ void btm_ble_update_mode_operation(uint8_t link_role, const RawAddress* bd_addr, - uint8_t status) { + tHCI_STATUS status) { if (status == HCI_ERR_ADVERTISING_TIMEOUT) { btm_cb.ble_ctr_cb.inq_var.adv_mode = BTM_BLE_ADV_DISABLE; /* make device fall back into undirected adv mode by default */ diff --git a/stack/btm/btm_ble_int.h b/stack/btm/btm_ble_int.h index e37e64342..f015baf45 100644 --- a/stack/btm/btm_ble_int.h +++ b/stack/btm/btm_ble_int.h @@ -33,6 +33,7 @@ #include "btm_int_types.h" #include "hcidefs.h" #include "smp_api.h" +#include "stack/include/hci_error_code.h" extern void btm_ble_process_periodic_adv_sync_est_evt(uint8_t len, uint8_t* p); extern void btm_ble_process_periodic_adv_pkt(uint8_t len, uint8_t* p); @@ -97,7 +98,7 @@ extern bool btm_ble_suspend_bg_conn(void); extern bool btm_ble_resume_bg_conn(void); extern void btm_ble_update_mode_operation(uint8_t link_role, const RawAddress* bda, - uint8_t status); + tHCI_STATUS status); extern void btm_ble_bgconn_cancel_if_disconnected(const RawAddress& bd_addr); /* BLE address management */ diff --git a/stack/btu/btu_hcif.cc b/stack/btu/btu_hcif.cc index b5499d385..353246ba0 100644 --- a/stack/btu/btu_hcif.cc +++ b/stack/btu/btu_hcif.cc @@ -1448,7 +1448,7 @@ static void btu_hcif_hdl_command_status(uint16_t opcode, uint8_t status, case HCI_BLE_CREATE_LL_CONN: case HCI_LE_EXTENDED_CREATE_CONNECTION: if (status != HCI_SUCCESS) { - btm_ble_create_ll_conn_complete(status); + btm_ble_create_ll_conn_complete(static_cast(status)); } break; case HCI_BLE_START_ENC: diff --git a/stack/include/ble_hci_link_interface.h b/stack/include/ble_hci_link_interface.h index e77b1d851..fd4b462c1 100644 --- a/stack/include/ble_hci_link_interface.h +++ b/stack/include/ble_hci_link_interface.h @@ -28,7 +28,7 @@ void btm_ble_process_phy_update_pkt(uint8_t len, uint8_t* p); void btm_ble_read_remote_features_complete(uint8_t* p); void btm_le_on_advertising_set_terminated(uint8_t* p, uint16_t length); extern void btm_ble_write_adv_enable_complete(uint8_t* p); -extern void btm_ble_create_ll_conn_complete(uint8_t status); +extern void btm_ble_create_ll_conn_complete(tHCI_STATUS status); extern void btm_ble_ltk_request(uint16_t handle, uint8_t rand[8], uint16_t ediv); extern void btm_ble_test_command_complete(uint8_t* p); -- 2.11.0