Group Functions

group Functions

Functions exported by the LeapC library.

Functions

int64_t LeapGetNow(void)

Samples the universal clock used by the system to timestamp image and tracking frames.

The returned counter value is given in microseconds since an epoch time. The clock used for the counter itself is implementation-defined, but generally speaking, it is global, monotonic, and makes use of the most accurate high-performance counter available on the system.

Since

3.0.0

Returns

microseconds since an unspecified epoch.

eLeapRS LeapCreateConnection(const LEAP_CONNECTION_CONFIG *pConfig, LEAP_CONNECTION *phConnection)

Creates a new LEAP_CONNECTION object.

Pass the LEAP_CONNECTION pointer to LeapOpenConnection() to establish a connection to the Ultraleap Tracking Service; and to subsequent operations on the same connection.

Since

3.0.0

Parameters
  • pConfig – The configuration to be used with the newly created connection. If pConfig is null, a connection is created with a default configuration.

  • phConnection[out] Receives a pointer to the connection object, set to invalid on failure

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapSetConnectionMetadata(LEAP_CONNECTION hConnection, const char *metadata, size_t len)

Optionally sets connection metadata prior to opening the connection to the service.

This optional function has no functional effect.

If used, this must be called before a call to LeapOpenConnection.

Caller can safely free the memory after the function returns.

Note: Any null characters will be copied into the string if they are within the length defined.

Since

5.10.0

Parameters
  • hConnection – A handle to the connection object, created by LeapCreateConnection().

  • metadata – A char array representing the metadata string.

  • len – The length of the metadata string, not including the null terminator.

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapOpenConnection(LEAP_CONNECTION hConnection)

Opens a connection to the service.

This routine will not block. A connection to the service will not be established until the first invocation of LeapPollConnection.

Since

3.0.0

Parameters

hConnection – A handle to the connection object, created by LeapCreateConnection().

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapGetConnectionInfo(LEAP_CONNECTION hConnection, LEAP_CONNECTION_INFO *pInfo)

Retrieves status information about the specified connection.

Call LeapCreateConnection() to generate the handle for the connection; call LeapOpenConnection() to establish the connection; then call this function to check the connection status.

Since

3.0.0

Parameters
  • hConnection – The handle of the connection of interest. Created by LeapCreateConnection.

  • pInfo[out] A pointer to a buffer that receives additional connection information. One input, the size field of pInfo is the size of the buffer(i.e. the size of a LEAP_CONNECTION_INFO struct); On output, the size field of pInfo receives the size necessary to hold the entire information block.

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapSetPolicyFlags(LEAP_CONNECTION hConnection, uint64_t set, uint64_t clear)

Sets or clears one or more policy flags.

Changing policies is asynchronous. After you call this function, a subsequent call to LeapPollConnection provides a LEAP_POLICY_EVENT containing the current policies, reflecting any changes.

To get the current policies without changes, specify zero for both the set and clear parameters. When ready, LeapPollConnection() provides a LEAP_POLICY_EVENT containing the current settings.

The eLeapPolicyFlag enumeration defines the policy flags.

Since

3.0.0

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • set – A bitwise combination of flags to be set. Set to 0 if not setting any flags.

  • clear – A bitwise combination of flags to be cleared. Set to 0 to if not clearing any flags.

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapSetPolicyFlagsEx(LEAP_CONNECTION hConnection, LEAP_DEVICE hDevice, uint64_t set, uint64_t clear)

Sets or clears one or more policy flags for a particular device.

Changing policies is asynchronous. After you call this function, a subsequent call to LeapPollConnection provides a LEAP_POLICY_EVENT containing the current policies, reflecting any changes.

To get the current policies without changes, specify zero for both the set and clear parameters. When ready, LeapPollConnection() provides a LEAP_POLICY_EVENT containing the current settings.

The eLeapPolicyFlag enumeration defines the policy flags.

Since

5.4.0

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • hDevice – A device handle returned by LeapOpenDevice().

  • set – A bitwise combination of flags to be set. Set to 0 if not setting any flags.

  • clear – A bitwise combination of flags to be cleared. Set to 0 if not clearing any flags.

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapSetTrackingMode(LEAP_CONNECTION hConnection, eLeapTrackingMode mode)

Requests a tracking mode.

Changing tracking modes is asynchronous. After you call this function, a subsequent call to LeapPollConnection provides a LEAP_POLICY_EVENT containing the current policies, reflecting any changes.

The eLeapTrackingMode enumeration defines the tracking mode.

Since

5.0.0

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • mode – The enum value specifying the requested tracking mode

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapSetTrackingModeEx(LEAP_CONNECTION hConnection, LEAP_DEVICE hDevice, eLeapTrackingMode mode)

Requests a tracking mode for a particular device.

Changing tracking modes is asynchronous. After you call this function, a subsequent call to LeapPollConnection provides a LEAP_POLICY_EVENT containing the current policies, reflecting any changes.

The eLeapTrackingMode enumeration defines the tracking mode.

Since

5.4.0

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • hDevice – A device handle returned by LeapOpenDevice().

  • mode – The enum value specifying the requested tracking mode.

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapGetTrackingMode(LEAP_CONNECTION hConnection)

Requests the currently set tracking mode.

Requesting the current tracking mode is asynchronous. After you call this function, a subsequent call to LeapPollConnection provides a LEAP_TRACKING_MODE_EVENT containing the current tracking mode, reflecting any changes.

The eLeapTrackingMode enumeration defines the tracking mode.

Since

5.0.0

Parameters

hConnection – The connection handle created by LeapCreateConnection().

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapGetTrackingModeEx(LEAP_CONNECTION hConnection, LEAP_DEVICE hDevice)

Requests the currently set tracking mode for a particular device.

Requesting the current tracking mode is asynchronous. After you call this function, a subsequent call to LeapPollConnection provides a LEAP_TRACKING_MODE_EVENT containing the current tracking mode, reflecting any changes.

