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

Simple whitelisting How-To

I am really puzzled by this and although I've read all the relevant answers in the Q/A I'm still unable to do the following:

  • do non-selective scanning with central device
  • accept the first peripheral device (which has the service I need) and add it to whitelist
  • after central restart load the whitelist and do selective scanning

What I want to achieve with this is that only one peripheral can be connected to central. I understand I need to limit how large the whitelist is - in my case 1.

For this discussion let us all review the ble_app_uart_c example which seems like it implements whitelist (I can't get it to work though - peripheral got connected, then after central restart, whitelist is empty hence it goes into non-selective scannign again).


My question (related to example):

  • after non-selective scanning where exactly is the device address stored to whitelist and saved to flash?

In the example in function scan_start() I can see the whitelist gets created with dm_whitelist_create() but does this function load the whitelist from flash? This would be necessary so selective scanning would be working (after a peripheral's address was added to whitelist in non-selective scanning in previous power-cycle).

  • is the example missing anything which would prevent it from working with whitelist?
Related