Bluetooth: CSIS: Rename bt_csis_client_set
Rename struct bt_csis_client_set to struct bt_csis_client_csis_inst, as that is more descriptive of the actual content of the struct. This also avoids the confusion about what a "set" is, which is clearly not a single instance of CSIS on a single remote server. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
47e23ab344
commit
e9703294b1
@ -224,7 +224,7 @@ struct bt_csis_client_set_info {
|
||||
* The values in this struct will be populated during discovery of sets
|
||||
* (bt_csis_client_discover_sets()).
|
||||
*/
|
||||
struct bt_csis_client_set {
|
||||
struct bt_csis_client_csis_inst {
|
||||
struct bt_csis_client_set_info info;
|
||||
|
||||
/** Internally used pointer value */
|
||||
@ -235,8 +235,8 @@ struct bt_csis_client_set {
|
||||
struct bt_csis_client_set_member {
|
||||
/** Connection pointer to the remote device, populated by the user */
|
||||
struct bt_conn *conn;
|
||||
/** Array of sets for the remote device */
|
||||
struct bt_csis_client_set sets[BT_CSIS_CLIENT_MAX_CSIS_INSTANCES];
|
||||
/** Array of Coordinated Set Identification Service instances for the remote device */
|
||||
struct bt_csis_client_csis_inst insts[BT_CSIS_CLIENT_MAX_CSIS_INSTANCES];
|
||||
};
|
||||
|
||||
/**
|
||||
@ -293,12 +293,13 @@ typedef void (*bt_csis_client_lock_set_cb)(int err);
|
||||
* @typedef bt_csis_client_lock_changed_cb
|
||||
* @brief Callback when the lock value on a set of a connected device changes.
|
||||
*
|
||||
* @param set The set that was changed.
|
||||
* @param inst The Coordinated Set Identification Service instance that was
|
||||
* changed.
|
||||
* @param locked Whether the lock is locked or release.
|
||||
*
|
||||
* @return int Return 0 on success, or an errno value on error.
|
||||
*/
|
||||
typedef void (*bt_csis_client_lock_changed_cb)(struct bt_csis_client_set *set,
|
||||
typedef void (*bt_csis_client_lock_changed_cb)(struct bt_csis_client_csis_inst *inst,
|
||||
bool locked);
|
||||
|
||||
/**
|
||||
|
||||
@ -73,10 +73,10 @@ static int csis_client_read_set_size(struct bt_conn *conn, uint8_t inst_idx,
|
||||
bt_gatt_read_func_t cb);
|
||||
static int csis_client_read_set_lock(struct bt_csis *inst);
|
||||
|
||||
static uint8_t csis_client_discover_sets_read_set_sirk_cb(
|
||||
static uint8_t csis_client_discover_insts_read_set_sirk_cb(
|
||||
struct bt_conn *conn, uint8_t err, struct bt_gatt_read_params *params,
|
||||
const void *data, uint16_t length);
|
||||
static void discover_sets_resume(struct bt_conn *conn, uint16_t sirk_handle,
|
||||
static void discover_insts_resume(struct bt_conn *conn, uint16_t sirk_handle,
|
||||
uint16_t size_handle, uint16_t rank_handle);
|
||||
|
||||
static void active_members_reset(void)
|
||||
@ -125,10 +125,10 @@ static struct bt_csis *lookup_instance_by_index(struct bt_conn *conn,
|
||||
static struct bt_csis *lookup_instance_by_set_info(const struct bt_csis_client_set_member *member,
|
||||
const struct bt_csis_client_set_info *set_info)
|
||||
{
|
||||
for (int i = 0; i < ARRAY_SIZE(member->sets); i++) {
|
||||
for (int i = 0; i < ARRAY_SIZE(member->insts); i++) {
|
||||
const struct bt_csis_client_set_info *member_set_info;
|
||||
|
||||
member_set_info = &member->sets[i].info;
|
||||
member_set_info = &member->insts[i].info;
|
||||
if (member_set_info->set_size == set_info->set_size &&
|
||||
memcmp(&member_set_info->set_sirk,
|
||||
&set_info->set_sirk,
|
||||
@ -197,7 +197,7 @@ static uint8_t sirk_notify_func(struct bt_conn *conn,
|
||||
uint8_t *dst_sirk;
|
||||
|
||||
client = &client_insts[bt_conn_index(conn)];
|
||||
dst_sirk = client->set_member->sets[csis_inst->cli.idx].info.set_sirk;
|
||||
dst_sirk = client->set_member->insts[csis_inst->cli.idx].info.set_sirk;
|
||||
|
||||
BT_DBG("Set SIRK %sencrypted",
|
||||
sirk->type == BT_CSIS_SIRK_TYPE_PLAIN
|
||||
@ -262,7 +262,7 @@ static uint8_t size_notify_func(struct bt_conn *conn,
|
||||
struct bt_csis_client_set_info *set_info;
|
||||
|
||||
client = &client_insts[bt_conn_index(conn)];
|
||||
set_info = &client->set_member->sets[csis_inst->cli.idx].info;
|
||||
set_info = &client->set_member->insts[csis_inst->cli.idx].info;
|
||||
|
||||
(void)memcpy(&set_size, data, length);
|
||||
BT_DBG("Set size updated from %u to %u",
|
||||
@ -319,12 +319,12 @@ static uint8_t lock_notify_func(struct bt_conn *conn,
|
||||
if (csis_client_cbs != NULL &&
|
||||
csis_client_cbs->lock_changed != NULL) {
|
||||
struct bt_csis_client_inst *client;
|
||||
struct bt_csis_client_set *set;
|
||||
struct bt_csis_client_csis_inst *inst;
|
||||
|
||||
client = &client_insts[bt_conn_index(conn)];
|
||||
set = &client->set_member->sets[csis_inst->cli.idx];
|
||||
inst = &client->set_member->insts[csis_inst->cli.idx];
|
||||
|
||||
csis_client_cbs->lock_changed(set, locked);
|
||||
csis_client_cbs->lock_changed(inst, locked);
|
||||
}
|
||||
} else {
|
||||
BT_DBG("Invalid length %u", length);
|
||||
@ -371,7 +371,7 @@ static int read_set_sirk(struct bt_csis *csis)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
read_params.func = csis_client_discover_sets_read_set_sirk_cb;
|
||||
read_params.func = csis_client_discover_insts_read_set_sirk_cb;
|
||||
read_params.handle_count = 1;
|
||||
read_params.single.handle = csis->cli.set_sirk_handle;
|
||||
read_params.single.offset = 0U;
|
||||
@ -630,7 +630,7 @@ bool bt_csis_client_is_set_member(uint8_t set_sirk[BT_CSIS_SET_SIRK_SIZE],
|
||||
return false;
|
||||
}
|
||||
|
||||
static uint8_t csis_client_discover_sets_read_rank_cb(struct bt_conn *conn,
|
||||
static uint8_t csis_client_discover_insts_read_rank_cb(struct bt_conn *conn,
|
||||
uint8_t err,
|
||||
struct bt_gatt_read_params *params,
|
||||
const void *data,
|
||||
@ -657,7 +657,7 @@ static uint8_t csis_client_discover_sets_read_rank_cb(struct bt_conn *conn,
|
||||
BT_DBG("Invalid length, continuing to next member");
|
||||
}
|
||||
|
||||
discover_sets_resume(conn, 0, 0, 0);
|
||||
discover_insts_resume(conn, 0, 0, 0);
|
||||
}
|
||||
|
||||
if (cb_err != 0) {
|
||||
@ -670,7 +670,7 @@ static uint8_t csis_client_discover_sets_read_rank_cb(struct bt_conn *conn,
|
||||
return BT_GATT_ITER_STOP;
|
||||
}
|
||||
|
||||
static uint8_t csis_client_discover_sets_read_set_size_cb(struct bt_conn *conn,
|
||||
static uint8_t csis_client_discover_insts_read_set_size_cb(struct bt_conn *conn,
|
||||
uint8_t err,
|
||||
struct bt_gatt_read_params *params,
|
||||
const void *data,
|
||||
@ -690,7 +690,7 @@ static uint8_t csis_client_discover_sets_read_set_size_cb(struct bt_conn *conn,
|
||||
|
||||
BT_HEXDUMP_DBG(data, length, "Data read");
|
||||
|
||||
set_info = &client->set_member->sets[cur_inst->cli.idx].info;
|
||||
set_info = &client->set_member->insts[cur_inst->cli.idx].info;
|
||||
|
||||
if (length == sizeof(set_info->set_size)) {
|
||||
(void)memcpy(&set_info->set_size, data, length);
|
||||
@ -699,7 +699,7 @@ static uint8_t csis_client_discover_sets_read_set_size_cb(struct bt_conn *conn,
|
||||
BT_DBG("Invalid length");
|
||||
}
|
||||
|
||||
discover_sets_resume(conn, 0, 0, cur_inst->cli.rank_handle);
|
||||
discover_insts_resume(conn, 0, 0, cur_inst->cli.rank_handle);
|
||||
}
|
||||
|
||||
if (cb_err != 0) {
|
||||
@ -717,7 +717,7 @@ static int parse_sirk(struct bt_csis_client_set_member *member,
|
||||
{
|
||||
uint8_t *set_sirk;
|
||||
|
||||
set_sirk = member->sets[cur_inst->cli.idx].info.set_sirk;
|
||||
set_sirk = member->insts[cur_inst->cli.idx].info.set_sirk;
|
||||
|
||||
if (length == sizeof(struct bt_csis_set_sirk)) {
|
||||
struct bt_csis_set_sirk *sirk =
|
||||
@ -760,7 +760,7 @@ static int parse_sirk(struct bt_csis_client_set_member *member,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint8_t csis_client_discover_sets_read_set_sirk_cb(struct bt_conn *conn,
|
||||
static uint8_t csis_client_discover_insts_read_set_sirk_cb(struct bt_conn *conn,
|
||||
uint8_t err,
|
||||
struct bt_gatt_read_params *params,
|
||||
const void *data,
|
||||
@ -783,7 +783,7 @@ static uint8_t csis_client_discover_sets_read_set_sirk_cb(struct bt_conn *conn,
|
||||
if (cb_err != 0) {
|
||||
BT_DBG("Could not parse SIRK: %d", cb_err);
|
||||
} else {
|
||||
discover_sets_resume(conn, 0,
|
||||
discover_insts_resume(conn, 0,
|
||||
cur_inst->cli.set_size_handle,
|
||||
cur_inst->cli.rank_handle);
|
||||
}
|
||||
@ -809,7 +809,7 @@ static uint8_t csis_client_discover_sets_read_set_sirk_cb(struct bt_conn *conn,
|
||||
* @param size_handle 0, or the handle for the size characteristic.
|
||||
* @param rank_handle 0, or the handle for the rank characteristic.
|
||||
*/
|
||||
static void discover_sets_resume(struct bt_conn *conn, uint16_t sirk_handle,
|
||||
static void discover_insts_resume(struct bt_conn *conn, uint16_t sirk_handle,
|
||||
uint16_t size_handle, uint16_t rank_handle)
|
||||
{
|
||||
int cb_err = 0;
|
||||
@ -818,14 +818,14 @@ static void discover_sets_resume(struct bt_conn *conn, uint16_t sirk_handle,
|
||||
if (size_handle != 0) {
|
||||
cb_err = csis_client_read_set_size(
|
||||
conn, cur_inst->cli.idx,
|
||||
csis_client_discover_sets_read_set_size_cb);
|
||||
csis_client_discover_insts_read_set_size_cb);
|
||||
if (cb_err != 0) {
|
||||
BT_DBG("Could not read set size: %d", cb_err);
|
||||
}
|
||||
} else if (rank_handle != 0) {
|
||||
cb_err = csis_client_read_rank(
|
||||
conn, cur_inst->cli.idx,
|
||||
csis_client_discover_sets_read_rank_cb);
|
||||
csis_client_discover_insts_read_rank_cb);
|
||||
if (cb_err != 0) {
|
||||
BT_DBG("Could not read set rank: %d", cb_err);
|
||||
}
|
||||
@ -1233,8 +1233,8 @@ int bt_csis_client_discover(struct bt_csis_client_set_member *member)
|
||||
|
||||
err = bt_gatt_discover(member->conn, &discover_params);
|
||||
if (err == 0) {
|
||||
for (size_t i = 0; i < ARRAY_SIZE(member->sets); i++) {
|
||||
member->sets[i].csis = &client->csis_insts[i];
|
||||
for (size_t i = 0; i < ARRAY_SIZE(member->insts); i++) {
|
||||
member->insts[i].csis = &client->csis_insts[i];
|
||||
}
|
||||
busy = true;
|
||||
}
|
||||
@ -1259,7 +1259,7 @@ int bt_csis_client_discover_sets(struct bt_csis_client_set_member *member)
|
||||
}
|
||||
|
||||
/* Start reading values and call CB when done */
|
||||
err = read_set_sirk(member->sets[0].csis);
|
||||
err = read_set_sirk(member->insts[0].csis);
|
||||
if (err == 0) {
|
||||
busy = true;
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
static uint8_t members_found;
|
||||
static struct k_work_delayable discover_members_timer;
|
||||
static struct bt_csis_client_set_member set_members[CONFIG_BT_MAX_CONN];
|
||||
struct bt_csis_client_set *cur_set;
|
||||
struct bt_csis_client_csis_inst *cur_inst;
|
||||
static bt_addr_le_t addr_found[CONFIG_BT_MAX_CONN];
|
||||
const struct bt_csis_client_set_member *locked_members[CONFIG_BT_MAX_CONN];
|
||||
|
||||
@ -111,10 +111,10 @@ static void csis_client_discover_sets_cb(struct bt_csis_client_set_member *membe
|
||||
}
|
||||
|
||||
for (uint8_t i = 0; i < set_count; i++) {
|
||||
struct bt_csis_client_set *set = &member->sets[i];
|
||||
struct bt_csis_client_csis_inst *inst = &member->insts[i];
|
||||
|
||||
shell_print(ctx_shell, "Set size %d (pointer: %p)",
|
||||
set[i].info.set_size, &set[i]);
|
||||
inst[i].info.set_size, &inst[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -141,17 +141,17 @@ static void csis_client_release_set_cb(int err)
|
||||
static void csis_client_lock_state_read_cb(const struct bt_csis_client_set_info *set_info,
|
||||
int err, bool locked)
|
||||
{
|
||||
struct bt_csis_client_set *set = CONTAINER_OF(set_info,
|
||||
struct bt_csis_client_set,
|
||||
info);
|
||||
struct bt_csis_client_csis_inst *inst = CONTAINER_OF(set_info,
|
||||
struct bt_csis_client_csis_inst,
|
||||
info);
|
||||
|
||||
if (err != 0) {
|
||||
shell_error(ctx_shell, "Device (set %p) lock get "
|
||||
"failed (%d)", set, err);
|
||||
shell_error(ctx_shell, "Device (inst %p) lock get "
|
||||
"failed (%d)", inst, err);
|
||||
}
|
||||
|
||||
shell_print(ctx_shell, "Device (set %p) lock value %d",
|
||||
set, locked);
|
||||
shell_print(ctx_shell, "Device (inst %p) lock value %d",
|
||||
inst, locked);
|
||||
}
|
||||
|
||||
static struct bt_csis_client_cb cbs = {
|
||||
@ -164,7 +164,7 @@ static struct bt_csis_client_cb cbs = {
|
||||
|
||||
static bool csis_found(struct bt_data *data, void *user_data)
|
||||
{
|
||||
if (bt_csis_client_is_set_member(cur_set->info.set_sirk, data)) {
|
||||
if (bt_csis_client_is_set_member(cur_inst->info.set_sirk, data)) {
|
||||
bt_addr_le_t *addr = user_data;
|
||||
char addr_str[BT_ADDR_LE_STR_LEN];
|
||||
|
||||
@ -181,9 +181,9 @@ static bool csis_found(struct bt_data *data, void *user_data)
|
||||
bt_addr_le_copy(&addr_found[members_found++], addr);
|
||||
|
||||
shell_print(ctx_shell, "Found member (%u / %u)",
|
||||
members_found, cur_set->info.set_size);
|
||||
members_found, cur_inst->info.set_size);
|
||||
|
||||
if (members_found == cur_set->info.set_size) {
|
||||
if (members_found == cur_inst->info.set_size) {
|
||||
int err;
|
||||
|
||||
(void)k_work_cancel_delayable(&discover_members_timer);
|
||||
@ -208,7 +208,7 @@ static void csis_client_scan_recv(const struct bt_le_scan_recv_info *info,
|
||||
{
|
||||
/* We're only interested in connectable events */
|
||||
if (info->adv_props & BT_GAP_ADV_PROP_CONNECTABLE) {
|
||||
if (cur_set != NULL) {
|
||||
if (cur_inst != NULL) {
|
||||
bt_data_parse(ad, csis_found, (void *)info->addr);
|
||||
}
|
||||
}
|
||||
@ -223,7 +223,7 @@ static void discover_members_timer_handler(struct k_work *work)
|
||||
int err;
|
||||
|
||||
shell_error(ctx_shell, "Could not find all members (%u / %u)",
|
||||
members_found, cur_set->info.set_size);
|
||||
members_found, cur_inst->info.set_size);
|
||||
|
||||
err = bt_le_scan_stop();
|
||||
if (err != 0) {
|
||||
@ -309,21 +309,21 @@ static int cmd_csis_client_discover_members(const struct shell *sh, size_t argc,
|
||||
{
|
||||
int err;
|
||||
|
||||
cur_set = (struct bt_csis_client_set *)strtol(argv[1], NULL, 0);
|
||||
cur_inst = (struct bt_csis_client_csis_inst *)strtol(argv[1], NULL, 0);
|
||||
|
||||
if (cur_set == NULL) {
|
||||
if (cur_inst == NULL) {
|
||||
shell_error(sh, "NULL set");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (cur_set->info.set_size > CONFIG_BT_MAX_CONN) {
|
||||
if (cur_inst->info.set_size > CONFIG_BT_MAX_CONN) {
|
||||
/*
|
||||
* TODO Handle case where set size is larger than
|
||||
* number of possible connections
|
||||
*/
|
||||
shell_error(sh,
|
||||
"Set size (%u) larger than max connections (%u)",
|
||||
cur_set->info.set_size, CONFIG_BT_MAX_CONN);
|
||||
cur_inst->info.set_size, CONFIG_BT_MAX_CONN);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@ -354,7 +354,7 @@ static int cmd_csis_client_lock_set(const struct shell *sh, size_t argc,
|
||||
int err;
|
||||
int conn_count = 0;
|
||||
|
||||
if (cur_set == NULL) {
|
||||
if (cur_inst == NULL) {
|
||||
shell_error(sh, "No set selected");
|
||||
return -ENOEXEC;
|
||||
}
|
||||
@ -365,7 +365,7 @@ static int cmd_csis_client_lock_set(const struct shell *sh, size_t argc,
|
||||
}
|
||||
}
|
||||
|
||||
err = bt_csis_client_lock(locked_members, conn_count, &cur_set->info);
|
||||
err = bt_csis_client_lock(locked_members, conn_count, &cur_inst->info);
|
||||
if (err != 0) {
|
||||
shell_error(sh, "Fail: %d", err);
|
||||
}
|
||||
@ -379,7 +379,7 @@ static int cmd_csis_client_release_set(const struct shell *sh, size_t argc,
|
||||
int err;
|
||||
int conn_count = 0;
|
||||
|
||||
if (cur_set == NULL) {
|
||||
if (cur_inst == NULL) {
|
||||
shell_error(sh, "No set selected");
|
||||
return -ENOEXEC;
|
||||
}
|
||||
@ -390,7 +390,7 @@ static int cmd_csis_client_release_set(const struct shell *sh, size_t argc,
|
||||
}
|
||||
}
|
||||
|
||||
err = bt_csis_client_release(locked_members, conn_count, &cur_set->info);
|
||||
err = bt_csis_client_release(locked_members, conn_count, &cur_inst->info);
|
||||
if (err != 0) {
|
||||
shell_error(sh, "Fail: %d", err);
|
||||
}
|
||||
@ -429,7 +429,7 @@ static int cmd_csis_client_lock_get(const struct shell *sh, size_t argc,
|
||||
|
||||
err = bt_csis_client_get_lock_state(lock_member,
|
||||
ARRAY_SIZE(lock_member),
|
||||
&cur_set->info);
|
||||
&cur_inst->info);
|
||||
if (err != 0) {
|
||||
shell_error(sh, "Fail: %d", err);
|
||||
}
|
||||
@ -444,7 +444,7 @@ static int cmd_csis_client_lock(const struct shell *sh, size_t argc,
|
||||
long member_index = 0;
|
||||
const struct bt_csis_client_set_member *lock_member[1];
|
||||
|
||||
if (cur_set == NULL) {
|
||||
if (cur_inst == NULL) {
|
||||
shell_error(sh, "No set selected");
|
||||
return -ENOEXEC;
|
||||
}
|
||||
@ -461,7 +461,7 @@ static int cmd_csis_client_lock(const struct shell *sh, size_t argc,
|
||||
|
||||
lock_member[0] = &set_members[member_index];
|
||||
|
||||
err = bt_csis_client_lock(lock_member, 1, &cur_set->info);
|
||||
err = bt_csis_client_lock(lock_member, 1, &cur_inst->info);
|
||||
if (err != 0) {
|
||||
shell_error(sh, "Fail: %d", err);
|
||||
}
|
||||
@ -476,7 +476,7 @@ static int cmd_csis_client_release(const struct shell *sh, size_t argc,
|
||||
long member_index = 0;
|
||||
const struct bt_csis_client_set_member *lock_member[1];
|
||||
|
||||
if (cur_set == NULL) {
|
||||
if (cur_inst == NULL) {
|
||||
shell_error(sh, "No set selected");
|
||||
return -ENOEXEC;
|
||||
}
|
||||
@ -493,7 +493,7 @@ static int cmd_csis_client_release(const struct shell *sh, size_t argc,
|
||||
|
||||
lock_member[0] = &set_members[member_index];
|
||||
|
||||
err = bt_csis_client_release(lock_member, 1, &cur_set->info);
|
||||
err = bt_csis_client_release(lock_member, 1, &cur_inst->info);
|
||||
if (err != 0) {
|
||||
shell_error(sh, "Fail: %d", err);
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@ static volatile bool set_locked;
|
||||
static volatile bool set_unlocked;
|
||||
static volatile bool set_read_locked;
|
||||
static volatile bool set_read_unlocked;
|
||||
static struct bt_csis_client_set *set;
|
||||
static struct bt_csis_client_csis_inst *inst;
|
||||
|
||||
static uint8_t members_found;
|
||||
static struct k_work_delayable discover_members_timer;
|
||||
@ -62,7 +62,7 @@ static void csis_client_discover_sets_cb(struct bt_csis_client_set_member *membe
|
||||
return;
|
||||
}
|
||||
|
||||
set = &member->sets[0];
|
||||
inst = &member->insts[0];
|
||||
sets_discovered = true;
|
||||
}
|
||||
|
||||
@ -79,10 +79,10 @@ static void csis_discover_cb(struct bt_csis_client_set_member *member, int err,
|
||||
discovered = true;
|
||||
}
|
||||
|
||||
static void csis_lock_changed_cb(struct bt_csis_client_set *set,
|
||||
static void csis_lock_changed_cb(struct bt_csis_client_csis_inst *inst,
|
||||
bool locked)
|
||||
{
|
||||
printk("Set %p %s\n", set, locked ? "locked" : "released");
|
||||
printk("Inst %p %s\n", inst, locked ? "locked" : "released");
|
||||
}
|
||||
|
||||
|
||||
@ -147,7 +147,7 @@ static bool is_discovered(const bt_addr_le_t *addr)
|
||||
|
||||
static bool csis_found(struct bt_data *data, void *user_data)
|
||||
{
|
||||
if (bt_csis_client_is_set_member(set->info.set_sirk, data)) {
|
||||
if (bt_csis_client_is_set_member(inst->info.set_sirk, data)) {
|
||||
const bt_addr_le_t *addr = user_data;
|
||||
char addr_str[BT_ADDR_LE_STR_LEN];
|
||||
|
||||
@ -163,7 +163,7 @@ static bool csis_found(struct bt_data *data, void *user_data)
|
||||
bt_addr_le_copy(&addr_found[members_found++], addr);
|
||||
|
||||
printk("Found member (%u / %u)\n",
|
||||
members_found, set->info.set_size);
|
||||
members_found, inst->info.set_size);
|
||||
|
||||
/* Stop parsing */
|
||||
return false;
|
||||
@ -177,7 +177,7 @@ static void csis_client_scan_recv(const struct bt_le_scan_recv_info *info,
|
||||
{
|
||||
/* We're only interested in connectable events */
|
||||
if (info->adv_props & BT_GAP_ADV_PROP_CONNECTABLE) {
|
||||
if (set == NULL) {
|
||||
if (inst == NULL) {
|
||||
/* Scanning for the first device */
|
||||
if (members_found == 0) {
|
||||
bt_addr_le_copy(&addr_found[members_found++],
|
||||
@ -196,7 +196,7 @@ static struct bt_le_scan_cb csis_client_scan_callbacks = {
|
||||
static void discover_members_timer_handler(struct k_work *work)
|
||||
{
|
||||
FAIL("Could not find all members (%u / %u)\n",
|
||||
members_found, set->info.set_size);
|
||||
members_found, inst->info.set_size);
|
||||
}
|
||||
|
||||
static void read_set_lock_state(const struct bt_csis_client_set_member **members,
|
||||
@ -213,7 +213,7 @@ static void read_set_lock_state(const struct bt_csis_client_set_member **members
|
||||
set_read_unlocked = false;
|
||||
}
|
||||
|
||||
err = bt_csis_client_get_lock_state(members, count, &set->info);
|
||||
err = bt_csis_client_get_lock_state(members, count, &inst->info);
|
||||
if (err != 0) {
|
||||
FAIL("Failed to do CSIS client read lock state (%d)", err);
|
||||
return;
|
||||
@ -306,7 +306,7 @@ static void test_main(void)
|
||||
return;
|
||||
}
|
||||
|
||||
WAIT_FOR(members_found == set->info.set_size);
|
||||
WAIT_FOR(members_found == inst->info.set_size);
|
||||
|
||||
(void)k_work_cancel_delayable(&discover_members_timer);
|
||||
err = bt_le_scan_stop();
|
||||
@ -363,7 +363,7 @@ static void test_main(void)
|
||||
|
||||
printk("Locking set\n");
|
||||
err = bt_csis_client_lock(locked_members, connected_member_count,
|
||||
&set->info);
|
||||
&inst->info);
|
||||
if (err != 0) {
|
||||
FAIL("Failed to do CSIS client lock (%d)", err);
|
||||
return;
|
||||
@ -377,7 +377,7 @@ static void test_main(void)
|
||||
|
||||
printk("Releasing set\n");
|
||||
err = bt_csis_client_release(locked_members, connected_member_count,
|
||||
&set->info);
|
||||
&inst->info);
|
||||
if (err != 0) {
|
||||
FAIL("Failed to do CSIS client release (%d)", err);
|
||||
return;
|
||||
@ -393,7 +393,7 @@ static void test_main(void)
|
||||
|
||||
printk("Locking set\n");
|
||||
err = bt_csis_client_lock(locked_members, connected_member_count,
|
||||
&set->info);
|
||||
&inst->info);
|
||||
if (err != 0) {
|
||||
FAIL("Failed to do CSIS client lock (%d)", err);
|
||||
return;
|
||||
@ -405,7 +405,7 @@ static void test_main(void)
|
||||
|
||||
printk("Releasing set\n");
|
||||
err = bt_csis_client_release(locked_members, connected_member_count,
|
||||
&set->info);
|
||||
&inst->info);
|
||||
if (err != 0) {
|
||||
FAIL("Failed to do CSIS client release (%d)", err);
|
||||
return;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user