Tilt Five NDK  1.4.1
Context object management
Collaboration diagram for Context object management:

Functions

T5_EXPORT T5_Result t5CreateContext (T5_Context *context, const T5_ClientInfo *clientInfo, void *platformContext)
 Create a context object. More...
 
T5_EXPORT void t5DestroyContext (T5_Context *context)
 Destroy a context object. More...
 

Detailed Description

Function Documentation

◆ t5CreateContext()

T5_EXPORT T5_Result t5CreateContext ( T5_Context context,
const T5_ClientInfo clientInfo,
void *  platformContext 
)

Create a context object.

Internally, this starts a client connection to the Tilt Five™ service, which is required for other library functions.

This function can succeed even if it can't connect to the service, but will continue to attempt to connect. If the service connection goes away at any time, the client will reconnect automatically when it returns.

Calling t5CreateContext() multiple times is valid, but likely unnecessary. It will result in multiple separate connections to the service. Note that you do not need multiple separate connections to connect to multiple glasses.

Contexts should be destroyed with t5DestroyContext() after a client is done. Failure to do so will keep the client connected and leak memory.

Some platforms may require additional parameters to create the context. For example, Android uses JNI, which requires information about the JVM in the form of a NativePlatformContext passed in from the Java layer.

Attention
Ensure that the lifetimes of the T5_ClientInfo members remain valid for the duration of the context.
Threading
Exclusivity group 1 - Functions in this group must not be called concurrently from different threads.
Parameters
[out]context- Pointer to a T5_Context to be created
[in]clientInfo- T5_ClientInfo filled by client to detail client information.
[in]platformContext- Platform specific context.
Platform Value
Android Pointer to a jobject/NativePlatformContext
Linux Should be set to 0
Windows Should be set to 0
Return values
T5_SUCCESSContext object was written to context
T5_ERROR_INVALID_ARGSNullptr was supplied for clientInfo.
T5_ERROR_STRING_OVERFLOWOne or more of the provided strings is too long.

◆ t5DestroyContext()

T5_EXPORT void t5DestroyContext ( T5_Context context)

Destroy a context object.

This function destroys a T5_Context context object created with t5CreateContext() and closes it's connection to the Tilt Five™ service.

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

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

Parameters
[in,out]context- T5_Context returned by t5CreateContext(). Invalidated on return.