You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2015/12/22 21:17:41 UTC
incubator-mynewt-larva git commit: Add basic unit tests for adv. data.
Repository: incubator-mynewt-larva
Updated Branches:
refs/heads/master cc5b7b724 -> 961bcd69b
Add basic unit tests for adv. data.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/commit/961bcd69
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/tree/961bcd69
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/diff/961bcd69
Branch: refs/heads/master
Commit: 961bcd69b76319b1f8efaf71599d43ac4abcac47
Parents: cc5b7b7
Author: Christopher Collins <cc...@gmail.com>
Authored: Tue Dec 22 12:14:38 2015 -0800
Committer: Christopher Collins <cc...@gmail.com>
Committed: Tue Dec 22 12:17:12 2015 -0800
----------------------------------------------------------------------
net/nimble/host/include/host/ble_hs.h | 3 +
net/nimble/host/include/host/ble_hs_test.h | 3 +
net/nimble/host/src/ble_gap_conn.c | 28 ++-
net/nimble/host/src/ble_hs_adv.c | 2 +-
net/nimble/host/src/ble_hs_adv.h | 2 +
net/nimble/host/src/host_hci_cmd.c | 7 +-
net/nimble/host/src/test/ble_hs_adv_test.c | 229 +++++++++++++++++++++++
net/nimble/host/src/test/ble_hs_conn_test.c | 2 -
net/nimble/host/src/test/ble_hs_test.c | 10 +
net/nimble/host/src/test/ble_hs_test_util.c | 71 ++++---
net/nimble/host/src/test/ble_hs_test_util.h | 2 +
11 files changed, 315 insertions(+), 44 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/961bcd69/net/nimble/host/include/host/ble_hs.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/include/host/ble_hs.h b/net/nimble/host/include/host/ble_hs.h
index f18692a..5ffc01b 100644
--- a/net/nimble/host/include/host/ble_hs.h
+++ b/net/nimble/host/include/host/ble_hs.h
@@ -42,6 +42,9 @@ extern struct ble_hs_cfg ble_hs_cfg;
struct ble_hs_adv_fields {
uint8_t flags;
+ uint8_t tx_pwr_lvl;
+ unsigned tx_pwr_lvl_is_present:1;
+
uint8_t *name;
uint8_t name_len;
unsigned name_is_complete:1;
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/961bcd69/net/nimble/host/include/host/ble_hs_test.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/include/host/ble_hs_test.h b/net/nimble/host/include/host/ble_hs_test.h
index 8fbf063..bf145f3 100644
--- a/net/nimble/host/include/host/ble_hs_test.h
+++ b/net/nimble/host/include/host/ble_hs_test.h
@@ -17,9 +17,11 @@
#ifndef H_HOST_TEST_
#define H_HOST_TEST_
+#include <inttypes.h>
struct os_mbuf;
void ble_hs_test_pkt_txed(struct os_mbuf *om);
+void ble_hs_test_hci_txed(uint8_t *cmdbuf);
int l2cap_test_all(void);
int ble_att_svr_test_all(void);
@@ -33,5 +35,6 @@ int ble_gatt_disc_c_test_all(void);
int ble_gatt_read_test_all(void);
int ble_gatt_write_test_all(void);
int ble_gatt_conn_test_all(void);
+int ble_hs_adv_test_all(void);
#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/961bcd69/net/nimble/host/src/ble_gap_conn.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_gap_conn.c b/net/nimble/host/src/ble_gap_conn.c
index 2797949..4eba4b2 100644
--- a/net/nimble/host/src/ble_gap_conn.c
+++ b/net/nimble/host/src/ble_gap_conn.c
@@ -654,8 +654,8 @@ ble_gap_conn_adv_rsp_data_tx(void *arg)
static int
ble_gap_conn_adv_data_tx(void *arg)
{
+ uint8_t adv_data_len;
uint8_t flags;
- int adv_data_len;
int rc;
/* Calculate the value of the flags field from the discoverable mode. */
@@ -678,26 +678,20 @@ ble_gap_conn_adv_data_tx(void *arg)
}
/* Encode the flags AD field if it is nonzero. */
+ adv_data_len = ble_gap_conn_adv_data_len;
if (flags != 0) {
- adv_data_len = ble_gap_conn_adv_data_len + 3;
- assert(adv_data_len <= BLE_HCI_MAX_ADV_DATA_LEN);
-
- ble_gap_conn_adv_data[ble_gap_conn_adv_data_len] = 2;
- ble_gap_conn_adv_data[ble_gap_conn_adv_data_len + 1] =
- BLE_HS_ADV_TYPE_FLAGS;
- ble_gap_conn_adv_data[ble_gap_conn_adv_data_len + 2] = flags;
- } else {
- adv_data_len = ble_gap_conn_adv_data_len;
+ rc = ble_hs_adv_set_one_field(BLE_HS_ADV_TYPE_FLAGS, 1,
+ &flags, ble_gap_conn_adv_data,
+ &adv_data_len, BLE_HCI_MAX_ADV_DATA_LEN);
+ assert(rc == 0);
}
/* Encode the transmit power AD field. */
- adv_data_len = ble_gap_conn_adv_data_len + 3;
- assert(adv_data_len <= BLE_HCI_MAX_ADV_DATA_LEN);
- ble_gap_conn_adv_data[ble_gap_conn_adv_data_len] = 2;
- ble_gap_conn_adv_data[ble_gap_conn_adv_data_len + 1] =
- BLE_HS_ADV_TYPE_TX_PWR_LEVEL;
- ble_gap_conn_adv_data[ble_gap_conn_adv_data_len + 2] =
- ble_gap_conn_tx_pwr_lvl;
+ rc = ble_hs_adv_set_one_field(BLE_HS_ADV_TYPE_TX_PWR_LEVEL, 1,
+ &ble_gap_conn_tx_pwr_lvl,
+ ble_gap_conn_adv_data,
+ &adv_data_len, BLE_HCI_MAX_ADV_DATA_LEN);
+ assert(rc == 0);
ble_hci_ack_set_callback(ble_gap_conn_adv_ack, NULL);
rc = host_hci_cmd_le_set_adv_data(ble_gap_conn_adv_data, adv_data_len);
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/961bcd69/net/nimble/host/src/ble_hs_adv.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hs_adv.c b/net/nimble/host/src/ble_hs_adv.c
index d25d354..0be75ea 100644
--- a/net/nimble/host/src/ble_hs_adv.c
+++ b/net/nimble/host/src/ble_hs_adv.c
@@ -20,7 +20,7 @@
#include "ble_hs_adv.h"
#include "ble_hs_priv.h"
-static int
+int
ble_hs_adv_set_one_field(uint8_t type, uint8_t data_len, void *data,
uint8_t *dst, uint8_t *dst_len, uint8_t max_len)
{
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/961bcd69/net/nimble/host/src/ble_hs_adv.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hs_adv.h b/net/nimble/host/src/ble_hs_adv.h
index 3cb5231..c9df5b1 100644
--- a/net/nimble/host/src/ble_hs_adv.h
+++ b/net/nimble/host/src/ble_hs_adv.h
@@ -45,6 +45,8 @@ struct ble_hs_adv {
#define BLE_HS_ADV_F_DISC_LTD 0x01
#define BLE_HS_ADV_F_DISC_GEN 0x02
+int ble_hs_adv_set_one_field(uint8_t type, uint8_t data_len, void *data,
+ uint8_t *dst, uint8_t *dst_len, uint8_t max_len);
int ble_hs_adv_set_fields(struct ble_hs_adv_fields *adv_fields,
uint8_t *dst, uint8_t *dst_len, uint8_t max_len);
int ble_hs_adv_parse_fields(struct ble_hs_adv_fields *adv_fields, uint8_t *src,
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/961bcd69/net/nimble/host/src/host_hci_cmd.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/host_hci_cmd.c b/net/nimble/host/src/host_hci_cmd.c
index 530b9f9..e5d5e10 100644
--- a/net/nimble/host/src/host_hci_cmd.c
+++ b/net/nimble/host/src/host_hci_cmd.c
@@ -27,12 +27,15 @@
#include "ble_hci_ack.h"
#include "ble_hs_conn.h"
#include "ble_l2cap.h"
+#ifdef PHONY_TRANSPORT
+#include "host/ble_hs_test.h"
+#endif
static int
host_hci_cmd_transport(uint8_t *cmdbuf)
{
-#ifdef ARCH_sim
- os_memblock_put(&g_hci_cmd_pool, cmdbuf);
+#ifdef PHONY_TRANSPORT
+ ble_hs_test_hci_txed(cmdbuf);
return 0;
#else
return ble_hci_transport_host_cmd_send(cmdbuf);
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/961bcd69/net/nimble/host/src/test/ble_hs_adv_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_hs_adv_test.c b/net/nimble/host/src/test/ble_hs_adv_test.c
new file mode 100644
index 0000000..81f1c15
--- /dev/null
+++ b/net/nimble/host/src/test/ble_hs_adv_test.c
@@ -0,0 +1,229 @@
+/**
+ * Copyright (c) 2015 Runtime Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stddef.h>
+#include <errno.h>
+#include <string.h>
+#include "nimble/hci_common.h"
+#include "ble_hs_priv.h"
+#include "host/ble_hs_test.h"
+#include "host/host_hci.h"
+#include "ble_l2cap.h"
+#include "ble_att_priv.h"
+#include "ble_hs_conn.h"
+#include "ble_hs_adv.h"
+#include "ble_hci_ack.h"
+#include "ble_hci_sched.h"
+#include "ble_gap_conn.h"
+#include "ble_hs_test_util.h"
+#include "testutil/testutil.h"
+
+#define BLE_ADV_TEST_DATA_OFF 4
+
+static void
+ble_hs_adv_test_misc_verify_tx_adv_data_hdr(int data_len)
+{
+ uint16_t opcode;
+ uint8_t *sptr;
+
+ TEST_ASSERT(ble_hs_test_util_prev_hci_tx != NULL);
+
+ sptr = ble_hs_test_util_prev_hci_tx;
+
+ opcode = le16toh(sptr + 0);
+ TEST_ASSERT(BLE_HCI_OGF(opcode) == BLE_HCI_OGF_LE);
+ TEST_ASSERT(BLE_HCI_OCF(opcode) == BLE_HCI_OCF_LE_SET_ADV_DATA);
+
+ TEST_ASSERT(sptr[2] == data_len + 1);
+ TEST_ASSERT(sptr[3] == data_len);
+}
+
+static void
+ble_hs_adv_test_misc_verify_tx_field(int off, uint8_t type, uint8_t val_len,
+ void *val)
+{
+ uint8_t *sptr;
+
+ TEST_ASSERT_FATAL(ble_hs_test_util_prev_hci_tx != NULL);
+
+ sptr = ble_hs_test_util_prev_hci_tx + off;
+
+ TEST_ASSERT(sptr[0] == val_len + 1);
+ TEST_ASSERT(sptr[1] == type);
+ TEST_ASSERT(memcmp(sptr + 2, val, val_len) == 0);
+}
+
+struct ble_hs_adv_test_field {
+ uint8_t type; /* 0 indicates end of array. */
+ uint8_t *val;
+ uint8_t val_len;
+};
+
+static int
+ble_hs_adv_test_misc_calc_data_len(struct ble_hs_adv_test_field *fields)
+{
+ struct ble_hs_adv_test_field *field;
+ int len;
+
+ len = 0;
+ for (field = fields; field->type != 0; field++) {
+ len += 2 + field->val_len;
+ }
+
+ return len;
+}
+
+static void
+ble_hs_adv_test_misc_verify_tx_fields(int off,
+ struct ble_hs_adv_test_field *fields)
+{
+ struct ble_hs_adv_test_field *field;
+
+ for (field = fields; field->type != 0; field++) {
+ ble_hs_adv_test_misc_verify_tx_field(off, field->type, field->val_len,
+ field->val);
+ off += 2 + field->val_len;
+ }
+}
+
+static void
+ble_hs_adv_test_misc_verify_tx_data(struct ble_hs_adv_test_field *fields)
+{
+ int data_len;
+
+ data_len = ble_hs_adv_test_misc_calc_data_len(fields);
+ ble_hs_adv_test_misc_verify_tx_adv_data_hdr(data_len);
+ ble_hs_adv_test_misc_verify_tx_fields(BLE_ADV_TEST_DATA_OFF, fields);
+}
+
+static void
+ble_hs_adv_test_misc_tx_and_verify_data(uint8_t disc_mode,
+ struct ble_hs_adv_test_field *fields)
+{
+ int rc;
+
+ ble_hs_test_util_init();
+
+ rc = ble_gap_conn_advertise(disc_mode, BLE_GAP_CONN_MODE_UND, NULL, 0);
+ TEST_ASSERT_FATAL(rc == 0);
+
+ ble_hs_test_util_rx_und_adv_acks_count(3);
+ ble_hs_adv_test_misc_verify_tx_data(fields);
+}
+
+TEST_CASE(ble_hs_adv_test_case_flags)
+{
+ /* No flags. */
+ ble_hs_adv_test_misc_tx_and_verify_data(BLE_GAP_DISC_MODE_NON,
+ (struct ble_hs_adv_test_field[]) {
+ {
+ .type = BLE_HS_ADV_TYPE_TX_PWR_LEVEL,
+ .val = (uint8_t[]){ 0x00 },
+ .val_len = 1,
+ },
+ { 0 },
+ });
+
+ /* Flags = limited discoverable. */
+ ble_hs_adv_test_misc_tx_and_verify_data(BLE_GAP_DISC_MODE_LTD,
+ (struct ble_hs_adv_test_field[]) {
+ {
+ .type = BLE_HS_ADV_TYPE_FLAGS,
+ .val = (uint8_t[]){ BLE_HS_ADV_F_DISC_LTD },
+ .val_len = 1,
+ }, {
+ .type = BLE_HS_ADV_TYPE_TX_PWR_LEVEL,
+ .val = (uint8_t[]){ 0x00 },
+ .val_len = 1,
+ },
+ { 0 },
+ });
+
+ /* Flags = general discoverable. */
+ ble_hs_adv_test_misc_tx_and_verify_data(BLE_GAP_DISC_MODE_GEN,
+ (struct ble_hs_adv_test_field[]) {
+ {
+ .type = BLE_HS_ADV_TYPE_FLAGS,
+ .val = (uint8_t[]){ BLE_HS_ADV_F_DISC_GEN },
+ .val_len = 1,
+ }, {
+ .type = BLE_HS_ADV_TYPE_TX_PWR_LEVEL,
+ .val = (uint8_t[]){ 0x00 },
+ .val_len = 1,
+ },
+ { 0 },
+ });
+}
+
+TEST_CASE(ble_hs_adv_test_case_user)
+{
+ struct ble_hs_adv_fields fields;
+
+ /*** Complete name. */
+ fields.name = (uint8_t *)"myname";
+ fields.name_len = 6;
+ fields.name_is_complete = 1;
+ ble_gap_conn_set_adv_fields(&fields);
+
+ ble_hs_adv_test_misc_tx_and_verify_data(BLE_GAP_DISC_MODE_NON,
+ (struct ble_hs_adv_test_field[]) {
+ {
+ .type = BLE_HS_ADV_TYPE_COMP_NAME,
+ .val = (uint8_t*)"myname",
+ .val_len = 6,
+ },
+ {
+ .type = BLE_HS_ADV_TYPE_TX_PWR_LEVEL,
+ .val = (uint8_t[]){ 0x00 },
+ .val_len = 1,
+ },
+ { 0 },
+ });
+
+ /*** Incomplete name. */
+ fields.name_is_complete = 0;
+ ble_gap_conn_set_adv_fields(&fields);
+
+ ble_hs_adv_test_misc_tx_and_verify_data(BLE_GAP_DISC_MODE_NON,
+ (struct ble_hs_adv_test_field[]) {
+ {
+ .type = BLE_HS_ADV_TYPE_INCOMP_NAME,
+ .val = (uint8_t*)"myname",
+ .val_len = 6,
+ },
+ {
+ .type = BLE_HS_ADV_TYPE_TX_PWR_LEVEL,
+ .val = (uint8_t[]){ 0x00 },
+ .val_len = 1,
+ },
+ { 0 },
+ });
+}
+
+TEST_SUITE(ble_hs_adv_test_suite)
+{
+ ble_hs_adv_test_case_flags();
+ ble_hs_adv_test_case_user();
+}
+
+int
+ble_hs_adv_test_all(void)
+{
+ ble_hs_adv_test_suite();
+
+ return tu_any_failed;
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/961bcd69/net/nimble/host/src/test/ble_hs_conn_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_hs_conn_test.c b/net/nimble/host/src/test/ble_hs_conn_test.c
index ba05b7d..a84e683 100644
--- a/net/nimble/host/src/test/ble_hs_conn_test.c
+++ b/net/nimble/host/src/test/ble_hs_conn_test.c
@@ -236,8 +236,6 @@ TEST_CASE(ble_hs_conn_test_undirect_connectable_success)
NULL, 0);
TEST_ASSERT(rc == 0);
- ble_hci_sched_wakeup();
-
TEST_ASSERT(!ble_gap_conn_master_in_progress());
TEST_ASSERT(ble_gap_conn_slave_in_progress());
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/961bcd69/net/nimble/host/src/test/ble_hs_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_hs_test.c b/net/nimble/host/src/test/ble_hs_test.c
index caf8120..b407e05 100644
--- a/net/nimble/host/src/test/ble_hs_test.c
+++ b/net/nimble/host/src/test/ble_hs_test.c
@@ -32,6 +32,15 @@ ble_hs_test_pkt_txed(struct os_mbuf *om)
os_mbuf_adj(om, BLE_HCI_DATA_HDR_SZ + BLE_L2CAP_HDR_SZ);
}
+void
+ble_hs_test_hci_txed(uint8_t *cmdbuf)
+{
+ if (ble_hs_test_util_prev_hci_tx != NULL) {
+ os_memblock_put(&g_hci_cmd_pool, ble_hs_test_util_prev_hci_tx);
+ }
+ ble_hs_test_util_prev_hci_tx = cmdbuf;
+}
+
#ifdef PKG_TEST
int
@@ -52,6 +61,7 @@ main(void)
ble_gatt_read_test_all();
ble_gatt_write_test_all();
ble_gatt_conn_test_all();
+ ble_hs_adv_test_all();
return tu_any_failed;
}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/961bcd69/net/nimble/host/src/test/ble_hs_test_util.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_hs_test_util.c b/net/nimble/host/src/test/ble_hs_test_util.c
index b496677..a605206 100644
--- a/net/nimble/host/src/test/ble_hs_test_util.c
+++ b/net/nimble/host/src/test/ble_hs_test_util.c
@@ -31,6 +31,7 @@
#include "ble_hs_test_util.h"
struct os_mbuf *ble_hs_test_util_prev_tx;
+uint8_t *ble_hs_test_util_prev_hci_tx;
void
ble_hs_test_util_build_cmd_complete(uint8_t *dst, int len,
@@ -255,37 +256,62 @@ ble_hs_test_util_rx_num_completed_pkts_event(
}
void
-ble_hs_test_util_rx_und_adv_acks(void)
+ble_hs_test_util_rx_und_adv_acks_count(int count)
{
- /* Receive set-adv-params ack. */
- ble_hs_test_util_rx_le_ack(BLE_HCI_OCF_LE_SET_ADV_PARAMS, BLE_ERR_SUCCESS);
- TEST_ASSERT(ble_gap_conn_slave_in_progress());
+ if (count > 0) {
+ /* Receive set-adv-params ack. */
+ ble_hci_sched_wakeup();
+ ble_hs_test_util_rx_le_ack(BLE_HCI_OCF_LE_SET_ADV_PARAMS,
+ BLE_ERR_SUCCESS);
+ TEST_ASSERT(ble_gap_conn_slave_in_progress());
+
+ count--;
+ }
- ble_hci_sched_wakeup();
+ if (count > 0) {
+ /* Receive read-power-level ack. */
+ ble_hci_sched_wakeup();
+ ble_hs_test_util_rx_le_ack_param(BLE_HCI_OCF_LE_RD_ADV_CHAN_TXPWR,
+ BLE_ERR_SUCCESS, (uint8_t[]){0}, 1);
+ TEST_ASSERT(ble_gap_conn_slave_in_progress());
- /* Receive read-power-level ack. */
- ble_hs_test_util_rx_le_ack_param(BLE_HCI_OCF_LE_RD_ADV_CHAN_TXPWR,
- BLE_ERR_SUCCESS, (uint8_t[]){0}, 1);
- TEST_ASSERT(ble_gap_conn_slave_in_progress());
+ count--;
+ }
- ble_hci_sched_wakeup();
+ if (count > 0) {
+ /* Receive set-adv-data ack. */
+ ble_hci_sched_wakeup();
+ ble_hs_test_util_rx_le_ack(BLE_HCI_OCF_LE_SET_ADV_DATA,
+ BLE_ERR_SUCCESS);
+ TEST_ASSERT(ble_gap_conn_slave_in_progress());
- /* Receive set-adv-data ack. */
- ble_hs_test_util_rx_le_ack(BLE_HCI_OCF_LE_SET_ADV_DATA, BLE_ERR_SUCCESS);
- TEST_ASSERT(ble_gap_conn_slave_in_progress());
+ count--;
+ }
- ble_hci_sched_wakeup();
+ if (count > 0) {
+ /* Receive set-scan-response-data ack. */
+ ble_hci_sched_wakeup();
+ ble_hs_test_util_rx_le_ack(BLE_HCI_OCF_LE_SET_SCAN_RSP_DATA,
+ BLE_ERR_SUCCESS);
+ TEST_ASSERT(ble_gap_conn_slave_in_progress());
- /* Receive set-scan-response-data ack. */
- ble_hs_test_util_rx_le_ack(BLE_HCI_OCF_LE_SET_SCAN_RSP_DATA,
- BLE_ERR_SUCCESS);
- TEST_ASSERT(ble_gap_conn_slave_in_progress());
+ count--;
+ }
- ble_hci_sched_wakeup();
+ if (count > 0) {
+ /* Receive set-adv-enable ack. */
+ ble_hci_sched_wakeup();
+ ble_hs_test_util_rx_le_ack(BLE_HCI_OCF_LE_SET_ADV_ENABLE,
+ BLE_ERR_SUCCESS);
+ TEST_ASSERT(ble_gap_conn_slave_in_progress());
+ count--;
+ }
+}
- /* Receive set-adv-enable ack. */
- ble_hs_test_util_rx_le_ack(BLE_HCI_OCF_LE_SET_ADV_ENABLE, BLE_ERR_SUCCESS);
- TEST_ASSERT(ble_gap_conn_slave_in_progress());
+void
+ble_hs_test_util_rx_und_adv_acks(void)
+{
+ ble_hs_test_util_rx_und_adv_acks_count(5);
}
void
@@ -314,4 +340,5 @@ ble_hs_test_util_init(void)
ble_hs_cfg.max_outstanding_pkts_per_conn = 0;
ble_hs_test_util_prev_tx = NULL;
+ ble_hs_test_util_prev_hci_tx = NULL;
}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/961bcd69/net/nimble/host/src/test/ble_hs_test_util.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_hs_test_util.h b/net/nimble/host/src/test/ble_hs_test_util.h
index e61e4eb..0df60dc 100644
--- a/net/nimble/host/src/test/ble_hs_test_util.h
+++ b/net/nimble/host/src/test/ble_hs_test_util.h
@@ -22,6 +22,7 @@ struct ble_hs_conn;
struct ble_l2cap_chan;
extern struct os_mbuf *ble_hs_test_util_prev_tx;
+extern uint8_t *ble_hs_test_util_prev_hci_tx;
struct ble_hs_test_util_num_completed_pkts_entry {
uint16_t handle_id; /* 0 for terminating entry in array. */
@@ -52,6 +53,7 @@ void ble_hs_test_util_rx_startup_acks(void);
void ble_hs_test_util_rx_num_completed_pkts_event(
struct ble_hs_test_util_num_completed_pkts_entry *entries);
void ble_hs_test_util_rx_und_adv_acks(void);
+void ble_hs_test_util_rx_und_adv_acks_count(int count);
void ble_hs_test_util_rx_dir_adv_acks(void);
void ble_hs_test_util_init(void);