bleak.args package
Submodules
bleak.args.bluez module
BlueZ backend arguments
- class bleak.args.bluez.BlueZDiscoveryFilters[source]
Bases:
TypedDictDictionary of arguments for the
org.bluez.Adapter1.SetDiscoveryFilterD-Bus method.- 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 Duplicatesparameter of theLE Set Scan EnableHCI command to the Bluetooth adapter!Although the default value for BlueZ is
True, Bleak sets this toFalseby 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_uuidsargument ofbleak.BleakScanneris used instead.
- class bleak.args.bluez.BlueZNotifyArgs[source]
Bases:
TypedDictbleak.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[source]
Bases:
TypedDictBleakScannerargs 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)[source]
Bases:
NamedTupleBlueZ advertisement monitor or-pattern.
- 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[source]
Bases:
TypedDictPlatform-specific
BleakScannerargs 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[source]
Bases:
TypedDictCoreBluetooth 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
Trueif the value is from a notification orFalseif 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[source]
Bases:
TypedDictWindows-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
Trueallows 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.Falsewill 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.