Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix minor WinRT backend bugs #537

Merged
merged 3 commits into from
May 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions bleak/backends/winrt/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def _received_handler(
# 0x21 is service data with 128-bit UUID
for section in event_args.advertisement.get_sections_by_type(0x21):
data = bytearray(CryptographicBuffer.copy_to_byte_array(section.data))
service_data[str(UUID(bytes=data[15::-1]))] = data[16:]
service_data[str(UUID(bytes=bytes(data[15::-1])))] = data[16:]

# Use the BLEDevice to populate all the fields for the advertisement data to return
advertisement_data = AdvertisementData(
Expand Down Expand Up @@ -135,7 +135,7 @@ async def start(self):
if self._signal_strength_filter is not None:
self.watcher.signal_strength_filter = self._signal_strength_filter
if self._advertisement_filter is not None:
self.watcher._advertisement_filter = self._advertisement_filter
self.watcher.advertisement_filter = self._advertisement_filter

self.watcher.start()

Expand Down Expand Up @@ -172,7 +172,8 @@ def set_scanning_filter(self, **kwargs):
# TODO: Handle AdvertisementFilter parameters
self._advertisement_filter = kwargs["AdvertisementFilter"]

async def get_discovered_devices(self) -> List[BLEDevice]:
@property
def discovered_devices(self) -> List[BLEDevice]:
found = []
for event_args in list(self._devices.values()):
new_device = self._parse_event_args(event_args)
Expand Down