Loading...
Searching...
No Matches
Listener Class Reference
PST SDK C++ API

Abstract listener class for receiving tracking information and tracking mode updates. More...

`#include <pstsdk_cpp.h>`

## Public Member Functions
virtual void | OnTrackerData (const TrackerData &data)
| Callback function receiving tracking information from the tracker.
virtual void | OnTrackerMode (const TrackerMode mode)
| Callback function receiving tracking mode updates from the the tracker.
virtual | ~Listener ()
| Destructor for the listener implementation.

## Detailed Description

Extend this class and implement its methods in order to receive tracking information and tracking mode updates from the PST Tracker. Alternatively, Tracker::GetSingleMeasurement() can be called to get the latest available tracking data.

Attention
  The destructor must call PSTech::pstsdk::Tracker::RemoveTrackerListener(this) to ensure the listener is properly unregistered before destruction.

See also
  Tracker::AddTrackerListener()
  Tracker::RemoveTrackerListener()
  Tracker::GetSingleMeasurement()

Examples
  exposure.cpp, images.cpp, listener.cpp, minimal.cpp, reference.cpp, and trackingtarget.cpp.

## Constructor & Destructor Documentation

## ◆ ~Listener()

virtual ~Listener | ( |  | ) |
| virtual

The derived classes must implement their own destructor that calls PSTech::pstsdk::Tracker::RemoveTrackerListener(this) to unregister the listener instance from the tracker before destruction. This ensures that the tracker does not attempt to access a listener that has already been destroyed, preventing undefined behavior or crashes. The removal must occur before any member variables used inside the listener's callback functions are destroyed.

See also
  Tracker::RemoveTrackerListener()

## Member Function Documentation

## ◆ OnTrackerData()

virtual void OnTrackerData | ( | const TrackerData & | data | ) |
| inline virtual

Implement the OnTrackerData method to receive tracking information from the PST Tracker.

Parameters

  [out] | data | A TrackerData object containing the detected tracking targets and 3D markers.

See also
  TrackerData

Examples
  exposure.cpp, images.cpp, listener.cpp, minimal.cpp, reference.cpp, and trackingtarget.cpp.

## ◆ OnTrackerMode()

virtual void OnTrackerMode | ( | const TrackerMode | mode | ) |
| inline virtual

Implement the OnTrackerMode method to receive tracking mode updates of the PST Tracker. This function enables responding to the different PST Tracker mode changes enumerated by TrackerMode as soon as they occur.

Parameters

  [out] | mode | Current tracker mode code as TrackerMode enumeration member.

See also
  TrackerMode

Examples
  listener.cpp.

The documentation for this class was generated from the following file:

- include/pstsdk_cpp.h