I am using the nrf connect SDK.
I want to switch multiple BDADDRs in one AdvertiseSet.
BDADDR does not change even if bt_le_adv_param.id is changed in bt_le_ext_adv_update_param().
Is there any way?
I am using the nrf connect SDK.
I want to switch multiple BDADDRs in one AdvertiseSet.
BDADDR does not change even if bt_le_adv_param.id is changed in bt_le_ext_adv_update_param().
Is there any way?
Can you elaborate what you are trying to do here? If you enable private resolveable address you can configure how frequently the address is updated by this kconfig option (you may need to update to ncs v2.2 for this to work):
https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/kconfig/index.html#CONFIG_BT_RPA_TIMEOUT
Kenneth
Core spec v5.1
LE Set Advertising Set Random Address command
want to do the same thing.
It seems that this command can be called even during Advertising.
(It seems that the setting will be reflected at the next enable.)
what should i do?
---------------------------------------------------------------------------------------------
I checked the source code.
zephyr/subsys/bluetooth/host/adv.c
int bt_le_ext_adv_update_param()
...
le_ext_adv_param_set()
...
////////////////////////////////////
It looks like are setting BDADDR
////////////////////////////////////
err = bt_id_set_adv_own_addr(adv, param->options, dir_adv,
&cp->own_addr_type);
...
/* Set which local identity address we're advertising with */
///////////////////////////////////////////////
BDADDR is not new addr but old(current) addr?
///////////////////////////////////////////////
id_addr = &bt_dev.id_addr[adv->id];
...
if (options & BT_LE_ADV_OPT_USE_IDENTITY) {
if (id_addr->type == BT_ADDR_LE_RANDOM) {
err = bt_id_set_adv_random_addr(adv, &id_addr->a);
}
is something wrong?
Core spec v5.1
LE Set Advertising Set Random Address command
want to do the same thing.
It seems that this command can be called even during Advertising.
(It seems that the setting will be reflected at the next enable.)
what should i do?
---------------------------------------------------------------------------------------------
I checked the source code.
zephyr/subsys/bluetooth/host/adv.c
int bt_le_ext_adv_update_param()
...
le_ext_adv_param_set()
...
////////////////////////////////////
It looks like are setting BDADDR
////////////////////////////////////
err = bt_id_set_adv_own_addr(adv, param->options, dir_adv,
&cp->own_addr_type);
...
/* Set which local identity address we're advertising with */
///////////////////////////////////////////////
BDADDR is not new addr but old(current) addr?
///////////////////////////////////////////////
id_addr = &bt_dev.id_addr[adv->id];
...
if (options & BT_LE_ADV_OPT_USE_IDENTITY) {
if (id_addr->type == BT_ADDR_LE_RANDOM) {
err = bt_id_set_adv_random_addr(adv, &id_addr->a);
}
is something wrong?
It is not allowed for most types of advertising.
When using legacy advertising commands the address that is used is the one set through "HCI LE Set Random Address command". In Core_v5.4, Vol 4, Part E, Section 7.8.4:
If the Host issues this command when any of advertising (created using legacy advertising commands), scanning, or initiating are enabled, the Controller shall return the error code Command Disallowed (0x0C).
When using extended advertising commands the address that is used is the one set through "LE Set Advertising Set Random Address command". In Core_v5.4, Vol 4, Part E, Section 7.8.52:
However, if the Host issues this command while the advertising set identified by the Advertising_Handle parameter is using connectable advertising and is enabled, the Controller shall return the error code Command Disallowed (0x0C).
Best regards,
Kenneth
No, that's not what I want to know.
Did you forget to set param->id to adv->id in the process of bt_le_ext_adv_update_param()?
I suggest you do as initially suggested:
loquat said:I can achieve this by using multiple AdvertiseSets, but I would like to avoid this as it requires additional memory.
Alternatively, you can stop, update and start advertising also if you want too like on the old nRF5 SDK.
But if you are using connectable advertisment then we need to follow the BT spec.
Kenneth