Bluetooth: Host: Update connection test to use bt_eatt_count
The test now uses the public bt_eatt_count function to wait until the expected number of EATT channels are connected. Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
This commit is contained in:
parent
101a9a7525
commit
e4b6407596
1 changed files with 8 additions and 16 deletions
|
@ -88,7 +88,6 @@ BT_CONN_CB_DEFINE(conn_callbacks) = {
|
||||||
static void test_peripheral_main(void)
|
static void test_peripheral_main(void)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
size_t num_enhanced;
|
|
||||||
|
|
||||||
err = bt_enable(NULL);
|
err = bt_enable(NULL);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -109,14 +108,13 @@ static void test_peripheral_main(void)
|
||||||
FAIL("Sending credit based connection request failed (err %d)\n", err);
|
FAIL("Sending credit based connection request failed (err %d)\n", err);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Use a flag set by a callback from EATT connection instead of sleeping */
|
while (bt_eatt_count(default_conn) < CONFIG_BT_EATT_MAX) {
|
||||||
/* Wait for EATT channels to be connected */
|
k_sleep(K_MSEC(10));
|
||||||
k_sleep(K_MSEC(10000));
|
|
||||||
num_enhanced = bt_eatt_count(default_conn);
|
|
||||||
printk("%d enhanced bearers connected\n", num_enhanced);
|
|
||||||
if (num_enhanced != CONFIG_BT_EATT_MAX) {
|
|
||||||
FAIL("Expected %d enhanced bearers, got %d\n", CONFIG_BT_EATT_MAX, num_enhanced);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Do not disconnect until the central also has connected all channels */
|
||||||
|
k_sleep(K_MSEC(1000));
|
||||||
|
|
||||||
/* Disconnect */
|
/* Disconnect */
|
||||||
err = bt_conn_disconnect(default_conn, BT_HCI_ERR_REMOTE_USER_TERM_CONN);
|
err = bt_conn_disconnect(default_conn, BT_HCI_ERR_REMOTE_USER_TERM_CONN);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -152,7 +150,6 @@ static void device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type,
|
||||||
static void test_central_main(void)
|
static void test_central_main(void)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
size_t num_enhanced;
|
|
||||||
|
|
||||||
err = bt_enable(NULL);
|
err = bt_enable(NULL);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -173,13 +170,8 @@ static void test_central_main(void)
|
||||||
FAIL("Sending credit based connection request failed (err %d)\n", err);
|
FAIL("Sending credit based connection request failed (err %d)\n", err);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Use a flag set by a callback from EATT connection instead of sleeping */
|
while (bt_eatt_count(default_conn) < CONFIG_BT_EATT_MAX) {
|
||||||
/* Wait for EATT channels to be connected */
|
k_sleep(K_MSEC(10));
|
||||||
k_sleep(K_MSEC(10000));
|
|
||||||
num_enhanced = bt_eatt_count(default_conn);
|
|
||||||
printk("%d enhanced bearers connected\n", num_enhanced);
|
|
||||||
if (num_enhanced != CONFIG_BT_EATT_MAX) {
|
|
||||||
FAIL("Expected %d enhanced bearers, got %d\n", CONFIG_BT_EATT_MAX, num_enhanced);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wait for disconnect */
|
/* Wait for disconnect */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue