Functions related to wands. More...
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... | |
Functions related to wands.
T5_EXPORT T5_Result t5ConfigureWandStreamForGlasses | ( | T5_Glasses | glasses, |
const T5_WandStreamConfig * | config | ||
) |
Configure the wand event stream.
[in] | glasses | - T5_Glasses returned by t5CreateGlasses() |
[in] | config | - T5_WandStreamConfig filled by client to detail configuration |
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:
T5_ERROR_INTERNAL | Internal (Not correctable): Generic error. |
T5_ERROR_INVALID_STATE | Internal (Not correctable): Invalid state for request. |
Referenced by tiltfive::Glasses::configureWandStream().
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.
[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. |
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:
T5_ERROR_INTERNAL | Internal (Not correctable): Generic error. |
T5_ERROR_INVALID_STATE | Internal (Not correctable): Invalid state for request. |
Referenced by tiltfive::Glasses::listWands().
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.
[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. |
T5_SUCCESS | Wand stream event written to glasses |
T5_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:
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().
T5_EXPORT T5_Result t5SendImpulse | ( | T5_Glasses | glasses, |
T5_WandHandle | wand, | ||
float | amplitude, | ||
uint16_t | duration | ||
) |
Send a haptic data buffer to a wand.
[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. |
T5_SUCCESS | List successfully written to buffer. |
T5_ERROR_INVALID_ARGS | Value outside of [0.0,1.0] was supplied for amplitude. or Value outside of [0,320] was supplied for duration. |
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:
T5_ERROR_INTERNAL | Internal (Not correctable): Generic error. |
T5_ERROR_INVALID_STATE | Internal (Not correctable): Invalid state for request. |
Referenced by tiltfive::Glasses::sendImpulse().