WebBluetooth GATT, filter by custom service UUID

32 Views Asked by At

I'm unable to filter by Service UUID using the bluetooth.requestDevice Web Bluetooth Gatt API

My device named MyDevice1 with the service UUID: "607cdd4f-32aa-47da-8209-18f12012e3a4" which has been randomly generated from here: https://www.uuidgenerator.net/

The following works fine and I can find my device:

    return navigator.bluetooth.requestDevice({
          
        filters: [{
            namePrefix: "MyDevice"
        }]
}).then......

But this does not work:

    return navigator.bluetooth.requestDevice({
          
        filters: [{
            namePrefix: "MyDevice",
            services: ["607cdd4f-32aa-47da-8209-18f12012e3a4"] // matches device only service UUID

        }]
}).then......

I've checked the device ID and it's definitely correct.

I it a the case that you can only use predefined UUID or can custom ones be generated for filtering? I've been using Chrome for testing.

Related Information: Bluetooth GATT service uuid overview

0

There are 0 best solutions below