Capture sessions
Capture & calibration
Returned by device.start_capture() to control one manual capture. Keep the completed session open while passing it to start_calibration().
CaptureSession.snapshot()
Read a snapshot of the current session state.
Type
CaptureSession.snapshot() -> CaptureSessionSnapshotReturns
Details
- The session must remain open.
See also
CaptureSession.confirm()
Confirm the current request so capture can continue.
Type
CaptureSession.confirm(request_id: str) -> NoneParameters
request_id: required; a non-empty identifier from the latest progress or session snapshot.
Returns
None.
Details
- The session must remain open.
- Empty identifiers raise
InvalidArgumentError; stale requests, disallowed operations, and non-retryable stages are rejected.
Example
Obtain session from start_capture(). After the user confirms the action, check the latest snapshot’s allowed operations and submit the token from that same snapshot.
from qnbot_sdk.glove import CaptureControlAction
snapshot = session.snapshot()
if (CaptureControlAction.CONFIRM in snapshot.allowed_operations
and snapshot.request_id is not None):
session.confirm(snapshot.request_id)Related complete Capture workflow: host_capture_calibration.py.
See also
CaptureSession.skip()
Skip the current capture stage when skipping is allowed.
Type
CaptureSession.skip(request_id: str) -> NoneParameters
request_id: required; a non-empty identifier from the latest progress or session snapshot.
Returns
None.
Details
- The session must remain open.
- Empty identifiers raise
InvalidArgumentError; stale requests, disallowed operations, and non-retryable stages are rejected.
Example
session is an active Capture session and the user has requested skipping. Check whether the current snapshot allows SKIP rather than relying on a previously observed optional flag.
from qnbot_sdk.glove import CaptureControlAction
snapshot = session.snapshot()
if (CaptureControlAction.SKIP in snapshot.allowed_operations
and snapshot.request_id is not None):
session.skip(snapshot.request_id)Related complete Capture workflow: host_capture_calibration.py.
See also
CaptureSession.retry()
Retry the specified capture stage.
Type
CaptureSession.retry(stage_id: str) -> NoneParameters
stage_id: required; a non-empty identifier from the latest progress or session snapshot.
Returns
None.
Details
- The session must remain open.
- Empty identifiers raise
InvalidArgumentError; stale requests, disallowed operations, and non-retryable stages are rejected.
Example
Select stage_id from plan.stages in the latest snapshot and ensure that stage is currently retryable. Do not invent IDs or reuse stage IDs from another session.
from qnbot_sdk.glove import CaptureControlAction
snapshot = session.snapshot()
if CaptureControlAction.RETRY in snapshot.allowed_operations:
session.retry(stage_id)Related complete Capture workflow: host_capture_calibration.py.
See also
CaptureSession.cancel()
Cancel this capture session without a request identifier.
Type
CaptureSession.cancel() -> NoneReturns
None.
Details
- The session must remain open.
See also
CaptureSession.result()
Read the completed capture result.
Type
CaptureSession.result() -> CaptureResult | NoneReturns
CaptureResult | None. See CaptureResult.
Details
- The session must remain open.
- Returns an empty value before completion; see CaptureResult for fields.
Example
Keep session open. If no result is available, continue Capture rather than treating it as an empty result. Retain the completed session for starting Calibration.
result = session.result()
if result is not None:
for stage in result.stage_samples:
print(stage.stage_id, stage.frame_count)Related complete Capture workflow: host_capture_calibration.py.
See also
CaptureSession.close()
Close the current scope and release its resources.
Type
CaptureSession.close() -> NoneReturns
None.
Details
- Release the session handle; a closed session cannot be queried or controlled.
See also