コード例 #1
0
ファイル: ModemTest.cs プロジェクト: Denborodin/Terminal
 void ModemLogUpdate(string str)
 {
     ModemLog.AppendText(DateTime.Now.ToString() + " " + str + Environment.NewLine);
 }
コード例 #2
0
ファイル: ModemTest.cs プロジェクト: Denborodin/Terminal
        private void Satel_SetSettings()
        {
            string command = null;

            if (ModemPortComboBox.Text != "Direct")
            {
                SendData("%%dm,dev/modem/a");
                CurrentPort[9].DiscardInBuffer();
                DChain();
            }
            //Configuring:

            //Setting Spacing
            ModemLog.AppendText(DateTime.Now.ToString() + " " + "Setting spacing: " + SatelSpacingCombobox.Text + Environment.NewLine);
            for (int i = 0; i < 3; i++)
            {
                string response = SendData("SL%D?");
                if (response != null)
                {
                    ModemLog.AppendText(DateTime.Now.ToString() + " " + "Modem model: " + response.Trim() + Environment.NewLine);
                    break;
                }
            }

            switch (SatelSpacingCombobox.SelectedIndex)
            {
            case 0:
                command = "SL&W=1250";
                break;

            case 1:
                command = "SL&W=2500";
                break;

            default:
                break;
            }

            for (int i = 0; i < 3; i++)
            {
                string response = SendData(command);
                if (response != null && response.Trim() == "OK")
                {
                    ModemLog.AppendText(DateTime.Now.ToString() + " " + "Spacing set succesfully: " + response.Trim() + Environment.NewLine);
                    break;
                }
                ModemLog.AppendText(DateTime.Now.ToString() + " " + "Spacing setting failed, retrying: " + response + Environment.NewLine);
            }


            //Setting protocol
            ModemLog.AppendText(DateTime.Now.ToString() + " " + "Setting radio protocol: " + SatelModeCombobox.Text + Environment.NewLine);
            switch (SatelModeCombobox.SelectedIndex)
            {
            case 0:
                command = "SL@S=0";
                break;

            case 1:
                command = "SL@S=1";
                break;

            case 2:
                command = "SL@S=2";
                break;

            case 3:
                command = "SL@S=3";
                break;

            case 4:
                command = "SL@S=4";
                break;

            default:
                break;
            }

            for (int i = 0; i < 3; i++)
            {
                string response = SendData(command);
                if (response != null && response.Trim() == "OK")
                {
                    ModemLog.AppendText(DateTime.Now.ToString() + " " + "Radio protocol set succesfully: " + response.Trim() + Environment.NewLine);
                    break;
                }
                ModemLog.AppendText(DateTime.Now.ToString() + " " + "Radio protocol setting failed, retrying: " + response + Environment.NewLine);
            }


            //Setting FEC
            ModemLog.AppendText(DateTime.Now.ToString() + " " + "Setting FEC: " + SatelFECComboBox.Text + Environment.NewLine);
            switch (SatelFECComboBox.SelectedIndex)
            {
            case 0:
                command = "SL%F=1";
                break;

            case 1:
                command = "SL%F=0";
                break;

            default:
                break;
            }

            for (int i = 0; i < 3; i++)
            {
                string response = SendData(command);
                if (response != null && response.Trim() == "OK")
                {
                    ModemLog.AppendText(DateTime.Now.ToString() + " " + "FEC set succesfully: " + response.Trim() + Environment.NewLine);
                    break;
                }
                ModemLog.AppendText(DateTime.Now.ToString() + " " + "FEC setting failed, retrying: " + response + Environment.NewLine);
            }


            //Setting Power
            ModemLog.AppendText(DateTime.Now.ToString() + " " + "Setting Transmit power: " + SatelPowercomboBox1.Text + Environment.NewLine);
            command = "SL@P=" + SatelPowercomboBox1.Text;

            for (int i = 0; i < 3; i++)
            {
                string response = SendData(command);
                if (response != null && response.Trim() == "OK")
                {
                    ModemLog.AppendText(DateTime.Now.ToString() + " " + "Power set succesfully: " + response.Trim() + Environment.NewLine);
                    break;
                }
                ModemLog.AppendText(DateTime.Now.ToString() + " " + "Power setting failed, retrying: " + response + Environment.NewLine);
            }


            //Setting Frequency
            command = "SL&F=";
            command = command + SatelFreqTxtbox.Text;
            ModemLog.AppendText(DateTime.Now.ToString() + " " + "Setting Frequency: " + SatelFreqTxtbox.Text + Environment.NewLine);

            for (int i = 0; i < 3; i++)
            {
                string response = SendData(command);
                if (response != null && response.Trim() == "OK")
                {
                    ModemLog.AppendText(DateTime.Now.ToString() + " " + "Frequency set succesfully: " + response.Trim() + Environment.NewLine);
                    break;
                }
                ModemLog.AppendText(DateTime.Now.ToString() + " " + "Frequency setting failed, retrying: " + response + Environment.NewLine);
            }


            if (ModemPortComboBox.Text != "Direct")
            {
                DChainOff();
            }
        }
