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;
}
}