| Tilt Five NDK |

TiltFiveNative.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2020-2022 Tilt Five, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
21
22#include "errors.h"
23#include "types.h"
24
25#ifndef __cplusplus
26#include <stddef.h>
27#else
28#include <cstddef>
29#endif
30
31#ifdef _WIN32
32#ifdef BUILDING_T5_NATIVE_DLL
33#ifdef __GNUC__
34#define T5_EXPORT __attribute__((dllexport))
35#else // !__GNUC__
36#define T5_EXPORT __declspec(dllexport)
37#endif // !__GNUC__
38#else // !BUILDING_T5_NATIVE_DLL
39#define T5_EXPORT
40#endif // !BUILDING_T5_NATIVE_DLL
41#else // !_WIN32
42#define T5_EXPORT __attribute__((visibility("default")))
43#endif // !_WIN32
44
45#ifdef __cplusplus
46 extern "C" {
47#endif
48
52
56
59
99T5_EXPORT T5_Result t5CreateContext(T5_Context* context,
100 const T5_ClientInfo* clientInfo,
101 void* platformContext);
102
116T5_EXPORT void t5DestroyContext(T5_Context* context);
117
119// C_Ctx
120
124
163T5_EXPORT T5_Result t5ListGlasses(T5_Context context, char* buffer, size_t* bufferSize);
164
191T5_EXPORT T5_Result t5CreateGlasses(T5_Context context, const char* id, T5_Glasses* glasses);
192
206T5_EXPORT void t5DestroyGlasses(T5_Glasses* glasses);
207
209
239T5_EXPORT T5_Result t5GetSystemIntegerParam(T5_Context context, T5_ParamSys param, int64_t* value);
240
270T5_EXPORT T5_Result t5GetSystemFloatParam(T5_Context context, T5_ParamSys param, double* value);
271
311T5_EXPORT T5_Result t5GetSystemUtf8Param(T5_Context context,
312 T5_ParamSys param,
313 char* buffer,
314 size_t* bufferSize);
315
341T5_EXPORT T5_Result t5GetChangedSystemParams(T5_Context context,
342 T5_ParamSys* buffer,
343 uint16_t* count);
344
357T5_EXPORT T5_Result t5GetGameboardSize(T5_Context context,
358 T5_GameboardType gameboardType,
359 T5_GameboardSize* gameboardSize);
361// C_Sys
362
366
369
404T5_EXPORT T5_Result t5ReserveGlasses(T5_Glasses glasses, const char* displayName);
405
422T5_EXPORT T5_Result t5SetGlassesDisplayName(T5_Glasses glasses, const char* displayName);
423
454T5_EXPORT T5_Result t5EnsureGlassesReady(T5_Glasses glasses);
455
470T5_EXPORT T5_Result t5ReleaseGlasses(T5_Glasses glasses);
471
485T5_EXPORT T5_Result t5GetGlassesConnectionState(T5_Glasses glasses,
486 T5_ConnectionState* connectionState);
487
507T5_EXPORT T5_Result t5GetGlassesIdentifier(T5_Glasses glasses, char* buffer, size_t* bufferSize);
508
513
536T5_EXPORT T5_Result t5GetGlassesPose(T5_Glasses glasses,
537 T5_GlassesPoseUsage usage,
538 T5_GlassesPose* pose);
539
565T5_EXPORT T5_Result t5InitGlassesGraphicsContext(T5_Glasses glasses,
566 T5_GraphicsApi graphicsApi,
567 void* graphicsContext);
568
587T5_EXPORT T5_Result t5ConfigureCameraStreamForGlasses(T5_Glasses glasses,
588 T5_CameraStreamConfig config);
589
595//
615 T5_EXPORT T5_Result t5GetFilledCamImageBuffer(T5_Glasses glasses, T5_CamImage* image);
616
618//
645 T5_EXPORT T5_Result t5SubmitEmptyCamImageBuffer(T5_Glasses glasses, T5_CamImage* image);
646
648//
665 T5_EXPORT T5_Result t5CancelCamImageBuffer(T5_Glasses glasses, uint8_t* buffer);
666
684//
709 T5_EXPORT T5_Result t5SendFrameToGlasses(T5_Glasses glasses, const T5_FrameInfo* info);
710
713
742T5_EXPORT T5_Result t5GetGlassesIntegerParam(T5_Glasses glasses,
743 T5_WandHandle wand,
744 T5_ParamGlasses param,
745 int64_t* value);
746
775T5_EXPORT T5_Result t5GetGlassesFloatParam(T5_Glasses glasses,
776 T5_WandHandle wand,
777 T5_ParamGlasses param,
778 double* value);
779
818T5_EXPORT T5_Result t5GetGlassesUtf8Param(T5_Glasses glasses,
819 T5_WandHandle wand,
820 T5_ParamGlasses param,
821 char* buffer,
822 size_t* bufferSize);
823
847T5_EXPORT T5_Result t5GetChangedGlassesParams(T5_Glasses glasses,
848 T5_ParamGlasses* buffer,
849 uint16_t* count);
850
853
886T5_EXPORT T5_Result t5ListWandsForGlasses(T5_Glasses glasses,
887 T5_WandHandle* buffer,
888 uint8_t* count);
889
909T5_EXPORT T5_Result t5ConfigureWandStreamForGlasses(T5_Glasses glasses,
910 const T5_WandStreamConfig* config);
911
945T5_EXPORT T5_Result t5ReadWandStreamForGlasses(T5_Glasses glasses,
946 T5_WandStreamEvent* event,
947 uint32_t timeoutMs);
948
950// C_Gls
951
953// C_Glasses_Interface
954
955#ifdef __cplusplus
956}
957#endif
958
959#undef T5_EXPORT
960
errors.h
C errors for the Tilt Five™ API.
T5_Result
uint32_t T5_Result
Represents an error code that may be returned by the Tilt Five™ API.
Definition: errors.h:47
t5CreateContext
T5_EXPORT T5_Result t5CreateContext(T5_Context *context, const T5_ClientInfo *clientInfo, void *platformContext)
Create a context object.
t5DestroyContext
T5_EXPORT void t5DestroyContext(T5_Context *context)
Destroy a context object.
t5CreateGlasses
T5_EXPORT T5_Result t5CreateGlasses(T5_Context context, const char *id, T5_Glasses *glasses)
Create a glasses access object.
t5GetGameboardSize
T5_EXPORT T5_Result t5GetGameboardSize(T5_Context context, T5_GameboardType gameboardType, T5_GameboardSize *gameboardSize)
Get the gameboard dimensions.
t5DestroyGlasses
T5_EXPORT void t5DestroyGlasses(T5_Glasses *glasses)
Destroy a glasses object.
t5ListGlasses
T5_EXPORT T5_Result t5ListGlasses(T5_Context context, char *buffer, size_t *bufferSize)
Enumerate all glasses.
t5GetSystemFloatParam
T5_EXPORT T5_Result t5GetSystemFloatParam(T5_Context context, T5_ParamSys param, double *value)
Get a system-wide floating point parameter.
t5GetSystemUtf8Param
T5_EXPORT T5_Result t5GetSystemUtf8Param(T5_Context context, T5_ParamSys param, char *buffer, size_t *bufferSize)
Get a system-wide UTF-8 encoded string parameter.
t5GetSystemIntegerParam
T5_EXPORT T5_Result t5GetSystemIntegerParam(T5_Context context, T5_ParamSys param, int64_t *value)
Get a system-wide integer parameter.
t5GetChangedSystemParams
T5_EXPORT T5_Result t5GetChangedSystemParams(T5_Context context, T5_ParamSys *buffer, uint16_t *count)
Get a system-wide list of changed parameters.
t5CancelCamImageBuffer
T5_EXPORT T5_Result t5CancelCamImageBuffer(T5_Glasses glasses, uint8_t *buffer)
Clear out the remaining buffers and return all buffers as a vector of camera images.
t5GetFilledCamImageBuffer
T5_EXPORT T5_Result t5GetFilledCamImageBuffer(T5_Glasses glasses, T5_CamImage *image)
t5ReleaseGlasses
T5_EXPORT T5_Result t5ReleaseGlasses(T5_Glasses glasses)
t5ConfigureCameraStreamForGlasses
T5_EXPORT T5_Result t5ConfigureCameraStreamForGlasses(T5_Glasses glasses, T5_CameraStreamConfig config)
Configure the camera stream.
t5SubmitEmptyCamImageBuffer
T5_EXPORT T5_Result t5SubmitEmptyCamImageBuffer(T5_Glasses glasses, T5_CamImage *image)
Submit an empty image buffer to be filled by the camera frame stream.
t5SetGlassesDisplayName
T5_EXPORT T5_Result t5SetGlassesDisplayName(T5_Glasses glasses, const char *displayName)
Set the display name for glasses that were previously reserved for exclusive operations.
t5GetGlassesConnectionState
T5_EXPORT T5_Result t5GetGlassesConnectionState(T5_Glasses glasses, T5_ConnectionState *connectionState)
Get the exclusivity/connection status of the glasses.
t5ReserveGlasses
T5_EXPORT T5_Result t5ReserveGlasses(T5_Glasses glasses, const char *displayName)
Reserve glasses for exclusive operations by the client.
t5GetGlassesIdentifier
T5_EXPORT T5_Result t5GetGlassesIdentifier(T5_Glasses glasses, char *buffer, size_t *bufferSize)
Get the device identifier of a glasses.
t5EnsureGlassesReady
T5_EXPORT T5_Result t5EnsureGlassesReady(T5_Glasses glasses)
Ensure that reserved glasses are ready for exclusive operations.
t5SendFrameToGlasses
T5_EXPORT T5_Result t5SendFrameToGlasses(T5_Glasses glasses, const T5_FrameInfo *info)
Send a frame to display on the glasses.
t5InitGlassesGraphicsContext
T5_EXPORT T5_Result t5InitGlassesGraphicsContext(T5_Glasses glasses, T5_GraphicsApi graphicsApi, void *graphicsContext)
Initialize the graphics context to enable sending rendered frames to the glasses.
t5GetGlassesPose
T5_EXPORT T5_Result t5GetGlassesPose(T5_Glasses glasses, T5_GlassesPoseUsage usage, T5_GlassesPose *pose)
Get the latest pose of the glasses.
t5GetGlassesFloatParam
T5_EXPORT T5_Result t5GetGlassesFloatParam(T5_Glasses glasses, T5_WandHandle wand, T5_ParamGlasses param, double *value)
Get a glasses floating point parameter.
t5GetGlassesUtf8Param
T5_EXPORT T5_Result t5GetGlassesUtf8Param(T5_Glasses glasses, T5_WandHandle wand, T5_ParamGlasses param, char *buffer, size_t *bufferSize)
Get a glasses UTF-8 encoded string parameter.
t5GetChangedGlassesParams
T5_EXPORT T5_Result t5GetChangedGlassesParams(T5_Glasses glasses, T5_ParamGlasses *buffer, uint16_t *count)
Get a glasses-specific list of changed parameters.
t5GetGlassesIntegerParam
T5_EXPORT T5_Result t5GetGlassesIntegerParam(T5_Glasses glasses, T5_WandHandle wand, T5_ParamGlasses param, int64_t *value)
Get a glasses integer parameter.
t5ReadWandStreamForGlasses
T5_EXPORT T5_Result t5ReadWandStreamForGlasses(T5_Glasses glasses, T5_WandStreamEvent *event, uint32_t timeoutMs)
Read from the wands event stream.
t5ListWandsForGlasses
T5_EXPORT T5_Result t5ListWandsForGlasses(T5_Glasses glasses, T5_WandHandle *buffer, uint8_t *count)
List available wands connected to this glasses.
t5ConfigureWandStreamForGlasses
T5_EXPORT T5_Result t5ConfigureWandStreamForGlasses(T5_Glasses glasses, const T5_WandStreamConfig *config)
Configure the wand event stream.
T5_ConnectionState
T5_ConnectionState
Glasses connection state.
Definition: types.h:153
T5_ParamGlasses
T5_ParamGlasses
Possible parameters that can be retrieved for glasses.
Definition: types.h:419
T5_WandHandle
uint8_t T5_WandHandle
Opaque handle used with wands.
Definition: types.h:83
T5_Context
struct T5_ContextImpl * T5_Context
Opaque handle used with system-wide functions.
Definition: types.h:71
T5_GraphicsApi
T5_GraphicsApi
Graphics API types.
Definition: types.h:86
T5_ParamSys
T5_ParamSys
Possible parameters that can be retrieved with System-wide parameters.
Definition: types.h:429
T5_GameboardType
T5_GameboardType
Possible gameboard types.
Definition: types.h:98
T5_Glasses
struct T5_GlassesImpl * T5_Glasses
Opaque handle used with glasses.
Definition: types.h:77
T5_GlassesPoseUsage
T5_GlassesPoseUsage
Glasses pose usage indicator.
Definition: types.h:168
cstddef
types.h
count
constexpr iterator_traits< _InputIterator >::difference_type count(_InputIterator __first, _InputIterator __last, const _Tp &__value)
T5_GameboardSize
Physical dimensions of a gameboard.
Definition: types.h:113
T5_ClientInfo
Client provided information for use with t5CreateGlasses()
Definition: types.h:136
T5_GlassesPose
Glasses pose information to be retrieved with t5GetGlassesPose()
Definition: types.h:199
T5_CameraStreamConfig
Camera stream configuration.
Definition: types.h:216
T5_FrameInfo
Render information to be used with t5SendFrameToGlasses()
Definition: types.h:225
T5_CamImage
Camera Frame information to be retrieved with t5GetFilledCamImageBuffer()
Definition: types.h:276
T5_WandStreamConfig
Wand stream configuration.
Definition: types.h:312
T5_WandStreamEvent
Represents an event from the wand stream.
Definition: types.h:404