This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How can I know that it is scanning or not?

Hi. I'm using PCA10028, SDK10.0.0, S130.

If i scan again when it is scanning, system goes halt and reset.

So i want to check it's scanning or not before I make it scan.

How can i know?

I need your help.

  • FormerMember
    0 FormerMember

    There is no function that explicitly can tell if your device is scanning or not.

    What you can do is one of the following:

    • Since scanning has to be started and stopped manually, you can use a global variable to keep track of the scannning "state" (running/not running).
    • Use the error code from sd_ble_gap_scan_start(..) to assumue if it is scanning or not: If you call sd_ble_gap_scan_start(..) when the devices is already scanning, it will return NRF_ERROR_INVALID_STATE, if it is not scanning, it will return NRF_SUCCESS.
Related