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

Commit 9b7a93f5 authored by Chris Manton's avatar Chris Manton
Browse files

Use proper API and switch/case for bta search/discovery operations

Bug: 259118978
Test: None

Change-Id: Iad19f722add8f100f02c6c0410493e550b4084d5
parent 800ea4b4
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -978,12 +978,23 @@ void bta_dm_discover(tBTA_DM_MSG* p_data) {
 * Description      Cancels an ongoing search or discovery for devices in case
 *                  of a Bluetooth disable
 *
 *
 * Returns          void
 *
 ******************************************************************************/
static void bta_dm_disable_search_and_disc(void) {
  if (bta_dm_search_cb.state != BTA_DM_SEARCH_IDLE) bta_dm_search_cancel();
  switch (bta_dm_search_get_state()) {
    case BTA_DM_SEARCH_IDLE:
      break;
    case BTA_DM_SEARCH_ACTIVE:
    case BTA_DM_SEARCH_CANCELLING:
    case BTA_DM_DISCOVER_ACTIVE:
    default:
      LOG_DEBUG(
          "Search state machine is not idle so issuing search cancel current "
          "state:%s",
          bta_dm_state_text(bta_dm_search_get_state()).c_str());
      bta_dm_search_cancel();
  }
}

/*******************************************************************************