API Reference

ContactGlove SDK v2 is a C++ library for interacting with ContactGlove devices.

Setup and integration

See the SDK guide for supported operating systems, CPU architectures, runtime and build requirements, distribution installation, CMake/C/Rust integration, and troubleshooting.

Examples

Connecting to and disconnecting from DivingStation

Use ConnectToHost to connect to DivingStation.

The connection information passed to ConnectToHost consists of a host name, IP address, DivingStation receive port, and SDK receive port. The host name is an arbitrary label used to distinguish hosts. The IP address is assigned to the computer running DivingStation. The DivingStation receive port accepts OSC requests from the SDK. It is normally 25791, but it can be changed in DivingStation; use the corresponding value when it is changed. The SDK receive port accepts data streams from DivingStation.

Use Disconnect to disconnect from DivingStation.

#include <chrono>
#include <iostream>
#include <thread>

#include "contactglove/ContactGloveSDKv2.hpp"

int main() {
    ContactGloveSDKv2::SDK sdk;

    // Set the connection information.
    ContactGloveSDKv2::Host host{"localhost", "127.0.0.1", 25791, 25788};

    // Connect to DivingStation.
    sdk.ConnectToHost(host);

    // Perform application-specific work.

    // Disconnect from DivingStation.
    sdk.Disconnect(host);

    return(0);
}

Querying data

The following functions retrieve information associated with a glove. Each returns the value available when the function is called.

Available valueFunction
Glove informationGetDataForGlove
Whether a glove supports hapticsDoesGloveSupportHaptics
Opening and bending angles for each finger jointGetErgonomicsDataForGlove
Position and rotation of each finger jointGetSkeletonDataForGlove
Raw sensor position and rotationGetRawSensorTransformsForGlove
Input from the controller attached to the gloveGetControllerDataForGlove
IDs of all connected glovesGetIdsOfAvailableGloves
Number of connected glovesGetNumberofAvailableGloves

Glove data arrives asynchronously. A successful ConnectToHost call starts the local session; it does not confirm approval or data reception. Use a glove ID received from DivingStation when querying data. When multiple gloves are present, select the intended device using its ID or properties such as isLeft.

The bundled share/ContactGloveSDKv2/examples/basic_usage.cpp demonstrates callbacks and polling with DivingStation on the same PC (127.0.0.1). It polls the first ID received and disconnects after approximately five seconds.

For LAN connections that require approval, keep the same session alive while waiting for approval and data. Calling Disconnect can discard pending or granted approval; a successful connection request does not confirm approval.

Receiving updates automatically

Register callback functions to receive automatic updates when glove-related values change. Callbacks run on the SDK receiver thread and may query cached data. An exception thrown by one callback is contained; the remaining callbacks and records are still delivered. Do not connect, disconnect, or destroy this SDK from a callback. Schedule connection management on another thread instead. Disconnect waits for active callbacks to finish. Finish callbacks that access the SDK before starting its destruction.

Update that triggers the callbackFunction
Glove informationRegisterCallbackForGloveDataStream
Opening and bending angles for each finger jointRegisterCallbackForErgonomicsStream
Position and rotation of each finger jointRegisterCallbackForSkeletonStream
Raw sensor position and rotationRegisterCallbackForRawSensorTransformsStream
Input from the controller attached to the gloveRegisterCallbackForControllerDataStream

See the bundled share/ContactGloveSDKv2/examples/basic_usage.cpp for a complete callback and polling example and its five-second lifetime.

C ABI and Rust bindings

include/contactglove/ContactGloveSDKv2C.h is the ContactGlove SDK v2 C++/C/Rust FFI header. It can be used directly from C with no additional header. The C ABI v2 exposes opaque handles, fixed-width numeric types, UTF-8 string views, caller-provided buffers, and subscription tokens.

Although most C ABI data structures correspond to the C++ types documented here, their lifetime and memory contracts differ. For polling results that include strings, the caller provides a buffer in cg_string_buffer_t. Even when CG_RESULT_BUFFER_TOO_SMALL is returned, length receives the required character count. Allocate sufficient storage and retry the same function. Memory returned by the SDK does not need to be freed.

Manage stream subscriptions with cg_sdk_subscribe_* and cg_sdk_unsubscribe. A callback view is valid only during the callback invocation. After cg_sdk_unsubscribe succeeds, its callback is not running. Disconnecting, destroying the SDK, or unsubscribing from within a callback is unsupported.

The v2 updates expose device field is_external_power_present and the invalid value battery_percentage=-1, tracking_state for ergonomics and skeleton data, profile_uuid for retargeted skeleton data, HandSkeletonRaw, and retarget profile information request and response messages. The Rust bindings expose the same query and callback surface. The numeric C ABI and Rust color fields use the DeviceColor values for the device display-color setting. Their numeric tracking_state fields use TrackingState values and the same display/diagnostic-only restriction for IkFailed and NotAttempted. While connected, the SDK resends Connect every 30 seconds and reuses the same send socket for Connect, Disconnect, and haptics requests.

The official Rust workspace is included in rust/ in distributions. contactglove-sdk-v2-sys provides the C ABI layer, while contactglove-sdk-v2 provides owned types and RAII subscriptions.

Defined types and functions

The following types and functions are defined by this SDK.

Classes

