private void GetOccupiedChannels(RegionSearchParams searchParams, RegionWhitespaceDetails whitespaceDetails, string countryRegion) { IEnumerable <INCU> incumbents = this.GetReseveredChannelsFromIncumbentRequest(searchParams.IncumbentType, searchParams.Latitude, searchParams.Longitude, countryRegion, null); if (incumbents != null) { List <INCU> reservedIncumbents = incumbents.ToList(); whitespaceDetails.OccupiedChannes = this.FilterIncumbentsByRegion(searchParams.Latitude, searchParams.Longitude, reservedIncumbents).OrderBy(inc => inc.Channel).ToList(); } }
private void GetAvailableChannelsLookup(RegionSearchParams searchParams, RegionWhitespaceDetails whitespaceDetails, Region region) { Dictionary <string, ChannelInfo[]> availableChannelsLookup = new Dictionary <string, ChannelInfo[]>(); ChannelInfo[] channels = null; string[] deviceTypes = region.Regulatory.SupportedDeviceTypes.Select(device => device.Type).ToArray(); whitespaceDetails.AnalysisResult = this.GetWhitespaceAnalysisResult(deviceTypes, searchParams.Latitude, searchParams.Longitude, region, availableChannelsLookup); if (availableChannelsLookup.Any()) { channels = availableChannelsLookup[searchParams.IncumbentType]; } whitespaceDetails.Channels = this.GetChannelAvailabilityInfo(channels, region.Regulatory.WSChannelsInfo.StartChannel, region.Regulatory.WSChannelsInfo.EndChannel, region.Regulatory.WSChannelsInfo.PowerDBmTransitionPoint).ToList(); whitespaceDetails.AvailableChannelsLookup = availableChannelsLookup; }
private RegionWhitespaceDetails GetRegionWhitespaceDetails(string regionCode, double?antennaHeight) { IEnumerable <Region> supportedCountries = this.regionSource.GetAvailableRegions(); Region region = supportedCountries.FirstOrDefault(country => string.Compare(country.Regulatory.RegionCode, regionCode, StringComparison.OrdinalIgnoreCase) == 0); RegionSearchParams defaultSearchParams = new RegionSearchParams { CountryRegion = region != null ? region.RegionInformation.Name : string.Empty }; if (region != null) { defaultSearchParams.RegionCode = region.Regulatory.RegionCode; defaultSearchParams.Latitude = region.RegionInformation.Latitude; defaultSearchParams.Longitude = region.RegionInformation.Longitude; defaultSearchParams.IncumbentType = region.Regulatory.SupportedDeviceTypes.FirstOrDefault().Type; defaultSearchParams.AntennaHeight = antennaHeight; } return(this.GetRegionWhitespaceDetails(defaultSearchParams, false)); }
public ActionResult GetIncumbents(RegionSearchParams searchParams, int[] channels) { List <INCU> incumbents = new List <INCU>(); Region region = this.regionSource.GetAvailableRegions().FirstOrDefault(rgn => string.Compare(rgn.RegionInformation.Name, searchParams.CountryRegion, StringComparison.OrdinalIgnoreCase) == 0); if (region == null) { //// TODO: Logic to handle Invalid CountryRegion as argument. } incumbents = this.whitespacesManager.GetIncumbents(searchParams.IncumbentType, searchParams.Latitude, searchParams.Longitude, searchParams.CountryRegion, channels); // TODO: May be we need to have condition check below to make sure following filter logic executes only for FCC. // [Temporary fix]: Commenting following search location based filtering, because for incumbent type such as "TV_US" is not return TransmitLocation, // which plays a major role in filtering the incumbents for the given search location. // incumbents = this.FilterIncumbentsByRegion(searchParams.Latitude, searchParams.Longitude, incumbents); incumbents = this.FilterIncumbentsByChannels(channels, incumbents); return(this.Json(incumbents, JsonRequestBehavior.AllowGet)); }
public PartialViewResult FindNearByIncumbents(RegionSearchParams model) { RegionWhitespaceDetails whitespaceDetails = this.GetRegionWhitespaceDetails(model, this.ModelState.IsValid); return(this.PartialView("WhitespaceDetailsPartial", whitespaceDetails)); }
public PartialViewResult GetCountryRegionSpecificControls(RegionSearchParams model) { RegionWhitespaceDetails whitespaceDetails = this.GetRegionWhitespaceDetails(model.RegionCode, model.AntennaHeight); return(this.PartialView("WhitespaceDetailsPartial", whitespaceDetails)); }
private RegionWhitespaceDetails GetRegionWhitespaceDetails(RegionSearchParams searchParams, bool getChannelInfoList) { Region region = this.regionSource.GetAvailableRegions().FirstOrDefault(rgn => string.Compare(rgn.Regulatory.RegionCode, searchParams.RegionCode, StringComparison.OrdinalIgnoreCase) == 0); RegionWhitespaceDetails whitespaceDetails = new RegionWhitespaceDetails { AntennaHeight = searchParams.AntennaHeight, Location = searchParams.Location, EnableProtectedAreas = region != null ? region.Regulatory.AllowAccessToProtedtedArea : false }; if (region != null) { whitespaceDetails.StartChannelNo = region.Regulatory.WSChannelsInfo.StartChannel; whitespaceDetails.EndChannelNo = region.Regulatory.WSChannelsInfo.EndChannel; if (region.Regulatory.SupportedDeviceTypes != null) { whitespaceDetails.DeviceTypes = region.Regulatory.SupportedDeviceTypes.ToList(); whitespaceDetails.SelectedIncumbentType = string.IsNullOrEmpty(searchParams.IncumbentType) ? whitespaceDetails.DeviceTypes.FirstOrDefault().Type : searchParams.IncumbentType; whitespaceDetails.PowerDBmTransitionPoint = region.Regulatory.WSChannelsInfo.PowerDBmTransitionPoint; } } if (getChannelInfoList) { string[] deviceTypes = region.Regulatory.SupportedDeviceTypes.Select(device => device.Type).ToArray(); Task getAnalysisResult = new Task(() => { this.GetAvailableChannelsLookup(searchParams, whitespaceDetails, region); }); getAnalysisResult.Start(); try { if (region.Regulatory.AllowAccessToProtedtedArea) { Task getIncumbents = new Task(() => { this.GetOccupiedChannels(searchParams, whitespaceDetails, region.RegionInformation.Name); }); getIncumbents.Start(); Task.WaitAll(getAnalysisResult, getIncumbents); } else { Task.WaitAll(getAnalysisResult); } } catch (AggregateException ex) { // TODO: Is it required to initialize following view model lists to empty list or leave them as null ? // Swallow the exception, initialize lists to empty list and return results. whitespaceDetails.AnalysisResult = new WhitespaceAnalysisResult(new List <WhitespaceSummary>()); whitespaceDetails.Channels = new List <ChannelInformation>(); whitespaceDetails.OccupiedChannes = new List <INCU>(); System.Diagnostics.Trace.Write(ex.ToString()); this.WhitespaceFinderAuditor.RegionCode = Convert.ToInt16(region.RegionInformation.Id); this.WhitespaceFinderAuditor.TransactionId = this.WhitespaceFinderLogger.TransactionId; this.WhitespaceFinderAuditor.Audit(AuditId.WhitespaceFinder, AuditStatus.Failure, default(int), ex.ToString()); } } whitespaceDetails.RegionChannelsDetail = this.GetRegionChannelsDetail(whitespaceDetails.Channels, searchParams.Latitude, searchParams.Longitude, searchParams.CountryRegion); return(whitespaceDetails); }