Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Can't perform scan on UUID 0x0000

There is a bug on the nrf_ble_scan.c uuid 128 bit filter.

My devices advertise the same 128bit uuid service, which is constituted of my random generated 128 bit UUID and a byte 12 set to 0 and a byte 13 set to 0. I have a central that scans for them using a SCAN_UUID_FILTER.
The filter was not working because of this test, checking that the uuid filter has not been set. It tests that the filter was not previously added and in order to do so tests for a uuid equal to the current value of the filter struct ( which is set to 0 when you call nrf_ble_scan_all_filter_remove)

    // Check for duplicated filter.
    for (index = 0; index < NRF_BLE_SCAN_UUID_CNT; index++)
    {
        if (p_uuid_filter[index].uuid == p_uuid->uuid)
        {
            return NRF_SUCCESS;
        }
    }

A proposal for a correction to this test would be to also test for the uuid type, as 0 is an invalid value for the uuid type
 

    // Check for duplicated filter.
    for (index = 0; index < NRF_BLE_SCAN_UUID_CNT; index++)
    {
        if ((p_uuid_filter[index].uuid == p_uuid->uuid) && (p_uuid_filter[index].type == p_uuid->type))
        {
            return NRF_SUCCESS;
        }
    }

Parents Reply Children
Related