toio.device_interface.ble module¶
BLE device interface
- class toio.device_interface.ble.BleCube(device: BLEDevice | str)[source]¶
Bases:
CubeInterface
Cube interface for internal BLE interface.
- class toio.device_interface.ble.BleScanner[source]¶
Bases:
ScannerInterface
Scanner for internal BLE interface.
- async scan(num: int | None = None, cube_id: set[str] | None = None, address: set[str] | None = None, sort: Literal['rssi', 'local_name'] | None = None, timeout: float = 5.0) list[toio.device_interface.CubeInfo] [source]¶
Scan toio Core Cubes. Argument ‘num’, ‘cube_id’, and ‘address’ is exclusive.
- Parameters:
num (Optional[int], optional) – Number of cubes to be found. Defaults to None.
cube_id (Optional[set[str]], optional) – Set of cube id to be found. Defaults to None.
address (Optional[set[str]], optional) – Set of cube BLE address to be found. Defaults to None.
sort (SortKey, optional) – Key to sort results. Defaults to None (no sort).
timeout (float, optional) – Scan timeout. Defaults to DEFAULT_SCAN_TIMEOUT.
- Returns:
List of found cubes
- Return type:
list[CubeInfo]
Notes
If the cube named “31j” is found in scanning, this function warns it. If you specify the name “31j” to find the cube, this function warns it.
“31j” is wrong name. This name appears when the toio Core Cube fall wrong state. To recover this, turn off the cube and back again.