Bluetooth: gatt: callbacks on ATT MTU update
Adds a new callback structure to `<gatt.h>` for receiving notifications of ATT MTU updates. This callback is called regardless of whether the MTU update was initiated locally or remotely. Fixes #32035. Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
This commit is contained in:
parent
1f0b783bbb
commit
43b2400688
4 changed files with 77 additions and 0 deletions
|
@ -71,6 +71,7 @@ struct gatt_sub {
|
|||
#endif /* CONFIG_BT_GATT_CLIENT */
|
||||
|
||||
static struct gatt_sub subscriptions[SUB_MAX];
|
||||
static sys_slist_t callback_list;
|
||||
|
||||
static const uint16_t gap_appearance = CONFIG_BT_DEVICE_APPEARANCE;
|
||||
|
||||
|
@ -1106,6 +1107,8 @@ void bt_gatt_init(void)
|
|||
|
||||
bt_gatt_service_init();
|
||||
|
||||
sys_slist_init(&callback_list);
|
||||
|
||||
#if defined(CONFIG_BT_GATT_CACHING)
|
||||
k_work_init_delayable(&db_hash.work, db_hash_process);
|
||||
|
||||
|
@ -1157,6 +1160,11 @@ submit:
|
|||
}
|
||||
#endif /* BT_GATT_DYNAMIC_DB || (BT_GATT_CACHING && BT_SETTINGS) */
|
||||
|
||||
void bt_gatt_cb_register(struct bt_gatt_cb *cb)
|
||||
{
|
||||
sys_slist_append(&callback_list, &cb->node);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_BT_GATT_DYNAMIC_DB)
|
||||
static void db_changed(void)
|
||||
{
|
||||
|
@ -4867,6 +4875,17 @@ void bt_gatt_connected(struct bt_conn *conn)
|
|||
#endif /* CONFIG_BT_GATT_CLIENT */
|
||||
}
|
||||
|
||||
void bt_gatt_att_max_mtu_changed(struct bt_conn *conn, uint16_t tx, uint16_t rx)
|
||||
{
|
||||
struct bt_gatt_cb *cb;
|
||||
|
||||
SYS_SLIST_FOR_EACH_CONTAINER(&callback_list, cb, node) {
|
||||
if (cb->att_mtu_updated) {
|
||||
cb->att_mtu_updated(conn, tx, rx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void bt_gatt_encrypt_change(struct bt_conn *conn)
|
||||
{
|
||||
struct conn_data data;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue