Test: Bluetooth: controller: add CI testing for advertising chaining
Update babblesim tests for testing chaining for advertising to ensure that we spill over to the next PDU Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
This commit is contained in:
parent
e8716bf793
commit
e04c963d9c
3 changed files with 21 additions and 5 deletions
|
@ -47,11 +47,18 @@
|
|||
BT_AD_DATA_FORMAT_LEN_SIZE - \
|
||||
BT_AD_DATA_FORMAT_TYPE_SIZE - \
|
||||
BT_DEVICE_NAME_AD_DATA_LEN)))
|
||||
|
||||
/*
|
||||
* Datalength is an integer, so BT_MFG_DATA_LEN can not be larger than 255.
|
||||
* To ensure that we need to chain PDUs we therefore add manufacturer data
|
||||
* twice when chaining is enabled
|
||||
*/
|
||||
static uint8_t mfg_data[BT_MFG_DATA_LEN] = { 0xFF, 0xFF, };
|
||||
|
||||
static const struct bt_data ad[] = {
|
||||
BT_DATA(BT_DATA_MANUFACTURER_DATA, mfg_data, sizeof(mfg_data)),
|
||||
#if defined(CONFIG_BT_CTLR_ADV_DATA_CHAIN)
|
||||
BT_DATA(BT_DATA_MANUFACTURER_DATA, mfg_data, sizeof(mfg_data)),
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct bt_le_ext_adv *adv[CONFIG_BT_EXT_ADV_MAX_ADV_SET];
|
||||
|
@ -75,6 +82,7 @@ int broadcaster_multiple(void)
|
|||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
for (int index = 0; index < CONFIG_BT_EXT_ADV_MAX_ADV_SET; index++) {
|
||||
/* Use advertising set instance index as SID */
|
||||
adv_param.sid = index;
|
||||
|
|
|
@ -30,9 +30,9 @@ CONFIG_BT_EXT_SCAN_BUF_SIZE=1650
|
|||
# Set maximum scan data length for Extended Scanning in Bluetooth LE Controller
|
||||
CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX=1650
|
||||
|
||||
# Zephyr Controller does not combine all the 1650 bytes before fragmenting them
|
||||
# into 8 HCI reports, if a PDU has 255 bytes, it will generate 2 HCI reports
|
||||
# and so we need to reserve 16 buffers
|
||||
# The Zephyr Controller does not combine all the 1650 bytes before
|
||||
# fragmenting into 8 HCI reports, if a PDU has 255 bytes,
|
||||
# it will generate 2 HCI reports and so we need to reserve 16 buffers
|
||||
CONFIG_BT_BUF_EVT_RX_COUNT=16
|
||||
|
||||
# Increase Zephyr Bluetooth LE Controller Rx buffer to receive complete chain
|
||||
|
|
|
@ -34,8 +34,12 @@
|
|||
#define NAME_LEN 30
|
||||
#define BT_AD_DATA_NAME_SIZE (sizeof(CONFIG_BT_DEVICE_NAME) - 1U + 2U)
|
||||
#define BT_AD_DATA_MFG_DATA_SIZE (254U + 2U)
|
||||
/*
|
||||
* for testing chaining the manufacturing data is duplicated, hence DATA_LEN needs to
|
||||
* add twice the size for this element
|
||||
*/
|
||||
#define DATA_LEN MIN((BT_AD_DATA_NAME_SIZE + \
|
||||
BT_AD_DATA_MFG_DATA_SIZE), \
|
||||
BT_AD_DATA_MFG_DATA_SIZE + BT_AD_DATA_MFG_DATA_SIZE), \
|
||||
CONFIG_BT_CTLR_ADV_DATA_LEN_MAX)
|
||||
|
||||
static K_SEM_DEFINE(sem_recv, 0, 1);
|
||||
|
@ -94,6 +98,7 @@ static void scan_recv(const struct bt_le_scan_recv_info *info,
|
|||
|
||||
data_len = buf->len;
|
||||
if (data_len != DATA_LEN) {
|
||||
printk("Received datalength: %d\n", data_len);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -101,11 +106,13 @@ static void scan_recv(const struct bt_le_scan_recv_info *info,
|
|||
bt_data_parse(buf, data_cb, name);
|
||||
|
||||
if (strcmp(name, CONFIG_BT_DEVICE_NAME)) {
|
||||
printk("Wrong name %s\n", name);
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint8_t i = 0; i < sid_count; i++) {
|
||||
if (sid[i] == info->sid) {
|
||||
printk("Received SID %d\n", info->sid);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -113,6 +120,7 @@ static void scan_recv(const struct bt_le_scan_recv_info *info,
|
|||
sid[sid_count++] = info->sid;
|
||||
|
||||
if (sid_count < CONFIG_BT_EXT_ADV_MAX_ADV_SET) {
|
||||
printk("Received advertising sets: %d\n", sid_count);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue