0

I'm executing a scan with BluetoothLeScanner to search for devices running one of 3 services. I've tried adding the services UUIDs to a ScanFilter list, but it seems the scan searches for devices running the 3 services.

List<ScanFilter> filters = new ArrayList<>();
            ScanFilter.Builder sfBuilder = new ScanFilter.Builder();
            sfBuilder.setServiceUuid(ParcelUuid.fromString(Uuids.A));
            //sfBuilder.setServiceUuid(ParcelUuid.fromString(Uuids.B));
            //sfBuilder.setServiceUuid(ParcelUuid.fromString(Uuids.C));
            filters.add(sfBuilder.build());

            ScanSettings.Builder scanSettingsBuilder = new ScanSettings.Builder();

        mBluetoothAdapter.getBluetoothLeScanner().startScan(filters,scanSettingsBuilder.build(),mLeScanCallback);

Is there a way to pass the 3 UUIDs and the scan returns the devices running 1 or more of those services? (i know i can search for all devices without filters, and after that filter them myself, i was trying to avoid that)

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Thought
  • 5,326
  • 7
  • 33
  • 69
  • 1
    If the three services have a common part in their UUIDs you can use a mask to exclude the uncommon bits from the search. Post the searched uuids strings please :) – Nicola Gallazzi Dec 20 '18 at 11:37

1 Answers1

1

Maybe you can start three scans with a filter, for each service?

Emil
  • 16,784
  • 2
  • 41
  • 52