WVR_GetTrackerCapabilities

WVR_EXPORT WVR_Result WVR_GetTrackerCapabilities(WVR_TrackerId trackerId, WVR_TrackerCapabilities_t * capabilities)

Function to get the capability of the tracker device.

Version
API Level 8
Parameters
Return Value
  • WVR_Success: Get the capabilities of the tracker successfully.
  • Others: means failure. (Refer to WVR_Result.)

Note

How to use

Note

  • There are two use timings for function WVR_GetTrackerCapabilities to get tracker capabilities to check whether the other functions work or not: (It’s better to take both two timings.)
    • Timing 1: After starting tracker feature successfully (calls function WVR_StartTracker and returns WVR_Success) for the tracker device which has been connected before.
    • Timing 2: When the tracker device has just been connected. (It’s equal to the timing of receiving event WVR_EventType_TrackerConnected.)

Here is an example for the function:

  1. Header & global variables.
#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;

// Global variable for device capabilities of WVR_TrackerId_0
WVR_TrackerCapabilities_t gCapabilitiesId0;
  1. Start tracker feature first if it has not been started yet. (See also WVR Supported Features)
    • And (Timing 1 - After starting tracker feature successfully) use function WVR_GetTrackerCapabilities to get tracker capabilities.
if (WVR_GetSupportedFeatures() & WVR_SupportedFeature_Tracker) { // the tracker feature is supported or not
    WVR_Result res = WVR_StartTracker();
    if (res == WVR_Success) gRunningTR = true;
}

// Timing 1: Update the tracker capabilities after WVR_StartTracker for the tracker device which has been connected before.
if (gRunningTR && WVR_IsTrackerConnected(WVR_TrackerId_0)) {
    WVR_Result ret = WVR_GetTrackerCapabilities(WVR_TrackerId_0, &gCapabilitiesId0);
}
  1. (Timing 2 - When receiving event WVR_EventType_TrackerConnected) Use function WVR_GetTrackerCapabilities to get tracker capabilities.
void ProcessEvent() {
    WVR_Event_t event;
    while(WVR_PollEventQueue(&event)) {
        switch (event.common.type) {
            /* Timing 2: Update tracker capabilities when the tracker device has just been connected.*/
            case WVR_EventType_TrackerConnected:
                {
                    if (gRunningTR && event.tracker.trackerId == WVR_TrackerId_0) {
                        WVR_Result ret = WVR_GetTrackerCapabilities(event.tracker.trackerId, &gCapabilitiesId0);
                        LOGI("TrackerId_%d, capabilities(ret: %d): %d, %d, %d, %d, %d, %d",
                            event.tracker.trackerId, ret,
                            gCapabilitiesId0.supportsOrientationTracking,
                            gCapabilitiesId0.supportsPositionTracking,
                            gCapabilitiesId0.supportsInputDevice,
                            gCapabilitiesId0.supportsHapticVibration,
                            gCapabilitiesId0.supportsBatteryLevel,
                            gCapabilitiesId0.supportsExtendedData);
                    }
                }
                break;
            default:
                break;
        }
    }
}