NameDescription
SDKMain class of the ContactGlove SDK.
GloveDataStructure holding glove device information.
HostStructure describing a DivingStation host.
Vec3Three-dimensional vector.
QuaternionQuaternion representing rotation.
TransformTransform combining position and rotation.
ControllerDataStructure holding controller input states.
ErgonomicsDataStructure holding finger opening and bending angle data.
SkeletonDataStructure holding hand skeleton data (joint positions and rotations).
RawSkeletonDataHand skeleton data before retargeting.
RetargetProfileInfoResponse containing retarget profile information.
RawSensorTransformsDataStructure holding raw sensor transform data for one hand.

Enumerations

NameDescription
DeviceFamilyTypeEnumeration of device families.
DeviceColorEnumeration of device display-color settings.
DeviceConnectedStateEnumeration of device connection states.
TrackingStateTracking state of IK-derived data.
SDKReturnCodeReturn codes used by SDK functions.
ButtonStatusEnumeration of button states.
ErgonomicsDataTypeEnumeration identifying the joint represented by each ergonomics data element.
SkeletonDataTypeEnumeration identifying the joint represented by each skeleton data element.

DeviceFamilyType

enum DeviceFamilyType

Enumeration of device families.

ContactGlove3 is the primary target.

ValueDescription
ContactGloveContactGlove.
ContactSheetContactSheet.
ContactGlove2ContactGlove2.
ContactGlove3ContactGlove3.

DeviceColor

enum DeviceColor

Enumeration of device display-color settings.

Migrating the display-color type name

DeviceColor is the public display-color type. Replace references such as LedColor::Green with DeviceColor::Green and rebuild. LedColor remains a C++ compatibility alias of DeviceColor, so existing source still compiles. Prefer DeviceColor in new code. The GloveData.color member name and numeric color values stay the same. The C ABI version remains 2. The C ABI and Rust integer color fields and the OSC wire format are unchanged.

ValueDescription
MagentaMagenta.
RedRed.
OrangeOrange.
YellowYellow.
GreenGreen.
CyanCyan.
BlueBlue.
AchromaticAchromatic.

DeviceConnectedState

enum DeviceConnectedState

Enumeration of device connection states.

ValueDescription
UnknownState unknown.
ConnectedConnected.
UnconnectedNot connected.
PairingConnection attempt in progress.

TrackingState

enum TrackingState

Tracking state of IK-derived data.

NotAttempted means the required IK pass was not performed. This includes earlier processing failures or missing input, and cases where pose calculation was deemed unnecessary, such as update-interval control reusing an existing pose. It does not itself indicate an IK failure.

IkFailed and NotAttempted values may be used for display and diagnostics, but must not be used for control, velocity estimation or interpolation. Only Tracked values are valid for those uses.

SkeletonData reports retarget IK; RawSkeletonData and ErgonomicsData report source skeleton IK. Their states can differ at the same time. For retarget IK, NotAttempted also includes a decision that pose calculation was unnecessary.

ValueDescription
TrackedValid result from the current IK pass.
IkFailedIK was attempted but failed.
NotAttemptedIK was not performed, including intentional update-interval skips.

SDKReturnCode

enum SDKReturnCode

Return codes used by SDK functions.

Indicates the result of a function call or the kind of error.

ValueDescription
SuccessOperation completed successfully.
SdkNotAvailableThe SDK or requested feature is unavailable.
NotConnectedNot connected to DivingStation.
InvalidIDThe specified ID does not exist.
InvalidArgumentAn argument is outside its valid range.

ButtonStatus

enum ButtonStatus

Enumeration of button states.

ValueDescription
UnpressedNot pressed.
TouchingTouch sensor detected contact.
PressedPressed.

ErgonomicsDataType

enum ErgonomicsDataType

Enumeration identifying the joint represented by each ergonomics data element.

Left-hand values are 0 through 19 and right-hand values are 20 through 39, but ErgonomicsData::data always holds only one hand (20 elements). To use a value as an index into ErgonomicsData::data, use static_cast<uint32_t>(type) % ERGONOMICS_DATA_COUNT. Values are in degrees.

Naming convention: (Left|Right){finger name}{joint name}{motion type}.

