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

Commit b2a587cd authored by Chris Manton's avatar Chris Manton
Browse files

Use proper types tHCI_ROLE

Bug: 179120287
Test: gd/cert/run
Tag: #refactor
BYPASS_LONG_LINES_REASON: Bluetooth likes 120 lines

Change-Id: I6fd932fa39b4d7ea8b88db0877806a636a90deed
parent b58f5f4f
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -1797,12 +1797,11 @@ void bta_av_conn_failed(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {
 *
 ******************************************************************************/
void bta_av_do_start(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {
  uint8_t cur_role;

  LOG_INFO(
      "A2dp stream start peer:%s sco_occupied:%s role:%s started:%s wait:0x%x",
      "A2dp stream start peer:%s sco_occupied:%s av_role:0x%x started:%s "
      "wait:0x%x",
      PRIVATE_ADDRESS(p_scb->PeerAddress()),
      logbool(bta_av_cb.sco_occupied).c_str(), RoleText(p_scb->role).c_str(),
      logbool(bta_av_cb.sco_occupied).c_str(), p_scb->role,
      logbool(p_scb->started).c_str(), p_scb->wait);
  if (bta_av_cb.sco_occupied) {
    LOG_WARN("A2dp stream start failed");
@@ -1813,6 +1812,7 @@ void bta_av_do_start(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {
  /* disallow role switch during streaming, only if we are the central role
   * i.e. allow role switch, if we are peripheral.
   * It would not hurt us, if the peer device wants us to be central */
  tHCI_ROLE cur_role;
  if ((BTM_GetRole(p_scb->PeerAddress(), &cur_role) == BTM_SUCCESS) &&
      (cur_role == HCI_ROLE_CENTRAL)) {
    BTM_block_role_switch_for(p_scb->PeerAddress());
@@ -2183,7 +2183,7 @@ void bta_av_start_ok(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {
  bool suspend = false;
  uint8_t new_role = p_scb->role;
  BT_HDR hdr;
  uint8_t cur_role;
  tHCI_ROLE cur_role;
  uint8_t local_tsep = p_scb->seps[p_scb->sep_idx].tsep;

  LOG_INFO("%s: peer %s bta_handle:0x%x wait:0x%x role:0x%x local_tsep:%d",
+2 −2
Original line number Diff line number Diff line
@@ -815,7 +815,7 @@ static void bta_av_sys_rs_cback(UNUSED_ATTR tBTA_SYS_CONN_STATUS status,
                                const RawAddress& peer_addr) {
  int i;
  tBTA_AV_SCB* p_scb = NULL;
  uint8_t cur_role;
  tHCI_ROLE cur_role;
  uint8_t peer_idx = 0;

  APPL_TRACE_DEBUG(
@@ -1009,7 +1009,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) {
  uint8_t role;
  tHCI_ROLE role;
  if (BTM_GetRole(p_scb->PeerAddress(), &role) != BTM_SUCCESS) {
    LOG_WARN("Unable to find link role for device:%s",
             PRIVATE_ADDRESS(p_scb->PeerAddress()));
+2 −2
Original line number Diff line number Diff line
@@ -2257,7 +2257,7 @@ static void bta_dm_local_name_cback(UNUSED_ATTR void* p_name) {
  BTIF_dm_enable();
}

static void handle_role_change(const RawAddress& bd_addr, uint8_t new_role,
static void handle_role_change(const RawAddress& bd_addr, tHCI_ROLE new_role,
                               tHCI_STATUS hci_status) {
  tBTA_DM_PEER_DEVICE* p_dev = bta_dm_find_peer_device(bd_addr);
  if (!p_dev) {
@@ -2304,7 +2304,7 @@ static void handle_role_change(const RawAddress& bd_addr, uint8_t new_role,
  bta_sys_notify_role_chg(bd_addr, new_role, hci_status);
}

void BTA_dm_report_role_change(const RawAddress bd_addr, uint8_t new_role,
void BTA_dm_report_role_change(const RawAddress bd_addr, tHCI_ROLE new_role,
                               tHCI_STATUS hci_status) {
  do_in_main_thread(
      FROM_HERE, base::Bind(handle_role_change, bd_addr, new_role, hci_status));
+2 −1
Original line number Diff line number Diff line
@@ -20,11 +20,12 @@

#include "stack/include/bt_types.h"
#include "stack/include/hci_error_code.h"
#include "stack/include/hcidefs.h"
#include "types/bt_transport.h"
#include "types/raw_address.h"

void BTA_dm_acl_up(const RawAddress bd_addr, tBT_TRANSPORT transport);
void BTA_dm_acl_down(const RawAddress bd_addr, tBT_TRANSPORT transport);
void BTA_dm_report_role_change(const RawAddress bd_addr, uint8_t new_role,
void BTA_dm_report_role_change(const RawAddress bd_addr, tHCI_ROLE new_role,
                               tHCI_STATUS hci_status);
void BTA_dm_notify_remote_features_complete(const RawAddress bd_addr);
+2 −1
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@

#include "osi/include/alarm.h"
#include "stack/include/hci_error_code.h"
#include "stack/include/hcidefs.h"

/*****************************************************************************
 *  Constants and data types
@@ -238,7 +239,7 @@ extern void bta_sys_chg_ssr_config(uint8_t id, uint8_t app_id,

extern void bta_sys_role_chg_register(tBTA_SYS_CONN_CBACK* p_cback);
extern void bta_sys_notify_role_chg(const RawAddress& peer_addr,
                                    uint8_t new_role, tHCI_STATUS hci_status);
                                    tHCI_ROLE new_role, tHCI_STATUS hci_status);
extern void bta_sys_collision_register(uint8_t bta_id,
                                       tBTA_SYS_CONN_CBACK* p_cback);
extern void bta_sys_notify_collision(const RawAddress& peer_addr);
Loading