Scanner¶
- spherov2.scanner.find_toys(*, timeout=5.0, toy_types: Optional[Iterable[Type[Toy]]] = None, toy_names: Optional[Iterable[str]] = None, adapter=None) List[Toy] [source]¶
Find toys that matches the criteria given.
- Parameters:
timeout – Device scanning timeout, in seconds.
toy_types – Iterable of toy types (subclasses of
Toy
) that needs to be scanned. Set toNone
to scan all toy types available.toy_names – Iterable of strings of toy names that needs to be scanned. Set to
None
to scan toys with all kinds of names.adapter – Kind of adapter to use for scanning bluetooth devices. Set to
None
to use defaultBleakAdapter
.
- Returns:
A list of toys that are scanned.
- spherov2.scanner.find_toy(*, toy_name: Optional[str] = None, **kwargs) Toy [source]¶
Find a single toy that matches the criteria given.
- Parameters:
toy_name – A string of toy name that needs to be scanned. Set to
None
to scan toy with all kinds of names.timeout – Device scanning timeout, in seconds.
toy_types – List of toy types (subclasses of
Toy
) that needs to be scanned. Set toNone
to scan all toy types available.adapter – Kind of adapter to use for scanning bluetooth devices. Set to
None
to use defaultBleakAdapter
.
- Returns:
A toy that is scanned.
- Raises:
ToyNotFoundError – If no toys could be found