Exemple #1
0
        private void SqlLogin_Load(object sender, EventArgs e)
        {
            cB_sqlServerType.SelectedIndex = 0;
            tB_Tester.Text      = IniFile.GetString("sqlinfo", "operator", "test", Application.StartupPath + "\\SqlInfo.ini");
            tB_sqladdr.Text     = IniFile.GetString("sqlinfo", "sqladdr", "0.0.0.0", Application.StartupPath + "\\SqlInfo.ini");
            tB_sqldatabase.Text = IniFile.GetString("sqlinfo", "sqlname", "pim-datebase", Application.StartupPath + "\\SqlInfo.ini");
            tB_sqluser.Text     = IniFile.GetString("sqlinfo", "sqluser", "sa", Application.StartupPath + "\\SqlInfo.ini");

            if (IniFile.GetString("sqlinfo", "deson", "0", Application.StartupPath + "\\SqlInfo.ini") == "1")
            {
                checkBox1.Checked = true;
                string str_sql = IniFile.GetString("sqlinfo", "sqlpw", "123", Application.StartupPath + "\\SqlInfo.ini");
                str_sql = DecryptDES(str_sql);
                if (str_sql != "Error")
                {
                    tB_sqlpassward.Text = str_sql;
                }

                string str_ftp = IniFile.GetString("sqlinfo", "ftppw", "123", Application.StartupPath + "\\SqlInfo.ini");
                str_ftp = DecryptDES(str_ftp);
                if (str_ftp != "Error")
                {
                    tB_ftppw.Text = str_ftp;
                }
            }

            tB_ftpaddr.Text = IniFile.GetString("sqlinfo", "ftpaddr", "0.0.0.0:21", Application.StartupPath + "\\SqlInfo.ini");
            tB_ftpuser.Text = IniFile.GetString("sqlinfo", "ftpuser", "san", Application.StartupPath + "\\SqlInfo.ini");
        }
        void SaveScript()
        {
            string strPath = Application.StartupPath + "\\settings\\JcScript.ini";
            //清空
            int count = int.Parse(IniFile.GetString("Script", "count", "0", strPath));

            for (int i = 1; i <= count; i++)
            {
                IniFile.SetString("Script", "N" + i.ToString(), "", strPath);
            }
            //开始SAVE
            int n = m_listScript.Count;

            IniFile.SetString("Script", "count", (n - 1).ToString(), strPath);
            for (int i = 1; i < n; i++)
            {//列表序号0为默认配置,不保存
                string strValue = m_listScript[i].settings.projectName + "," +
                                  ((int)m_listScript[i].settings.SweepType).ToString() + "," +
                                  ((int)m_listScript[i].settings.PimSchema).ToString() + "," +
                                  ((int)m_listScript[i].settings.PimOrder).ToString() + "," +
                                  m_listScript[i].settings.F1s.ToString() + "," +
                                  m_listScript[i].settings.F1e.ToString() + "," +
                                  m_listScript[i].settings.F2s.ToString() + "," +
                                  m_listScript[i].settings.F2e.ToString() + "," +
                                  m_listScript[i].settings.Setp1.ToString() + "," +
                                  m_listScript[i].settings.TimeSweepPoints.ToString() + "," +
                                  m_listScript[i].settings.Tx;
                IniFile.SetString("Script", "N" + i.ToString(), strValue, strPath);
            }
        }
Exemple #3
0
        internal void LoadSettings()
        {
            IniFile.SetFileName(fileName);

            channel        = int.Parse(IniFile.GetString("spectrum", "channel", "0"));
            enableOffset   = int.Parse(IniFile.GetString("spectrum", "enableOffset", "1"));
            offsetFilePath = IniFile.GetString("spectrum", "offsetFilePath", "");

            att = int.Parse(IniFile.GetString("spectrum", "att", "0"));
            rbw = int.Parse(IniFile.GetString("spectrum", "rbw", "4"));
            vbw = int.Parse(IniFile.GetString("spectrum", "vbw", "4"));

            start = float.Parse(IniFile.GetString("spectrum", "start", "800"));
            stop  = float.Parse(IniFile.GetString("spectrum", "stop", "900"));

            min_freq = float.Parse(IniFile.GetString("spectrum", "min_freq", "0.1"));
            max_freq = float.Parse(IniFile.GetString("spectrum", "max_freq", "3000"));

            min_aph = float.Parse(IniFile.GetString("spectrum", "min_aph", "-30"));
            max_aph = float.Parse(IniFile.GetString("spectrum", "max_aph", "-130"));

            rev          = float.Parse(IniFile.GetString("spectrum", "rev", "0"));
            enableRF     = int.Parse(IniFile.GetString("spectrum", "enableRF", "0"));
            timeRF       = int.Parse(IniFile.GetString("spectrum", "timeRF", "200"));
            sampleSpan   = int.Parse(IniFile.GetString("spectrum", "sampleSpan", "200"));
            averageCount = int.Parse(IniFile.GetString("spectrum", "averagecount", "5"));
            rxRef        = float.Parse(IniFile.GetString("spectrum", "rxRef", "0"));
            txRef        = float.Parse(IniFile.GetString("spectrum", "txRef", "0"));
            List_txRef   = IniFile.GetString("spectrum", "txRefTable", "0,0,0,0,0,0,0,0").Split(',');
            List_rxRef   = IniFile.GetString("spectrum", "rxRefTable", "0,0,0,0,0,0,0,0").Split(',');
        }
Exemple #4
0
        internal void LoadSettings()
        {
            string s1 = "";
            string s2 = "";

            IniFile.SetFileName(fileName);

            s1 = IniFile.GetString(sectionName, "tx_p", "");
            s2 = IniFile.GetString(sectionName, "tx_f", "");

            if (String.IsNullOrEmpty(s1) || String.IsNullOrEmpty(s2))
            {
                return;
            }

            //校准表的行数目
            int N = IniFile.CountOfItemIn(s1);

            //校准表的列数目
            int M = IniFile.CountOfItemIn(s2);

            if ((N <= 0) || (M <= 0))
            {
                return;
            }

            rowHead.Parse(s2, M);

            colHead.Parse(s1, N);

            FillTable(N, M);
        }
        internal void LoadSettings()
        {
            IniFile.SetFileName(fileName);

            port       = IniFile.GetString(signalName, "port", "COM1");
            limit_vswr = float.Parse(IniFile.GetString(signalName, "limit_vswr", "2.0"));

            mode_power = int.Parse(IniFile.GetString(signalName, "mode_power", "0"));
            tx_pre     = float.Parse(IniFile.GetString(signalName, "tx_pre", "30"));
            tx         = float.Parse(IniFile.GetString(signalName, "tx", "43"));

            enableVswr = int.Parse(IniFile.GetString(signalName, "enableVswr", "1"));
            time_vswr  = int.Parse(IniFile.GetString(signalName, "time_vswr", "500"));

            min_power = float.Parse(IniFile.GetString(signalName, "min_power", "30"));
            max_power = float.Parse(IniFile.GetString(signalName, "max_power", "45"));

            min_freq = float.Parse(IniFile.GetString(signalName, "min_freq", "930"));
            max_freq = float.Parse(IniFile.GetString(signalName, "max_freq", "940"));

            min_temp = float.Parse(IniFile.GetString(signalName, "min_temp", "-10"));
            max_temp = float.Parse(IniFile.GetString(signalName, "max_temp", "65"));

            min_curr = float.Parse(IniFile.GetString(signalName, "min_curr", "0.5"));
            max_curr = float.Parse(IniFile.GetString(signalName, "max_curr", "2.5"));
        }
