PyQt 6.6.1 QBluetoothDeviceInfo getServiceData() Bug
Phil Thompson
phil at riverbankcomputing.com
Wed Apr 17 12:45:48 BST 2024
On 12/04/2024 10:51, Benjamin Griffiths wrote:
> Hi there,
>
> I am trying to read the BLE service data from QBluetoothDeviceInfo
> via the serviceData() method, but I believe I have discovered a bug.
>
> _serviceData() ->__ Dict[QBluetoothUuid, QByteArray]_
>
> The function returns an empty dictionary for discovered devices that
> have no service data available (correct behaviour). However, when the
> device does have service data, a TypeError is raised.
>
> _TypeError: unhashable type: 'QBluetoothUuid'_
>
> I have attached a minimal reproducible example that scans for all
> Bluetooth Low Energy devices and tries to read the service data using
> serviceData(). Obviously to reproduce this error you will need to be
> in range of some BLE devices that have non-empty service data.
>
> I am using Python 3.10.11 and PyQt 6.6.1.
>
> A work around is to use the serviceUuids() method, then use
> serviceData(uuid) for each UUID. However as per the documentation this
> only return the "first" item in service data, not all of it.
>
> Any support would be greatly appreciated.
>
> Many thanks,
>
> Ben
Should be fixed in the next snapshot.
Thanks,
Phil
More information about the PyQt
mailing list