The eLeapTrackingMode enumeration defines the tracking mode.

Since

5.4.0

Parameters
Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapSetPause(LEAP_CONNECTION hConnection, bool pause)

Pauses the service.

Attempts to pause or unpause the service depending on the argument. This is treated as a ‘user pause’, as though a user had requested a pause through the Leap Control Panel. The connection must have the AllowPauseResume policy set or it will fail with eLeapRS_InvalidArgument.

Since

4.0.0

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • pause – Set to ‘true’ to pause, or ‘false’ to unpause.

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapSetAllocator(LEAP_CONNECTION hConnection, const LEAP_ALLOCATOR *allocator)

Sets the allocator functions to use for a particular connection.

If user-supplied allocator functions are not supplied, the functions that require dynamic memory allocation will not be available.

Since

4.0.0

Parameters
  • hConnection – A handle to the connection object, created by LeapCreateConnection().

  • allocator – A pointer to a structure containing the allocator functions to be called as needed by the library.

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapSaveConfigValue(LEAP_CONNECTION hConnection, const char *key, const LEAP_VARIANT *value, uint32_t *pRequestID)

Causes the client to commit a configuration change to the Ultraleap Tracking Service.

The change is performed asynchronously and may fail. LeapPollConnection() returns this event structure when the request has been processed. Use the pRequestID value to correlate the response to the originating request.

Since

3.0.0

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • key – The key of the configuration to commit.

  • value – The value of the configuration to commit.

  • pRequestID[out] A pointer to a memory location to which the id for this request is written, or nullptr if this value is not needed.

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapRequestConfigValue(LEAP_CONNECTION hConnection, const char *key, uint32_t *pRequestID)

Requests the current value of a service configuration setting.

The value is fetched asynchronously since it requires a service transaction. LeapPollConnection() returns this event structure when the request has been processed. Use the pRequestID value to correlate the response to the originating request.

Since

3.0.0

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • key – The key of the configuration to request

  • pRequestID[out] A pointer to a memory location to which the id for this request is written.

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapGetDeviceList(LEAP_CONNECTION hConnection, LEAP_DEVICE_REF *pArray, uint32_t *pnArray)

Retrieves a list of Ultraleap Tracking camera devices currently attached to the system.

To get the number of connected devices, call this function with the pArray parameter set to null. The number of devices is written to the memory specified by pnArray. Use the device count to create an array of LEAP_DEVICE_REF structs large enough to hold the number of connected devices. Finally, call LeapGetDeviceList() with this array and known count to get the list of Leap devices. A device must be opened with LeapOpenDevice() before device properties can be queried.

Since

3.0.0

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • pArray[out] A pointer to an array that LeapC fills with the device list.

  • pnArray[inout] On input, set to the number of elements in pArray; on output, LeapC sets this to the number of valid device handles.

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapOpenDevice(LEAP_DEVICE_REF rDevice, LEAP_DEVICE *phDevice)

Opens a device reference and retrieves a handle to the device.

To ensure resources are properly freed, users must call LeapCloseDevice() when finished with the device, even if the retrieved device has problems or cannot stream.

Since

3.0.0

Parameters
  • rDevice – A device reference.

  • phDevice[out] A pointer that receives the opened device handle.

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapSetPrimaryDevice(LEAP_CONNECTION hConnection, LEAP_DEVICE hDevice, bool unsubscribeOthers)

For a multi-device aware client, sets the device to use in the context of non-“Ex” API functions which are logically device-specific but don’t provide a device parameter.

Automatically subscribes to the specified device (see LeapSubscribeEvents()), and if unsubscribeOthers is true, then unsubscribes from all other devices as well (see LeapUnsubscribeEvents()).

Affects future invocations of the following functions:

It is not necessary to call this function from a client that does not claim to be multi-device-aware (see eLeapConnectionConfig and LeapCreateConnection).

Since

5.4.0

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • hDevice – A device handle returned by LeapOpenDevice().

  • unsubscribeOthers – If true, unsubscribe from all other devices.

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapSubscribeEvents(LEAP_CONNECTION hConnection, LEAP_DEVICE hDevice)

Subscribe to event messages based on device.

If events from multiple devices are being sent from a service, this function allows the client to receive events from the specified device. Clients that claim to be multi-device-aware (see eLeapConnectionConfig and LeapCreateConnection) must subscribe to a device to receive various device-specific events.

Since

5.4.0

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • hDevice – A handle to the device for which events are desired.

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapUnsubscribeEvents(LEAP_CONNECTION hConnection, LEAP_DEVICE hDevice)

Unsubscribe from event messages based on device.

If events from multiple devices are being sent from a service, this function prevents receiving further events from the specified device that had previously been enabled using a call to LeapSubscribeEvents().

Since

5.4.0

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • hDevice – A handle to the device for which events are desired.

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapGetServerStatus(uint32_t timeout, const LEAP_SERVER_STATUS **status)

Retrieves server status information without requiring a LeapConnection object and a LeapPollConnection tracking loop.

This function is for clients that want server information but do not want to use the heavier-weight LeapPollConnection functions. Typically these would be applications that want to check if hand tracking is available before choosing to start hand tracking.

Calling LeapGetServerStatus will synchronously retrieve server status information and may block for up to the timeout value.

The status output parameter will remain valid until the client calls LeapReleaseServerStatus.

Since

5.8.0

Parameters
  • timeout – The maximum amount of time to wait, in milliseconds.

  • status[out] Address of a pointer that will be updated to reference a LEAP_SERVER_STATUS structure (on eLeapRS_Success)

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapReleaseServerStatus(const LEAP_SERVER_STATUS *status)

Release memory allocations for a LEAP_SERVER_STATUS from an earlier call to LeapGetServerStatus.

Since

5.8.0

Parameters

