Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 03b4fc06 authored by Chris Manton's avatar Chris Manton
Browse files

Use proper tHCI_STATUS types

Towards readable code

Bug: 163134718
Tag: #refactor
Test: gd/cert/run --host

Change-Id: Ide1a5faa7afbed347a77d5c484a633479bf641ef
parent bee3615c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@ inline std::string link_policy_text(tLINK_POLICY policy) {
 */
typedef struct {
  RawAddress remote_bd_addr; /* Remote BD addr involved with the switch */
  uint8_t hci_status;        /* HCI status returned with the event */
  tHCI_STATUS hci_status;    /* HCI status returned with the event */
  uint8_t role;              /* HCI_ROLE_CENTRAL or HCI_ROLE_PERIPHERAL */
} tBTM_ROLE_SWITCH_CMPL;

+1 −1
Original line number Diff line number Diff line
@@ -1215,7 +1215,7 @@ tBTM_STATUS btm_ble_start_inquiry(uint8_t duration) {
 ******************************************************************************/
void btm_ble_read_remote_name_cmpl(bool status, const RawAddress& bda,
                                   uint16_t length, char* p_name) {
  uint8_t hci_status = HCI_SUCCESS;
  tHCI_STATUS hci_status = HCI_SUCCESS;
  BD_NAME bd_name;

  memset(bd_name, 0, (BD_NAME_LEN + 1));
+13 −11
Original line number Diff line number Diff line
@@ -2118,7 +2118,7 @@ bool is_state_getting_name(void* data, void* context) {
 *
 ******************************************************************************/
void btm_sec_rmt_name_request_complete(const RawAddress* p_bd_addr,
                                       uint8_t* p_bd_name, uint8_t status) {
                                       uint8_t* p_bd_name, tHCI_STATUS status) {
  tBTM_SEC_DEV_REC* p_dev_rec;
  int i;
  DEV_CLASS dev_class;
@@ -2339,10 +2339,10 @@ void btm_sec_rmt_name_request_complete(const RawAddress* p_bd_addr,
  }

  /* Remote Name succeeded, execute the next security procedure, if any */
  status = (uint8_t)btm_sec_execute_procedure(p_dev_rec);
  tBTM_STATUS btm_status = btm_sec_execute_procedure(p_dev_rec);

  /* If result is pending reply from the user or from the device is pending */
  if (status == BTM_CMD_STARTED) return;
  if (btm_status == BTM_CMD_STARTED) return;

  /* There is no next procedure or start of procedure failed, notify the waiting
   * layer */
@@ -3148,7 +3148,7 @@ void btm_sec_auth_complete(uint16_t handle, tHCI_STATUS status) {
 * Returns          void
 *
 ******************************************************************************/
void btm_sec_encrypt_change(uint16_t handle, uint8_t status,
void btm_sec_encrypt_change(uint16_t handle, tHCI_STATUS status,
                            uint8_t encr_enable) {
  tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev_by_handle(handle);
  BTM_TRACE_EVENT(
@@ -3280,11 +3280,11 @@ void btm_sec_encrypt_change(uint16_t handle, uint8_t status,
  }

  /* Encryption setup succeeded, execute the next security procedure, if any */
  status = (uint8_t)btm_sec_execute_procedure(p_dev_rec);
  tBTM_STATUS btm_status = btm_sec_execute_procedure(p_dev_rec);
  /* If there is no next procedure, or procedure failed to start, notify the
   * caller */
  if (status != BTM_CMD_STARTED)
    btm_sec_dev_rec_cback_event(p_dev_rec, status, false);
    btm_sec_dev_rec_cback_event(p_dev_rec, btm_status, false);
}

/*******************************************************************************
@@ -3326,8 +3326,8 @@ static void btm_sec_connect_after_reject_timeout(UNUSED_ATTR void* data) {
 * Returns          void
 *
 ******************************************************************************/
void btm_sec_connected(const RawAddress& bda, uint16_t handle, uint8_t status,
                       uint8_t enc_mode) {
void btm_sec_connected(const RawAddress& bda, uint16_t handle,
                       tHCI_STATUS status, uint8_t enc_mode) {
  tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(bda);
  uint8_t res;
  bool is_pairing_device = false;
@@ -3339,13 +3339,15 @@ void btm_sec_connected(const RawAddress& bda, uint16_t handle, uint8_t status,
  if (p_dev_rec) {
    VLOG(2) << __func__ << ": Security Manager: in state: "
            << btm_pair_state_descr(btm_cb.pairing_state)
            << " handle:" << handle << " status:" << loghex(status)
            << " handle:" << handle
            << " status:" << loghex(static_cast<uint16_t>(status))
            << " enc_mode:" << loghex(enc_mode) << " bda:" << bda
            << " RName:" << p_dev_rec->sec_bd_name;
  } else {
    VLOG(2) << __func__ << ": Security Manager: in state: "
            << btm_pair_state_descr(btm_cb.pairing_state)
            << " handle:" << handle << " status:" << loghex(status)
            << " handle:" << handle
            << " status:" << loghex(static_cast<uint16_t>(status))
            << " enc_mode:" << loghex(enc_mode) << " bda:" << bda;
  }

@@ -3629,7 +3631,7 @@ tBTM_STATUS btm_sec_disconnect(uint16_t handle, tHCI_STATUS reason) {
void btm_sec_disconnected(uint16_t handle, tHCI_STATUS reason) {
  tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev_by_handle(handle);
  uint8_t old_pairing_flags = btm_cb.pairing_flags;
  int result = HCI_ERR_AUTH_FAILURE;
  tHCI_STATUS result = HCI_ERR_AUTH_FAILURE;
  tBTM_SEC_CALLBACK* p_callback = NULL;
  tBT_TRANSPORT transport = BT_TRANSPORT_BR_EDR;

+4 −4
Original line number Diff line number Diff line
@@ -498,7 +498,7 @@ bool is_state_getting_name(void* data, void* context);
 *
 ******************************************************************************/
void btm_sec_rmt_name_request_complete(const RawAddress* p_bd_addr,
                                       uint8_t* p_bd_name, uint8_t status);
                                       uint8_t* p_bd_name, tHCI_STATUS status);

/*******************************************************************************
 *
@@ -609,7 +609,7 @@ void btm_sec_auth_complete(uint16_t handle, tHCI_STATUS status);
 * Returns          void
 *
 ******************************************************************************/
void btm_sec_encrypt_change(uint16_t handle, uint8_t status,
void btm_sec_encrypt_change(uint16_t handle, tHCI_STATUS status,
                            uint8_t encr_enable);

/*******************************************************************************
@@ -622,8 +622,8 @@ void btm_sec_encrypt_change(uint16_t handle, uint8_t status,
 * Returns          void
 *
 ******************************************************************************/
void btm_sec_connected(const RawAddress& bda, uint16_t handle, uint8_t status,
                       uint8_t enc_mode);
void btm_sec_connected(const RawAddress& bda, uint16_t handle,
                       tHCI_STATUS status, uint8_t enc_mode);

/*******************************************************************************
 *
+2 −2
Original line number Diff line number Diff line
@@ -180,8 +180,8 @@ typedef struct {
                               uint8_t pin_len, uint8_t* p_pin);
  friend void btm_sec_auth_complete(uint16_t handle, tHCI_STATUS status);
  friend void btm_sec_connected(const RawAddress& bda, uint16_t handle,
                                uint8_t status, uint8_t enc_mode);
  friend void btm_sec_encrypt_change(uint16_t handle, uint8_t status,
                                tHCI_STATUS status, uint8_t enc_mode);
  friend void btm_sec_encrypt_change(uint16_t handle, tHCI_STATUS status,
                                     uint8_t encr_enable);
  friend void btm_sec_link_key_notification(const RawAddress& p_bda,
                                            const Octet16& link_key,
Loading