예제 #1
0
        private IEnumerable <mwc.Incumbent> GetIncumbentsFromTable(string tableName, string partitionKey, IncumbentType incumbentType)
        {
            // Todo: this is a temporary method provided until the backend supports retriving incumbents of type "tv_us"
            Microsoft.WhiteSpaces.AzureTableAccess.AzureTableOperation azureTableOperations = new Microsoft.WhiteSpaces.AzureTableAccess.AzureTableOperation();

            string tableQuery = TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, partitionKey);

            if (incumbentType != IncumbentType.None)
            {
                tableQuery = TableQuery.CombineFilters(tableQuery, TableOperators.And, TableQuery.GenerateFilterConditionForInt("Type", QueryComparisons.Equal, (int)incumbentType));
            }

            IEnumerable <mwc.Incumbent> tvEngDataList = azureTableOperations.GetAllEntities <CDBSTvEngData>(tableName, tableQuery)
                                                        .Select(cdbsTvEndData =>
            {
                List <Position> contourPoints = WhitespacesManager.GetContourPointsSpaceSeperator(cdbsTvEndData.Contour);
                mwc.Incumbent incumbent       = new mwc.Incumbent(
                    cdbsTvEndData.CallSign,
                    cdbsTvEndData.Channel,
                    contourPoints,
                    null,
                    incumbentType,
                    null,
                    new Location(cdbsTvEndData.Latitude, cdbsTvEndData.Longitude));

                return(incumbent);
            });

            return(tvEngDataList);
        }
예제 #2
0
        private static List <mwc.Incumbent> ParseRawIncumbents(IncumbentType incumbentType, object[] rawIncumbents, IEnumerable <int> channels)
        {
            dynamic incumbentList           = null;
            List <mwc.Incumbent> incumbents = new List <mwc.Incumbent>();

            if (rawIncumbents != null)
            {
                switch (incumbentType)
                {
                case IncumbentType.MVPD:
                    incumbentList = WhitespacesManager.GetDeserializedIncumbents <MVPDRegistration>(rawIncumbents);
                    break;

                case IncumbentType.LPAux:
                case IncumbentType.UnlicensedLPAux:
                    incumbentList = WhitespacesManager.GetDeserializedIncumbents <LPAuxRegistration>(rawIncumbents);
                    break;

                case IncumbentType.TBAS:
                    incumbentList = WhitespacesManager.GetDeserializedIncumbents <TempBASRegistration>(rawIncumbents);
                    break;

                case IncumbentType.TV_US:
                    // TODO: Logic to de-serialize TV_US incumbents type. [Need to wait until back-end supports this]
                    break;
                }

                if (incumbentList != null)
                {
                    foreach (object incumbent in incumbentList)
                    {
                        mwc.Incumbent incumbentModel = WhitespacesManager.GetIncumbent(incumbent, incumbentType);
                        incumbents.Add(incumbentModel);
                    }
                }

                if (channels != null)
                {
                    IEnumerable <mwc.Incumbent> filteredIncumbents = WhitespacesManager.FilterIncumbentsByChannel(incumbents, channels);
                    incumbents = filteredIncumbents != null?filteredIncumbents.ToList() : incumbents;
                }
            }

            return(incumbents);
        }
예제 #3
0
        private static mwc.Incumbent GetIncumbent(object incumbent, IncumbentType requestedIncumbentType)
        {
            mwc.Incumbent incumbentModel = null;

            if (incumbent is MVPDRegistration)
            {
                MVPDRegistration mvpdRegistration = (MVPDRegistration)incumbent;

                // TODO: BroadcastStationContour was removed
                //                List<Position> contourPoints = WhitespacesManager.GetContourPoints(mvpdRegistration.BroadcastStationContour);
                List <Position> contourPoints = new List <Position>();

                incumbentModel = new mwc.Incumbent(
                    mvpdRegistration.Channel.CallSign,
                    mvpdRegistration.ChannelNumber,
                    contourPoints,
                    null,
                    requestedIncumbentType,
                    mvpdRegistration.Location,
                    mvpdRegistration.TransmitLocation);
            }
            else if (incumbent is TempBASRegistration)
            {
                TempBASRegistration tempBasRegistration = (TempBASRegistration)incumbent;

                // TODO: BroadcastStationContour was removed
                //                List<Position> contourPoints = WhitespacesManager.GetContourPoints(tempBasRegistration.BroadcastStationContour);
                List <Position> contourPoints = new List <Position>();

                incumbentModel = new mwc.Incumbent(
                    tempBasRegistration.Channel.CallSign,
                    tempBasRegistration.ChannelNumber,
                    contourPoints,
                    tempBasRegistration.Event,
                    requestedIncumbentType,
                    tempBasRegistration.RecvLocation,
                    tempBasRegistration.TransmitLocation);
            }
            else if (incumbent is LPAuxRegistration)
            {
                LPAuxRegistration lpAuxIncumbent = (LPAuxRegistration)incumbent;
                List <Position>   contourPoints  = new List <Position>();

                if (lpAuxIncumbent.PointsArea != null)
                {
                    contourPoints = lpAuxIncumbent.PointsArea.ToList();
                }
                else if (lpAuxIncumbent.QuadrilateralArea != null)
                {
                    foreach (QuadrilateralArea area in lpAuxIncumbent.QuadrilateralArea)
                    {
                        contourPoints.Add(area.NEPoint);
                        contourPoints.Add(area.NWPoint);
                        contourPoints.Add(area.SEPoint);
                        contourPoints.Add(area.SWPoint);
                    }
                }

                // TODO: How to get ReceiveLocation for LPAuxRegistration entity.
                incumbentModel = new mwc.Incumbent(
                    lpAuxIncumbent.CallSign.CallSign,
                    lpAuxIncumbent.CallSign.Channel.Value,
                    contourPoints,
                    lpAuxIncumbent.Event,
                    requestedIncumbentType,
                    null,
                    new Location(lpAuxIncumbent.Latitude, lpAuxIncumbent.Longitude));
            }

            //// TODO: Logic to create Incumbent object for TV_US incumbent type, as now not sure what Object type to be compare with.

            return(incumbentModel);
        }