How to count the transmitted advertising messages?

6 posts / 0 new
Last post
AngelT
Offline
Last seen:1 year 2 months ago
加入:2016-03-24 12:25
How to count the transmitted advertising messages?

Hello,
We use the last version SDK 5.0.4 to create a new BLE project with specific features. The requirement is to transmit predefined number of advertising messages with specific manufacture data.

Questions:
Is there a way to count the transmitted advertising messages?

有没有一种方法/富吗nction to transmit one advertising message 3, 5 or 100 times independently from the current parameters (advertising period and channels) ?

Thank you for the answers in advance.

Device:
MT_dialog
Offline
Last seen:2 months 6 days ago
Staff
加入:2015-06-08 11:34
Hi AngelT,

Hi AngelT,

There is no function that it will allow you to emmit a specified number of advertising messages but you can count the advertising message that are emmited by the device. There is an implementation for this kind of operation in the beacon reference design. Please check the app_asynch_trm() function there is an implementation that reads the last BLE event and if this is a BLE_EVT_END it means that an advertising message is emmited. This is also counting the connection intervals, so when counting you must make sure that your device is in advertising state as well. You can implement the function in SDK5 in the app_on_ble_powered callback.

Thanks MT_dialog

AngelT
Offline
Last seen:1 year 2 months ago
加入:2016-03-24 12:25
Hello MT_dialog,

Hello MT_dialog,

Thanks for the fast answer. I saw the beacon project and I succeeded to implement the idea in my project. I works properly. But I have a few questions.

1. Why the return value in the function app_asynch_trm() is only GOTO_SLEEP? Is it better or not the return value to be KEEP_POWERED when the advertising operation is stopped?

2. The beacon reference design supports connection mode and specific profiles. Some configuration parameters can be updated. Why in the project (in the function app_asynch_trm()) there is not a verification whether the current state is "advertising state" like your recommendation in the answer?

3. Why in the function app_asynch_trm() after the first transmission of advertising message exists the next code?
if (app_advertise_mode == GAPM_ADV_NON_CONN)
ble_advtim_set(500);

MT_dialog
Offline
Last seen:2 months 6 days ago
Staff
加入:2015-06-08 11:34
Hi AngelT,

Hi AngelT,

1) This is something that the user should handle at his application whether or not to continue with the sleeping procedure or dont go to sleep and continue with the scheduling of the events. If you return KEEP_POWERED all the time you wont be able to sleep between the advertising intervals.

2) The beacon is going to measure mistakenly as advertisements some connection events, but i suppose that didn't matter for the specific reference design since the counter is set back to zero when disconnected and starting to advertise again.

3) The code that you mention reduces the interval of each transmition on different channel during advertising, since the device is a beacon it advertises non connectable packets, thus it doesn't wait for a reception at each advertising so since there is no reception we can reduce the time slot that is required in order to perform only a transmition. This is done in order to reduce the power consumption of the device even more.

Thanks MT_dialog

AngelT
Offline
Last seen:1 year 2 months ago
加入:2016-03-24 12:25
Thanks for the fast answers.

Thanks for the fast answers.
About your last answer. How this value 500 is defined? The Bluetooth standard defines TX and RX time slots 625us. By the way, if the function app_last_rwble_evt_get() returns the end of the BLE event (one BLE event contains up to 3 transmissions), the advertising interval will be changed for all BLE events after the first one, which cannot be seen in the document UM-B-019_DA14580_Beacon_Reference_Application_v1.2.pdf.

MT_dialog
Offline
Last seen:2 months 6 days ago
Staff
加入:2015-06-08 11:34
Hi AngelT,

Hi AngelT,

The value is 500us, and itsNOTthe value of the advertising interval. For each advertising event, the device advertises in the 3 different channels, that value defines the interval between each successive RF transmit on different advertising channels in one advertising event. I dont get the last question, why the interval will be changed for all BLE events after the first one ?

Thansk MT_dialog