mirror of
https://github.com/espressif/esp-idf.git
synced 2026-07-23 03:13:01 +03:00
Merge branch 'fix/gattc-multi-app-notif-warning_v5.3' into 'release/v5.3'
fix(bt): Suppress gattc drop-notif warning for unregistered gatt_if (5.3) See merge request espressif/esp-idf!49514
This commit is contained in:
@@ -2264,12 +2264,14 @@ void bta_gattc_process_indicate(UINT16 conn_id, tGATTC_OPTYPE op, tGATT_CL_COMPL
|
||||
bta_gattc_proc_other_indication(p_clcb, op, p_data, ¬ify);
|
||||
}
|
||||
} else {
|
||||
/* No app registered for this handle: drop the PDU, but log it
|
||||
* so the common "registered a wrong handle" bug is visible
|
||||
* instead of silently failing. */
|
||||
APPL_TRACE_WARNING("drop %s, handle 0x%04x not registered",
|
||||
(op == GATTC_OPTYPE_INDICATION) ? "ind" : "notif",
|
||||
handle);
|
||||
/* GATT stack broadcasts notif/ind to every client app; drop here
|
||||
* when this gatt_if did not register. Only warn if no app at all
|
||||
* registered for the handle (likely wrong handle). */
|
||||
if (!bta_gattc_any_notif_registry(p_srcb, ¬ify)) {
|
||||
APPL_TRACE_WARNING("drop %s, handle 0x%04x not registered",
|
||||
(op == GATTC_OPTYPE_INDICATION) ? "ind" : "notif",
|
||||
handle);
|
||||
}
|
||||
if (op == GATTC_OPTYPE_INDICATION) {
|
||||
GATTC_SendHandleValueConfirm(conn_id, handle);
|
||||
}
|
||||
|
||||
@@ -668,6 +668,29 @@ BOOLEAN bta_gattc_check_notif_registry(tBTA_GATTC_RCB *p_clreg, tBTA_GATTC_SERV
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_gattc_any_notif_registry
|
||||
**
|
||||
** Description check if any GATT client app registered for the notification.
|
||||
**
|
||||
** Returns TRUE if any app registered, FALSE otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
BOOLEAN bta_gattc_any_notif_registry(tBTA_GATTC_SERV *p_srcb, tBTA_GATTC_NOTIFY *p_notify)
|
||||
{
|
||||
UINT8 i;
|
||||
|
||||
for (i = 0; i < BTA_GATTC_CL_MAX; i++) {
|
||||
if (bta_gattc_cb.cl_rcb[i].in_use &&
|
||||
bta_gattc_check_notif_registry(&bta_gattc_cb.cl_rcb[i], p_srcb, p_notify)) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_gattc_clear_notif_registration
|
||||
|
||||
@@ -523,6 +523,7 @@ extern BOOLEAN bta_gattc_enqueue(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_dat
|
||||
|
||||
extern BOOLEAN bta_gattc_uuid_compare (const tBT_UUID *p_src, const tBT_UUID *p_tar, BOOLEAN is_precise);
|
||||
extern BOOLEAN bta_gattc_check_notif_registry(tBTA_GATTC_RCB *p_clreg, tBTA_GATTC_SERV *p_srcb, tBTA_GATTC_NOTIFY *p_notify);
|
||||
extern BOOLEAN bta_gattc_any_notif_registry(tBTA_GATTC_SERV *p_srcb, tBTA_GATTC_NOTIFY *p_notify);
|
||||
extern BOOLEAN bta_gattc_mark_bg_conn (tBTA_GATTC_IF client_if, BD_ADDR_PTR remote_bda, BOOLEAN add, BOOLEAN is_listen);
|
||||
extern BOOLEAN bta_gattc_check_bg_conn (tBTA_GATTC_IF client_if, BD_ADDR remote_bda, UINT8 role);
|
||||
extern UINT8 bta_gattc_num_reg_app(void);
|
||||
|
||||
Reference in New Issue
Block a user