public async Task <ISpatialCoordinate> LocalizeAsync(CancellationToken cancellationToken) { localizer.DebugLog("Getting host coordinate"); await coordinateService.TryDiscoverCoordinatesAsync(cancellationToken, new int[] { settings.MarkerID }); if (!coordinateService.TryGetKnownCoordinate(settings.MarkerID, out ISpatialCoordinate spatialCoordinate)) { Debug.LogError("Unexpected failure to discover a marker coordinate"); } return(spatialCoordinate); }
/// <inheritdoc /> public override async Task <ISpatialCoordinate> LocalizeAsync(CancellationToken cancellationToken) { localizer.DebugLog("Getting host coordinate"); ISpatialCoordinate spatialCoordinate = null; using (var cancellableCTS = CancellationTokenSource.CreateLinkedTokenSource(defaultCancellationToken, cancellationToken)) { await coordinateService.TryDiscoverCoordinatesAsync(cancellationToken, new int[] { settings.MarkerID }); if (!coordinateService.TryGetKnownCoordinate(settings.MarkerID, out spatialCoordinate)) { Debug.LogError("Unexpected failure to discover a marker coordinate"); } } return(spatialCoordinate); }