Bluetooth: sample: Update iso_connected_benchmark to use new ISO API
Update the sample to use the new ISO API. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
23f3aa12ae
commit
76091850c5
2 changed files with 100 additions and 82 deletions
|
@ -47,7 +47,7 @@ static enum benchmark_role role;
|
||||||
static struct bt_conn *default_conn;
|
static struct bt_conn *default_conn;
|
||||||
static struct k_work_delayable iso_send_work;
|
static struct k_work_delayable iso_send_work;
|
||||||
static struct bt_iso_chan iso_chans[CONFIG_BT_ISO_MAX_CHAN];
|
static struct bt_iso_chan iso_chans[CONFIG_BT_ISO_MAX_CHAN];
|
||||||
static uint8_t cis_create_count = DEFAULT_CIS_COUNT;
|
static struct bt_iso_chan *cis[CONFIG_BT_ISO_MAX_CHAN];
|
||||||
static bool advertiser_found;
|
static bool advertiser_found;
|
||||||
static bt_addr_le_t adv_addr;
|
static bt_addr_le_t adv_addr;
|
||||||
static uint32_t last_received_counter;
|
static uint32_t last_received_counter;
|
||||||
|
@ -56,6 +56,7 @@ static struct iso_recv_stats stats_overall;
|
||||||
static int64_t iso_conn_start_time;
|
static int64_t iso_conn_start_time;
|
||||||
static size_t total_iso_conn_count;
|
static size_t total_iso_conn_count;
|
||||||
static uint32_t iso_send_count;
|
static uint32_t iso_send_count;
|
||||||
|
static struct bt_iso_cig *cig;
|
||||||
|
|
||||||
NET_BUF_POOL_FIXED_DEFINE(tx_pool, 1, CONFIG_BT_ISO_TX_MTU, NULL);
|
NET_BUF_POOL_FIXED_DEFINE(tx_pool, 1, CONFIG_BT_ISO_TX_MTU, NULL);
|
||||||
static uint8_t iso_data[CONFIG_BT_ISO_TX_MTU - BT_ISO_CHAN_SEND_RESERVE];
|
static uint8_t iso_data[CONFIG_BT_ISO_TX_MTU - BT_ISO_CHAN_SEND_RESERVE];
|
||||||
|
@ -68,27 +69,30 @@ static K_SEM_DEFINE(sem_connected, 0, 1);
|
||||||
static K_SEM_DEFINE(sem_disconnected, 0, 1);
|
static K_SEM_DEFINE(sem_disconnected, 0, 1);
|
||||||
|
|
||||||
static struct bt_iso_chan_io_qos iso_tx_qos = {
|
static struct bt_iso_chan_io_qos iso_tx_qos = {
|
||||||
.interval = DEFAULT_CIS_INTERVAL_US, /* in microseconds */
|
|
||||||
.latency = DEFAULT_CIS_LATENCY_MS, /* milliseconds */
|
|
||||||
.sdu = DEFAULT_CIS_SDU_SIZE, /* bytes */
|
.sdu = DEFAULT_CIS_SDU_SIZE, /* bytes */
|
||||||
.rtn = DEFAULT_CIS_RTN,
|
.rtn = DEFAULT_CIS_RTN,
|
||||||
.phy = DEFAULT_CIS_PHY,
|
.phy = DEFAULT_CIS_PHY,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct bt_iso_chan_io_qos iso_rx_qos = {
|
static struct bt_iso_chan_io_qos iso_rx_qos = {
|
||||||
.interval = DEFAULT_CIS_INTERVAL_US, /* in microseconds */
|
|
||||||
.latency = DEFAULT_CIS_LATENCY_MS, /* milliseconds */
|
|
||||||
.sdu = DEFAULT_CIS_SDU_SIZE, /* bytes */
|
.sdu = DEFAULT_CIS_SDU_SIZE, /* bytes */
|
||||||
.rtn = DEFAULT_CIS_RTN,
|
.rtn = DEFAULT_CIS_RTN,
|
||||||
.phy = DEFAULT_CIS_PHY,
|
.phy = DEFAULT_CIS_PHY,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct bt_iso_chan_qos iso_qos = {
|
static struct bt_iso_chan_qos iso_qos = {
|
||||||
|
.tx = &iso_tx_qos,
|
||||||
|
.rx = &iso_rx_qos,
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct bt_iso_cig_create_param cig_create_param = {
|
||||||
|
.interval = DEFAULT_CIS_INTERVAL_US, /* in microseconds */
|
||||||
|
.latency = DEFAULT_CIS_LATENCY_MS, /* milliseconds */
|
||||||
.sca = BT_GAP_SCA_UNKNOWN,
|
.sca = BT_GAP_SCA_UNKNOWN,
|
||||||
.packing = DEFAULT_CIS_PACKING,
|
.packing = DEFAULT_CIS_PACKING,
|
||||||
.framing = DEFAULT_CIS_FRAMING,
|
.framing = DEFAULT_CIS_FRAMING,
|
||||||
.tx = &iso_tx_qos,
|
.cis_channels = cis,
|
||||||
.rx = &iso_rx_qos,
|
.num_cis = DEFAULT_CIS_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
static enum benchmark_role device_role_select(void)
|
static enum benchmark_role device_role_select(void)
|
||||||
|
@ -146,9 +150,9 @@ static void iso_timer_timeout(struct k_work *work)
|
||||||
* calls `bt_iso_chan_send` but the controller only sending a single
|
* calls `bt_iso_chan_send` but the controller only sending a single
|
||||||
* ISO packet.
|
* ISO packet.
|
||||||
*/
|
*/
|
||||||
k_work_reschedule(&iso_send_work, K_USEC(iso_tx_qos.interval - 100));
|
k_work_reschedule(&iso_send_work, K_USEC(cig_create_param.interval - 100));
|
||||||
|
|
||||||
for (int i = 0; i < cis_create_count; i++) {
|
for (int i = 0; i < cig_create_param.num_cis; i++) {
|
||||||
buf = net_buf_alloc(&tx_pool, K_FOREVER);
|
buf = net_buf_alloc(&tx_pool, K_FOREVER);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
LOG_ERR("Could not allocate buffer");
|
LOG_ERR("Could not allocate buffer");
|
||||||
|
@ -276,7 +280,7 @@ static int iso_accept(struct bt_conn *conn, struct bt_iso_chan **chan)
|
||||||
if (iso_chans[i].state == BT_ISO_DISCONNECTED) {
|
if (iso_chans[i].state == BT_ISO_DISCONNECTED) {
|
||||||
LOG_INF("Returning instance %d", i);
|
LOG_INF("Returning instance %d", i);
|
||||||
*chan = &iso_chans[i];
|
*chan = &iso_chans[i];
|
||||||
cis_create_count++;
|
cig_create_param.num_cis++;
|
||||||
|
|
||||||
k_sem_give(&sem_iso_accept);
|
k_sem_give(&sem_iso_accept);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -458,14 +462,14 @@ static int parse_rtn_arg(struct bt_iso_chan_io_qos *qos)
|
||||||
return (int)rtn;
|
return (int)rtn;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int parse_interval_arg(struct bt_iso_chan_io_qos *qos)
|
static int parse_interval_arg(void)
|
||||||
{
|
{
|
||||||
char buffer[9];
|
char buffer[9];
|
||||||
size_t char_count;
|
size_t char_count;
|
||||||
uint64_t interval;
|
uint64_t interval;
|
||||||
|
|
||||||
printk("Set interval (us) (current %u, default %u)\n",
|
printk("Set interval (us) (current %u, default %u)\n",
|
||||||
qos->interval, DEFAULT_CIS_INTERVAL_US);
|
cig_create_param.interval, DEFAULT_CIS_INTERVAL_US);
|
||||||
|
|
||||||
char_count = get_chars(buffer, sizeof(buffer) - 1);
|
char_count = get_chars(buffer, sizeof(buffer) - 1);
|
||||||
if (char_count == 0) {
|
if (char_count == 0) {
|
||||||
|
@ -482,14 +486,14 @@ static int parse_interval_arg(struct bt_iso_chan_io_qos *qos)
|
||||||
return (int)interval;
|
return (int)interval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int parse_latency_arg(struct bt_iso_chan_io_qos *qos)
|
static int parse_latency_arg(void)
|
||||||
{
|
{
|
||||||
char buffer[6];
|
char buffer[6];
|
||||||
size_t char_count;
|
size_t char_count;
|
||||||
uint64_t latency;
|
uint64_t latency;
|
||||||
|
|
||||||
printk("Set latency (ms) (current %u, default %u)\n",
|
printk("Set latency (ms) (current %u, default %u)\n",
|
||||||
qos->latency, DEFAULT_CIS_LATENCY_MS);
|
cig_create_param.latency, DEFAULT_CIS_LATENCY_MS);
|
||||||
|
|
||||||
char_count = get_chars(buffer, sizeof(buffer) - 1);
|
char_count = get_chars(buffer, sizeof(buffer) - 1);
|
||||||
if (char_count == 0) {
|
if (char_count == 0) {
|
||||||
|
@ -563,7 +567,7 @@ static int parse_cis_count_arg(void)
|
||||||
uint64_t cis_count;
|
uint64_t cis_count;
|
||||||
|
|
||||||
printk("Set CIS count (current %u, default %u)\n",
|
printk("Set CIS count (current %u, default %u)\n",
|
||||||
cis_create_count, DEFAULT_CIS_COUNT);
|
cig_create_param.num_cis, DEFAULT_CIS_COUNT);
|
||||||
|
|
||||||
char_count = get_chars(buffer, sizeof(buffer) - 1);
|
char_count = get_chars(buffer, sizeof(buffer) - 1);
|
||||||
if (char_count == 0) {
|
if (char_count == 0) {
|
||||||
|
@ -579,11 +583,39 @@ static int parse_cis_count_arg(void)
|
||||||
return (int)cis_count;
|
return (int)cis_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int parse_args(struct bt_iso_chan_io_qos *qos)
|
static int parse_cig_args(void)
|
||||||
{
|
{
|
||||||
int rtn;
|
|
||||||
int interval;
|
int interval;
|
||||||
int latency;
|
int latency;
|
||||||
|
int cis_count;
|
||||||
|
|
||||||
|
printk("Follow the prompts. Press enter to use default values.\n");
|
||||||
|
|
||||||
|
cis_count = parse_cis_count_arg();
|
||||||
|
if (cis_count < 0) {
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
interval = parse_interval_arg();
|
||||||
|
if (interval < 0) {
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
latency = parse_latency_arg();
|
||||||
|
if (latency < 0) {
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
cig_create_param.interval = interval;
|
||||||
|
cig_create_param.latency = latency;
|
||||||
|
cig_create_param.num_cis = cis_count;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int parse_cis_args(struct bt_iso_chan_io_qos *qos)
|
||||||
|
{
|
||||||
|
int rtn;
|
||||||
int phy;
|
int phy;
|
||||||
int sdu;
|
int sdu;
|
||||||
|
|
||||||
|
@ -594,16 +626,6 @@ static int parse_args(struct bt_iso_chan_io_qos *qos)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
interval = parse_interval_arg(qos);
|
|
||||||
if (interval < 0) {
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
latency = parse_latency_arg(qos);
|
|
||||||
if (latency < 0) {
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
phy = parse_phy_arg(qos);
|
phy = parse_phy_arg(qos);
|
||||||
if (phy < 0) {
|
if (phy < 0) {
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -615,8 +637,6 @@ static int parse_args(struct bt_iso_chan_io_qos *qos)
|
||||||
}
|
}
|
||||||
|
|
||||||
qos->rtn = rtn;
|
qos->rtn = rtn;
|
||||||
qos->interval = interval;
|
|
||||||
qos->latency = latency;
|
|
||||||
qos->phy = phy;
|
qos->phy = phy;
|
||||||
qos->sdu = sdu;
|
qos->sdu = sdu;
|
||||||
|
|
||||||
|
@ -628,10 +648,26 @@ static int change_central_settings(void)
|
||||||
char c;
|
char c;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
printk("Change CIG settings (y/N)? (Current settings: cis_count=%u, "
|
||||||
|
"interval=%u, latency=%u)\n",
|
||||||
|
cig_create_param.num_cis, cig_create_param.interval,
|
||||||
|
cig_create_param.latency);
|
||||||
|
|
||||||
|
c = tolower(console_getchar());
|
||||||
|
if (c == 'y') {
|
||||||
|
err = parse_cig_args();
|
||||||
|
if (err != 0) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
printk("New settings: cis_count=%u, inteval=%u, latency=%u\n",
|
||||||
|
cig_create_param.num_cis, cig_create_param.interval,
|
||||||
|
cig_create_param.latency);
|
||||||
|
}
|
||||||
|
|
||||||
printk("Change TX settings (y/N)? (Current settings: rtn=%u, "
|
printk("Change TX settings (y/N)? (Current settings: rtn=%u, "
|
||||||
"interval=%u, latency=%u, phy=%u, sdu=%u)\n",
|
"phy=%u, sdu=%u)\n",
|
||||||
iso_tx_qos.rtn, iso_tx_qos.interval, iso_tx_qos.latency,
|
iso_tx_qos.rtn, iso_tx_qos.phy, iso_tx_qos.sdu);
|
||||||
iso_tx_qos.phy, iso_tx_qos.sdu);
|
|
||||||
|
|
||||||
c = tolower(console_getchar());
|
c = tolower(console_getchar());
|
||||||
if (c == 'y') {
|
if (c == 'y') {
|
||||||
|
@ -643,22 +679,19 @@ static int change_central_settings(void)
|
||||||
} else {
|
} else {
|
||||||
iso_qos.tx = &iso_tx_qos;
|
iso_qos.tx = &iso_tx_qos;
|
||||||
|
|
||||||
err = parse_args(&iso_tx_qos);
|
err = parse_cis_args(&iso_tx_qos);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
printk("New settings: rtn=%u, interval=%u, latency=%u, "
|
printk("New settings: rtn=%u, phy=%u, sdu=%u\n",
|
||||||
"phy=%u, sdu=%u\n",
|
iso_tx_qos.rtn, iso_tx_qos.phy, iso_tx_qos.sdu);
|
||||||
iso_tx_qos.rtn, iso_tx_qos.interval, iso_tx_qos.latency,
|
|
||||||
iso_tx_qos.phy, iso_tx_qos.sdu);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printk("Change RX settings (y/N)? (Current settings: rtn=%u, "
|
printk("Change RX settings (y/N)? (Current settings: rtn=%u, "
|
||||||
"interval=%u, latency=%u, phy=%u, sdu=%u)\n",
|
"phy=%u, sdu=%u)\n",
|
||||||
iso_rx_qos.rtn, iso_rx_qos.interval, iso_rx_qos.latency,
|
iso_rx_qos.rtn, iso_rx_qos.phy, iso_rx_qos.sdu);
|
||||||
iso_rx_qos.phy, iso_rx_qos.sdu);
|
|
||||||
|
|
||||||
c = tolower(console_getchar());
|
c = tolower(console_getchar());
|
||||||
if (c == 'y') {
|
if (c == 'y') {
|
||||||
|
@ -678,15 +711,13 @@ static int change_central_settings(void)
|
||||||
|
|
||||||
c = tolower(console_getchar());
|
c = tolower(console_getchar());
|
||||||
if (c == 'n') {
|
if (c == 'n') {
|
||||||
err = parse_args(&iso_rx_qos);
|
err = parse_cis_args(&iso_rx_qos);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
printk("New settings: rtn=%u, interval=%u, "
|
printk("New settings: rtn=%u, phy=%u, sdu=%u\n",
|
||||||
"latency=%u, phy=%u, sdu=%u\n",
|
iso_rx_qos.rtn, iso_rx_qos.phy,
|
||||||
iso_rx_qos.rtn, iso_rx_qos.interval,
|
|
||||||
iso_rx_qos.latency, iso_rx_qos.phy,
|
|
||||||
iso_rx_qos.sdu);
|
iso_rx_qos.sdu);
|
||||||
} else {
|
} else {
|
||||||
(void)memcpy(&iso_rx_qos, &iso_tx_qos,
|
(void)memcpy(&iso_rx_qos, &iso_tx_qos,
|
||||||
|
@ -695,20 +726,6 @@ static int change_central_settings(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printk("Change CIS count (y/N)? (Current: %u)\n", cis_create_count);
|
|
||||||
|
|
||||||
c = tolower(console_getchar());
|
|
||||||
if (c == 'y') {
|
|
||||||
int cis_count = parse_cis_count_arg();
|
|
||||||
|
|
||||||
if (cis_count < 0) {
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
cis_create_count = cis_count;
|
|
||||||
printk("New CIS count: %u\n", cis_create_count);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -755,36 +772,36 @@ static int central_create_connection(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int central_create_cis(void)
|
static int central_create_cig(void)
|
||||||
{
|
{
|
||||||
|
struct bt_iso_connect_param connect_param[CONFIG_BT_ISO_MAX_CHAN];
|
||||||
struct bt_conn *conn_pointers[CONFIG_BT_ISO_MAX_CHAN];
|
|
||||||
struct bt_iso_chan *chan_pointers[CONFIG_BT_ISO_MAX_CHAN];
|
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
iso_conn_start_time = 0;
|
iso_conn_start_time = 0;
|
||||||
|
|
||||||
for (int i = 0; i < cis_create_count; i++) {
|
LOG_INF("Creating CIG");
|
||||||
conn_pointers[i] = default_conn;
|
|
||||||
chan_pointers[i] = &iso_chans[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
LOG_INF("Binding ISO");
|
err = bt_iso_cig_create(&cig_create_param, &cig);
|
||||||
err = bt_iso_chan_bind(conn_pointers, cis_create_count, chan_pointers);
|
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
LOG_ERR("Failed to bind iso to connection: %d", err);
|
LOG_ERR("Failed to create CIG: %d", err);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INF("Connecting ISO channels");
|
LOG_INF("Connecting ISO channels");
|
||||||
err = bt_iso_chan_connect(chan_pointers, cis_create_count);
|
|
||||||
|
for (int i = 0; i < cig_create_param.num_cis; i++) {
|
||||||
|
connect_param[i].conn = default_conn;
|
||||||
|
connect_param[i].iso = &iso_chans[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
err = bt_iso_chan_connect(connect_param, cig_create_param.num_cis);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
LOG_ERR("Failed to connect iso: %d", err);
|
LOG_ERR("Failed to connect iso: %d", err);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
total_iso_conn_count++;
|
total_iso_conn_count++;
|
||||||
|
|
||||||
for (int i = 0; i < cis_create_count; i++) {
|
for (int i = 0; i < cig_create_param.num_cis; i++) {
|
||||||
err = k_sem_take(&sem_iso_connected, K_FOREVER);
|
err = k_sem_take(&sem_iso_connected, K_FOREVER);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
LOG_ERR("failed to take sem_iso_connected: %d", err);
|
LOG_ERR("failed to take sem_iso_connected: %d", err);
|
||||||
|
@ -813,7 +830,7 @@ static int cleanup(void)
|
||||||
|
|
||||||
err = k_sem_take(&sem_disconnected, K_NO_WAIT);
|
err = k_sem_take(&sem_disconnected, K_NO_WAIT);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
for (int i = 0; i < cis_create_count; i++) {
|
for (int i = 0; i < cig_create_param.num_cis; i++) {
|
||||||
err = k_sem_take(&sem_iso_disconnected, K_NO_WAIT);
|
err = k_sem_take(&sem_iso_disconnected, K_NO_WAIT);
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
err = bt_iso_chan_disconnect(&iso_chans[i]);
|
err = bt_iso_chan_disconnect(&iso_chans[i]);
|
||||||
|
@ -864,9 +881,9 @@ static int run_central(void)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = central_create_cis();
|
err = central_create_cig();
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
LOG_ERR("Failed to create CISes: %d", err);
|
LOG_ERR("Failed to create CIG or connect CISes: %d", err);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -881,7 +898,7 @@ static int run_central(void)
|
||||||
|
|
||||||
bt_conn_unref(default_conn);
|
bt_conn_unref(default_conn);
|
||||||
|
|
||||||
for (int i = 0; i < cis_create_count; i++) {
|
for (int i = 0; i < cig_create_param.num_cis; i++) {
|
||||||
err = k_sem_take(&sem_iso_disconnected, K_FOREVER);
|
err = k_sem_take(&sem_iso_disconnected, K_FOREVER);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
LOG_ERR("failed to take sem_iso_disconnected: %d", err);
|
LOG_ERR("failed to take sem_iso_disconnected: %d", err);
|
||||||
|
@ -901,7 +918,7 @@ static int run_peripheral(void)
|
||||||
static bool initialized;
|
static bool initialized;
|
||||||
|
|
||||||
/* Reset */
|
/* Reset */
|
||||||
cis_create_count = 0;
|
cig_create_param.num_cis = 0;
|
||||||
iso_conn_start_time = 0;
|
iso_conn_start_time = 0;
|
||||||
last_received_counter = 0;
|
last_received_counter = 0;
|
||||||
memset(&stats_current_conn, 0, sizeof(stats_current_conn));
|
memset(&stats_current_conn, 0, sizeof(stats_current_conn));
|
||||||
|
@ -944,7 +961,7 @@ static int run_peripheral(void)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < cis_create_count; i++) {
|
for (int i = 0; i < cig_create_param.num_cis; i++) {
|
||||||
err = k_sem_take(&sem_iso_connected, K_FOREVER);
|
err = k_sem_take(&sem_iso_connected, K_FOREVER);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
LOG_ERR("failed to take sem_iso_connected: %d", err);
|
LOG_ERR("failed to take sem_iso_connected: %d", err);
|
||||||
|
@ -965,7 +982,7 @@ static int run_peripheral(void)
|
||||||
|
|
||||||
bt_conn_unref(default_conn);
|
bt_conn_unref(default_conn);
|
||||||
|
|
||||||
for (int i = 0; i < cis_create_count; i++) {
|
for (int i = 0; i < cig_create_param.num_cis; i++) {
|
||||||
err = k_sem_take(&sem_iso_disconnected, K_FOREVER);
|
err = k_sem_take(&sem_iso_disconnected, K_FOREVER);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
LOG_ERR("failed to take sem_iso_disconnected: %d", err);
|
LOG_ERR("failed to take sem_iso_disconnected: %d", err);
|
||||||
|
@ -1005,6 +1022,7 @@ void main(void)
|
||||||
for (int i = 0; i < ARRAY_SIZE(iso_chans); i++) {
|
for (int i = 0; i < ARRAY_SIZE(iso_chans); i++) {
|
||||||
iso_chans->ops = &iso_ops;
|
iso_chans->ops = &iso_ops;
|
||||||
iso_chans->qos = &iso_qos;
|
iso_chans->qos = &iso_qos;
|
||||||
|
cis[i] = &iso_chans[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Init data */
|
/* Init data */
|
||||||
|
|
|
@ -1295,9 +1295,9 @@ static void le_ecred_reconf_req(struct bt_l2cap *l2cap, uint8_t ident,
|
||||||
goto response;
|
goto response;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (chan_count-- >= 0) {
|
for (int i = 0; i < chan_count; i++) {
|
||||||
BT_L2CAP_LE_CHAN(chans[chan_count])->tx.mtu = mtu;
|
BT_L2CAP_LE_CHAN(chans[i])->tx.mtu = mtu;
|
||||||
BT_L2CAP_LE_CHAN(chans[chan_count])->tx.mps = mps;
|
BT_L2CAP_LE_CHAN(chans[i])->tx.mps = mps;
|
||||||
}
|
}
|
||||||
|
|
||||||
BT_DBG("mtu %u mps %u", mtu, mps);
|
BT_DBG("mtu %u mps %u", mtu, mps);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue