You can use CyBle_GappSetNumOfAdvPkts() API for sending a fixed number of adv packets.
Thanks Gyan, this API may be useful for my case.
Two followup questions though:
1) For a given dynamic environment, it maybe hard for me to know before hand the number of packets that I have to send, say when the user presses a button to stop the advertising. In that case, I still need to count the packets on fly. Is there a Stack handler event that I can use to trackf each packet sent?
2) Is the CyBle_GappSetNumOfAdvPkts() API valid for PSoC 6 BLE? I tried variations like Cy_BLE_GAPP_SetNumOfAdvPkts() but could not find the API in my PSoC 6 BLE project. The BLE component is set in 'Broadcaster' role.
You can keep track of number of Advertisement events ( Ex : If you are using all the 3 ADV channels , then every ADV event ,3 ADV packets will be sent over the air).
To do this, you need to register the bless interrupt callback function.
1) For PSoC 4 BLE :- CyBle_RegisterBlessInterruptCallback()
2) For PSOC 6 BLE :- Cy_BLE_RegisterInterruptCallback()
Please let me know if it helps for you.
I tried Cy_BLE_RegisterInterruptCallback() to record the number of advertisement packets sent from a broadcaster, based on number of BLESS interrupts I receive after starting the advertisement. Unfortunately, the numbers reported are way too less than I see on the BLE sniffer. I have accounted for counting three times for sending packets to channel 37,38 and 39 as well as other BLESS interrupts.
I have raised a Technical support case and hopefully will get this sorted out and shared here. Let me know if you have any ideas on what else I maybe missing.
Going back to my other question on 'CyBle_GappSetNumOfAdvPkts()', can you provide the correct API name that is used in PSoC 6 BLE and its respective event name?