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

Commit 1f590496 authored by Zach Johnson's avatar Zach Johnson
Browse files

Flatten BTA_DM_ENABLE_EVT

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I98dcd7785c64ccacec7c03b86898b6cd5860ba1e
parent aa81d17a
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -63,6 +63,8 @@

using bluetooth::Uuid;

void BTIF_dm_enable();

static void bta_dm_inq_results_cb(tBTM_INQ_RESULTS* p_inq, uint8_t* p_eir,
                                  uint16_t eir_len);
static void bta_dm_inq_cmpl_cb(void* p_result);
@@ -2439,10 +2441,7 @@ static uint8_t bta_dm_sp_cback(tBTM_SP_EVT event, tBTM_SP_EVT_DATA* p_data) {
 *
 ******************************************************************************/
static void bta_dm_local_name_cback(UNUSED_ATTR void* p_name) {
  tBTA_DM_SEC sec_event;

  if (bta_dm_cb.p_sec_cback)
    bta_dm_cb.p_sec_cback(BTA_DM_ENABLE_EVT, &sec_event);
  BTIF_dm_enable();
}

static void handle_role_change(const RawAddress& bd_addr, uint8_t new_role,
+0 −1
Original line number Diff line number Diff line
@@ -340,7 +340,6 @@ typedef uint8_t tBTA_DM_LINK_QUALITY_VALUE;
typedef uint8_t tBTA_SIG_STRENGTH_MASK;

/* Security Callback Events */
#define BTA_DM_ENABLE_EVT 0    /* Enable Event */
#define BTA_DM_DISABLE_EVT 1   /* Disable Event */
#define BTA_DM_PIN_REQ_EVT 2   /* PIN request. */
#define BTA_DM_AUTH_CMPL_EVT 3 /* Authentication complete indication. */
+42 −43
Original line number Diff line number Diff line
@@ -1505,25 +1505,7 @@ void BTIF_dm_on_hw_error() {
  kill(getpid(), SIGKILL);
}

/*******************************************************************************
 *
 * Function         btif_dm_upstreams_cback
 *
 * Description      Executes UPSTREAMS events in btif context
 *
 * Returns          void
 *
 ******************************************************************************/
static void btif_dm_upstreams_evt(uint16_t event, char* p_param) {
  tBTA_DM_SEC* p_data = (tBTA_DM_SEC*)p_param;
  tBTA_SERVICE_MASK service_mask;
  uint32_t i;
  RawAddress bd_addr;

  BTIF_TRACE_EVENT("%s: ev: %s", __func__, dump_dm_event(event));

  switch (event) {
    case BTA_DM_ENABLE_EVT: {
void BTIF_dm_enable() {
  BD_NAME bdname;
  bt_status_t status;
  bt_property_t prop;
@@ -1547,10 +1529,9 @@ static void btif_dm_upstreams_evt(uint16_t event, char* p_param) {

  /* for each of the enabled services in the mask, trigger the profile
   * enable */
      service_mask = btif_get_enabled_services_mask();
      for (i = 0; i <= BTA_MAX_SERVICE_ID; i++) {
        if (service_mask &
            (tBTA_SERVICE_MASK)(BTA_SERVICE_ID_TO_SERVICE_MASK(i))) {
  tBTA_SERVICE_MASK service_mask = btif_get_enabled_services_mask();
  for (uint32_t i = 0; i <= BTA_MAX_SERVICE_ID; i++) {
    if (service_mask & (tBTA_SERVICE_MASK)(BTA_SERVICE_ID_TO_SERVICE_MASK(i))) {
      btif_in_execute_service_request(i, true);
    }
  }
@@ -1564,8 +1545,26 @@ static void btif_dm_upstreams_evt(uint16_t event, char* p_param) {
  btif_storage_load_bonded_devices();
  bluetooth::bqr::EnableBtQualityReport(true);
  btif_enable_bluetooth_evt();
    } break;
}

/*******************************************************************************
 *
 * Function         btif_dm_upstreams_cback
 *
 * Description      Executes UPSTREAMS events in btif context
 *
 * Returns          void
 *
 ******************************************************************************/
static void btif_dm_upstreams_evt(uint16_t event, char* p_param) {
  tBTA_DM_SEC* p_data = (tBTA_DM_SEC*)p_param;
  tBTA_SERVICE_MASK service_mask;
  uint32_t i;
  RawAddress bd_addr;

  BTIF_TRACE_EVENT("%s: ev: %s", __func__, dump_dm_event(event));

  switch (event) {
    case BTA_DM_DISABLE_EVT:
      /* for each of the enabled services in the mask, trigger the profile
       * disable */
+0 −1
Original line number Diff line number Diff line
@@ -144,7 +144,6 @@ const char* dump_property_type(bt_property_type_t type) {

const char* dump_dm_event(uint16_t event) {
  switch (event) {
    CASE_RETURN_STR(BTA_DM_ENABLE_EVT)
    CASE_RETURN_STR(BTA_DM_DISABLE_EVT)
    CASE_RETURN_STR(BTA_DM_PIN_REQ_EVT)
    CASE_RETURN_STR(BTA_DM_AUTH_CMPL_EVT)