hbldh / bleak

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

Unable to scan for BLE 5.x extended advertisements #1347

Open Nilon123456789 opened 1 year ago

Nilon123456789 commented 1 year ago

Description

I'm trying to listen for extended advertising from an nrf52833. But I can't see the packets on my pi nor on my windows desktop.

What I Did

I tried running the https://github.com/hbldh/bleak/blob/develop/examples/discover.py script on my pc and pi. But I'm only seeing regular advertising message and not extended one. I know that my nrf is broadcasting since I can see the packets on my pc using https://github.com/microsoft/BluetoothLEExplorer from microsoft.

dlech commented 1 year ago

With BlueZ (Linux) and CoreBluetooth (Mac), we only get updates when RSSI or the value of a advertisement data type changes. There isn't a way to tell the difference between different types of advertisements on these OSes. Windows does provide this information, but to make Bleak consistent cross-platform, we don't expose that.

Nilon123456789 commented 1 year ago

So I can not read/receive extended advertisement packet using bleak?

dlech commented 1 year ago

I'm not entirely sure since I don't have any devices that use extended advertisements to see exactly how all of the different OSes handle it.

eriklins commented 10 months ago

On Windows (10+) it should be possible to enable support for extended advertisements: https://learn.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.advertisement.bluetoothleadvertisementwatcher.allowextendedadvertisements?view=winrt-19041. However, the underlying BT controller needs to support these, which is not the case for every BT5.0 specified controller, since extended advertisements are an optional feature of BT5.0 spec.

philrittenhouse commented 5 months ago

I'm not entirely sure since I don't have any devices that use extended advertisements to see exactly how all of the different OSes handle it.

If you have an ESP32S3 you can test extended advertising capabilities with the NimBLE Multi Advertiser Demo in the supplied Examples