using Nonemm.Core; namespace Nonemm.Session; /// Reads a mode typed into the callsign box, which is how an operator changes /// mode without touching a radio. N1MM takes a mode there the same way it takes /// a frequency, and it is the only way to reach a mode with no radio connected. public static class ModeEntry { /// Null when the text names no mode. `SSB`, `PH` and `PHONE` take the /// sideband the frequency calls for, which is what the band panel does. public static Mode? Parse(string text, Frequency where) { string wanted = text.Trim().ToUpperInvariant(); return wanted switch { "" => null, "SSB" or "PH" or "PHONE" => Modes.ForSideband(where), _ => Modes.Parse(wanted), }; } }