# bleak.args package

## Submodules

## bleak.args.bluez module

### BlueZ backend arguments

class bleak.args.bluez.BlueZClientArgs

  Bases: `TypedDict`

  `bleak.BleakClient` args that are specific to the BlueZ backend.

  Added in version 3.0.

  adapter: str

    Bluetooth adapter to use for connection, e.g. “hci0”.

    Tip

    If you have multiple Bluetooth adapters, they may not always be assigned the same `hciX` name across reboots. In that case, you can use udev to look up the name based on other properties like the USB vendor and product ID.

class bleak.args.bluez.BlueZDiscoveryFilters

  Bases: `TypedDict`

  Dictionary of arguments for the `org.bluez.Adapter1.SetDiscoveryFilter` D-Bus method.

  https://github.com/bluez/bluez/blob/master/doc/org.bluez.Adapter.rst#void-setdiscoveryfilterdict-filter

  Discoverable: bool

    Make adapter discoverable while discovering, if the adapter is already discoverable setting this filter won’t do anything.

  DuplicateData: bool

    Disables duplicate detection of advertisement data.

    This does not affect the `Filter Duplicates` parameter of the `LE Set Scan Enable` HCI command to the Bluetooth adapter!

    Although the default value for BlueZ is `True`, Bleak sets this to `False` by default.

  Pathloss: int

    Pathloss threshold value.

  Pattern: str

    Discover devices where the pattern matches either the prefix of the address or device name which is convenient way to limited the number of device objects created during a discovery.

  RSSI: int

    RSSI threshold value.

  Transport: str

    Transport parameter determines the type of scan.

    This should not be used since it is required to be set to `"le"`.

  UUIDs: list[str]

    Filter by service UUIDs, empty means match _any_ UUID.

    Normally, the `service_uuids` argument of `bleak.BleakScanner` is used instead.

class bleak.args.bluez.BlueZNotifyArgs

  Bases: `TypedDict`

  `bleak.BleakClient.start_notify()` method args that are specific to the BlueZ backend.

  Added in version 2.1.

  use_start_notify: bool

    If false, use the “AcquireNotify” D-Bus method instead of “StartNotify” to subscribe to notifications. The default is to use “StartNotify” for better compatibility with most BLE devices.

    see Enabling notification/indication with start_notify for more details.

    Changed in version 3.0.2: The default value was changed from `False` to `True`.

class bleak.args.bluez.BlueZScannerArgs

  Bases: `TypedDict`

  `BleakScanner` args that are specific to the BlueZ backend.

  adapter: str

    Bluetooth adapter to use for discovery, e.g. “hci0”.

    Tip

    If you have multiple Bluetooth adapters, they may not always be assigned the same `hciX` name across reboots. In that case, you can use udev to look up the name based on other properties like the USB vendor and product ID.

    Added in version 3.0.

  filters: BlueZDiscoveryFilters

    Filters to pass to the adapter SetDiscoveryFilter D-Bus method.

    Only used for active scanning.

  or_patterns: list[OrPattern | tuple[int, AdvertisementDataType, bytes]]

    Or patterns to pass to the AdvertisementMonitor1 D-Bus interface.

    Only used for passive scanning.

class bleak.args.bluez.OrPattern(start_position: int, ad_data_type: AdvertisementDataType, content_of_pattern: bytes)

  Bases: `NamedTuple`

  BlueZ advertisement monitor or-pattern.

  https://github.com/bluez/bluez/blob/master/doc/org.bluez.AdvertisementMonitor.rst#arrayuint8-uint8-arraybyte-patterns-read-only-optional

  ad_data_type: AdvertisementDataType

    Alias for field number 1

  content_of_pattern: bytes

    Alias for field number 2

  start_position: int

    Alias for field number 0

## bleak.args.corebluetooth module

### CoreBluetooth backend arguments

class bleak.args.corebluetooth.CBScannerArgs

  Bases: `TypedDict`

  Platform-specific `BleakScanner` args for the CoreBluetooth backend.

  use_bdaddr: bool

    If true, use Bluetooth address instead of UUID.

    Warning

    This uses an undocumented IOBluetooth API to get the Bluetooth address and may break in the future macOS releases. It is known to not work on macOS 10.15.

class bleak.args.corebluetooth.CBStartNotifyArgs

  Bases: `TypedDict`

  CoreBluetooth backend-specific dictionary of arguments for the `bleak.BleakClient.start_notify()` method.

  notification_discriminator: Callable[[bytes], bool] | None

    A function that takes a single argument of a characteristic value and returns `True` if the value is from a notification or `False` if the value is from a read response.

    See also

    Notifications for more info.

## bleak.args.winrt module

### WinRT backend arguments

class bleak.args.winrt.WinRTClientArgs

  Bases: `TypedDict`

  Windows-specific arguments for `BleakClient`.

  address_type: Literal['public', 'random']

    Can either be `"public"` or `"random"`, depending on the required address type needed to connect to your device.

  use_cached_services: bool

    `True` allows Windows to fetch the services, characteristics and descriptors from the Windows cache instead of reading them from the device. Can be very much faster for known, unchanging devices, but not recommended for DIY peripherals where the GATT layout can change between connections.

    `False` will force the attribute database to be read from the remote device instead of using the OS cache.

    If omitted, the OS Bluetooth stack will do what it thinks is best.

## Module contents

class bleak.args.SizedBuffer(*args, **kwargs)

  Bases: `Buffer`, `Sized`, `Protocol`

  Protocol for types that are both Buffer and Sized.

  Added in version 2.1.