How to use public-addr and non-resolvable-addr on nrf connect SDK

I want to use  public-addr and non-resolvable-addr for advertising on nrf connect SDK.

I was able to advertise using a random static addr.

But,
1. can not set public addr.
2. can not create non-resolvable-addr 's bt_id.

Following test code.

static bt_addr_le_t random_bdaddr = {
	.type = BT_ADDR_LE_RANDOM,
	.a = {
		.val = {0xC1, 0x11, 0x11, 0x11, 0x11, 0xC1},
	}
};

static struct bt_le_adv_param adv_param = {
	.id				= 0,
	.options		= BT_LE_ADV_OPT_USE_IDENTITY | BT_LE_ADV_OPT_EXT_ADV,
	.interval_min	= 0x20,
	.interval_max	= 0x20,
};

	bt_ctlr_set_public_addr(public_addr);
	(or sdc_hci_cmd_vs_zephyr_write_bd_addr(&public_addr);)

	bt_enable(NULL);

	int id0 = bt_id_create(&random_bdaddr, NULL);

	bt_addr_le_t nrpa_bdaddr;
	bt_addr_le_create_nrpa(&nrpa_bdaddr);
	int id1 = bt_id_create(&nrpa_bdaddr, NULL); /* this is ERROR!! */

	adv_param.id = 0; /* bt_id */
	bt_le_ext_adv_create(&adv_param, &adv_cb, &adv);
	bt_le_ext_adv_set_data(adv, bdata, 1, NULL, 0);
	bt_le_ext_adv_start(adv, &adv_start_param);

Parents
  • Hi,

    Different address types must be configured in different ways. To set a public address, the simplest is to do as illustrated here:

    static void set_public_addr(void)
    {
    	uint8_t pub_addr[BT_ADDR_SIZE] = {0xba, 0xde, 0xba, 0x11, 0xca, 0xfe};
    	bt_ctlr_set_public_addr(pub_addr);
    }

    Note that this must be done before you call bt_enable().

    I need to look a bit more into non resolvable private addresses though, as I did not get that to work. That is a very uncommon address type, though. May I ask why you want to use it?

  • I tried using bt_ctlr_set_public_addr but it didn't work. (see code above)
    Called before bt_enable().
    what am i doing wrong?

    I implement encrypted advertising transmission.
    I want to use NRPA to make it harder to track. (like bluetooth mesh does)

Reply Children
Related