| Tilt Five NDK |

Modules | Functions
Glasses functions
Tilt Five™ Native Interface (C)
Collaboration diagram for Glasses functions:

## Modules
| Glasses state management
| Functions related to the management of glasses state and exclusivity.
| Exclusive functions
| Functions requiring an exclusive connection.
| Glasses parameters
| Functions for getting glasses parameters.
| Wand related
| Functions related to wands.

## Functions
T5_EXPORT T5_Result | t5ReleaseGlasses (T5_Glasses glasses)
T5_EXPORT T5_Result | t5ConfigureCameraStreamForGlasses (T5_Glasses glasses, T5_CameraStreamConfig config)
| Configure the camera stream. More...
T5_EXPORT T5_Result | t5GetFilledCamImageBuffer (T5_Glasses glasses, T5_CamImage *image)
T5_EXPORT T5_Result | t5SubmitEmptyCamImageBuffer (T5_Glasses glasses, T5_CamImage *image)
| Submit an empty image buffer to be filled by the camera frame stream. More...
T5_EXPORT T5_Result | t5CancelCamImageBuffer (T5_Glasses glasses, uint8_t *buffer)
| Clear out the remaining buffers and return all buffers as a vector of camera images. More...

## Detailed Description

Require a T5_Glasses for invocation

## Function Documentation

## ◆ t5CancelCamImageBuffer()

T5_EXPORT T5_Result t5CancelCamImageBuffer | ( | T5_Glasses | glasses,
|  | uint8_t * | buffer
| ) |  |

Clear out the remaining buffers and return all buffers as a vector of camera images.

Exclusive Connection
  Requires an exclusive connection - established with makeExclusive().

Threading
  Exclusivity group 1 - Functions in this group must not be called simultaneously from different threads.

Parameters

  [in] | glasses | - T5_Glasses returned by T5ApiSys::createGlasses().
  [in] | buffer | - A pointer to an image buffer that should be cancelled and no longer used by the service

Return values

  T5_SUCCESS | Buffer is no longer in use and is available for freeing
  T5_ERROR_NO_CONTEXT | `glasses` is invalid.
  T5_ERROR_NOT_CONNECTED | Glasses aren't exclusively connected for this client. Use makeExclusive() first.
  T5_ERROR_INTERNAL | Internal error - not correctable.

Referenced by tiltfive::Glasses::cancelCamImageBuffer().

## ◆ t5ConfigureCameraStreamForGlasses()

T5_EXPORT T5_Result t5ConfigureCameraStreamForGlasses | ( | T5_Glasses | glasses,
|  | T5_CameraStreamConfig | config
| ) |  |

Configure the camera stream.

Threading
  Exclusivity group 1 - Functions in this group must not be called concurrently from different threads.

Parameters

  [in] | glasses | - T5_Glasses returned by t5CreateGlasses()
  [in] | config | - T5_CameraStreamConfig filled by client to detail configuration

Return values

  T5_SUCCESS | Stream configured ok.
  T5_ERROR_IO_FAILURE | Failed to communicate with the service.
  T5_ERROR_NO_SERVICE | Service is unavailable.
  T5_ERROR_TARGET_NOT_FOUND | Device not found.
  T5_ERROR_NO_CONTEXT | `glasses` is invalid.

The following are internal errors that should be discarded and/or logged:

Return values

  T5_ERROR_INTERNAL | Internal (Not correctable): Generic error.
  T5_ERROR_INVALID_STATE | Internal (Not correctable): Invalid state for request.

Referenced by tiltfive::Glasses::configureCameraStream().

## ◆ t5GetFilledCamImageBuffer()

T5_EXPORT T5_Result t5GetFilledCamImageBuffer | ( | T5_Glasses | glasses,
|  | T5_CamImage * | image
| ) |  |

Get a new filled image buffer from the camera stream. Will always return the oldest filled buffer. This function does not block on call, and will return a TryAgain error if there are no available filled buffers. To ensure images don't become stale, continual polling of t5GetFilledCamImageBuffer() and resubmission of empty buffers via t5SubmitEmptyCamImageBuffer() is expected.

Exclusive Connection
  Requires an exclusive connection - established with makeExclusive().

Threading
  Exclusivity group 1 - Functions in this group must not be called simultaneously from different threads.

Parameters

  [in] | glasses | - T5_Glasses returned by T5ApiSys::createGlasses().
  [out] | image | - T5_CamImage representing a camera image wrapper that will contain a filled buffer upon successful return.

Return values

  T5_SUCCESS | Image written to `image`.
  T5_ERROR_TRY_AGAIN | No available image.
  T5_ERROR_INVALID_ARGS | Nullptr was supplied for `image`.
  T5_ERROR_NO_CONTEXT | `glasses` is invalid.
  T5_ERROR_NOT_CONNECTED | Glasses aren't exclusively connected for this client. Use makeExclusive() first.
  ::T5_INVALID_BUFFER | The buffer does not have the requisite size for a camera image
  T5_ERROR_INTERNAL | Internal error - not correctable.

Referenced by tiltfive::Glasses::getFilledCamImageBuffer().

## ◆ t5ReleaseGlasses()

T5_EXPORT T5_Result t5ReleaseGlasses | ( | T5_Glasses | glasses | ) |

Release previously-reserved glasses.

Release glasses that were previously reserved for exclusive operations by the client. After calling this, exclusive operations cannot be used with the glasses unless the glasses are again reserved and readied.

Threading
  Exclusivity group 1 - Functions in this group must not be called concurrently from different threads.

Parameters

  [in] | glasses | - T5_Glasses returned by T5ApiSys::createGlasses()

Return values

  T5_SUCCESS | Glasses released.
  T5_ERROR_NO_CONTEXT | `glasses` is invalid.

Referenced by tiltfive::Glasses::release().

## ◆ t5SubmitEmptyCamImageBuffer()

T5_EXPORT T5_Result t5SubmitEmptyCamImageBuffer | ( | T5_Glasses | glasses,
|  | T5_CamImage * | image
| ) |  |

Submit an empty image buffer to be filled by the camera frame stream.

Exclusive Connection
  Requires an exclusive connection - established with makeExclusive().

Threading
  Exclusivity group 1 - Functions in this group must not be called simultaneously from different threads.

The memory in the image buffer Must remain valid until the corresponding wrapper is returned by t5GetFilledCamImageBuffer or the buffer is canceled by t5CancelCamImageBuffer

Note, only the image buffer inside of T5_CamImage is required to be kept valid. The T5_CamImage wrapper is not.

Incoming image is expected to have 0 width, height, and stride, and a buffer size larger than the minimum image size.

Parameters

  [in] | glasses | - T5_Glasses returned by T5ApiSys::createGlasses().
  [in] | image | - T5_CamImage representing current camera image buffer to be filled.

Return values

  T5_SUCCESS | Buffer submitted to service.
  T5_ERROR_INVALID_ARGS | Nullptr was supplied for `image`.
  T5_ERROR_NO_CONTEXT | `glasses` is invalid.
  T5_ERROR_NOT_CONNECTED | Glasses aren't exclusively connected for this client. Use makeExclusive() first.
  ::T5_INVALID_BUFFER | The buffer does not have the requisite size for a camera image
  T5_ERROR_INTERNAL | Internal error - not correctable.

Referenced by tiltfive::Glasses::submitEmptyCamImageBuffer().