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

Commit 20b4bb12 authored by Chris Manton's avatar Chris Manton
Browse files

Use proper types tHCI_STATUS/tHCI_REASON

Towards readable code

Bug: 163134718
Tag: #refactor
Test: gd/cert/run
Change-Id: Ib8f01833a0de300b7612d584d2eae542f465f54c
parent 0186b393
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -59,6 +59,7 @@
#include "stack/include/btm_api.h"
#include "stack/include/btm_api.h"
#include "stack/include/btm_iso_api.h"
#include "stack/include/btm_iso_api.h"
#include "stack/include/btu.h"
#include "stack/include/btu.h"
#include "stack/include/hci_error_code.h"
#include "stack/include/hcimsgs.h"
#include "stack/include/hcimsgs.h"
#include "stack/include/l2cap_acl_interface.h"
#include "stack/include/l2cap_acl_interface.h"
#include "stack/include/sco_hci_link_interface.h"
#include "stack/include/sco_hci_link_interface.h"
@@ -66,7 +67,7 @@


void gatt_find_in_device_record(const RawAddress& bd_addr,
void gatt_find_in_device_record(const RawAddress& bd_addr,
                                tBLE_BD_ADDR* address_with_type);
                                tBLE_BD_ADDR* address_with_type);
void l2c_link_hci_conn_comp(uint8_t status, uint16_t handle,
void l2c_link_hci_conn_comp(tHCI_STATUS status, uint16_t handle,
                            const RawAddress& p_bda);
                            const RawAddress& p_bda);


void BTM_db_reset(void);
void BTM_db_reset(void);
+3 −1
Original line number Original line Diff line number Diff line
@@ -42,6 +42,7 @@
#include "stack/include/btu.h"
#include "stack/include/btu.h"
#include "stack/include/dev_hci_link_interface.h"
#include "stack/include/dev_hci_link_interface.h"
#include "stack/include/gatt_api.h"
#include "stack/include/gatt_api.h"
#include "stack/include/hci_error_code.h"
#include "stack/include/hci_evt_length.h"
#include "stack/include/hci_evt_length.h"
#include "stack/include/hcidefs.h"
#include "stack/include/hcidefs.h"
#include "stack/include/inq_hci_link_interface.h"
#include "stack/include/inq_hci_link_interface.h"
@@ -52,7 +53,8 @@
using base::Location;
using base::Location;
using bluetooth::hci::IsoManager;
using bluetooth::hci::IsoManager;


bool l2c_link_hci_disc_comp(uint16_t handle, uint8_t reason);  // TODO remove
bool l2c_link_hci_disc_comp(uint16_t handle,
                            tHCI_REASON reason);               // TODO remove
bool BTM_BLE_IS_RESOLVE_BDA(const RawAddress& x);              // TODO remove
bool BTM_BLE_IS_RESOLVE_BDA(const RawAddress& x);              // TODO remove
void BTA_sys_signal_hw_error();                                // TODO remove
void BTA_sys_signal_hw_error();                                // TODO remove
void smp_cancel_start_encryption_attempt();                    // TODO remove
void smp_cancel_start_encryption_attempt();                    // TODO remove
+2 −1
Original line number Original line Diff line number Diff line
@@ -18,10 +18,11 @@
#pragma once
#pragma once


#include "bt_common.h"
#include "bt_common.h"
#include "stack/include/hci_error_code.h"


// This header contains functions for HCI-LinkManagement to invoke
// This header contains functions for HCI-LinkManagement to invoke


extern bool l2c_link_hci_disc_comp(uint16_t handle, uint8_t reason);
extern bool l2c_link_hci_disc_comp(uint16_t handle, tHCI_REASON reason);


extern void l2c_link_role_changed(const RawAddress* bd_addr, uint8_t new_role,
extern void l2c_link_role_changed(const RawAddress* bd_addr, uint8_t new_role,
                                  uint8_t hci_status);
                                  uint8_t hci_status);
+0 −1
Original line number Original line Diff line number Diff line
@@ -1220,7 +1220,6 @@ bool L2CA_ConnectFixedChnl(uint16_t fixed_cid, const RawAddress& rem_bda) {


  // Get a CCB and link the lcb to it
  // Get a CCB and link the lcb to it
  if (!l2cu_initialize_fixed_ccb(p_lcb, fixed_cid)) {
  if (!l2cu_initialize_fixed_ccb(p_lcb, fixed_cid)) {
    p_lcb->SetDisconnectReason(L2CAP_CONN_NO_RESOURCES);
    LOG_WARN("Unable to allocate fixed channel resource fixed_cid:0x%04x",
    LOG_WARN("Unable to allocate fixed channel resource fixed_cid:0x%04x",
             fixed_cid);
             fixed_cid);
    l2cu_release_lcb(p_lcb);
    l2cu_release_lcb(p_lcb);
+6 −3
Original line number Original line Diff line number Diff line
@@ -39,6 +39,7 @@
#include "osi/include/alarm.h"
#include "osi/include/alarm.h"
#include "osi/include/fixed_queue.h"
#include "osi/include/fixed_queue.h"
#include "osi/include/list.h"
#include "osi/include/list.h"
#include "stack/include/hci_error_code.h"


#define L2CAP_MIN_MTU 48 /* Minimum acceptable MTU is 48 bytes */
#define L2CAP_MIN_MTU 48 /* Minimum acceptable MTU is 48 bytes */


@@ -452,11 +453,13 @@ typedef struct t_l2c_linkcb {
  tL2C_CCB* p_fixed_ccbs[L2CAP_NUM_FIXED_CHNLS];
  tL2C_CCB* p_fixed_ccbs[L2CAP_NUM_FIXED_CHNLS];


 private:
 private:
  uint16_t disc_reason_;
  tHCI_REASON disc_reason_{HCI_ERR_UNDEFINED};


 public:
 public:
  uint16_t DisconnectReason() const { return disc_reason_; }
  tHCI_REASON DisconnectReason() const { return disc_reason_; }
  void SetDisconnectReason(uint16_t disc_reason) { disc_reason_ = disc_reason; }
  void SetDisconnectReason(tHCI_REASON disc_reason) {
    disc_reason_ = disc_reason;
  }


  tBT_TRANSPORT transport;
  tBT_TRANSPORT transport;
  bool is_transport_br_edr() const { return transport == BT_TRANSPORT_BR_EDR; }
  bool is_transport_br_edr() const { return transport == BT_TRANSPORT_BR_EDR; }
Loading