Exemplo n.º 1
0
        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));
                    }
                }
            }
        }
Exemplo n.º 2
0
        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());
        }