예제 #1
0
        /// <summary>
        /// RF_Sample
        /// </summary>
        /// <param name="Addr">功放地址</param>
        /// <param name="Lvl">命令等级</param>
        /// <param name="status">功放状态对象</param>
        /// <returns>true成功 false超时</returns>
        private bool RF_Sample(int Addr,
                               int Lvl,
                               ref PowerStatus status)
        {
            bool RF_Succ = true;

            RFSignal.RFClear(Addr, Lvl);

            RFSignal.RFSample(Addr, Lvl);

            RFSignal.RFStart(Addr);

            if (Addr == exe_params.DevInfo.RF_Addr1)
            {
                RF_Succ = power1_Handle.WaitOne(1000, true);
                power1_Handle.Reset();
            }
            else
            {
                RF_Succ = power2_Handle.WaitOne(1000, true);
                power2_Handle.Reset();
            }

            //没有发生功放通信超时,则获取功放状态信息
            if (RF_Succ)
            {
                RFSignal.RFStatus(Addr, ref status);
            }

            //返回通信超时的情况
            return(!RF_Succ);
        }
예제 #2
0
        public static bool NewRFSignal(int comAddr,
                                       int clsValue,
                                       int forValue)
        {
            bool flag = false;
            int  lvl  = RFPriority.LvlTwo;

            RFSignal.RFNewSignal(comAddr,
                                 ComNames[comAddr - 1],
                                 clsValue,
                                 forValue);

            RFSignal.EnableLog(false);

            if (RFSignal.RFConnected(comAddr, TimeOut))
            {
                flag = true;

                RFSignal.RFClear(comAddr, lvl);

                //只有三维功放需要执行总查询
                if (clsValue == clsSunWave)
                {
                    RFSignal.RFSample2(comAddr, lvl);
                    RFSignal.RFPower(comAddr, lvl, 30);
                }

                RFSignal.RFSample(comAddr, lvl);

                RFSignal.RFStart(comAddr);
            }
            return(flag);
        }
예제 #3
0
 public static void InitRFSignal(IntPtr destHandle)
 {
     RFSignal.RFInitialize(ComCount,
                           destHandle,
                           MessageID.RF_SUCCED_ALL,
                           MessageID.RF_SUCCED_ONE,
                           MessageID.RF_FAILED);
 }
예제 #4
0
        /// <summary>
        /// Rev
        /// </summary>
        /// <returns>true成功 false失败</returns>
        public static bool Rev()
        {
            bool rev = false;

            int[] value = new int[1];

            if (App_Configure.Cnfgs.Gpio == 0)
            {
                GetPortVal(0x084d, value, 1);
                if (SetPortVal(0x084d, value[0] & 0xfe, 1))
                {
                    App_Configure.Cnfgs.Channel = 0;
                    rev = true;
                }
            }
            else if (App_Configure.Cnfgs.Gpio == 4)
            {
                int[] original = new int[1];

                if (GetPortVal(0x0a00, original, 1) == false)
                {
                    return(false);
                }
                rev = SetPortVal(0x0a00, original[0] & 0xfe, 1);
                if (App_Configure.Cnfgs.Ms_switch_port_count >= 1)
                {
                    RFSignal.RFClear(comAddr, RFPriority.LvlTwo);
                    RFSignal.RFAssistGpo(comAddr, RFPriority.LvlTwo, 0);
                    RFSignal.RFStart(comAddr);
                }
            }
            if (App_Configure.Cnfgs.Ms_switch_port_count >= 2 && App_Configure.Cnfgs.Gpio == 0)
            {
                GetPortVal(0x084d, value, 1);
                if (SetPortVal(0x084d, value[0] & 0xfe, 1))
                {
                    App_Configure.Cnfgs.Channel = 0;
                    rev = true;
                }
                if (App_Configure.Cnfgs.Ms_switch_port_count >= 1)
                {
                    RFSignal.RFClear(comAddr, RFPriority.LvlTwo);
                    RFSignal.RFAssistGpo(comAddr, RFPriority.LvlTwo, 0);
                    RFSignal.RFStart(comAddr);
                }
            }



            return(rev);
        }