status – Pointer to a LEAP_SERVER_STATUS to release.

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapGetDeviceInfo(LEAP_DEVICE hDevice, LEAP_DEVICE_INFO *info)

Gets device properties.

To get the device serial number, you must supply a LEAP_DEVICE_INFO struct whose serial member points to a char array large enough to hold the null-terminated serial number string. To get the required length, call LeapGetDeviceInfo() using a LEAP_DEVICE_INFO struct that has serial set to NULL. LeapC sets serial_length field of the struct to the required length. You can then allocate memory for the string, set the serial field, and call this function again.

Since

3.0.0

Parameters
  • hDevice – A handle to the device to be queried.

  • info[out] The struct to receive the device property data.

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapGetDeviceTransform(LEAP_DEVICE hDevice, float *transform)

Get the transform to world coordinates from 3D Leap coordinates.

To get the transform, you must supply an array of 16 elements.

The function will return a an array representing a 4 x 4 matrix of the form:

R, t 0, 1

where: R is a 3 x 3 rotation matrix t is a 3 x 1 translation vector

Note that the matrix is in column major, e.g. transform[12] corresponds to the x coordinate of the translation vector t.

A possible pipeline would be, for example: 1) Get “palm_pos” the position of the center of the palm (as a 3x1 vector) 2) Construct a 4x1 vector using the palm_position: palm_pos_4 = (palm_pos.x; palm_pos.y; palm_pos.z; 1.0f) 3) Create a 4x4 matrix “trans_mat” as illustrated above using the returned transform 4) Get the position of the center of the palm in world coordinates by multiplying trans_mat and palm_pos_4: center_world_4 = trans_mat * palm_pos_4

This function returns eLeapRS_Unsupported in the case where this functionality is not yet supported.

Since

5.4.0

Parameters
  • hDevice – A handle to the device to be queried.

  • transform[out] A pointer to a single-precision float array of size 16, containing the coefficients of the 4x4 matrix in Column Major order.

Returns

The operation result code, a member of the eLeapRS enumeration.

bool LeapDeviceTransformAvailable(LEAP_DEVICE hDevice)

Returns whether a device transform is available for the device.

Since

5.13.0

Parameters

hDevice – A handle to the device to be queried.

Returns

Returns boolean.

eLeapRS LeapGetDeviceCameraCount(LEAP_DEVICE hDevice, uint8_t *cameraCount)

Get the camera count of the specified device from the hand tracking service.

Since

5.11.0

Parameters
  • hDevice – A handle to the device to be queried.

  • cameraCount[out] The device’s camera count.

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapPollConnection(LEAP_CONNECTION hConnection, uint32_t timeout, LEAP_CONNECTION_MESSAGE *evt)

Polls the connection for a new event.

The specific types of events that may be received are not configurable in this entrypoint. Configure the device or connection object directly to change what events will be received.

Pointers in the retrieved event message structure will be valid until the associated connection or device is closed, or the next call to LeapPollConnection().

Calling this method concurrently will return eLeapRS_ConcurrentPoll.

Since

3.0.0

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • timeout – The maximum amount of time to wait, in milliseconds. If this value is zero, the evt pointer references the next queued message, if there is one, and returns immediately.

  • evt[out] A pointer to a structure that is filled with event information. This structure will be valid as long as the LEAP_CONNECTION object is valid.

Returns

The operation result code, a member of the eLeapRS enumeration. If the operation times out, this method will return eLeapRS_Timeout. The evt pointer will reference a message of type eLeapEventType_None.

eLeapRS LeapGetFrameSize(LEAP_CONNECTION hConnection, int64_t timestamp, uint64_t *pncbEvent)

Retrieves the number of bytes required to allocate an interpolated frame at the specified time.

Use this function to determine the size of the buffer to allocate when calling LeapInterpolateFrame().

Since

3.1.1

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • timestamp – The timestamp of the frame whose size is to be queried.

  • pncbEvent[out] A pointer that receives the number of bytes required to store the specified frame.

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapGetFrameSizeEx(LEAP_CONNECTION hConnection, LEAP_DEVICE hDevice, int64_t timestamp, uint64_t *pncbEvent)

Retrieves the number of bytes required to allocate an interpolated frame at the specified time for a particular device.

Use this function to determine the size of the buffer to allocate when calling LeapInterpolateFrameEx().

Since

5.4.0

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • hDevice – A device handle returned by LeapOpenDevice().

  • timestamp – The timestamp of the frame whose size is to be queried.

  • pncbEvent[out] A pointer that receives the number of bytes required to store the specified frame.

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapInterpolateFrame(LEAP_CONNECTION hConnection, int64_t timestamp, LEAP_TRACKING_EVENT *pEvent, uint64_t ncbEvent)

Constructs a frame at the specified timestamp by interpolating between measured frames.

Caller is responsible for allocating a buffer large enough to hold the data of the frame. Use LeapGetFrameSize() to calculate the minimum size of this buffer.

Use LeapCreateClockRebaser(), LeapUpdateRebase(), and LeapRebaseClock() to synchronize time measurements in the application with time measurements in the Ultraleap Tracking Service. This process is required to achieve accurate, smooth interpolation.

Since

3.1.1

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • timestamp – The timestamp at which to interpolate the frame data.

  • pEvent[out] A pointer to a flat buffer which is filled with an interpolated frame.

  • ncbEvent – The number of bytes pointed to by pEvent.

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapInterpolateFrameEx(LEAP_CONNECTION hConnection, LEAP_DEVICE hDevice, int64_t timestamp, LEAP_TRACKING_EVENT *pEvent, uint64_t ncbEvent)

Constructs a frame at the specified timestamp for a particular device by interpolating between measured frames.

Caller is responsible for allocating a buffer large enough to hold the data of the frame. Use LeapGetFrameSizeEx() to calculate the minimum size of this buffer.

Use LeapCreateClockRebaser(), LeapUpdateRebase(), and LeapRebaseClock() to synchronize time measurements in the application with time measurements in the Ultraleap Tracking Service. This process is required to achieve accurate, smooth interpolation.

