toio.cube.api.button module¶
- class toio.cube.api.button.ButtonState(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
Value of the state of cube button
- RELEASED = 0¶
- PRESSED = 128¶
- class toio.cube.api.button.ButtonInformation(payload: bytearray)[source]¶
Bases:
CubeResponse
Cube button state response
- state¶
State of the cube button
- Type:
References
https://toio.github.io/toio-spec/en/docs/ble_button#read-operations
- toio.cube.api.button.ButtonResponseType¶
Response type of button characteristic
- class toio.cube.api.button.Button(interface: CubeInterface, device: Any)[source]¶
Bases:
CubeCharacteristic
Button characteristic
References
https://toio.github.io/toio-spec/en/docs/ble_button
- static is_my_data(payload: bytearray) → ButtonInformation | None[source]¶
If payload is my characteristic response, this function returns CubeResponse object. Otherwise, it returns None.
- Parameters:
payload (GattReadData) – received data from the cube.
- __init__(interface: CubeInterface, device: Any)[source]¶
- async read() → ButtonInformation | None[source]¶
Read the state of button
- Returns:
ButtonInformation or None (None returns when read fails)
References
https://toio.github.io/toio-spec/en/docs/ble_button#read-operations