| Tilt Five NDK |

Public Member Functions
tiltfive::Glasses Class Reference
Tilt Five™ Native Interface (C++)

Represents an instance of Tilt Five™ glasses. More...

`#include <TiltFiveNative.hpp>`

Inheritance diagram for tiltfive::Glasses:
[legend]
Collaboration diagram for tiltfive::Glasses:
[legend]

## Public Member Functions
auto | getHandle () const -> T5_Glasses
| Obtain the C handle for this glasses object. More...
auto | getIdentifier () const -> std::string
| Obtain a hardware (not user facing) identifier for the glasses. More...
auto | getConnectionState () -> Result< ConnectionState >
| Get the current connection state of the glasses. More...
auto | getChangedParams () -> Result< std::vector< T5_ParamGlasses > >
| Get a system-wide list of changed parameters. More...
auto | getIpd () -> Result< double >
| Get the current IPD setting for this glasses. More...
auto | getFriendlyName () -> Result< std::string >
| Get the user-facing name of the glasses. More...
auto | reserve (const std::string &displayName) -> Result< void >
| Reserve glasses for exclusive operations by the client. More...
auto | ensureReady () -> Result< void >
| Ensure that reserved glasses are ready for exclusive operations. More...
auto | release () -> Result< void >
| Release previously-reserved glasses. More...
auto | getLatestGlassesPose (T5_GlassesPoseUsage usage) -> Result< T5_GlassesPose >
| Get the latest pose for this glasses. More...
auto | initGraphicsContext (T5_GraphicsApi graphicsApi, void *graphicsContext) -> Result< void >
| Initialize the glasses for graphics operations. More...
auto | configureCameraStream (T5_CameraStreamConfig config) -> Result< void >
| Configure the wand event stream. More...
auto | getFilledCamImageBuffer () -> Result< T5_CamImage >
| Get the latest camera image for this glasses. More...
auto | submitEmptyCamImageBuffer (T5_CamImage *imgBuffer) -> Result< void >
| Submit a buffer to the camera image stream to hold Camera Frame data. More...
auto | cancelCamImageBuffer (uint8_t *buffer) -> Result< void >
| Cancel an image buffer in use by the service for freeing. More...
auto | sendFrame (const T5_FrameInfo *const frameInfo) -> Result< void >
| Send a frame to display on the glasses. More...
auto | listWands () -> Result< std::vector< T5_WandHandle > >
| Obtain a list of connected wands. More...
auto | configureWandStream (const T5_WandStreamConfig *const config) -> Result< void >
| Configure the wand event stream. More...
auto | readWandStream (std::chrono::milliseconds timeout=std::chrono::milliseconds(100)) -> Result< T5_WandStreamEvent >
| Read from the wands event stream. More...
auto | getWandStreamHelper () -> std::shared_ptr< WandStreamHelper >
| Get a WandStreamHelper. More...
auto | createConnectionHelper (const std::string &displayName, std::chrono::milliseconds connectionPollInterval=std::chrono::milliseconds(100)) -> std::unique_ptr< GlassesConnectionHelper >
| Create a GlassesConnectionHelper. More...

## Detailed Description

Represents an instance of Tilt Five™ glasses.

Definition at line 323 of file TiltFiveNative.hpp.

## Member Function Documentation

## ◆ cancelCamImageBuffer()

auto tiltfive::Glasses::cancelCamImageBuffer | ( | uint8_t * | buffer | ) | -> Result<void>
| inline

Cancel an image buffer in use by the service for freeing.

Parameters

  [in] | buffer | - A pointer to the buffer to be canceled and released from use by the service.

Definition at line 625 of file TiltFiveNative.hpp.

## ◆ configureCameraStream()

auto tiltfive::Glasses::configureCameraStream | ( | T5_CameraStreamConfig | config | ) | -> Result<void>
| inline

Configure the wand event stream.

Parameters

  [in] | config | - T5_CameraStreamConfig filled by client to detail configuration

Definition at line 587 of file TiltFiveNative.hpp.

## ◆ configureWandStream()

auto tiltfive::Glasses::configureWandStream | ( | const T5_WandStreamConfig *const | config | ) | -> Result<void>
| inline

Configure the wand event stream.

Parameters

  [in] | config | - T5_WandStreamConfig filled by client to detail configuration

Definition at line 680 of file TiltFiveNative.hpp.

## ◆ createConnectionHelper()