ValueDescription
LeftThumbCMCFlexLeft thumb CMC joint flexion angle.
LeftThumbMCPFlexLeft thumb MCP joint flexion angle.
LeftThumbIPFlexLeft thumb IP joint flexion angle.
LeftThumbMCPTiltLeft thumb MCP joint tilt angle.
LeftIndexMCPFlexLeft index finger MCP joint flexion angle.
LeftIndexPIPFlexLeft index finger PIP joint flexion angle.
LeftIndexDIPFlexLeft index finger DIP joint flexion angle.
LeftIndexMCPTiltLeft index finger MCP joint tilt angle.
LeftMiddleMCPFlexLeft middle finger MCP joint flexion angle.
LeftMiddlePIPFlexLeft middle finger PIP joint flexion angle.
LeftMiddleDIPFlexLeft middle finger DIP joint flexion angle.
LeftMiddleMCPTiltLeft middle finger MCP joint tilt angle.
LeftRingMCPFlexLeft ring finger MCP joint flexion angle.
LeftRingPIPFlexLeft ring finger PIP joint flexion angle.
LeftRingDIPFlexLeft ring finger DIP joint flexion angle.
LeftRingMCPTiltLeft ring finger MCP joint tilt angle.
LeftLittleMCPFlexLeft little finger MCP joint flexion angle.
LeftLittlePIPFlexLeft little finger PIP joint flexion angle.
LeftLittleDIPFlexLeft little finger DIP joint flexion angle.
LeftLittleMCPTiltLeft little finger MCP joint tilt angle.
RightThumbCMCFlexRight thumb CMC joint flexion angle.
RightThumbMCPFlexRight thumb MCP joint flexion angle.
RightThumbIPFlexRight thumb IP joint flexion angle.
RightThumbMCPTiltRight thumb MCP joint tilt angle.
RightIndexMCPFlexRight index finger MCP joint flexion angle.
RightIndexPIPFlexRight index finger PIP joint flexion angle.
RightIndexDIPFlexRight index finger DIP joint flexion angle.
RightIndexMCPTiltRight index finger MCP joint tilt angle.
RightMiddleMCPFlexRight middle finger MCP joint flexion angle.
RightMiddlePIPFlexRight middle finger PIP joint flexion angle.
RightMiddleDIPFlexRight middle finger DIP joint flexion angle.
RightMiddleMCPTiltRight middle finger MCP joint tilt angle.
RightRingMCPFlexRight ring finger MCP joint flexion angle.
RightRingPIPFlexRight ring finger PIP joint flexion angle.
RightRingDIPFlexRight ring finger DIP joint flexion angle.
RightRingMCPTiltRight ring finger MCP joint tilt angle.
RightLittleMCPFlexRight little finger MCP joint flexion angle.
RightLittlePIPFlexRight little finger PIP joint flexion angle.
RightLittleDIPFlexRight little finger DIP joint flexion angle.
RightLittleMCPTiltRight little finger MCP joint tilt angle.

SkeletonDataType

enum SkeletonDataType

Enumeration identifying the joint represented by each skeleton data element.

Use this enum to index SkeletonData::transforms. It maps to SKELETON_NODE_COUNT elements for one hand.

Naming convention: Skeleton{finger}{joint name} or Skeleton{finger}Tip.

ValueDescription
SkeletonWristWrist.
SkeletonThumbCMCThumb CMC joint.
SkeletonThumbMCPThumb MCP joint.
SkeletonThumbIPThumb IP joint.
SkeletonThumbTipThumb tip.
SkeletonIndexCMCIndex finger CMC joint.
SkeletonIndexMCPIndex finger MCP joint.
SkeletonIndexPIPIndex finger PIP joint.
SkeletonIndexDIPIndex finger DIP joint.
SkeletonIndexTipIndex finger tip.
SkeletonMiddleCMCMiddle finger CMC joint.
SkeletonMiddleMCPMiddle finger MCP joint.
SkeletonMiddlePIPMiddle finger PIP joint.
SkeletonMiddleDIPMiddle finger DIP joint.
SkeletonMiddleTipMiddle finger tip.
SkeletonRingCMCRing finger CMC joint.
SkeletonRingMCPRing finger MCP joint.
SkeletonRingPIPRing finger PIP joint.
SkeletonRingDIPRing finger DIP joint.
SkeletonRingTipRing finger tip.
SkeletonLittleCMCLittle finger CMC joint.
SkeletonLittleMCPLittle finger MCP joint.
SkeletonLittlePIPLittle finger PIP joint.
SkeletonLittleDIPLittle finger DIP joint.
SkeletonLittleTipLittle finger tip.

Typedefs

ReturnNameDescription
uint64_tTimestampInteger type representing Unix time in milliseconds.
std::stringGloveIdIdentifier of a glove device.
DeviceColorLedColorCompatibility alias for DeviceColor. Prefer DeviceColor in new code.
std::function< void(const GloveData &)>GloveDataStreamCallback_tCallback function type invoked when glove data is updated.
std::function< void(const ControllerData &)>ControllerDataStreamCallback_tCallback function type invoked when controller data is updated.
std::function< void(const ErgonomicsData &)>ErgonomicsStreamCallback_tCallback function type invoked when ergonomics data is updated.
std::function< void(const SkeletonData &)>SkeletonStreamCallback_tCallback function type invoked when skeleton data is updated.
std::function< void(const RawSkeletonData &)>RawSkeletonStreamCallback_t
std::function< void(const RawSensorTransformsData &)>RawSensorTransformsStreamCallback_tCallback function type invoked when raw sensor transform data is updated.
std::function< void(const RetargetProfileInfo &)>RetargetProfileInfoCallback_t

Timestamp

uint64_t Timestamp()

Integer type representing Unix time in milliseconds.


GloveId

std::string GloveId()

Identifier of a glove device.


LedColor

DeviceColor LedColor()

Compatibility alias for DeviceColor. Prefer DeviceColor in new code.


GloveDataStreamCallback_t

std::function< void(const GloveData &)> GloveDataStreamCallback_t()

Callback function type invoked when glove data is updated.


ControllerDataStreamCallback_t

std::function< void(const ControllerData &)> ControllerDataStreamCallback_t()

Callback function type invoked when controller data is updated.


ErgonomicsStreamCallback_t

std::function< void(const ErgonomicsData &)> ErgonomicsStreamCallback_t()

