public static FrequencyBandType GetBandFromFcn(this int fcn) { FrequencyBandDef def = frequencyBands.FirstOrDefault( x => fcn >= x.FcnStart && fcn <= x.FcnEnd); return((def != null) ? def.FrequencyBandType : FrequencyBandType.Undefined); }
public static FrequencyBandType GetBandFromFrequency(this double frequency) { FrequencyBandDef def = frequencyBands.FirstOrDefault( x => frequency >= x.FrequencyStart && frequency <= x.FrequencyEnd); return((def != null) ? def.FrequencyBandType : FrequencyBandType.Undefined); }
public static double GetFrequency(this int fcn) { FrequencyBandDef def = frequencyBands.FirstOrDefault( x => x.FrequencyBandType == fcn.GetBandFromFcn()); return((def != null) ? def.FrequencyStart + 0.1 * (fcn - def.FcnStart) : double.MinValue); }
public static int GetEarfcn(this double frequency) { FrequencyBandDef def = frequencyBands.FirstOrDefault( x => x.FrequencyBandType == frequency.GetBandFromFrequency()); return((def != null) ? (int)(def.FcnStart + 10 * (frequency - def.FrequencyStart)) : int.MinValue); }