예제 #1
0
        // Event handler invoked when switching between VFO in SO2V in DXLog.net
        private void HandleFocusChange()
        {
            CATCommon radio1       = mainForm.COMMainProvider.RadioObject(1);
            int       focusedRadio = mainForm.ContestDataProvider.FocusedRadio;
            bool      stereoAudio  = mainForm.ListenStatusMode == COMMain.ListenMode.R1R2;

            tempStereoToggle = false;

            if (focusedRadio != lastFocusedRadio) // Only active in SO2V. Ignore redundant invokations.
            {
                lastFocusedRadio = focusedRadio;

                if (microHamPort != null)
                {
                    if (stereoAudio)
                    {
                        mainForm.SetListenStatusMode(COMMain.ListenMode.R1R2, true, false);
                    }
                    else
                    {
                        mainForm.SetListenStatusMode(focusedRadio == 1 ? COMMain.ListenMode.R1R1 : COMMain.ListenMode.R2R2, true, false);
                    }
                }

                if (radio1 != null)
                {
                    if (radio1.IsICOM())
                    {
                        radio1.SendCustomCommand(focusedRadio == 1 ? IcomSelectMain : IcomSelectSub);
                    }
                }

                mainForm.SetMainStatusText(string.Format(statusMessage, focusedRadio == 1 ? "Main" : "Sub", stereoAudio ? "Stereo" : "Single receiver"));
            }
        }
예제 #2
0
        // Executes at DXLog.net start
        public void Initialize(FrmMain main)
        {
            CATCommon radio1 = main.COMMainProvider.RadioObject(1);

            mainForm = main;
            bool modeIsSo2V = (mainForm.ContestDataProvider.OPTechnique == ContestData.Technique.SO2V);

            if (modeIsSo2V)
            {
                // Initialize temporary stereo mode to DXLog's stereo mode to support temporary toggle
                // At start up, radio 1 is always focused and stereo audio is disabled
                tempStereoAudio = false;
                lastFocus       = 1;

                main.ContestDataProvider.FocusedRadioChanged += new ContestData.FocusedRadioChange(HandleFocusChange);

                // Only initialize radio if present and ICOM
                if (radio1 != null)
                {
                    if (radio1.IsICOM())
                    {
                        // Initialize radio to DW off, Split off and Main VFO focused
                        radio1.SendCustomCommand(IcomDualWatchOff);
                        radio1.SendCustomCommand(IcomSelectMain);
                        radio1.SendCustomCommand(IcomSplitOff);
                    }
                }
            }
        }
        public void Initialize(FrmMain main)
        {
            int       radioIndex, bandIndex, megaHertz;
            CATCommon radio1 = main.COMMainProvider.RadioObject(1);

            cdata    = main.ContestDataProvider;
            mainForm = main;

            if (radio1 != null)                 // Only test if radio is ICOM if radio exist
            {
                if (radio1.IsICOM())
                {
                    cdata.FocusedRadioChanged += new ContestData.FocusedRadioChange(HandleFocusChange);
                }
            }

            // Create look-up table based on actual frequency for simple look-up
            for (radioIndex = 0; radioIndex < 2; radioIndex++)
            {
                for (bandIndex = 0; bandIndex < 12; bandIndex++)
                {
                    megaHertz = (int)(_txpower[radioIndex, bandIndex, 0] / 1000.0);
                    TxPower[radioIndex, megaHertz] = _txpower[radioIndex, bandIndex, 1];
                }
            }

            cdata.ActiveRadioBandChanged += new ContestData.ActiveRadioBandChange(HandleBandChange);
        }
예제 #4
0
        // Executes at DXLog.net start
        public void Initialize(FrmMain main)
        {
            mainForm = main;
            CATCommon radio1 = main.COMMainProvider.RadioObject(1);

            if (main.ContestDataProvider.OPTechnique == ContestData.Technique.SO2V)
            {
                // Find Microham port
                foreach (COMPort _comport in main.COMMainProvider._com)
                {
                    if (_comport._mk2r != null)
                    {
                        microHamPort = _comport;
                    }
                }

                if (microHamPort != null)
                {
                    // Initialize temporary stereo mode to DXLog's stereo mode to support temporary toggle
                    // At start up, radio 1 is always focused and stereo audio is forced
                    main.SetListenStatusMode(COMMain.ListenMode.R1R2, true, false);
                    tempStereoToggle = false;
                    lastFocusedRadio = 1;

                    main.ContestDataProvider.FocusedRadioChanged += new ContestData.FocusedRadioChange(HandleFocusChange);

                    // Only initialize radio if present and ICOM
                    if (radio1 != null)
                    {
                        if (radio1.IsICOM())
                        {
                            // Initialize radio to DW off, Split off and Main VFO focused
                            radio1.SendCustomCommand(IcomDualWatchOn);
                            radio1.SendCustomCommand(IcomSelectMain);
                            radio1.SendCustomCommand(IcomSplitOff);
                        }
                    }
                }
                else
                {
                    main.COMMainProvider.SignalMessage("ICOM_SO2V: ERROR no Microham device");
                }
            }
        }
예제 #5
0
        public void Initialize(FrmMain main)
        {
            CATCommon radio1 = main.COMMainProvider.RadioObject(1);

            cdata     = main.ContestDataProvider;
            mainForm  = main;
            lastFocus = 1;

            if ((radio1 != null) && (mainForm._cwKeyer != null))
            {
                if (radio1.IsICOM())
                {
                    // Subscribe to CW speed change event
                    mainForm._cwKeyer.CWSpeedChange += new CWKey.CWSpeedChangeDelegate(HandleCWSpeedChange);
                    // Subscribe to radio focus change event
                    cdata.FocusedRadioChanged += new ContestData.FocusedRadioChange(HandleFocusChange);
                }
            }
        }