예제 #5
0
        /// <summary>
        /// Fwd
        /// </summary>
        /// <returns>true成功 false失败</returns>
        public static bool Fwd()
        {
            bool rev = false;

            int[] value = new int[1];

            if (App_Configure.Cnfgs.Gpio == 0)
            {
                GetPortVal(0x084d, value, 1);
                if (SetPortVal(0x084d, value[0] | 0x01, 1))
                {
                    App_Configure.Cnfgs.Channel = 1;
                    rev = true;
                }


                //}
                //else
                //{
                //    byte pinNum = Convert.ToByte(Width_pinNum.ToString(), 10);
                //    if (gpioSucc)
                //    {
                //        if (susiGpio.susiGpio.WriteExHigh(pinNum))
                //        {
                //            App_Configure.Cnfgs.Channel = 1;
                //            rev = true;
                //        }
                //    }
                //}
            }
            else if (App_Configure.Cnfgs.Gpio == 4)
            {
                int[] original = new int[1];

                if (GetPortVal(0x0a00, original, 1) == false)
                {
                    return(false);
                }
                rev = SetPortVal(0x0a00, original[0] | 0x01, 1);
                if (App_Configure.Cnfgs.Ms_switch_port_count >= 1)
                {
                    RFSignal.RFClear(comAddr, RFPriority.LvlTwo);
                    RFSignal.RFAssistGpo(comAddr, RFPriority.LvlTwo, 1);
                    RFSignal.RFStart(comAddr);
                }
            }

            return(rev);
        }
예제 #6
0
        /// <summary>
        /// 准备扫描参数
        /// </summary>
        /// <param name="sweeps"></param>
        internal void Prepare(SweepParams usr_sweeps)
        {
            usr_sweeps.Clone(exe_params);

            //设置功放消息的目标窗体句柄
            RFSignal.SetWndHandle(exe_params.WndHandle);

            //建立频谱分析对象
            if (exe_params.DevInfo.Spectrum == SpectrumType.SPECAT2)
            {
                ISpectrumObj = new SpectrumLib.Spectrums.SpeCat2(exe_params.WndHandle, MessageID.SPECTRUEME_SUCCED, MessageID.SPECTRUM_ERROR);
            }

            else
            {
                ISpectrumObj = new SpectrumLib.Spectrums.BirdSh(exe_params.WndHandle, MessageID.SPECTRUEME_SUCCED, MessageID.SPECTRUM_ERROR);
            }
        }
예제 #7
0
        private bool RF_Do(int Addr,
                           int Lvl,
                           float P,
                           float F,
                           bool RFon,
                           bool ignoreRFon,
                           bool useP,
                           bool useF,
                           ref PowerStatus status)
        {
            bool RF_Succ = false;

            RFSignal.RFClear(Addr, Lvl);

            if (useP)
            {
                RFSignal.RFPower(Addr, Lvl, P);
            }

            if (useF)
            {
                RFSignal.RFFreq(Addr, Lvl, F);
            }

            if (!ignoreRFon)
            {
                if (RFon)
                {
                    RFSignal.RFOn(Addr, Lvl);
                }
                else
                {
                    RFSignal.RFOff(Addr, Lvl);
                }
            }

            RFSignal.RFSample(Addr, Lvl);

            RFSignal.RFStart(Addr);

            //等待功放
            if (Addr == exe_params.DevInfo.RF_Addr1)
            {
                RF_Succ = power1_Handle.WaitOne(2000, true);
                power1_Handle.Reset();
            }
            else
            {
                RF_Succ = power2_Handle.WaitOne(2000, true);
                power2_Handle.Reset();
            }

            //没有发生功放通信超时,则获取功放状态信息
            if (RF_Succ)
            {
                RFSignal.RFStatus(Addr, ref status);
            }

            //返回通信超时的情况
            return(!RF_Succ);
        }