Callback function type invoked when ergonomics data is updated.


SkeletonStreamCallback_t

std::function< void(const SkeletonData &)> SkeletonStreamCallback_t()

Callback function type invoked when skeleton data is updated.


RawSkeletonStreamCallback_t

std::function< void(const RawSkeletonData &)> RawSkeletonStreamCallback_t()

RawSensorTransformsStreamCallback_t

std::function< void(const RawSensorTransformsData &)> RawSensorTransformsStreamCallback_t()

Callback function type invoked when raw sensor transform data is updated.


RetargetProfileInfoCallback_t

std::function< void(const RetargetProfileInfo &)> RetargetProfileInfoCallback_t()

Variables

ReturnNameDescription
uint32_tERGONOMICS_DATA_COUNTNumber of ergonomics data elements per hand (five fingers times four joints).
uint32_tSKELETON_NODE_COUNTNumber of skeleton nodes per hand (wrist, four thumb nodes, and five nodes for each of four fingers).
uint32_tSKELETON_DATA_COUNTNumber of skeleton transforms per hand.
uint32_tRAW_SENSOR_TRANSFORM_COUNTNumber of raw sensor transforms per hand.

ERGONOMICS_DATA_COUNT

uint32_t ERGONOMICS_DATA_COUNT = 20

Number of ergonomics data elements per hand (five fingers times four joints).


SKELETON_NODE_COUNT

uint32_t SKELETON_NODE_COUNT = 25

Number of skeleton nodes per hand (wrist, four thumb nodes, and five nodes for each of four fingers).


SKELETON_DATA_COUNT

uint32_t SKELETON_DATA_COUNT = SKELETON_NODE_COUNT

Number of skeleton transforms per hand.


RAW_SENSOR_TRANSFORM_COUNT

uint32_t RAW_SENSOR_TRANSFORM_COUNT = 5

Number of raw sensor transforms per hand.

SDK

#include <contactglove/ContactGloveSDKv2.hpp>

Main class of the ContactGlove SDK.

Public Methods

ReturnNameDescription
SDK
SDKDeleted constructor.
SDKReturnCodeConnectToHostConnect to DivingStation and start data streams.
SDKReturnCodeDisconnectDisconnect from DivingStation.
SDKReturnCodeDoesGloveSupportHaptics constQuery whether a glove supports haptics.
SDKReturnCodeGetDataForGlove constRetrieve glove information by glove ID.
SDKReturnCodeGetControllerDataForGlove constRetrieve controller input data by glove ID.
SDKReturnCodeGetErgonomicsDataForGlove constRetrieve finger opening and bending angle data by glove ID.
SDKReturnCodeGetSkeletonDataForGlove constRetrieve joint position and rotation data by glove ID.
SDKReturnCodeGetRawSkeletonDataForGlove constRetrieve pre-retarget hand skeleton data by glove ID.
SDKReturnCodeGetRawSensorTransformsForGlove constRetrieve raw sensor transform data by glove ID.
SDKReturnCodeGetIdsOfAvailableGloves constRetrieve IDs of all currently recognized gloves.
SDKReturnCodeGetNumberofAvailableGloves constRetrieve the total number of currently recognized gloves.
SDKReturnCodeVibrateGloveVibrate a glove.
SDKReturnCodeRequestRetargetProfileInfoSend a request for retarget profile information.
SDKReturnCodeRegisterCallbackForGloveDataStreamRegister a callback invoked when glove information is updated.
SDKReturnCodeRegisterCallbackForControllerDataStreamRegister a callback invoked when controller data is updated.
SDKReturnCodeRegisterCallbackForErgonomicsStreamRegister a callback invoked when ergonomics data is updated.
SDKReturnCodeRegisterCallbackForSkeletonStreamRegister a callback invoked when skeleton data is updated.
SDKReturnCodeRegisterCallbackForRawSkeletonStream
SDKReturnCodeRegisterCallbackForRawSensorTransformsStreamRegister a callback invoked when raw sensor transform data is updated.
SDKReturnCodeRegisterCallbackForRetargetProfileInfoStream

SDK

SDK()

SDK

SDK(const SDK &) = delete

Deleted constructor.


ConnectToHost

SDKReturnCode ConnectToHost(const Host & p_Host)

Connect to DivingStation and start data streams.

Calling again with the same endpoint and ports resends Connect using the existing socket, including its OS-selected source port when sendPort is 0. Use this for automatic retries while awaiting LAN approval or recovering from lost data. Success means the request was started; it does not confirm LAN approval. Disconnect explicitly ends the session and can revoke approval.

Parameters

  • p_Host Host information for the target DivingStation instance.

Returns

SDKReturnCode::Success — Connection started successfully.

Returns

SDKReturnCode::SdkNotAvailable — Failed to open a socket.

Returns

SDKReturnCode::InvalidArgument — p_Host.sendPort is greater than 65535.

Returns

SDKReturnCode::InvalidArgument — The receive port is already in use by a connection with a different IP address, destination port, or send port.


Disconnect

SDKReturnCode Disconnect(const Host & p_Host)

Disconnect from DivingStation.

Parameters

  • p_Host Host information to disconnect. It must match the value passed to ConnectToHost().

Returns

