toio.cube.api.configuration module

class toio.cube.api.configuration.RequestProtocolVersion[source]

Bases: CubeCommand

Protocol version request command

References

https://toio.github.io/toio-spec/en/docs/ble_configuration#requesting-the-ble-protocol-version

__init__() None[source]
__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.configuration.SetHorizontalDetectionThreshold(threshold: int)[source]

Bases: CubeCommand

Horizontal detection threshold setting command

References

https://toio.github.io/toio-spec/en/docs/ble_configuration#horizontal-detection-threshold-settings

__init__(threshold: int) None[source]
__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.configuration.SetCollisionDetectionThreshold(threshold: int)[source]

Bases: CubeCommand

Collision detection threshold setting command

References

https://toio.github.io/toio-spec/en/docs/ble_configuration#collision-detection-threshold-settings

__init__(threshold: int) None[source]
__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.configuration.SetDoubleTapDetectionTimeInterval(threshold: int)[source]

Bases: CubeCommand

Double-tap detection time interval setting command

References

https://toio.github.io/toio-spec/en/docs/ble_configuration#double-tap-detection-time-interval-settings

__init__(threshold: int) None[source]
__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.configuration.NotificationCondition(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Notification conditions of ID notification

References

https://toio.github.io/toio-spec/en/docs/ble_configuration#notification-conditions

Always = 0
ChangeDetection = 1
Periodic = 255
class toio.cube.api.configuration.SetIdNotification(interval_ms: int, condition: NotificationCondition)[source]

Bases: CubeCommand

ID notification setting command

References

https://toio.github.io/toio-spec/en/docs/ble_configuration#identification-sensor-id-notification-settings

__init__(interval_ms: int, condition: NotificationCondition) None[source]
__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.configuration.SetIdMissedNotification(sensitivity_ms: int)[source]

Bases: CubeCommand

ID missed notification setting command

References

https://toio.github.io/toio-spec/en/docs/ble_configuration#identification-sensor-id-missed-notification-settings

__init__(sensitivity_ms: int) None[source]
__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.configuration.MagneticSensorFunction(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Disable = 0
MagnetState = 1
MagneticForce = 2
class toio.cube.api.configuration.MagneticSensorCondition(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Always = 0
ChangeDetection = 1
class toio.cube.api.configuration.SetMagneticSensor(function_type: MagneticSensorFunction, interval_ms: int, condition: MagneticSensorCondition)[source]

Bases: CubeCommand

Magnet sensor setting command

References

https://toio.github.io/toio-spec/en/docs/ble_configuration#magnetic-sensor-settings-

__init__(function_type: MagneticSensorFunction, interval_ms: int, condition: MagneticSensorCondition) None[source]
__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.configuration.MotorSpeedInformationAcquisitionState(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Disable = 0
Enable = 1
class toio.cube.api.configuration.SetMotorSpeedInformationAcquisition(state: MotorSpeedInformationAcquisitionState)[source]

Bases: CubeCommand

Motor speed information acquisition setting command

References

https://toio.github.io/toio-spec/en/docs/ble_configuration#motor-speed-information-acquisition-settings

__init__(state: MotorSpeedInformationAcquisitionState) None[source]
__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.configuration.PostureAngleDetectionType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Euler = 1
Quaternions = 2
class toio.cube.api.configuration.PostureAngleDetectionCondition(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Notification condition of posture angle detection

References

https://toio.github.io/toio-spec/en/docs/ble_configuration#notification-conditions-1

Always = 0
ChangeDetection = 1
class toio.cube.api.configuration.SetPostureAngleDetection(detection_type: PostureAngleDetectionType, interval_ms: int, condition: PostureAngleDetectionCondition)[source]

Bases: CubeCommand

Posture angle detection setting command

References

https://toio.github.io/toio-spec/en/docs/ble_configuration#posture-angle-detection-settings-

__init__(detection_type: PostureAngleDetectionType, interval_ms: int, condition: PostureAngleDetectionCondition)[source]
__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.configuration.ProtocolVersion(payload: bytearray)[source]

Bases: CubeResponse

Protocol version response

version

version (UTF-8)

Type:

str

References

https://toio.github.io/toio-spec/en/docs/ble_configuration#obtaining-the-ble-protocol-version

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.configuration.ResponseIdNotificationSettings(payload: bytearray)[source]

Bases: CubeResponse

ID notification setting response

result

Result of the command

Type:

bool

References

https://toio.github.io/toio-spec/en/docs/ble_configuration#responses-to-identification-sensor-id-notification-settings

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.configuration.ResponseIdMissedNotificationSettings(payload: bytearray)[source]

Bases: CubeResponse

ID missed notification setting response

result

Result of the command

Type:

bool

References

https://toio.github.io/toio-spec/en/docs/ble_configuration#responses-to-identification-sensor-id-missed-notification-settings

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.configuration.ResponseMagneticSensorSettings(payload: bytearray)[source]

Bases: CubeResponse

Magnetic sensor setting response

result

Result of the command

Type:

bool

References

https://toio.github.io/toio-spec/en/docs/ble_configuration#responses-to-magnetic-sensor-settings

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.configuration.ResponseMotorSpeedInformationAcquisitionSettings(payload: bytearray)[source]

Bases: CubeResponse

Motor speed information setting response

result

Result of the command

Type:

bool

References

https://toio.github.io/toio-spec/en/docs/ble_configuration#responses-to-motor-speed-information-acquisition-settings

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.configuration.ResponsePostureAngleDetectionSettings(payload: bytearray)[source]

Bases: CubeResponse

Posture angle detection setting response

result

Result of the command

Type:

bool

References

https://toio.github.io/toio-spec/en/docs/ble_configuration#responses-to-posture-angle-detection-settings-

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).

toio.cube.api.configuration.ConfigurationResponseType

Response types of configuration characteristic

alias of Union[ProtocolVersion, ResponseIdNotificationSettings, ResponseIdMissedNotificationSettings, ResponseMagneticSensorSettings, ResponseMotorSpeedInformationAcquisitionSettings, ResponsePostureAngleDetectionSettings]

class toio.cube.api.configuration.Configuration(interface: CubeInterface)[source]

Bases: CubeCharacteristic

Configuration characteristic

References

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

static is_my_data(payload: bytearray) ProtocolVersion | ResponseIdNotificationSettings | ResponseIdMissedNotificationSettings | ResponseMagneticSensorSettings | ResponseMotorSpeedInformationAcquisitionSettings | ResponsePostureAngleDetectionSettings | 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) None[source]
async request_protocol_version() None[source]

Send protocol version request command

This function DO NOT return response payload. Receive the result by notification.

References

https://toio.github.io/toio-spec/en/docs/ble_configuration#requesting-the-ble-protocol-version

async set_horizontal_detection_threshold(threshold: int) None[source]

Send horizontal detection threshold setting command

This function DO NOT return response payload. Receive the result by notification.

Parameters:

threshold (int) – Threshold

References

https://toio.github.io/toio-spec/en/docs/ble_configuration#horizontal-detection-threshold-settings

async set_collision_detection_threshold(threshold: int) None[source]

Send collision detection threshold setting request command

This function DO NOT return response payload. Receive the result by notification.

Parameters:

threshold (int) – Threshold

References

https://toio.github.io/toio-spec/en/docs/ble_configuration#collision-detection-threshold-settings

async set_double_tap_detection_threshold(threshold: int) None[source]

Send double-tap detection threshold setting request command

This function DO NOT return response payload. Receive the result by notification.

Parameters:

threshold (int) – Threshold

References

https://toio.github.io/toio-spec/en/docs/ble_configuration#double-tap-detection-time-interval-settings

async set_id_notification(interval_ms: int, condition: NotificationCondition) None[source]

Send id information notification setting request command

This function DO NOT return response payload. Receive the result by notification.

Parameters:

References

https://toio.github.io/toio-spec/en/docs/ble_configuration#identification-sensor-id-notification-settings

async set_id_missed_notification(sensitivity_ms: int) None[source]

Send ID missed notification setting request command

This function DO NOT return response payload. Receive the result by notification.

Parameters:

sensitivity_ms (int) – Sensitivity [ms]

References

https://toio.github.io/toio-spec/en/docs/ble_configuration#identification-sensor-id-missed-notification-settings

async set_magnetic_sensor(function_type: MagneticSensorFunction, interval_ms: int, condition: MagneticSensorCondition) None[source]

Send magnetic sensor setting request command

This function DO NOT return response payload. Receive the result by notification.

Parameters:

References

https://toio.github.io/toio-spec/en/docs/ble_configuration#magnetic-sensor-settings-

async set_motor_speed_information_acquisition(state: MotorSpeedInformationAcquisitionState) None[source]

Send motor speed information acquisition setting request command

This function DO NOT return response payload. Receive the result by notification.

Parameters:

state (MotorSpeedInformationAcquisitionState) – state

References

https://toio.github.io/toio-spec/en/docs/ble_configuration#motor-speed-information-acquisition-settings

async set_posture_angle_detection(detection_type: PostureAngleDetectionType, interval_ms: int, condition: PostureAngleDetectionCondition) None[source]

Send posture angle setting request command

This function DO NOT return response payload. Receive the result by notification.

Parameters:

References

https://toio.github.io/toio-spec/en/docs/ble_configuration#posture-angle-detection-settings-