Registry /
communication / winrt-windows-devices-bluetooth-genericattributeprofile
Install & Compatibility
Where this runs
tested against v? · pip install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
build_error
glibcpy 3.10–3.920 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
GattDeviceService
✓ from winrt.windows.devices.bluetooth.genericattributeprofile import GattDeviceService
✗ from winrt_windows_devices_bluetooth_genericattributeprofile import GattDeviceService
WinRT projection imports follow the 'winrt.<namespace>' pattern, not the PyPI package name directly.
BluetoothLEDevice
✓ from winrt.windows.devices.bluetooth import BluetoothLEDevice
✗ from winrt.windows.devices.bluetooth.genericattributeprofile import BluetoothLEDevice
Classes are imported from their specific namespace. BluetoothLEDevice is in 'winrt.windows.devices.bluetooth', not 'genericattributeprofile'.
DeviceInformation
✓ from winrt.windows.devices.enumeration import DeviceInformation
✗ from winrt.windows.devices.bluetooth import DeviceInformation
DeviceInformation is part of the enumeration namespace, which is separate from bluetooth namespaces.
This quickstart demonstrates how to use `pywinrt` to list available Bluetooth LE devices on a Windows system. It shows the basic pattern for importing WinRT classes and calling asynchronous methods. To interact with GATT services (e.g., GattDeviceService), you would extend this by getting a specific `BluetoothLEDevice` and calling its `GetGattServicesAsync` method, which is conceptually shown in comments.
import asyncio
from winrt.windows.devices.bluetooth import BluetoothLEDevice
from winrt.windows.devices.enumeration import DeviceInformation
async def list_bluetooth_le_devices():
# AQS filter for Bluetooth LE devices
aqs_le_devices = BluetoothLEDevice.get_device_selector()
print("Searching for Bluetooth LE devices (this may take a few seconds)...")
# DeviceInformation is in winrt.windows.devices.enumeration
devices = await DeviceInformation.find_all_async(aqs_le_devices)
if not devices:
print("No Bluetooth LE devices found.")
print("Ensure Bluetooth is enabled and devices are discoverable.")
return
print(f"Found {len(devices)} Bluetooth LE devices:")
for i, device in enumerate(devices):
print(f" [{i}] Name: {device.name}, Id: {device.id}")
# To get GATT services, you would then obtain a BluetoothLEDevice instance
# and call its GetGattServicesAsync method.
# Example (conceptual):
# from winrt.windows.devices.bluetooth.genericattributeprofile import GattCommunicationStatus
# le_device = await BluetoothLEDevice.from_id_async(device.id)
# if le_device:
# result = await le_device.get_gatt_services_async()
# if result.status == GattCommunicationStatus.SUCCESS:
# for service in result.services:
# print(f" GATT Service: {service.uuid}")
# # Further GATT operations would use objects from
# # winrt.windows.devices.bluetooth.genericattributeprofile
# # e.g., GattDeviceService, GattCharacteristic, etc.
if __name__ == "__main__":
# This code must run on a Windows machine with Bluetooth enabled and permissions granted.
asyncio.run(list_bluetooth_le_devices())
Upgrade
Version history
3.2.1latest on PyPI · released Jun 6, 2025
Audit
Dependencies
winrt-runtimerequiredProvides core WinRT projection functionalities and infrastructure required by all specific WinRT projection packages.