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);
339 os <<
"<Glasses:" << instance.mIdentifier <<
">";
360 return static_cast<Error>(err);
365 glasses->mGlasses = handle;
401 return static_cast<Error>(err);
404 switch (connectionState) {
430 uint16_t changedParamsCount = 32;
433 changedParamsBuffer.
resize(changedParamsCount);
439 changedParamsBuffer.
resize(changedParamsCount);
440 return changedParamsBuffer;
443 changedParamsCount = changedParamsBuffer.
size() * 2;
447 return static_cast<Error>(err);
465 return static_cast<Error>(err);
485 return static_cast<Error>(err);
514 return static_cast<Error>(err);
537 return static_cast<Error>(err);
553 return static_cast<Error>(err);
569 return static_cast<Error>(err);
582 return static_cast<Error>(err);
593 return static_cast<Error>(err);
606 return static_cast<Error>(err);
618 return static_cast<Error>(err);
631 return static_cast<Error>(err);
643 return static_cast<Error>(err);
657 return static_cast<Error>(err);
665 uint8_t wandCount = 4;
669 wandBuffer.
resize(wandCount);
676 for (
auto i = 0; i < wandCount; i++) {
683 wandCount = wandBuffer.
size() * 2;
687 return static_cast<Error>(err);
700 return static_cast<Error>(err);
726 return static_cast<Error>(err);
735 auto wandStreamHelper = mWandStreamHelper.lock();
736 if (!wandStreamHelper) {
739 mWandStreamHelper = wandStreamHelper;
741 return wandStreamHelper;
757 shared_from_this(), displayName, connectionPollInterval);
764 if (!connectionState) {
794 mLastAsyncError = err;
799 auto connectionState = mGlasses->getConnectionState();
800 if (!connectionState) {
801 setLastAsyncError(connectionState.error());
806 switch (*connectionState) {
809 auto result = mGlasses->reserve(mDisplayName);
811 setLastAsyncError(result.error());
821 auto result = mGlasses->ensureReady();
823 setLastAsyncError(result.error());
853 , mConnectionPollInterval(connectionPollInterval) {
855 mThread =
std::thread(&GlassesConnectionHelper::threadMain,
this);
866 auto connectionState = mGlasses->getConnectionState();
867 if (!connectionState) {
868 return connectionState.error();
874 connectionState = mGlasses->getConnectionState();
875 if (!connectionState) {
876 return connectionState.error();
887 auto start = std::chrono::steady_clock::now();
889 auto connectionState = mGlasses->getConnectionState();
890 if (!connectionState) {
891 return connectionState.error();
895 if ((std::chrono::steady_clock::now() -
start) >
timeout) {
901 connectionState = mGlasses->getConnectionState();
902 if (!connectionState) {
903 return connectionState.error();
918 return mLastAsyncError.exchange({});
924 if (mThread.joinable()) {
960 mLastAsyncError = err;
965 auto result = glasses->readWandStream(mPollTimeout);
967 return result.error();
973 switch (result->type) {
975 mLastWandReports[result->wandId] = {};
976 mWandListDirty =
true;
980 mLastWandReports.
erase(result->wandId);
981 mWandListDirty =
true;
985 mWandListDirty =
true;
989 mLastWandReports[result->wandId] = result->report;
1002 auto refreshReports() ->
void {
1008 mLastWandReports.
cend(),
1013 for (
const auto& connectedWand : mWandList) {
1014 lastWandReportKeys.
erase(connectedWand);
1019 for (
auto defunctKey : lastWandReportKeys) {
1020 mLastWandReports.
erase(defunctKey);
1026 bool configured =
false;
1031 auto configureRequest = mGlasses->configureWandStream(&streamConfig);
1032 if (!configureRequest) {
1033 setLastAsyncError(configureRequest.error());
1041 auto result = drainStream(mGlasses);
1046 setLastAsyncError(result.error());
1052 streamConfig.enabled =
false;
1053 auto configureRequest = mGlasses->configureWandStream(&streamConfig);
1054 if (!configureRequest) {
1055 setLastAsyncError(configureRequest.error());
1069 : mGlasses(
std::move(glasses)), mPollTimeout(pollTimeout) {
1071 mThread =
std::thread(&WandStreamHelper::threadMain,
this);
1077 auto report = mLastWandReports.
find(handle);
1078 if (report == mLastWandReports.
end()) {
1082 return report->second;
1095 return mLastAsyncError.exchange({});
1108 if (mWandListDirty.exchange(
false)) {
1109 auto result = mGlasses->listWands();
1111 mWandListDirty =
true;
1112 return result.error();
1116 for (
auto wandHandle : *result) {
1119 mWandList = wandHandles;
1126 for (
auto wandHandle : mWandList) {
1140 auto result = mGlasses->sendImpulse(handle, amplitude, duration);
1142 return result.error();
1151 if (mThread.joinable()) {
1182 static constexpr size_t kDefaultSettingBufferSize = 16;
1200 mLastAsyncError = err;
1213 , mPollInterval(pollInterval) {
1215 mThread =
std::thread(&ParamChangeHelper::threadMain,
this);
1220 for (
const auto& glasses : mRegisteredGlasses) {
1221 checkGlassesParams(glasses, listener);
1227 uint16_t changeCount;
1229 mChangedGlassesParams.
resize(kDefaultSettingBufferSize);
1231 changeCount = mChangedGlassesParams.
size();
1233 glasses->mGlasses, mChangedGlassesParams.
data(), &changeCount);
1236 if (changeCount > 0) {
1237 mChangedGlassesParams.
resize(changeCount);
1238 listener->onGlassesParamChanged(glasses, mChangedGlassesParams);
1245 mChangedSysParams.
resize(mChangedSysParams.
size() * 2);
1249 setLastAsyncError(
static_cast<Error>(err));
1255 uint16_t changeCount;
1257 mChangedSysParams.
resize(kDefaultSettingBufferSize);
1259 changeCount = mChangedSysParams.
size();
1264 if (changeCount > 0) {
1265 mChangedSysParams.
resize(changeCount);
1266 listener->onSysParamChanged(mChangedSysParams);
1273 mChangedSysParams.
resize(mChangedSysParams.
size() * 2);
1277 setLastAsyncError(
static_cast<Error>(err));
1282 auto threadMain() ->
void {
1286 auto listener = mChangeListener.lock();
1291 checkGlassesParams(listener);
1293 checkSysParams(listener);
1304 if (mThread.joinable()) {
1319 return mLastAsyncError.exchange({});
1325 mRegisteredGlasses.
insert(glasses);
1331 mRegisteredGlasses.
erase(glasses);
1350 os <<
"<Wand:" << +instance.mHandle <<
">";
1363 return mWandStreamHelper->getLatestReport(mHandle);
1370 return mWandStreamHelper->sendImpulse(mHandle, amplitude, duration);
1390 void* platformContext,
1393 return Client::create(applicationId, applicationVersion, platformContext, sdkType);
1404 return Glasses::create(identifier, client);
1452 << (instance.
poseValid ?
"P" :
"_") <<
"]";
1455 os <<
"[A: " << std::right << std::fixed << std::setw(10) << instance.
stick.x <<
"x"
1456 << std::right << std::fixed << std::setw(10) << instance.
stick.y <<
" | " << std::right
1457 << std::fixed << std::setw(10) << instance.
trigger <<
"]";
1459 os <<
"[A: Invalid]";
1463 os <<
"[B: " << (instance.
buttons.t5 ?
"T" :
"_") << (instance.
buttons.one ?
"1" :
"_")
1464 << (instance.
buttons.two ?
"2" :
"_") << (instance.
buttons.three ?
"3" :
"_")
1465 << (instance.
buttons.a ?
"A" :
"_") << (instance.
buttons.b ?
"B" :
"_")
1466 << (instance.
buttons.x ?
"X" :
"_") << (instance.
buttons.y ?
"Y" :
"_") <<
"]";
1468 os <<
"[B: Invalid]";
1472 os <<
"[P: (" << std::right << std::fixed << std::setw(10) << instance.
posGrip_GBD.x <<
","
1473 << std::right << std::fixed << std::setw(10) << instance.
posGrip_GBD.y <<
","
1474 << std::right << std::fixed << std::setw(10) << instance.
posGrip_GBD.z <<
") ("
1475 << std::right << std::fixed << std::setw(10) << instance.
rotToWND_GBD.w <<
","
1476 << std::right << std::fixed << std::setw(10) << instance.
rotToWND_GBD.x <<
","
1477 << std::right << std::fixed << std::setw(10) << instance.
rotToWND_GBD.y <<
","
1478 << std::right << std::fixed << std::setw(10) << instance.
rotToWND_GBD.z <<
")"
1491 gameboardType =
"None";
1494 gameboardType =
"LE";
1497 gameboardType =
"XE";
1500 gameboardType =
"XE (Raised)";
1504 gameboardType =
std::string(
"[Invalid T5_GameboardType : ") +
1510 os <<
"[" << instance.
timestampNanos <<
"| " << gameboardType <<
" (" << std::right
1511 << std::fixed << std::setw(10) << instance.
posGLS_GBD.x <<
"," << std::right << std::fixed
1512 << std::setw(10) << instance.
posGLS_GBD.y <<
"," << std::right << std::fixed << std::setw(10)
1513 << instance.
posGLS_GBD.z <<
") (" << std::right << std::fixed << std::setw(10)
1514 << instance.
rotToGLS_GBD.w <<
"," << std::right << std::fixed << std::setw(10)
1515 << instance.
rotToGLS_GBD.x <<
"," << std::right << std::fixed << std::setw(10)
1516 << instance.
rotToGLS_GBD.y <<
"," << std::right << std::fixed << std::setw(10)
1528 os <<
"Service Version";
1532 os <<
"UI Attention Required";
1537 os <<
"[Invalid T5_ParamSys : " <<
static_cast<int>(instance) <<
"]";
1553 os <<
"Friendly Name";
1558 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 t5SendImpulse(T5_Glasses glasses, T5_WandHandle wand, float amplitude, uint16_t duration)
Send a haptic data buffer to a wand.
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 sendImpulse(T5_WandHandle handle, float amplitude, uint16_t duration) -> Result< void >
Send a Haptic Impulse to a wand.
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.
auto sendImpulse(const T5_WandHandle &handle, float amplitude, uint16_t duration) -> Result< void >
Send a haptic impulse to a specific tiltfive::Wand.
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.
auto sendImpulse(float amplitude, uint16_t duration) const -> Result< void >
Send an impulse to 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