auto tiltfive::Glasses::createConnectionHelper | ( | const std::string & | displayName,
|  | std::chrono::milliseconds | connectionPollInterval = `std::chrono::milliseconds(100)`
| ) |  | -> std::unique_ptr<GlassesConnectionHelper>
| inline

Create a GlassesConnectionHelper.

Using GlassesConnectionHelper

Parameters

  [in] | displayName | - The user facing display name for this instance.
  [in] | connectionPollInterval | - Period between attempts to connect.

Returns
  A std::unique_ptr to a GlassesConnectionHelper

Definition at line 736 of file TiltFiveNative.hpp.

## ◆ ensureReady()

auto tiltfive::Glasses::ensureReady | ( |  | ) | -> Result<void>
| inline

Ensure that reserved glasses are ready for exclusive operations.

Ensure that reserved glasses are ready for exclusive operations, such as the ability to get poses (getLatestGlassesPose()) and send frames (sendFrame()). To reserve glasses for exclusive use, see reserve(). This must be checked for success prior to exclusive operations, otherwise those operations will fail.

In normal operation, this will return successfully or contain the error tiltfive::Error::kTryAgain. This should be called until success or an different error is seen.

If glasses are not reserved before calling, this will return an error.

Returns
  Result indicating success or error.

Definition at line 531 of file TiltFiveNative.hpp.

## ◆ getChangedParams()

auto tiltfive::Glasses::getChangedParams | ( |  | ) | -> Result<std::vector<T5_ParamGlasses>>
| inline

Get a system-wide list of changed parameters.

This function doesn't return the values of the changed parameters, but vector of the parameters that have changed since this function was last called. Note that as a result, the first call to this function will always result in a count of 0.

Returns
  A std::vector of T5_ParamGlasses containing the changed parameters

Definition at line 428 of file TiltFiveNative.hpp.

## ◆ getConnectionState()

auto tiltfive::Glasses::getConnectionState | ( |  | ) | -> Result<ConnectionState>
| inline

Get the current connection state of the glasses.

Returns
  ConnectionState representing the current connection state.

Definition at line 396 of file TiltFiveNative.hpp.

## ◆ getFilledCamImageBuffer()

auto tiltfive::Glasses::getFilledCamImageBuffer | ( |  | ) | -> Result<T5_CamImage>
| inline

Get the latest camera image for this glasses.

Returns
  T5_CamImage representing the most recent tt image.

Definition at line 599 of file TiltFiveNative.hpp.

## ◆ getFriendlyName()

auto tiltfive::Glasses::getFriendlyName | ( |  | ) | -> Result<std::string>
| inline

Get the user-facing name of the glasses.

The value of the friendly name is user specified in the Tilt Five™ UI.

This can be changed by the user during a session, and as such must not be used as any kind of key. Use getIdentifier() instead.

Returns
  UTF8 encoded friendly name.

Definition at line 476 of file TiltFiveNative.hpp.

## ◆ getHandle()

auto tiltfive::Glasses::getHandle | ( |  | ) | const -> T5_Glasses
| inline

Obtain the C handle for this glasses object.

This is the lower level handle for use with the C interface. In almost all cases, you won't need to use this. If in doubt, don't.

Returns
  The C handle

Definition at line 376 of file TiltFiveNative.hpp.

## ◆ getIdentifier()

auto tiltfive::Glasses::getIdentifier | ( |  | ) | const -> std::string
| inline

Obtain a hardware (not user facing) identifier for the glasses.

Guaranteed to be stable for the duration of the glasses connection.

Not guaranteed to be stable between sessions. Commonly it will be, however if a user de-registers their glasses and re-registers them the identifier may change. IE - It's a local semi-stable software identifier, not a persistent hardware identifier.

Returns
  Non user-facing identifier for the glasses.

Definition at line 389 of file TiltFiveNative.hpp.

## ◆ getIpd()

auto tiltfive::Glasses::getIpd | ( |  | ) | -> Result<double>
| inline

Get the current IPD setting for this glasses.

The value of the IPD is user specified in the Tilt Five™ UI. Clients should query this parameter and adjust their rendering appropriately to provide a comfortable user experience.

Returns
  Current IPD in meters.

Definition at line 458 of file TiltFiveNative.hpp.

## ◆ getLatestGlassesPose()

auto tiltfive::Glasses::getLatestGlassesPose | ( | T5_GlassesPoseUsage | usage | ) | -> Result<T5_GlassesPose>
| inline

