58class WandStreamHelper;
59class GlassesConnectionHelper;
60class ParamChangeHelper;
61class ParamChangeListener;
84 static constexpr bool kDebug =
true;
87 : mApplicationId(
std::move(applicationId))
88 , mApplicationVersion(
std::move(applicationVersion)) {
110 os <<
"<Client:" << instance.mApplicationId <<
">";
116 void* platformContext,
119 static auto create(
const std::string& applicationId,
121 void* platformContext,
138 auto err =
t5CreateContext(&client->mContext, &client->mClientInfo, platformContext);
140 return static_cast<Error>(err);
174 bufferSize = buffer.
size();
179 if (bufferSize > 1024) {
183 buffer.
resize(bufferSize);
185 return static_cast<Error>(err);
191 auto buffPtr = buffer.
data();
198 buffPtr +=
id.
length() + 1;
216 return static_cast<Error>(err);
228 uint16_t changedParamsCount = 32;
231 changedParamsBuffer.
resize(changedParamsCount);
237 changedParamsBuffer.
resize(changedParamsCount);
238 return changedParamsBuffer;
241 changedParamsCount = changedParamsBuffer.
size() * 2;
245 return static_cast<Error>(err);
271 return static_cast<Error>(err);
286 return static_cast<Error>(err);
338 os <<
"<Glasses:" << instance.mIdentifier <<
">";
359 return static_cast<Error>(err);
364 glasses->mGlasses = handle;
400 return static_cast<Error>(err);
403 switch (connectionState) {
429 uint16_t changedParamsCount = 32;
432 changedParamsBuffer.
resize(changedParamsCount);
438 changedParamsBuffer.
resize(changedParamsCount);
439 return changedParamsBuffer;
442 changedParamsCount = changedParamsBuffer.
size() * 2;
446 return static_cast<Error>(err);
464 return static_cast<Error>(err);
484 return static_cast<Error>(err);
513 return static_cast<Error>(err);
536 return static_cast<Error>(err);
552 return static_cast<Error>(err);
568 return static_cast<Error>(err);
581 return static_cast<Error>(err);
592 return static_cast<Error>(err);
605 return static_cast<Error>(err);
617 return static_cast<Error>(err);
630 return static_cast<Error>(err);
642 return static_cast<Error>(err);
650 uint8_t wandCount = 4;
654 wandBuffer.
resize(wandCount);
661 for (
auto i = 0; i < wandCount; i++) {
668 wandCount = wandBuffer.
size() * 2;
672 return static_cast<Error>(err);
685 return static_cast<Error>(err);
711 return static_cast<Error>(err);
720 auto wandStreamHelper = mWandStreamHelper.lock();
721 if (!wandStreamHelper) {
724 mWandStreamHelper = wandStreamHelper;
726 return wandStreamHelper;
742 shared_from_this(), displayName, connectionPollInterval);
749 if (!connectionState) {
779 mLastAsyncError = err;
784 auto connectionState = mGlasses->getConnectionState();
785 if (!connectionState) {
786 setLastAsyncError(connectionState.error());
791 switch (*connectionState) {
794 auto result = mGlasses->reserve(mDisplayName);
796 setLastAsyncError(result.error());
806 auto result = mGlasses->ensureReady();
808 setLastAsyncError(result.error());
838 , mConnectionPollInterval(connectionPollInterval) {
840 mThread =
std::thread(&GlassesConnectionHelper::threadMain,
this);
851 auto connectionState = mGlasses->getConnectionState();
852 if (!connectionState) {
853 return connectionState.error();
859 connectionState = mGlasses->getConnectionState();
860 if (!connectionState) {
861 return connectionState.error();
872 auto start = std::chrono::steady_clock::now();
874 auto connectionState = mGlasses->getConnectionState();
875 if (!connectionState) {
876 return connectionState.error();
880 if ((std::chrono::steady_clock::now() -
start) >
timeout) {
886 connectionState = mGlasses->getConnectionState();
887 if (!connectionState) {
888 return connectionState.error();
903 return mLastAsyncError.exchange({});
909 if (mThread.joinable()) {
945 mLastAsyncError = err;
950 auto result = glasses->readWandStream(mPollTimeout);
952 return result.error();
958 switch (result->type) {
960 mLastWandReports[result->wandId] = {};
961 mWandListDirty =
true;
965 mLastWandReports.
erase(result->wandId);
966 mWandListDirty =
true;
970 mWandListDirty =
true;
974 mLastWandReports[result->wandId] = result->report;
987 auto refreshReports() ->
void {
993 mLastWandReports.
cend(),
998 for (
const auto& connectedWand : mWandList) {
999 lastWandReportKeys.
erase(connectedWand);
1004 for (
auto defunctKey : lastWandReportKeys) {
1005 mLastWandReports.
erase(defunctKey);
1011 bool configured =
false;
1016 auto configureRequest = mGlasses->configureWandStream(&streamConfig);
1017 if (!configureRequest) {
1018 setLastAsyncError(configureRequest.error());
1026 auto result = drainStream(mGlasses);
1031 setLastAsyncError(result.error());
1037 streamConfig.enabled =
false;
1038 auto configureRequest = mGlasses->configureWandStream(&streamConfig);
1039 if (!configureRequest) {
1040 setLastAsyncError(configureRequest.error());
1054 : mGlasses(
std::move(glasses)), mPollTimeout(pollTimeout) {
1056 mThread =
std::thread(&WandStreamHelper::threadMain,
this);
1062 auto report = mLastWandReports.
find(handle);
1063 if (report == mLastWandReports.
end()) {
1067 return report->second;
1080 return mLastAsyncError.exchange({});
1093 if (mWandListDirty.exchange(
false)) {
1094 auto result = mGlasses->listWands();
1096 mWandListDirty =
true;
1097 return result.error();
1101 for (
auto wandHandle : *result) {
1104 mWandList = wandHandles;
1111 for (
auto wandHandle : mWandList) {
1121 if (mThread.joinable()) {
1152 static constexpr size_t kDefaultSettingBufferSize = 16;
1170 mLastAsyncError = err;
1183 , mPollInterval(pollInterval) {
1185 mThread =
std::thread(&ParamChangeHelper::threadMain,
this);
1190 for (
const auto& glasses : mRegisteredGlasses) {
1191 checkGlassesParams(glasses, listener);
1197 uint16_t changeCount;
1199 mChangedGlassesParams.
resize(kDefaultSettingBufferSize);
1201 changeCount = mChangedGlassesParams.
size();
1203 glasses->mGlasses, mChangedGlassesParams.
data(), &changeCount);
1206 if (changeCount > 0) {
1207 mChangedGlassesParams.
resize(changeCount);
1208 listener->onGlassesParamChanged(glasses, mChangedGlassesParams);
1215 mChangedSysParams.
resize(mChangedSysParams.
size() * 2);
1219 setLastAsyncError(
static_cast<Error>(err));
1225 uint16_t changeCount;
1227 mChangedSysParams.
resize(kDefaultSettingBufferSize);
1229 changeCount = mChangedSysParams.
size();
1234 if (changeCount > 0) {
1235 mChangedSysParams.
resize(changeCount);
1236 listener->onSysParamChanged(mChangedSysParams);
1243 mChangedSysParams.
resize(mChangedSysParams.
size() * 2);
1247 setLastAsyncError(
static_cast<Error>(err));
1252 auto threadMain() ->
void {
1256 auto listener = mChangeListener.lock();
1261 checkGlassesParams(listener);
1263 checkSysParams(listener);
1274 if (mThread.joinable()) {
1289 return mLastAsyncError.exchange({});
1295 mRegisteredGlasses.
insert(glasses);
1301 mRegisteredGlasses.
erase(glasses);
1320 os <<
"<Wand:" << +instance.mHandle <<
">";
1333 return mWandStreamHelper->getLatestReport(mHandle);
1353 void* platformContext,
1356 return Client::create(applicationId, applicationVersion, platformContext, sdkType);
1367 return Glasses::create(identifier, client);
1415 << (instance.
poseValid ?
"P" :
"_") <<
"]";
1418 os <<
"[A: " << std::right << std::fixed << std::setw(10) << instance.
stick.x <<
"x"
1419 << std::right << std::fixed << std::setw(10) << instance.
stick.y <<
" | " << std::right
1420 << std::fixed << std::setw(10) << instance.
trigger <<
"]";
1422 os <<
"[A: Invalid]";
1426 os <<
"[B: " << (instance.
buttons.t5 ?
"T" :
"_") << (instance.
buttons.one ?
"1" :
"_")
1427 << (instance.
buttons.two ?
"2" :
"_") << (instance.
buttons.three ?
"3" :
"_")
1428 << (instance.
buttons.a ?
"A" :
"_") << (instance.
buttons.b ?
"B" :
"_")
1429 << (instance.
buttons.x ?
"X" :
"_") << (instance.
buttons.y ?
"Y" :
"_") <<
"]";
1431 os <<
"[B: Invalid]";
1435 os <<
"[P: (" << std::right << std::fixed << std::setw(10) << instance.
posGrip_GBD.x <<
","
1436 << std::right << std::fixed << std::setw(10) << instance.
posGrip_GBD.y <<
","
1437 << std::right << std::fixed << std::setw(10) << instance.
posGrip_GBD.z <<
") ("
1438 << std::right << std::fixed << std::setw(10) << instance.
rotToWND_GBD.w <<
","
1439 << std::right << std::fixed << std::setw(10) << instance.
rotToWND_GBD.x <<
","
1440 << std::right << std::fixed << std::setw(10) << instance.
rotToWND_GBD.y <<
","
1441 << std::right << std::fixed << std::setw(10) << instance.
rotToWND_GBD.z <<
")"
1454 gameboardType =
"None";
1457 gameboardType =
"LE";
1460 gameboardType =
"XE";
1463 gameboardType =
"XE (Raised)";
1467 gameboardType =
std::string(
"[Invalid T5_GameboardType : ") +
1473 os <<
"[" << instance.
timestampNanos <<
"| " << gameboardType <<
" (" << std::right
1474 << std::fixed << std::setw(10) << instance.
posGLS_GBD.x <<
"," << std::right << std::fixed
1475 << std::setw(10) << instance.
posGLS_GBD.y <<
"," << std::right << std::fixed << std::setw(10)
1476 << instance.
posGLS_GBD.z <<
") (" << std::right << std::fixed << std::setw(10)
1477 << instance.
rotToGLS_GBD.w <<
"," << std::right << std::fixed << std::setw(10)
1478 << instance.
rotToGLS_GBD.x <<
"," << std::right << std::fixed << std::setw(10)
1479 << instance.
rotToGLS_GBD.y <<
"," << std::right << std::fixed << std::setw(10)
1491 os <<
"Service Version";
1495 os <<
"UI Attention Required";
1500 os <<
"[Invalid T5_ParamSys : " <<
static_cast<int>(instance) <<
"]";
1516 os <<
"Friendly Name";
1521 os <<
"[Invalid T5_ParamGlasses : " <<
static_cast<int>(instance) <<
"]";
uint32_t T5_Result
Represents an error code that may be returned by the Tilt Five™ API.
C++ errors for the Tilt Five™ API.
C++ Templated common return type for the Tilt Five™ API.
C interface definition for the Tilt Five™ API.
#define T5_ERROR_SETTING_UNKNOWN
The requested param is unknown.
#define T5_SUCCESS
Success.
#define T5_ERROR_OVERFLOW
Buffer overflow.
Error
Error codes returned by most functions of return type Result.
@ kStringOverflow
String overflow.
@ kInvalidArgument
Argument(s) are invalid.
@ kUnavailable
Target is unavailable.
@ kOverflow
Buffer overflow.
@ kTargetNotFound
Target (wand) not found.
@ kInternalError
An internal error occurred.
T5_EXPORT T5_Result t5CreateContext(T5_Context *context, const T5_ClientInfo *clientInfo, void *platformContext)
Create a context object.
T5_EXPORT void t5DestroyContext(T5_Context *context)
Destroy a context object.
T5_EXPORT T5_Result t5CreateGlasses(T5_Context context, const char *id, T5_Glasses *glasses)
Create a glasses access object.
T5_EXPORT T5_Result t5GetGameboardSize(T5_Context context, T5_GameboardType gameboardType, T5_GameboardSize *gameboardSize)
Get the gameboard dimensions.
T5_EXPORT void t5DestroyGlasses(T5_Glasses *glasses)
Destroy a glasses object.
T5_EXPORT T5_Result t5ListGlasses(T5_Context context, char *buffer, size_t *bufferSize)
Enumerate all glasses.
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.
T5_EXPORT T5_Result t5GetSystemIntegerParam(T5_Context context, T5_ParamSys param, int64_t *value)
Get a system-wide integer parameter.
T5_EXPORT T5_Result t5GetChangedSystemParams(T5_Context context, T5_ParamSys *buffer, uint16_t *count)
Get a system-wide list of changed parameters.
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.
T5_EXPORT T5_Result t5GetFilledCamImageBuffer(T5_Glasses glasses, T5_CamImage *image)
T5_EXPORT T5_Result t5ReleaseGlasses(T5_Glasses glasses)
T5_EXPORT T5_Result t5ConfigureCameraStreamForGlasses(T5_Glasses glasses, T5_CameraStreamConfig config)
Configure the camera stream.
T5_EXPORT T5_Result t5SubmitEmptyCamImageBuffer(T5_Glasses glasses, T5_CamImage *image)
Submit an empty image buffer to be filled by the camera frame stream.
T5_EXPORT T5_Result t5GetGlassesConnectionState(T5_Glasses glasses, T5_ConnectionState *connectionState)
Get the exclusivity/connection status of the glasses.
T5_EXPORT T5_Result t5ReserveGlasses(T5_Glasses glasses, const char *displayName)
Reserve glasses for exclusive operations by the client.
T5_EXPORT T5_Result t5EnsureGlassesReady(T5_Glasses glasses)
Ensure that reserved glasses are ready for exclusive operations.
T5_EXPORT T5_Result t5SendFrameToGlasses(T5_Glasses glasses, const T5_FrameInfo *info)
Send a frame to display on the glasses.
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.
T5_EXPORT T5_Result t5GetGlassesPose(T5_Glasses glasses, T5_GlassesPoseUsage usage, T5_GlassesPose *pose)
Get the latest pose of the glasses.
T5_EXPORT T5_Result t5GetGlassesFloatParam(T5_Glasses glasses, T5_WandHandle wand, T5_ParamGlasses param, double *value)
Get a glasses floating point parameter.
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.
T5_EXPORT T5_Result t5GetChangedGlassesParams(T5_Glasses glasses, T5_ParamGlasses *buffer, uint16_t *count)
Get a glasses-specific list of changed parameters.
T5_EXPORT T5_Result t5ReadWandStreamForGlasses(T5_Glasses glasses, T5_WandStreamEvent *event, uint32_t timeoutMs)
Read from the wands event stream.
T5_EXPORT T5_Result t5ListWandsForGlasses(T5_Glasses glasses, T5_WandHandle *buffer, uint8_t *count)
List available wands connected to this glasses.
T5_EXPORT T5_Result t5ConfigureWandStreamForGlasses(T5_Glasses glasses, const T5_WandStreamConfig *config)
Configure the wand event stream.
auto obtainParamChangeHelper(std::shared_ptr< Client > client, std::weak_ptr< ParamChangeListener > listener, std::chrono::milliseconds pollInterval) -> std::unique_ptr< ParamChangeHelper >
Internal utility function - Do not call directly.
auto obtainGlassesConnectionHelper(std::shared_ptr< Glasses > glasses, const std::string &displayName, std::chrono::milliseconds connectionPollInterval) -> std::unique_ptr< GlassesConnectionHelper >
Internal utility function - Do not call directly.
auto obtainClient(const std::string &applicationId, const std::string &applicationVersion, void *platformContext, const uint8_t sdkType=0) -> Result< std::shared_ptr< Client > >
Obtain an instance of the Tilt Five™ API client.
auto obtainWandStreamHelper(std::shared_ptr< Glasses > glasses, std::chrono::milliseconds pollTimeout) -> std::shared_ptr< WandStreamHelper >
Internal utility function - Do not call directly.
auto obtainGlasses(const std::string &identifier, const std::shared_ptr< Client > &client) -> Result< std::shared_ptr< Glasses > >
Obtain an instance of the Tilt Five™ Glasses.
auto obtainWand(T5_WandHandle handle, std::shared_ptr< WandStreamHelper > wandStreamHelper) -> std::shared_ptr< Wand >
Internal utility function - Do not call directly.
ConnectionState
Represents the exclusivity connection state of glasses.
@ kReserved
Glasses are reserved for exclusive use by this client.
@ kConnected
Glasses are connected for exclusive use by this client.
@ kDisconnected
Glasses were previously connected for exclusive use, but have now disconnected.
@ kNotExclusivelyConnected
Glasses have not been connected for exclusive use. They may still be connected to the host.
std::ostream & operator<<(std::ostream &os, const T5_WandReport &instance)
Support for writing T5_WandReport to an std::ostream.
#define T5_MAX_STRING_PARAM_LEN
The maximum number of characters allowed for string values.
T5_ConnectionState
Glasses connection state.
T5_ParamGlasses
Possible parameters that can be retrieved for glasses.
uint8_t T5_WandHandle
Opaque handle used with wands.
struct T5_ContextImpl * T5_Context
Opaque handle used with system-wide functions.
T5_GraphicsApi
Graphics API types.
T5_ParamSys
Possible parameters that can be retrieved with System-wide parameters.
T5_GameboardType
Possible gameboard types.
struct T5_GlassesImpl * T5_Glasses
Opaque handle used with glasses.
T5_GlassesPoseUsage
Glasses pose usage indicator.
@ kT5_ConnectionState_Disconnected
Glasses were previously exclusively connected, but the device has disconnected.
@ kT5_ConnectionState_ExclusiveConnection
Glasses are connected for exclusive use.
@ kT5_ConnectionState_NotExclusivelyConnected
Glasses have not been exclusively connected or reserved.
@ kT5_ConnectionState_ExclusiveReservation
Glasses are reserved for exclusive use.
@ kT5_ParamGlasses_Float_IPD
Interpupillary distance - Float, millimeters
@ kT5_ParamGlasses_UTF8_FriendlyName
User-facing name of the glasses - UTF8.
@ kT5_ParamSys_Integer_CPL_AttRequired
Non-zero if the control panel requires user interaction (E.g. Important firmware update) - Integer,...
@ kT5_ParamSys_UTF8_Service_Version
Version of the service software - UTF8.
@ kT5_GameboardType_LE
An LE gameboard.
@ kT5_GameboardType_XE
An XE gameboard, flap laid flat.
@ kT5_GameboardType_None
No gameboard.
@ kT5_GameboardType_XE_Raised
An XE gameboard, flap raised at an angle on the kickstand.
@ kT5_WandStreamEventType_Connect
Wand connected.
@ kT5_WandStreamEventType_Disconnect
Wand disconnected.
@ kT5_WandStreamEventType_Report
Wand report (Pose, Buttons, Trigger, Stick, Battery)
@ kT5_WandStreamEventType_Desync
Stream has desynchronized.
constexpr pair(piecewise_construct_t, tuple< _Args1... >, tuple< _Args2... >)
valarray< size_t > size() const
constexpr _OutputIterator transform(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _UnaryOperation __unary_op)
constexpr _OI move(_II __first, _II __last, _OI __result)
void lock(_L1 &__l1, _L2 &__l2, _L3 &... __l3)
insert_iterator< _Container > inserter(_Container &__x, typename _Container::iterator __i)
basic_string< char > string
constexpr auto empty(const _Container &__cont) noexcept(noexcept(__cont.empty())) -> decltype(__cont.empty())
void sleep_for(const chrono::duration< _Rep, _Period > &__rtime)
Templated return type with support for error conditions.
Specialization of tiltfive::Result for functions with 'no return'.
Client for communicating with the Tilt Five™ API.
auto getServiceVersion() -> Result< std::string >
Get the version of the Tilt Five™ service.
auto getGameboardSize(T5_GameboardType type) -> Result< T5_GameboardSize >
Obtain the dimensions of the gameboard.
auto getChangedParams() -> Result< std::vector< T5_ParamSys > >
Get a system-wide list of changed parameters.
friend auto obtainClient(const std::string &applicationId, const std::string &applicationVersion, void *platformContext, const uint8_t sdkType) -> Result< std::shared_ptr< Client > >
Obtain an instance of the Tilt Five™ API client.
auto isTiltFiveUiRequestingAttention() -> Result< bool >
Check if the Tilt Five™ UI wants the users attention.
auto listGlasses() -> Result< std::vector< std::string > >
Enumerate glasses.
auto createParamChangedHelper(std::weak_ptr< ParamChangeListener > listener, std::chrono::milliseconds pollInterval=std::chrono::milliseconds(100)) -> std::unique_ptr< ParamChangeHelper >
Create a ParamChangeHelper.
Represents an instance of Tilt Five™ glasses.
auto initGraphicsContext(T5_GraphicsApi graphicsApi, void *graphicsContext) -> Result< void >
Initialize the glasses for graphics operations.
auto getIpd() -> Result< double >
Get the current IPD setting for this glasses.
auto getHandle() const -> T5_Glasses
Obtain the C handle for this glasses object.
auto getFilledCamImageBuffer() -> Result< T5_CamImage >
Get the latest camera image for this glasses.
auto getChangedParams() -> Result< std::vector< T5_ParamGlasses > >
Get a system-wide list of changed parameters.
auto release() -> Result< void >
Release previously-reserved glasses.
auto submitEmptyCamImageBuffer(T5_CamImage *imgBuffer) -> Result< void >
Submit a buffer to the camera image stream to hold Camera Frame data.
auto sendFrame(const T5_FrameInfo *const frameInfo) -> Result< void >
Send a frame to display on the glasses.
auto configureWandStream(const T5_WandStreamConfig *const config) -> Result< void >
Configure the wand event stream.
auto getLatestGlassesPose(T5_GlassesPoseUsage usage) -> Result< T5_GlassesPose >
Get the latest pose for this glasses.
friend auto obtainGlasses(const std::string &identifier, const std::shared_ptr< Client > &client) -> Result< std::shared_ptr< Glasses > >
Obtain an instance of the Tilt Five™ Glasses.
auto cancelCamImageBuffer(uint8_t *buffer) -> Result< void >
Cancel an image buffer in use by the service for freeing.
auto readWandStream(std::chrono::milliseconds timeout=std::chrono::milliseconds(100)) -> Result< T5_WandStreamEvent >
Read from the wands event stream.
auto reserve(const std::string &displayName) -> Result< void >
Reserve glasses for exclusive operations by the client.
auto configureCameraStream(T5_CameraStreamConfig config) -> Result< void >
Configure the wand event stream.
auto getConnectionState() -> Result< ConnectionState >
Get the current connection state of the glasses.
auto listWands() -> Result< std::vector< T5_WandHandle > >
Obtain a list of connected wands.
auto createConnectionHelper(const std::string &displayName, std::chrono::milliseconds connectionPollInterval=std::chrono::milliseconds(100)) -> std::unique_ptr< GlassesConnectionHelper >
Create a GlassesConnectionHelper.
auto getWandStreamHelper() -> std::shared_ptr< WandStreamHelper >
Get a WandStreamHelper.
auto getIdentifier() const -> std::string
Obtain a hardware (not user facing) identifier for the glasses.
auto ensureReady() -> Result< void >
Ensure that reserved glasses are ready for exclusive operations.
auto getFriendlyName() -> Result< std::string >
Get the user-facing name of the glasses.
Utility class to automate the Glasses exclusive connection process.
auto awaitConnection(const std::chrono::milliseconds timeout) -> Result< void >
Block until a connection is established or timed out.
auto awaitConnection() -> Result< void >
Block until a connection is established.
auto glasses() -> Glasses &
Obtain a reference to the wrapped tiltfive::Glasses object.
friend auto obtainGlassesConnectionHelper(std::shared_ptr< Glasses > glasses, const std::string &displayName, std::chrono::milliseconds connectionPollInterval) -> std::unique_ptr< GlassesConnectionHelper >
Internal utility function - Do not call directly.
auto consumeLastAsyncError() -> std::error_code
Obtain and consume the last asynchronous error.
Utility class to manage the wand stream.
auto listWands() -> Result< std::vector< std::shared_ptr< Wand > > >
Obtain a list of tiltfive::Wand.
friend auto obtainWandStreamHelper(std::shared_ptr< Glasses > glasses, std::chrono::milliseconds pollTimeout) -> std::shared_ptr< WandStreamHelper >
Internal utility function - Do not call directly.
auto consumeLastAsyncError() -> std::error_code
Obtain and consume the last asynchronous error.
Virtual base class for use with tiltfive::ParamChangeHelper.
virtual auto onSysParamChanged(const std::vector< T5_ParamSys > &changed) -> void=0
Called by a tiltfive::ParamChangeHelper when system-wide (T5_ParamSys) params have changed.
virtual auto onGlassesParamChanged(const std::shared_ptr< Glasses > &glasses, const std::vector< T5_ParamGlasses > &changed) -> void=0
Called by a tiltfive::ParamChangeHelper when glasses specific (T5_ParamGlasses) params have changed.
Utility class to track changes to parameters Using ParamChangeHelper.
auto registerGlasses(const std::shared_ptr< Glasses > &glasses) -> void
Register glasses for parameter change tracking.
friend auto obtainParamChangeHelper(std::shared_ptr< Client > client, std::weak_ptr< ParamChangeListener > listener, std::chrono::milliseconds pollInterval) -> std::unique_ptr< ParamChangeHelper >
Internal utility function - Do not call directly.
auto deregisterGlasses(const std::shared_ptr< Glasses > &glasses) -> void
De-register glasses for parameter change tracking.
auto consumeLastAsyncError() -> std::error_code
Obtain and consume the last asynchronous error.
Represents an abstract instance of a Tilt Five™ wand Used with tiltfive::WandStreamHelper.
T5_WandHandle handle() const
Get the wand handle.
friend auto obtainWand(T5_WandHandle handle, std::shared_ptr< WandStreamHelper > wandStreamHelper) -> std::shared_ptr< Wand >
Internal utility function - Do not call directly.
auto getLatestReport() const -> Result< T5_WandReport >
Get the latest wand report for this wand.
Physical dimensions of a gameboard.
Client provided information for use with t5CreateGlasses()
uint8_t sdkType
The SDK type.
const char * applicationId
The application ID.
const char * applicationVersion
The application version.
Glasses pose information to be retrieved with t5GetGlassesPose()
uint64_t timestampNanos
The timestamp of the pose.
T5_Vec3 posGLS_GBD
The position of the origin of the GLS (glasses) frame relative to the GBD (gameboard) frame.
T5_Quat rotToGLS_GBD
The rotation that transforms points in the GBD (gameboard) frame orientation to the GLS (glasses) fra...
T5_GameboardType gameboardType
The type of gameboard visible for this pose.
Camera stream configuration.
Render information to be used with t5SendFrameToGlasses()
Camera Frame information to be retrieved with t5GetFilledCamImageBuffer()
Wand stream configuration.
Contains wand related information (Pose, Buttons, Trigger, Stick, Battery)
bool poseValid
Validity of pose parameters. True = valid.
T5_Quat rotToWND_GBD
WND/GBD rotation unit quaternion.
struct T5_WandReport::@5 buttons
Buttons state. True = Pressed.
T5_Vec3 posGrip_GBD
Position (Grip) - Vector3f.
float trigger
Trigger - Analog, Range [0.0 - 1.0], 1.0 = Fully depressed.
bool analogValid
Validity of analog parameters. True = valid.
bool buttonsValid
Validity of button parameters. True = valid.
T5_Vec2 stick
Stick (X/Y) - Analog, Range [-1.0 - 1.0], 0 = Centered, 1.0 = Top/Right.
Represents an event from the wand stream.
const char * c_str() const noexcept
size_type length() const noexcept
void insert(_InputIterator __first, _InputIterator __last)
const_iterator end() const noexcept
const_iterator cend() const noexcept
size_type erase(const key_type &__x)
iterator find(const key_type &__x)
const_iterator cbegin() const noexcept
iterator end() const noexcept
void insert(_InputIterator __first, _InputIterator __last)
size_type erase(const key_type &__x)
void resize(size_type __new_size)
void push_back(const value_type &__x)
void reserve(size_type __n)
size_type size() const noexcept
pointer get() const noexcept