コード例 #3
0
ファイル: ModemTest.cs プロジェクト: Denborodin/Terminal
        private void Satel_GetSettings()
        {
            if (ModemPortComboBox.Text != "Direct")
            {
                SendData("dm,dev/modem/a");
                CurrentPort[9].DiscardInBuffer();
                DChain();
            }

            string response = null;


            //Quering spacing
            ModemLog.AppendText(DateTime.Now.ToString() + " " + "Quering spacing " + Environment.NewLine);

            for (int i = 0; i < 3; i++)
            {
                response = SendData("SL&W?");
                if (response != null)
                {
                    ModemLog.AppendText(DateTime.Now.ToString() + " " + "Quering spacing succesfully: " + response.Trim() + Environment.NewLine);
                    switch (response.Trim())
                    {
                    case "12.5 kHz":
                        SatelSpacingCombobox.SelectedIndex = 0;
                        ModemLog.AppendText(DateTime.Now.ToString() + " " + "Spacing is set to " + response + Environment.NewLine);
                        break;

                    case "25.0 kHz":
                        SatelSpacingCombobox.SelectedIndex = 1;
                        ModemLog.AppendText(DateTime.Now.ToString() + " " + "FEC is set to " + response + Environment.NewLine);
                        break;

                    default:
                        ModemLog.AppendText(DateTime.Now.ToString() + " " + "FEC response not recognized" + response + Environment.NewLine);
                        break;
                    }
                    break;
                }
                ModemLog.AppendText(DateTime.Now.ToString() + " " + "Quering spacing failed, retrying: " + response + Environment.NewLine);
            }



            //Quering Frequency
            ModemLog.AppendText(DateTime.Now.ToString() + " " + "Quering Frequency " + Environment.NewLine);
            for (int i = 0; i < 3; i++)
            {
                response = SendData("SL&F?");
                if (response != null)
                {
                    ModemLog.AppendText(DateTime.Now.ToString() + " " + "Quering Frequency succesfully: " + response.Trim() + Environment.NewLine);
                    string[] parts = response.Trim().Split(' ');
                    if (double.TryParse(parts[2], out double freq))
                    {
                        SatelFreqTxtbox.Text = freq.ToString("F4");
                        ModemLog.AppendText(DateTime.Now.ToString() + " " + "Frequency is set to: " + parts[1] + Environment.NewLine);
                    }
                    else
                    {
                        ModemLog.AppendText(DateTime.Now.ToString() + " " + "Frequency response not recognized: " + parts[1] + Environment.NewLine);
                    }
                    break;
                }
                ModemLog.AppendText(DateTime.Now.ToString() + " " + "Quering Frequency failed, retrying: " + response + Environment.NewLine);
            }



            //Quering Protocol
            ModemLog.AppendText(DateTime.Now.ToString() + " " + "Quering Protocol " + Environment.NewLine);
            for (int i = 0; i < 3; i++)
            {
                response = SendData("SL@S?");
                if (response != null)
                {
                    ModemLog.AppendText(DateTime.Now.ToString() + " " + "Quering Protocol succesfully: " + response.Trim() + Environment.NewLine);
                    switch (response)
                    {
                    case "0":
                        SatelModeCombobox.SelectedIndex = 0;
                        ModemLog.AppendText(DateTime.Now.ToString() + " " + "Protocol is set to Satel3AS" + Environment.NewLine);
                        break;

                    case "1":
                        SatelModeCombobox.SelectedIndex = 1;
                        ModemLog.AppendText(DateTime.Now.ToString() + " " + "Protocol is set to PacCrest 4FSK" + Environment.NewLine);
                        break;

                    case "2":
                        SatelModeCombobox.SelectedIndex = 2;
                        ModemLog.AppendText(DateTime.Now.ToString() + " " + "Protocol is set to PacCrest GMSK" + Environment.NewLine);
                        break;

                    case "3":
                        SatelModeCombobox.SelectedIndex = 3;
                        ModemLog.AppendText(DateTime.Now.ToString() + " " + "Protocol is set to TrimTalk" + Environment.NewLine);
                        break;

                    case "4":
                        SatelModeCombobox.SelectedIndex = 4;
                        ModemLog.AppendText(DateTime.Now.ToString() + " " + "Protocol is set to TrimTalk Trimble" + Environment.NewLine);
                        break;

                    default:
                        ModemLog.AppendText(DateTime.Now.ToString() + " " + "Protocol response not recognized" + response + Environment.NewLine);
                        break;
                    }
                    break;
                }
                ModemLog.AppendText(DateTime.Now.ToString() + " " + "Quering Protocol failed, retrying: " + response + Environment.NewLine);
            }



            //Quering Power
            ModemLog.AppendText(DateTime.Now.ToString() + " " + "Quering Power " + Environment.NewLine);

            for (int i = 0; i < 3; i++)
            {
                response = SendData("SL@P?");
                if (response != null)
                {
                    ModemLog.AppendText(DateTime.Now.ToString() + " " + "Quering Power succesfully: " + response.Trim() + Environment.NewLine);
                    switch (response.Trim())
                    {
                    case "10 mW":
                        SatelPowercomboBox1.SelectedIndex = 0;
                        ModemLog.AppendText(DateTime.Now.ToString() + " " + "Power is set to " + response + Environment.NewLine);
                        break;

                    case "20 mW":
                        SatelPowercomboBox1.SelectedIndex = 1;
                        ModemLog.AppendText(DateTime.Now.ToString() + " " + "Power is set to " + response + Environment.NewLine);
                        break;

                    case "50 mW":
                        SatelPowercomboBox1.SelectedIndex = 2;
                        ModemLog.AppendText(DateTime.Now.ToString() + " " + "Power is set to " + response + Environment.NewLine);
                        break;

                    case "100 mW":
                        SatelPowercomboBox1.SelectedIndex = 3;
                        ModemLog.AppendText(DateTime.Now.ToString() + " " + "Power is set to " + response + Environment.NewLine);
                        break;

                    case "200 mW":
                        SatelPowercomboBox1.SelectedIndex = 4;
                        ModemLog.AppendText(DateTime.Now.ToString() + " " + "Power is set to " + response + Environment.NewLine);
                        break;

                    case "500 mW":
                        SatelPowercomboBox1.SelectedIndex = 5;
                        ModemLog.AppendText(DateTime.Now.ToString() + " " + "Power is set to " + response + Environment.NewLine);
                        break;

                    case "1000 mW":
                        SatelPowercomboBox1.SelectedIndex = 6;
                        ModemLog.AppendText(DateTime.Now.ToString() + " " + "Power is set to " + response + Environment.NewLine);
                        break;

                    default:
                        ModemLog.AppendText(DateTime.Now.ToString() + " " + "Power response not recognized: " + response + Environment.NewLine);
                        break;
                    }

                    break;
                }
                ModemLog.AppendText(DateTime.Now.ToString() + " " + "Quering Power failed, retrying: " + response + Environment.NewLine);
            }



            //Quering FEC
            for (int i = 0; i < 3; i++)
            {
                response = SendData("SL%F?");
                if (response != null)
                {
                    ModemLog.AppendText(DateTime.Now.ToString() + " " + "Quering Power succesfully: " + response.Trim() + Environment.NewLine);
                    switch (response.Trim())
                    {
                    case "0":
                        SatelFECComboBox.SelectedIndex = 1;
                        ModemLog.AppendText(DateTime.Now.ToString() + " " + "FEC is set to OFF" + Environment.NewLine);
                        break;

                    case "1":
                        SatelFECComboBox.SelectedIndex = 0;
                        ModemLog.AppendText(DateTime.Now.ToString() + " " + "FEC is set to ON" + Environment.NewLine);
                        break;

                    default:
                        ModemLog.AppendText(DateTime.Now.ToString() + " " + "FEC response not recognized" + response + Environment.NewLine);
                        break;
                    }
                    break;
                }
                ModemLog.AppendText(DateTime.Now.ToString() + " " + "Quering Power failed, retrying: " + response + Environment.NewLine);
            }



            if (ModemPortComboBox.Text != "Direct")
            {
                DChainOff();
            }
        }