Get the latest pose for this glasses.

Parameters

  [in] | usage | T5_GlassesPoseUsage indicating the intended use for the glasses pose.

Returns
  T5_GlassesPose representing the most recent pose.

Definition at line 561 of file TiltFiveNative.hpp.

## ◆ getWandStreamHelper()

auto tiltfive::Glasses::getWandStreamHelper | ( |  | ) | -> std::shared_ptr<WandStreamHelper>
| inline

Get a WandStreamHelper.

Using WandStreamHelper

Returns
  A std::shared_ptr to a WandStreamHelper

Definition at line 719 of file TiltFiveNative.hpp.

## ◆ initGraphicsContext()

auto tiltfive::Glasses::initGraphicsContext | ( | T5_GraphicsApi | graphicsApi,
|  | void * | graphicsContext
| ) |  | -> Result<void>
| inline

Initialize the glasses for graphics operations.

Parameters

  [in] | graphicsApi | - T5_GraphicsApi specifying the graphics API for the glasses.
  [in] | graphicsContext | - Meaning depends on the graphics API in use.

Definition at line 576 of file TiltFiveNative.hpp.

## ◆ listWands()

auto tiltfive::Glasses::listWands | ( |  | ) | -> Result<std::vector<T5_WandHandle>>
| inline

Obtain a list of connected wands.

Returns
  std::vector <T5_WandHandle> representing the available wands.

Definition at line 649 of file TiltFiveNative.hpp.

## ◆ readWandStream()

auto tiltfive::Glasses::readWandStream | ( | std::chrono::milliseconds | timeout = `std::chrono::milliseconds(100)` | ) | -> Result<T5_WandStreamEvent>
| inline

Read from the wands event stream.

The client should repeatedly call this for as long as the wand event stream is enabled. In any polling period, the client should call this in a loop until it returns Error::kTimeout to ensure that the queue is drained.

The server will continuously write events to the stream, and will not block for clients that have fallen behind reading the stream. Wand events that overflow the buffer are discarded. In the event of falling behind the client should do any static query that it needs to do (such as enumerating connected wands), and attempt to read the stream faster.

Parameters

  [in] | timeout | - Timeout in ms to wait before returning without read.

Definition at line 703 of file TiltFiveNative.hpp.

## ◆ release()

auto tiltfive::Glasses::release | ( |  | ) | -> Result<void>
| inline

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.

Returns
  Result indicating success or error.

Definition at line 547 of file TiltFiveNative.hpp.

## ◆ reserve()

auto tiltfive::Glasses::reserve | ( | const std::string & | displayName | ) | -> Result<void>
| inline

Reserve glasses for exclusive operations by the client.

Although several operations can be performed without acquiring an exclusive lock on glasses, there are a few for which an exclusive lock is required. Primarily, the ability to get poses (getLatestGlassesPose()) and send frames (sendFrame()). To reserve glasses for exclusive use, use this function.

Clients may request glasses that aren't fully available yet (e.g. a device that isn't fully booted, or needs to be rebooted to be compatible with the client). That is why there's a two-step approach here requiring a request for exclusive access first. To finish preparing for exclusive operations, use ensureReady().

Repeated calls to this function should be made until a exclusive reservation is successful or an error occurs.

Attention
  Ensure that the lifetime of the graphics context remains valid for the duration of the glasses connection.

Parameters

  [in] | displayName | - string to display for this program in control panel (localized), e.g. "Awesome Game (Player 1)"

Definition at line 508 of file TiltFiveNative.hpp.

## ◆ sendFrame()

auto tiltfive::Glasses::sendFrame | ( | const T5_FrameInfo *const | frameInfo | ) | -> Result<void>
| inline

Send a frame to display on the glasses.

Parameters

  [in] | frameInfo | - T5_FrameInfo detailing the frame to display.

Definition at line 637 of file TiltFiveNative.hpp.

## ◆ submitEmptyCamImageBuffer()

auto tiltfive::Glasses::submitEmptyCamImageBuffer | ( | T5_CamImage * | imgBuffer | ) | -> Result<void>
| inline

Submit a buffer to the camera image stream to hold Camera Frame data.

Parameters

  [in] | imgBuffer | - T5_CamImage representing the buffer to be filled.

Definition at line 612 of file TiltFiveNative.hpp.

The documentation for this class was generated from the following file:

- TiltFiveNative.hpp