/// <summary> /// Both the sniffer backend and radiomap backend define a PositionEstimate entity. /// Therefore, we convert WifiSniffer position estimates to radiomap position-estimates when /// we save tracking data to the radio map backend (which houses the tracking data as well) /// </summary> /// <param name="?"></param> /// <returns></returns> private static TrackedPosition CreateTrackedPosition(WifiSnifferPositioningService.PositionEstimate org) { TrackedPosition res = new TrackedPosition(); res.Accuracy = org.Accuracy; res.Altitude = org.Altitude; res.Bearing = org.Bearing; res.Building_ID = org.Building_ID; res.HasAccuracy = org.HasAccuracy; res.HasBearing = org.HasBearing; res.HasSpeed = org.HasSpeed; res.Latitude = org.Latitude; res.Longitude = org.Longitude; res.Provider = org.Provider; res.Speed = org.Speed; res.Time = DateTime.Now; //org.Time; res.VertexID = org.VertexID; res.ClientID = ClientId; //A guid return res; }
/// <summary> /// Creates a tracked position from a wifi sniffer position estimate and adds it to the tracked positions /// </summary> /// <param name="pos"></param> private static void AddToTrackedPositions(WifiSnifferPositioningService.PositionEstimate pos) { AddToTrackedPositions(CreateTrackedPosition(pos)); }
public PositionEstimateEventArgs(WifiSnifferPositioningService.PositionEstimate pos) { this.PositionEstimate = pos; }
public PositionEstimateArgs(WifiSnifferPositioningService.PositionEstimate loc) { this.Location = loc; }
private void UI_UpdateNewLocation(WifiSnifferPositioningService.PositionEstimate location) { if (uiMode == UiMode.GOOGLE_MAPS) { JSInterface.updateNewLocation(browser, location); } else if (uiMode == UiMode.BING_MAPS) { OnPositionEstimateChanged(this, new PositionEstimateArgs(location)); } }
private void updateNewLocation(WifiSnifferPositioningService.PositionEstimate location) { double distToPrev = -1; //placed here so I can see its value throughoutu the mehthod (for debugging) if (location != null) { bool showNewLocation = true; if (lastUpdatedLocation != null) { //ekstra tjek - paa threshold double oldLat = lastUpdatedLocation.Latitude; double oldLng = lastUpdatedLocation.Longitude; double newLat = location.Latitude; double newLng = location.Longitude; distToPrev = DistanceMeasurements.CalculateMoveddistanceInMeters(oldLat, oldLng, newLat, newLng); if (distToPrev <= this.updateThresholdInMeters) { showNewLocation = false; } } if (showNewLocation) { UI_UpdateNewLocation(location); lastUpdatedLocation = location; //NOTE: MAYBE important to COPY as done here. } lastKnownLocation = location; } }