Ejemplo n.º 1
0
        /// <summary>
        /// Checks if "/res:" is an argument and after ":" should be [high|normal|low] in each case, g_nResolutionPoints takes a different value
        /// </summary>
        /// <param name="args"></param>
        static void UpdateSweepPoints(string[] args)
        {
            string sRes = FindOptionValue(args, "/res:");

            if (!String.IsNullOrEmpty(sRes))
            {   //Sweep data points resolution devices allowed (not SA 3G)
                if (g_objRFE.IsHighResAvailable && !g_objRFE.ExpansionBoardActive || g_bIoTBoard)
                {
                    switch (sRes)
                    {
                    case "high": g_nResolutionPoints = 4096; break;

                    case "normal": g_nResolutionPoints = 1024; break;

                    case "low": g_nResolutionPoints = 112; break;

                    default:
                        if (g_bIoTBoard)
                        {
                            g_nResolutionPoints = 1024;
                        }
                        else
                        {
                            g_nResolutionPoints = 112;
                        }
                        break;
                    }
                }
            }
            Trace.WriteLine("Resolution sweep points: " + g_nResolutionPoints);
            g_objRFE.SendCommand_SweepDataPoints(g_nResolutionPoints);
        }
        ///res: [high|normal|low]
        static void UpdateSweepPoints(string[] args)
        {
            string sRes = FindOptionValue(args, "/res:");

            if (!String.IsNullOrEmpty(sRes))
            {
                switch (sRes)
                {
                case "high": g_nResolutionPoints = 4096; break;

                case "low": g_nResolutionPoints = 112; break;

                default:
                    if (g_bIoTBoard)
                    {
                        g_nResolutionPoints = 1024;
                    }
                    else
                    {
                        g_nResolutionPoints = 112;
                    }
                    break;

                case "normal": g_nResolutionPoints = 1024; break;
                }
            }
            Console.WriteLine("Resolution sweep points: " + g_nResolutionPoints);
            g_objRFE.SendCommand_SweepDataPoints(g_nResolutionPoints);
        }
        static bool SetFrequencyRange(string[] args)
        {
            bool bOk = true;

            if (g_bIoTBoard)
            {
                //For IOT use 1024 sweep points by default
                g_objRFE.SendCommand_SweepDataPoints(1024);
                WaitAndProcess(1, false);
            }

            //check command line frequency range arguments
            double fStartMHZ = 0.0f;
            double fStopMHZ  = 0.0f;

            foreach (string sVal in args)
            {
                if (sVal.Contains("/"))
                {
                    continue;
                }

                if (fStartMHZ == 0.0f)
                {
                    //Get first frequency value
                    fStartMHZ = Convert.ToDouble(sVal);
                    //Check frequency value is valid
                    bOk = fStartMHZ >= g_objRFE.MinFreqMHZ;
                    bOk = bOk && fStartMHZ < g_objRFE.MaxFreqMHZ;
                    if (!bOk)
                    {
                        Console.WriteLine("ERROR: Start frequency is outside range!");
                    }
                }
                else
                {
                    //Get the second frequency value
                    fStopMHZ = Convert.ToDouble(sVal);
                    //Check frequency value is valid
                    bOk = fStopMHZ > fStartMHZ;
                    bOk = bOk && fStopMHZ <= g_objRFE.MaxFreqMHZ;
                    if (!bOk)
                    {
                        Console.WriteLine("ERROR: Stop frequency is outside range!");
                    }
                }

                //if errors, no need to go on anymore
                if (!bOk)
                {
                    break;
                }
            }

            //Check if values were initialized
            bOk = bOk && (fStartMHZ >= g_objRFE.MinFreqMHZ) && (fStopMHZ <= g_objRFE.MaxFreqMHZ);
            if (!bOk)
            {
                Console.WriteLine("ERROR: Start/Stop frequency values missing or out of range");
            }

            if (bOk)
            {
                g_fStartMHZ     = fStartMHZ; //change flag value to recognize when new configuration is already in place
                g_bIgnoreSweeps = true;
                g_objRFE.UpdateDeviceConfig(fStartMHZ, fStopMHZ);
            }

            return(bOk);
        }