From 83211b0ccceb53586ac651a4d67ded7443b2f222 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowski Date: Wed, 7 Dec 2016 11:25:15 -0800 Subject: [PATCH] Get rid of selective connection procedure Bug: 30622771 Test: compilation test Change-Id: I1a7e4c49f93f11a350b96ffe7b2e69974ed82f46 --- bta/dm/bta_dm_act.cc | 3 +- bta/dm/bta_dm_api.cc | 29 ++------- bta/dm/bta_dm_int.h | 7 -- bta/hh/bta_hh_le.cc | 2 +- bta/include/bta_api.h | 28 ++------ btif/src/btif_gatt_client.cc | 2 +- btif/src/btif_gatt_server.cc | 2 +- stack/btm/btm_ble_bgconn.cc | 119 +--------------------------------- stack/btm/btm_ble_gap.cc | 133 ++++++-------------------------------- stack/btm/btm_ble_int.h | 4 +- stack/btm/btm_ble_int_types.h | 5 -- stack/btm/btm_devctl.cc | 1 - stack/include/btm_ble_api.h | 22 ++----- stack/include/btm_ble_api_types.h | 2 +- 14 files changed, 41 insertions(+), 318 deletions(-) diff --git a/bta/dm/bta_dm_act.cc b/bta/dm/bta_dm_act.cc index 56cda90e8..aad4c7fce 100644 --- a/bta/dm/bta_dm_act.cc +++ b/bta/dm/bta_dm_act.cc @@ -4226,8 +4226,7 @@ void bta_dm_security_grant(tBTA_DM_MSG* p_data) { * ******************************************************************************/ void bta_dm_ble_set_bg_conn_type(tBTA_DM_MSG* p_data) { - BTM_BleSetBgConnType(p_data->ble_set_bd_conn_type.bg_conn_type, - p_data->ble_set_bd_conn_type.p_select_cback); + BTM_BleStartAutoConn(); } /******************************************************************************* diff --git a/bta/dm/bta_dm_api.cc b/bta/dm/bta_dm_api.cc index 2dac45755..bffedecb1 100644 --- a/bta/dm/bta_dm_api.cc +++ b/bta/dm/bta_dm_api.cc @@ -1003,31 +1003,14 @@ extern void BTA_DmBleTrackAdvertiser( * BLE ADV data management API ******************************************************************************/ -/******************************************************************************* - * - * Function BTA_DmBleSetBgConnType - * - * Description This function is called to set BLE connectable mode for a - * peripheral device. - * - * Parameters bg_conn_type: it can be auto connection, or selective - * connection. - * p_select_cback: callback function when selective connection - * procedure is being used. - * - * Returns void - * - ******************************************************************************/ -void BTA_DmBleSetBgConnType(tBTA_DM_BLE_CONN_TYPE bg_conn_type, - tBTA_DM_BLE_SEL_CBACK* p_select_cback) { - tBTA_DM_API_BLE_SET_BG_CONN_TYPE* p_msg = - (tBTA_DM_API_BLE_SET_BG_CONN_TYPE*)osi_calloc( - sizeof(tBTA_DM_API_BLE_SET_BG_CONN_TYPE)); +/** + * Set BLE connectable mode to auto connect + */ +void BTA_DmBleStartAutoConn() { + tBTA_DM_API_SET_NAME* p_msg = + (tBTA_DM_API_SET_NAME*)osi_calloc(sizeof(tBTA_DM_API_SET_NAME)); p_msg->hdr.event = BTA_DM_API_BLE_SET_BG_CONN_TYPE; - p_msg->bg_conn_type = bg_conn_type; - p_msg->p_select_cback = p_select_cback; - bta_sys_sendmsg(p_msg); } diff --git a/bta/dm/bta_dm_int.h b/bta/dm/bta_dm_int.h index 7860e2132..2dbef0caf 100644 --- a/bta/dm/bta_dm_int.h +++ b/bta/dm/bta_dm_int.h @@ -362,12 +362,6 @@ typedef struct { tBTA_DM_BLE_SEC_GRANT res; } tBTA_DM_API_BLE_SEC_GRANT; -typedef struct { - BT_HDR hdr; - tBTA_DM_BLE_CONN_TYPE bg_conn_type; - tBTA_DM_BLE_SEL_CBACK* p_select_cback; -} tBTA_DM_API_BLE_SET_BG_CONN_TYPE; - /* set prefered BLE connection parameters for a device */ typedef struct { BT_HDR hdr; @@ -580,7 +574,6 @@ typedef union { tBTA_DM_API_ADD_BLE_DEVICE add_ble_device; tBTA_DM_API_PASSKEY_REPLY ble_passkey_reply; tBTA_DM_API_BLE_SEC_GRANT ble_sec_grant; - tBTA_DM_API_BLE_SET_BG_CONN_TYPE ble_set_bd_conn_type; tBTA_DM_API_BLE_CONN_PARAMS ble_set_conn_params; tBTA_DM_API_BLE_CONN_SCAN_PARAMS ble_set_conn_scan_params; tBTA_DM_API_BLE_SCAN_PARAMS ble_set_scan_params; diff --git a/bta/hh/bta_hh_le.cc b/bta/hh/bta_hh_le.cc index f94076ae8..63612378e 100644 --- a/bta/hh/bta_hh_le.cc +++ b/bta/hh/bta_hh_le.cc @@ -2125,7 +2125,7 @@ static void bta_hh_le_add_dev_bg_conn(tBTA_HH_DEV_CB* p_cb, bool check_bond) { BTA_GATTC_Open(bta_hh_cb.gatt_if, p_cb->addr, false, BTA_GATT_TRANSPORT_LE); p_cb->in_bg_conn = true; - BTA_DmBleSetBgConnType(BTA_DM_BLE_CONN_AUTO, NULL); + BTA_DmBleStartAutoConn(); } return; } diff --git a/bta/include/bta_api.h b/bta/include/bta_api.h index 30c5a1c56..4b898b5b7 100644 --- a/bta/include/bta_api.h +++ b/bta/include/bta_api.h @@ -594,13 +594,6 @@ typedef struct { #define BTA_DM_SEC_REP_ATTEMPTS BTA_DM_AUTH_SMP_REPEATED_ATTEMPT typedef uint8_t tBTA_DM_BLE_SEC_GRANT; -#define BTA_DM_BLE_ONN_NONE BTM_BLE_CONN_NONE -#define BTA_DM_BLE_CONN_AUTO BTM_BLE_CONN_AUTO -#define BTA_DM_BLE_CONN_SELECTIVE BTM_BLE_CONN_SELECTIVE -typedef uint8_t tBTA_DM_BLE_CONN_TYPE; - -typedef bool(tBTA_DM_BLE_SEL_CBACK)(BD_ADDR random_bda, uint8_t* p_remote_name); - /* Structure associated with BTA_DM_BLE_SEC_REQ_EVT */ typedef struct { BD_ADDR bd_addr; /* peer address */ @@ -1600,23 +1593,10 @@ extern int32_t BTA_DmPcmResample(void* p_src, uint32_t in_bytes, void* p_dst); ******************************************************************************/ extern void BTA_DmBleSecurityGrant(BD_ADDR bd_addr, tBTA_DM_BLE_SEC_GRANT res); -/******************************************************************************* - * - * Function BTA_DmBleSetBgConnType - * - * Description This function is called to set BLE connectable mode for a - * peripheral device. - * - * Parameters bg_conn_type: it can be auto connection, or selective - * connection. - * p_select_cback: callback function when selective connection - * procedure is being used. - * - * Returns void - * - ******************************************************************************/ -extern void BTA_DmBleSetBgConnType(tBTA_DM_BLE_CONN_TYPE bg_conn_type, - tBTA_DM_BLE_SEL_CBACK* p_select_cback); +/** + * Set BLE connectable mode to auto connect + */ +extern void BTA_DmBleStartAutoConn(); /******************************************************************************* * diff --git a/btif/src/btif_gatt_client.cc b/btif/src/btif_gatt_client.cc index d21e85fae..dcfb52685 100644 --- a/btif/src/btif_gatt_client.cc +++ b/btif/src/btif_gatt_client.cc @@ -263,7 +263,7 @@ void btif_gattc_open_impl(int client_if, BD_ADDR address, bool is_direct, return; } } - BTA_DmBleSetBgConnType(BTM_BLE_CONN_AUTO, NULL); + BTA_DmBleStartAutoConn(); } // Determine transport diff --git a/btif/src/btif_gatt_server.cc b/btif/src/btif_gatt_server.cc index 7f146daef..1d075dd0f 100644 --- a/btif/src/btif_gatt_server.cc +++ b/btif/src/btif_gatt_server.cc @@ -296,7 +296,7 @@ static void btif_gatts_open_impl(int server_if, BD_ADDR address, bool is_direct, } // Mark background connections - if (!is_direct) BTA_DmBleSetBgConnType(BTM_BLE_CONN_AUTO, NULL); + if (!is_direct) BTA_DmBleStartAutoConn(); // Determine transport if (transport_param != GATT_TRANSPORT_AUTO) { diff --git a/stack/btm/btm_ble_bgconn.cc b/stack/btm/btm_ble_bgconn.cc index c81cb2304..fd05b060d 100644 --- a/stack/btm/btm_ble_bgconn.cc +++ b/stack/btm/btm_ble_bgconn.cc @@ -403,108 +403,6 @@ bool btm_ble_start_auto_conn(bool start) { /******************************************************************************* * - * Function btm_ble_start_select_conn - * - * Description This function is to start/stop selective connection - * procedure. - * - * Parameters start: true to start; false to stop. - * p_select_cback: callback function to return application - * selection. - * - * Returns bool : selective connectino procedure is started. - * - ******************************************************************************/ -bool btm_ble_start_select_conn(bool start, tBTM_BLE_SEL_CBACK* p_select_cback) { - tBTM_BLE_CB* p_cb = &btm_cb.ble_ctr_cb; - uint32_t scan_int = p_cb->scan_int == BTM_BLE_SCAN_PARAM_UNDEF - ? BTM_BLE_SCAN_FAST_INT - : p_cb->scan_int; - uint32_t scan_win = p_cb->scan_win == BTM_BLE_SCAN_PARAM_UNDEF - ? BTM_BLE_SCAN_FAST_WIN - : p_cb->scan_win; - - BTM_TRACE_EVENT("%s", __func__); - - if (start) { - if (!BTM_BLE_IS_SCAN_ACTIVE(p_cb->scan_activity)) { - if (p_select_cback != NULL) - btm_cb.ble_ctr_cb.p_select_cback = p_select_cback; - - btm_execute_wl_dev_operation(); - - btm_update_scanner_filter_policy(SP_ADV_WL); - btm_cb.ble_ctr_cb.inq_var.scan_type = BTM_BLE_SCAN_MODE_PASS; - - /* Process advertising packets only from devices in the white list */ - if (btm_cb.cmn_ble_vsc_cb.extended_scan_support == 0) { - /* use passive scan by default */ - btsnd_hcic_ble_set_scan_params( - BTM_BLE_SCAN_MODE_PASS, scan_int, scan_win, - p_cb->addr_mgnt_cb.own_addr_type, SP_ADV_WL); - } else { - btm_ble_send_extended_scan_params( - BTM_BLE_SCAN_MODE_PASS, scan_int, scan_win, - p_cb->addr_mgnt_cb.own_addr_type, SP_ADV_WL); - } - - if (!btm_ble_topology_check(BTM_BLE_STATE_PASSIVE_SCAN)) { - BTM_TRACE_ERROR( - "peripheral device cannot initiate passive scan for a selective " - "connection"); - return false; - } else if (background_connections_pending()) { -#if (BLE_PRIVACY_SPT == TRUE) - btm_ble_enable_resolving_list_for_platform(BTM_BLE_RL_SCAN); -#endif - btsnd_hcic_ble_set_scan_enable(true, - true); /* duplicate filtering enabled */ - - /* mark up inquiry status flag */ - p_cb->scan_activity |= BTM_LE_SELECT_CONN_ACTIVE; - p_cb->wl_state |= BTM_BLE_WL_SCAN; - } - } else { - BTM_TRACE_ERROR( - "scan active, can not start selective connection procedure"); - return false; - } - } else /* disable selective connection mode */ - { - p_cb->scan_activity &= ~BTM_LE_SELECT_CONN_ACTIVE; - p_cb->p_select_cback = NULL; - p_cb->wl_state &= ~BTM_BLE_WL_SCAN; - - /* stop scanning */ - if (!BTM_BLE_IS_SCAN_ACTIVE(p_cb->scan_activity)) - btm_ble_stop_scan(); /* duplicate filtering enabled */ - } - return true; -} -/******************************************************************************* - * - * Function btm_ble_initiate_select_conn - * - * Description This function is to start/stop selective connection - * procedure. - * - * Parameters start: true to start; false to stop. - * p_select_cback: callback function to return application - * selection. - * - * Returns bool : selective connectino procedure is started. - * - ******************************************************************************/ -void btm_ble_initiate_select_conn(BD_ADDR bda) { - BTM_TRACE_EVENT("btm_ble_initiate_select_conn"); - - /* use direct connection procedure to initiate connection */ - if (!L2CA_ConnectFixedChnl(L2CAP_ATT_CID, bda)) { - BTM_TRACE_ERROR("btm_ble_initiate_select_conn failed"); - } -} -/******************************************************************************* - * * Function btm_ble_suspend_bg_conn * * Description This function is to suspend an active background connection @@ -520,8 +418,6 @@ bool btm_ble_suspend_bg_conn(void) { if (btm_cb.ble_ctr_cb.bg_conn_type == BTM_BLE_CONN_AUTO) return btm_ble_start_auto_conn(false); - else if (btm_cb.ble_ctr_cb.bg_conn_type == BTM_BLE_CONN_SELECTIVE) - return btm_ble_start_select_conn(false, NULL); return false; } @@ -538,9 +434,6 @@ static void btm_suspend_wl_activity(tBTM_BLE_WL_STATE wl_state) { if (wl_state & BTM_BLE_WL_INIT) { btm_ble_start_auto_conn(false); } - if (wl_state & BTM_BLE_WL_SCAN) { - btm_ble_start_select_conn(false, NULL); - } if (wl_state & BTM_BLE_WL_ADV) { btm_ble_stop_adv(); } @@ -575,17 +468,11 @@ static void btm_resume_wl_activity(tBTM_BLE_WL_STATE wl_state) { ******************************************************************************/ bool btm_ble_resume_bg_conn(void) { tBTM_BLE_CB* p_cb = &btm_cb.ble_ctr_cb; - bool ret = false; - - if (p_cb->bg_conn_type != BTM_BLE_CONN_NONE) { - if (p_cb->bg_conn_type == BTM_BLE_CONN_AUTO) - ret = btm_ble_start_auto_conn(true); - - if (p_cb->bg_conn_type == BTM_BLE_CONN_SELECTIVE) - ret = btm_ble_start_select_conn(true, btm_cb.ble_ctr_cb.p_select_cback); + if (p_cb->bg_conn_type == BTM_BLE_CONN_AUTO) { + return btm_ble_start_auto_conn(true); } - return ret; + return false; } /******************************************************************************* * diff --git a/stack/btm/btm_ble_gap.cc b/stack/btm/btm_ble_gap.cc index 20568d9c4..8e80b5c71 100644 --- a/stack/btm/btm_ble_gap.cc +++ b/stack/btm/btm_ble_gap.cc @@ -80,7 +80,6 @@ static void btm_ble_observer_timer_timeout(void* data); #define BTM_BLE_INQ_RESULT 0x01 #define BTM_BLE_OBS_RESULT 0x02 -#define BTM_BLE_SEL_CONN_RESULT 0x04 /* LE states combo bit to check */ const uint8_t btm_le_state_combo_tbl[BTM_BLE_STATE_MAX][BTM_BLE_STATE_MAX][2] = @@ -711,59 +710,17 @@ bool BTM_BleLocalPrivacyEnabled(void) { #endif } -/******************************************************************************* - * - * Function BTM_BleSetBgConnType - * - * Description This function is called to set BLE connectable mode for a - * peripheral device. - * - * Parameters bg_conn_type: it can be auto connection, or selective - * connection. - * p_select_cback: callback function when selective - * connection procedure is being used. - * - * Returns void - * - ******************************************************************************/ -bool BTM_BleSetBgConnType(tBTM_BLE_CONN_TYPE bg_conn_type, - tBTM_BLE_SEL_CBACK* p_select_cback) { - bool started = true; - - BTM_TRACE_EVENT("BTM_BleSetBgConnType "); - if (!controller_get_interface()->supports_ble()) return false; - - if (btm_cb.ble_ctr_cb.bg_conn_type != bg_conn_type) { - switch (bg_conn_type) { - case BTM_BLE_CONN_AUTO: - btm_ble_start_auto_conn(true); - break; - - case BTM_BLE_CONN_SELECTIVE: - if (btm_cb.ble_ctr_cb.bg_conn_type == BTM_BLE_CONN_AUTO) { - btm_ble_start_auto_conn(false); - } - btm_ble_start_select_conn(true, p_select_cback); - break; - - case BTM_BLE_CONN_NONE: - if (btm_cb.ble_ctr_cb.bg_conn_type == BTM_BLE_CONN_AUTO) { - btm_ble_start_auto_conn(false); - } else if (btm_cb.ble_ctr_cb.bg_conn_type == BTM_BLE_CONN_SELECTIVE) { - btm_ble_start_select_conn(false, NULL); - } - started = true; - break; - - default: - BTM_TRACE_ERROR("invalid bg connection type : %d ", bg_conn_type); - started = false; - break; - } +/** + * Set BLE connectable mode to auto connect + */ +void BTM_BleStartAutoConn() { + BTM_TRACE_EVENT("%s", __func__); + if (!controller_get_interface()->supports_ble()) return; - if (started) btm_cb.ble_ctr_cb.bg_conn_type = bg_conn_type; + if (btm_cb.ble_ctr_cb.bg_conn_type != BTM_BLE_CONN_AUTO) { + btm_ble_start_auto_conn(true); + btm_cb.ble_ctr_cb.bg_conn_type = BTM_BLE_CONN_AUTO; } - return started; } /******************************************************************************* @@ -1464,8 +1421,7 @@ tBTM_STATUS btm_ble_start_inquiry(uint8_t mode, uint8_t duration) { /* if selective connection is active, or inquiry is already active, reject it */ - if (BTM_BLE_IS_INQ_ACTIVE(p_ble_cb->scan_activity) || - BTM_BLE_IS_SEL_CONN_ACTIVE(p_ble_cb->scan_activity)) { + if (BTM_BLE_IS_INQ_ACTIVE(p_ble_cb->scan_activity)) { BTM_TRACE_ERROR("LE Inquiry is active, can not start inquiry"); return (BTM_BUSY); } @@ -1716,10 +1672,6 @@ uint8_t btm_ble_is_discoverable(BD_ADDR bda, uint8_t evt_type) { if (BTM_BLE_IS_OBS_ACTIVE(btm_cb.ble_ctr_cb.scan_activity)) rt |= BTM_BLE_OBS_RESULT; - if (BTM_BLE_IS_SEL_CONN_ACTIVE(btm_cb.ble_ctr_cb.scan_activity) && - (evt_type == BTM_BLE_CONNECT_EVT || evt_type == BTM_BLE_CONNECT_DIR_EVT)) - rt |= BTM_BLE_SEL_CONN_RESULT; - /* does not match filter condition */ if (p_cond->filter_cond_type == BTM_FILTER_COND_BD_ADDR && memcmp(bda, p_cond->filter_cond.bdaddr_cond, BD_ADDR_LEN) != 0) { @@ -2006,45 +1958,6 @@ void btm_clear_all_pending_le_entry(void) { /******************************************************************************* * - * Function btm_send_sel_conn_callback - * - * Description send selection connection request callback. - * - * Parameters - * - * Returns void - * - ******************************************************************************/ -void btm_send_sel_conn_callback(BD_ADDR remote_bda, uint8_t evt_type, - uint8_t data_len, uint8_t* data, - UNUSED_ATTR uint8_t addr_type) { - uint8_t len; - uint8_t *p_dev_name, remname[31] = {0}; - - if (btm_cb.ble_ctr_cb.p_select_cback == NULL || - /* non-connectable device */ - (evt_type != BTM_BLE_EVT_CONN_ADV && - evt_type != BTM_BLE_EVT_CONN_DIR_ADV)) - return; - - /* get the device name if exist in ADV data */ - if (data_len != 0) { - p_dev_name = BTM_CheckAdvData(data, BTM_BLE_AD_TYPE_NAME_CMPL, &len); - - if (p_dev_name == NULL) - p_dev_name = BTM_CheckAdvData(data, BTM_BLE_AD_TYPE_NAME_SHORT, &len); - - if (p_dev_name) memcpy(remname, p_dev_name, len); - } - /* allow connection */ - if ((*btm_cb.ble_ctr_cb.p_select_cback)(remote_bda, remname)) { - /* terminate selective connection, initiate connection */ - btm_ble_initiate_select_conn(remote_bda); - } -} - -/******************************************************************************* - * * Function btm_ble_process_adv_pkt * * Description This function is called when adv packet report events are @@ -2209,22 +2122,14 @@ static void btm_ble_process_adv_pkt_cont(BD_ADDR bda, uint8_t addr_type, btm_acl_update_busy_level(BTM_BLI_INQ_DONE_EVT); } } - /* background connection in selective connection mode */ - if (btm_cb.ble_ctr_cb.bg_conn_type == BTM_BLE_CONN_SELECTIVE) { - if (result & BTM_BLE_SEL_CONN_RESULT) - btm_send_sel_conn_callback(bda, evt_type, data_len, data, addr_type); - else { - BTM_TRACE_DEBUG("None LE device, can not initiate selective connection"); - } - } else { - if (p_inq_results_cb && (result & BTM_BLE_INQ_RESULT)) { - (p_inq_results_cb)((tBTM_INQ_RESULTS*)&p_i->inq_info.results, - p_le_inq_cb->adv_data_cache); - } - if (p_obs_results_cb && (result & BTM_BLE_OBS_RESULT)) { - (p_obs_results_cb)((tBTM_INQ_RESULTS*)&p_i->inq_info.results, - p_le_inq_cb->adv_data_cache); - } + + if (p_inq_results_cb && (result & BTM_BLE_INQ_RESULT)) { + (p_inq_results_cb)((tBTM_INQ_RESULTS*)&p_i->inq_info.results, + p_le_inq_cb->adv_data_cache); + } + if (p_obs_results_cb && (result & BTM_BLE_OBS_RESULT)) { + (p_obs_results_cb)((tBTM_INQ_RESULTS*)&p_i->inq_info.results, + p_le_inq_cb->adv_data_cache); } } @@ -2272,8 +2177,6 @@ void btm_ble_stop_scan(void) { BTM_BLE_DUPLICATE_ENABLE); btm_update_scanner_filter_policy(SP_ADV_ALL); - - btm_cb.ble_ctr_cb.wl_state &= ~BTM_BLE_WL_SCAN; } /******************************************************************************* * diff --git a/stack/btm/btm_ble_int.h b/stack/btm/btm_ble_int.h index 343aa792d..635ea3d04 100644 --- a/stack/btm/btm_ble_int.h +++ b/stack/btm/btm_ble_int.h @@ -121,10 +121,8 @@ extern void btm_ble_white_list_init(uint8_t white_list_size); /* background connection function */ extern bool btm_ble_suspend_bg_conn(void); extern bool btm_ble_resume_bg_conn(void); -extern void btm_ble_initiate_select_conn(BD_ADDR bda); extern bool btm_ble_start_auto_conn(bool start); -extern bool btm_ble_start_select_conn(bool start, - tBTM_BLE_SEL_CBACK* p_select_cback); +extern bool btm_ble_start_select_conn(bool start); extern bool btm_ble_renew_bg_conn_params(bool add, BD_ADDR bd_addr); extern void btm_write_dir_conn_wl(BD_ADDR target_addr); extern void btm_ble_update_mode_operation(uint8_t link_role, BD_ADDR bda, diff --git a/stack/btm/btm_ble_int_types.h b/stack/btm/btm_ble_int_types.h index 656d30ccb..c530ee81a 100644 --- a/stack/btm/btm_ble_int_types.h +++ b/stack/btm/btm_ble_int_types.h @@ -91,8 +91,6 @@ typedef uint8_t tBTM_BLE_SEC_REQ_ACT; (((x)[0] & BLE_PUBLIC_ADDR_MSB_MASK) == BLE_PUBLIC_ADDR_MSB) /* LE scan activity bit mask, continue with LE inquiry bits */ -/* selection connection is in progress */ -#define BTM_LE_SELECT_CONN_ACTIVE 0x40 /* observe is in progress */ #define BTM_LE_OBSERVE_ACTIVE 0x80 @@ -100,7 +98,6 @@ typedef uint8_t tBTM_BLE_SEC_REQ_ACT; #define BTM_BLE_IS_SCAN_ACTIVE(x) ((x)&BTM_BLE_SCAN_ACTIVE_MASK) #define BTM_BLE_IS_INQ_ACTIVE(x) ((x)&BTM_BLE_INQUIRY_MASK) #define BTM_BLE_IS_OBS_ACTIVE(x) ((x)&BTM_LE_OBSERVE_ACTIVE) -#define BTM_BLE_IS_SEL_CONN_ACTIVE(x) ((x)&BTM_LE_SELECT_CONN_ACTIVE) /* BLE ADDR type ID bit */ #define BLE_ADDR_TYPE_ID_BIT 0x02 @@ -203,7 +200,6 @@ typedef struct { /* white list using state as a bit mask */ #define BTM_BLE_WL_IDLE 0 #define BTM_BLE_WL_INIT 1 -#define BTM_BLE_WL_SCAN 2 #define BTM_BLE_WL_ADV 4 typedef uint8_t tBTM_BLE_WL_STATE; @@ -308,7 +304,6 @@ typedef struct { tBTM_BLE_CONN_TYPE bg_conn_type; uint32_t scan_int; uint32_t scan_win; - tBTM_BLE_SEL_CBACK* p_select_cback; /* white list information */ uint8_t white_list_avail_size; diff --git a/stack/btm/btm_devctl.cc b/stack/btm/btm_devctl.cc index bc4c5f934..8e580bc57 100644 --- a/stack/btm/btm_devctl.cc +++ b/stack/btm/btm_devctl.cc @@ -161,7 +161,6 @@ static void reset_complete(void* result) { btm_cb.ble_ctr_cb.conn_state = BLE_CONN_IDLE; btm_cb.ble_ctr_cb.bg_conn_type = BTM_BLE_CONN_NONE; - btm_cb.ble_ctr_cb.p_select_cback = NULL; gatt_reset_bgdev_list(); btm_pm_reset(); diff --git a/stack/include/btm_ble_api.h b/stack/include/btm_ble_api.h index b1f2d6546..7eddbd0ac 100644 --- a/stack/include/btm_ble_api.h +++ b/stack/include/btm_ble_api.h @@ -448,24 +448,10 @@ extern bool BTM_ReadRemoteConnectionAddr(BD_ADDR pseudo_addr, BD_ADDR conn_addr, ******************************************************************************/ extern void BTM_BleLoadLocalKeys(uint8_t key_type, tBTM_BLE_LOCAL_KEYS* p_key); -/******************************************************************************* - * - * Function BTM_BleSetBgConnType - * - * Description This function is called to set BLE background connection - * procedure type. It can be auto connection, or selective - * connection. - * - * Parameters conn_type: it can be auto connection, or selective - * connection. - * p_select_cback: callback function when selective connection - * procedure is being used. - * - * Returns void - * - ******************************************************************************/ -extern bool BTM_BleSetBgConnType(tBTM_BLE_CONN_TYPE conn_type, - tBTM_BLE_SEL_CBACK* p_select_cback); +/** + * Set BLE connectable mode to auto connect + */ +extern void BTM_BleStartAutoConn(); /******************************************************************************* * diff --git a/stack/include/btm_ble_api_types.h b/stack/include/btm_ble_api_types.h index dabddee34..ee97f32db 100644 --- a/stack/include/btm_ble_api_types.h +++ b/stack/include/btm_ble_api_types.h @@ -631,7 +631,7 @@ typedef uint8_t BTM_BLE_ADV_INFO_PRESENT; typedef uint8_t BTM_BLE_RSSI_VALUE; typedef uint16_t BTM_BLE_ADV_INFO_TIMESTAMP; -enum { BTM_BLE_CONN_NONE, BTM_BLE_CONN_AUTO, BTM_BLE_CONN_SELECTIVE }; +enum { BTM_BLE_CONN_NONE, BTM_BLE_CONN_AUTO }; typedef uint8_t tBTM_BLE_CONN_TYPE; #define ADV_INFO_PRESENT 0x00 -- 2.11.0