SDKReturnCode::Success — Disconnected successfully.

Returns

SDKReturnCode::NotConnected — No connection exists for the specified port.


DoesGloveSupportHaptics

const

SDKReturnCode DoesGloveSupportHaptics(const std::string & id, bool * p_IsHaptics) const

Query whether a glove supports haptics.

Parameters

  • id ID of the glove to query.

  • p_IsHaptics Output location for whether haptics are supported; must not be null.

Returns

SDKReturnCode::Success — Value retrieved successfully.

Returns

SDKReturnCode::InvalidID — The specified glove does not exist.


GetDataForGlove

const

SDKReturnCode GetDataForGlove(const std::string & id, GloveData * p_GloveData) const

Retrieve glove information by glove ID.

Parameters

  • id ID of the glove to retrieve.

  • p_GloveData Output location for the retrieved data; must not be null.

Returns

SDKReturnCode::Success — Data retrieved successfully.

Returns

SDKReturnCode::InvalidID — The specified glove does not exist.


GetControllerDataForGlove

const

SDKReturnCode GetControllerDataForGlove(const std::string & id, ControllerData * p_Controller) const

Retrieve controller input data by glove ID.

Parameters

  • id ID of the glove to retrieve.

  • p_Controller Output location for the retrieved data; must not be null.

Returns

SDKReturnCode::Success — Data retrieved successfully.

Returns

SDKReturnCode::InvalidID — No data exists for the specified ID, or p_Controller is null.


GetErgonomicsDataForGlove

const

SDKReturnCode GetErgonomicsDataForGlove(const std::string & id, ErgonomicsData * p_ErgonomicsData) const

Retrieve finger opening and bending angle data by glove ID.

Parameters

  • id ID of the glove to retrieve.

  • p_ErgonomicsData Output location for the retrieved data; must not be null.

Returns

SDKReturnCode::Success — Data retrieved successfully.

Returns

SDKReturnCode::InvalidID — No data exists for the specified ID, or p_ErgonomicsData is null.


GetSkeletonDataForGlove

const

SDKReturnCode GetSkeletonDataForGlove(const std::string & id, SkeletonData * p_SkeletonData) const

Retrieve joint position and rotation data by glove ID.

Parameters

  • id ID of the glove to retrieve.

  • p_SkeletonData Output location for the retrieved data; must not be null.

Returns

SDKReturnCode::Success — Data retrieved successfully.

Returns

SDKReturnCode::InvalidID — No data exists for the specified ID, or p_SkeletonData is null.


GetRawSkeletonDataForGlove

const

SDKReturnCode GetRawSkeletonDataForGlove(const std::string & id, RawSkeletonData * p_RawSkeletonData) const

Retrieve pre-retarget hand skeleton data by glove ID.


GetRawSensorTransformsForGlove

const

SDKReturnCode GetRawSensorTransformsForGlove(const std::string & id, RawSensorTransformsData * p_RawSensorTransforms) const

Retrieve raw sensor transform data by glove ID.

Parameters

  • id ID of the glove to retrieve.

  • p_RawSensorTransforms Output location for the retrieved data; must not be null.

Returns

SDKReturnCode::Success — Data retrieved successfully.

Returns

SDKReturnCode::InvalidID — No data exists for the specified ID, or p_RawSensorTransforms is null.


GetIdsOfAvailableGloves

const

SDKReturnCode GetIdsOfAvailableGloves(GloveId * p_IdsOfAvailableGloves, uint32_t p_NumberOfIdsThatFitInArray) const

Retrieve IDs of all currently recognized gloves.

When the output array is too small, only the first p_NumberOfIdsThatFitInArray IDs are written. Query the total count in advance with GetNumberofAvailableGloves().

Parameters

  • p_IdsOfAvailableGloves Pointer to the first element of the output ID array; must not be null.

  • p_NumberOfIdsThatFitInArray Capacity of the output array in elements.

Returns

SDKReturnCode::Success — Data retrieved successfully.

Returns

SDKReturnCode::InvalidID — p_IdsOfAvailableGloves is null.


GetNumberofAvailableGloves

const

SDKReturnCode GetNumberofAvailableGloves(uint32_t * n) const

Retrieve the total number of currently recognized gloves.

Parameters

  • n Output location for the count; must not be null.

Returns

SDKReturnCode::Success — Data retrieved successfully.

Returns

SDKReturnCode::InvalidID — n is null.


VibrateGlove

SDKReturnCode VibrateGlove(const std::string & id, float frequency, float amplitude, float duration)

Vibrate a glove.

Parameters

  • id ID of the glove to vibrate.

  • frequency Vibration frequency in Hz (100.0 to 500.0).

  • amplitude Vibration amplitude (0.0 to 1.0).

  • duration Vibration duration in seconds (0.001 to 1.0).

Returns

SDKReturnCode::Success — Request sent successfully.

Returns

SDKReturnCode::InvalidID — The specified glove does not exist.

Returns

SDKReturnCode::InvalidArgument — An argument is outside its valid range.


RequestRetargetProfileInfo

SDKReturnCode RequestRetargetProfileInfo(const std::string & profileUuid, int32_t requestId)

Send a request for retarget profile information.


RegisterCallbackForGloveDataStream

SDKReturnCode RegisterCallbackForGloveDataStream(GloveDataStreamCallback_t p_Callback)

