Bluetooth: indication callback signature update
Update the signature of the `bt_gatt_indicate_func_t` callback type by replacing the attr pointer with a pointer to the `bt_gatt_indicate_params` struct that was used to start the indication. This allows the callback to free the `bt_gatt_indicate_params` instance if it was allocated from storage, while still allowing the `bt_gatt_attr` value to be accessed through `params->attr`. Allocating the `bt_gatt_indicate_params` instance from storage is desirable as multiple indications can be queued, however each instance must be valid until the callback is run. Implements API update from #29357 Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
This commit is contained in:
parent
e51226b827
commit
170f17e0e7
9 changed files with 21 additions and 16 deletions
|
@ -904,7 +904,7 @@ static inline void sc_work_submit(k_timeout_t timeout)
|
|||
|
||||
#if defined(CONFIG_BT_GATT_SERVICE_CHANGED)
|
||||
static void sc_indicate_rsp(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, uint8_t err)
|
||||
struct bt_gatt_indicate_params *params, uint8_t err)
|
||||
{
|
||||
#if defined(CONFIG_BT_GATT_CACHING)
|
||||
struct gatt_cf_cfg *cfg;
|
||||
|
@ -1900,7 +1900,7 @@ static void gatt_indicate_rsp(struct bt_conn *conn, uint8_t err,
|
|||
{
|
||||
struct bt_gatt_indicate_params *params = user_data;
|
||||
|
||||
params->func(conn, params->attr, err);
|
||||
params->func(conn, params, err);
|
||||
}
|
||||
|
||||
static int gatt_send(struct bt_conn *conn, struct net_buf *buf,
|
||||
|
@ -2268,7 +2268,7 @@ uint8_t bt_gatt_check_perm(struct bt_conn *conn, const struct bt_gatt_attr *attr
|
|||
}
|
||||
|
||||
static void sc_restore_rsp(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, uint8_t err)
|
||||
struct bt_gatt_indicate_params *params, uint8_t err)
|
||||
{
|
||||
#if defined(CONFIG_BT_GATT_CACHING)
|
||||
struct gatt_cf_cfg *cfg;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue