Loading system/stack/btm/btm_ble_bgconn.cc +58 −58 Original line number Diff line number Diff line Loading @@ -149,7 +149,7 @@ void btm_ble_bgconn_cancel_if_disconnected(const RawAddress& bd_addr) { BackgroundConnection* connection = &map_it->second; if (!connection->in_controller_wl && !connection->pending_removal && !BTM_IsAclConnectionUp(bd_addr, BT_TRANSPORT_LE)) { btm_ble_start_auto_conn(false); btm_ble_stop_auto_conn(); } } } Loading Loading @@ -264,7 +264,7 @@ bool btm_update_dev_to_white_list(bool to_add, const RawAddress& bd_addr) { } if (p_cb->wl_state & BTM_BLE_WL_INIT) { btm_ble_start_auto_conn(false); btm_ble_stop_auto_conn(); } btm_add_dev_to_controller(to_add, bd_addr); btm_ble_resume_bg_conn(); Loading Loading @@ -386,20 +386,12 @@ void btm_send_hci_create_connection( } } /******************************************************************************* * * Function btm_ble_start_auto_conn * * Description This function is to start/stop auto connection procedure. * * Parameters start: true to start; false to stop. * * Returns void * ******************************************************************************/ bool btm_ble_start_auto_conn(bool start) { /** This function is to start auto connection procedure */ bool btm_ble_start_auto_conn() { tBTM_BLE_CB* p_cb = &btm_cb.ble_ctr_cb; bool exec = true; BTM_TRACE_EVENT("%s", __func__); uint16_t scan_int = (p_cb->scan_int == BTM_BLE_SCAN_PARAM_UNDEF) ? BTM_BLE_SCAN_SLOW_INT_1 : p_cb->scan_int; Loading @@ -413,11 +405,16 @@ bool btm_ble_start_auto_conn(bool start) { if (controller_get_interface()->supports_ble_2m_phy()) phy |= PHY_LE_2M; if (controller_get_interface()->supports_ble_coded_phy()) phy |= PHY_LE_CODED; BTM_TRACE_EVENT("%s start=%d", __func__, start); if (!btm_ble_topology_check(BTM_BLE_STATE_INIT)) { LOG(INFO) << "initate background connection fail, topology limitation"; return false; } if (p_cb->conn_state != BLE_CONN_IDLE || !background_connections_pending() || !l2cu_can_allocate_lcb()) { return false; } if (start) { if (p_cb->conn_state == BLE_CONN_IDLE && background_connections_pending() && btm_ble_topology_check(BTM_BLE_STATE_INIT) && l2cu_can_allocate_lcb()) { p_cb->wl_state |= BTM_BLE_WL_INIT; btm_execute_wl_dev_operation(); Loading Loading @@ -446,21 +443,24 @@ bool btm_ble_start_auto_conn(bool start) { 0, /* uint16_t max_len */ phy); btm_ble_set_conn_st(BLE_BG_CONN); } else { exec = false; return true; } } else { if (p_cb->conn_state == BLE_BG_CONN) { btsnd_hcic_ble_create_conn_cancel(); btm_ble_set_conn_st(BLE_CONN_CANCEL); p_cb->wl_state &= ~BTM_BLE_WL_INIT; } else { /** This function is to stop auto connection procedure */ bool btm_ble_stop_auto_conn() { BTM_TRACE_EVENT("%s", __func__); tBTM_BLE_CB* p_cb = &btm_cb.ble_ctr_cb; if (p_cb->conn_state != BLE_BG_CONN) { BTM_TRACE_DEBUG("conn_st = %d, not in auto conn state, cannot stop", p_cb->conn_state); exec = false; } return false; } return exec; btsnd_hcic_ble_create_conn_cancel(); btm_ble_set_conn_st(BLE_CONN_CANCEL); p_cb->wl_state &= ~BTM_BLE_WL_INIT; return true; } /******************************************************************************* Loading @@ -479,7 +479,7 @@ 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_start_auto_conn(false); return btm_ble_stop_auto_conn(); return false; } Loading @@ -499,7 +499,7 @@ bool btm_ble_suspend_bg_conn(void) { 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(true); return btm_ble_start_auto_conn(); } return false; Loading system/stack/btm/btm_ble_gap.cc +2 −2 Original line number Diff line number Diff line Loading @@ -704,7 +704,7 @@ void BTM_BleStartAutoConn() { 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(true); btm_ble_start_auto_conn(); btm_cb.ble_ctr_cb.bg_conn_type = BTM_BLE_CONN_AUTO; } } Loading @@ -724,7 +724,7 @@ void BTM_BleStartAutoConn() { ******************************************************************************/ void BTM_BleClearBgConnDev(void) { if (!controller_get_interface()->supports_ble()) return; btm_ble_start_auto_conn(false); btm_ble_stop_auto_conn(); btm_ble_clear_white_list(); gatt_reset_bgdev_list(); } Loading system/stack/btm/btm_ble_int.h +2 −1 Original line number Diff line number Diff line Loading @@ -137,7 +137,8 @@ extern void btm_send_hci_create_connection( uint16_t conn_int_min, uint16_t conn_int_max, uint16_t conn_latency, uint16_t conn_timeout, uint16_t min_ce_len, uint16_t max_ce_len, uint8_t phy); extern bool btm_ble_start_auto_conn(bool start); extern bool btm_ble_start_auto_conn(); extern bool btm_ble_stop_auto_conn(); extern bool btm_ble_start_select_conn(bool start); extern bool btm_ble_renew_bg_conn_params(bool add, const RawAddress& bd_addr); extern void btm_write_dir_conn_wl(const RawAddress& target_addr); Loading Loading
system/stack/btm/btm_ble_bgconn.cc +58 −58 Original line number Diff line number Diff line Loading @@ -149,7 +149,7 @@ void btm_ble_bgconn_cancel_if_disconnected(const RawAddress& bd_addr) { BackgroundConnection* connection = &map_it->second; if (!connection->in_controller_wl && !connection->pending_removal && !BTM_IsAclConnectionUp(bd_addr, BT_TRANSPORT_LE)) { btm_ble_start_auto_conn(false); btm_ble_stop_auto_conn(); } } } Loading Loading @@ -264,7 +264,7 @@ bool btm_update_dev_to_white_list(bool to_add, const RawAddress& bd_addr) { } if (p_cb->wl_state & BTM_BLE_WL_INIT) { btm_ble_start_auto_conn(false); btm_ble_stop_auto_conn(); } btm_add_dev_to_controller(to_add, bd_addr); btm_ble_resume_bg_conn(); Loading Loading @@ -386,20 +386,12 @@ void btm_send_hci_create_connection( } } /******************************************************************************* * * Function btm_ble_start_auto_conn * * Description This function is to start/stop auto connection procedure. * * Parameters start: true to start; false to stop. * * Returns void * ******************************************************************************/ bool btm_ble_start_auto_conn(bool start) { /** This function is to start auto connection procedure */ bool btm_ble_start_auto_conn() { tBTM_BLE_CB* p_cb = &btm_cb.ble_ctr_cb; bool exec = true; BTM_TRACE_EVENT("%s", __func__); uint16_t scan_int = (p_cb->scan_int == BTM_BLE_SCAN_PARAM_UNDEF) ? BTM_BLE_SCAN_SLOW_INT_1 : p_cb->scan_int; Loading @@ -413,11 +405,16 @@ bool btm_ble_start_auto_conn(bool start) { if (controller_get_interface()->supports_ble_2m_phy()) phy |= PHY_LE_2M; if (controller_get_interface()->supports_ble_coded_phy()) phy |= PHY_LE_CODED; BTM_TRACE_EVENT("%s start=%d", __func__, start); if (!btm_ble_topology_check(BTM_BLE_STATE_INIT)) { LOG(INFO) << "initate background connection fail, topology limitation"; return false; } if (p_cb->conn_state != BLE_CONN_IDLE || !background_connections_pending() || !l2cu_can_allocate_lcb()) { return false; } if (start) { if (p_cb->conn_state == BLE_CONN_IDLE && background_connections_pending() && btm_ble_topology_check(BTM_BLE_STATE_INIT) && l2cu_can_allocate_lcb()) { p_cb->wl_state |= BTM_BLE_WL_INIT; btm_execute_wl_dev_operation(); Loading Loading @@ -446,21 +443,24 @@ bool btm_ble_start_auto_conn(bool start) { 0, /* uint16_t max_len */ phy); btm_ble_set_conn_st(BLE_BG_CONN); } else { exec = false; return true; } } else { if (p_cb->conn_state == BLE_BG_CONN) { btsnd_hcic_ble_create_conn_cancel(); btm_ble_set_conn_st(BLE_CONN_CANCEL); p_cb->wl_state &= ~BTM_BLE_WL_INIT; } else { /** This function is to stop auto connection procedure */ bool btm_ble_stop_auto_conn() { BTM_TRACE_EVENT("%s", __func__); tBTM_BLE_CB* p_cb = &btm_cb.ble_ctr_cb; if (p_cb->conn_state != BLE_BG_CONN) { BTM_TRACE_DEBUG("conn_st = %d, not in auto conn state, cannot stop", p_cb->conn_state); exec = false; } return false; } return exec; btsnd_hcic_ble_create_conn_cancel(); btm_ble_set_conn_st(BLE_CONN_CANCEL); p_cb->wl_state &= ~BTM_BLE_WL_INIT; return true; } /******************************************************************************* Loading @@ -479,7 +479,7 @@ 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_start_auto_conn(false); return btm_ble_stop_auto_conn(); return false; } Loading @@ -499,7 +499,7 @@ bool btm_ble_suspend_bg_conn(void) { 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(true); return btm_ble_start_auto_conn(); } return false; Loading
system/stack/btm/btm_ble_gap.cc +2 −2 Original line number Diff line number Diff line Loading @@ -704,7 +704,7 @@ void BTM_BleStartAutoConn() { 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(true); btm_ble_start_auto_conn(); btm_cb.ble_ctr_cb.bg_conn_type = BTM_BLE_CONN_AUTO; } } Loading @@ -724,7 +724,7 @@ void BTM_BleStartAutoConn() { ******************************************************************************/ void BTM_BleClearBgConnDev(void) { if (!controller_get_interface()->supports_ble()) return; btm_ble_start_auto_conn(false); btm_ble_stop_auto_conn(); btm_ble_clear_white_list(); gatt_reset_bgdev_list(); } Loading
system/stack/btm/btm_ble_int.h +2 −1 Original line number Diff line number Diff line Loading @@ -137,7 +137,8 @@ extern void btm_send_hci_create_connection( uint16_t conn_int_min, uint16_t conn_int_max, uint16_t conn_latency, uint16_t conn_timeout, uint16_t min_ce_len, uint16_t max_ce_len, uint8_t phy); extern bool btm_ble_start_auto_conn(bool start); extern bool btm_ble_start_auto_conn(); extern bool btm_ble_stop_auto_conn(); extern bool btm_ble_start_select_conn(bool start); extern bool btm_ble_renew_bg_conn_params(bool add, const RawAddress& bd_addr); extern void btm_write_dir_conn_wl(const RawAddress& target_addr); Loading