API referenceVetraGlove ProC++

Capture sessions

Capture & calibration

Current version · 2.0.0

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

CaptureSessionSnapshot CaptureSession::snapshot() const;

Details

  • The session must remain open.

See also

CaptureSession::confirm()

Confirm the current request so capture can continue.

Type

void CaptureSession::confirm(const std::string& request_id) const;

Parameters

  • request_id: required; a non-empty identifier from the latest progress or session snapshot.

Returns

void.

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.

const auto snapshot = session.snapshot();
const auto& allowed = snapshot.allowed_operations;
if (snapshot.request_id && std::find(allowed.begin(), allowed.end(),
        qnbot::CaptureControlAction::confirm) != allowed.end()) {
    session.confirm(*snapshot.request_id);
}

Related complete Capture workflow: host_capture_calibration.cpp.

See also

CaptureSession::skip()

Skip the current capture stage when skipping is allowed.

Type

void CaptureSession::skip(const std::string& request_id) const;

Parameters

  • request_id: required; a non-empty identifier from the latest progress or session snapshot.

Returns

void.

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.

const auto snapshot = session.snapshot();
const auto& allowed = snapshot.allowed_operations;
if (snapshot.request_id && std::find(allowed.begin(), allowed.end(),
        qnbot::CaptureControlAction::skip) != allowed.end()) {
    session.skip(*snapshot.request_id);
}

Related complete Capture workflow: host_capture_calibration.cpp.

See also

CaptureSession::retry()

Retry the specified capture stage.

Type

void CaptureSession::retry(const std::string& stage_id) const;

Parameters

  • stage_id: required; a non-empty identifier from the latest progress or session snapshot.

Returns

void.

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.

const auto snapshot = session.snapshot();
const auto& allowed = snapshot.allowed_operations;
if (std::find(allowed.begin(), allowed.end(),
        qnbot::CaptureControlAction::retry) != allowed.end()) {
    session.retry(stage_id);
}

Related complete Capture workflow: host_capture_calibration.cpp.

See also

CaptureSession::cancel()

Cancel this capture session without a request identifier.

Type

void CaptureSession::cancel() const;

Returns

void.

Details

  • The session must remain open.

See also

CaptureSession::result()

Read the completed capture result.

Type

std::optional<CaptureResult> CaptureSession::result() const;

Returns

std::optional<CaptureResult>. 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.

if (const auto result = session.result()) {
    for (const auto& stage : result->stage_samples) {
        std::cout << stage.stage_id << " " << stage.frame_count << '\n';
    }
}

Related complete Capture workflow: host_capture_calibration.cpp.

See also

CaptureSession::close()

Close the current scope and release its resources.

Type

void CaptureSession::close() const;

Returns

void.

Details

  • Release the session handle; a closed session cannot be queried or controlled.

See also