Since

5.4.0

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • hDevice – A device handle returned by LeapOpenDevice().

  • timestamp – The timestamp at which to interpolate the frame data.

  • pEvent[out] A pointer to a flat buffer which is filled with an interpolated frame.

  • ncbEvent – The number of bytes pointed to by pEvent.

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapInterpolateFrameFromTime(LEAP_CONNECTION hConnection, int64_t timestamp, int64_t sourceTimestamp, LEAP_TRACKING_EVENT *pEvent, uint64_t ncbEvent)

Constructs a frame at the specified timestamp by interpolating between a frame near the timestamp and a frame near the sourceTimestamp.

Caller is responsible for allocating a buffer large enough to hold the data of the frame. Use LeapGetFrameSize() to calculate the minimum size of this buffer.

Use LeapCreateClockRebaser(), LeapUpdateRebase(), and LeapRebaseClock() to synchronize time measurements in the application with time measurements in the Ultraleap Tracking Service. This process is required to achieve accurate, smooth interpolation.

Since

3.1.1

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • timestamp – The timestamp to which to interpolate the frame data.

  • sourceTimestamp – The timestamp of the beginning frame from which to interpolate the frame data.

  • pEvent[out] A pointer to a flat buffer which is filled with an interpolated frame.

  • ncbEvent – The number of bytes pointed to by pEvent.

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapInterpolateFrameFromTimeEx(LEAP_CONNECTION hConnection, LEAP_DEVICE hDevice, int64_t timestamp, int64_t sourceTimestamp, LEAP_TRACKING_EVENT *pEvent, uint64_t ncbEvent)

Constructs a frame at the specified timestamp for a particular device by interpolating between a frame near the timestamp and a frame near the sourceTimestamp.

Caller is responsible for allocating a buffer large enough to hold the data of the frame. Use LeapGetFrameSizeEx() to calculate the minimum size of this buffer.

Use LeapCreateClockRebaser(), LeapUpdateRebase(), and LeapRebaseClock() to synchronize time measurements in the application with time measurements in the Ultraleap Tracking Service. This process is required to achieve accurate, smooth interpolation.

Since

5.4.0

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • hDevice – A device handle returned by LeapOpenDevice().

  • timestamp – The timestamp to which to interpolate the frame data.

  • sourceTimestamp – The timestamp of the beginning frame from which to interpolate the frame data.

  • pEvent[out] A pointer to a flat buffer which is filled with an interpolated frame.

  • ncbEvent – The number of bytes pointed to by pEvent.

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapGetDeviceFrameRate(LEAP_CONNECTION hConnection, float *framesPerSecond)

Get the frequency the default device is providing the hand tracking service with images.

See

LeapGetDeviceFrameRateEx for additional information

Since

5.8.0

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • framesPerSecond[out] The device frame rate.

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapGetDeviceFrameRateEx(LEAP_CONNECTION hConnection, LEAP_DEVICE hDevice, float *framesPerSecond)

Get the frequency the device is providing the hand tracking service with images.

This is only implemented for some devices. In case of missing implementation, the function will return a frequency of 0.

Since

5.8.0

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • hDevice – A handle to the device to be queried.

  • framesPerSecond[out] The given device frame rate.

Returns

The operation result code, a member of the eLeapRS enumeration.

void LeapCloseDevice(LEAP_DEVICE hDevice)

Closes a device handle previously opened with LeapOpenDevice.

Since

3.0.0

Parameters

hDevice – The device handle to close.

void LeapCloseConnection(LEAP_CONNECTION hConnection)

Closes a previously opened connection.

This method closes the specified connection object if it is opened

This method never fails.

Since

4.0.0

Parameters

hConnection – A handle to the connection object to be closed.

void LeapDestroyConnection(LEAP_CONNECTION hConnection)

Destroys a previously opened connection.

This method closes the specified connection object if it is opened, destroys the underlying object, and releases all resources associated with it.

This method never fails.

Be sure that no other functions are accessing the connection when this function is called.

Since

3.0.0

Parameters

hConnection – A handle to the connection object to be destroyed.

eLeapRS LeapCreateClockRebaser(LEAP_CLOCK_REBASER *phClockRebaser)

Initializes a new Leap clock-rebaser handle object.

Pass the filled-in LEAP_CLOCK_REBASER object to calls to LeapUpdateRebase(), LeapRebaseClock(), and LeapDestroyClockRebaser().

Since

3.1.2

Parameters

phClockRebaser[out] The pointer to the clock-rebaser object to be initialized.

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapUpdateRebase(LEAP_CLOCK_REBASER hClockRebaser, int64_t userClock, int64_t leapClock)

Updates the relationship between the Ultraleap Tracking Service clock and the user clock.

When using LeapInterpolateFrame(), call this function for every graphics frame rendered by your application. The function should be called as close to the actual point of rendering as possible.

The relationship between the application clock and the Ultraleap Tracking Service clock is neither fixed nor stable. Simulation restarts can cause user clock values to change instantaneously. Certain systems simulate slow motion, or respond to heavy load, by reducing the tick rate of the user clock. As a result, the LeapUpdateRebase() function must be called for every rendered frame.

Since

3.1.2

Parameters
  • hClockRebaser – The handle to a rebaser object created by LeapCreateClockRebaser().

  • userClock – A clock value supplied by the application, sampled at about the same time as LeapGetNow() was sampled.

  • leapClock – The Ultraleap Tracking Service clock value sampled by a call to LeapGetNow().

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapRebaseClock(LEAP_CLOCK_REBASER hClockRebaser, int64_t userClock, int64_t *pLeapClock)

Computes the Ultraleap Tracking Service clock corresponding to a specified application clock value.

Use this function to translate your application clock to the Ultraleap Tracking Service clock when interpolating frames. LeapUpdateRebase() must be called for every rendered frame for the relationship between the two clocks to remain synchronized.

