API referenceVetraGlove ProC++

Glove management

Core interfaces

Current version · 2.0.0

Returned by sdk.glove(), this object controls all configured gloves. Use device() to select one glove.

Glove::device()

Select a configured glove.

Type

GloveDevice Glove::device() const;
GloveDevice Glove::device(const std::string& name) const;
GloveDevice Glove::device(Side side) const;
GloveDevice Glove::device(const std::string& name, Side side) const;

Parameters

  • None, name, Side, or name and Side together

Returns

GloveDevice.

Details

  • Call conditions: After SDK creation.

Errors

  • NotFoundSelectionError, AmbiguousSelectionError.

Example

The Glove scope has both left and right devices configured. Stopping the right device leaves the left one running.

auto left = glove.device(qnbot::Side::left);
auto right = glove.device(qnbot::Side::right);
left.start();
right.start();
right.stop();

Complete example: Multiple-device lifecycle example.

Glove::sync_time()

Set one external absolute time reference for every Glove source.

Type

void Glove::sync_time(double reference_time_ms) const;

Parameters

  • double reference_time_ms, a finite Unix-millisecond value

Returns

void.

Details

  • Call conditions: Prefer before start(); may be called again while running to resynchronize.

Errors

  • InvalidArgumentError, ClosedHandleError, or native synchronization errors.

After synchronization, newly generated device status timestamps and their source_time, CaptureResult.created_at, and CalibrationResult.created_at use the synchronized time reference. Existing samples and saved results are unchanged. observed_at and runtime waits remain on the SDK monotonic clock.

Example

Keep glove open. This example uses the host Unix clock in milliseconds; replace it with your actual external time source.

const auto elapsed = std::chrono::system_clock::now().time_since_epoch();
const double reference_time_ms =
    std::chrono::duration<double, std::milli>(elapsed).count();
glove.sync_time(reference_time_ms);

Complete example: Time-sync example.

Glove::start()

Start devices and capabilities in this object’s scope.

Type

void Glove::start() const;
void Glove::start(CalibrationMode mode) const;

Parameters

  • mode: CalibrationMode, default automatic. Omission uses the automatic mode.
  • The explicit overload accepts CalibrationMode::automatic, manual, or none.

Returns

void.

Details

  • Call conditions: The corresponding lifecycle stage.

Errors

  • Connection, lifecycle, or close errors.

Example

Choose MANUAL mode when the application manages Capture and Calibration. Prepare channels and subscriptions before starting; the complete example shows the subsequent workflow.

glove.start(qnbot::CalibrationMode::manual);

Related complete Capture workflow: host_capture_calibration.cpp.

See also

Glove::update()

Perform one SDK scheduling pass and return its update result.

Type

UpdateResult Glove::update() const;

Returns

UpdateResult.

Details

  • Call conditions: Started; choose one of the three methods.
  • Call sleep() on each result only once; see Runtime for run modes and wait semantics.

Errors

  • LifecycleError, background runtime errors.

Example

Obtain glove from sdk.glove() and prepare channels and subscriptions before starting. Call sleep() once per update result, and do not start a background runner at the same time.

glove.start();
for (int i = 0; i < 100; ++i) {
    const auto update = glove.update();
    if (update.sleep() == qnbot::SleepResult::no_tasks) {
        std::this_thread::sleep_for(std::chrono::milliseconds(10));
    }
}
glove.close();

Complete example: manual_runtime.cpp.

See also

Glove::run_forever()

Advance SDK scheduling on the current thread until stopped.

Type

void Glove::run_forever() const;

Returns

void.

Details

  • Call conditions: Started; choose one of the three methods.
  • Blocks the current thread; do not mix with background execution or manual update().

Errors

  • LifecycleError, background runtime errors.

Example

Obtain glove from sdk.glove() and prepare channels and subscriptions before starting. This call occupies the current thread. See the complete example for shutdown handling.

glove.start();
glove.run_forever();
glove.close();

Complete example: foreground_runtime.cpp.

See also

Glove::run_background()

Start background scheduling so the current thread can continue.

Type

void Glove::run_background() const;

Returns

void.

Details

  • Call conditions: Started; choose one of the three methods.
  • Mutually exclusive with run_forever() and manual update(). Request stop and call join() to finish.

Errors

  • LifecycleError, background runtime errors.

Example

Obtain glove from sdk.glove() and prepare channels and subscriptions before starting. The application thread remains available. Request shutdown, join the thread, and then close the scope.

glove.start();
glove.run_background();
std::this_thread::sleep_for(std::chrono::seconds(1));
glove.request_stop();
glove.join();
glove.close();

Complete example: background_runtime.cpp.

See also

Glove::request_stop()

Request that the current run loop stop.

Type

void Glove::request_stop() const;

Returns

void.

Errors

  • LifecycleError, background errors.

See also

Glove::join()

Wait for the background thread and report background runtime errors.

Type

void Glove::join() const;

Returns

void.

Details

  • Call request_stop() first. This method reports background errors; do not omit the wait.

Errors

  • LifecycleError, background errors.

See also

Glove::stop()

Stop the current scope and disconnect its devices.

Type

void Glove::stop() const;

Returns

void.

Details

  • The scope can be started again; stopping a device cancels active calibration.

Errors

  • Connection, lifecycle, or close errors.

See also

Glove::close()

Close the current scope and release its resources.

Type

void Glove::close() const;

Returns

void.

Errors

  • Connection, lifecycle, or close errors.

See also

Glove::health()

Read the health summary for the current scope.

Type

Health Glove::health() const;

Returns

Health.

Details

  • Call conditions: Glove not closed.

Errors

  • ClosedHandleError.