예제 #6
0
        // Toggle permanent dual watch, execution of Main is mapped to same key as built-in toggle Ctrl-Alt-S = AltGr-S.
        public void Main(FrmMain main, ContestData cdata, COMMain comMain)
        {
            CATCommon radio1        = comMain.RadioObject(1);
            int       focusedRadio  = cdata.FocusedRadio;
            bool      stereoAudio   = main.ListenStatusMode == COMMain.ListenMode.R1R2;
            bool      modeIsSo2V    = cdata.OPTechnique == ContestData.Technique.SO2V;
            bool      radio1Present = radio1 != null;

            main.SetMainStatusText("Sub receiver " + (stereoAudio ? "not " : "") + "permanently on.");

            if (focusedRadio == 1 && radio1Present && modeIsSo2V)
            {
                if (radio1.IsICOM())
                {
                    radio1.SendCustomCommand(stereoAudio ? IcomDualWatchOff : IcomDualWatchOn);
                }
            }

            // Also execute the normal operation of the key
            main.ScriptContinue = true;
        }
예제 #7
0
        private void SetIcomFilter(int filter)
        {
            byte[] IcomSetModeFilter = { 0x26, 0x00, 0x00, 0x00, 0x00 };
            byte[] IcomDisableAPF    = { 0x16, 0x32, 0x00 };

            bool      modeIsSO2V = cdata.OPTechnique == ContestData.Technique.SO2V;
            int       focusedRadio = cdata.FocusedRadio;
            int       physicalRadio = modeIsSO2V ? 1 : focusedRadio;
            CATCommon radio = mainForm.COMMainProvider.RadioObject(physicalRadio);
            int       vfo, mode = 0;

            if ((radio == null) || (!radio.IsICOM()))
            {
                return;
            }

            vfo = ((focusedRadio == 2) && modeIsSO2V) ? 0x01 : 0x00;

            // Only works for modes listed below
            switch ((vfo == 0) ? radio.VFOAMode : radio.VFOBMode)
            {
            case "LSB":
                mode = 0x00;
                break;

            case "USB":
                mode = 0x01;
                break;

            case "AM":
                mode = 0x02;
                break;

            case "CW":
                mode = 0x03;
                break;

            case "RTTY":
                mode = 0x04;
                break;

            case "FM":
                mode = 0x05;
                break;
            }

            IcomSetModeFilter[1] = (byte)vfo;
            IcomSetModeFilter[2] = (byte)mode;
            IcomSetModeFilter[4] = (byte)filter;

            radio.SendCustomCommand(IcomDisableAPF);
            radio.SendCustomCommand(IcomSetModeFilter);

            if (Debug)
            {
                mainForm.SetMainStatusText(String.Format("IcomFilter: VFO {0} changed to FIL{1}. Command: [{2}]. ",
                                                         (vfo == 0) ? "A" : "B", filter, BitConverter.ToString(IcomSetModeFilter)));
            }
            else
            {
                mainForm.SetMainStatusText(String.Format("VFO {0} changed to FIL{1}.",
                                                         (vfo == 0) ? "A" : "B", filter));
            }
        }
예제 #8
0
        private void SetIcomFilter(int filter, FrmMain main)
        {
            byte mode;
            bool modeIsSO2V   = main.ContestDataProvider.OPTechnique == ContestData.Technique.SO2V;
            int  focusedRadio = main.ContestDataProvider.FocusedRadio;

            // Physical radio is #1 in SO2V, otherwised the focused radio
            int       physicalRadio = modeIsSO2V ? 1 : focusedRadio;
            CATCommon radio         = main.COMMainProvider.RadioObject(physicalRadio);

            // Act on currently selected VFO. In SO2V, the selected "radio" defines which VFO
            byte vfo = (byte)(((focusedRadio == 2) && modeIsSO2V) ? 0x01 : 0x00);

            // If there is no radio or if it is not ICOM, do nothing
            if (radio == null || !radio.IsICOM())
            {
                return;
            }

            // The set filter CAT command requires mode information
            // Exits and does nothing if current mode is not supported
            switch ((vfo == 0) ? radio.VFOAMode : radio.VFOBMode)
            {
            case "LSB":
                mode = 0x00;
                break;

            case "USB":
                mode = 0x01;
                break;

            case "AM":
                mode = 0x02;
                break;

            case "CW":
                mode = 0x03;
                break;

            case "RTTY":
                mode = 0x04;
                break;

            case "FM":
                mode = 0x05;
                break;

            default:
                return;
            }

            // Always disable APF when switching filter
            byte[] IcomDisableAPF = { 0x16, 0x32, 0x00 };
            radio.SendCustomCommand(IcomDisableAPF);

            // Switch filter
            byte[] IcomSetModeFilter = { 0x26, vfo, mode, 0x00, (byte)filter };
            radio.SendCustomCommand(IcomSetModeFilter);

            if (Debug)
            {
                main.SetMainStatusText(String.Format("IcomFilter: VFO {0} changed to FIL{1}. CI-V command: [{2}]. ",
                                                     (vfo == 0) ? "A" : "B", filter, BitConverter.ToString(IcomSetModeFilter)));
            }
            else
            {
                main.SetMainStatusText(String.Format("VFO {0} changed to FIL{1}.",
                                                     (vfo == 0) ? "A" : "B", filter));
            }
        }