WVR_GetTrackerRole¶
-
WVR_EXPORT WVR_TrackerRole WVR_GetTrackerRole(WVR_TrackerId trackerId)
Function to get the tracker role of the tracker device.
- Return
- The tracker role. (Refer to WVR_TrackerRole.)
- Version
- API Level 8
- Parameters
trackerId
: Indicates what id of the tracker device. (Refer to WVR_TrackerId.)
How to use¶
Here is an example for the function:
- Header & global variable.
#include <wvr/wvr.h> // for enum WVR_SupportedFeature
#include <wvr/wvr_events.h>
#include <wvr/wvr_tracker.h>
#include <wvr/wvr_types.h>
bool gRunningTR = false;
- Start tracker feature first if it has not been started yet. (See also WVR Supported Features)
if (WVR_GetSupportedFeatures() & WVR_SupportedFeature_Tracker) { // the tracker feature is supported or not
WVR_Result res = WVR_StartTracker();
if (res == WVR_Success) gRunningTR = true;
}
- Use function WVR_GetTrackerRole to get the role of connected tracker device.
void ProcessEvent() {
WVR_Event_t event;
while(WVR_PollEventQueue(&event)) {
switch (event.common.type) {
case WVR_EventType_TrackerConnected: // when tracker device has been connected
case WVR_EventType_TrackerRoleChanged: // when the role of tracker device has been changed
{
if (gRunningTR) {
WVR_TrackerRole role = WVR_GetTrackerRole(event.tracker.trackerId);
}
}
break;
}
}
}
Note
- See alse enum WVR_TrackerRole of Types in wvr.h for the new extended definition of tracker role. (Supported at Wave SDK 5.3.0 or later.)
- See alse enum WVR_EventType of Types in wvr.h for Event WVR_EventType_TrackerRoleChanged. (Supported at Wave SDK 5.3.0 or later.)