maximum time for high_undirect_adv_duration and high_direct_adv_duration

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hello,

My application has be visible all the time. (Better: it should be connected all the time).

If the device is not connected, it should send advertisements at high duration.

If set high_undirect_adv_duration to 40000 (seconds) (low_direct_adv_duration is set to 0), ADV stopped is called every second.

If set high_undirect_adv_duration to 30000 it seems to work.

So what is the maximum time for high_undirect_adv_duration and high_direct_adv_duration?

SDK: 2.2.1 (Ubuntu)

Hardware: BCM920736S

david_armour

0 Likes
6 Replies
Anonymous
Not applicable

How to set peripheral to always advertise

Does the above thread help for continuously sending advertisements?

Anonymous
Not applicable

Hi lucyli

No, sorry. The link doesn't help very much.

I implemented the callback of ADV stopped.

But if I increase the duration for the ADVs to 40.000 seconds, that callback will be called every second, instead of every 40.000 seconds.

But with a duration of 30.000 seconds, that callback won't be called every second. I have not tested when he will be called, but it seems there is a maximum I the duration can be.

But I can't find that maximum for the durations.

0 Likes
Anonymous
Not applicable

I think what you need to do is register a callback for the advertising timeout app event and then when it is called, restart the advertising.

Here is what I do..

In connUp I stop the advertising.

In connDown, I restart the advertising

in advStopped, I restart the advertising (or set a timer to restart later).

In App_create():

// register connection up and connection down handler.

    bleprofile_regAppEvtHandler(BLECM_APP_EVT_LINK_UP, my_connUp);

    bleprofile_regAppEvtHandler(BLECM_APP_EVT_LINK_DOWN, my_connDown);

    bleprofile_regAppEvtHandler(BLECM_APP_EVT_ADV_TIMEOUT, my_advStopped);

in my_AdvStoppped():

   bleprofile_Discoverable(LOW_UNDIRECTED_DISCOVERABLE, NULL);

   blecm_setAdvEnable(1);

0 Likes
Anonymous
Not applicable

Based on your observations I'm going to make a wild guess that the variable in question is a signed sixteen bit integer.

In that case the maximum values would be 65535 / 2 or 32767.

A value of 40,000 would look like a negative number which might have unpredictable effects depending on what the system does with it... either takes the absolute value or assumes some default maybe.

0 Likes
Anonymous
Not applicable

Hi ehoffman,

I checked the types in the BLE_PROFILE_CFG, but the duration is defined as UINT16.

I don't know if the work other where in the software with INT16. But then the type in the BLE_PROFILE_CFG should be updated.

So I don't know if your guess with the signed sixteen bit integer is correct.

0 Likes

To update this thread:

ehoffman I can confirm that your guess was correct. A few layers down the stack, these numbers are cast as signed 16 bit integers--making anything more than 32768 a negative number and an invalid input.

Jacob

0 Likes