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

scan params at creating connection

Hi,

I'm wondering why are there scan parameters on creating connection? If I refer to SD130, create connection function, there is a note which tells us that if scan is currently running is terminated on calling this function. After call is scan procedure started "internal" inside of soft device with parameters that I pass as argument, that connection could be established? Or am I wrong?

Thank you.

BR, Matej

  • There are scan parameters because connection to a peripheral by a central requires it to first scan for advertising packets and then reply with a connection request. It's perfectly legitimate to just call the connect function without having first scanned if you know what you want to connect to and the device doesn't even have to be in range, turned on, or advertising. So you have to specify the scan parameters to tell the central how often and for how long to scan for the thing you want to connect to.

  • From the Connecting section of the BLE Central Tutorial:

    The p_scan_params are the same scan parameters we used to scan earlier. These are needed because our device must scan for the next advertisement from the chosen peripheral. As I mentioned in the background theory section, the peripheral will only listen for connection requests in a short time after broadcasting an advertisement packet.

Related