Ejemplo n.º 1
0
        public List <mwc.Incumbent> GetIncumbents(string incumbentType, string regionName, IEnumerable <int> channels)
        {
            Check.IsNotEmptyOrWhiteSpace(incumbentType, "incumbentType");
            Check.IsNotEmptyOrWhiteSpace(regionName, "regionName");

            IncumbentType enumType = (IncumbentType)Enum.Parse(typeof(IncumbentType), incumbentType, true);

            // Todo: This is temporary code until backend supports returning TV_US via the GetIncumbents call.
            if (enumType == IncumbentType.TV_US || enumType == IncumbentType.MVPD || enumType == IncumbentType.TV_TRANSLATOR)
            {
                return(this.GetIncumbentsFromTable(channels, enumType));
            }

            mwc.IRequestParameters requestParams = this.GetRequestParams(
                req =>
            {
                req.RegionName = regionName;
                req.Params     = new Parameters
                {
                    IncumbentType = incumbentType
                };
            });

            object[] rawIncumbents = this.whitespacesClient.GetIncumbents(requestParams).IncumbentList;

            return(WhitespacesManager.ParseRawIncumbents(enumType, rawIncumbents, channels));
        }
Ejemplo n.º 2
0
        public ProtectedDevice[] GetDeviceList(string incumbentType, double latitude, double longitude, string regionName = "United States")
        {
            mwc.IRequestParameters requestParams = this.GetRequestParams(
                req =>
            {
                req.RegionName = regionName;
                req.Params     = new Parameters
                {
                    IncumbentType = incumbentType,
                    Location      = new GeoLocation
                    {
                        Point = new Ellipse
                        {
                            Center = new Point
                            {
                                Latitude  = latitude.ToString(),
                                Longitude = longitude.ToString()
                            }
                        }
                    }
                };
            });

            return(this.whitespacesClient.GetDevices(requestParams).DeviceList);
        }
Ejemplo n.º 3
0
        public void SubmitPawsInterference(Parameters parameters, string regionName = Microsoft.WhiteSpaces.Common.Constants.Paws)
        {
            mwc.IRequestParameters requestParams = this.GetRequestParams(
                req =>
            {
                req.RegionName = regionName;
                req.Params     = parameters;
            });

            this.whitespacesClient.SubmitPawsInterference(requestParams);
        }
Ejemplo n.º 4
0
        public LpAuxLicenseInfo GetULSFileInfo(string ulsFileNumber, string regionName = "United States")
        {
            Check.IsNotNull(ulsFileNumber, "Uls File Number");
            mwc.IRequestParameters requestParams = this.GetRequestParams(
                req =>
            {
                req.RegionName = regionName;
                req.Params     = new Parameters();
            });

            LpAuxLicenseInfo[] lpAuxLicenses = this.whitespacesClient.GetAllUlsFileNumbers(regionName).LpAuxLicenses;

            return(lpAuxLicenses.Where(x => x.ULSFileNumber == ulsFileNumber).FirstOrDefault());
        }
Ejemplo n.º 5
0
        public async Task <MVPDCallSignsInfo> GetMvpdCallsignInfoAsync(string callsign, string regionName = "United States")
        {
            Check.IsNotNull(callsign, "callsign");

            mwc.IRequestParameters requestParams = this.GetRequestParams(
                req =>
            {
                req.RegionName = regionName;
            });

            Result result = await this.whitespacesClient.GetMvpdCallsignInfoAsync(callsign, regionName);

            return(result.CallsignInfo);
        }
Ejemplo n.º 6
0
        public MVPDCallSignsInfo[] GetNearByTvStations(Location location, string accessToken, string regionName = "United States")
        {
            Check.IsNotNull(location, "Location");

            mwc.IRequestParameters requestParams = this.GetRequestParams(
                req =>
            {
                req.RegionName = regionName;
                req.Params     = new Parameters
                {
                    MVPDLocation = location,
                };
                req.AccessToken = accessToken;
            });

            return(this.whitespacesClient.GetNearByTvStations(requestParams).SearchMVPDCallSigns);
        }