Register a callback invoked when glove information is updated.

The callback receives a GloveData argument.

Parameters

  • p_Callback Callback function to register.

Returns

SDKReturnCode::Success — Registered successfully.


RegisterCallbackForControllerDataStream

SDKReturnCode RegisterCallbackForControllerDataStream(ControllerDataStreamCallback_t p_Callback)

Register a callback invoked when controller data is updated.

Parameters

  • p_Callback Callback function to register.

Returns

SDKReturnCode::Success — Registered successfully.


RegisterCallbackForErgonomicsStream

SDKReturnCode RegisterCallbackForErgonomicsStream(ErgonomicsStreamCallback_t p_Callback)

Register a callback invoked when ergonomics data is updated.

Parameters

  • p_Callback Callback function to register.

Returns

SDKReturnCode::Success — Registered successfully.


RegisterCallbackForSkeletonStream

SDKReturnCode RegisterCallbackForSkeletonStream(SkeletonStreamCallback_t p_Callback)

Register a callback invoked when skeleton data is updated.

Parameters

  • p_Callback Callback function to register.

Returns

SDKReturnCode::Success — Registered successfully.


RegisterCallbackForRawSkeletonStream

SDKReturnCode RegisterCallbackForRawSkeletonStream(RawSkeletonStreamCallback_t p_Callback)

RegisterCallbackForRawSensorTransformsStream

SDKReturnCode RegisterCallbackForRawSensorTransformsStream(RawSensorTransformsStreamCallback_t p_Callback)

Register a callback invoked when raw sensor transform data is updated.

Parameters

  • p_Callback Callback function to register.

Returns

SDKReturnCode::Success — Registered successfully.


RegisterCallbackForRetargetProfileInfoStream

SDKReturnCode RegisterCallbackForRetargetProfileInfoStream(RetargetProfileInfoCallback_t p_Callback)

GloveData

#include <contactglove/ContactGloveSDKv2.hpp>

Structure holding glove device information.

Corresponds to data received at OSC address /DS2/HC/Device.

Public Attributes

ReturnNameDescription
std::stringidDevice ID.
std::stringpairIdID of the paired glove; empty when no pair exists.
int32_tbatteryPercentageBattery percentage [0 - 100]; -1 when invalid.
boolisHapticsWhether haptics are supported.
boolisLeftWhether this is a left-hand glove.
DeviceFamilyTypefamilyTypeDevice family.
DeviceColorcolorDevice display-color setting.
DeviceConnectedStateconnectedStateConnection state.
std::stringnameDevice name.
boolisExternalPowerPresentWhether external power is detected.

id

std::string id

Device ID.


pairId

std::string pairId

ID of the paired glove; empty when no pair exists.


batteryPercentage

int32_t batteryPercentage = -1

Battery percentage [0 - 100]; -1 when invalid.


isHaptics

bool isHaptics = false

Whether haptics are supported.


isLeft

bool isLeft = false

Whether this is a left-hand glove.


familyType

DeviceFamilyType familyType = DeviceFamilyType::ContactGlove

Device family.


color

DeviceColor color = DeviceColor::Achromatic

Device display-color setting.


connectedState

DeviceConnectedState connectedState = DeviceConnectedState::Unknown

Connection state.


name

std::string name

Device name.


isExternalPowerPresent

bool isExternalPowerPresent = false

Whether external power is detected.

Host

#include <contactglove/ContactGloveSDKv2.hpp>

Structure describing a DivingStation host.

Pass this structure to ConnectToHost() and Disconnect(). port is the OSC receive port on DivingStation. receivePort is the OSC receive port on the SDK. sendPort is the OSC send port on the SDK; when it is 0, the operating system selects an available port.

Public Attributes

ReturnNameDescription
std::stringhostNameArbitrary label used to distinguish hosts, for example "localhost".
std::stringipAddressIP address, for example "127.0.0.1".
uint32_tportOSC receive port on DivingStation.
uint32_treceivePortOSC receive port on the SDK.
uint32_tsendPortOSC send port on the SDK; 0 lets the OS select a port.

hostName

std::string hostName

Arbitrary label used to distinguish hosts, for example "localhost".


ipAddress

std::string ipAddress

IP address, for example "127.0.0.1".


port

uint32_t port = 25791

OSC receive port on DivingStation.


receivePort

uint32_t receivePort = 25788

OSC receive port on the SDK.


sendPort

uint32_t sendPort = 0

OSC send port on the SDK; 0 lets the OS select a port.

Vec3

#include <contactglove/ContactGloveSDKv2.hpp>

Three-dimensional vector.

Public Attributes

ReturnNameDescription
floatxX component.
floatyY component.
floatzZ component.

x

float x = 0.0f

X component.


y

float y = 0.0f

Y component.


z

float z = 0.0f

Z component.

Quaternion

#include <contactglove/ContactGloveSDKv2.hpp>

Quaternion representing rotation.

Public Attributes

ReturnNameDescription
floatwScalar component.
floatxX component.
floatyY component.
floatzZ component.

w

float w = 1.0f

Scalar component.


x

float x = 0.0f

X component.


y

float y = 0.0f

Y component.


z

float z = 0.0f

Z component.

Transform

