diff --git a/include/bluetooth/audio/csis.h b/include/bluetooth/audio/csis.h index 2406fd39e31..1e954bf01cc 100644 --- a/include/bluetooth/audio/csis.h +++ b/include/bluetooth/audio/csis.h @@ -253,13 +253,12 @@ typedef void (*bt_csis_client_lock_changed_cb)(struct bt_csis_client_set *set, /** * @brief Callback when the lock value is read on a device. * - * @param conn Connection of the CSIS server. + * @param set The set that was read. * @param err Error value. 0 on success, GATT error or errno on fail. - * @param inst_idx The index of the CSIS service. * @param locked Whether the lock is locked or release. */ -typedef void (*bt_csis_client_lock_read_cb)(struct bt_conn *conn, int err, - uint8_t inst_idx, bool locked); +typedef void (*bt_csis_client_lock_read_cb)(struct bt_csis_client_set *set, + int err, bool locked); struct bt_csis_client_cb { /* Set callbacks */ diff --git a/subsys/bluetooth/audio/csis_client.c b/subsys/bluetooth/audio/csis_client.c index 2257f12fcf6..44d41b0bc3e 100644 --- a/subsys/bluetooth/audio/csis_client.c +++ b/subsys/bluetooth/audio/csis_client.c @@ -858,9 +858,10 @@ static uint8_t csis_client_read_lock_cb(struct bt_conn *conn, uint8_t err, struct bt_gatt_read_params *params, const void *data, uint16_t length) { + struct bt_csis_client_inst *client; + struct bt_csis_client_set *set; uint8_t value = 0; int cb_err = err; - uint8_t idx = cur_inst->cli.idx; busy = false; @@ -889,10 +890,12 @@ static uint8_t csis_client_read_lock_cb(struct bt_conn *conn, uint8_t err, } } + client = &client_insts[bt_conn_index(conn)]; + set = &client->set_member->sets[cur_inst->cli.idx]; cur_inst = NULL; if (csis_client_cbs != NULL && csis_client_cbs->lock_read != NULL) { - csis_client_cbs->lock_read(conn, cb_err, idx, + csis_client_cbs->lock_read(set, cb_err, value == BT_CSIS_LOCK_VALUE ? true : false); } return BT_GATT_ITER_STOP; diff --git a/subsys/bluetooth/shell/csis_client.c b/subsys/bluetooth/shell/csis_client.c index a1d098484e9..17ea7d658f3 100644 --- a/subsys/bluetooth/shell/csis_client.c +++ b/subsys/bluetooth/shell/csis_client.c @@ -137,16 +137,16 @@ static void csis_client_release_set_cb(int err) shell_print(ctx_shell, "Set released"); } -static void csis_client_lock_get_cb(struct bt_conn *conn, int err, - uint8_t inst_idx, bool locked) +static void csis_client_lock_get_cb(struct bt_csis_client_set *set, int err, + bool locked) { if (err != 0) { - shell_error(ctx_shell, "Device (index 0x%02x) lock get " - "failed (%d)", inst_idx, err); + shell_error(ctx_shell, "Device (set %p) lock get " + "failed (%d)", set, err); } - shell_print(ctx_shell, "Device (index 0x%02x) lock value %d", - inst_idx, locked); + shell_print(ctx_shell, "Device (set %p) lock value %d", + set, locked); } static struct bt_csis_client_cb cbs = {