tessl install tessl/pypi-bleak@1.1.0Cross-platform Bluetooth Low Energy GATT client library for asynchronous BLE communication
Agent Success
Agent success rate when using this tile
97%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.07x
Baseline
Agent success rate without this tile
91%
Build a BLE scanner that discovers heart rate monitoring devices in the vicinity.
Create a Python script that scans for BLE devices advertising heart rate services and displays information about discovered devices.
Implement a scanner that:
0x180D)For each discovered device, display:
Print results in the following format:
Scanning for heart rate monitors...
Found: <device_name> (<address>) - RSSI: <rssi> dBmIf no devices are found, print:
No heart rate monitors foundThe following test cases should pass:
File: test_hr_scanner.py { .test-file }
Test:
import pytest
from hr_scanner import scan_heart_rate_devices
@pytest.mark.asyncio
async def test_scanner_filters_by_service():
"""Test that scanner uses service UUID filter"""
# This test verifies the scanner is configured with service UUID filter
devices = await scan_heart_rate_devices(timeout=1.0)
# If devices are found, they should have been filtered during scan
assert isinstance(devices, list)File: test_hr_scanner.py { .test-file }
Test:
import pytest
from hr_scanner import format_device_info
def test_format_device_info():
"""Test device information formatting"""
# Mock BLEDevice and AdvertisementData
class MockDevice:
def __init__(self):
self.name = "HR Monitor"
self.address = "AA:BB:CC:DD:EE:FF"
class MockAdData:
def __init__(self):
self.rssi = -65
device = MockDevice()
ad_data = MockAdData()
result = format_device_info(device, ad_data)
assert "HR Monitor" in result
assert "AA:BB:CC:DD:EE:FF" in result
assert "-65" in resultProvides cross-platform Bluetooth Low Energy support for device scanning and GATT operations.