Example #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);
        }
Example #2
0
 public void CloneReference(ref PowerStatus ps1,
                            ref PowerStatus ps2,
                            ref SweepResult sr,
                            ref RFErrors rfr_errors1,
                            ref RFErrors rfr_errors2)
 {
     ps1         = rfStatus_1;
     ps2         = rfStatus_2;
     sr          = sweepValue;
     rfr_errors1 = rfErrors_1;
     rfr_errors2 = rfErrors_2;
 }
Example #3
0
        /// <summary>
        /// 建立实例变量
        /// </summary>
        internal void InitSweep()
        {
            ctrl = new SweepCtrl();

            exe_params = new SweepParams();

            power1_Handle = new ManualResetEvent(false);

            power2_Handle = new ManualResetEvent(false);

            thrd_Handle = new ManualResetEvent(false);

            sweepValue = new SweepResult();

            rfStatus_1 = new PowerStatus();

            rfStatus_2 = new PowerStatus();

            rfErrors_1 = new RFErrors();

            rfErrors_2 = new RFErrors();
        }
Example #4
0
        private void btnRF2_On_Click(object sender, EventArgs e)
        {
            numericUpDownFreq2.Enabled = false;
            numericUpDownRF2.Enabled   = false;
            btnRF2_On.Enabled          = false;
            btnRF2_Off.Enabled         = true;

            float freq_2  = (float)numericUpDownFreq2.Value;
            float power_2 = (float)numericUpDownRF2.Value;

            exe_params.TmeParam.F2 = freq_2;
            exe_params.TmeParam.P2 = OffsetPower(freq_2, power_2, 2);

            exe_params.DevInfo.RF_Addr2 = App_Configure.Cnfgs.ComAddr2;
            exe_params.RFInvolved       = RFInvolved.Rf_2;
            rfStatus_2 = new PowerStatus();
            rfErrors_2 = new RFErrors();

            thdRF2 = new Thread(StartRF);
            thdRF2.IsBackground = true;
            thdRF2.Start(RFInvolved.Rf_2);
        }
Example #5
0
        private void btnRF1_On_Click(object sender, EventArgs e)
        {
            numericUpDownFreq1.Enabled = false;
            numericUpDownRF1.Enabled   = false;
            btnRF1_On.Enabled          = false;
            btnRF1_Off.Enabled         = true;

            float freq_1  = (float)numericUpDownFreq1.Value;
            float power_1 = (float)numericUpDownRF1.Value;

            exe_params.TmeParam.F1 = freq_1;
            exe_params.TmeParam.P1 = OffsetPower(freq_1, power_1, 1);

            exe_params.DevInfo.RF_Addr1 = App_Configure.Cnfgs.ComAddr1;
            exe_params.RFInvolved       = RFInvolved.Rf_1;
            rfStatus_1 = new PowerStatus();
            rfErrors_1 = new RFErrors();

            thdRF1 = new Thread(StartRF);
            thdRF1.IsBackground = true;
            thdRF1.Start(RFInvolved.Rf_1);
        }
Example #6
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);
        }
Example #7
0
 public static extern void RFStatus(int ComAddr,
                                    ref PowerStatus dest);