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
The purpose is to send multiple types of advertising.
I can achieve this by using multiple AdvertiseSets, but I would like to avoid this as it requires additional memory.
Also, I implemented the processing for multiple types of advertising for the nRF5 SDK, so I would like to use that processing.
How did you do this in nRF5 SDK? I would think the address could not be changed on the fly there either?
But to answer your question, the address can be changed using the bt_id_get() and bt_id_create() api:
https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/connectivity/bluetooth/api/gap.html#c.bt_id_create
Example usage:
https://github.com/nrfconnect/sdk-zephyr/blob/v2.6.99-ncs1-snapshot1/samples/bluetooth/peripheral_identity/src/peripheral_identity.c#L44
https://devzone.nordicsemi.com/f/nordic-q-a/79563/is-there-a-way-to-update-the-mac-address-after-enabling-bluetooth/329797
Kenneth
On nRF5 SDK,
call sd_ble_gap_addr_set() before sd_ble_gap_adv_start().
Example is not ExtendedAdvertising.
In AdvertiseExtension,
I'm thinking of using bt_le_ext_adv_update_param() and changing the id to change the BDADDR.
Am I wrong?
Please let me know if there is another way.
Changing bt_le_adv_param.options seems possible.
I was able to switch BDADDR between RandomStaticAddr and NonResolvablePrivateAddress by adding or removing BT_LE_ADV_OPT_USE_IDENTITY in bt_le_adv_param.options.
I would assume you need to do this similiar to the nRF5 SDK; set address before advertisement start. I do not expect changing the address on the fly while advertising will work, but I suggest you simply try it, if it works then it works, if it doesn't then it doesn't.
Kenneth
Inside the bt_le_ext_adv_cb.sent() callback function, we are calling bt_le_ext_adv_update_param().
Is this a problem?
If you are doing something wrong when calling bluetooth api's you will get an error message. As long as there is no error message you are fine.
Kenneth
If you are doing something wrong when calling bluetooth api's you will get an error message. As long as there is no error message you are fine.
Kenneth
Apparently, bt_id can only be set during adv_create and cannot be changed with update_param.
I would like to use bt_id_reset() instead.
However, if the id is associated with adv_create(), calling bt_id_reset() will return an error (-120).
What are the limitations of bt_id_reset()?
loquat said:Apparently, bt_id can only be set during adv_create and cannot be changed with update_param.
So it's the same as old nRF5 SDK then.
loquat said:What are the limitations of bt_id_reset()?
/** * @brief Reset/reclaim an identity for reuse. * * The semantics of the @a addr and @a irk parameters of this function * are the same as with bt_id_create(). The difference is the first * @a id parameter that needs to be an existing identity (if it doesn't * exist this function will return an error). When given an existing * identity this function will disconnect any connections created using it, * remove any pairing keys or other data associated with it, and then create * a new identity in the same slot, based on the @a addr and @a irk * parameters. * * @note the default identity (BT_ID_DEFAULT) cannot be reset, i.e. this * API will return an error if asked to do that. * * @param id Existing identity identifier. * @param addr Address to use for the new identity. If NULL or initialized * to BT_ADDR_LE_ANY the stack will generate a new static * random address for the identity and copy it to the given * parameter upon return from this function (in case the * parameter was non-NULL). * @param irk Identity Resolving Key (16 bytes) to be used with this * identity. If set to all zeroes or NULL, the stack will * generate a random IRK for the identity and copy it back * to the parameter upon return from this function (in case * the parameter was non-NULL). If privacy * @kconfig{CONFIG_BT_PRIVACY} is not enabled this parameter must * be NULL. * * @return Identity identifier (>= 0) in case of success, or a negative * error code on failure. */ int bt_id_reset(uint8_t id, bt_addr_le_t *addr, uint8_t *irk);
Is it possible to set a different addr for bt_id_reset?
Is it possible during advertising?
loquat said:Is it possible during advertising?
No.
Kenneth
OK.Thanks.