Skip to content

Commit d07997c

Browse files
alexsvenkoffes
authored andcommitted
[nrf fromtree] tests: bluetooth: tester: CSIS: Add more commands
- Add command for setting the set size - Add command for setting the SIRK - Allows the following tests to pass: - CSIS/SR/CN/BV-01-C - CSIS/SR/CN/BV-02-C - CSIS/SR/CN/BV-03-C - CSIS/SR/CN/BV-04-C Signed-off-by: Alexander Svensen <alexander.svensen@nordicsemi.no> (cherry picked from commit 52f2686de67817f3ac5aa9ef16c89a0faf110d0b)
1 parent a3e38ca commit d07997c

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed

tests/bluetooth/tester/overlay-le-audio.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ CONFIG_BT_HAS_CLIENT=y
130130
# CSIS
131131
CONFIG_BT_CSIP_SET_MEMBER=y
132132
CONFIG_BT_CSIP_SET_MEMBER_ENC_SIRK_SUPPORT=y
133+
CONFIG_BT_CSIP_SET_MEMBER_SIRK_NOTIFIABLE=y
134+
CONFIG_BT_CSIP_SET_MEMBER_SIZE_NOTIFIABLE=y
133135

134136
# CSIP
135137
CONFIG_BT_CSIP_SET_COORDINATOR=y

tests/bluetooth/tester/src/audio/btp/btp_csis.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,14 @@ struct btp_csis_get_member_rsi_rp {
4141
struct btp_csis_sirk_set_type_cmd {
4242
uint8_t type;
4343
} __packed;
44+
45+
#define BTP_CSIS_SET_SIRK 0x05
46+
struct btp_csis_set_sirk_cmd {
47+
uint8_t sirk[BT_CSIP_SIRK_SIZE];
48+
} __packed;
49+
50+
#define BTP_CSIS_SET_SET_SIZE 0x06
51+
struct btp_csis_set_set_size_cmd {
52+
uint8_t set_size;
53+
uint8_t rank;
54+
} __packed;

tests/bluetooth/tester/src/audio/btp_csis.c

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,38 @@ static uint8_t csis_set_sirk_type(const void *cmd, uint16_t cmd_len, void *rsp,
9090
return BTP_STATUS_SUCCESS;
9191
}
9292

93+
static uint8_t csis_set_sirk(const void *cmd, uint16_t cmd_len, void *rsp, uint16_t *rsp_len)
94+
{
95+
const struct btp_csis_set_sirk_cmd *cp = cmd;
96+
int err = -ENOENT;
97+
98+
LOG_DBG("Setting new SIRK");
99+
100+
if (csis_svc_inst != NULL) {
101+
err = bt_csip_set_member_sirk(csis_svc_inst, cp->sirk);
102+
} else {
103+
LOG_DBG("No CSIS instance registered");
104+
}
105+
106+
return BTP_STATUS_VAL(err);
107+
}
108+
109+
static uint8_t csis_set_set_size(const void *cmd, uint16_t cmd_len, void *rsp, uint16_t *rsp_len)
110+
{
111+
const struct btp_csis_set_set_size_cmd *cp = cmd;
112+
int err = -ENOENT;
113+
114+
LOG_DBG("Setting new set size %u and rank %u", cp->set_size, cp->rank);
115+
116+
if (csis_svc_inst != NULL) {
117+
err = bt_csip_set_member_set_size_and_rank(csis_svc_inst, cp->set_size, cp->rank);
118+
} else {
119+
LOG_DBG("No CSIS instance registered");
120+
}
121+
122+
return BTP_STATUS_VAL(err);
123+
}
124+
93125
static const struct btp_handler csis_handlers[] = {
94126
{
95127
.opcode = BTP_CSIS_READ_SUPPORTED_COMMANDS,
@@ -112,6 +144,16 @@ static const struct btp_handler csis_handlers[] = {
112144
.expect_len = sizeof(struct btp_csis_sirk_set_type_cmd),
113145
.func = csis_set_sirk_type,
114146
},
147+
{
148+
.opcode = BTP_CSIS_SET_SIRK,
149+
.expect_len = sizeof(struct btp_csis_set_sirk_cmd),
150+
.func = csis_set_sirk,
151+
},
152+
{
153+
.opcode = BTP_CSIS_SET_SET_SIZE,
154+
.expect_len = sizeof(struct btp_csis_set_set_size_cmd),
155+
.func = csis_set_set_size,
156+
},
115157
};
116158

117159
static void lock_changed_cb(struct bt_conn *conn, struct bt_csip_set_member_svc_inst *svc_inst,

0 commit comments

Comments
 (0)