Tilt Five NDK  1.4.1

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 t5SendImpulse (T5_Glasses glasses, T5_WandHandle wand, float amplitude, uint16_t duration)
 Send a haptic data buffer to a wand. 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_SUCCESSStream configured ok.
T5_ERROR_IO_FAILUREFailed to communicate with the service.
T5_ERROR_NO_SERVICEService is unavailable.
T5_ERROR_TARGET_NOT_FOUNDDevice not found.
T5_ERROR_NO_CONTEXTglasses is invalid.

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

Return values
T5_ERROR_INTERNALInternal (Not correctable): Generic error.
T5_ERROR_INVALID_STATEInternal (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_SUCCESSList successfully written to buffer.
T5_ERROR_INVALID_ARGSNullptr was supplied for buffer. or Nullptr was supplied for count.
T5_ERROR_OVERFLOWProvided buffer is too small to contain wand list.
T5_ERROR_NO_CONTEXTglasses is invalid.
T5_ERROR_IO_FAILUREFailed to communicate with the service.
T5_ERROR_NO_SERVICEService is unavailable.
T5_ERROR_TARGET_NOT_FOUNDDevice not found.

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

Return values
T5_ERROR_INTERNALInternal (Not correctable): Generic error.
T5_ERROR_INVALID_STATEInternal (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_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_SUCCESSWand stream event written to glasses
T5_TIMEOUTTimeout waiting for wand stream event
T5_ERROR_NO_CONTEXTglasses is invalid.
T5_ERROR_UNAVAILABLEWand stream isn't configured as enabled. Use t5ConfigureWandStream() to enable.
T5_ERROR_IO_FAILUREFailed to communicate with the service.

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

Return values
T5_ERROR_DECODE_ERRORInternal (Not correctable): Decode error.
T5_ERROR_INTERNALInternal (Not correctable): Generic error.
T5_ERROR_INVALID_STATEInternal (Not correctable): Invalid state for request.

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

◆ t5SendImpulse()

T5_EXPORT T5_Result t5SendImpulse ( T5_Glasses  glasses,
T5_WandHandle  wand,
float  amplitude,
uint16_t  duration 
)

Send a haptic data buffer to a wand.

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]wand- T5_WandHandle to get value for.
[in]amplitude- The amplitude of the impulse, between 0.0 and 1.0.
[in]duration- The duration, in ms, of the impulse. Duration must be less than or equal to 320ms.
Return values
T5_SUCCESSList successfully written to buffer.
T5_ERROR_INVALID_ARGSValue outside of [0.0,1.0] was supplied for amplitude. or Value outside of [0,320] was supplied for duration.
T5_ERROR_NO_CONTEXTglasses is invalid.
T5_ERROR_IO_FAILUREFailed to communicate with the service.
T5_ERROR_NO_SERVICEService is unavailable.
T5_ERROR_TARGET_NOT_FOUNDDevice not found.

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

Return values
T5_ERROR_INTERNALInternal (Not correctable): Generic error.
T5_ERROR_INVALID_STATEInternal (Not correctable): Invalid state for request.

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