Since

3.1.2

Parameters
  • hClockRebaser – The handle to a rebaser object created by LeapCreateClockRebaser().

  • userClock – The clock in microseconds referenced to the application clock.

  • pLeapClock[out] The corresponding Ultraleap Tracking Service clock value.

Returns

The operation result code, a member of the eLeapRS enumeration.

void LeapDestroyClockRebaser(LEAP_CLOCK_REBASER hClockRebaser)

Destroys a previously created clock-rebaser object.

This method destroys the specified clock-rebaser object, and releases all resources associated with it.

Since

3.1.2

Parameters

hClockRebaser – A handle to the clock-rebaser object to be destroyed.

LEAP_VECTOR LeapPixelToRectilinear(LEAP_CONNECTION hConnection, eLeapPerspectiveType camera, LEAP_VECTOR pixel)

This finds the default device and returns the result of LeapPixelToRectilinearEx()

See

LeapPixelToRectilinearEx for additional information

Since

3.1.3

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • camera – The camera to use, a member of the eLeapPerspectiveType enumeration

  • pixel – A Vector containing the position of a pixel in the image.

Returns

A Vector containing the ray direction (the z-component of the vector is always 1). May return [NaN, NaN, 1] (quiet NaN type) under the following conditions: *) You do not have a valid connection or device handle. *) You passed an invalid camera enum. *) You have never received any images from LeapC as detailed above.

LEAP_VECTOR LeapPixelToRectilinearEx(LEAP_CONNECTION hConnection, LEAP_DEVICE hDevice, eLeapPerspectiveType camera, LEAP_VECTOR pixel)

This converts the camera perspective to an index and returns the result of LeapPixelToRectilinearByIndexEx()

See

LeapPixelToRectilinearByIndexEx for additional information

Since

5.4.0

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • hDevice – A device handle returned by LeapOpenDevice().

  • camera – The camera to use, a member of the eLeapPerspectiveType enumeration

  • pixel – A Vector containing the position of a pixel in the image.

Returns

A Vector containing the ray direction (the z-component of the vector is always 1). May return [NaN, NaN, 1] (quiet NaN type) under the following conditions: *) You do not have a valid connection or device handle. *) You passed an invalid camera enum. *) You have never received any images from LeapC as detailed above.

LEAP_VECTOR LeapPixelToRectilinearByIndex(LEAP_CONNECTION hConnection, uint8_t cameraIndex, LEAP_VECTOR pixel)

This finds the default device and returns the result of LeapPixelToRectilinearByIndexEx()

See

LeapPixelToRectilinearByIndexEx for additional information

Since

5.8.0

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • cameraIndex – The index of the camera to use

  • pixel – A Vector containing the position of a pixel in the image.

Returns

A Vector containing the ray direction (the z-component of the vector is always 1). May return [NaN, NaN, 1] (quiet NaN type) under the following conditions: *) You do not have a valid connection or device handle. *) You passed an invalid camera index. *) You have never received any images from LeapC as detailed above.

LEAP_VECTOR LeapPixelToRectilinearByIndexEx(LEAP_CONNECTION hConnection, LEAP_DEVICE hDevice, uint8_t cameraIndex, LEAP_VECTOR pixel)

Provides the corrected camera ray intercepting the specified point on the image for a particular device.

Given a point on the image, LeapPixelToRectilinearByIndex() corrects for camera distortion and returns the true direction from the camera to the source of that image point within the Devices field of view.

This direction vector has an x and y component [x, y, 1], with the third element always 1. Note that this vector uses the 2D camera coordinate system where the x-axis parallels the longer (typically horizontal) dimension and the y-axis parallels the shorter (vertical) dimension. The camera coordinate system does not correlate to the 3D Ultraleap coordinate system.

For this function to work, you must have fetched at least 1 image from the LeapC polling event loop, i.e. call LeapSetPolicyFlags(eLeapPolicyFlag_Images, 0), and received one LEAP_IMAGE_EVENT type for your given device handle.

Since

5.8.0

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • hDevice – A device handle returned by LeapOpenDevice().

  • cameraIndex – The index of the camera to use

  • pixel – A Vector containing the position of a pixel in the image.

Returns

A Vector containing the ray direction (the z-component of the vector is always 1). May return [NaN, NaN, 1] (quiet NaN type) under the following conditions: *) You do not have a valid connection or device handle. *) You passed an invalid camera index. *) You have never received any images from LeapC as detailed above.

LEAP_VECTOR LeapRectilinearToPixel(LEAP_CONNECTION hConnection, eLeapPerspectiveType camera, LEAP_VECTOR rectilinear)

This finds the default device and returns the result of LeapRectilinearToPixelEx()

See

LeapRectilinearToPixelEx for additional information

Since

3.1.3

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • camera – The camera to use, a member of the eLeapPerspectiveType enumeration

  • rectilinear – A Vector containing the ray direction.

Returns

A Vector containing the pixel coordinates [x, y, 1] (with z always 1). May return [NaN, NaN, 1] (quiet NaN type) under the following conditions: *) You do not have a valid connection or device handle. *) You passed an invalid camera enum. *) You have never received any images from LeapC as detailed above.

LEAP_VECTOR LeapRectilinearToPixelEx(LEAP_CONNECTION hConnection, LEAP_DEVICE hDevice, eLeapPerspectiveType camera, LEAP_VECTOR rectilinear)

This converts the camera perspective to an index and returns the result of LeapRectilinearToPixelByIndexEx()

See

LeapRectilinearToPixelByIndexEx for additional information

Since

5.4.0

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • hDevice – A device handle returned by LeapOpenDevice().

  • camera – The camera to use, a member of the eLeapPerspectiveType enumeration

  • rectilinear – A Vector containing the ray direction.

Returns