#include <contactglove/ContactGloveSDKv2.hpp>

Transform combining position and rotation.

Used as each element of SkeletonData::transforms.

Public Attributes

ReturnNameDescription
Vec3positionPosition.
QuaternionrotationRotation.

position

Vec3 position

Position.


rotation

Quaternion rotation

Rotation.

ControllerData

#include <contactglove/ContactGloveSDKv2.hpp>

Structure holding controller input states.

Public Attributes

ReturnNameDescription
std::stringidGlove ID.
boolisLeftWhether this is the left hand.
ButtonStatusaButtonA button state.
ButtonStatusbButtonB button state.
ButtonStatussysButtonSystem button state.
ButtonStatustriggerButtonTrigger button state.
ButtonStatusjoystickButtonJoystick button state.
ButtonStatustrackpadButtonTrackpad touch state.
floattriggerTrigger value (0.0 to 1.0).
floatgripValueGrip value (0.0 to 1.0).
floatgripForceGrip force (0.0 to 1.0).
floatjoystickXJoystick X-axis value (-1.0 to 1.0).
floatjoystickYJoystick Y-axis value (-1.0 to 1.0).
floattrackpadXTrackpad X-axis value (-1.0 to 1.0).
floattrackpadYTrackpad Y-axis value (-1.0 to 1.0).

id

std::string id

Glove ID.


isLeft

bool isLeft = false

Whether this is the left hand.


aButton

ButtonStatus aButton = ButtonStatus::Unpressed

A button state.


bButton

ButtonStatus bButton = ButtonStatus::Unpressed

B button state.


sysButton

ButtonStatus sysButton = ButtonStatus::Unpressed

System button state.


triggerButton

ButtonStatus triggerButton = ButtonStatus::Unpressed

Trigger button state.


joystickButton

ButtonStatus joystickButton = ButtonStatus::Unpressed

Joystick button state.


trackpadButton

ButtonStatus trackpadButton = ButtonStatus::Unpressed

Trackpad touch state.


trigger

float trigger = 0.0f

Trigger value (0.0 to 1.0).


gripValue

float gripValue = 0.0f

Grip value (0.0 to 1.0).


gripForce

float gripForce = 0.0f

Grip force (0.0 to 1.0).


joystickX

float joystickX = 0.0f

Joystick X-axis value (-1.0 to 1.0).


joystickY

float joystickY = 0.0f

Joystick Y-axis value (-1.0 to 1.0).


trackpadX

float trackpadX = 0.0f

Trackpad X-axis value (-1.0 to 1.0).


trackpadY

float trackpadY = 0.0f

Trackpad Y-axis value (-1.0 to 1.0).

ErgonomicsData

#include <contactglove/ContactGloveSDKv2.hpp>

Structure holding finger opening and bending angle data.

data has ERGONOMICS_DATA_COUNT elements for one hand. Values are in degrees. See ErgonomicsDataType for the meaning of each index.

Public Attributes

ReturnNameDescription
std::stringidGlove ID.
boolisLeftWhether this is the left hand.
TimestampgeneratedAtFrame generation time (Unix time in milliseconds).
TrackingStatetrackingStateTracking state of IK-derived data.
std::array< float, ERGONOMICS_DATA_COUNT >dataOpening and bending angle values per joint (20 elements for one hand, in degrees).

id

std::string id

Glove ID.


isLeft

bool isLeft = false

Whether this is the left hand.


generatedAt

Timestamp generatedAt = 0

Frame generation time (Unix time in milliseconds).


trackingState

TrackingState trackingState = TrackingState::Tracked

Tracking state of IK-derived data.


data

std::array< float, ERGONOMICS_DATA_COUNT > data {}

Opening and bending angle values per joint (20 elements for one hand, in degrees).

SkeletonData

#include <contactglove/ContactGloveSDKv2.hpp>

Structure holding hand skeleton data (joint positions and rotations).

transforms has SKELETON_DATA_COUNT elements for one hand. See SkeletonDataType for the meaning of each index. Positions are in meters in a right-handed hand-model coordinate system rooted at the wrist. +X points from the fingertips toward the wrist, +Y from the palm toward the back of the hand, and +Z from little finger to thumb on the right hand and from thumb to little finger on the left hand. Rotations are local quaternions relative to the parent joint; wrist and fingertip rotations are identity placeholders, not measured rotations. These conventions apply to skeleton transforms; raw sensor rotations instead represent orientations in hand-model space.

Public Attributes

ReturnNameDescription
std::stringidGlove ID.
std::stringprofileUuidStable UUID of the retarget profile.
boolisLeftWhether this is the left hand.
TimestampgeneratedAtFrame generation time (Unix time in milliseconds).
TrackingStatetrackingStateTracking state of retarget IK.
std::array< Transform, SKELETON_DATA_COUNT >transformsPosition and rotation per node (25 elements).

id

std::string id

Glove ID.


profileUuid

std::string profileUuid

Stable UUID of the retarget profile.


isLeft

bool isLeft = false

Whether this is the left hand.


generatedAt

Timestamp generatedAt = 0

Frame generation time (Unix time in milliseconds).


trackingState

TrackingState trackingState = TrackingState::Tracked

Tracking state of retarget IK.


transforms

std::array< Transform, SKELETON_DATA_COUNT > transforms {}

