[DXLog.net - Support] New Scripts for K3 S02V support

Oliver Grossmann olli at bretzi.de
Mon Jan 4 20:56:09 CET 2016


Now with attached files as *.txt file, *.cs files are filtered.

Olli, DH2WQ

------------------------------------------------------------------------
Oliver Grossmann | DH2WQ | oliver.grossmann at bretzi.de
Hi,

happy new year to all.

I wrote 3 scripts for K3 Audio switching for SO2V Operation.
please refer to attached files.

K3_ListenBothVFO.cs will switch K3 to listen Main RX on Right and Sub RX 
on left stereo channel.

K3_ListenPrimaryVFO.cs will switch Main VFO to both stereo channels.

K3_ListenSecondaryVFO.cs will switch Sub VFO to both Stereo channels.

I also worked on a VFO switching for SO2V Mode on the K3 with limited 
success.

I was able to add TX on 2nd RX by setting cdata.UseSPLITTInSO2V = true;
but this works only on the same band due to the fact the K3 can't 
transmit on 2nd VFO if both VFOs are on the same band.

I'm now looking for a possibility to swap VFOs on K3 by focusing on 
Radio 2 Entry over all bands. Therefore it is necessary to link VFO to 
R2 focus.

I would handle the cdata.RadioTCStatusChanged event in such a manner:

// (Only pseudo code and handling of first start etc has to be added) //

If (cdata.FocusedRadio == 1)
{
     double copyVFOAFreq = VFOAFreq;
     double copyVFOBFreq = VFOBFreq;

     setVFOAFreq(copyVFOBFreq);
     setVFOBFreq(copyVFOAFreq);

     LinkVFOA(Radio_1);
}
else if (cdata.FocusedRadio == 2)
{
     double copyVFOAFreq = VFOAFreq;
     double copyVFOBFreq = VFOBFreq;

     setVFOAFreq(copyVFOBFreq);
     setVFOBFreq(copyVFOAFreq);

     LinkVFOA(Radio_2);
}

My Problem is LinkVFOA();
Can I somehow redirect the CAT objects like frequencies or is it 
necessary to manipulate?

Thanks
Olli, DH2WQ

-- 
------------------------------------------------------------------------
Oliver Grossmann | DH2WQ | oliver.grossmann at bretzi.de


-------------- next part --------------
//INCLUDE_ASSEMBLY System.dll
//INCLUDE_ASSEMBLY System.Windows.Forms.dll

using System;
using System.Windows.Forms;


namespace DXLog.net
{
    public class ListenBothVFO : ScriptClass
    {
        FrmMain frmMain;
        ContestData cdata;

        int VFOAVolume;
        int VFOBVolume;

        public void Initialize(FrmMain main)
        {
            frmMain = main;
            frmMain.COMMainProvider.RadioObject(1).RadioCommandStringReceived += new CATCommon.RadioCommandStringRec(HandleCATReceiveString);

            VFOAVolume = 0;
            VFOBVolume = 0;

            CATCommon radioObject = frmMain.COMMainProvider.RadioObject(1);

            if (radioObject == null)
            {
                frmMain.SetMainStatusText(String.Format("CAT object for radio {0} isn't available!", cdata.ActiveRadio));
                return;
            }
            radioObject.SendCustomCommand("AG;");
            radioObject.SendCustomCommand("AG$;");
        }

        public void Deinitialize()
        {
            frmMain.COMMainProvider.RadioObject(1).RadioCommandStringReceived -= HandleCATReceiveString;
        }

        public void Main(FrmMain frmMain, ContestData cdata, COMMain comMain)
        {
            CATCommon radioObject = frmMain.COMMainProvider.RadioObject(1);

            if (radioObject == null)
            {
                frmMain.SetMainStatusText(String.Format("CAT object for radio {0} isn't available!", cdata.ActiveRadio));
                return;
            }

            radioObject.SendCustomCommand("MN111;");
            radioObject.SendCustomCommand("MP000;");
            radioObject.SendCustomCommand("MN255;");
            radioObject.SendCustomCommand(String.Format("AG{0};", VFOAVolume.ToString("000")));
            radioObject.SendCustomCommand(String.Format("AG${0};", VFOBVolume.ToString("000")));
        }

        public void HandleCATReceiveString(int radio, string strCommand)
        {
            if (strCommand.StartsWith("AG$"))
            {
                if (!strCommand.Substring(3, 3).Equals("000"))
                {
                    VFOBVolume = int.Parse(strCommand.Substring(3, 3));
                }
            }
            else if (strCommand.StartsWith("AG"))
            {
                if (!strCommand.Substring(3, 3).Equals("000"))
                {
                    VFOAVolume = int.Parse(strCommand.Substring(2, 3));
                }
            }
        }
    }
}


-------------- next part --------------
//INCLUDE_ASSEMBLY System.dll
//INCLUDE_ASSEMBLY System.Windows.Forms.dll

using System;
using System.Windows.Forms;


namespace DXLog.net
{
    public class ListenPrimaryVFO : ScriptClass
    {
        FrmMain frmMain;
        ContestData cdata;

        int VFOAVolume;
        int VFOBVolume;

