Esempio n. 1
0
        public void ChangeFrequency(CurrentSRSRadioMode currentSRSRadioMode, double value)
        {
            var radioId = 0;

            switch (currentSRSRadioMode)
            {
            case CurrentSRSRadioMode.COM1:
            {
                radioId = 1;
                break;
            }

            case CurrentSRSRadioMode.COM2:
            {
                radioId = 2;
                break;
            }

            case CurrentSRSRadioMode.NAV1:
            {
                radioId = 3;
                break;
            }

            case CurrentSRSRadioMode.NAV2:
            {
                radioId = 4;
                break;
            }

            case CurrentSRSRadioMode.ADF:
            {
                radioId = 5;
                break;
            }

            case CurrentSRSRadioMode.DME:
            {
                radioId = 6;
                break;
            }

            case CurrentSRSRadioMode.XPDR:
            {
                radioId = 7;
                break;
            }

            default:
            {
                radioId = 1;
                break;
            }
            }
            var result = "{ \"Command\": 0,\"RadioId\":" + radioId + ",\"Frequency\": " + value.ToString("0.000", CultureInfo.InvariantCulture) + " }\n";

            Common.DebugP(result);
            SendDataFunction(result);
        }
Esempio n. 2
0
        public void ToggleBetweenGuardAndFrequency(CurrentSRSRadioMode currentSRSRadioMode)
        {
            var radioId = 0;

            switch (currentSRSRadioMode)
            {
            case CurrentSRSRadioMode.COM1:
            {
                radioId = 1;
                break;
            }

            case CurrentSRSRadioMode.COM2:
            {
                radioId = 2;
                break;
            }

            case CurrentSRSRadioMode.NAV1:
            {
                radioId = 3;
                break;
            }

            case CurrentSRSRadioMode.NAV2:
            {
                radioId = 4;
                break;
            }

            case CurrentSRSRadioMode.ADF:
            {
                radioId = 5;
                break;
            }

            case CurrentSRSRadioMode.DME:
            {
                radioId = 6;
                break;
            }

            case CurrentSRSRadioMode.XPDR:
            {
                radioId = 7;
                break;
            }
            }
            var result = "{\"Command\": 2,\"RadioId\":" + radioId + "}\n";

            //{ "Command": 2,"RadioId":2}
            Common.DebugP(result);
            SendDataFunction(result);
        }
Esempio n. 3
0
        public double GetFrequencyOrChannel(CurrentSRSRadioMode currentSRSRadioMode, bool guard = false)
        {
            lock (_readSRSDataLockObject)
            {
                switch (currentSRSRadioMode)
                {
                case CurrentSRSRadioMode.COM1:
                {
                    if (!guard)
                    {
                        if (_srsPlayerRadioInfo.radios[1].channel == -1)
                        {
                            return(_srsPlayerRadioInfo.radios[1].freq);
                        }
                        return(_srsPlayerRadioInfo.radios[1].channel);
                    }
                    return(_srsPlayerRadioInfo.radios[1].secFreq);
                }

                case CurrentSRSRadioMode.COM2:
                {
                    if (!guard)
                    {
                        if (_srsPlayerRadioInfo.radios[2].channel == -1)
                        {
                            return(_srsPlayerRadioInfo.radios[2].freq);
                        }
                        return(_srsPlayerRadioInfo.radios[2].channel);
                    }
                    return(_srsPlayerRadioInfo.radios[2].secFreq);
                }

                case CurrentSRSRadioMode.NAV1:
                {
                    if (!guard)
                    {
                        if (_srsPlayerRadioInfo.radios[3].channel == -1)
                        {
                            return(_srsPlayerRadioInfo.radios[3].freq);
                        }
                        return(_srsPlayerRadioInfo.radios[3].channel);
                    }
                    return(_srsPlayerRadioInfo.radios[3].secFreq);
                }

                case CurrentSRSRadioMode.NAV2:
                {
                    if (!guard)
                    {
                        if (_srsPlayerRadioInfo.radios[4].channel == -1)
                        {
                            return(_srsPlayerRadioInfo.radios[4].freq);
                        }
                        return(_srsPlayerRadioInfo.radios[4].channel);
                    }
                    return(_srsPlayerRadioInfo.radios[4].secFreq);
                }

                case CurrentSRSRadioMode.ADF:
                {
                    if (!guard)
                    {
                        if (_srsPlayerRadioInfo.radios[5].channel == -1)
                        {
                            return(_srsPlayerRadioInfo.radios[5].freq);
                        }
                        return(_srsPlayerRadioInfo.radios[5].channel);
                    }
                    return(_srsPlayerRadioInfo.radios[5].secFreq);
                }

                case CurrentSRSRadioMode.DME:
                {
                    if (!guard)
                    {
                        if (_srsPlayerRadioInfo.radios[6].channel == -1)
                        {
                            return(_srsPlayerRadioInfo.radios[6].freq);
                        }
                        return(_srsPlayerRadioInfo.radios[6].channel);
                    }
                    return(_srsPlayerRadioInfo.radios[6].secFreq);
                }

                case CurrentSRSRadioMode.XPDR:
                {
                    if (!guard)
                    {
                        if (_srsPlayerRadioInfo.radios[7].channel == -1)
                        {
                            return(_srsPlayerRadioInfo.radios[7].freq);
                        }
                        return(_srsPlayerRadioInfo.radios[7].channel);
                    }
                    return(_srsPlayerRadioInfo.radios[7].secFreq);
                }
                }
            }
            return(-1);
        }
