public Task SetFrequency(Vfo vfo, Frequency frequency) { lock (lockObj) { serialPort.Write($"F{vfoMap[vfo]}{frequency:D11};"); if (vfo == Vfo.A) { freqHzA = frequency; } else if (vfo == Vfo.B) { freqHzB = frequency; } else { throw new NotSupportedException(vfo.ToString()); } while (true) { if (ReadFrequencyFromRig(vfo) == frequency) { return(Task.FromResult(true)); } } } }
public Task <Frequency> GetFrequency(Vfo vfo) { switch (vfo) { case Vfo.A: return(Task.FromResult <Frequency>(freqHzA)); case Vfo.B: return(Task.FromResult <Frequency>(freqHzB)); } throw new NotSupportedException(vfo.ToString()); }