        public void Initialize(FrmMain main)
        {
            frmMain = main;
            frmMain.COMMainProvider.RadioObject(1).RadioCommandStringReceived += new CATCommon.RadioCommandStringRec(HandleCATReceiveString);

            VFOAVolume = 0;
            VFOBVolume = 0;

            CATCommon radioObject = frmMain.COMMainProvider.RadioObject(1);

            if (radioObject == null)
            {
                frmMain.SetMainStatusText(String.Format("CAT object for radio {0} isn't available!", cdata.ActiveRadio));
                return;
            }
            radioObject.SendCustomCommand("AG;");
            radioObject.SendCustomCommand("AG$;");
        }

        public void Deinitialize()
        {
            frmMain.COMMainProvider.RadioObject(1).RadioCommandStringReceived -= HandleCATReceiveString;
        }

        public void Main(FrmMain frmMain, ContestData cdata, COMMain comMain)
        {
            CATCommon radioObject = frmMain.COMMainProvider.RadioObject(1);

            if (radioObject == null)
            {
                frmMain.SetMainStatusText(String.Format("CAT object for radio {0} isn't available!", cdata.ActiveRadio));
                return;
            }
            radioObject.SendCustomCommand("MN111;");
            radioObject.SendCustomCommand("MP003;");
            radioObject.SendCustomCommand("MN255;");

            switch (cdata.FocusedRadio)
            {    
                case 1:
                    radioObject.SendCustomCommand("AG$;");
                    radioObject.SendCustomCommand("AG$000;");
                    radioObject.SendCustomCommand(String.Format("AG{0};", VFOAVolume.ToString("000")));
                    break;
                case 2:
                    radioObject.SendCustomCommand("AG;");
                    radioObject.SendCustomCommand("AG000;");
                    radioObject.SendCustomCommand(String.Format("AG${0};", VFOBVolume.ToString("000")));
                    break;
                default:
                    frmMain.SetMainStatusText("error");
                    break;
            }
        }

        public void HandleCATReceiveString(int radio, string strCommand)
        {
            if (strCommand.StartsWith("AG$"))
            {
                if (!strCommand.Substring(3, 3).Equals("000"))
                {
                    VFOBVolume = int.Parse(strCommand.Substring(3, 3));
                }
            }
            else if (strCommand.StartsWith("AG"))
            {
                if (!strCommand.Substring(3, 3).Equals("000"))
                {
                    VFOAVolume = int.Parse(strCommand.Substring(2, 3));
                }
            }
        }
    }
}


-------------- next part --------------
//INCLUDE_ASSEMBLY System.dll
//INCLUDE_ASSEMBLY System.Windows.Forms.dll

using System;
using System.Windows.Forms;


namespace DXLog.net
{
    public class ListenSecondaryVFO : ScriptClass
    {
        FrmMain frmMain;
        ContestData cdata;

        int VFOAVolume;
        int VFOBVolume;

        public void Initialize(FrmMain main)
        {
            frmMain = main;
            frmMain.COMMainProvider.RadioObject(1).RadioCommandStringReceived += new CATCommon.RadioCommandStringRec(HandleCATReceiveString);

            VFOAVolume = 0;
            VFOBVolume = 0;

            CATCommon radioObject = frmMain.COMMainProvider.RadioObject(1);

            if (radioObject == null)
            {
                frmMain.SetMainStatusText(String.Format("CAT object for radio {0} isn't available!", cdata.ActiveRadio));
                return;
            }
            radioObject.SendCustomCommand("AG;");
            radioObject.SendCustomCommand("AG$;");
        }

        public void Deinitialize()
        {
            frmMain.COMMainProvider.RadioObject(1).RadioCommandStringReceived -= HandleCATReceiveString;
        }

        public void Main(FrmMain frmMain, ContestData cdata, COMMain comMain)
        {
            CATCommon radioObject = frmMain.COMMainProvider.RadioObject(1);

            if (radioObject == null)
            {
                frmMain.SetMainStatusText(String.Format("CAT object for radio {0} isn't available!", cdata.ActiveRadio));
                return;
            }

            radioObject.SendCustomCommand("MN111;");
            radioObject.SendCustomCommand("MP003;");
            radioObject.SendCustomCommand("MN255;");

            switch (cdata.FocusedRadio)
            {
                case 1:
                    radioObject.SendCustomCommand("AG;");
                    radioObject.SendCustomCommand("AG000;");
                    radioObject.SendCustomCommand(String.Format("AG${0};", VFOBVolume.ToString("000")));

                    break;
                case 2:
                    radioObject.SendCustomCommand("AG$;");
                    radioObject.SendCustomCommand("AG$000;");
                    radioObject.SendCustomCommand(String.Format("AG{0};", VFOAVolume.ToString("000")));
                    break;
                default:
                    frmMain.SetMainStatusText("error");
                    break;
            }
        }

        public void HandleCATReceiveString(int radio, string strCommand)
        {
            if (strCommand.StartsWith("AG$"))
            {
                if (!strCommand.Substring(3, 3).Equals("000"))
                {
                    VFOBVolume = int.Parse(strCommand.Substring(3, 3));
                }
            }
            else if (strCommand.StartsWith("AG"))
            {
                if (!strCommand.Substring(3, 3).Equals("000"))
                {
                    VFOAVolume = int.Parse(strCommand.Substring(2, 3));
                }
            }
        }
    }
}




More information about the Support mailing list