| Tilt Five NDK |

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

## Modules
| System-wide parameters

## Functions
T5_EXPORT T5_Result | t5ListGlasses (T5_Context context, char *buffer, size_t *bufferSize)
| Enumerate all glasses. More...
T5_EXPORT T5_Result | t5CreateGlasses (T5_Context context, const char *id, T5_Glasses *glasses)
| Create a glasses access object. More...
T5_EXPORT void | t5DestroyGlasses (T5_Glasses *glasses)
| Destroy a glasses object. More...
T5_EXPORT T5_Result | t5GetGameboardSize (T5_Context context, T5_GameboardType gameboardType, T5_GameboardSize *gameboardSize)
| Get the gameboard dimensions. More...

## Detailed Description

Require a T5_Context for invocation

## Function Documentation

## ◆ t5CreateGlasses()

T5_EXPORT T5_Result t5CreateGlasses | ( | T5_Context | context,
|  | const char * | id,
|  | T5_Glasses * | glasses
| ) |  |

Create a glasses access object.

Use t5ListGlasses() to obtain a list of ids usable for the `id` parameter.

Destroy with t5DestroyGlasses()

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

Threading
  Exclusivity group 1 - Functions in this group must not be called concurrently from different threads. The calling thread must be the thread that provided the graphics context.

Parameters

  [in] | context | - T5_Context returned by t5CreateContext().
  [in] | id | - Null terminated C string specifying the target glasses.
  [out] | glasses | - T5_Glasses for use with glasses related functions.

Return values

  T5_SUCCESS | Obtained handle to glasses.
  T5_ERROR_INVALID_ARGS | Nullptr was supplied for `id`. or Nullptr was supplied for `glasses`.
  T5_ERROR_NO_CONTEXT | `context` is invalid.
  T5_ERROR_STRING_OVERFLOW | One or more of the provided strings is too long.
  T5_ERROR_INTERNAL | Internal (Not correctable): Generic error.
  T5_ERROR_SERVICE_INCOMPATIBLE | Service is incompatible; context cannot be used. Need driver upgrade.

## ◆ t5DestroyGlasses()

T5_EXPORT void t5DestroyGlasses | ( | T5_Glasses * | glasses | ) |

Destroy a glasses object.

Destroys a T5_Glasses returned by t5CreateGlasses() and frees any associated resources.

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

Attempting to use a T5_Glasses after it has been destroyed will result in a T5_ERROR_NO_CONTEXT error.

Parameters

  [in,out] | glasses | - T5_Glasses returned by t5CreateGlasses(). Invalidated on return.

## ◆ t5GetGameboardSize()

T5_EXPORT T5_Result t5GetGameboardSize | ( | T5_Context | context,
|  | T5_GameboardType | gameboardType,
|  | T5_GameboardSize * | gameboardSize
| ) |  |

Get the gameboard dimensions.

Threading
  Thread safe - may be called by any thread at any time.

Parameters

  [in] | context | - T5_Context returned by t5CreateContext()
  [in] | gameboardType | - T5_GameboardType we're interested in
  [out] | gameboardSize | - Resulting gameboard dimensions

Return values

  T5_SUCCESS | Changed parameter list written to buffer.
  T5_ERROR_INVALID_ARGS | Gameboard type invalid or nullptr supplied for gameboardSize.

Referenced by tiltfive::Client::getGameboardSize().

## ◆ t5ListGlasses()

T5_EXPORT T5_Result t5ListGlasses | ( | T5_Context | context,
|  | char * | buffer,
|  | size_t * | bufferSize
| ) |  |

Enumerate all glasses.

An entry in this list does not mean that it's available for use by the client. This list includes glasses that are locked for use by other clients as well as glasses that are not in the 'ready' state (E.g. Rebooting).

t5CreateGlasses() can be called on any entry, even if the glasses aren't currently available.

The result is encoded as a sequence of null-terminated strings, with the final entry being an empty string (IE The last entry is terminated with two nulls).

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

Parameters

  [in] | context | - T5_Context returned by t5CreateContext().
  [out] | buffer | - Buffer to receive the list of devices as a series of null terminated strings. The last element will be an empty string (I.E. the list is terminated with two null chars in sequence).
  [in,out] | bufferSize | - On Call: Size of buffer. On Return: Size of written data. Note that this may be larger than the buffer, in which case T5_ERROR_OVERFLOW is returned, and this value represents the size of the buffer needed to avoid overflow.

Return values

  T5_SUCCESS | List successfully written to buffer.
  T5_ERROR_INVALID_ARGS | Nullptr was supplied for `buffer`. or Nullptr was supplied for `count`.
  T5_ERROR_OVERFLOW | Provided buffer is too small to contain glasses list.
  T5_ERROR_IO_FAILURE | Failed to communicate with the service.
  T5_ERROR_NO_SERVICE | Service is unavailable.
  T5_ERROR_NO_CONTEXT | `context` is invalid.
  T5_ERROR_INTERNAL | Internal (Not correctable): Generic error.
  T5_ERROR_STRING_OVERFLOW | Internal (Not correctable): String conversion overflow.
  T5_ERROR_SERVICE_INCOMPATIBLE | Service is incompatible; context cannot be used. Need driver upgrade.

Referenced by tiltfive::Client::listGlasses().