Skip to content

Commit

Permalink
bt: services: ots: l2cap close handling for read
Browse files Browse the repository at this point in the history
Ensure OTS current object is returned to idle state when an L2CAP
connection is closed.

Signed-off-by: Abe Kohandel <[email protected]>
  • Loading branch information
ekohandel committed Dec 11, 2024
1 parent 1baf93b commit 973b5d1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion subsys/bluetooth/services/ots/ots_oacp.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ LOG_MODULE_DECLARE(bt_ots, CONFIG_BT_OTS_LOG_LEVEL);
#if defined(CONFIG_BT_OTS_OACP_WRITE_SUPPORT)
static ssize_t oacp_write_proc_cb(struct bt_gatt_ots_l2cap *l2cap_ctx,
struct bt_conn *conn, struct net_buf *buf);
#endif

static void oacp_l2cap_closed(struct bt_gatt_ots_l2cap *l2cap_ctx,
struct bt_conn *conn)
Expand All @@ -45,7 +46,6 @@ static void oacp_l2cap_closed(struct bt_gatt_ots_l2cap *l2cap_ctx,
l2cap_ctx->rx_done = NULL;
l2cap_ctx->tx_done = NULL;
}
#endif

#if defined(CONFIG_BT_OTS_OACP_CREATE_SUPPORT)
static enum bt_gatt_ots_oacp_res_code oacp_create_proc_validate(
Expand Down Expand Up @@ -506,6 +506,7 @@ static void oacp_read_proc_cb(struct bt_gatt_ots_l2cap *l2cap_ctx,
}

ots->l2cap.tx_done = oacp_read_proc_cb;
ots->l2cap.closed = oacp_l2cap_closed;
err = bt_gatt_ots_l2cap_send(&ots->l2cap, obj_chunk, len);
if (err) {
LOG_ERR("L2CAP CoC error: %d while trying to execute OACP "
Expand Down

0 comments on commit 973b5d1

Please sign in to comment.