Position and rotation per node (25 elements).

RawSkeletonData

#include <contactglove/ContactGloveSDKv2.hpp>

Hand skeleton data before retargeting.

Public Attributes

ReturnNameDescription
std::stringid
boolisLeft
TimestampgeneratedAt
TrackingStatetrackingState
std::array< Transform, SKELETON_DATA_COUNT >transforms

id

std::string id

isLeft

bool isLeft = false

generatedAt

Timestamp generatedAt = 0

trackingState

TrackingState trackingState = TrackingState::Tracked

transforms

std::array< Transform, SKELETON_DATA_COUNT > transforms {}

RetargetProfileInfo

#include <contactglove/ContactGloveSDKv2.hpp>

Response containing retarget profile information.

Public Attributes

ReturnNameDescription
int32_trequestId
std::stringprofileUuid
int32_tstatus
std::stringname
std::stringdescription

requestId

int32_t requestId = 0

profileUuid

std::string profileUuid

status

int32_t status = 0

name

std::string name

description

std::string description

RawSensorTransformsData

#include <contactglove/ContactGloveSDKv2.hpp>

Structure holding raw sensor transform data for one hand.

Corresponds to data received at OSC address /DS2/HC/RawSensorTransforms. Each transform is expressed in the same right-handed model-rooted space as /DS2/HC/HandSkeleton. Its position is the sensor center relative to the wrist, and its rotation is the orientation from the sensor local frame to model-rooted space. transforms contains RAW_SENSOR_TRANSFORM_COUNT elements in thumb, index, middle, ring, and little finger order.

Public Attributes

ReturnNameDescription
std::stringidGlove ID.
boolisLeftWhether this is the left hand.
TimestampgeneratedAtFrame generation time (Unix time in milliseconds).
std::array< Transform, RAW_SENSOR_TRANSFORM_COUNT >transformsPosition and rotation per sensor (five elements for one hand).

id

std::string id

Glove ID.


isLeft

bool isLeft = false

Whether this is the left hand.


generatedAt

Timestamp generatedAt = 0

Frame generation time (Unix time in milliseconds).


transforms

std::array< Transform, RAW_SENSOR_TRANSFORM_COUNT > transforms {}

Position and rotation per sensor (five elements for one hand).

Generated by Moxygen

On this page

Setup and integrationExamplesConnecting to and disconnecting from DivingStationQuerying dataReceiving updates automaticallyC ABI and Rust bindingsDefined types and functionsClassesEnumerationsDeviceFamilyTypeDeviceColorDeviceConnectedStateTrackingStateSDKReturnCodeButtonStatusErgonomicsDataTypeSkeletonDataTypeTypedefsTimestampGloveIdLedColorGloveDataStreamCallback_tControllerDataStreamCallback_tErgonomicsStreamCallback_tSkeletonStreamCallback_tRawSkeletonStreamCallback_tRawSensorTransformsStreamCallback_tRetargetProfileInfoCallback_tVariablesERGONOMICS_DATA_COUNTSKELETON_NODE_COUNTSKELETON_DATA_COUNTRAW_SENSOR_TRANSFORM_COUNTSDKPublic MethodsSDKSDKConnectToHostParametersReturnsReturnsReturnsReturnsDisconnectParametersReturnsReturnsDoesGloveSupportHapticsParametersReturnsReturnsGetDataForGloveParametersReturnsReturnsGetControllerDataForGloveParametersReturnsReturnsGetErgonomicsDataForGloveParametersReturnsReturnsGetSkeletonDataForGloveParametersReturnsReturnsGetRawSkeletonDataForGloveGetRawSensorTransformsForGloveParametersReturnsReturnsGetIdsOfAvailableGlovesParametersReturnsReturnsGetNumberofAvailableGlovesParametersReturnsReturnsVibrateGloveParametersReturnsReturnsReturnsRequestRetargetProfileInfoRegisterCallbackForGloveDataStreamParametersReturnsRegisterCallbackForControllerDataStreamParametersReturnsRegisterCallbackForErgonomicsStreamParametersReturnsRegisterCallbackForSkeletonStreamParametersReturnsRegisterCallbackForRawSkeletonStreamRegisterCallbackForRawSensorTransformsStreamParametersReturnsRegisterCallbackForRetargetProfileInfoStreamGloveDataPublic AttributesidpairIdbatteryPercentageisHapticsisLeftfamilyTypecolorconnectedStatenameisExternalPowerPresentHostPublic AttributeshostNameipAddressportreceivePortsendPortVec3Public AttributesxyzQuaternionPublic AttributeswxyzTransformPublic AttributespositionrotationControllerDataPublic AttributesidisLeftaButtonbButtonsysButtontriggerButtonjoystickButtontrackpadButtontriggergripValuegripForcejoystickXjoystickYtrackpadXtrackpadYErgonomicsDataPublic AttributesidisLeftgeneratedAttrackingStatedataSkeletonDataPublic AttributesidprofileUuidisLeftgeneratedAttrackingStatetransformsRawSkeletonDataPublic AttributesidisLeftgeneratedAttrackingStatetransformsRetargetProfileInfoPublic AttributesrequestIdprofileUuidstatusnamedescriptionRawSensorTransformsDataPublic AttributesidisLeftgeneratedAttransforms