A Vector containing the pixel coordinates [x, y, 1] (with z always 1). May return [NaN, NaN, 1] (quiet NaN type) under the following conditions: *) You do not have a valid connection or device handle. *) You passed an invalid camera enum. *) You have never received any images from LeapC as detailed above.

LEAP_VECTOR LeapRectilinearToPixelByIndex(LEAP_CONNECTION hConnection, uint8_t cameraIndex, LEAP_VECTOR rectilinear)

This finds the default device and returns the result of LeapRectilinearToPixelByIndexEx()

See

LeapRectilinearToPixelByIndexEx for additional information

Since

5.8.0

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • cameraIndex – The index of the camera to use

  • rectilinear – A Vector containing the ray direction.

Returns

A Vector containing the pixel coordinates [x, y, 1] (with z always 1). May return [NaN, NaN, 1] (quiet NaN type) under the following conditions: *) You do not have a valid connection or device handle. *) You passed an invalid camera index. *) You have never received any images from LeapC as detailed above.

LEAP_VECTOR LeapRectilinearToPixelByIndexEx(LEAP_CONNECTION hConnection, LEAP_DEVICE hDevice, uint8_t cameraIndex, LEAP_VECTOR rectilinear)

Provides the point in the image corresponding to a ray projecting from the camera for a particular device.

Given a ray projected from the camera in the specified direction, LeapRectilinearToPixelByIndex() corrects for camera distortion and returns the corresponding pixel coordinates in the image.

The ray direction is specified in relationship to the camera. The first vector element is the tangent of the “horizontal” view angle; the second element is the tangent of the “vertical” view angle.

The LeapRectilinearToPixelByIndex() function returns pixel coordinates outside of the image bounds if you project a ray toward a point for which there is no recorded data.

LeapRectilinearToPixelByIndex() is typically not fast enough for realtime distortion correction. For better performance, use a shader program executed on a GPU.

For this function to work, you must have fetched at least 1 image from the LeapC polling event loop, i.e. call LeapSetPolicyFlags(eLeapPolicyFlag_Images, 0), and received one LEAP_IMAGE_EVENT type for your given device handle.

Since

5.8.0

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • hDevice – A device handle returned by LeapOpenDevice().

  • cameraIndex – The index of the camera to use

  • rectilinear – A Vector containing the ray direction.

Returns

A Vector containing the pixel coordinates [x, y, 1] (with z always 1). May return [NaN, NaN, 1] (quiet NaN type) under the following conditions: *) You do not have a valid connection or device handle. *) You passed an invalid camera index. *) You have never received any images from LeapC as detailed above.

void LeapCameraMatrix(LEAP_CONNECTION hConnection, eLeapPerspectiveType camera, float *dest)

Returns an OpenCV-compatible camera matrix.

Since

3.2.1

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • camera – The camera to use, a member of the eLeapPerspectiveType enumeration

  • dest[out] A pointer to a single-precision float array of size 9

void LeapCameraMatrixEx(LEAP_CONNECTION hConnection, LEAP_DEVICE hDevice, eLeapPerspectiveType camera, float *dest)

Returns an OpenCV-compatible camera matrix for a particular device.

Since

5.4.0

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • hDevice – A device handle returned by LeapOpenDevice().

  • camera – The camera to use, a member of the eLeapPerspectiveType enumeration

  • dest[out] A pointer to a single-precision float array of size 9

void LeapCameraMatrixByIndex(LEAP_CONNECTION hConnection, uint8_t cameraIndex, float *dest)

Returns an OpenCV-compatible camera matrix for a particular device.

Since

5.8.0

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • cameraIndex – The index of the camera to use

  • dest[out] A pointer to a single-precision float array of size 9

void LeapCameraMatrixByIndexEx(LEAP_CONNECTION hConnection, LEAP_DEVICE hDevice, uint8_t cameraIndex, float *dest)

Returns an OpenCV-compatible camera matrix for a particular device.

Since

5.8.0

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • hDevice – A device handle returned by LeapOpenDevice().

  • cameraIndex – The index of the camera to use

  • dest[out] A pointer to a single-precision float array of size 9

void LeapExtrinsicCameraMatrix(LEAP_CONNECTION hConnection, eLeapPerspectiveType camera, float *dest)

This finds the default device and returns the result LeapExtrinsicCameraMatrixEx()

See

LeapExtrinsicCameraMatrixEx for additional information

Since

5.1.0

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • camera – The camera to use, a member of the eLeapPerspectiveType enumeration

  • dest[out] A pointer to a single-precision float array of size 16, containing the coefficients of the 4x4 matrix in Column Major order

void LeapExtrinsicCameraMatrixEx(LEAP_CONNECTION hConnection, LEAP_DEVICE hDevice, eLeapPerspectiveType camera, float *dest)

This converts the camera perspective to an index and returns the result of LeapExtrinsicCameraMatrixByIndexEx()

See

LeapExtrinsicCameraMatrixByIndexEx for additional information

Since

5.1.0

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • hDevice – A device handle returned by LeapOpenDevice().

  • camera – The camera to use, a member of the eLeapPerspectiveType enumeration

  • dest[out] A pointer to a single-precision float array of size 16, containing the coefficients of the 4x4 matrix in Column Major order

void LeapExtrinsicCameraMatrixByIndex(LEAP_CONNECTION hConnection, uint8_t cameraIndex, float *dest)

This finds the default device and returns the result of LeapPixelToRectilinearByIndexEx()

See

LeapPixelToRectilinearByIndexEx for additional information

Since

5.8.0

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • cameraIndex – The index of the camera to use

  • dest[out] A pointer to a single-precision float array of size 16, containing the coefficients of the 4x4 matrix in Column Major order

void LeapExtrinsicCameraMatrixByIndexEx(LEAP_CONNECTION hConnection, LEAP_DEVICE hDevice, uint8_t cameraIndex, float *dest)

