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 EstimoteIndoorLocationDatum(DateTimeOffset timestamp, double x, double y, double orientation, EstimoteIndoorLocationAccuracy accuracy, string locationName, string locationId, EstimoteIndoorLocation estimoteLocation, EstimoteIndoorPosition estimotePosition) : base(timestamp) { _x = x; _y = y; _orientation = orientation; _accuracy = accuracy; _locationName = locationName; _locationId = locationId; _estimoteLocation = estimoteLocation; _estimotePosition = estimotePosition; }