Пример #1
0
        public GoogleARCore.AsyncTask <CloudAnchorResult> CreateCloudAnchor(GoogleARCore.Anchor anchor)
        {
            Action <CloudAnchorResult> onComplete;
            var task = new GoogleARCore.AsyncTask <CloudAnchorResult>(out onComplete);

            IntPtr cloudAnchorHandle = IntPtr.Zero;
            var    status            = LifecycleManager.Instance.NativeSession.SessionApi
                                       .CreateCloudAnchor(anchor.m_NativeHandle, out cloudAnchorHandle);

            if (status != ApiArStatus.Success)
            {
                onComplete(new CloudAnchorResult()
                {
                    Response = status.ToCloudServiceResponse(),
                    Anchor   = null,
                });

                return(task);
            }

            var request = new CloudAnchorRequest()
            {
                IsComplete     = false,
                NativeSession  = LifecycleManager.Instance.NativeSession,
                AnchorHandle   = cloudAnchorHandle,
                OnTaskComplete = onComplete,
            };

            _UpdateCloudAnchorRequest(request, true);
            return(task);
        }
Пример #2
0
        public GoogleARCore.AsyncTask <CloudAnchorResult> CreateCloudAnchor(GoogleARCore.Anchor anchor)
        {
            Action <CloudAnchorResult> onComplete;

            GoogleARCore.AsyncTask <CloudAnchorResult> task;
            if (!_CreateCloudAnchorResultAsyncTask(out onComplete, out task))
            {
                return(task);
            }
            _CreateCloudAnchor(onComplete, anchor.m_NativeHandle);
            return(task);
        }
        public GoogleARCore.AsyncTask <CloudAnchorResult> CreateCloudAnchor(
            GoogleARCore.Anchor anchor, int ttlDays)
        {
            Action <CloudAnchorResult> onComplete;

            GoogleARCore.AsyncTask <CloudAnchorResult> task;
            if (!CreateCloudAnchorResultAsyncTask(out onComplete, out task))
            {
                return(task);
            }

            CreateCloudAnchor(onComplete, anchor._nativeHandle, ttlDays);

            return(task);
        }
Пример #4
0
 /// <summary>
 /// Attempts to asynchronously create a new <see cref="Cloud Anchor"/> with a given lifetime in days,
 /// using the pose of the provided <paramref name="anchor"/>.
 /// </summary>
 /// <remarks>
 /// The initial pose of the returned anchor will be set to the pose of the provided
 /// <paramref name="anchor"/>. However, the returned anchor is completely independent of
 /// the original <paramref name="anchor"/>, and the two poses might diverge over time.
 /// Hosting requires an active session for which the
 /// <see cref="GoogleARCore.TrackingState"/> is
 /// <see cref="GoogleARCore.TrackingState"/>.<c>Tracking</c>, as well as a working internet
 /// connection. The task will continue to retry silently in the background if it is unable
 /// to establish a connection to the ARCore <see cref="Cloud Anchor"/> service.
 /// </remarks>
 /// <param name="anchor">The anchor to host.</param>
 /// <param name="ttlDays">The lifetime of the anchor in days. Must be positive. The
 /// maximum allowed value is 1 if using an API Key to authenticate with the
 /// ARCore <see cref="Cloud Anchor"/> service, otherwise the maximum allowed value is 365.</param>
 /// <returns>A task that will complete when the attempt to create a new <see cref="Cloud Anchor"/> has
 /// finished. The result will be a <c>CloudAnchorResult</c> associated with the operation.
 /// </returns>
 public static GoogleARCore.AsyncTask <CloudAnchorResult> CreateCloudAnchor(
     GoogleARCore.Anchor anchor, int ttlDays)
 {
     return(CloudServiceManager.Instance.CreateCloudAnchor(anchor, ttlDays));
 }