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;
390 return static_cast<Error>(err);
393 switch (connectionState) {
419 uint16_t changedParamsCount = 32;
422 changedParamsBuffer.
resize(changedParamsCount);
428 changedParamsBuffer.
resize(changedParamsCount);
429 return changedParamsBuffer;
432 changedParamsCount = changedParamsBuffer.
size() * 2;
436 return static_cast<Error>(err);
454 return static_cast<Error>(err);
474 return static_cast<Error>(err);
503 return static_cast<Error>(err);
526 return static_cast<Error>(err);
542 return static_cast<Error>(err);
558 return static_cast<Error>(err);
571 return static_cast<Error>(err);
582 return static_cast<Error>(err);
595 return static_cast<Error>(err);
607 return static_cast<Error>(err);
620 return static_cast<Error>(err);
632 return static_cast<Error>(err);
640 uint8_t wandCount = 4;
644 wandBuffer.
resize(wandCount);
651 for (
auto i = 0; i < wandCount; i++) {
658 wandCount = wandBuffer.
size() * 2;
662 return static_cast<Error>(err);
675 return static_cast<Error>(err);
701 return static_cast<Error>(err);
710 auto wandStreamHelper = mWandStreamHelper.lock();
711 if (!wandStreamHelper) {
714 mWandStreamHelper = wandStreamHelper;
716 return wandStreamHelper;
732 shared_from_this(), displayName, connectionPollInterval);
739 if (!connectionState) {
769 mLastAsyncError = err;
774 auto connectionState = mGlasses->getConnectionState();
775 if (!connectionState) {
776 setLastAsyncError(connectionState.error());
781 switch (*connectionState) {
784 auto result = mGlasses->reserve(mDisplayName);
786 setLastAsyncError(result.error());
796 auto result = mGlasses->ensureReady();
798 setLastAsyncError(result.error());
828 , mConnectionPollInterval(connectionPollInterval) {
830 mThread =
std::thread(&GlassesConnectionHelper::threadMain,
this);
841 auto connectionState = mGlasses->getConnectionState();
842 if (!connectionState) {
843 return connectionState.error();
849 connectionState = mGlasses->getConnectionState();
850 if (!connectionState) {
851 return connectionState.error();
862 auto start = std::chrono::steady_clock::now();
864 auto connectionState = mGlasses->getConnectionState();
865 if (!connectionState) {
866 return connectionState.error();
870 if ((std::chrono::steady_clock::now() -
start) >
timeout) {
876 connectionState = mGlasses->getConnectionState();
877 if (!connectionState) {
878 return connectionState.error();
893 return mLastAsyncError.exchange({});
899 if (mThread.joinable()) {
935 mLastAsyncError = err;
940 auto result = glasses->readWandStream(mPollTimeout);
942 return result.error();
948 switch (result->type) {
950 mLastWandReports[result->wandId] = {};
951 mWandListDirty =
true;
955 mLastWandReports.
erase(result->wandId);
956 mWandListDirty =
true;
960 mWandListDirty =
true;
964 mLastWandReports[result->wandId] = result->report;
977 auto refreshReports() ->
void {
983 mLastWandReports.
cend(),
988 for (
const auto& connectedWand : mWandList) {
989 lastWandReportKeys.
erase(connectedWand);
994 for (
auto defunctKey : lastWandReportKeys) {
995 mLastWandReports.
erase(defunctKey);
1001 bool configured =
false;
1006 auto configureRequest = mGlasses->configureWandStream(&streamConfig);
1007 if (!configureRequest) {
1008 setLastAsyncError(configureRequest.error());
1016 auto result = drainStream(mGlasses);
1021 setLastAsyncError(result.error());
1027 streamConfig.enabled =
false;
1028 auto configureRequest = mGlasses->configureWandStream(&streamConfig);
1029 if (!configureRequest) {
1030 setLastAsyncError(configureRequest.error());
1044 : mGlasses(
std::move(glasses)), mPollTimeout(pollTimeout) {
1046 mThread =
std::thread(&WandStreamHelper::threadMain,
this);
1052 auto report = mLastWandReports.
find(handle);
1053 if (report == mLastWandReports.
end()) {
1057 return report->second;
1070 return mLastAsyncError.exchange({});
1083 if (mWandListDirty.exchange(
false)) {
1084 auto result = mGlasses->listWands();
1086 mWandListDirty =
true;
1087 return result.error();
1091 for (
auto wandHandle : *result) {
1094 mWandList = wandHandles;
1101 for (
auto wandHandle : mWandList) {
1111 if (mThread.joinable()) {
1142 static constexpr size_t kDefaultSettingBufferSize = 16;
1160 mLastAsyncError = err;
1173 , mPollInterval(pollInterval) {
1175 mThread =
std::thread(&ParamChangeHelper::threadMain,
this);
1180 for (
const auto& glasses : mRegisteredGlasses) {
1181 checkGlassesParams(glasses, listener);
1187 uint16_t changeCount;
1189 mChangedGlassesParams.
resize(kDefaultSettingBufferSize);
1191 changeCount = mChangedGlassesParams.
size();
1193 glasses->mGlasses, mChangedGlassesParams.
data(), &changeCount);
1196 if (changeCount > 0) {
1197 mChangedGlassesParams.
resize(changeCount);
1198 listener->onGlassesParamChanged(glasses, mChangedGlassesParams);
1205 mChangedSysParams.
resize(mChangedSysParams.
size() * 2);
1209 setLastAsyncError(
static_cast<Error>(err));
1215 uint16_t changeCount;
1217 mChangedSysParams.
resize(kDefaultSettingBufferSize);
1219 changeCount = mChangedSysParams.
size();
1224 if (changeCount > 0) {
1225 mChangedSysParams.
resize(changeCount);
1226 listener->onSysParamChanged(mChangedSysParams);
1233 mChangedSysParams.
resize(mChangedSysParams.
size() * 2);
1237 setLastAsyncError(
static_cast<Error>(err));
1242 auto threadMain() ->
void {
1246 auto listener = mChangeListener.lock();
1251 checkGlassesParams(listener);
1253 checkSysParams(listener);
1264 if (mThread.joinable()) {
1279 return mLastAsyncError.exchange({});
1285 mRegisteredGlasses.
insert(glasses);
1291 mRegisteredGlasses.
erase(glasses);
1310 os <<
"<Wand:" << +instance.mHandle <<
">";
1323 return mWandStreamHelper->getLatestReport(mHandle);
1343 void* platformContext,
1346 return Client::create(applicationId, applicationVersion, platformContext, sdkType);
1357 return Glasses::create(identifier, client);
1405 << (instance.
poseValid ?
"P" :
"_") <<
"]";
1408 os <<
"[A: " << std::right << std::fixed << std::setw(10) << instance.
stick.x <<
"x"
1409 << std::right << std::fixed << std::setw(10) << instance.
stick.y <<
" | " << std::right
1410 << std::fixed << std::setw(10) << instance.
trigger <<
"]";
1412 os <<
"[A: Invalid]";
1416 os <<
"[B: " << (instance.
buttons.t5 ?
"T" :
"_") << (instance.
buttons.one ?
"1" :
"_")
1417 << (instance.
buttons.two ?
"2" :
"_") << (instance.
buttons.three ?
"3" :
"_")
1418 << (instance.
buttons.a ?
"A" :
"_") << (instance.
buttons.b ?
"B" :
"_")
1419 << (instance.
buttons.x ?
"X" :
"_") << (instance.
buttons.y ?
"Y" :
"_") <<
"]";
1421 os <<
"[B: Invalid]";
1425 os <<
"[P: (" << std::right << std::fixed << std::setw(10) << instance.
posGrip_GBD.x <<
","
1426 << std::right << std::fixed << std::setw(10) << instance.
posGrip_GBD.y <<
","
1427 << std::right << std::fixed << std::setw(10) << instance.
posGrip_GBD.z <<
") ("
1428 << std::right << std::fixed << std::setw(10) << instance.
rotToWND_GBD.w <<
","
1429 << std::right << std::fixed << std::setw(10) << instance.
rotToWND_GBD.x <<
","
1430 << std::right << std::fixed << std::setw(10) << instance.
rotToWND_GBD.y <<
","
1431 << std::right << std::fixed << std::setw(10) << instance.
rotToWND_GBD.z <<
")"
1444 gameboardType =
"None";
1447 gameboardType =
"LE";
1450 gameboardType =
"XE";
1453 gameboardType =
"XE (Raised)";
1457 gameboardType =
std::string(
"[Invalid T5_GameboardType : ") +
1463 os <<
"[" << instance.
timestampNanos <<
"| " << gameboardType <<
" (" << std::right
1464 << std::fixed << std::setw(10) << instance.
posGLS_GBD.x <<
"," << std::right << std::fixed
1465 << std::setw(10) << instance.
posGLS_GBD.y <<
"," << std::right << std::fixed << std::setw(10)
1466 << instance.
posGLS_GBD.z <<
") (" << std::right << std::fixed << std::setw(10)
1467 << instance.
rotToGLS_GBD.w <<
"," << std::right << std::fixed << std::setw(10)
1468 << instance.
rotToGLS_GBD.x <<
"," << std::right << std::fixed << std::setw(10)
1469 << instance.
rotToGLS_GBD.y <<
"," << std::right << std::fixed << std::setw(10)
1481 os <<
"Service Version";
1485 os <<
"UI Attention Required";
1490 os <<
"[Invalid T5_ParamSys : " <<
static_cast<int>(instance) <<
"]";
1506 os <<
"Friendly Name";
1511 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 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