interface IARNetworking (Niantic.ARDK.AR.Networking.IARNetworking)

Overview

interface IARNetworking: IDisposable {
    // properties

    IARSession ARSession;
    IReadOnlyDictionary<IPeer, Matrix4x4> LatestPeerPoses;
    IReadOnlyDictionary<IPeer, PeerState> LatestPeerStates;
    PeerState LocalPeerState;
    IMultipeerNetworking Networking;

    // events

    event Deinitialized();
    event PeerPoseReceived();
    event PeerStateReceived();

    // methods

    void DisablePoseBroadcasting();
    void EnablePoseBroadcasting();
    void InitializeForMarkerScanning(Vector3[] markerPointLocations = null);

    void ScanForMarker(
        MarkerScanOption options,
        Action<MarkerMetadata> gotResult = null,
        IMarkerScanner scanner = null,
        IMetadataSerializer deserializer = null
    );

    void SetTargetPoseLatency(Int64 targetPoseLatency);
};

// direct descendants

interface IMockARNetworking;

Detailed Documentation

Properties

IARSession ARSession

A reference to the underlying ARSession object generating data used to synchronize with other peers.

IReadOnlyDictionary<IPeer, Matrix4x4> LatestPeerPoses

Latest poses received from each peer (excluding the local peer). Peers will be removed from the dictionary when they leave the session.

IReadOnlyDictionary<IPeer, PeerState> LatestPeerStates

Latest PeerStates received from each peer (including the local peer). Peers will be removed from the dictionary when they leave the session.

PeerState LocalPeerState

Current localization state of the local peer.

IMultipeerNetworking Networking

A reference to the underlying MultipeerNetworking instance used to communicate with other peers.

Events

event Deinitialized()

Alerts subscribers when this object is deinitialized.

event PeerPoseReceived()

Alerts subscribers when any peer’s (excluding the local peer’s) pose has changed.

event PeerStateReceived()

Alerts subscribers when any peer’s (including the local peer’s) localization state has changed.

Methods

void DisablePoseBroadcasting()

Disable broadcasting of the local peer pose.

void EnablePoseBroadcasting()

Enable broadcasting of the local peer pose.

void InitializeForMarkerScanning(Vector3[] markerPointLocations = null)

Sets up this ARNetworking session to be a MarkerScanning host. The peer calling this method must be the host in an existing networking session. Only needs to be called when using a marker for map syncing.

Note

This is part of an experimental feature that is not advised to be used in release builds.

Parameters:

markerPointLocations

Positions of the marker points that should be detected by scanners in real-world space (unit: meters), relative to the center of the device’s screen.

void ScanForMarker(
    MarkerScanOption options,
    Action<MarkerMetadata> gotResult = null,
    IMarkerScanner scanner = null,
    IMetadataSerializer deserializer = null
)

Initiates and runs the process to scan for a marker and join a networking session and/or sync maps using that marker.

Note

This is part of an experimental feature that is not advised to be used in release builds.

Parameters:

options

Configure to scan for a marker in order to join a networking session, to sync maps, or to do both (in last case will first join, then sync when able).

gotResult

Callback raised when a marker is properly scanned and parsed. If both joining and syncing MarkerScanOption flags are enabled, the callback will only be raised after the syncing metadata has been parsed. At the time of the callback it is not guaranteed this ARNetworking has either joined or synced, so still use the MultipeerNetworking.DidConnect and ARNetworking.DidReceiveStateFromPeer to verify those statuses.

scanner

If null, will default to using an ARFrameScanner scanning for a ZXing barcode.

deserializer

If null, will default to using BasicMetadataSerializer and EmbeddedStationaryMetadataSerializer (if MarkerScanOption.ScanToJoin is flagged).

void SetTargetPoseLatency(Int64 targetPoseLatency)

Set target latency (milliseconds) for broadcasting the local peer pose.