protected override async Task InitializeAsync() { await base.InitializeAsync(); if (Location != null) { #region foreground monitoring _foregroundIndoorLocationManager = new EILIndoorLocationManager(); EstimoteForegroundIndoorLocationManagerDelegate foregroundLocationManagerDelegate = new EstimoteForegroundIndoorLocationManagerDelegate(); foregroundLocationManagerDelegate.UpdatedPositionAsync += async(position, accuracy, location) => { EstimoteIndoorLocationAccuracy accuracyEnum = (EstimoteIndoorLocationAccuracy)Enum.Parse(typeof(EstimoteIndoorLocationAccuracy), accuracy.ToString(), true); await StoreDatumAsync(new EstimoteIndoorLocationDatum(DateTimeOffset.UtcNow, position.X, position.Y, position.Orientation, accuracyEnum, location.Name, location.Identifier, location, position)); }; _foregroundIndoorLocationManager.Delegate = foregroundLocationManagerDelegate; #endregion #region background monitoring _backgroundIndoorLocationManager = new EILBackgroundIndoorLocationManager(); EstimoteBackgroundIndoorLocationManagerDelegate backgroundLocationManagerDelegate = new EstimoteBackgroundIndoorLocationManagerDelegate(); backgroundLocationManagerDelegate.UpdatedPositionAsync += async(position, accuracy, location) => { EstimoteIndoorLocationAccuracy accuracyEnum = (EstimoteIndoorLocationAccuracy)Enum.Parse(typeof(EstimoteIndoorLocationAccuracy), accuracy.ToString(), true); await StoreDatumAsync(new EstimoteIndoorLocationDatum(DateTimeOffset.UtcNow, position.X, position.Y, position.Orientation, accuracyEnum, location.Name, location.Identifier, location, position)); }; _backgroundIndoorLocationManager.Delegate = backgroundLocationManagerDelegate; #endregion } }
public override void DidFailToUpdatePosition(EILBackgroundIndoorLocationManager locationManager, NSError error) { SensusServiceHelper.Get().Logger.Log("Failed to update indoor location position: " + error, LoggingLevel.Normal, GetType()); }
public override async void DidUpdatePosition(EILBackgroundIndoorLocationManager locationManager, EILOrientedPoint position, EILPositionAccuracy positionAccuracy, EILLocation location) { await(UpdatedPositionAsync?.Invoke(position, positionAccuracy, location) ?? Task.CompletedTask); }