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

Whitelisting example on central and peripheral devices

Hello!

I have multiple peripherals and multiple centrals. I'm trying to make one peripheral to connect only to one central.

I read a way to do this is by using whitelisting. I would like to know where I can find examples on how to implement a whitelist on both communication sides, central and peripheral.

Thank you!

Parents
  • For Peripheral you can look at the hid keyboard example. But all you need to do is provide the whitelist to ble_gap_adv_params_t. This is populated using dm_whitelist_create. For central you can look at ble_app_hrs_c.

  • So, just to get this right and to verify if whitelist is the right option for me: I want one peripheral to connect to only one central. After 15 seconds, my peripheral goes to sleep (i'm using sleep_mode_enter()), so when it wakes up, it actually resets, resetting the whitelist. Is whitelisting the right option for me? Or is there other way to keep a non-volatile connection?

    Let me present an example:

    I have 2 centrals, 1 peripheral. Peripheral has whitelist enabled, just like hid keyboard example presents. Both centrals are on. When I turn on my peripheral, it connects to central A. If I turn off central A and keep central B on, peripheral connects to central B. I want to avoid this recconection behavior. I want the peripheral to connect only to central A, even if other centrals are available.

Reply
  • So, just to get this right and to verify if whitelist is the right option for me: I want one peripheral to connect to only one central. After 15 seconds, my peripheral goes to sleep (i'm using sleep_mode_enter()), so when it wakes up, it actually resets, resetting the whitelist. Is whitelisting the right option for me? Or is there other way to keep a non-volatile connection?

    Let me present an example:

    I have 2 centrals, 1 peripheral. Peripheral has whitelist enabled, just like hid keyboard example presents. Both centrals are on. When I turn on my peripheral, it connects to central A. If I turn off central A and keep central B on, peripheral connects to central B. I want to avoid this recconection behavior. I want the peripheral to connect only to central A, even if other centrals are available.

Children
No Data
Related