Skip to content

Commit

Permalink
[tcat] fix: use normalize_uuid_str() on BBTC_SERVICE_UUID (openthread…
Browse files Browse the repository at this point in the history
…#10879)

This commit adds 'normalize_uuid_str()' in 'scan_tcat_devices()'.
It fixes an issue finding TCAT devices in newer versions of the 'bleak' module.
  • Loading branch information
jaul-nsc authored Nov 21, 2024
1 parent 7f6723f commit 9ae7de5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tools/tcat_ble_client/ble/ble_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

from bleak import BleakScanner
from bleak.backends.device import BLEDevice
from bleak.uuids import normalize_uuid_str
from bbtc import BBTC_SERVICE_UUID
from typing import Optional
from ble.ble_advertisement_data import AdvertisedData
Expand All @@ -48,9 +49,8 @@ async def find_first_by_mac(mac):
async def scan_tcat_devices(adapter: Optional[str] = None):
scanner = BleakScanner()
tcat_devices: list[BLEDevice] = []
discovered_devices = await scanner.discover(return_adv=True,
service_uuids=[BBTC_SERVICE_UUID.lower()],
adapter=adapter)
service_uuids = [normalize_uuid_str(BBTC_SERVICE_UUID)]
discovered_devices = await scanner.discover(return_adv=True, service_uuids=service_uuids, adapter=adapter)
for _, (device, adv) in discovered_devices.items():
ad = None
for uuid, data in adv.service_data.items():
Expand Down

0 comments on commit 9ae7de5

Please sign in to comment.