# Args modules

In order to use some platform-specific features, Bleak provides platform-specific arguments to various constructors and methods. This modules all live in the `bleak.args` sub-package.

## BlueZ backend arguments

class bleak.args.bluez.BlueZDiscoveryFilters

  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

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

  Added in version 2.1.

  use_start_notify: bool

    If true, use the “StartNotify” D-Bus method instead of “AcquireNotify” to subscribe to notifications.

    This is needed in rare cases to work around BlueZ quirks. For example, some peripherals may send notifications immediately after writing to the CCCD descriptor, before the write response is sent. In this case, “AcquireNotify” will miss the notification, whereas “StartNotify” will work correctly.

class bleak.args.bluez.BlueZScannerArgs

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

  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)

  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

## CoreBluetooth backend arguments

class bleak.args.corebluetooth.CBScannerArgs

  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

  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.

## WinRT backend arguments

class bleak.args.winrt.WinRTClientArgs

  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.