예제 #8
0
        /// <summary>
        /// 窗体加载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TestForm_Load(object sender, EventArgs e)
        {
            _handle = this.Handle;

            //频谱类型
            type = App_Configure.Cnfgs.Spectrum;
            switch (type)
            {
            case 0:
                ISpectrumObj = new SpectrumLib.Spectrums.SpeCat2(this.Handle, MessageID.SPECTRUEME_SUCCED, MessageID.SPECTRUM_ERROR);
                break;

            case 1:
                ISpectrumObj = new SpectrumLib.Spectrums.BirdSh(this.Handle, MessageID.SPECTRUEME_SUCCED, MessageID.SPECTRUM_ERROR);
                break;

            case 2:
                ISpectrumObj = new SpectrumLib.Spectrums.Deli(this.Handle, MessageID.SPECTRUEME_SUCCED, MessageID.SPECTRUM_ERROR);
                break;

            case 3:
                ISpectrumObj = new SpectrumLib.Spectrums.FanShuang(this.Handle, MessageID.SPECTRUEME_SUCCED, MessageID.SPECTRUM_ERROR);
                break;
            }

            ISpectrumObj.EnableLog();

            //绑定RBW
            Bind(comboBoxRbw);

            if (type == 0)
            {
                comboBoxVbw.Enabled = false;
                comboBoxVbw.Visible = false;
                label19.Visible     = false;
            }
            else if (type == 1)
            {
                //绑定VBW
                Bind(comboBoxVbw);
            }
            else
            {
                comboBoxVbw.Enabled = false;
                comboBoxVbw.Visible = false;
                label19.Visible     = false;
            }

            //绑定Fun
            BindFun();

            //扫描对象
            exe_params           = new SweepParams();
            exe_params.SweepType = SweepType.Time_Sweep;
            exe_params.WndHandle = this.Handle;
            exe_params.DevInfo   = new DeviceInfo();
            exe_params.TmeParam  = new TimeSweepParam();
            exe_params.WndHandle = _handle;
            power1_Handle        = new ManualResetEvent(false);
            power2_Handle        = new ManualResetEvent(false);
            //建立射频功放层
            RFSignal.SetWndHandle(exe_params.WndHandle);

            btnRF1_On.Enabled  = true;
            btnRF1_Off.Enabled = false;

            btnRF2_On.Enabled  = true;
            btnRF2_Off.Enabled = false;

            btnSpe_On.Enabled  = true;
            btnSpe_Off.Enabled = false;

            //范围
            numericUpDownFreq1.Minimum = (decimal)App_Settings.sgn_1.Min_Freq;
            numericUpDownFreq1.Maximum = (decimal)App_Settings.sgn_1.Max_Freq;
            numericUpDownFreq2.Minimum = (decimal)App_Settings.sgn_2.Min_Freq;
            numericUpDownFreq2.Maximum = (decimal)App_Settings.sgn_2.Max_Freq;
            numericUpDownRF1.Minimum   = (decimal)App_Settings.sgn_1.Min_Power;
            numericUpDownRF1.Maximum   = (decimal)App_Settings.sgn_1.Max_Power;
            numericUpDownRF2.Minimum   = (decimal)App_Settings.sgn_2.Min_Power;
            numericUpDownRF2.Maximum   = (decimal)App_Settings.sgn_2.Max_Power;

            //初值
            numericUpDownFreq1.Value = (decimal)App_Settings.sgn_1.Min_Freq;
            numericUpDownFreq2.Value = (decimal)App_Settings.sgn_2.Min_Freq;
            numericUpDownRF1.Value   = (decimal)App_Settings.sgn_1.Min_Power;
            numericUpDownRF2.Value   = (decimal)App_Settings.sgn_2.Min_Power;
            numericUpDownSpe.Value   = (decimal)App_Settings.sgn_1.Min_Freq;

            if (App_Configure.Cnfgs.Cal_Use_Table)
            {
                btnOffset.Enabled = false;
                chkTable.Checked  = true;
                rad_frd.Enabled   = true;
                rad_rev.Enabled   = true;
            }
            else
            {
                btnOffset.Enabled = true;
                chkTable.Checked  = false;
                rad_frd.Enabled   = false;
                rad_rev.Enabled   = false;
            }
        }
