Exemple #1
0
        public static int?GetChannel(decimal frequency)
        {
            if (!FrequencyMap.ContainsKey(frequency))
            {
                return(null);
            }

            return(FrequencyMap[frequency]);
        }
Exemple #2
0
        private static void PopulateMaps()
        {
            foreach (var band in ChannelBands)
            {
                for (var channelId = band.MinChannel; channelId <= band.MaxChannel; channelId++)
                {
                    var frequency = CalculateFrequency(channelId, band);

                    if (ChannelMap.ContainsKey(channelId))
                    {
                        throw new Exception($"Channel ID overlap detected for channel {channelId}. Please check channel bands.");
                    }

                    if (FrequencyMap.ContainsKey(frequency))
                    {
                        throw new Exception($"Frequency overlap detected for frequency {frequency}Mhz. Please check channel bands.");
                    }

                    ChannelMap[channelId]   = frequency;
                    FrequencyMap[frequency] = channelId;
                }
            }
        }