mirror of
https://github.com/espressif/esp-idf.git
synced 2026-08-18 06:35:35 +03:00
fix(bluedroid): delete bluedroid gatt_listen
(cherry picked from commit db17c7cea3)
Co-authored-by: zhiweijian <zhiweijian@espressif.com>
This commit is contained in:
@@ -379,68 +379,6 @@ void BTM_BleClearWhitelist(tBTM_UPDATE_WHITELIST_CBACK *update_wl_cb)
|
||||
btm_ble_clear_white_list(update_wl_cb);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_BleUpdateAdvFilterPolicy
|
||||
**
|
||||
** Description This function update the filter policy of advertiser.
|
||||
**
|
||||
** Parameter adv_policy: advertising filter policy
|
||||
**
|
||||
** Return void
|
||||
*******************************************************************************/
|
||||
void BTM_BleUpdateAdvFilterPolicy(tBTM_BLE_AFP adv_policy)
|
||||
{
|
||||
tBTM_BLE_INQ_CB *p_cb = &btm_cb.ble_ctr_cb.inq_var;
|
||||
tBLE_ADDR_TYPE init_addr_type = BLE_ADDR_PUBLIC;
|
||||
BD_ADDR p_addr_ptr = {0};
|
||||
UINT8 adv_mode = p_cb->adv_mode;
|
||||
|
||||
BTM_TRACE_EVENT ("BTM_BleUpdateAdvFilterPolicy\n");
|
||||
|
||||
if (!controller_get_interface()->supports_ble()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (p_cb->afp != adv_policy) {
|
||||
p_cb->afp = adv_policy;
|
||||
|
||||
#if (BLE_42_ADV_EN == TRUE)
|
||||
/* if adv active, stop and restart */
|
||||
btm_ble_stop_adv ();
|
||||
#endif // #if (BLE_42_ADV_EN == TRUE)
|
||||
|
||||
if (p_cb->connectable_mode & BTM_BLE_CONNECTABLE) {
|
||||
p_cb->evt_type = btm_set_conn_mode_adv_init_addr(p_cb, p_addr_ptr, &init_addr_type,
|
||||
&p_cb->adv_addr_type);
|
||||
}
|
||||
|
||||
uint8_t null_addr[BD_ADDR_LEN] = {0};
|
||||
if ((p_cb->evt_type == 0x01 || p_cb->evt_type == 0x04) && memcmp(p_addr_ptr, null_addr, BD_ADDR_LEN) == 0) {
|
||||
/* directed advertising */
|
||||
return;
|
||||
}
|
||||
|
||||
btsnd_hcic_ble_write_adv_params ((UINT16)(p_cb->adv_interval_min ? p_cb->adv_interval_min :
|
||||
BTM_BLE_GAP_ADV_SLOW_INT),
|
||||
(UINT16)(p_cb->adv_interval_max ? p_cb->adv_interval_max :
|
||||
BTM_BLE_GAP_ADV_SLOW_INT),
|
||||
p_cb->evt_type,
|
||||
p_cb->adv_addr_type,
|
||||
init_addr_type,
|
||||
p_addr_ptr,
|
||||
p_cb->adv_chnl_map,
|
||||
p_cb->afp);
|
||||
|
||||
if (adv_mode == BTM_BLE_ADV_ENABLE) {
|
||||
#if (BLE_42_ADV_EN == TRUE)
|
||||
btm_ble_start_adv ();
|
||||
#endif // #if (BLE_42_ADV_EN == TRUE)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btm_ble_send_extended_scan_params
|
||||
|
||||
@@ -1394,10 +1394,6 @@ void GATT_Deregister (tGATT_IF gatt_if)
|
||||
#if (tGATT_BG_CONN_DEV == TRUE)
|
||||
gatt_deregister_bgdev_list(gatt_if);
|
||||
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
|
||||
/* update the listen mode */
|
||||
#if (defined(BLE_PERIPHERAL_MODE_SUPPORT) && (BLE_PERIPHERAL_MODE_SUPPORT == TRUE))
|
||||
GATT_Listen(gatt_if, FALSE, NULL);
|
||||
#endif
|
||||
|
||||
memset (p_reg, 0, sizeof(tGATT_REG));
|
||||
}
|
||||
@@ -1703,45 +1699,6 @@ BOOLEAN GATT_GetConnIdIfConnected(tGATT_IF gatt_if, BD_ADDR bd_addr, UINT16 *p_c
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function GATT_Listen
|
||||
**
|
||||
** Description This function start or stop LE advertisement and listen for
|
||||
** connection.
|
||||
**
|
||||
** Parameters gatt_if: application interface
|
||||
** p_bd_addr: listen for specific address connection, or NULL for
|
||||
** listen to all device connection.
|
||||
** start: start or stop listening.
|
||||
**
|
||||
** Returns TRUE if advertisement is started; FALSE if adv start failure.
|
||||
**
|
||||
*******************************************************************************/
|
||||
BOOLEAN GATT_Listen (tGATT_IF gatt_if, BOOLEAN start, BD_ADDR_PTR bd_addr)
|
||||
{
|
||||
tGATT_REG *p_reg;
|
||||
|
||||
GATT_TRACE_API ("GATT_Listen gatt_if=%d", gatt_if);
|
||||
|
||||
/* Make sure app is registered */
|
||||
if ((p_reg = gatt_get_regcb(gatt_if)) == NULL) {
|
||||
GATT_TRACE_ERROR("GATT_Listen - gatt_if =%d is not registered", gatt_if);
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
if (bd_addr != NULL) {
|
||||
#if (tGATT_BG_CONN_DEV == TRUE)
|
||||
gatt_update_auto_connect_dev(gatt_if, start, bd_addr, FALSE);
|
||||
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
|
||||
} else {
|
||||
p_reg->listening = start ? GATT_LISTEN_TO_ALL : GATT_LISTEN_TO_NONE;
|
||||
}
|
||||
|
||||
return gatt_update_listen_mode();
|
||||
}
|
||||
|
||||
#if (GATTS_INCLUDED == TRUE)
|
||||
tGATT_STATUS GATTS_SetServiceChangeMode(UINT8 mode)
|
||||
{
|
||||
|
||||
@@ -2830,53 +2830,6 @@ tGATT_PENDING_ENC_CLCB *gatt_add_pending_enc_channel_clcb(tGATT_TCB *p_tcb, tGAT
|
||||
return p_buf;
|
||||
}
|
||||
#endif // (SMP_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function gatt_update_listen_mode
|
||||
**
|
||||
** Description update peripheral role listening mode
|
||||
**
|
||||
** Returns Pointer to the new service start buffer, NULL no buffer available
|
||||
**
|
||||
*******************************************************************************/
|
||||
BOOLEAN gatt_update_listen_mode(void)
|
||||
{
|
||||
UINT8 ii = 0;
|
||||
tGATT_REG *p_reg = &gatt_cb.cl_rcb[0];
|
||||
UINT8 listening = 0;
|
||||
UINT16 connectability, window, interval;
|
||||
BOOLEAN rt = TRUE;
|
||||
|
||||
for (; ii < GATT_MAX_APPS; ii ++, p_reg ++) {
|
||||
if ( p_reg->in_use && p_reg->listening > listening) {
|
||||
listening = p_reg->listening;
|
||||
}
|
||||
}
|
||||
|
||||
if (listening == GATT_LISTEN_TO_ALL ||
|
||||
listening == GATT_LISTEN_TO_NONE) {
|
||||
BTM_BleUpdateAdvFilterPolicy (AP_SCAN_CONN_ALL);
|
||||
} else {
|
||||
BTM_BleUpdateAdvFilterPolicy (AP_SCAN_CONN_WL);
|
||||
}
|
||||
|
||||
if (rt) {
|
||||
connectability = BTM_ReadConnectability (&window, &interval);
|
||||
|
||||
if (listening != GATT_LISTEN_TO_NONE) {
|
||||
connectability |= BTM_BLE_CONNECTABLE;
|
||||
} else {
|
||||
if ((connectability & BTM_BLE_CONNECTABLE) == 0) {
|
||||
connectability &= ~BTM_BLE_CONNECTABLE;
|
||||
}
|
||||
}
|
||||
/* turning on the adv now */
|
||||
btm_ble_set_connectability(connectability);
|
||||
}
|
||||
|
||||
return rt;
|
||||
|
||||
}
|
||||
|
||||
char *gatt_uuid_to_str(const tBT_UUID *uuid)
|
||||
{
|
||||
|
||||
@@ -665,7 +665,6 @@ extern void gatt_set_srv_chg(void);
|
||||
extern void gatt_delete_dev_from_srv_chg_clt_list(BD_ADDR bd_addr);
|
||||
extern tGATTS_PENDING_NEW_SRV_START *gatt_add_pending_new_srv_start( tGATTS_HNDL_RANGE *p_new_srv_start);
|
||||
extern void gatt_free_srvc_db_buffer_app_id(tBT_UUID *p_app_id);
|
||||
extern BOOLEAN gatt_update_listen_mode(void);
|
||||
extern BOOLEAN gatt_cl_send_next_cmd_inq(tGATT_TCB *p_tcb);
|
||||
|
||||
/* reserved handle list */
|
||||
|
||||
@@ -2754,19 +2754,6 @@ BOOLEAN BTM_BleUpdateAdvWhitelist(BOOLEAN add_remove, BD_ADDR emote_bda, tBLE_AD
|
||||
*******************************************************************************/
|
||||
void BTM_BleClearWhitelist(tBTM_UPDATE_WHITELIST_CBACK *update_wl_cb);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_BleUpdateAdvFilterPolicy
|
||||
**
|
||||
** Description This function update the filter policy of advertiser.
|
||||
**
|
||||
** Parameter adv_policy: advertising filter policy
|
||||
**
|
||||
** Return void
|
||||
*******************************************************************************/
|
||||
//extern
|
||||
void BTM_BleUpdateAdvFilterPolicy(tBTM_BLE_AFP adv_policy);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_BleReceiverTest
|
||||
|
||||
@@ -1227,23 +1227,6 @@ extern BOOLEAN GATT_GetConnIdIfConnected(tGATT_IF gatt_if, BD_ADDR bd_addr,
|
||||
UINT16 *p_conn_id, tBT_TRANSPORT transport);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function GATT_Listen
|
||||
**
|
||||
** Description This function start or stop LE advertisement and listen for
|
||||
** connection.
|
||||
**
|
||||
** Parameters gatt_if: application interface
|
||||
** p_bd_addr: listen for specific address connection, or NULL for
|
||||
** listen to all device connection.
|
||||
** start: is a direct connection or a background auto connection
|
||||
**
|
||||
** Returns TRUE if advertisement is started; FALSE if adv start failure.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN GATT_Listen (tGATT_IF gatt_if, BOOLEAN start, BD_ADDR_PTR bd_addr);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function GATT_ConfigServiceChangeCCC
|
||||
|
||||
Reference in New Issue
Block a user