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);
184 bufferSize = buffer.
size();
189 if (bufferSize > 1024) {
193 buffer.
resize(bufferSize);
195 return static_cast<Error>(err);
201 auto buffPtr = buffer.
data();
208 buffPtr +=
id.
length() + 1;
226 return static_cast<Error>(err);
238 uint16_t changedParamsCount = 32;
241 changedParamsBuffer.
resize(changedParamsCount);
247 changedParamsBuffer.
resize(changedParamsCount);
248 return changedParamsBuffer;
251 changedParamsCount = changedParamsBuffer.
size() * 2;
255 return static_cast<Error>(err);
281 return static_cast<Error>(err);
296 return static_cast<Error>(err);
349 os <<
"<Glasses:" << instance.mIdentifier <<
">";
370 return static_cast<Error>(err);
375 glasses->mGlasses = handle;
411 return static_cast<Error>(err);
414 switch (connectionState) {
475 return projectionInfo;
477 return static_cast<Error>(err);
489 uint16_t changedParamsCount = 32;
492 changedParamsBuffer.
resize(changedParamsCount);
498 changedParamsBuffer.
resize(changedParamsCount);
499 return changedParamsBuffer;
502 changedParamsCount = changedParamsBuffer.
size() * 2;
506 return static_cast<Error>(err);
524 return static_cast<Error>(err);
544 return static_cast<Error>(err);
573 return static_cast<Error>(err);
596 return static_cast<Error>(err);
612 return static_cast<Error>(err);
628 return static_cast<Error>(err);
636 uint16_t gameboardCount = 1;
641 return gameboardPoses;
643 return static_cast<Error>(err);
656 return static_cast<Error>(err);
667 return static_cast<Error>(err);
680 return static_cast<Error>(err);
692 return static_cast<Error>(err);
705 return static_cast<Error>(err);
718 return static_cast<Error>(err);
730 return static_cast<Error>(err);
744 return static_cast<Error>(err);
752 uint8_t wandCount = 4;
756 wandBuffer.
resize(wandCount);
763 for (
auto i = 0; i < wandCount; i++) {
770 wandCount = wandBuffer.
size() * 2;
774 return static_cast<Error>(err);
787 return static_cast<Error>(err);
813 return static_cast<Error>(err);
822 auto wandStreamHelper = mWandStreamHelper.lock();
823 if (!wandStreamHelper) {
826 mWandStreamHelper = wandStreamHelper;
828 return wandStreamHelper;
844 shared_from_this(), displayName, connectionPollInterval);
851 if (!connectionState) {
881 mLastAsyncError = err;
886 auto connectionState = mGlasses->getConnectionState();
887 if (!connectionState) {
888 setLastAsyncError(connectionState.error());
893 switch (*connectionState) {
896 auto result = mGlasses->reserve(mDisplayName);
898 setLastAsyncError(result.error());
908 auto result = mGlasses->ensureReady();
910 setLastAsyncError(result.error());
940 , mConnectionPollInterval(connectionPollInterval) {
942 mThread =
std::thread(&GlassesConnectionHelper::threadMain,
this);
953 auto connectionState = mGlasses->getConnectionState();
954 if (!connectionState) {
955 return connectionState.error();
961 connectionState = mGlasses->getConnectionState();
962 if (!connectionState) {
963 return connectionState.error();
974 auto start = std::chrono::steady_clock::now();
976 auto connectionState = mGlasses->getConnectionState();
977 if (!connectionState) {
978 return connectionState.error();
982 if ((std::chrono::steady_clock::now() -
start) >
timeout) {
988 connectionState = mGlasses->getConnectionState();
989 if (!connectionState) {
990 return connectionState.error();
1005 return mLastAsyncError.exchange({});
1011 if (mThread.joinable()) {
1047 mLastAsyncError = err;
1052 auto result = glasses->readWandStream(mPollTimeout);
1054 return result.error();
1060 switch (result->type) {
1062 mLastWandReports[result->wandId] = {};
1063 mWandListDirty =
true;
1067 mLastWandReports.
erase(result->wandId);
1068 mWandListDirty =
true;
1072 mWandListDirty =
true;
1076 mLastWandReports[result->wandId] = result->report;
1089 auto refreshReports() ->
void {
1095 mLastWandReports.
cend(),
1100 for (
const auto& connectedWand : mWandList) {
1101 lastWandReportKeys.
erase(connectedWand);
1106 for (
auto defunctKey : lastWandReportKeys) {
1107 mLastWandReports.
erase(defunctKey);
1113 bool configured =
false;
1118 auto configureRequest = mGlasses->configureWandStream(&streamConfig);
1119 if (!configureRequest) {
1120 setLastAsyncError(configureRequest.error());
1128 auto result = drainStream(mGlasses);
1133 setLastAsyncError(result.error());
1139 streamConfig.enabled =
false;
1140 auto configureRequest = mGlasses->configureWandStream(&streamConfig);
1141 if (!configureRequest) {
1142 setLastAsyncError(configureRequest.error());
1156 : mGlasses(
std::move(glasses)), mPollTimeout(pollTimeout) {
1158 mThread =
std::thread(&WandStreamHelper::threadMain,
this);
1164 auto report = mLastWandReports.
find(handle);
1165 if (report == mLastWandReports.
end()) {
1169 return report->second;
1182 return mLastAsyncError.exchange({});
1195 if (mWandListDirty.exchange(
false)) {
1196 auto result = mGlasses->listWands();
1198 mWandListDirty =
true;
1199 return result.error();
1203 for (
auto wandHandle : *result) {
1206 mWandList = wandHandles;
1213 for (
auto wandHandle : mWandList) {
1227 auto result = mGlasses->sendImpulse(handle, amplitude, duration);
1229 return result.error();
1238 if (mThread.joinable()) {
1269 static constexpr size_t kDefaultSettingBufferSize = 16;
1287 mLastAsyncError = err;
1300 , mPollInterval(pollInterval) {
1302 mThread =
std::thread(&ParamChangeHelper::threadMain,
this);
1307 for (
const auto& glasses : mRegisteredGlasses) {
1308 checkGlassesParams(glasses, listener);
1314 uint16_t changeCount;
1316 mChangedGlassesParams.
resize(kDefaultSettingBufferSize);
1318 changeCount = mChangedGlassesParams.
size();
1320 glasses->mGlasses, mChangedGlassesParams.
data(), &changeCount);
1323 if (changeCount > 0) {
1324 mChangedGlassesParams.
resize(changeCount);
1325 listener->onGlassesParamChanged(glasses, mChangedGlassesParams);
1332 mChangedSysParams.
resize(mChangedSysParams.
size() * 2);
1336 setLastAsyncError(
static_cast<Error>(err));
1342 uint16_t changeCount;
1344 mChangedSysParams.
resize(kDefaultSettingBufferSize);
1346 changeCount = mChangedSysParams.
size();
1351 if (changeCount > 0) {
1352 mChangedSysParams.
resize(changeCount);
1353 listener->onSysParamChanged(mChangedSysParams);
1360 mChangedSysParams.
resize(mChangedSysParams.
size() * 2);
1364 setLastAsyncError(
static_cast<Error>(err));
1369 auto threadMain() ->
void {
1373 auto listener = mChangeListener.lock();
1378 checkGlassesParams(listener);
1380 checkSysParams(listener);
1391 if (mThread.joinable()) {
1406 return mLastAsyncError.exchange({});
1412 mRegisteredGlasses.
insert(glasses);
1418 mRegisteredGlasses.
erase(glasses);
1437 os <<
"<Wand:" << +instance.mHandle <<
">";
1450 return mWandStreamHelper->getLatestReport(mHandle);
1457 return mWandStreamHelper->sendImpulse(mHandle, amplitude, duration);
1477 void* platformContext,
1480 return Client::create(applicationId, applicationVersion, platformContext, sdkType);
1491 return Glasses::create(identifier, client);
1539 << (instance.
poseValid ?
"P" :
"_") <<
"]";
1542 os <<
"[A: " << std::right << std::fixed << std::setw(10) << instance.
stick.x <<
"x"
1543 << std::right << std::fixed << std::setw(10) << instance.
stick.y <<
" | " << std::right
1544 << std::fixed << std::setw(10) << instance.
trigger <<
"]";
1546 os <<
"[A: Invalid]";
1550 os <<
"[B: " << (instance.
buttons.t5 ?
"T" :
"_") << (instance.
buttons.one ?
"1" :
"_")
1551 << (instance.
buttons.two ?
"2" :
"_") << (instance.
buttons.three ?
"3" :
"_")
1552 << (instance.
buttons.a ?
"A" :
"_") << (instance.
buttons.b ?
"B" :
"_")
1553 << (instance.
buttons.x ?
"X" :
"_") << (instance.
buttons.y ?
"Y" :
"_") <<
"]";
1555 os <<
"[B: Invalid]";
1559 os <<
"[P: (" << std::right << std::fixed << std::setw(10) << instance.
posGrip_STAGE.x
1560 <<
"," << std::right << std::fixed << std::setw(10) << instance.
posGrip_STAGE.y <<
","
1561 << std::right << std::fixed << std::setw(10) << instance.
posGrip_STAGE.z <<
") ("
1562 << std::right << std::fixed << std::setw(10) << instance.
rotToWND_STAGE.w <<
","
1563 << std::right << std::fixed << std::setw(10) << instance.
rotToWND_STAGE.x <<
","
1564 << std::right << std::fixed << std::setw(10) << instance.
rotToWND_STAGE.y <<
","
1565 << std::right << std::fixed << std::setw(10) << instance.
rotToWND_STAGE.z <<
")"
1578 gameboardType =
"None";
1581 gameboardType =
"LE";
1584 gameboardType =
"XE";
1587 gameboardType =
"XE (Raised)";
1591 gameboardType =
std::string(
"[Invalid T5_GameboardType : ") +
1597 os <<
"[" << instance.
timestampNanos <<
"| " << gameboardType <<
" (" << std::right
1598 << std::fixed << std::setw(10) << instance.
posGLS_STAGE.x <<
"," << std::right << std::fixed
1599 << std::setw(10) << instance.
posGLS_STAGE.y <<
"," << std::right << std::fixed
1600 << std::setw(10) << instance.
posGLS_STAGE.z <<
") (" << std::right << std::fixed
1601 << std::setw(10) << instance.
rotToGLS_STAGE.w <<
"," << std::right << std::fixed
1602 << std::setw(10) << instance.
rotToGLS_STAGE.x <<
"," << std::right << std::fixed
1603 << std::setw(10) << instance.
rotToGLS_STAGE.y <<
"," << std::right << std::fixed
1616 primaryGameboardType =
"None";
1619 primaryGameboardType =
"LE";
1622 primaryGameboardType =
"XE";
1625 primaryGameboardType =
"XE (Raised)";
1629 primaryGameboardType =
std::string(
"[Invalid T5_GameboardType : ") +
1635 os <<
"[" << instance.
timestampNanos <<
"| " << primaryGameboardType <<
" (" << std::right
1636 << std::fixed << std::setw(10) << instance.
posBOARD_STAGE.x <<
"," << std::right
1637 << std::fixed << std::setw(10) << instance.
posBOARD_STAGE.y <<
"," << std::right
1638 << std::fixed << std::setw(10) << instance.
posBOARD_STAGE.z <<
") (" << std::right
1639 << std::fixed << std::setw(10) << instance.
rotToBOARD_STAGE.w <<
"," << std::right
1640 << std::fixed << std::setw(10) << instance.
rotToBOARD_STAGE.x <<
"," << std::right
1641 << std::fixed << std::setw(10) << instance.
rotToBOARD_STAGE.y <<
"," << std::right
1653 os <<
"Service Version";
1657 os <<
"UI Attention Required";
1662 os <<
"[Invalid T5_ParamSys : " <<
static_cast<int>(instance) <<
"]";
1678 os <<
"Friendly Name";
1683 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 t5GetDewarpedPixelCoordinate(T5_Glasses glasses, T5_PixelDewarp *pixelCoordinate)
Submit a 2D image coordinate to be dewarped using a specific camera.
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 t5GetProjection(T5_Glasses glasses, T5_CartesianCoordinateHandedness handedness, T5_DepthRange depthRange, T5_MatrixOrder matrixOrder, double nearPlane, double farPlane, double worldScale, T5_ProjectionInfo *projectionInfo)
Get projection properties for glasses.
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 t5GetGameboardPoses(T5_Glasses glasses, T5_GameboardPose *buffer, uint16_t *count)
Get the latest set of gameboard poses.
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_MatrixOrder
Matrix order.
T5_ParamGlasses
Possible parameters that can be retrieved for glasses.
uint8_t T5_WandHandle
Opaque handle used with wands.
T5_DepthRange
Z Depth range.
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.
T5_CartesianCoordinateHandedness
Handedness of a cartesian coordinate system.
@ 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 getHandle() const -> T5_Context
Obtain the C handle for this client.
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 getLatestGameboardPoses() -> Result< std::vector< T5_GameboardPose > >
Get the latest set of gameboard poses 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 getDewarpedPixelCoordinate(T5_PixelDewarp *pixelCoordinate) -> Result< void >
Submit a pixel coordinate to have the dewarped image location calculated.
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 getProjectionInfo(T5_CartesianCoordinateHandedness handedness, T5_DepthRange depthRange, T5_MatrixOrder matrixOrder, double nearPlane, double farPlane, double worldScale) -> Result< T5_ProjectionInfo >
Get projection properties for 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_GameboardType gameboardType
The type of gameboard visible for this pose.
T5_Quat rotToGLS_STAGE
The rotation that transforms points in the STAGE frame orientation to the GLS (glasses) frame orienta...
T5_Vec3 posGLS_STAGE
The position of the origin of the GLS (glasses) frame relative to the STAGE frame.
Gameboard pose information to be retrieved by enumerating the output of t5GetGameboardPoses()
T5_Vec3 posBOARD_STAGE
The position of the origin of the BOARD (gameboard) frame relative to the STAGE frame.
T5_Quat rotToBOARD_STAGE
The rotation that transforms points in the STAGE frame orientation to the BOARD (gameboard) frame ori...
T5_GameboardType gameboardType
The type of gameboard represented by this pose.
uint64_t timestampNanos
The timestamp of the 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_Vec3 posGrip_STAGE
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_Quat rotToWND_STAGE
WND/STAGE rotation unit quaternion.
T5_Vec2 stick
Stick (X/Y) - Analog, Range [-1.0 - 1.0], 0 = Centered, 1.0 = Top/Right.
struct T5_WandReport::@7 buttons
Buttons state. True = Pressed.
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