hbldh / bleak

A cross platform Bluetooth Low Energy Client for Python using asyncio
MIT License
1.61k stars 279 forks source link

backends: filter discovered devices #1577

Closed dlech closed 1 month ago

dlech commented 1 month ago

This is a follow-up to a818521 ("backends/scanner: always filter by service_uuids") to also filter discovered devices by the service UUIDs.

This was overlooked in that change and on Windows actually caused a regression.

Fixes: https://github.com/hbldh/bleak/issues/1576

dlech commented 1 month ago

Hi @MarkusPiotrowski, could you please test?

MarkusPiotrowski commented 1 month ago

Yes, this work now. Out of 8 devices catched during a scan without UUID filtering, only two were found when scanning with service_uuids filter, both containing the selected service UUID.

BTW, is it usual that a device only advertises one service, at max? Although service_uuids is a list in AdvertisementData, I have never seen a device with more than one service in this list.

dlech commented 1 month ago

BTW, is it usual that a device only advertises one service, at max?

Probably, given the small size of the advertising data. I suppose someone might want to scan for two different types of devices at the same time in some cases?