Cross-platform Bluetooth Low Energy GATT client library for asynchronous BLE communication
Overall
score
97%
A utility module for managing Bluetooth Low Energy device connections with proper connection lifecycle management, including connection status tracking and graceful disconnection.
@generates
from bleak import BleakClient
class BLEConnectionManager:
"""Manages BLE device connections with proper lifecycle handling."""
def __init__(self, device_address: str):
"""
Initialize the BLE connection manager.
Args:
device_address: Bluetooth address of the device to connect to
"""
pass
async def connect(self) -> None:
"""
Connect to the BLE device.
Raises:
Exception: If connection fails
"""
pass
async def disconnect(self) -> None:
"""
Disconnect from the BLE device if connected.
"""
pass
def is_connected(self) -> bool:
"""
Check if currently connected to the device.
Returns:
True if connected, False otherwise
"""
pass
async def __aenter__(self):
"""Async context manager entry - connects to device."""
pass
async def __aexit__(self, exc_type, exc_val, exc_tb):
"""Async context manager exit - disconnects from device."""
passProvides Bluetooth Low Energy GATT client functionality for connecting to and communicating with BLE devices.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/pypi-bleakdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9