Exemple #6
0
        private void btnDefault_Click(object sender, EventArgs e)
        {
            //App_Settings.pim.Clone(this.settings);
            //GetPimValues();

            //ygq
            IniFile.SetFileName(Application.StartupPath + "\\settings\\Settings_Pim.ini");
            cbxPimMode.SelectedIndex = int.Parse(IniFile.GetString("pim", "mode", "0"));
            int order = int.Parse(IniFile.GetString("pim", "order", "0"));

            switch (order)
            {
            case 3:
                cbxPimOrder.SelectedIndex = 0; break;

            case 5:
                cbxPimOrder.SelectedIndex = 1; break;

            case 7:
                cbxPimOrder.SelectedIndex = 2; break;

            case 9:
                cbxPimOrder.SelectedIndex = 3; break;
            }
            cbxPimUnit.SelectedIndex = int.Parse(IniFile.GetString("pim", "unit", "0"));
            nudPimLimit.Value        = Convert.ToDecimal(IniFile.GetString("pim", "limit", "-110"));
            nudAtt.Value             = Convert.ToDecimal(IniFile.GetString("pim", "att_spc", "0"));
            nudTx.Value = Convert.ToDecimal(IniFile.GetString("pim", "tx", "43"));
            cbxPimSchema.SelectedIndex = int.Parse(IniFile.GetString("pim", "schema", "0"));
            //
        }
