Hi Sir,
Advertiser modified NCS 2.2.0 multiple_adv_sets on nRF52840-DK.
Set advertisement data and scan response data as below.
static const struct bt_data ad_sync[] = {
BT_DATA_BYTES(BT_DATA_FLAGS, BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR),
BT_DATA(BT_DATA_NAME_COMPLETE, "ADV_IND", (sizeof("ADV_IND") - 1))
};
static const struct bt_data sd_sync[] = {
BT_DATA_BYTES(BT_DATA_FLAGS, BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR),
BT_DATA(BT_DATA_NAME_COMPLETE, "SCAN_RSP", (sizeof("SCAN_RSP") - 1))
};
static struct bt_le_ext_adv *adv_ext;
static void adv_scanned_cb(struct bt_le_ext_adv *adv,
struct bt_le_ext_adv_scanned_info *info)
{
char addr[BT_ADDR_LE_STR_LEN];
bt_addr_le_to_str(info->addr, addr, sizeof(addr));
printk("scanned[%s]\n",addr);
}
static const struct bt_le_ext_adv_cb advmy_cb = {
.scanned = adv_scanned_cb
};
void main(void)
{
int err;
int blink_status = 0;
printk("Starting Bluetooth multiple advertising sets example\n");
err = dk_leds_init();
if (err) {
printk("LEDs init failed (err %d)\n", err);
return;
}
err = bt_enable(NULL);
if (err) {
printk("Bluetooth init failed (err %d)\n", err);
return;
}
printk("Bluetooth initialized\n");
err = bt_le_ext_adv_create(BT_LE_ADV_CONN, &advmy_cb, &adv_ext);
if (err) {
printk("Failed to create advertising set\n");
return ;
}
err = bt_le_ext_adv_set_data(adv_ext, ad_sync, ARRAY_SIZE(ad_sync), sd_sync, ARRAY_SIZE(sd_sync));
if (err) {
printk("Failed to start advertising set data. Err: %d\n", err);
return;
}
err = bt_le_ext_adv_start(adv_ext, BT_LE_EXT_ADV_START_DEFAULT);
if (err) {
printk("Failed to start advertising set. Err: %d\n", err);
return;
}
printk("Connectable advertising started\n");
for (;;) {
dk_set_led(RUN_STATUS_LED, (++blink_status) % 2);
k_sleep(K_MSEC(RUN_LED_BLINK_INTERVAL));
}
}
Scanner can receive ADV_IND and SCAN_RSP.
But advertiser doesn't trigger BT_HCI_EVT_LE_SCAN_REQ_RECEIVED event to application.
Please help us to fix it, thank you.
Scanner log is normal.
HL [00:00:02.435,607] [0m<inf> cis_headset: sync_scan_start: sync scanning successfully started[0m
HL [00:00:02.446,807] [0m<dbg> cis_headset: device_found: Device found 0 9 7 ADV_IND[0m
HL [00:00:02.447,509] [0m<dbg> cis_headset: device_found: Device found 4 9 8 SCAN_RSP[0m
HL [00:00:02.862,365] [0m<dbg> cis_headset: device_found: Device found 0 9 7 ADV_IND[0m
HL [00:00:02.863,067] [0m<dbg> cis_headset: device_found: Device found 4 9 8 SCAN_RSP[0m
HL [00:00:03.296,722] [0m<dbg> cis_headset: device_found: Device found 0 9 7 ADV_IND[0m
HL [00:00:03.297,424] [0m<dbg> cis_headset: device_found: Device found 4 9 8 SCAN_RSP[0m
HL [00:00:03.819,122] [0m<dbg> cis_headset: device_found: Device found 0 9 7 ADV_IND[0m
HL [00:00:03.819,824] [0m<dbg> cis_headset: device_found: Device found 4 9 8 SCAN_RSP[0m
HL [00:00:04.126,647] [0m<dbg> cis_headset: device_found: Device found 0 9 7 ADV_IND[0m
HL [00:00:04.127,349] [0m<dbg> cis_headset: device_found: Device found 4 9 8 SCAN_RSP[0m
HL [00:00:04.439,758] [0m<dbg> cis_headset: device_found: Device found 0 9 7 ADV_IND[0m
HL [00:00:04.440,460] [0m<dbg> cis_headset: device_found: Device found 4 9 8 SCAN_RSP[0m
HL [00:00:04.964,324] [0m<dbg> cis_headset: device_found: Device found 0 9 7 ADV_IND[0m
HL [00:00:04.965,057] [0m<dbg> cis_headset: device_found: Device found 4 9 8 SCAN_RSP[0m
HL [00:00:05.276,123] [0m<dbg> cis_headset: device_found: Device found 0 9 7 ADV_IND[0m
HL [00:00:05.276,824] [0m<dbg> cis_headset: device_found: Device found 4 9 8 SCAN_RSP[0m