toio.cube.api.id_information module

class toio.cube.api.id_information.PositionId(payload: bytearray)[source]

Bases: CubeResponse

Position id information response

References

https://toio.github.io/toio-spec/en/docs/ble_id#position-id

static is_myself(payload: 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.

__init__(payload: bytearray)[source]
__str__() str[source]

Return str(self).

class toio.cube.api.id_information.StandardId(payload: bytearray)[source]

Bases: CubeResponse

Standard id information response

References

https://toio.github.io/toio-spec/en/docs/ble_id#standard-id

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.

__init__(payload: bytearray)[source]
__str__() str[source]

Return str(self).

class toio.cube.api.id_information.PositionIdMissed(payload: bytearray)[source]

Bases: CubeResponse

Position id missed response

References

https://toio.github.io/toio-spec/en/docs/ble_id#position-id-missed

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.

__init__(payload: bytearray)[source]
__str__() str[source]

Return str(self).

class toio.cube.api.id_information.StandardIdMissed(payload: bytearray)[source]

Bases: CubeResponse

Standard id information response

References

https://toio.github.io/toio-spec/en/docs/ble_id#standard-id-missed

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.

__init__(payload: bytearray)[source]
__str__() str[source]

Return str(self).

toio.cube.api.id_information.IdInformationResponseType

Response types of id information characteristic

alias of Union[PositionId, StandardId, PositionIdMissed, StandardIdMissed]

class toio.cube.api.id_information.IdInformation(interface: CubeInterface, device: Any)[source]

Bases: CubeCharacteristic

ID sensor characteristic

References

https://toio.github.io/toio-spec/en/docs/ble_id

static is_my_data(payload: bytearray) PositionId | StandardId | PositionIdMissed | StandardIdMissed | 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() PositionId | StandardId | PositionIdMissed | StandardIdMissed | None[source]

Read id information response

Returns:

One of IdInformationData or None (None returns when read fails)