Exemple #7
0
 public static bool  ClientCom()
 {
     try
     {
         string addCom = IniFile.GetString("GPIO_Board", "addrCOm", "", Application.StartupPath + "\\Configures.ini");
         string addLan = IniFile.GetString("GPIO_Board", "addrLan", "", Application.StartupPath + "\\Configures.ini");
         cic = new com_io_ctl.com_io_ctl(Application.StartupPath + "\\io_mobi2_6.ini");
         //cic.OpenCom("COM" + App_Configure.Cnfgs.Comaddr_switch);
         if (addCom != "")
         {
             cic.OpenCom(addCom);
         }
         else if (addLan != "")
         {
             cic.TcpConnect(addLan, 4001);
         }
         else
         {
             cic.TcpConnect("192.168.1.178", 4001);
         }
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Exemple #8
0
        private void btnLoad_Click(object sender, EventArgs e)
        {
            //ReadSettingFiles rsfm = new ReadSettingFiles();

            //rsfm.FillFiles(App_Configure.Cnfgs.Path_Usr_Pim);

            //if (rsfm.ShowDialog() == DialogResult.OK)
            //{
            //    if (File.Exists(App_Configure.Cnfgs.Path_Usr_Pim + "\\" + rsfm.FileName))
            //    {
            //       // string File_Usr_Pim = rsfm.FileName;

            //        Settings_Pim pim = new Settings_Pim(App_Configure.Cnfgs.Path_Usr_Pim + "\\" +
            //                                            rsfm.FileName);

            //        pim.LoadSettings();

            //        pim.Clone(this.settings);

            //        GetPimValues();
            //    }
            //}

            //rsfm.Dispose();

            //ygq
            IniFile.SetFileName("D:\\settings\\Settings_Pim.ini");
            cbxPimMode.SelectedIndex = int.Parse(IniFile.GetString("pim", "mode", "0"));
            int order = int.Parse(IniFile.GetString("pim", "order", "0"));

            switch (order)
            {
            case 3:
                cbxPimOrder.SelectedIndex = 0; break;

            case 5:
                cbxPimOrder.SelectedIndex = 1; break;

            case 7:
                cbxPimOrder.SelectedIndex = 2; break;

            case 9:
                cbxPimOrder.SelectedIndex = 3; break;
            }
            cbxPimUnit.SelectedIndex = int.Parse(IniFile.GetString("pim", "unit", "0"));
            nudPimLimit.Value        = Convert.ToDecimal(IniFile.GetString("pim", "limit", "-110"));
            nudAtt.Value             = Convert.ToDecimal(IniFile.GetString("pim", "att_spc", "0"));
            nudTx.Value = Convert.ToDecimal(IniFile.GetString("pim", "tx", "43"));
            cbxPimSchema.SelectedIndex = int.Parse(IniFile.GetString("pim", "schema", "0"));
            //
        }
        /// <summary>
        /// 获取属性值
        /// </summary>
        internal void LoadSettings()
        {
            IniFile.SetFileName(fileName);


            ishigh = IniFile.GetString("pim", "ishigh", "0") == "1" ? true : false;
            //ishigh = false;

            tx  = float.Parse(IniFile.GetString("pim", "tx", "43.0"));
            tx2 = float.Parse(IniFile.GetString("pim", "tx", "43.0"));
            f1  = float.Parse(IniFile.GetString("pim", "f1", "935.0"));
            f2  = float.Parse(IniFile.GetString("pim", "f2", "960.0"));

            _f1s = App_Settings.spfc.ims[0].F1UpS;
            _f1e = App_Settings.spfc.ims[0].F1UpE;
            _f2s = App_Settings.spfc.ims[0].F2DnS;
            _f2e = App_Settings.spfc.ims[0].F2DnE;

            _setp1 = App_Settings.spfc.ims[0].F1Step;
            _setp2 = App_Settings.spfc.ims[0].F2Step;

            enableSquence = 0;

            schema = int.Parse(IniFile.GetString("pim", "schema", "0"));
            mode   = int.Parse(IniFile.GetString("pim", "mode", "0"));
            order  = int.Parse(IniFile.GetString("pim", "order", "3"));
            unit   = int.Parse(IniFile.GetString("pim", "unit", "1"));

            limit = float.Parse(IniFile.GetString("pim", "limit", "-165.0"));

            scanum1 = int.Parse(IniFile.GetString("pim", "scanum1", "20"));
            scanum2 = int.Parse(IniFile.GetString("pim", "scanum2", "20"));
            scanum3 = int.Parse(IniFile.GetString("pim", "scanum3", "10"));
            scanum4 = int.Parse(IniFile.GetString("pim", "scanum4", "1"));

            att_spc = int.Parse(IniFile.GetString("pim", "att_spc", "0"));
            rbw_spc = int.Parse(IniFile.GetString("pim", "rbw_spc", "4"));
            vbw_spc = int.Parse(IniFile.GetString("pim", "vbw_spc", "4"));

            scanband = float.Parse(IniFile.GetString("pim", "scanband", "0.05"));

            specDelay = int.Parse(IniFile.GetString("pim", "specDelay", "0"));
            tsDelay   = int.Parse(IniFile.GetString("pim", "tsDelay", "0"));
            fsDelay   = int.Parse(IniFile.GetString("pim", "fsDelay", "0"));
        }
        ///<summary>
        ///获取指定的时间扫描数据
        ///</summary>
        internal TimeSweepParam GetTimeSweepParam(Settings_Pim settings,
                                                  string filePath,
                                                  string gsm,
                                                  string mode,
                                                  int imOrder,
                                                  string cate,
                                                  float num)
        {
            TimeSweepParam tsp = new TimeSweepParam();

            IniFile.SetFileName(filePath);
            string name = GetName(gsm, mode, imOrder, cate);

            tsp.F1 = float.Parse(IniFile.GetString(name, "tx1", "935"));
            tsp.F2 = float.Parse(IniFile.GetString(name, "tx2", "960"));
            tsp.Rx = float.Parse(IniFile.GetString(name, "rx", "910"));
            if (App_Configure.Cnfgs.Cal_Use_Table)
            {
                //----------------------------------------

                tsp.P1 = (float)settings.Tx + Tx_Tables.pim_rev_tx1.Offset(tsp.F1, settings.Tx, Tx_Tables.pim_rev_offset1);
                tsp.P2 = (float)settings.Tx2 + Tx_Tables.pim_rev_tx2.Offset(tsp.F2, settings.Tx2, Tx_Tables.pim_rev_offset2);

                //if (settings.PimSchema == ImSchema.REV)
                //{
                //    tsp.P1 = (float)settings.Tx + Tx_Tables.pim_rev_tx1.Offset(tsp.F1, settings.Tx, Tx_Tables.pim_rev_offset1);
                //    tsp.P2 = (float)settings.Tx + Tx_Tables.pim_rev_tx2.Offset(tsp.F2, settings.Tx, Tx_Tables.pim_rev_offset2);
                //}
                //else
                //{
                //    tsp.P1 = (float)settings.Tx + Tx_Tables.pim_frd_tx1.Offset(tsp.F1, settings.Tx, Tx_Tables.pim_frd_offset1);
                //    tsp.P2 = (float)settings.Tx + Tx_Tables.pim_frd_tx2.Offset(tsp.F2, settings.Tx, Tx_Tables.pim_frd_offset2);
                //}
                //----------------------------------------
            }
            else
            {
                tsp.P1 = (float)App_Factors.pim_tx1.ValueWithOffset(tsp.F1, settings.Tx);
                tsp.P2 = (float)App_Factors.pim_tx2.ValueWithOffset(tsp.F2, settings.Tx2);
            }
            tsp.N1 = num;
            return(tsp);
        }
Exemple #11
0
        /// <summary>
        /// 加载规格参数
        /// </summary>
        internal void LoadSettings()
        {
            IniFile.SetFileName(fileName);
            int    n = 3;
            string pre;

            for (int i = 0; i < ims.Length; i++)
            {
                ims[i] = new ImSpecifics();

                pre = "ord" + n.ToString() + "_";

                ims[i].F1UpS   = float.Parse(IniFile.GetString("Specifics", pre + "F1UpS", "869"));   //F1: 869~871.5
                ims[i].F1UpE   = float.Parse(IniFile.GetString("Specifics", pre + "F1UpE", "871.5"));
                ims[i].F2DnS   = float.Parse(IniFile.GetString("Specifics", pre + "F2DnS", "889"));   //F2: 889~894
                ims[i].F2DnE   = float.Parse(IniFile.GetString("Specifics", pre + "F2DnE", "894"));
                ims[i].F1fixed = float.Parse(IniFile.GetString("Specifics", pre + "F1fixed", "869")); //F1: 869 F2: 894
                ims[i].F2fixed = float.Parse(IniFile.GetString("Specifics", pre + "F2fixed", "894"));
                ims[i].F1Step  = float.Parse(IniFile.GetString("Specifics", pre + "F1Step", "1"));    //Step
                ims[i].F2Step  = float.Parse(IniFile.GetString("Specifics", pre + "F2Step", "1"));
                ims[i].ImS     = float.Parse(IniFile.GetString("Specifics", pre + "ImS", "844"));     //Im3: 844~849
                ims[i].ImE     = float.Parse(IniFile.GetString("Specifics", pre + "ImE", "849"));

                n = n + 2;
            }

            cbn.Cbn1F1S = float.Parse(IniFile.GetString("Specifics", "Cbn1F1S", "869")); //F1: 869~871.5
            cbn.Cbn1F1E = float.Parse(IniFile.GetString("Specifics", "Cbn1F1E", "871.5"));
            cbn.Cbn1F2S = float.Parse(IniFile.GetString("Specifics", "Cbn1F2S", "889")); //F2: 889~894
            cbn.Cbn1F2E = float.Parse(IniFile.GetString("Specifics", "Cbn1F2E", "894"));
            cbn.Cbn1RxS = float.Parse(IniFile.GetString("Specifics", "Cbn1RxS", "824")); //Rx: 824~849
            cbn.Cbn1RxE = float.Parse(IniFile.GetString("Specifics", "Cbn1RxE", "849"));

            cbn.Cbn2TxS = float.Parse(IniFile.GetString("Specifics", "Cbn2TxS", "869")); //Tx: 869~894
            cbn.Cbn2TxE = float.Parse(IniFile.GetString("Specifics", "Cbn2TxE", "894"));
            cbn.Cbn2RxS = float.Parse(IniFile.GetString("Specifics", "Cbn2RxS", "824")); //Rx: 824~849
            cbn.Cbn2RxE = float.Parse(IniFile.GetString("Specifics", "Cbn2RxE", "849"));

            cbn.TxS = float.Parse(IniFile.GetString("Specifics", "TxS", "869")); //Tx: 869~894
            cbn.TxE = float.Parse(IniFile.GetString("Specifics", "TxE", "894"));
            cbn.RxS = float.Parse(IniFile.GetString("Specifics", "RxS", "824")); //Rx: 824~849
            cbn.RxE = float.Parse(IniFile.GetString("Specifics", "RxE", "849"));
        }
Exemple #12
0
        internal void LoadOffsets()
        {
            string strTemp;

            //设置配置文件,以操作之
            IniFile.SetFileName(fileName);

            strTemp = IniFile.GetString(sectionName, keyName, "");

            factors = strTemp.Trim();

            a1 = GetFactors(0);
            b1 = GetFactors(1);
            c1 = GetFactors(2);

            a2 = GetFactors(3);
            b2 = GetFactors(4);
            c2 = GetFactors(5);
        }
Exemple #13
0
        internal void LoadSettings()
        {
            IniFile.SetFileName(fileName);

            tx   = float.Parse(IniFile.GetString("harmonic", "tx", "30.0"));
            freq = float.Parse(IniFile.GetString("harmonic", "freq", "930.0"));

            att_spc = int.Parse(IniFile.GetString("harmonic", "att_spc", "0"));
            rbw_spc = int.Parse(IniFile.GetString("harmonic", "rbw_spc", "4"));
            vbw_spc = int.Parse(IniFile.GetString("harmonic", "vbw_spc", "4"));

            min_har = float.Parse(IniFile.GetString("harmonic", "min_har", "0"));
            max_har = float.Parse(IniFile.GetString("harmonic", "max_har", "140"));

            time_points = int.Parse(IniFile.GetString("harmonic", "time_points", "20"));
            freq_step   = float.Parse(IniFile.GetString("harmonic", "freq_step", "1.0"));

            limit      = float.Parse(IniFile.GetString("harmonic", "limit", "80"));
            multiplier = int.Parse(IniFile.GetString("harmonic", "multiplier", "2"));

            rev = int.Parse(IniFile.GetString("harmonic", "rev", "0"));
        }
Exemple #14
0
        private void PimSaveForm_Load(object sender, EventArgs e)
        {
            IniFile.SetFileName("D:\\settings\\Specifics.ini");

            chkCsv.Checked = IniFile.GetString("Specifics", "csvC", "1") == "1"?true:false;
            chkPDF.Checked = IniFile.GetString("Specifics", "pdfC", "0") == "1" ? true : false;
            chkJpg.Checked = IniFile.GetString("Specifics", "jpgC", "0") == "1" ? true : false;
            //chkCsv.Checked = Convert.ToBoolean(App_Configure.Cnfgs.Csv_checked);
            //chkPDF.Checked = Convert.ToBoolean(App_Configure.Cnfgs.Pdf_checked);
            //chkJpg.Checked = Convert.ToBoolean(App_Configure.Cnfgs.Jpg_checked);

            string formate = "yyyy-MM-dd HH-mm-ss";

            txtCsv.Text   = DateTime.Now.ToString(formate);
            txtJpg.Text   = DateTime.Now.ToString(formate);
            txtPDF.Text   = DateTime.Now.ToString(formate);
            textBox2.Text = App_Configure.Cnfgs.Modno;
            textBox3.Text = App_Configure.Cnfgs.Serno;
            textBox1.Text = App_Configure.Cnfgs.Opeor;
            SaveDatas();
            lblPath.Text = "文件路径:" + App_Configure.Cnfgs.Path_Rpt_Pim;
        }
Exemple #15
0
        public sock(IntPtr i)
        {
            Socket sockwatch = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            string path      = Application.StartupPath;

            this.i = i;
            string getip = IniFile.GetString("connServer", "addr", "0", Application.StartupPath + "\\SqlInfo.ini");

            if (getip == "0")
            {
                MessageBox.Show("读取ip错误");
                return;
            }
            IPEndPoint ip = new IPEndPoint(IPAddress.Parse(getip), 6307);

            sockwatch.Bind(ip);
            sockwatch.Listen(10);
            Thread th2 = new Thread(SocketC);

            th2.IsBackground = true;
            th2.Start(sockwatch);
        }
        internal void LoadSettings()
        {
            IniFile.SetFileName(fileName);

            tx   = float.Parse(IniFile.GetString("isolation", "tx", "30.0"));
            freq = float.Parse(IniFile.GetString("isolation", "freq", "930.0"));

            att_spc = int.Parse(IniFile.GetString("isolation", "att_spc", "0"));
            rbw_spc = int.Parse(IniFile.GetString("isolation", "rbw_spc", "4"));
            vbw_spc = int.Parse(IniFile.GetString("isolation", "vbw_spc", "4"));

            time_points = int.Parse(IniFile.GetString("isolation", "time_points", "20"));
            freq_step   = float.Parse(IniFile.GetString("isolation", "freq_step", "1.0"));

            min_iso = float.Parse(IniFile.GetString("isolation", "min_iso", "0"));
            max_iso = float.Parse(IniFile.GetString("isolation", "max_iso", "140"));

            limit = float.Parse(IniFile.GetString("isolation", "limit", "80"));

            attenuator = float.Parse(IniFile.GetString("isolation", "attenuator", "0"));
            offset     = float.Parse(IniFile.GetString("isolation", "offset", "0"));
        }
Exemple #17
0
        private void FillTable(int N, int M)
        {
            int   i, j;
            float v = 0.0f;

            string s  = "";
            string s2 = "";
            string r  = "tx_row_";

            //初始化2维表格
            table = new float[N][];
            for (i = 0; i < table.Length; i++)
            {
                table[i] = new float[M];

                s = IniFile.GetString(sectionName, (r + (i + 1).ToString()), "");

                for (j = 0; j < M; j++)
                {
                    s2 = IniFile.GetItemFrom(s, j, M);

                    try
                    {
                        if (s2 != "")
                        {
                            v = Convert.ToSingle(s2);
                        }
                    }
                    catch (InvalidCastException)
                    {
                        v = 0.0f;
                    }

                    table[i][j] = v;
                }
            }
        }
        internal void LoadSettings()
        {
            IniFile.SetFileName(fileName);

            tx        = float.Parse(IniFile.GetString("vswr", "tx", "30.0"));
            freq      = float.Parse(IniFile.GetString("vswr", "freq", "935.0"));
            freq_step = float.Parse(IniFile.GetString("vswr", "freq_step", "0.5"));
            count     = int.Parse(IniFile.GetString("vswr", "count", "20"));

            att_spc = int.Parse(IniFile.GetString("vswr", "att_spc", "0"));
            rbw_spc = int.Parse(IniFile.GetString("vswr", "rbw_spc", "4"));
            vbw_spc = int.Parse(IniFile.GetString("vswr", "vbw_spc", "4"));

            min_vsw = float.Parse(IniFile.GetString("vswr", "min_vsw", "0"));
            max_vsw = float.Parse(IniFile.GetString("vswr", "max_vsw", "10"));

            min_rls = float.Parse(IniFile.GetString("vswr", "min_rls", "0"));
            max_rls = float.Parse(IniFile.GetString("vswr", "max_rls", "100"));

            limit = float.Parse(IniFile.GetString("vswr", "limit", "1.3"));

            attenuator = float.Parse(IniFile.GetString("vswr", "attenuator", "0"));
            offset     = float.Parse(IniFile.GetString("vswr", "offset", "0"));
        }
        /// <summary>
        /// 获取指定的序列频率扫描数据
        /// </summary>
        /// <param name="filePath">读取的文件地址</param>
        /// <param name="gsm"></param>
        /// <param name="mode">REV,FWD</param>
        /// <param name="imOder">阶数</param>
        /// <param name="cate">fixed,sweep</param>
        internal FreqSweepParam GetFreqSweepParam(Settings_Pim settings,
                                                  string filePath,
                                                  string gsm,
                                                  string mode,
                                                  string cate,
                                                  int imOrder)
        {
            IniFile.SetFileName(filePath);
            string         name = GetName(gsm, mode, imOrder, cate);
            FreqSweepParam fsp  = new FreqSweepParam();

            FreqSweepItem[] sweepItem1 = null;
            FreqSweepItem[] sweepItem2 = null;
            string          tx1_1      = IniFile.GetString(name, "tx1_1", "935");
            string          tx2_1      = IniFile.GetString(name, "tx2_1", "960");
            string          rx_1       = IniFile.GetString(name, "rx_1", "910");

            string tx1_2 = IniFile.GetString(name, "tx1_2", "935");
            string tx2_2 = IniFile.GetString(name, "tx2_2", "960");
            string rx_2  = IniFile.GetString(name, "rx_2", "910");

            string[] strTx1_1 = tx1_1.Split(char.Parse(","));
            string[] strTx2_1 = tx2_1.Split(char.Parse(","));
            string[] strRx_1  = rx_1.Split(char.Parse(","));

            string[] strTx1_2 = tx1_2.Split(char.Parse(","));
            string[] strTx2_2 = tx2_2.Split(char.Parse(","));
            string[] strRx_2  = rx_2.Split(char.Parse(","));
            sweepItem1 = new FreqSweepItem[strTx1_1.Length];
            sweepItem2 = new FreqSweepItem[strTx1_2.Length];
            for (int i = 0; i < strTx1_1.Length; i++)
            {
                sweepItem1[i]     = new FreqSweepItem();
                sweepItem1[i].Tx1 = float.Parse(strTx1_1[i]);
                sweepItem1[i].Tx2 = float.Parse(strTx2_1[i]);
                sweepItem1[i].Rx  = float.Parse(strRx_1[i]);

                sweepItem2[i]     = new FreqSweepItem();
                sweepItem2[i].Tx1 = float.Parse(strTx1_2[i]);
                sweepItem2[i].Tx2 = float.Parse(strTx2_2[i]);
                sweepItem2[i].Rx  = float.Parse(strRx_2[i]);

                if (App_Configure.Cnfgs.Cal_Use_Table)
                {
                    //----------------------------------------

                    sweepItem1[i].P1 = settings.Tx + Tx_Tables.pim_rev_tx1.Offset(sweepItem1[i].Tx1, settings.Tx, Tx_Tables.pim_rev_offset1);
                    sweepItem1[i].P2 = settings.Tx2 + Tx_Tables.pim_rev_tx2.Offset(sweepItem1[i].Tx2, settings.Tx2, Tx_Tables.pim_rev_offset2);
                    sweepItem2[i].P1 = settings.Tx + Tx_Tables.pim_rev_tx1.Offset(sweepItem2[i].Tx1, settings.Tx, Tx_Tables.pim_rev_offset1);
                    sweepItem2[i].P2 = settings.Tx2 + Tx_Tables.pim_rev_tx2.Offset(sweepItem2[i].Tx2, settings.Tx2, Tx_Tables.pim_rev_offset2);

                    //if (settings.PimSchema == ImSchema.REV)
                    //{
                    //    sweepItem1[i].P1 = settings.Tx + Tx_Tables.pim_rev_tx1.Offset(sweepItem1[i].Tx1, settings.Tx, Tx_Tables.pim_rev_offset1);
                    //    sweepItem1[i].P2 = settings.Tx + Tx_Tables.pim_rev_tx2.Offset(sweepItem1[i].Tx2, settings.Tx, Tx_Tables.pim_rev_offset2);
                    //    sweepItem2[i].P1 = settings.Tx + Tx_Tables.pim_rev_tx1.Offset(sweepItem2[i].Tx1, settings.Tx, Tx_Tables.pim_rev_offset1);
                    //    sweepItem2[i].P2 = settings.Tx + Tx_Tables.pim_rev_tx2.Offset(sweepItem2[i].Tx2, settings.Tx, Tx_Tables.pim_rev_offset2);
                    //}
                    //else
                    //{
                    //    sweepItem1[i].P1 = settings.Tx + Tx_Tables.pim_frd_tx1.Offset(sweepItem1[i].Tx1, settings.Tx, Tx_Tables.pim_frd_offset1);
                    //    sweepItem1[i].P2 = settings.Tx + Tx_Tables.pim_frd_tx2.Offset(sweepItem1[i].Tx2, settings.Tx, Tx_Tables.pim_frd_offset2);
                    //    sweepItem2[i].P1 = settings.Tx + Tx_Tables.pim_frd_tx1.Offset(sweepItem2[i].Tx1, settings.Tx, Tx_Tables.pim_frd_offset1);
                    //    sweepItem2[i].P2 = settings.Tx + Tx_Tables.pim_frd_tx2.Offset(sweepItem2[i].Tx2, settings.Tx, Tx_Tables.pim_frd_offset2);
                    //}
                    //----------------------------------------
                }
                else
                {
                    sweepItem1[i].P1 = (float)App_Factors.pim_tx1.ValueWithOffset(sweepItem1[i].Tx1, settings.Tx);
                    sweepItem1[i].P2 = (float)App_Factors.pim_tx2.ValueWithOffset(sweepItem1[i].Tx2, settings.Tx2);
                    sweepItem2[i].P1 = (float)App_Factors.pim_tx1.ValueWithOffset(sweepItem2[i].Tx1, settings.Tx);
                    sweepItem2[i].P2 = (float)App_Factors.pim_tx2.ValueWithOffset(sweepItem2[i].Tx2, settings.Tx2);
                }
            }
            fsp.Items1 = sweepItem1;
            fsp.Items2 = sweepItem2;
            return(fsp);
        }
Exemple #20
0
        internal void LoadSettings()
        {
            IniFile.SetFileName(fileName);

            //=======ygq

            ms_switch_port_count = int.Parse(IniFile.GetString("cnfgs", "ms_switch_port_count", "0"));
            comaddr_switch       = int.Parse(IniFile.GetString("cnfgs", "comaddr_switch", "1"));
            rxRef            = float.Parse(IniFile.GetString("cnfgs", "rxRef", "0"));
            txRef            = float.Parse(IniFile.GetString("cnfgs", "txRef", "0"));
            openOffset       = int.Parse(IniFile.GetString("cnfgs", "openOffset", "1"));
            qiandanqian_mode = int.Parse(IniFile.GetString("cnfgs", "qiandanqiang_mode", "0"));
            mode             = int.Parse(IniFile.GetString("cnfgs", "mode", "0"));
            ishigh           = int.Parse(IniFile.GetString("cnfgs", "ishigh", "0"));
            //======ygq
            macdesc = IniFile.GetString("cnfgs", "macdesc", "JCIMA-II-900P");

            macid = int.Parse(IniFile.GetString("cnfgs", "macid", "1"));

            sn = IniFile.GetString("cnfgs", "sn", "none sn");

            cal = IniFile.GetString("cnfgs", "cal", "none cal");

            comaddr1  = int.Parse(IniFile.GetString("cnfgs", "comaddr1", "1"));
            comaddr2  = int.Parse(IniFile.GetString("cnfgs", "comaddr2", "2"));
            rfclass   = int.Parse(IniFile.GetString("cnfgs", "rfclass", "0"));
            rfformula = int.Parse(IniFile.GetString("cnfgs", "rfformula", "0"));

            spectrum = int.Parse(IniFile.GetString("cnfgs", "spectrum", "0"));

            max_vswr = float.Parse(IniFile.GetString("cnfgs", "max_vswr", "2.0"));
            min_temp = float.Parse(IniFile.GetString("cnfgs", "min_temp", "-20.0"));
            max_temp = float.Parse(IniFile.GetString("cnfgs", "max_temp", "60.0"));
            min_curr = float.Parse(IniFile.GetString("cnfgs", "min_curr", "0.1"));
            max_curr = float.Parse(IniFile.GetString("cnfgs", "max_curr", "3.0"));

            path_def = IniFile.GetString("cnfgs", "path_def", "settings");

            //file_def_pim = IniFile.GetString("cnfgs", "file_def_pim", "Settings_Pim.ini");
            //file_def_spc = IniFile.GetString("cnfgs", "file_def_spc", "Settings_Spc.ini");
            //file_def_iso = IniFile.GetString("cnfgs", "file_def_iso", "Settings_Iso.ini");
            //file_def_vsw = IniFile.GetString("cnfgs", "file_def_vsw", "Settings_Vsw.ini");
            //file_def_har = IniFile.GetString("cnfgs", "file_def_har", "Settings_Har.ini");

            path_usr = IniFile.GetString("cnfgs", "path_usr", "d:\\usr_settings");

            path_usr_pim = IniFile.GetString("cnfgs", "path_usr_pim", "d:\\usr_settings\\pim");
            path_usr_spc = IniFile.GetString("cnfgs", "path_usr_spc", "d:\\usr_settings\\spc");
            path_usr_iso = IniFile.GetString("cnfgs", "path_usr_iso", "d:\\usr_settings\\iso");
            path_usr_vsw = IniFile.GetString("cnfgs", "path_usr_vsw", "d:\\usr_settings\\vsw");
            path_usr_har = IniFile.GetString("cnfgs", "path_usr_har", "d:\\usr_settings\\har");

            //file_usr_pim = IniFile.GetString("cnfgs", "file_usr_pim", "Settings_Pim.ini");
            //file_usr_spc = IniFile.GetString("cnfgs", "file_usr_spc", "Settings_Spc.ini");
            //file_usr_iso = IniFile.GetString("cnfgs", "file_usr_iso", "Settings_Iso.ini");
            //file_usr_vsw = IniFile.GetString("cnfgs", "file_usr_vsw", "Settings_Vsw.ini");
            //file_usr_har = IniFile.GetString("cnfgs", "file_usr_har", "Settings_Har.ini");

            path_rpt = IniFile.GetString("cnfgs", "path_rpt", "d:\\report");

            path_rpt_pim = IniFile.GetString("cnfgs", "path_rpt_pim", "d:\\report\\pim");
            path_rpt_spc = IniFile.GetString("cnfgs", "path_rpt_spc", "d:\\report\\spc");
            path_rpt_iso = IniFile.GetString("cnfgs", "path_rpt_iso", "d:\\report\\iso");
            path_rpt_vsw = IniFile.GetString("cnfgs", "path_rpt_vsw", "d:\\report\\vsw");
            path_rpt_har = IniFile.GetString("cnfgs", "path_rpt_har", "d:\\report\\har");

            cal_use_table = int.Parse(IniFile.GetString("cnfgs", "cal_use_table", "0"));

            lang_pack_path = IniFile.GetString("cnfgs", "lang_pack_path", "");
            skin_pack_path = IniFile.GetString("cnfgs", "skin_pack_path", "");

            //enable_pim = int.Parse(IniFile.GetString("cnfgs", "enable_pim", "1"));
            //enable_spc = int.Parse(IniFile.GetString("cnfgs", "enable_spc", "1"));
            //enable_iso = int.Parse(IniFile.GetString("cnfgs", "enable_iso", "0"));
            //enable_vsw = int.Parse(IniFile.GetString("cnfgs", "enable_vsw", "0"));
            //enable_har = int.Parse(IniFile.GetString("cnfgs", "enable_har", "0"));
            //enable_tst = int.Parse(IniFile.GetString("cnfgs", "enable_tst", "0"));

            _desc  = IniFile.GetString("cnfgs", "desc", "here is no [description]");
            _modno = IniFile.GetString("cnfgs", "modno", "here is no [model no.]");
            _opeor = IniFile.GetString("cnfgs", "opeor", "here is no [serial no.]");
            _serno = IniFile.GetString("cnfgs", "serno", "default user");

            csv_checked = int.Parse(IniFile.GetString("cnfgs", "csv_checked", "0"));
            jpg_checked = int.Parse(IniFile.GetString("cnfgs", "jpg_checked", "0"));
            pdf_checked = int.Parse(IniFile.GetString("cnfgs", "pdf_checked", "0"));

            _channel      = int.Parse(IniFile.GetString("cnfgs", "channel", "0"));
            _gpio         = int.Parse(IniFile.GetString("cnfgs", "gpio", "0"));
            _battery      = int.Parse(IniFile.GetString("cnfgs", "battery", "0"));
            _width_pinNum = int.Parse(IniFile.GetString("cnfgs", "width_pinNum", "0"));
            _power_pinNum = int.Parse(IniFile.GetString("cnfgs", "power_pinNum", "1"));

            _enableSuperConfig = int.Parse(IniFile.GetString("cnfgs", "enableSuperConfig", "0"));
            isScroll           = IniFile.GetString("cnfgs", "scroll", "1") == "0" ? true : false;
            switchOrGpio       = IniFile.GetString("cnfgs", "SwitchOrGpio", "0") == "0" ? true : false;

            //_pim_wait = int.Parse(IniFile.GetString("cnfgs", "pimWait", "1000"));
            _password   = IniFile.GetString("cnfgs", "password", "82F8A4F03E18723F");
            _switchMode = int.Parse(IniFile.GetString("cnfgs", "switchMode", "0"));
            _switchO    = IniFile.GetString("cnfgs", "switchO", "0");
            _switchN    = IniFile.GetString("cnfgs", "switchN", "0");
            if (_password == "")
            {
                _password = "******";
            }
        }
Exemple #21
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            bool  running = false;
            Mutex mt      = new Mutex(true, "jcPimSoftware", out running);

            //获取程序执行路径
            string exePath = Application.StartupPath;

            //加载全局配置文件
            App_Configure.NewConfigure(exePath + "\\Configures.ini");
            App_Configure.Cnfgs.LoadSettings();

            //判断授权文件
            Code c = new Code();

            try
            {
                if (File.Exists(Code.strFilePath))
                {
                    if (!c.CheckFile(App_Configure.Cnfgs.SN.ToLower()))
                    {
                        running = false;
                        MessageBox.Show("授权日期已到!");
                    }
                }
                else
                {
                    running = false;
                    MessageBox.Show("请先生成授权文件!");
                }
            }
            catch
            {
                running = false;
                MessageBox.Show("授权文件缺失或错误,请重新生成授权文件!");
            }

            if (running)
            {
                sf = new StartForm("Initializing......\r\n");
                Thread t = new Thread(new ThreadStart(Show));
                t.IsBackground = true;
                t.Start();
                try
                {
                    //ygq
                    string s = Copy(Application.StartupPath + "\\settings", "D:\\settings");
                    //



                    #region 加载主配置文件,获取配置文件相对路径
                    //获取程序执行路径
                    //string exePath = Application.StartupPath;

                    //加载全局配置文件
                    //App_Configure.NewConfigure(exePath + "\\Configures.ini");
                    //App_Configure.Cnfgs.LoadSettings();


                    //获取配置文件夹路径
                    string setPath = App_Configure.Cnfgs.Path_Def;
                    #endregion

                    #region 建立功放补偿表格文件对象,并加载数据
                    //TX补偿文件
                    if (App_Configure.Cnfgs.Ms_switch_port_count <= 0)
                    {
                        //Tx_Tables.NewTables(exePath + "\\" + setPath + "\\Tx_Tables\\signal_tx_rev.ini",
                        //                    exePath + "\\" + setPath + "\\Tx_Tables\\signal_tx_disp_rev.ini"
                        //                  );


                        if (App_Configure.Cnfgs.Mode >= 2)
                        {
                            Tx_Tables.NewTables(exePath + "\\" + setPath + "\\Tx_Tables\\signal_tx_rev.ini",
                                                exePath + "\\" + setPath + "\\Tx_Tables\\signal_tx_disp_rev.ini",
                                                exePath + "\\" + setPath + "\\Tx_Tables\\signal_tx_rev2.ini",
                                                exePath + "\\" + setPath + "\\Tx_Tables\\signal_tx_disp_rev2.ini"
                                                );

                            Tx_Tables.LoadTables();

                            //RX补偿文件
                            string path1 = exePath + "\\" + setPath + "\\RX_Tables";
                            //string[] rx_tables_names = { path1 + "\\pim_rev.txt", path1 + "\\pim_frd.txt" };
                            string[] rx_tables_names = { path1 + "\\pim_rev.txt",  path1 + "\\pim_frd.txt",
                                                         path1 + "\\pim_rev2.txt", path1 + "\\pim_frd2.txt" };
                            Rx_Tables.NewTables(rx_tables_names);

                            Rx_Tables.LoadTables();
                        }

                        else
                        {
                            Tx_Tables.NewTables(exePath + "\\" + setPath + "\\Tx_Tables\\signal_tx_rev.ini",
                                                exePath + "\\" + setPath + "\\Tx_Tables\\signal_tx_disp_rev.ini"
                                                );

                            Tx_Tables.LoadTables2();

                            //RX补偿文件
                            string   path1           = exePath + "\\" + setPath + "\\RX_Tables";
                            string[] rx_tables_names = { path1 + "\\pim_rev.txt", path1 + "\\pim_frd.txt" };

                            Rx_Tables.NewTables(rx_tables_names);

                            Rx_Tables.LoadTables();
                        }
                    }
                    else
                    {
                        bool com_client = MsSwithc.ClientCom();
                        //mSwitch = new MotorSwitch();
                        //bool com_client = mSwitch.Connect("192.168.1.178", 4001);
                        if (com_client)
                        {
                            sf.GetInfoMation("Load switch successfully!");
                        }
                        else
                        {
                            sf.GetInfoMation("Load switch failed!");
                        }
                        offset = new Offset(App_Configure.Cnfgs.Ms_switch_port_count);
                        int a = int.Parse(IniFile.GetString("cnfgs", "xuhao", "0", exePath + "\\Configures.ini"));
                        offset.LoadingRX();
                        offset.LoadingTX();
                        offset.GetTX(a);
                        offset.GetRX(a);
                    }
                    //建立补偿系数文件对象,并加载文件
                    App_Factors.NewFactors(exePath + "\\" + setPath + "\\Offsets_Tx.ini",
                                           exePath + "\\" + setPath + "\\Offsets_Tx_Disp.ini",
                                           exePath + "\\" + setPath + "\\Offsets_Rx.ini");
                    App_Factors.LoadFactros();

                    #endregion

                    #region 建立频谱补偿表格文件对象,并加载数据
                    //频谱补偿文件
                    string   path2            = exePath + "\\" + setPath + "\\Spectrum_Tables";
                    string[] spc_tables_names = { path2 + "\\Ch1_4KHz.txt", path2 + "\\Ch1_20KHz.txt", path2 + "\\Ch1_100KHz.txt", path2 + "\\Ch1_1000KHz.txt",
                                                  path2 + "\\Ch2_4KHz.txt", path2 + "\\Ch2_20KHz.txt", path2 + "\\Ch2_100KHz.txt", path2 + "\\Ch2_1000KHz.txt" };

                    Spectrum_Tables.NewTables(spc_tables_names);
                    #endregion ;

                    #region 建立RLO校准文件对象,并加载数据
                    //string path4 = exePath + "\\" + setPath + "\\RL0_Tables";
                    //string[] rl0_tables_names = {path4 + "\\iso_tx1.txt", path4 + "\\iso_tx2.txt",
                    //                         path4 + "\\vsw_tx1.txt", path4 + "\\vsw_tx2.txt",
                    //                         path4 + "\\har_tx1.txt", path4 + "\\har_tx2.txt"};

                    //RL0_Tables.NewTables(rl0_tables_names);
                    //RL0_Tables.LoadTables();
                    #endregion

                    #region 建立默认模块配置信息对象,并加载数据
                    //默认模块配置文件
                    string   path3          = "D:\\" + setPath;
                    string[] settings_names = { path3 + "\\Settings_Sgn.ini", path3 + "\\Settings_Pim.ini",
                                                path3 + "\\Settings_Spc.ini",
                                                path3 + "\\Specifics.ini" };

                    App_Settings.NewSettings(settings_names);
                    App_Settings.LoadSettings();
                    #endregion

                    #region 加载皮肤资源
                    FileInfo f    = new FileInfo(exePath + "\\" + App_Configure.Cnfgs.Skin_pack_path);
                    string   name = f.Name.Substring(0, f.Name.LastIndexOf("."));
                    ImagesManage.LoadImageDLL(name);
                    #endregion

                    #region 加载语言包资源

                    #endregion


                    //建立报告文件夹结构
                    App_Configure.CreateReportFolder();

                    //建立用户配置文件夹结构
                    App_Configure.CreateUsrSettingFolder();

                    sf.GetInfoMation("Load default configuration successfully!");
                }
                catch
                {
                    sf.GetInfoMation("Load default configuration failed!");
                }
                NativeMessage.PostMessage(handel, MessageID.SF_WAIT, 0, 0);
                #region 建立程序主窗体
                frmMain = new MainForm();
                NativeMessage.PostMessage(handel, MessageID.SF_CONTINUTE, 0, 0);
                #endregion

                #region 建立射频功放层
                RFSignal.InitRFSignal(frmMain.Handle);
                bool flag      = false;
                int  adrr1     = App_Configure.Cnfgs.ComAddr1;
                int  adrr2     = App_Configure.Cnfgs.ComAddr2;
                int  rfClass   = App_Configure.Cnfgs.RFClass;
                int  rFFormula = App_Configure.Cnfgs.RFFormula;

                flag = RFSignal.NewRFSignal(adrr1, rfClass, rFFormula);
                if (flag)
                {
                    sf.GetInfoMation("Serial " + adrr1.ToString() + " initialized successfully!");
                    sf.status = sf.status & 1;
                }
                else
                {
                    sf.GetInfoMation("Serial " + adrr1.ToString() + " initialized failed!");
                    sf.status = sf.status & 0;
                }
                flag = RFSignal.NewRFSignal(adrr2, rfClass, rFFormula);

                if (flag)
                {
                    sf.GetInfoMation("Serial " + adrr2.ToString() + " initialized successfully!");
                    sf.status = sf.status & 1;
                }
                else
                {
                    sf.GetInfoMation("Serial " + adrr2.ToString() + " initialized failed!");
                    sf.status = sf.status & 0;
                }
                RFSignal.RFOff(adrr1, 2);
                RFSignal.RFOff(adrr2, 2);

                #endregion
                NativeMessage.PostMessage(handel, MessageID.SF_WAIT, 0, 0);
                #region WINIO、GPIO初始化操作

                flag = GPIO.InitWinIo();

                if (!flag)
                {
                    Thread.Sleep(300);
                    flag = GPIO.InitWinIo();
                }

                if (flag)
                {
                    sf.GetInfoMation("WINIO initialized successfully!");
                    sf.status = sf.status & 1;
                }
                else
                {
                    // Log.WriteLog("winIO初始化失败!", Log.EFunctionType.TestMode);
                    sf.GetInfoMation("WINIO initialized failed!");
                    sf.status = sf.status & 0;
                }
                sf.Complete = true;
                //GPIO.Narrowband();
                NativeMessage.PostMessage(handel, MessageID.SF_CONTINUTE, 0, 0);
                #endregion

                #region 判断Bird频谱仪状态

                if (App_Configure.Cnfgs.Spectrum == 1)
                {
                    FunTimeout                   tf           = new FunTimeout();
                    SpectrumLib.ISpectrum        ISpectrumObj = new SpectrumLib.Spectrums.BirdSh(handel, MessageID.SPECTRUEME_SUCCED, MessageID.SPECTRUM_ERROR);
                    SpectrumLib.Models.ScanModel model        = new SpectrumLib.Models.ScanModel();
                    sf.ISpectrumObj = ISpectrumObj;
                    if (ISpectrumObj.ConnectSpectrum() != 1)
                    {
                        GPIO.SetHigh();
                        Thread.Sleep(1000);
                        GPIO.SetLow();
                        ISpectrumObj.ResetStatus();
                        sf.GetInfoMation("Bird connect failed!");
                        Log.WriteLog("Bird connect failed!", Log.EFunctionType.SPECTRUM);
                    }
                    model.StartFreq = 900;
                    model.EndFreq   = 900.5;
                    model.Att       = 0;
                    model.Rbw       = 10 * 1000;
                    model.Vbw       = 3 * 1000;
                    model.Continued = false;
                    model.Unit      = SpectrumLib.Defines.CommonDef.EFreqUnit.MHz;

                    tf.obj = model;
                    tf.Do  = ISpectrumObj.StartAnalysis;
                    if (tf.DoWithTimeout(new TimeSpan(0, 0, 0, 1)))
                    {
                        GPIO.SetHigh();
                        Thread.Sleep(1000);
                        GPIO.SetLow();
                        ISpectrumObj.ResetStatus();
                        Log.WriteLog("Bird get data failed!", Log.EFunctionType.SPECTRUM);
                    }
                }

                #endregion

                #region 判断Deli频谱仪状态

                if (App_Configure.Cnfgs.Spectrum == 2)
                {
                    try
                    {
                        SpectrumLib.ISpectrum        ISpectrumObj = new SpectrumLib.Spectrums.Deli(handel, MessageID.SPECTRUEME_SUCCED, MessageID.SPECTRUM_ERROR);
                        SpectrumLib.Models.ScanModel model        = new SpectrumLib.Models.ScanModel();
                        sf.ISpectrumObj = ISpectrumObj;
                        if (ISpectrumObj.ConnectSpectrum() != 1)
                        {
                            ISpectrumObj.ResetStatus();
                            sf.GetInfoMation("Deli spectrum connect failed !");
                            Log.WriteLog("Deli spectrum connect failed!", Log.EFunctionType.SPECTRUM);
                        }
                        else
                        {
                            object o;
                            model.StartFreq         = App_Settings.pim.F1;
                            model.EndFreq           = model.StartFreq + 2 * App_Settings.pim.Scanband;
                            model.Unit              = SpectrumLib.Defines.CommonDef.EFreqUnit.MHz;
                            model.Att               = App_Settings.pim.Att_Spc;
                            model.Rbw               = App_Settings.pim.Rbw_Spc;
                            model.Vbw               = App_Settings.pim.Vbw_Spc;
                            model.Deli_averagecount = 6;
                            model.Deli_detector     = "AVERage";//检波方式
                            model.Deli_ref          = -50;
                            model.Deli_refoffset    = 0;
                            model.Deli_specing      = "LOGarithmic";
                            model.Deli_sweepmode    = "PERFormance"; //扫描模式
                            model.Deli_source       = "FREERUN";     //触发方式
                            model.Deli_scale        = 10;            //单位/格
                            model.Deli_startspe     = 0;             //频谱仪是否第一次启动
                            model.Deli_isSpectrum   = true;          //频谱模式

                            o = model;
                            if (!ISpectrumObj.Setting(o))
                            {
                                Thread.Sleep(1000);
                                ISpectrumObj.ResetStatus();
                                sf.GetInfoMation("Deli spectrum set failed !");
                                Log.WriteLog("Deli spectrum set failed!", Log.EFunctionType.SPECTRUM);
                            }
                        }
                    }
                    catch
                    {
                        sf.GetInfoMation("Deli spectrum connect failed !");
                        Log.WriteLog("Deli connect failed!", Log.EFunctionType.SPECTRUM);
                    }
                }
                #endregion

                #region 判断FanShuang收信机状态

                if (App_Configure.Cnfgs.Spectrum == SpectrumType.FanShuang)
                {
                    FunTimeout                   tf           = new FunTimeout();
                    SpectrumLib.ISpectrum        ISpectrumObj = new SpectrumLib.Spectrums.FanShuang(handel, MessageID.SPECTRUEME_SUCCED, MessageID.SPECTRUM_ERROR);
                    SpectrumLib.Models.ScanModel model        = new SpectrumLib.Models.ScanModel();
                    sf.ISpectrumObj = ISpectrumObj;
                    if (ISpectrumObj.ConnectSpectrum() != 1)
                    {
                        GPIO.SetHigh();
                        Thread.Sleep(1000);
                        GPIO.SetLow();
                        ISpectrumObj.ResetStatus();
                        sf.GetInfoMation("FanShaung connect failed!");
                        Log.WriteLog("FanShaung connect failed!", Log.EFunctionType.SPECTRUM);
                    }
                }

                #endregion

                mre.WaitOne();

                #region 启动程序

                Application.Run(frmMain);
                mt.ReleaseMutex();
            }
            else
            {
                Application.Exit();
            }
            #endregion

            #region 释放资源
            RFSignal.FinaRFSignal();
            #endregion
        }