Пример #1
0
        private void LocationService_OnPositionEstimateChange(object sender, LocationService.PositionEstimateEventArgs e)
        {
            WifiSnifferPositioningService.PositionEstimate location = e.PositionEstimate;

            //TODO: Insert a check for whether we need to shift building
            //location.Building_ID != lastKnownWifiLocation
            //The rest is part of an else block

            mCurrentEstimatedFloor = (int)location.Altitude; //placed here because we check floor before updating location
			    	
			//First check if we are even interested in receiving position updates?
			if (!IsTrackingPosition)	
			    return;
			 
   	        //Then check whether we need to update floor
			//We change floor if this is the very first wifi location or the location is estimated
			//at a new floor
			bool doChangeFloor = false;
            //Beware: If the locationService changes semantics to broadcasting null estimates (in case of error)
            //then this null check will not be a valid indicator of a floor change
		    if (lastKnownWifiLocation == null) //No prior pos: We change floor			    		
		    {
		    	doChangeFloor = true;
		    }
		    else //Check for new floor
		    {
		    	int prevFloor = (int)lastKnownWifiLocation.Altitude;
			    if (prevFloor != mCurrentEstimatedFloor)
			    	doChangeFloor = true;		    		
		    }
            lastKnownWifiLocation = location;
					
		    if (doChangeFloor)
		    {
		    	mCurrentSelectedFloor = mCurrentEstimatedFloor;
		    	//Globals.ShowDialog(source, "Changing to new floor...", Globals.DURATION_SHORT);
		    	refreshUI();
		    }
		    		
		    //the threshold based check for whether to update the location is conducted in updateNewLocation()
		    //as it applies to gps and wi-fi alike           
		    updateNewLocation(location);
        }
Пример #2
0
 void LocationService_OnBuildingIdentificationChange(object sender, LocationService.BuildingIdentificationEventArgs e)
 {
     if (e.BuildingFound)
     {
         LocationService.DownloadRadioMap(e.BuildingId);
     }
     else
     {
         if (OnNoBuildingFound != null)
             OnNoBuildingFound(this, EventArgs.Empty);                
     }                
 }