Filtering advertisement packets using UUIDs

Hello everybody,

I am working with a nRF52840 acting as a BLE central and I wan to scan (and connect) some specific peripherals. At first, I was using a whitelist; however, a new device for integration came and it was incompatible with this method of filtering. Now I am accepting all advertisement packets and filtering them by UUID. I am using the function ble_advdata_uuid_find to do so and it works fine for most of the peripherals.

My problem is with two specific peripherals whose UUIDs are non-standard. It is kind of weird because the function only works for one of these UUIDs, meaning it only recognizes and connects to only one of these peripherals. I have identified the following:

Scenario 1:
- I initialize custom service with custom UUID1.
-
I initialize custom service with custom UUID2.
-
The function I mention above is only able to find packets with custom UUID1.

Scenario 2:
- I initialize custom service with custom UUID2.
-
I initialize custom service with custom UUID1.
-
The function I mention above is only able to find packets with custom UUID2.

For more context:
Whenever I want to connect to 1 or 2, I pass the specific UUID to the function. While debugging, I confirmed that it is looking for the right UUID in each case.

More info:
- SDK v17.1
-  I have this in my sdkconfig.h #define NRF_SDH_BLE_VS_UUID_COUNT 4
- I have tried applying a UUID filter in the scanning process and it doesn't work either.

Any information of what might be happening is appreciated.

Thank you

Parents
  • Hi Daniela, 

    Could you show us how you setup the UUID to feed into nrf_ble_scan_filter_set() ? 
    Please note that if you have 2 UUIDs you would need to match the .type with what returned in sd_ble_uuid_vs_add() for each of them. They will not have the same value. Most likely the first one will have BLE_UUID_TYPE_VENDOR_BEGIN and the second one will have BLE_UUID_TYPE_VENDOR_BEGIN+1 
    This may explain why you only can scan for the first one you declare. 

Reply
  • Hi Daniela, 

    Could you show us how you setup the UUID to feed into nrf_ble_scan_filter_set() ? 
    Please note that if you have 2 UUIDs you would need to match the .type with what returned in sd_ble_uuid_vs_add() for each of them. They will not have the same value. Most likely the first one will have BLE_UUID_TYPE_VENDOR_BEGIN and the second one will have BLE_UUID_TYPE_VENDOR_BEGIN+1 
    This may explain why you only can scan for the first one you declare. 

Children
Related