or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/bleak@1.1.x
tile.json

tessl/pypi-bleak

tessl install tessl/pypi-bleak@1.1.0

Cross-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%

task.mdevals/scenario-7/

BLE Connection Manager

A utility module for managing Bluetooth Low Energy device connections with proper connection lifecycle management, including connection status tracking and graceful disconnection.

Capabilities

Establish and Verify Connection

  • Connect to a BLE device using a device address and verify the connection is established @test
  • Check connection status after successfully connecting returns True @test

Disconnect from Device

  • Disconnect from a connected BLE device and verify disconnection completes successfully @test
  • Check connection status after disconnecting returns False @test

Async Context Manager Usage

  • Connect and disconnect automatically using async context manager @test
  • Connection status is False after exiting async context manager @test

Implementation

@generates

API

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."""
        pass

Dependencies { .dependencies }

bleak { .dependency }

Provides Bluetooth Low Energy GATT client functionality for connecting to and communicating with BLE devices.

@satisfied-by