From: Chris Manton Date: Thu, 17 Sep 2020 18:00:47 +0000 (-0700) Subject: Rework API btm_ble_select_adv_interval X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=fc63e460db0e51ddf01c7392d9343a3ab5ca5c80;p=android-x86%2Fsystem-bt.git 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 --- diff --git a/stack/btm/btm_ble_gap.cc b/stack/btm/btm_ble_gap.cc index f022425c9..99acc57f9 100644 --- a/stack/btm/btm_ble_gap.cc +++ b/stack/btm/btm_ble_gap.cc @@ -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, - uint16_t* p_adv_int_min, - uint16_t* p_adv_int_max) { +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 */