Returns a transformation matrix from the coordinate system of the requested camera to 3D Leap coordinate space This is composed of a 4 x 4 matrix of the form:

R, t

0, 1

R is a 3 x 3 rotation matrix

t is a 3 x 1 translation vector

Since

5.8.0

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • hDevice – A device handle returned by LeapOpenDevice().

  • cameraIndex – The index of the camera to use

  • dest[out] A pointer to a single-precision float array of size 16, containing the coefficients of the 4x4 matrix in Column Major order

void LeapDistortionCoeffs(LEAP_CONNECTION hConnection, eLeapPerspectiveType camera, float *dest)

This finds the default device and returns the result of LeapDistortionCoeffsEx()

See

LeapDistortionCoeffsEx for additional information

Since

3.2.1

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • camera – The camera to use, a member of the eLeapPerspectiveType enumeration

  • dest[out] A pointer to a single-precision float array of size 8.

void LeapDistortionCoeffsEx(LEAP_CONNECTION hConnection, LEAP_DEVICE hDevice, eLeapPerspectiveType camera, float *dest)

This converts the camera perspective to an index and returns the result of LeapDistortionCoeffsByIndexEx()

See

LeapDistortionCoeffsByIndexEx for additional information

Since

5.4.0

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • hDevice – A device handle returned by LeapOpenDevice().

  • camera – The camera to use, a member of the eLeapPerspectiveType enumeration

  • dest[out] A pointer to a single-precision float array of size 8.

void LeapDistortionCoeffsByIndex(LEAP_CONNECTION hConnection, uint8_t cameraIndex, float *dest)

This finds the default device and returns the result of LeapDistortionCoeffsByIndexEx()

See

LeapDistortionCoeffsByIndexEx for additional information

Since

5.8.0

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • cameraIndex – The index of the camera to use

  • dest[out] A pointer to a single-precision float array of size 8.

void LeapDistortionCoeffsByIndexEx(LEAP_CONNECTION hConnection, LEAP_DEVICE hDevice, uint8_t cameraIndex, float *dest)

Returns an OpenCV-compatible lens distortion for a particular device, using the 8-parameter rational model.

The order of the returned array is: [k1, k2, p1, p2, k3, k4, k5, k6]

Since

5.8.0

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • hDevice – A device handle returned by LeapOpenDevice().

  • cameraIndex – The index of the camera to use

  • dest[out] A pointer to a single-precision float array of size 8.

const char *LeapDevicePIDToString(eLeapDevicePID pid)

Provides the human-readable canonical name of the specified device model.

This method is guaranteed to never return null for the LEAP_DEVICE_INFO.pid field returned by a successful call to LeapGetDeviceInfo

Parameters

pid – The pid of the device

Returns

The string name of the device model, or null if the device type string is invalid.

eLeapRS LeapRecordingOpen(LEAP_RECORDING *ppRecording, const char *filePath, LEAP_RECORDING_PARAMETERS params)

Opens or creates a LEAP_RECORDING.

Pass the LEAP_RECORDING pointer to LeapRecordingOpen() to initiate reading from or writing to a recording. The recording path is relative to the “user path” which is the SD card on Android.

Since

3.2.0

Parameters
  • ppRecording – The recording being opened.

  • filePath – The file path. This will be passed directly to the OS without modification. An “.lmt” suffix is suggested.

  • params – The LEAP_RECORDING_PARAMETERS describing what operations are requested.

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapRecordingClose(LEAP_RECORDING *ppRecording)

Closes a LEAP_RECORDING.

Since

3.2.0

Parameters

ppRecording[out] The recording being closed. Will modify *ppRecording to be null.

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapRecordingGetStatus(LEAP_RECORDING pRecording, LEAP_RECORDING_STATUS *pstatus)

Fills in a LEAP_RECORDING_STATUS struct for an open recording.

This struct provides the applicable eLeapRecordingFlags.

Since

3.2.0

Parameters
  • pRecording – The open recording.

  • pstatus[out] A LEAP_RECORDING_STATUS struct to receive the recording status.

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapRecordingReadSize(LEAP_RECORDING pRecording, uint64_t *pncbEvent)

Retrieves the number of bytes required to allocate the next frame in a recording.

Use this function to determine the size of the buffer to allocate before calling LeapRecordingRead().

Since

3.2.0

Parameters
  • pRecording – The recording being read from.

  • pncbEvent[out] A pointer that receives the number of bytes required to store the next frame.

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapRecordingRead(LEAP_RECORDING pRecording, LEAP_TRACKING_EVENT *pEvent, uint64_t ncbEvent)

Reads a tracking frame from a LEAP_RECORDING file.

Caller is responsible for allocating a buffer large enough to hold the data of the frame. Use LeapGetFrameSize() to calculate the minimum size of this buffer.

Since

3.2.0

Parameters
  • pRecording – The recording being read from.

  • pEvent[out] A pointer to a flat buffer which is filled with the next recorded frame.

  • ncbEvent – The number of bytes pointed to by pEvent.

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapRecordingWrite(LEAP_RECORDING pRecording, LEAP_TRACKING_EVENT *pEvent, uint64_t *pnBytesWritten)

Writes a tracking frame to a LEAP_RECORDING file.

Since

3.2.0

Parameters
  • pRecording – The recording being written to.

  • pEvent[out] A pointer to a flat buffer which is filled with an interpolated frame.

  • pnBytesWritten – If non-null the number of bytes written.

Returns

The operation result code, a member of the eLeapRS enumeration.

void LeapScaleOffsetMatrix(LEAP_CONNECTION hConnection, eLeapPerspectiveType camera, float *dest)

This finds the default device and returns the result of LeapScaleOffsetMatrixEx()

See

LeapScaleOffsetMatrixEx for additional information

Since

5.x.x

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • camera – The camera to use, a member of the eLeapPerspectiveType enumeration

  • dest[out] A pointer to a single-precision float array of size 16, containing the coefficients of the 4x4 matrix in Column Major order