Esempio n. 4
0
        public SRSRadioMode GetRadioMode(CurrentSRSRadioMode currentSRSRadioMode)
        {
            lock (_readSRSDataLockObject)
            {
                switch (currentSRSRadioMode)
                {
                case CurrentSRSRadioMode.COM1:
                {
                    if (_srsPlayerRadioInfo.radios[1].channel == -1)
                    {
                        return(SRSRadioMode.Freq);
                    }
                    return(SRSRadioMode.Channel);
                }

                case CurrentSRSRadioMode.COM2:
                {
                    if (_srsPlayerRadioInfo.radios[2].channel == -1)
                    {
                        return(SRSRadioMode.Freq);
                    }
                    return(SRSRadioMode.Channel);
                }

                case CurrentSRSRadioMode.NAV1:
                {
                    if (_srsPlayerRadioInfo.radios[3].channel == -1)
                    {
                        return(SRSRadioMode.Freq);
                    }
                    return(SRSRadioMode.Channel);
                }

                case CurrentSRSRadioMode.NAV2:
                {
                    if (_srsPlayerRadioInfo.radios[4].channel == -1)
                    {
                        return(SRSRadioMode.Freq);
                    }
                    return(SRSRadioMode.Channel);
                }

                case CurrentSRSRadioMode.ADF:
                {
                    if (_srsPlayerRadioInfo.radios[5].channel == -1)
                    {
                        return(SRSRadioMode.Freq);
                    }
                    return(SRSRadioMode.Channel);
                }

                case CurrentSRSRadioMode.DME:
                {
                    if (_srsPlayerRadioInfo.radios[6].channel == -1)
                    {
                        return(SRSRadioMode.Freq);
                    }
                    return(SRSRadioMode.Channel);
                }

                case CurrentSRSRadioMode.XPDR:
                {
                    if (_srsPlayerRadioInfo.radios[7].channel == -1)
                    {
                        return(SRSRadioMode.Freq);
                    }
                    return(SRSRadioMode.Channel);
                }
                }
            }
            return(SRSRadioMode.Freq);
        }
Esempio n. 5
0
        public void ChangeChannel(CurrentSRSRadioMode currentSRSRadioMode, bool increase)
        {
            var radioId = 0;

            switch (currentSRSRadioMode)
            {
            case CurrentSRSRadioMode.COM1:
            {
                radioId = 1;
                break;
            }

            case CurrentSRSRadioMode.COM2:
            {
                radioId = 2;
                break;
            }

            case CurrentSRSRadioMode.NAV1:
            {
                radioId = 3;
                break;
            }

            case CurrentSRSRadioMode.NAV2:
            {
                radioId = 4;
                break;
            }

            case CurrentSRSRadioMode.ADF:
            {
                radioId = 5;
                break;
            }

            case CurrentSRSRadioMode.DME:
            {
                radioId = 6;
                break;
            }

            case CurrentSRSRadioMode.XPDR:
            {
                radioId = 7;
                break;
            }
            }

            /*{ "Command": 3,"RadioId":1}
             * --channel up(if channels have been configured)
             *
             * { "Command": 4,"RadioId":1}
             * --channel down(if channels have been configured)*/
            var result = "";

            if (increase)
            {
                result = "{\"Command\": 3,\"RadioId\":" + radioId + "}\n";
            }
            else
            {
                result = "{\"Command\": 4,\"RadioId\":" + radioId + "}\n";
            }
            SendDataFunction(result);
        }