Where do the ad data and sd data of Bluetooth LE advertising providers come from? Where do I set this data?

Parents
  • Hi,

    The screenshots are from the CAF Bluetooth advertising module. It is used by the nRF Connect for Dekstop application and a few samples, but not nesesarily recomended for other Bluetooth projects. In most cases the bt_le_adv_prov_get_ad() that you see used in the implementation here is not used and unless there is a particular reason you are looking at this code(?) I woudl ignore it.

    If what you want to do is see how advertisig and scan response packets are usually (ans moste easily) written, you can look at the Zephyr NUS sample which is qutie minimal (there is also a Nordic NUS sample under nrf which has several advantages, but that demonstrates many other things as well). Therere you can see two bt_data instances made, defining the advertising packet and scan response packet. And both are passed to bt_le_adv_start().

  • Thanks for your reply. I mainly want to implement the function of fast advertising for 30 seconds and then slow advertising. Someone recommended that I use CAF module to implement it, so I added CAF module in my project. It does implement this function, but I don't know how to modify the advertising parameters. If I don't use CAF advertising module, is there any other way to implement fast advertising for 30 seconds and then slow advertising?

Reply
  • Thanks for your reply. I mainly want to implement the function of fast advertising for 30 seconds and then slow advertising. Someone recommended that I use CAF module to implement it, so I added CAF module in my project. It does implement this function, but I don't know how to modify the advertising parameters. If I don't use CAF advertising module, is there any other way to implement fast advertising for 30 seconds and then slow advertising?

Children
  • Hi,

    If you want to use CAF you can read documetnation for the CAF advertisign module here. Note the link to this page about advertising providers. So if you want to set the advertising/scan response data, you must register a callback with BT_LE_ADV_PROV_AD_PROVIDER_REGISTER and BT_LE_ADV_PROV_SD_PROVIDER_REGISTER. You can see an example of this being done in nrf/samples/bluetooth/fast_pair/input_device/src/bt_le_adv_prov_uuid16.c.

    Without CAF you could reconfigure advertising using for instance a delayable work queue item, or a delay if you have a thread not doing anythign else. There, stop and re-start advertising with parameters to modify the advertising interval. CAF certeinly has its's uses, but if this is all you want, then I would suggest that as a simpler approach.

Related