API referenceVetraGlove ProC++

Reading and writing state

Channels & subscriptions

Current version · 2.0.0

Inherits the read operations of ReadChannel and adds state writes and clearing. device.haptics() returns a haptics state channel.

StateChannel<T>::set()

Write the current state; a haptics channel accepts haptic strength settings.

Type

void StateChannel<T>::set(const T& value) const;

Parameters

  • value: required, of type T; a haptics channel uses GloveHaptics (also exported as Haptics).

Returns

void.

Details

  • Call conditions: Device connected and haptics supported.

Errors

  • Parameter, rejection, or disconnection errors.

Example

device is connected, started, and supports fingertip haptics. Strength is in 0…127. Perform application work before clearing when a hold duration is needed; the complete example includes that duration.

auto haptics = device.haptics();
haptics.set(qnbot::Haptics{{{qnbot::GloveFinger::thumb, 30}}});
std::this_thread::sleep_for(std::chrono::milliseconds(500));
haptics.clear();

Complete example: haptics.cpp.

StateChannel<T>::clear()

Clear the current state; a haptics channel clears its haptic setting.

Type

void StateChannel<T>::clear() const;

Returns

void.

Details

  • Call conditions: Device connected and haptics supported.

Errors

  • Parameter, rejection, or disconnection errors.