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

Connecting to only one central. How to? detailed

Hi, i know this question has been ask before but, i was reading and readind and i could find a way to do it. I got the theory but when i'm going to implement it in my code i get confused.

Starting by symple, i have 2 devices, one of this as central and one of this as peripheral.

I need the peripheral only get connected to this specific central and avoide connection to another.

1-. How i can setup an static address to my central? which part of the code i do that?

2-.I know that it is possible to create a whitelist to save bond info about the connection that has been made but i think i don't need it because i only have 1 central and just want to connect to him. wich part of the code i have to writte to set the address of my central in order to only connect to him? What would be this address, the peer addres or another one?

3-. I have read about directed advertising, what i got was that, you use direct adv when you want to connect to a specific central, but again, where do you specify that?

4-. My peripheral could be scannable but i just want my central could connect not any other device.

Maybe these are newbie question, but how i wrote above, i have read and read and i don't find a good explanation to do that.

Sorry and thanks in advance.

Parents
  • Hi Antonio,

    1. You set the address of the device using sd_ble_gap_address_set() function.

    2. You need to use whitelist, you can have a look at the demo code here if you want to use the API directly. If you don't you can think of using the device manager or peer manager and limit the maximum number of peer device to 1.

    3. You need to feed the address and the flag when calling sd_ble_gap_adv_start() as explained in the API documentation and in the blog above.

    4. Whitelisting with only one central will do the tast.

    Here is an example of using directed advertising. The address of the central device is {ba:2d:f2:f5:ed:5c} address type is Public. SDK v11, S132v2.

    ble_app_proximity - Directed.zip

  • Yes i did.. but, when i load this code in the peripheral, it doesn't start to advertising.

    You said i'm correct, so, how do i populate the peer address in the central and in the peripheral?

Reply Children
No Data
Related