scanner.py
scanner
¶
Scanning tools for finding mugs.
Attributes¶
Classes¶
ScannerKwargs
¶
Bases: typing.TypedDict
Optional kwargs for scanner.
Source code in ember_mug/scanner.py
20 21 22 23 24 |
|
Functions¶
build_scanner_kwargs
¶
build_scanner_kwargs(
adapter: str | None = None,
*,
service_uuids: list[str] | None = None
) -> scanner.ScannerKwargs
Add Adapter to kwargs for scanner if specified and using BlueZ.
Source code in ember_mug/scanner.py
32 33 34 35 36 37 38 |
|
discover_devices
async
¶
discover_devices(
mac: str | None = None,
adapter: str | None = None,
wait: int = 5,
) -> list[
tuple[
bleak.backends.device.BLEDevice,
bleak.backends.scanner.AdvertisementData,
]
]
Discover new devices in pairing mode.
Example:¶
```python
devices = await discover_devices()
for device, advertisement in devices:
print(device.address, advertisement)
```
Source code in ember_mug/scanner.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
|
find_device
async
¶
find_device(
mac: str | None = None,
adapter: str | None = None,
timeout: int = scanner.DEFAULT_TIMEOUT,
) -> (
tuple[
bleak.backends.device.BLEDevice,
bleak.backends.scanner.AdvertisementData,
]
| tuple[None, None]
)
Find a device that has previously been discovered.
Example:¶
```python
device = await find_device("my:mac:addr")
```
Source code in ember_mug/scanner.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
|