This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Scan time out

Hi. I'm using nRF51822, SDK12.2.0, S130 as multi-link Central.

#define SCAN_TIMEOUT 10

Time-out is working well when it is Single connection. After 10 second, it stops scanning.

When I use it as multi-link central, the operation is as below.

  1. Start scan(having 10seconds timeout)
  2. Spend 9seconds.
  3. find a peripheral I want
  4. Stop scanning
  5. connection
  6. Start scan(having more 10seconds timeout)
  7. goes to step2.

I want timeout it works during just 10 seconds. But it will work more. Sometimes it works infinitely. My example operation as I said above, it will take 80seconds around because nRF can have 8 multi connection. Plus, if I disconnect devices, it could work more or infinitely. It makes current consumption issue.

My question is Q1. Do I have to stop scan when I connect using "sd_ble_gap_connect"? Q2. If yes for Q1, is there any function for ABSOLUTE scan time out?

I need your help.

  • When you stop the scanner and start it again, the scanner timeout will be reset.

    I would suggest you to use a app timer to do the task. You start the app timer when you start your first scanning, and then when the timer timeout (10 seconds) you check if you are scanning then you can stop scanning.

    You can have a look at our ble_peripheral examples we use app timer in most of our examples.

Related