Remove variable btm_cb.ble_ctr_cb.bg_conn_type. We can enable the
background mode when the Bluetooth stack is started and don't have
to wait until the first background connection request from HID
Device/Hearing Aid/GATT. As soon as we add the first device to white
list, the stack will send HCI Create Connection (White List) command.
Test: manual. Bond to a BLE mouse and turn off/on Bluetooth. Also test
with initiating another direct/white list connection while another white
list connection is pending
Bug:
111562702
Bug:
112827989
Change-Id: I82a476489d181d17aa1c1da8202df1be76928d77
scan_interval, scan_window));
}
-/** Set BLE connectable mode to auto connect */
-void BTA_DmBleStartAutoConn() {
- do_in_main_thread(FROM_HERE, base::Bind(BTM_BleStartAutoConn));
-}
-
/*******************************************************************************
*
* Function bta_dm_discover_send_msg
/* add device into BG connection to accept remote initiated connection */
BTA_GATTC_Open(gatt_if, address, false, GATT_TRANSPORT_LE, false);
- BTA_DmBleStartAutoConn();
}
callbacks->OnDeviceAvailable(capabilities, hiSyncId, address);
if (hearingDevice->first_connection) {
/* add device into BG connection to accept remote initiated connection */
BTA_GATTC_Open(gatt_if, address, false, GATT_TRANSPORT_LE, false);
- BTA_DmBleStartAutoConn();
btif_storage_add_hearing_aid(
address, hearingDevice->psm, hearingDevice->capabilities,
BTA_GATTC_Open(bta_hh_cb.gatt_if, p_cb->addr, false, GATT_TRANSPORT_LE,
false);
p_cb->in_bg_conn = true;
-
- BTA_DmBleStartAutoConn();
}
return;
}
extern void BTA_DmBleSecurityGrant(const RawAddress& bd_addr,
tBTA_DM_BLE_SEC_GRANT res);
-/**
- * Set BLE connectable mode to auto connect
- */
-extern void BTA_DmBleStartAutoConn();
-
/*******************************************************************************
*
* Function BTA_DmBlePasskeyReply
}
}
- if (transport == GATT_TRANSPORT_LE) {
- BTA_DmBleStartAutoConn();
- }
-
// Connect!
BTIF_TRACE_DEBUG("%s Transport=%d, device type=%d, phy=%d", __func__,
transport, device_type, initiating_phys);
BTA_DmAddBleDevice(address, addr_type, device_type);
}
- // Mark background connections
- if (!is_direct) BTA_DmBleStartAutoConn();
-
// Determine transport
if (transport_param != GATT_TRANSPORT_AUTO) {
transport = transport_param;
******************************************************************************/
bool btm_ble_suspend_bg_conn(void) {
BTM_TRACE_EVENT("%s", __func__);
-
- if (btm_cb.ble_ctr_cb.bg_conn_type == BTM_BLE_CONN_AUTO)
- return btm_ble_stop_auto_conn();
-
- return false;
+ return btm_ble_stop_auto_conn();
}
/*******************************************************************************
* Returns none.
*
******************************************************************************/
-bool btm_ble_resume_bg_conn(void) {
- tBTM_BLE_CB* p_cb = &btm_cb.ble_ctr_cb;
- if (p_cb->bg_conn_type == BTM_BLE_CONN_AUTO) {
- return btm_ble_start_auto_conn();
- }
-
- return false;
-}
+bool btm_ble_resume_bg_conn(void) { return btm_ble_start_auto_conn(); }
/*******************************************************************************
*
* Function btm_ble_get_conn_st
#include "types/raw_address.h"
-/** Set BLE connectable mode to auto connect */
-extern void BTM_BleStartAutoConn();
-
/** Adds the device into white list. Returns false if white list is full and
* device can't be added, true otherwise. */
extern bool BTM_WhiteListAdd(const RawAddress& address);
#endif
}
-/** Set BLE connectable mode to auto connect */
-void BTM_BleStartAutoConn() {
- BTM_TRACE_EVENT("%s", __func__);
- if (!controller_get_interface()->supports_ble()) return;
-
- if (btm_cb.ble_ctr_cb.bg_conn_type != BTM_BLE_CONN_AUTO) {
- btm_ble_start_auto_conn();
- btm_cb.ble_ctr_cb.bg_conn_type = BTM_BLE_CONN_AUTO;
- }
-}
-
/*******************************************************************************
*
* Function BTM_BleSetConnectableMode
alarm_t* observer_timer;
/* background connection procedure cb value */
- tBTM_BLE_CONN_TYPE bg_conn_type;
uint16_t scan_int;
uint16_t scan_win;
btm_cb.btm_inq_vars.page_scan_type = HCI_DEF_SCAN_TYPE;
btm_cb.ble_ctr_cb.conn_state = BLE_CONN_IDLE;
- btm_cb.ble_ctr_cb.bg_conn_type = BTM_BLE_CONN_NONE;
gatt::connection_manager::reset(true);
btm_pm_reset();
typedef uint8_t BTM_BLE_RSSI_VALUE;
typedef uint16_t BTM_BLE_ADV_INFO_TIMESTAMP;
-enum { BTM_BLE_CONN_NONE, BTM_BLE_CONN_AUTO };
-typedef uint8_t tBTM_BLE_CONN_TYPE;
-
#define ADV_INFO_PRESENT 0x00
#define NO_ADV_INFO_PRESENT 0x01