import uuid
from ..domain_data import DomainData as DomainData
from .characteristic import BleakGATTCharacteristicESPHome as BleakGATTCharacteristicESPHome
from .descriptor import BleakGATTDescriptorESPHome as BleakGATTDescriptorESPHome
from .service import BleakGATTServiceESPHome as BleakGATTServiceESPHome
from _typeshed import Incomplete
from bleak.backends.characteristic import BleakGATTCharacteristic
from bleak.backends.client import BaseBleakClient, NotifyCallback as NotifyCallback
from bleak.backends.device import BLEDevice
from bleak.backends.service import BleakGATTServiceCollection
from collections.abc import Callable
from homeassistant.components.bluetooth import async_scanner_by_source as async_scanner_by_source
from homeassistant.config_entries import ConfigEntry as ConfigEntry
from homeassistant.core import CALLBACK_TYPE as CALLBACK_TYPE, HomeAssistant as HomeAssistant
from typing import Any, TypeVar

DEFAULT_MTU: int
GATT_HEADER_SIZE: int
DISCONNECT_TIMEOUT: float
CONNECT_FREE_SLOT_TIMEOUT: float
GATT_READ_TIMEOUT: float
CCCD_UUID: str
CCCD_NOTIFY_BYTES: bytes
CCCD_INDICATE_BYTES: bytes
MIN_BLUETOOTH_PROXY_VERSION_HAS_CACHE: int
DEFAULT_MAX_WRITE_WITHOUT_RESPONSE: Incomplete
_LOGGER: Incomplete
_WrapFuncType = TypeVar('_WrapFuncType', bound=Callable[..., Any])

def mac_to_int(address: str) -> int: ...
def verify_connected(func: _WrapFuncType) -> _WrapFuncType: ...
def api_error_as_bleak_error(func: _WrapFuncType) -> _WrapFuncType: ...

class ESPHomeClient(BaseBleakClient):
    _hass: Incomplete
    _ble_device: Incomplete
    _address_as_int: Incomplete
    _source: Incomplete
    domain_data: Incomplete
    entry_data: Incomplete
    _client: Incomplete
    _is_connected: bool
    _mtu: Incomplete
    _cancel_connection_state: Incomplete
    _notify_cancels: Incomplete
    _disconnected_event: Incomplete
    _connection_version: Incomplete
    _address_type: Incomplete
    _source_name: Incomplete
    def __init__(self, address_or_ble_device: Union[BLEDevice, str], *args: Any, config_entry: ConfigEntry, **kwargs: Any) -> None: ...
    def __str__(self) -> str: ...
    def _unsubscribe_connection_state(self) -> None: ...
    services: Incomplete
    def _async_disconnected_cleanup(self) -> None: ...
    def _async_ble_device_disconnected(self) -> None: ...
    def _async_esp_disconnected(self) -> None: ...
    _disconnected_callback: Incomplete
    def _async_call_bleak_disconnected_callback(self) -> None: ...
    async def connect(self, dangerous_use_bleak_cache: bool = ..., **kwargs: Any) -> bool: ...
    async def disconnect(self) -> bool: ...
    async def _wait_for_free_connection_slot(self, timeout: float) -> None: ...
    @property
    def is_connected(self) -> bool: ...
    @property
    def mtu_size(self) -> int: ...
    async def pair(self, *args: Any, **kwargs: Any) -> bool: ...
    async def unpair(self) -> bool: ...
    async def get_services(self, dangerous_use_bleak_cache: bool = ..., **kwargs: Any) -> BleakGATTServiceCollection: ...
    def _resolve_characteristic(self, char_specifier: Union[BleakGATTCharacteristic, int, str, uuid.UUID]) -> BleakGATTCharacteristic: ...
    async def clear_cache(self) -> None: ...
    async def read_gatt_char(self, char_specifier: Union[BleakGATTCharacteristic, int, str, uuid.UUID], **kwargs: Any) -> bytearray: ...
    async def read_gatt_descriptor(self, handle: int, **kwargs: Any) -> bytearray: ...
    async def write_gatt_char(self, char_specifier: Union[BleakGATTCharacteristic, int, str, uuid.UUID], data: Union[bytes, bytearray, memoryview], response: bool = ...) -> None: ...
    async def write_gatt_descriptor(self, handle: int, data: Union[bytes, bytearray, memoryview]) -> None: ...
    async def start_notify(self, characteristic: BleakGATTCharacteristic, callback: NotifyCallback, **kwargs: Any) -> None: ...
    async def stop_notify(self, char_specifier: Union[BleakGATTCharacteristic, int, str, uuid.UUID]) -> None: ...
    def __del__(self) -> None: ...