void LeapScaleOffsetMatrixEx(LEAP_CONNECTION hConnection, LEAP_DEVICE hDevice, eLeapPerspectiveType camera, float *dest)

This converts the camera perspective to an index and returns the result of LeapScaleOffsetMatrixByIndexEx()

See

LeapScaleOffsetMatrixByIndexEx for additional information

Since

5.x.x

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • hDevice – A device handle returned by LeapOpenDevice().

  • camera – The camera to use, a member of the eLeapPerspectiveType enumeration

  • dest[out] A pointer to a single-precision float array of size 16, containing the coefficients of the 4x4 matrix in Column Major order

void LeapScaleOffsetMatrixByIndex(LEAP_CONNECTION hConnection, uint8_t cameraIndex, float *dest)

This finds the default device and returns the result of LeapScaleOffsetMatrixByIndexEx()

See

LeapScaleOffsetMatrixByIndexEx for additional information

Since

5.8.0

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • cameraIndex – The index of the camera to use

  • dest[out] A pointer to a single-precision float array of size 16, containing the coefficients of the 4x4 matrix in Column Major order

void LeapScaleOffsetMatrixByIndexEx(LEAP_CONNECTION hConnection, LEAP_DEVICE hDevice, uint8_t cameraIndex, float *dest)

Returns the appropriate scale and offset coefficients required to project normalised Rectilinear coordinates to image-scale coordinates.

This is composed of a 4 x 4 matrix of the form:

scale_x, 0, 0, offset_x, 0, 1, 0, 0, 0, 0, scale_z, offset_z 0, 0, 0, 1

This matrix is specific to the size of the current image as contained within LEAP_IMAGE.

In practical terms, use this matrix in combination with normalised rays to project 3D points into a rectilinear image space (i.e. to visualise hands on an undistorted image).

The pipeline would be: 1) Take 3D points from hand tracking. 2) Apply an extrinsic transformation to a specific camera’s coordinate system 3) Apply a perspective division to transform 3D points to rays. 4) Apply the ScaleOffset matrix to these points.

These points will now be in the correct coordinate system consistent with the undistorted rectilinear image provided by LEAP_IMAGE::distortion_matrix.

Since

5.8.0

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • hDevice – A device handle returned by LeapOpenDevice().

  • cameraIndex – The index of the camera to use

  • dest[out] A pointer to a single-precision float array of size 16, containing the coefficients of the 4x4 matrix in Column Major order

eLeapRS LeapGetVersion(LEAP_CONNECTION hConnection, eLeapVersionPart versionPart, LEAP_VERSION *pVersion)

Returns the version of a specified part of the system.

If an invalid connection handle is provided only the version details of the client will be available.

Since

5.2.x

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • versionPart – The version part to return, this will reference one part of the system.

  • pVersion[out] A pointer to a struct used to store the version number.

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapSetDeviceHints(LEAP_CONNECTION hConnection, LEAP_DEVICE hDevice, const char *hints[])

Sets a number of hints describing how the client and device will be using hand tracking.

These hints will be used by the server to select an appropiate form of hand tracking for the client. The service will make its best guess at what to do when interpreting all the hints from all connected clients. It makes no guarantee to the client that it will follow any particular behaviour.

The trait string may contain either public strings (defined above) or custom hints.

The function is called on a per device basis, so different hints can be applied to different cameras. Calling this function will override any and all previous hints from this device for this client connection.

Hints will only be interpreted for “multi-device” aware clients (see @eLeapConnectionConfig_MultiDeviceAware). The function will return an error if the client is not “multi-device” aware.

Warning: Over specialisation of hints may lead to degraded generic hand tracking. In most cases the device position axis is the only trait clients would specify. If an axis trait is not specified for a particular axis the hand tracking service will choose a sensible default.

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • hDevice – A device handle returned by LeapOpenDevice().

  • hints – An array of null terminated strings, one string for each hint, the array is terminated with a null pointer.

eLeapRS LeapCheckLicenseFlag(LEAP_CONNECTION hConnection, const char *flag, bool *flag_enabled)

Check if a specific license feature flag is enabled in the hand tracking service.

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • flag – A feature flag, pointer to a null terminated string. For example: “Hyperion”

  • flag_enabled – An output parameter indicating if the feature flag is enabled.

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapSetClassifierThresholds(LEAP_CONNECTION hConnection, float acquireConfidence, float releaseConfidence)

Set the hand tracking classifier thresholds.

This function is only supported when the hand tracking service has a license with the “SetClassifierThresholds” flag.

eLeapRS_InvalidArgument will be returned if either the acquireConfidence or releaseConfidence parameters are not in the range: 0 <= t <= 1.

eLeapRS_Unsupported will be returned if no license with the “SetClassifierThresholds” flag is found.

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • acquireConfidence – The hand tracking model’s acquire threshold value.

  • releaseConfidence – The hand tracking model’s release threshold value.

Returns

The operation result code, a member of the eLeapRS enumeration.

eLeapRS LeapSetClassifierThresholdsEx(LEAP_CONNECTION hConnection, LEAP_DEVICE hDevice, float acquireConfidence, float releaseConfidence)

Set the hand tracking classifier thresholds for a device.

This function is only supported when the hand tracking service has a license with the “SetClassifierThresholds” flag.

eLeapRS_InvalidArgument will be returned if either the acquireConfidence or releaseConfidence parameters are not in the range: 0 <= t <= 1.

eLeapRS_Unsupported will be returned if no license with the “SetClassifierThresholds” flag is found.

Parameters
  • hConnection – The connection handle created by LeapCreateConnection().

  • hDevice – A device handle returned by LeapOpenDevice().

  • acquireConfidence – The hand tracking model’s acquire threshold value.

  • releaseConfidence – The hand tracking model’s release threshold value.

Returns

The operation result code, a member of the eLeapRS enumeration.