コード例 #4
0
ファイル: ModemTest.cs プロジェクト: Denborodin/Terminal
        public void ModemConnect()
        {
            if (ModemPortComboBox.Text != "Direct")
            {
                SendData("dm,dev/modem/a");
                CurrentPort[9].DiscardInBuffer();
                SendData("dm,dev/ser/a");
                CurrentPort[9].DiscardInBuffer();
                DChain();
            }
            switch (ModemType)
            {
            case "Satel":
                //modem info request:
                for (int i = 0; i < 3; i++)
                {
                    string response = SendData("SL%D?");
                    if (response != null)
                    {
                        ModemLog.AppendText(DateTime.Now.ToString() + " " + "Modem model: " + response.Trim() + Environment.NewLine);
                        break;
                    }
                }

                for (int i = 0; i < 3; i++)
                {
                    string response = SendData("SL%H?");
                    if (response != null)
                    {
                        ModemLog.AppendText(DateTime.Now.ToString() + " " + "Modem HW: " + response.Trim() + Environment.NewLine);
                        break;
                    }
                }

                for (int i = 0; i < 3; i++)
                {
                    string response = SendData("SL%S?");
                    if (response != null)
                    {
                        ModemLog.AppendText(DateTime.Now.ToString() + " " + "Modem serial: " + response.Trim() + Environment.NewLine);
                        break;
                    }
                }

                for (int i = 0; i < 3; i++)
                {
                    string response = SendData("SL%V?");
                    if (response != null)
                    {
                        ModemLog.AppendText(DateTime.Now.ToString() + " " + "Modem FW version: " + response.Trim() + Environment.NewLine);
                        break;
                    }
                }
                break;

            default:
                break;
            }
            if (ModemPortComboBox.Text != "Direct")
            {
                DChainOff();
            }
            ModemStartBtn.Enabled    = true;
            SatelSettingsGet.Enabled = true;
            SatelSettingsSet.Enabled = true;
        }