Ejemplo n.º 7
0
        public string ExcludeDevice(string accesstoken, string regionName, string deviceId, string serialNumber = "")
        {
            Check.IsNotEmptyOrWhiteSpace(regionName, "Region Name");
            Check.IsNotEmptyOrWhiteSpace(accesstoken, "Access Token");
            Check.IsNotEmptyOrWhiteSpace(regionName, "Region Name");

            this.requestParams = this.GetRequestParams(
                req =>
            {
                req.RegionName  = regionName;
                req.AccessToken = accesstoken;
                req.Params      = new Parameters
                {
                    DeviceId     = deviceId,
                    SerialNumber = serialNumber
                };
            });

            return(this.whitespacesClient.ExcludeIds(this.requestParams).Message);
        }
Ejemplo n.º 8
0
        public string ExcludeChannel(int[] channels, Point[] locations, string accesstoken, string regionName)
        {
            Check.IsNotNull(channels, "channels");
            Check.IsNotEmptyOrWhiteSpace(regionName, "Region Name");

            TvSpectrum[] spectra = new TvSpectrum[channels.Length];
            for (int i = 0; i < channels.Length; i++)
            {
                var spectrum = new TvSpectrum {
                    Channel = channels[i]
                };
                spectra[i] = spectrum;
            }

            List <GeoLocation> geoLocations = new List <GeoLocation>();

            foreach (Point location in locations)
            {
                geoLocations.Add(new GeoLocation
                {
                    Point = new Ellipse
                    {
                        Center = location
                    }
                });
            }

            this.requestParams = this.GetRequestParams(
                req =>
            {
                req.RegionName  = regionName;
                req.AccessToken = accesstoken;
                req.Params      = new Parameters
                {
                    Locations = geoLocations.ToArray(),
                    TvSpectra = spectra
                };
            });

            return(this.whitespacesClient.ExcludeChannel(this.requestParams).Message);
        }
Ejemplo n.º 9
0
        public List <mwc.Incumbent> GetIncumbents(string incumbentType, double latitude, double longitude, string regionName, IEnumerable <int> channels)
        {
            Check.IsNotEmptyOrWhiteSpace(incumbentType, "incumbentType");
            Check.IsNotEmptyOrWhiteSpace(regionName, "regionName");

            IncumbentType enumType = (IncumbentType)Enum.Parse(typeof(IncumbentType), incumbentType, true);

            // Todo: This is temporary code until backend supports returning TV_US via the GetIncumbents call.
            if (enumType == IncumbentType.TV_US || enumType == IncumbentType.TV_TRANSLATOR || enumType == IncumbentType.MVPD)
            {
                return(this.GetIncumbentsFromTable(channels, enumType, latitude, longitude));
            }

            // [Note:] As of now, it doesn't make any sense passing latitude and longitude values to filter the incumbents
            // based on the search region, but if it is enabled in back-end in future we can use following request.
            mwc.IRequestParameters requestParams = this.GetRequestParams(
                req =>
            {
                req.RegionName = regionName;
                req.Params     = new Parameters
                {
                    IncumbentType = incumbentType,
                    Location      = new GeoLocation
                    {
                        Point = new Ellipse
                        {
                            Center = new Point
                            {
                                Latitude  = latitude.ToString(),
                                Longitude = longitude.ToString()
                            }
                        }
                    }
                };
            });

            object[] rawIncumbents = this.whitespacesClient.GetIncumbents(requestParams).IncumbentList;

            return(WhitespacesManager.ParseRawIncumbents(enumType, rawIncumbents, channels));
        }
