Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

How to connect with direct advertising?

I am implementing a central device using the nRF Connect SDK. I want to connect to a peripheral device using direct advertising, but the central device does not seem to recognize the direct advertising. How can I connect to a device using direct advertising?

In the nRF SDK, when receiving direct advertising, there was an event called "White list report", but there is no corresponding callback in the nRF Connect SDK. The source code is as follows, and I have looked at various sample projects for central devices, but they all seem to be similar.

static void scan_init(void)
{
	int err;

	const struct bt_le_scan_param scan_param = {
		.interval = SCAN_INTERVAL,      // 100msec
		.interval_coded = 0,
		.options = BT_LE_SCAN_OPT_FILTER_ACCEPT_LIST | BT_LE_SCAN_OPT_FILTER_DUPLICATE,
		.timeout = 0,
		.type = BT_HCI_LE_SCAN_PASSIVE,
		.window = SCAN_WINDOW,          // 50msec
		.window_coded = 0,
	};

	struct bt_scan_init_param scan_init = {
		.connect_if_match = false,
		.conn_param = BT_LE_CONN_PARAM_DEFAULT,
		.scan_param = &scan_param,
	};

	bt_scan_init(&scan_init);
	bt_scan_cb_register(&scan_cb);

	err = bt_scan_filter_add(BT_SCAN_FILTER_TYPE_UUID, BT_UUID_BAS);
	if (err) {
		LOG_ERR("Scanning filters cannot be set (err %d)", err);
		return;
	}

	err = bt_scan_filter_enable(BT_SCAN_UUID_FILTER, false);
	if (err) {
		LOG_ERR("Filters cannot be turned on (err %d)", err);
	}
}

Parents Reply
  • Thank you for your information.

    I have read the web site and my understanding is you recommend using a filter accept list instead of directed advertising. right? I could not find any information on directed advertising above web site.

    Please let me know if you know any information for direct advertising. Or should I not use directed advertising in NCS perhaps?

    Best regards,

    Yoshihiro Goto

Children
Related