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

Commit 03bcbae4 authored by Zach Johnson's avatar Zach Johnson
Browse files

Pull hardware errors out of BTA_dm_sys_hw_cback

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: Ifc41edfb0b7ead0a158417aa895bdb6e9296f934
parent 5f1e4a0f
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -117,7 +117,6 @@ static void btm_dm_start_gatt_discovery(const RawAddress& bd_addr);
static void bta_dm_cancel_gatt_discovery(const RawAddress& bd_addr);
static void bta_dm_gattc_callback(tBTA_GATTC_EVT event, tBTA_GATTC* p_data);
extern tBTA_DM_CONTRL_STATE bta_dm_pm_obtain_controller_state(void);

#if (BLE_VND_INCLUDED == TRUE)
static void bta_dm_ctrl_features_rd_cmpl_cback(tBTM_STATUS result);
#endif
@@ -318,6 +317,11 @@ void bta_dm_deinit_cb(void) {
  memset(&bta_dm_cb, 0, sizeof(bta_dm_cb));
}

void BTA_dm_on_hw_error() {
  if (bta_dm_cb.p_sec_cback != NULL) {
    bta_dm_cb.p_sec_cback(BTA_DM_HW_ERROR_EVT, NULL);
  }
}
/*******************************************************************************
 *
 * Function         bta_dm_sys_hw_cback
@@ -336,13 +340,6 @@ void BTA_dm_sys_hw_cback(tBTA_SYS_HW_EVT status) {

  APPL_TRACE_DEBUG("%s with event: %i", __func__, status);

  /* On H/W error evt, report to the registered DM application callback */
  if (status == BTA_SYS_HW_ERROR_EVT) {
    if (bta_dm_cb.p_sec_cback != NULL)
      bta_dm_cb.p_sec_cback(BTA_DM_HW_ERROR_EVT, NULL);
    return;
  }

  if (status == BTA_SYS_HW_OFF_EVT) {
    if (bta_dm_cb.p_sec_cback != NULL)
      bta_dm_cb.p_sec_cback(BTA_DM_DISABLE_EVT, NULL);
+0 −2
Original line number Diff line number Diff line
@@ -184,8 +184,6 @@ enum {
  BTA_SYS_HW_ON_EVT,
  BTA_SYS_HW_STARTING_EVT,
  BTA_SYS_HW_STOPPING_EVT,
  BTA_SYS_HW_ERROR_EVT

};
typedef uint8_t tBTA_SYS_HW_EVT;

+3 −2
Original line number Diff line number Diff line
@@ -44,7 +44,8 @@
#include "bta_ar_api.h"
#endif

extern void BTA_dm_sys_hw_cback(tBTA_SYS_HW_EVT status);
void BTA_dm_sys_hw_cback(tBTA_SYS_HW_EVT status);
void BTA_dm_on_hw_error();

/* system manager control block definition */
tBTA_SYS_CB bta_sys_cb;
@@ -190,7 +191,7 @@ void send_bta_sys_hw_event(tBTA_SYS_HW_EVT event) {
void bta_sys_hw_error() {
  APPL_TRACE_DEBUG("%s", __func__);
  if (bta_sys_cb.bluetooth_active) {
    BTA_dm_sys_hw_cback(BTA_SYS_HW_ERROR_EVT);
    BTA_dm_on_hw_error();
  }
}