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

Device still visible while advertising with whitelist

I've come across the following situation:

We have a device (nrf52) which uses fast advertising with whitelist after it has established a bond with a single phone. When the device restarts it begins directed advertising to the phone in the whitelist.

When we use a second phone and scan for bluetooth devices Android's default bluetooth scanner (Settings->Bluetooth), the advertising device doesn't show up in the list of available devices (which is a good thing!)

However, when we use nrfConnect -or our own app- on this phone and scan for devices, the device actually pops up in the list. Therefore the following questions arose:

  • Does nrfConnect search for any advertising device, including those that advertise to a specific address thus causing the device to show up? Or should it not show up and is our whitelist mechanism not correctly functioning?

  • Is anyone aware of a scanning filter might be applied for clearing out those devices that are using directed advertising to a different address and are therefore 'unsupported' for the current phone? (e.g. the filter the android 'default' scanner uses)

Looking forward to your replies!

Parents
  • nRF Connect will show devices that advertise with a whitelist.

    You can test the whitelisting by trying to connect with a device that is not in the whitelist.

  • Just found the solution. Using the advertising flags you can determine in which state the advertising device is. In Android it is possible to get the advertising flags for devices that pop up in the scan callback.

    In my case I check whether the 'LE General Discoverable Mode' flag is set in the advertising package. If it is not set and the phone doesn't have a bond with that device, I leave it out of the list with available devices.

    For anyone looking for this solution:

    Check for something like this (in ScanCallback):

            int adv_flags = result.getScanRecord().getAdvertiseFlags();
    
            if( ( (0 == (adv_flags & FLAG_GENERAL_DISCOVERABLE) ) ) && (!(currentDevice.getBondState() == BOND_BONDED) ) )  {
                //If the device is not in general discoverable mode and no bond is present, do not show it.
            }
    
Reply
  • Just found the solution. Using the advertising flags you can determine in which state the advertising device is. In Android it is possible to get the advertising flags for devices that pop up in the scan callback.

    In my case I check whether the 'LE General Discoverable Mode' flag is set in the advertising package. If it is not set and the phone doesn't have a bond with that device, I leave it out of the list with available devices.

    For anyone looking for this solution:

    Check for something like this (in ScanCallback):

            int adv_flags = result.getScanRecord().getAdvertiseFlags();
    
            if( ( (0 == (adv_flags & FLAG_GENERAL_DISCOVERABLE) ) ) && (!(currentDevice.getBondState() == BOND_BONDED) ) )  {
                //If the device is not in general discoverable mode and no bond is present, do not show it.
            }
    
Children
No Data
Related