Scan and send advertise at the same time

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

cross mob
Anonymous
Not applicable

I can use blecm_startAdv and blecm_startScan to scan and send advertise at the same time.  However, when I stop the scan using the following function, the advertise also stop.  Is it by design?  How can I keep the device sending advertise?

blecm_setScanEnable(HCIULP_SCAN_MODE_OFF, blecen_cen_cfg.filter_duplicates);

0 Likes
15 Replies
JacobT_81
Employee
Employee
250 replies posted 100 replies posted 50 replies posted

Does the same thing happen when you use the user-level functions below to start and stop scans and advertisements?

blecen_Scan

bleprofile_Discoverable

Are you able to restart advertisements after the setScan function turns them off?

Jacob

0 Likes
Anonymous
Not applicable

I am able to restart the advertisements.   I did not try to use blecen_Scan and bleprofile_Discoverable.

0 Likes
JacobT_81
Employee
Employee
250 replies posted 100 replies posted 50 replies posted

Please see if the problem persists when you use the user-level functions blecen_Scan and bleprofile_Discoverable.

Jacob

0 Likes
Anonymous
Not applicable

I need to use the original functions because of the two reason.  I do not want to have timer to stop them and also I need to configure the channel for sending advertise.

0 Likes
JacobT_81
Employee
Employee
250 replies posted 100 replies posted 50 replies posted

You'll be fine restarting advertisements every time you stop a scan since you won't be interrupting timers. I can't narrow down the problem if I can't confirm it persists with the user-level functions.

Jacob

0 Likes
Anonymous
Not applicable

I think the user-level functions use blecm_startAdv, blecm_startScan, and blecm_setScanEnable. So, the same problem should be there.  Is it not true?

I did the following test:

run blecen_Scan(LOW_SCAN) and bleprofile_Discoverable(LOW_UNDIRECTED_DISCOVERABLE) -> there is No beacon.

run blecm_startScan and bleprofile_Discoverable(LOW_UNDIRECTED_DISCOVERABLE) -> there is beacon.

run blecm_startScan and bleprofile_Discoverable(LOW_UNDIRECTED_DISCOVERABLE) and blecen_Scan(NO_SCAN)-> there is NO beacon.

0 Likes
Anonymous
Not applicable

jakewtorres​  is there a way to fix the problem?  Thank you.

0 Likes
JacobT_81
Employee
Employee
250 replies posted 100 replies posted 50 replies posted

The user-level functions do, indeed, use these functions but they also do a few additional things on top of just calling these lower level functions. We needed to rule out it being a problem stemming form the upper layers.

I'll attempt to emulate the problem later today and get back to you.

Jacob

0 Likes

I can't reproduce this. If I quickly start and stop a scan, it doesn't stop my advertisements. Perhaps it's because you're in connection when you're calling these? Try a call to blecm_setAdvDuringConnEnable(TRUE);

Jacob

Anonymous
Not applicable

I have added  blecm_setAdvDuringConnEnable(TRUE);

The device scans for other adv.  When the device connects to others as the master, the following messages show that it stops its own Adv:

15:41:15   Connection is UP.

15:41:15   connUp

15:41:15   noAdv

Any idea why it stops adv?

0 Likes

Your initial question said that advertisements are stopped when you stopped scans. Is this not the case? Is it only when you enter connection?

"noAdv" is printed when  bleprofile_Discoverable(NO_DISCOVERABLE, NULL) is called. This happens below the application level in the connection process and cannot be prevented from happening.

Jacob

0 Likes
Anonymous
Not applicable

I am still verifying my initial question.

You suggested that maybe the node enter connection mode and blecm_setAdvDuringConnEnable(TRUE). So, I tested it and see the "noAdv" log.

But I did not call bleprofile_Discoverable.  There is no bleprofile_Discoverable in my code at all.

0 Likes
JacobT_81
Employee
Employee
250 replies posted 100 replies posted 50 replies posted

This happens below the application level in the connection process and cannot be prevented from happening.

Jacob

0 Likes
Anonymous
Not applicable

So, even when I set blecm_setAdvDuringConnEnable(TRUE), as long as a slave connects to the master, the master will stop sending adv?

Do some other functions call bleprofile_Discoverable(NO_DISCOVERABLE, NULL) ?    I am not sure why when a connection is up, the bleprofile_Discoverable(NO_DISCOVERABLE, NULL) needs to be called...

0 Likes

Yes, you must restart them after the connection process is compete.

Jacob

0 Likes