Registry / communication / winrt-windows-devices-bluetooth-genericattributeprofile

winrt-windows-devices-bluetooth-genericattributeprofile

JSON →
library3.2.1pypypiunverified

This package is a Python projection of the Windows Runtime (WinRT) APIs specific to `Windows.Devices.Bluetooth.GenericAttributeProfile`. It allows Python applications to interact with Bluetooth LE devices and their Generic Attribute Profile (GATT) services and characteristics on Windows. Part of the `pywinrt` project, it is currently at version 3.2.1 and receives regular updates to align with Windows SDK changes and project enhancements.

pip install winrt-windows-devices-bluetooth-genericattributeprofile
INSTALL
IMPORT
SIG · WINRT-WINDOWS-DEVI
W
winrt-windows-devices-bluetooth-genericattributeprofile
communicationpythonv3.2.1
Install
—
Import
—
Disk
—
Pass rate
0/ 10
Env Coverage0 / 10
glibc
3.9–3.13
musl
3.9–3.13
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
musl
py 3.10–3.920 runs
build_error
glibc
py 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())
Debug
Known issues
breakingVersion 3.0.0 introduced significant breaking changes, including a redesigned API, new `winrt.runtime` module, and changes to `winrt.system` functionalities (e.g., `box_...`/`unbox_...` functions, `Object.as_()`). Applications targeting `pywinrt` v2.x.x will require migration.
fix
Refer to the official migration guide for v2 to v3 on the pywinrt GitHub repository (scripts/2to3/README.md). Update import paths and API calls as necessary.
affects: <3.0.0
gotchaPrior to version 3.2.0, synchronously calling WinRT async operations was less straightforward, primarily relying on `asyncio.run()` or `await` within an async context. Directly calling `.get()` or `.wait()` on async operations was not officially supported or stable.
fix
For synchronous execution of async operations, upgrade to `pywinrt` 3.2.0 or later and use the `.get()` or `.wait()` methods on the returned `IAsyncOperation` or `IAsyncAction` objects. Otherwise, ensure all async calls are `await`ed within an `async` function.
affects: <3.2.0
gotchaThe `winrt.system.hresult` module, which provides access to common WinRT error codes, was introduced in version 3.2.0. Attempting to access this module or its contents on older versions will result in an `AttributeError`.
fix
Upgrade to `pywinrt` 3.2.0 or later to utilize the `winrt.system.hresult` module for standardized error code handling.
affects: <3.2.0
gotchaFixed a possible circular import exception in version 3.2.1. Older versions might encounter issues related to module loading order, especially in complex application structures.
fix
Upgrade to `pywinrt` version 3.2.1 or later to mitigate potential circular import issues.
affects: <3.2.1
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.
Agent activity
63 hits · last 30 days
node
58
OpenAI (training)
1
Resources
winrt-windows-devices-bluetooth-genericattributeprofile — pip install winrt-windows-devices-bluetooth-genericattributeprofile · libregistry