NCS mutiple_adv_sets get adv index

Hello,

When I use the sample mutiple_adv_sets in NCS v2.5.0,

I am wondering if there is a way to print the index of each AD after it has been started, so as to distinguish between different ads when they are sent (such as bt_le_ext_adv_get_index(),

but I don't know where to call it after each AD has started).

ps. Instead of unpacking packets at the receiver to distinguish between different advertising packets, they are immediately differentiated when they are sent.

Thank you

  • Hi

    I think you might be mixing up advertising sets and advertisements here, and the multiple_adv_sets sample does not seem to be relevant to this question really. It seems like you want to get the index for every single advertisement packet, which is not possible I'm afraid. 

    If you do in fact want to differentiate the advertising sets, you can do so with extended advertising and the bt_le_ext_adv sets, which is used when setting up and starting the advertisement set, and also used with the get index function you mentioned. 

    Best regards,

    Simon

  • Hello

    Thank you for your answer.

    I did confuse the concept of an AD set with an AD.

    1.About adv set

    Whether there is a sample for using the  bt_le_ext_adv_get_index()  to distinguish between AD sets

    2.About adv packet index

    For the Counting ads package, before NCS v2.5.3 there was a function called radio notification,

    (link: https://docs.nordicsemi.com/bundle/ncs-2.5.3/page/nrfxlib/mpsl/doc/radio_notification.html).

    I was wondering if I could count the AD packages in the callback function and write the index information to the AD packages via bt_le_adv_update_data().

    I tried counting and updating in that callback.

    By combining the (link: academy.nordicsemi.com/.../) Exercise 2 and (link: https://devzone.nordicsemi.com/f/nordic-q-a/75374/radio-notification-in-ncs) a sample called 6013. The peripheral_limited_adv. Zip

    the result:

    It looks like I used bt_le_adv_update_data incorrectly.

    -22 mean  EINVAL

    Is this solution theoretically sound, and how can I fix it?

    3.About multiple_adv_sets sample

    It can send two ads on the same device, and if at some point these two ads collide, what will the RF do?

    Thank you

  • Hi

    1. The bt_le_ext_adv_get_index() does exactly that, and returns the array index of an advertising set. This however is not possible for individual advertisement packets.

    2. Seems like you've set the bt_le_adv_update_data() params for bt_data and size are set to NULL and 0 respectively, which would be my guess to what this invalid argument error is caused by. I can't say I understand what you're trying to do here though, and in general I don't think counting the advertisement index will be possible.

    3. That is a good question actually. I assumed the MPSL timeslots handled this, but I can't see any mention of this in the sample project, so I have asked the developers now to get a straight forward answer on this.

    Best regards,

    Simon

  • 3, If two advertisers are due to be scheduled at the same time, the first one scheduled will take that slot and the second one will be rescheduled to be sent right afterwards. So it will in practice only be a slightly larger delay for the second advertiser.

    Best regards,

    Simon

  • Thank you very much for your answer.

    I tried bt_le_adv_update_data() again, and it seemed to work only for single AD updates, not AD set updates.

    Also, about the use of the bt_le_ext_adv_get_index() function. For example, if I have three connectable ads in my AD set with 20ms, 50ms, and 100ms periods, can I use this function to know which AD I am sending before each AD is sent (or at some other time)? How to use it?

    Best regards,

    qianjunwang

Related