toio.cube.api.base_class module

class toio.cube.api.base_class.CubeCommand[source]

Bases: object

abstract __bytes__() bytes[source]

Returns the byte representation of this class to be sent to cube.

Returns:

byte representation of this class to be sent to cube.

Return type:

bytes

class toio.cube.api.base_class.CubeResponse[source]

Bases: object

abstract static is_myself(data: bytearray) bool[source]

If argument data is a byte representation of this class, this function converts the byte representation to an object and returns it.

Parameters:

data (GattReadData) – received data from the cube.

class toio.cube.api.base_class.CubeCharacteristic(interface: CubeInterface, uuid: UUID)[source]

Bases: object

abstract static is_my_data(payload: bytearray) CubeResponse | 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, uuid: UUID)[source]
async register_notification_handler(handler: Callable[[bytearray], None | Awaitable[None]]) bool[source]

User interface to GATT for registering handler function.

async unregister_notification_handler(handler: Callable[[bytearray], None | Awaitable[None]] | None) bool[source]

User interface to GATT for unregistering handler function.