Ejemplo n.º 10
0
        public ChannelInfo[] GetChannelList(string incumbentType, double latitude, double longitude, string regionName = "United States")
        {
            Check.IsNotNull(incumbentType, "IncumbentType");

            mwc.IRequestParameters requestParams = this.GetRequestParams(
                req =>
            {
                req.RegionName = regionName;
                req.Params     = new Parameters
                {
                    IncumbentType = incumbentType,
                    Location      = new GeoLocation
                    {
                        Point = new Ellipse
                        {
                            Center = new Point
                            {
                                Latitude  = latitude.ToString(),
                                Longitude = longitude.ToString()
                            }
                        }
                    },

                    // Required for LpAux or UnLpAux
                    PointsArea = new Point[] { new Point {
                                                   Latitude = latitude.ToString(), Longitude = longitude.ToString()
                                               } },
                };

                // TODO: Should following fix be only for United Kingdom?
                if (string.Compare(regionName, "United Kingdom", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    req.Params.RequestType = "Specific";
                }
            });

            return(this.whitespacesClient.GetChannelList(requestParams).ChannelInfo);
        }
Ejemplo n.º 11
0
        public string RegisterMVPD(mwc.MvpdRegistrationInfo registrationInfo, string accessToken, string regionName = "United States")
        {
            Check.IsNotNull(registrationInfo, "MVPD Registration Info");
            Check.IsNotNull(accessToken, "Access Token");

            var errors = ValidationHelper.Validate <mwc.MvpdRegistrationInfo>(registrationInfo);

            if (errors.Count() > 0)
            {
                throw new mwc.ValidationErrorException(errors);
            }
            else
            {
                this.requestParams = this.GetRequestParams(
                    req =>
                {
                    req.AccessToken = accessToken;
                    req.Params      = new Parameters
                    {
                        IncumbentType    = registrationInfo.IncumbentType,
                        MVPDLocation     = registrationInfo.RecieveLocation,
                        TransmitLocation = registrationInfo.TransmitLocation,
                        Contact          = registrationInfo.Contact,
                        MVPDRegistrant   = registrationInfo.RegistrantInfo,
                        TvSpectrum       = new TvSpectrum
                        {
                            CallSign = registrationInfo.CallSign,
                            Channel  = registrationInfo.Channel,
                        },

                        // Some more name, description and contact Info, need to capture
                    };
                });

                return(this.whitespacesClient.AddIncumbent(this.requestParams).Message);
            }
        }
Ejemplo n.º 12
0
        public string RegisterLicensedLpAux(mwc.LicensedLpAuxRegistration registrationInfo, string accessToken, string regionName = "United States")
        {
            Check.IsNotNull(registrationInfo, "Licensed LpAux Registration Info");
            Check.IsNotNull(accessToken, "Access Token");

            List <Calendar> dateList = new List <Calendar>();

            if (registrationInfo.IsRecurred)
            {
                dateList = this.GetEventDates(registrationInfo);
            }
            else
            {
                var strartDate = Convert.ToDateTime(registrationInfo.StartDate).Add(TimeSpan.Parse(registrationInfo.StartTime));
                var endDate    = Convert.ToDateTime(registrationInfo.EndDate).Add(TimeSpan.Parse(registrationInfo.EndTime));
                dateList.Add(new Calendar {
                    Start = strartDate.ToString(), End = endDate.ToString(), Stamp = DateTime.Now.ToString()
                });
            }

            Event eventTime = new Event();

            eventTime.Times    = dateList.ToArray();
            eventTime.Channels = registrationInfo.Channels;

            this.requestParams = this.GetRequestParams(
                req =>
            {
                req.AccessToken = accessToken;
                req.Params      = new Parameters
                {
                    IncumbentType = IncumbentType.LPAux.ToString(),
                    TvSpectrum    = new TvSpectrum
                    {
                        CallSign = registrationInfo.CallSign,
                        Channel  = registrationInfo.Channels[0]
                    },
                    PointsArea = new Point[] { new Point {
                                                   Latitude = registrationInfo.Latitude.ToString(), Longitude = registrationInfo.Longitude.ToString()
                                               } },
                    Event           = eventTime,
                    LPAuxRegistrant = new Whitespace.Entities.Versitcard.VCard
                    {
                        Address = new Whitespace.Entities.Versitcard.Address
                        {
                            Locality = registrationInfo.Address1,
                            Street   = registrationInfo.Address2,
                            Country  = registrationInfo.Country,
                            Region   = registrationInfo.City,
                        },
                        Org = new Whitespace.Entities.Versitcard.Organization {
                            OrganizationName = registrationInfo.ResponsibleParty
                        }
                    },
                    Contact = new Whitespace.Entities.Versitcard.VCard
                    {
                        Address = new Whitespace.Entities.Versitcard.Address
                        {
                            Locality = registrationInfo.Address1,
                            Street   = registrationInfo.Address2,
                            Country  = registrationInfo.Country,
                            Region   = registrationInfo.City,
                        },
                        Email = new Whitespace.Entities.Versitcard.Email[] { new Whitespace.Entities.Versitcard.Email {
                                                                                 EmailAddress = registrationInfo.Email
                                                                             } },
                        Title = new Whitespace.Entities.Versitcard.Title {
                            Text = registrationInfo.FriendlyName
                        },
                        Telephone = new Whitespace.Entities.Versitcard.Telephone[] { new Whitespace.Entities.Versitcard.Telephone {
                                                                                         TelephoneNumber = registrationInfo.ContactPhone, PId = registrationInfo.Phone
                                                                                     } },
                        TimeZone = registrationInfo.TimeZone
                    }

                    // Channels need to capture
                };
            });

            return(this.whitespacesClient.AddIncumbent(this.requestParams).Message);
        }
Ejemplo n.º 13
0
        public string RegisterTBasLinks(mwc.TBasLinkRegistration registrationInfo, string accessToken, string regionName = "United States")
        {
            Check.IsNotNull(registrationInfo, "Licensed LpAux Registration Info");
            Check.IsNotNull(accessToken, "Access Token");

            var strartDate = Convert.ToDateTime(registrationInfo.StartDate).Add(TimeSpan.Parse(registrationInfo.StartTime));
            var endDate    = Convert.ToDateTime(registrationInfo.EndDate).Add(TimeSpan.Parse(registrationInfo.EndTime));

            this.requestParams = this.GetRequestParams(
                req =>
            {
                req.AccessToken = accessToken;
                req.Params      = new Parameters
                {
                    IncumbentType = IncumbentType.TBAS.ToString(),
                    TvSpectrum    = new TvSpectrum
                    {
                        CallSign = registrationInfo.CallSign,
                        Channel  = registrationInfo.Channels[0]
                    },

                    TransmitLocation = new Location {
                        Latitude = Convert.ToDouble(registrationInfo.TransmitterLatitude), Longitude = Convert.ToDouble(registrationInfo.TransmitterLongitude)
                    },
                    TempBasLocation = new Location {
                        Latitude = Convert.ToDouble(registrationInfo.RecieverLatitude), Longitude = Convert.ToDouble(registrationInfo.RecieverLongitude)
                    },

                    Event = new Event
                    {
                        // Reoccurence logic need to implement here
                        Times = new Calendar[] { new Calendar {
                                                     Start = strartDate.ToString(), End = endDate.ToString(), Stamp = DateTime.Now.ToString()
                                                 } },
                        Channels = registrationInfo.Channels
                    },
                    Contact = new Whitespace.Entities.Versitcard.VCard
                    {
                        Address = new Whitespace.Entities.Versitcard.Address
                        {
                            Locality = registrationInfo.Address1,
                            Street   = registrationInfo.Address2,
                            Country  = registrationInfo.Country,
                            Region   = registrationInfo.City,
                        },
                        Email = new Whitespace.Entities.Versitcard.Email[] { new Whitespace.Entities.Versitcard.Email {
                                                                                 EmailAddress = registrationInfo.Email
                                                                             } },
                        Telephone = new Whitespace.Entities.Versitcard.Telephone[] { new Whitespace.Entities.Versitcard.Telephone {
                                                                                         TelephoneNumber = registrationInfo.Phone
                                                                                     } },
                        TimeZone = registrationInfo.TimeZone,
                        Title    = new Whitespace.Entities.Versitcard.Title {
                            Text = registrationInfo.FriendlyName
                        }
                    },

                    TempBASRegistrant = new Whitespace.Entities.Versitcard.VCard
                    {
                        Address = new Whitespace.Entities.Versitcard.Address
                        {
                            Locality = registrationInfo.Address1,
                            Street   = registrationInfo.Address2,
                            Country  = registrationInfo.Country,
                            Region   = registrationInfo.City,
                        },
                        Email = new Whitespace.Entities.Versitcard.Email[] { new Whitespace.Entities.Versitcard.Email {
                                                                                 EmailAddress = registrationInfo.Email
                                                                             } },
                        Org = new Whitespace.Entities.Versitcard.Organization {
                            OrganizationName = registrationInfo.FriendlyName
                        },
                        Telephone = new Whitespace.Entities.Versitcard.Telephone[] { new Whitespace.Entities.Versitcard.Telephone {
                                                                                         TelephoneNumber = registrationInfo.Phone
                                                                                     } },
                        TimeZone = registrationInfo.TimeZone,
                        Title    = new Whitespace.Entities.Versitcard.Title {
                            Text = registrationInfo.Description
                        }
                    },

                    // Channels need to capture
                };
            });

            return(this.whitespacesClient.AddIncumbent(this.requestParams).Message);
        }