Skip to main content

class Provider

(Niantic.Lightship.AR.XRSubsystems.XRPersistentAnchorSubsystem.Provider)

Overview

An abstract class to be implemented by providers of this subsystem.

class Provider: SubsystemProvider< XRPersistentAnchorSubsystem > {
public:
// properties

bool IsMockProvider;
XRPersistentAnchorConfiguration CurrentConfiguration;

// methods

virtual abstract TrackableChanges<XRPersistentAnchor> GetChanges(
XRPersistentAnchor defaultAnchor,
Allocator allocator
) = 0;

virtual abstract bool GetNetworkStatusUpdate(out XRPersistentAnchorNetworkRequestStatus[] statuses) = 0;
virtual abstract bool GetLocalizationStatusUpdate(out XRPersistentAnchorLocalizationStatus[] statuses) = 0;
virtual abstract bool GetFrameDiagnosticsUpdate(out XRPersistentAnchorFrameDiagnostics[] statuses) = 0;
virtual bool GetVpsSessionId(out string vpsSessionId);
virtual abstract bool GetVpsDebuggerLog(out string vpsDebuggerLog) = 0;

virtual VpsGraphStatus TryGetDevicePoseAsGps(
Pose pose,
out double latitude,
out double longitude,
out double altitude,
out double verticalAccuracy,
out double horizontalAccuracy,
out double heading
);

virtual bool TryAddAnchor(Pose pose, out XRPersistentAnchor anchor);
virtual bool TryRemoveAnchor(TrackableId anchorId);

virtual bool TryRestoreAnchor(
XRPersistentAnchorPayload anchorPayload,
out XRPersistentAnchor anchor
);

virtual bool TryLocalize(
XRPersistentAnchorPayload anchorPayload,
out XRPersistentAnchor anchor
);
};

Detailed Documentation

An abstract class to be implemented by providers of this subsystem.

Properties

CurrentConfiguration

XRPersistentAnchorConfiguration CurrentConfiguration

Get or set configuration with <name>XRPersistentAnchorConfiguration</name>

Methods

GetChanges

virtual abstract TrackableChanges<XRPersistentAnchor> GetChanges(
XRPersistentAnchor defaultAnchor,
Allocator allocator
) = 0

Invoked to get the changes to anchors (added, updated, and removed) since the last call to GetChanges(XRPersistentAnchor,Allocator).

    Parameters:

    defaultAnchor - The default anchor. This should be used to initialize the returned NativeArrays for backwards compatibility. See Allocator.

    allocator - An allocator to use for the NativeArrays in TrackableChanges<T>.

    Returns:

    Changes since the last call to GetChanges.

GetNetworkStatusUpdate

virtual abstract bool GetNetworkStatusUpdate(out XRPersistentAnchorNetworkRequestStatus[] statuses) = 0

Get a list of network status updates, if any

    Returns:

    True if an update is present, false otherwise

GetLocalizationStatusUpdate

virtual abstract bool GetLocalizationStatusUpdate(out XRPersistentAnchorLocalizationStatus[] statuses) = 0

Get a list of localization status updates, if any

    Returns:

    True if an update is present, false otherwise

GetFrameDiagnosticsUpdate

virtual abstract bool GetFrameDiagnosticsUpdate(out XRPersistentAnchorFrameDiagnostics[] statuses) = 0

Get a list of frame diagnostics updates, if any

    Returns:

    True if an update is present, false otherwise

GetVpsSessionId

virtual bool GetVpsSessionId(out string vpsSessionId)

Get the vps session id, if any

    Parameters:

    vpsSessionId - The vps session id as 32 character hexidecimal upper-case string.

    Returns:

    True if vps session id is present, false otherwise

TryGetDevicePoseAsGps

virtual VpsGraphStatus TryGetDevicePoseAsGps(
Pose pose,
out double latitude,
out double longitude,
out double altitude,
out double verticalAccuracy,
out double horizontalAccuracy,
out double heading
)

Provider converts a Unity pose to GPS with double precision. Implementations should flatten the TRS into a float[16] in column-major, ARDK coordinate space before invoking native.

TryAddAnchor

virtual bool TryAddAnchor(Pose pose, out XRPersistentAnchor anchor)

Should create a new anchor with the provided pose.

    Parameters:

    pose - The pose, in session space, of the new anchor.

    anchor - The new anchor. Must be valid only if this method returns true.

    Returns:

    Should return true if the new anchor was added, otherwise false.

TryRemoveAnchor

virtual bool TryRemoveAnchor(TrackableId anchorId)

Should remove an existing anchor with TrackableId anchorId.

    Parameters:

    anchorId - The id of an existing anchor to remove.

    Returns:

    Should return true if the anchor was removed, otherwise false. If the anchor does not exist, return false.

TryRestoreAnchor

virtual bool TryRestoreAnchor(
XRPersistentAnchorPayload anchorPayload,
out XRPersistentAnchor anchor
)

Tries to restore an anchor

    Parameters:

    anchorPayload - The payload to restore the anchor with

    anchor - The restored anchor

    Returns:

    Whether or not the restoration was successful