Closed kaz399 closed 2 weeks ago
Thanks for the PR!
Can you please add a changelog entry?
Also, I'm wondering if we could write this in a way that is a bit less verbose. Maybe something like this?
data = address_or_ble_device.details
self._device_info = (data.adv or data.scan).bluetooth_address
And it would be good to fix the type hint at https://github.com/hbldh/bleak/blob/181467f7d7e09e0a7130962a0f7f8db4510ddc59/bleak/backends/winrt/scanner.py#L53 while we are at it. (Should be Optional[BluetoothLEAdvertisementReceivedEventArgs]
.)
Thanks for the suggestion for a more concise description! It is very clear and good.
I modify the type hints and update the changelog.
Thanks for updating!
In some situations, device.details has the scan response data only and advertising data is None.
Since the ble address cannot be obtained from device.details.adv this time, the ble address is obtained from the device.details.scan (scan response data).