Runtime and status data
Data models
UpdateResult
UpdateResult is returned by sdk.update() or glove.update() and is used to view how many tasks this manual scheduling executed and whether there are still subsequent tasks, and to wait for the next task to become due.
Fields
| Field | Type | Nullable | Description |
|---|---|---|---|
tick | int | No | Current update sequence number |
ran_task_count | int | No | The number of tasks executed this time |
has_next_task | bool | No | Whether a periodic task deadline exists; observation only, not a gate for sleep() |
sleep() | () -> SleepResult | — | Waits for the next task to become due; each result can be called only once |
Example
Glove is started in manual scheduling mode. Call sleep() once per result; do not use has_next_task to decide whether to call it.
from qnbot_sdk import SleepResult
import time
update = glove.update()
print(update.tick, update.ran_task_count)
if update.sleep() is SleepResult.NO_TASKS:
time.sleep(0.01)Complete example: manual_runtime.py.
GloveStatus
GloveStatus is the device status published by device.status(), used to observe the current connection, whether the data is stale, the most recent error and the number of successful recoveries.
Fields
| Field | Type | Nullable | Description |
|---|---|---|---|
device_type | str | No | Device type |
connected | bool | No | Whether it is currently connected |
stale | bool | No | Whether the current data is already stale or has not started flowing yet |
timestamp | float | No | Status timestamp |
last_error | str | None | Yes | The most recent device error; None when there is no error |
reconnect_count | int | No | The cumulative number of successful connection recoveries |
fields | dict[str, object] | No | Additional status related to the device type; can be an empty mapping |
DeviceHealth
DeviceHealth is the device health summary corresponding to each source in Health.devices, used to view the connection, data freshness and most recent error of multiple gloves at the same time.
Fields
| Field | Type | Nullable | Description |
|---|---|---|---|
connected | bool | No | Whether the device is connected |
stale | bool | No | Whether the device data is stale or has not started flowing yet |
last_error | str | None | Yes | The most recent device error |
Health
Health is returned by sdk.health() or glove.health() and is used to summarize the warnings, errors, device status and scheduling status of the SDK or all gloves.
Fields
| Field | Type | Nullable | Description |
|---|---|---|---|
ok | bool | No | Whether the current summary status is healthy |
warning_count | int | No | The number of warnings in the current summary |
error_count | int | No | The number of errors in the current summary |
devices | dict[str, DeviceHealth] | No | Mapping from source ID to device health status |
last_error | str | None | Yes | The most recent SDK error |
runtime_overrun | bool | No | Whether SDK scheduling has ever overrun |
topic_callback_error | bool | No | Whether an unhandled exception has ever occurred in a callback |
CalibrationReadiness
CalibrationReadiness is returned by device.calibration_status() and is used to determine whether the specified target requires no calibration, can be used directly or needs recalibration for the current wearer.
Fields
| Field | Type | Nullable | Description |
|---|---|---|---|
state | CalibrationReadinessState | No | NOT_REQUIRED, READY or NEEDS_CALIBRATION |
operator_id | str | No | The wearer identifier used for this determination |