예제 #9
0
        /// <summary>
        /// RF_Set
        /// </summary>
        /// <param name="Addr">功放地址</param>
        /// <param name="Lvl">命令等级</param>
        /// <param name="P">功率</param>
        /// <param name="F">频率</param>
        /// <param name="RFon">开启功放标识</param>
        /// <param name="ignoreRFon">忽略开功放标识</param>
        /// <param name="useP">设置功率标识</param>
        /// <param name="useF">设置频率标识</param>
        /// <returns>true成功 false超时</returns>
        private bool RF_Set(int Addr,
                            int Lvl,
                            float P,
                            float F,
                            bool RFon,
                            bool ignoreRFon,
                            bool useP,
                            bool useF)
        {
            bool RF_Succ = true;

            RFSignal.RFClear(Addr, Lvl);

            //紫光功放改变频率会影响功率,需先设置频率;韩国功放改变功率会影响频率,需先设置功率
            if (RF_Type == 0)
            {
                if (useF)
                {
                    RFSignal.RFFreq(Addr, Lvl, F);
                }

                if (useP)
                {
                    RFSignal.RFPower(Addr, Lvl, P);
                }
            }
            else
            {
                if (useP)
                {
                    RFSignal.RFPower(Addr, Lvl, P);
                }

                if (useF)
                {
                    RFSignal.RFFreq(Addr, Lvl, F);
                }
            }

            if (!ignoreRFon)
            {
                if (RFon)
                {
                    RFSignal.RFOn(Addr, Lvl);
                }
                else
                {
                    RFSignal.RFOff(Addr, Lvl);
                }
            }

            RFSignal.RFStart(Addr);


            //等待功放
            if (Addr == exe_params.DevInfo.RF_Addr1)
            {
                RF_Succ = power1_Handle.WaitOne(1000, true);
                power1_Handle.Reset();
            }
            else
            {
                RF_Succ = power2_Handle.WaitOne(1000, true);
                power2_Handle.Reset();
            }

            if (RFon == true && ignoreRFon == false)
            {
                if (RF_Type == 0)
                {
                    if (Addr == exe_params.DevInfo.RF_Addr1)
                    {
                        Thread.Sleep(Wait_time1);
                    }
                    else
                    {
                        Thread.Sleep(Wait_time2);
                    }
                }
            }
            else
            {
                if (RF_Type == 0)
                {
                    Thread.Sleep(50);
                }
                else
                {
                    Thread.Sleep(150);
                }
            }

            //返回通信超时的情况
            return(!RF_Succ);
        }
예제 #10
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
        }
예제 #11
0
        public static bool Fwd(int num)
        {
            bool rev = false;

            int[] value = new int[1];

            //if (App_Configure.Cnfgs.Gpio == 0)
            //{
            if (num == 1)
            {
                // GPO 1= 0,2=1
                //GetPortVal(0x084d, value, 1);
                if (SetPortVal(0x084d, 0x80, 1))
                {
                    App_Configure.Cnfgs.Channel = 0;
                    rev = true;
                }
                //GetPortVal(0x084d, value, 1);
                //if (SetPortVal(0x084d, (value[0] | 0x40), 1))
                //{
                //    App_Configure.Cnfgs.Channel = 0;
                //    rev = true;
                //}
            }
            else if (num == 2)
            {
                // GPO 1= 1,2=1
                //GetPortVal(0x084d, value, 1);
                if (SetPortVal(0x084d, 0x81, 1))
                {
                    App_Configure.Cnfgs.Channel = 1;
                    rev = true;
                }
                //GetPortVal(0x084d, value, 1);
                //if (SetPortVal(0x084d, 0x40, 1))
                //{
                //    App_Configure.Cnfgs.Channel = 1;
                //    rev = true;
                //}
            }
            //
            if (App_Configure.Cnfgs.Ms_switch_port_count >= 2 && App_Configure.Cnfgs.Gpio == 0)
            {
                int[] original = new int[1];

                GetPortVal(0x084d, value, 1);
                if (SetPortVal(0x084d, value[0] | 0x01, 1))
                {
                    App_Configure.Cnfgs.Channel = 1;
                    rev = true;
                }
                if (App_Configure.Cnfgs.Ms_switch_port_count >= 1)
                {
                    RFSignal.RFClear(comAddr, RFPriority.LvlTwo);
                    RFSignal.RFAssistGpo(comAddr, RFPriority.LvlTwo, 1);
                    RFSignal.RFStart(comAddr);
                }
            }

            return(rev);
        }
예제 #12
0
 public static void FinaRFSignal()
 {
     RFSignal.RFFinalize();
 }