WVR_TrackerInfoCallback

typedef void (*WVR_TrackerInfoCallback)(WVR_TrackerId trackerId, const char *cbInfo, uint64_t *timestamp)

The callback function template of tracker info notify.

Version
API Level 9
Parameters
  • rtrackerId: Indicates what id of the tracker device. (Refer to WVR_TrackerId.)
  • cbInfo: tracker info content.
  • timestamp: timestamp for tracker info content.

Warning

  • This function template only works at API level 9 or later.

How to use

Here is an example for the function:

  1. Header & global variable.
#include <wvr/wvr.h> // for enum WVR_SupportedFeature
#include <wvr/wvr_tracker.h>
#include <wvr/wvr_types.h>

bool gRunningTR = false;
  1. 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;
}
  1. Refer to this function template WVR_TrackerInfoCallback to implement the callback function for function WVR_RegisterTrackerInfoCallback.
void CustomizedTrackerInfoCallback(WVR_TrackerId trackerId, const char *cbInfo, uint64_t *cbTimestamp);

void CustomizedTrackerInfoCallback(WVR_TrackerId trackerId, const char *cbInfo, uint64_t *cbTimestamp) {
    LOGD("CustomizedTrackerInfoCallback, WVR_TrackerId(%d), cbInfo(%s), cbTs(%" PRId64 ")", trackerId, cbInfo, *cbTimestamp);

    // TODO: The developer might want to do something corresponding to this function call.
}