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

Commit 9358eaa0 authored by Omair Kamil's avatar Omair Kamil
Browse files

BTM_BleObserve is always given low_latency_scan as true (when start is true),...

BTM_BleObserve is always given low_latency_scan as true (when start is true), so clean up this parameter.

Bug: 228268706
Test: atest BluetoothInstrumentationTests, atest BumbleBluetoothTests
Flag: EXEMPT, dead code cleanup
Change-Id: I62fa2946fe2f0815ae279d5e96856787b5f3a0b1
parent 326867a0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1395,7 +1395,7 @@ private:

      instance->OnActiveScanResult(&p_data->inq_res);
    });
    BTA_DmBleScan(enable, bluetooth::csis::kDefaultScanDurationS, true);
    BTA_DmBleScan(enable, bluetooth::csis::kDefaultScanDurationS);

    /* Need to call it by ourselfs */
    if (!enable) {
+2 −4
Original line number Diff line number Diff line
@@ -250,15 +250,13 @@ void BTA_DmBleRequestMaxTxDataLength(const RawAddress& remote_device) {
 * Parameters       start: start or stop the scan procedure,
 *                  duration_sec: Duration of the scan. Continuous scan if 0 is
 *                                passed,
 *                  low_latency_scan: whether this is an low latency scan,
 *                                    default is false.
 *
 * Returns          void
 *
 ******************************************************************************/
void BTA_DmBleScan(bool start, uint8_t duration_sec, bool low_latency_scan) {
void BTA_DmBleScan(bool start, uint8_t duration_sec) {
  log::verbose("start = {}", start);
  do_in_main_thread(base::BindOnce(bta_dm_ble_scan, start, duration_sec, low_latency_scan));
  do_in_main_thread(base::BindOnce(bta_dm_ble_scan, start, duration_sec));
}

/*******************************************************************************
+6 −9
Original line number Diff line number Diff line
@@ -703,9 +703,9 @@ static void bta_dm_observe_cmpl_cb(void* p_result) {
  }
}

static void bta_dm_start_scan(uint8_t duration_sec, bool low_latency_scan = false) {
static void bta_dm_start_scan(uint8_t duration_sec) {
  tBTM_STATUS status = get_btm_client_interface().ble.BTM_BleObserve(
          true, duration_sec, bta_dm_observe_results_cb, bta_dm_observe_cmpl_cb, low_latency_scan);
          true, duration_sec, bta_dm_observe_results_cb, bta_dm_observe_cmpl_cb);

  if (status != BTM_CMD_STARTED) {
    log::warn("BTM_BleObserve  failed. status {}", status);
@@ -716,16 +716,15 @@ static void bta_dm_start_scan(uint8_t duration_sec, bool low_latency_scan = fals
  }
}

void bta_dm_ble_scan(bool start, uint8_t duration_sec, bool low_latency_scan = false) {
void bta_dm_ble_scan(bool start, uint8_t duration_sec) {
  if (!start) {
    if (get_btm_client_interface().ble.BTM_BleObserve(false, 0, NULL, NULL, false) !=
        BTM_CMD_STARTED) {
    if (get_btm_client_interface().ble.BTM_BleObserve(false, 0, NULL, NULL) != BTM_CMD_STARTED) {
      log::warn("Unable to start ble observe");
    }
    return;
  }

  bta_dm_start_scan(duration_sec, low_latency_scan);
  bta_dm_start_scan(duration_sec);
}

void bta_dm_ble_csis_observe(bool observe, tBTA_DM_SEARCH_CBACK* p_cback) {
@@ -973,9 +972,7 @@ void bta_dm_opportunistic_observe_results_cb(tBTM_INQ_RESULTS* p_inq, const uint
}
void bta_dm_queue_search(tBTA_DM_API_SEARCH& search) { ::bta_dm_queue_search(search); }

void bta_dm_start_scan(uint8_t duration_sec, bool low_latency_scan = false) {
  ::bta_dm_start_scan(duration_sec, low_latency_scan);
}
void bta_dm_start_scan(uint8_t duration_sec) { ::bta_dm_start_scan(duration_sec); }

}  // namespace testing
}  // namespace legacy
+2 −2
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ void bta_dm_disc_stop_device_discovery();
void bta_dm_disc_disable_search();

// LE observe and scan interface
void bta_dm_ble_scan(bool start, uint8_t duration_sec, bool low_latency_scan);
void bta_dm_ble_scan(bool start, uint8_t duration_sec);
void bta_dm_ble_csis_observe(bool observe, tBTA_DM_SEARCH_CBACK* p_cback);

// Checks if there is a device discovery request queued
+2 −2
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ void bta_dm_disc_disable_search();
void bta_dm_disc_acl_down(const RawAddress& bd_addr, tBT_TRANSPORT transport);

// LE observe and scan interface
void bta_dm_ble_scan(bool start, uint8_t duration_sec, bool low_latency_scan);
void bta_dm_ble_scan(bool start, uint8_t duration_sec);
void bta_dm_ble_csis_observe(bool observe, tBTA_DM_SEARCH_CBACK* p_cback);

// Checks if there is a device discovery request queued
Loading