pb_client.service.Service.scanning
async
¶
scanning(*, seconds=10.0, name=None, transport=None)
Scan, reporting each hub as it is seen rather than at the end.
The iterator yields one item per advertisement, so the same hub arrives many times over a scan with its signal strength as it is now. That is the point: a hub's signal is how someone works out which of two identically named hubs is the one on the desk in front of them. Callers that only want a list should use scan.
Leaving the block early stops the scan, so a caller can take the first hub it likes and get on with it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
seconds
|
float | None
|
How long the service should look, or |
10.0
|
name
|
str | None
|
Only report hubs with this name. |
None
|
transport
|
str | None
|
Only look on this transport, such as |
None
|
Yields:
| Type | Description |
|---|---|
AsyncGenerator[AsyncIterator[DeviceInfo], None]
|
An iterator over the hubs seen, ending when the scan does -- which, |
AsyncGenerator[AsyncIterator[DeviceInfo], None]
|
with no time limit, means when the block is left. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If this connection has no notification router, which would leave the iterator silently empty. |