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

Commit 1e88d762 authored by Chris Manton's avatar Chris Manton
Browse files

Rework API btm_ble_select_adv_interval

Please Don't Pass Globals As Parameters

Towards readable code

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Test: act.py -tc BleCocTest

Change-Id: If1d5f80cf12250b063a2ebe525527b6ddf6bfabc
parent 95cc20af
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -830,9 +830,10 @@ uint16_t BTM_BleReadConnectability() {
 * Returns          void
 *
 ******************************************************************************/
void btm_ble_select_adv_interval(tBTM_BLE_INQ_CB* p_cb, uint8_t evt_type,
static void btm_ble_select_adv_interval(uint8_t evt_type,
                                        uint16_t* p_adv_int_min,
                                        uint16_t* p_adv_int_max) {
  tBTM_BLE_INQ_CB* p_cb = &btm_cb.ble_ctr_cb.inq_var;
  if (p_cb->adv_interval_min && p_cb->adv_interval_max) {
    *p_adv_int_min = p_cb->adv_interval_min;
    *p_adv_int_max = p_cb->adv_interval_max;
@@ -971,7 +972,7 @@ tBTM_STATUS btm_ble_set_discoverability(uint16_t combined_mode) {
      mode == BTM_BLE_NON_DISCOVERABLE)
    new_mode = BTM_BLE_ADV_DISABLE;

  btm_ble_select_adv_interval(p_cb, evt_type, &adv_int_min, &adv_int_max);
  btm_ble_select_adv_interval(evt_type, &adv_int_min, &adv_int_max);

  alarm_cancel(p_cb->fast_adv_timer);

@@ -1061,7 +1062,7 @@ tBTM_STATUS btm_ble_set_connectability(uint16_t combined_mode) {
      p_cb->discoverable_mode == BTM_BLE_NON_DISCOVERABLE)
    new_mode = BTM_BLE_ADV_DISABLE;

  btm_ble_select_adv_interval(p_cb, evt_type, &adv_int_min, &adv_int_max);
  btm_ble_select_adv_interval(evt_type, &adv_int_min, &adv_int_max);

  alarm_cancel(p_cb->fast_adv_timer);
  /* update adv params if needed */