| Tilt Five NDK |

Functions
Wand related
Tilt Five™ Native Interface (C) » Glasses functions

Functions related to wands. More...

Collaboration diagram for Wand related:

## Functions
T5_EXPORT T5_Result | t5ListWandsForGlasses (T5_Glasses glasses, T5_WandHandle *buffer, uint8_t *count)
| List available wands connected to this glasses. More...
T5_EXPORT T5_Result | t5ConfigureWandStreamForGlasses (T5_Glasses glasses, const T5_WandStreamConfig *config)
| Configure the wand event stream. More...
T5_EXPORT T5_Result | t5ReadWandStreamForGlasses (T5_Glasses glasses, T5_WandStreamEvent *event, uint32_t timeoutMs)
| Read from the wands event stream. More...

## Detailed Description

Functions related to wands.

## Function Documentation

## ◆ t5ConfigureWandStreamForGlasses()

T5_EXPORT T5_Result t5ConfigureWandStreamForGlasses | ( | T5_Glasses | glasses,
|  | const T5_WandStreamConfig * | config
| ) |  |

Configure the wand event 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_WandStreamConfig 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::configureWandStream().

## ◆ t5ListWandsForGlasses()

T5_EXPORT T5_Result t5ListWandsForGlasses | ( | T5_Glasses | glasses,
|  | T5_WandHandle * | buffer,
|  | uint8_t * | count
| ) |  |

List available wands connected to this glasses.

The results are written to the buffer pointed to by 'buffer', up to the number of elements specified in 'bufferCapacity'. If the number of wands connected would overflow the buffer, T5_ERROR_OVERFLOW is returned.

The number of connected wands (and the number of elements that have been, or would be, written the the buffer), is returned in count.

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

Parameters

  [in] | glasses | - T5_Glasses returned by t5CreateGlasses().
  [out] | buffer | - T5_WandHandle buffer to receive the list of wand handles.
  [in,out] | count | - On Call: Size of buffer in elements. On Return: Number of elements present.

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 wand list.
  T5_ERROR_NO_CONTEXT | `glasses` is invalid.
  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.

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::listWands().

## ◆ t5ReadWandStreamForGlasses()

T5_EXPORT T5_Result t5ReadWandStreamForGlasses | ( | T5_Glasses | glasses,
|  | T5_WandStreamEvent * | event,
|  | uint32_t | timeoutMs
| ) |  |

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 ::T5_ERROR_TIMEOUT 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.

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

Parameters

  [in] | glasses | - T5_Glasses returned by t5CreateGlasses().
  [out] | event | - If an event is available, it will be written here.
  [in] | timeoutMs | - Timeout in ms to wait before returning without read.

Return values

  T5_SUCCESS | Wand stream event written to `glasses`
  ::T5_ERROR_TIMEOUT | Timeout waiting for wand stream event
  T5_ERROR_NO_CONTEXT | `glasses` is invalid.
  T5_ERROR_UNAVAILABLE | Wand stream isn't configured as enabled. Use t5ConfigureWandStream() to enable.
  T5_ERROR_IO_FAILURE | Failed to communicate with the service.

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

Return values

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

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