bleak.args package
Submodules
bleak.args.bluez module
BlueZ backend arguments
- class bleak.args.bluez.BlueZDiscoveryFilters[source]
Bases:
TypedDict
Dictionary of arguments for the
org.bluez.Adapter1.SetDiscoveryFilter
D-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 Duplicates
parameter of theLE Set Scan Enable
HCI command to the Bluetooth adapter!Although the default value for BlueZ is
True
, Bleak sets this toFalse
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 ofbleak.BleakScanner
is used instead.
- class bleak.args.bluez.BlueZScannerArgs[source]
Bases:
TypedDict
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)[source]
Bases:
NamedTuple
BlueZ 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:
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[source]
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 orFalse
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[source]
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.