/// <summary>
 /// Gets the dominant marker amplitude in whatever current measurement unit was stored
 /// </summary>
 /// <param name="nMarkerID"></param>
 /// <returns></returns>
 public double GetMarkerAmplitude(int nMarkerID, RFExplorerSignalType eSignalType)
 {
     if (m_arrMarkers != null)
     {
         return(m_arrMarkers[nMarkerID][(int)eSignalType].Location.Y);
     }
     else
     {
         return(0.0);
     }
 }
 public void SetMarkerText(int nMarkerID, RFExplorerSignalType eType, string sText)
 {
     m_arrMarkers[nMarkerID][(int)eType].FullText = sText;
 }
 /// <summary>
 /// Update a marker amplitude based on signal type and marker ID
 /// </summary>
 /// <param name="nMarkerID"></param>
 /// <param name="eType"></param>
 /// <param name="dAmplitude"></param>
 public void UpdateMarker(int nMarkerID, RFExplorerSignalType eType, double dAmplitude)
 {
     m_arrMarkers[nMarkerID][(int)eType].Location.X = m_arrMarkers[nMarkerID][0].Location.X;
     m_arrMarkers[nMarkerID][(int)eType].Location.Y = dAmplitude;
     m_arrMarkers[nMarkerID][(int)eType].IsVisible  = true;
 }
示例#4
0
 private void OnWaterfallContextMaxHold_Click(object sender, EventArgs e)
 {
     m_eWaterfallSignal = RFExplorerSignalType.MaxHold;
     UpdateAllWaterfallMenuItems();
     UpdateWaterfall();
     m_controlWaterfall.Invalidate();
 }
示例#5
0
        private void OnMarkerTrackPeak_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem objMarkerPeak = (ToolStripMenuItem)sender;
            m_eTrackSignalPeak = (RFExplorerSignalType)objMarkerPeak.Tag;
            UpdateMenuMarkerPeakTrack();
            UpdateMarkerControlContents();

            if (m_MainTab.SelectedTab == m_tabSpectrumAnalyzer)
            {
                DisplaySpectrumAnalyzerData(); //redisplay all for markers update
            }
        }
示例#6
0
        private void RestoreSettingsXML(string sSettingsName)
        {
            try
            {
                m_Markers.HideAllMarkers();                                

                DataRow[] objRowCol = m_DataSettings.Tables[_Common_Settings].Select("Name='" + sSettingsName + "'");
                if (objRowCol.Length > 0)
                {
                    DataRow objRowDefault = objRowCol[0];
                    double fStartFrequencyMHZ = (double)objRowDefault[_StartFreq];
                    double fStepFrequencyMHZ = (double)objRowDefault[_StepFreq];
                    double fAmplitudeTop = (double)objRowDefault[_TopAmp];
                    double fAmplitudeBottom = (double)objRowDefault[_BottomAmp];
                    numericIterations.Value = (UInt16)objRowDefault[_Calculator];
                    menuAveragedTrace.Checked = (bool)objRowDefault[_ViewAvg];
                    menuRealtimeTrace.Checked = (bool)objRowDefault[_ViewRT];
                    menuMinTrace.Checked = (bool)objRowDefault[_ViewMin];
                    menuMaxTrace.Checked = (bool)objRowDefault[_ViewMax];

                    if (m_DataSettings.Tables[_Common_Settings].Columns[_ViewMaxHold] == null)
                    {
                        //Introduced in v1.11.0.1307, may not exist before this date
                        m_DataSettings.Tables[_Common_Settings].Columns.Add(new DataColumn(_ViewMaxHold, System.Type.GetType("System.Boolean")));
                    }

                    try
                    {
                        if ((objRowDefault[_ViewMaxHold] != null) && (!String.IsNullOrEmpty(objRowDefault[_ViewMaxHold].ToString())))
                        {
                            menuMaxHoldTrace.Checked = (bool)objRowDefault[_ViewMaxHold];
                        }
                        else
                        {
                            objRowDefault[_ViewMaxHold] = menuMaxHoldTrace.Checked;
                        }
                    }
                    catch {}

                    if (m_DataSettings.Tables[_Common_Settings].Columns[_MarkerTrackSignal] == null)
                    {
                        //Introduced in v1.11.0.1402, may not exist before this date
                        for (int nInd = 1; nInd <= MarkerCollection.MAX_MARKERS; nInd++)
                        {
                            m_DataSettings.Tables[_Common_Settings].Columns.Add(new DataColumn(_MarkerEnabled + nInd.ToString(), System.Type.GetType("System.Boolean")));
                            if (nInd != 1)
                            {
                                m_DataSettings.Tables[_Common_Settings].Columns.Add(new DataColumn(_MarkerFrequency + nInd.ToString(), System.Type.GetType("System.Double")));
                            }
                            else
                            {
                                m_DataSettings.Tables[_Common_Settings].Columns.Add(new DataColumn(_MarkerTrackSignal, System.Type.GetType("System.UInt16")));
                            }
                        }
                    }

                    try
                    {
                        if ((objRowDefault[_MarkerTrackSignal] != null) && (!String.IsNullOrEmpty(objRowDefault[_MarkerTrackSignal].ToString())))
                        {
                            for (int nInd = 1; nInd <= MarkerCollection.MAX_MARKERS; nInd++)
                            {
                                if ((bool)objRowDefault[_MarkerEnabled + nInd.ToString()])
                                {
                                    m_Markers.EnableMarker(nInd - 1);
                                }
                                if (nInd != 1)
                                {
                                    m_Markers.SetMarkerFrequency(nInd - 1, (double)objRowDefault[_MarkerFrequency + nInd.ToString()]);
                                }
                                else
                                {
                                    m_eTrackSignalPeak = (RFExplorerSignalType)(UInt16)objRowDefault[_MarkerTrackSignal];
                                }
                            }
                        }
                        else
                        {
                            for (int nInd = 1; nInd <= MarkerCollection.MAX_MARKERS; nInd++)
                            {
                                objRowDefault[_MarkerEnabled + nInd.ToString()] = m_Markers.IsMarkerEnabled(nInd - 1);
                                if (nInd != 1)
                                {
                                    objRowDefault[_MarkerFrequency + nInd.ToString()] = m_Markers.GetMarkerFrequency(nInd - 1);
                                }
                                else
                                {
                                    objRowDefault[_MarkerTrackSignal] = 0;
                                }
                            }
                        }
                    }
                    catch {};

                    if (m_DataSettings.Tables[_Common_Settings].Columns[_RFGenStartFreq] == null)
                    {
                        //Introduced in v1.12.1409, may not exist in all files
                        m_DataSettings.Tables[_Common_Settings].Columns.Add(new DataColumn(_RFGenStartFreq, System.Type.GetType("System.Double")));
                        m_DataSettings.Tables[_Common_Settings].Columns.Add(new DataColumn(_RFGenStopFreq, System.Type.GetType("System.Double")));
                        m_DataSettings.Tables[_Common_Settings].Columns.Add(new DataColumn(_RFGenSteps, System.Type.GetType("System.UInt16")));
                        m_DataSettings.Tables[_Common_Settings].Columns.Add(new DataColumn(_RFGenPower, System.Type.GetType("System.UInt16")));
                        m_DataSettings.Tables[_Common_Settings].Columns.Add(new DataColumn(_RFGenStepTime, System.Type.GetType("System.UInt16")));
                    }

                    try
                    {
                        if ((objRowDefault[_RFGenStartFreq] != null) && (!String.IsNullOrEmpty(objRowDefault[_RFGenStartFreq].ToString())))
                        {
                            double fRFGenStartFrequencyMHZ = (double)objRowDefault[_RFGenStartFreq];
                            m_sRFGenFreqSweepStart.Text = fRFGenStartFrequencyMHZ.ToString("f3");
                            double fRFGenStopFrequencyMHZ = (double)objRowDefault[_RFGenStopFreq];
                            m_sRFGenFreqSweepStop.Text = fRFGenStopFrequencyMHZ.ToString("f3");
                            UInt16 nRFGenSteps = (UInt16)objRowDefault[_RFGenSteps];
                            m_sRFGenFreqSweepSteps.Text = nRFGenSteps.ToString();
                            UInt16 nRFGenPower = (UInt16)objRowDefault[_RFGenPower];
                            UInt16 nRFGenStepTime = (UInt16)objRowDefault[_RFGenStepTime];
                        }
                        else
                        {
                            objRowDefault[_RFGenStartFreq] = Convert.ToDouble(m_sRFGenFreqSweepStart.Text);
                            objRowDefault[_RFGenStopFreq] = Convert.ToDouble(m_sRFGenFreqSweepStop.Text);
                            objRowDefault[_RFGenSteps] = Convert.ToDouble(m_sRFGenFreqSweepSteps.Text);
                            objRowDefault[_RFGenPower] = 0;
                            objRowDefault[_RFGenStepTime] = 0;
                        }
                    }
                    catch {};


                    if (m_objRFEAnalyzer.PortConnected == false)
                    {
                        //If device is disconnected, we just need to update visible parts of screen as otherwise it won't change
                        m_objRFEAnalyzer.AmplitudeTopDBM = fAmplitudeTop;
                        m_objRFEAnalyzer.AmplitudeBottomDBM = fAmplitudeBottom;

                        //Check to reinitiate buffer here, otherwise after changing it the receive function will not know the data was changed
                        if ((Math.Abs(m_objRFEAnalyzer.StartFrequencyMHZ - fStartFrequencyMHZ) >= 0.001) || (Math.Abs(m_objRFEAnalyzer.StepFrequencyMHZ - fStepFrequencyMHZ) >= 0.001))
                        {
                            m_objRFEAnalyzer.StartFrequencyMHZ = fStartFrequencyMHZ;
                            m_objRFEAnalyzer.StepFrequencyMHZ = fStepFrequencyMHZ;
                            CleanSweepData();
                        }
                        SetupSpectrumAnalyzerAxis(); //will update everything including the edit boxes
                    }
                    else
                    {
                        //if device is connected, we do not need to change anything: just ask the device to reconfigure and the new configuration will come back
                        SendNewConfig(fStartFrequencyMHZ, fStartFrequencyMHZ + fStepFrequencyMHZ * m_objRFEAnalyzer.FreqSpectrumSteps, fAmplitudeTop, fAmplitudeBottom);
                    }
                    m_sLastSettingsLoaded = sSettingsName;
                    UpdateTitleText_Analyzer();
                    UpdateButtonStatus();
                    UpdateMenuFromMarkerCollection();
                }
            }
            catch (Exception obEx)
            {
                ReportLog("ERROR RestoreSettingsXML:" + obEx.ToString(), true);
            }
        }
示例#7
0
        private void LoadProperties()
        {
#if CALLSTACK
            Console.WriteLine("CALLSTACK:LoadProperties");
#endif
            try
            {
                //Load standard WinForm .NET properties
                m_groupCOMPortAnalyzer.DefaultCOMSpeed = RFExplorerClient.Properties.Settings.Default.COMSpeed;
                m_groupCOMPortAnalyzer.DefaultCOMPort = RFExplorerClient.Properties.Settings.Default.COMPort;
                m_groupCOMPortGenerator.DefaultCOMSpeed = RFExplorerClient.Properties.Settings.Default.COMSpeedRFGen;
                m_groupCOMPortGenerator.DefaultCOMPort = RFExplorerClient.Properties.Settings.Default.COMPortRFGen;
                
                menuSaveOnClose.Checked = RFExplorerClient.Properties.Settings.Default.SaveOnClose;
                numericZoom.Value = RFExplorerClient.Properties.Settings.Default.ScreenZoom;
                menuShowPeak.Checked = RFExplorerClient.Properties.Settings.Default.ViewPeaks;
                menuShowControlArea.Checked = RFExplorerClient.Properties.Settings.Default.ShowControlArea;
                menuDarkMode.Checked = RFExplorerClient.Properties.Settings.Default.DarkMode;
                menuAutoLCDOff.Checked = RFExplorerClient.Properties.Settings.Default.AutoLCDOff;
                menuContinuousLog.Checked = RFExplorerClient.Properties.Settings.Default.ContinuousLog;
                string sTemp = RFExplorerClient.Properties.Settings.Default.DefaultDataFolder;
                comboCSVFieldSeparator.SelectedIndex = (int)RFExplorerClient.Properties.Settings.Default.CSVDelimiter;
                menuRFConnections.Checked = RFExplorerClient.Properties.Settings.Default.ShowRFConnections;
                menuSmoothSignals.Checked = RFExplorerClient.Properties.Settings.Default.SignalSmooth;
                menuThickTrace.Checked = RFExplorerClient.Properties.Settings.Default.ThickTrace;
                menuShowGrid.Checked = RFExplorerClient.Properties.Settings.Default.ShowGrid;
                menuSignalFill.Checked = RFExplorerClient.Properties.Settings.Default.SignalFill;
                m_eWaterfallSignal = (RFExplorerSignalType)RFExplorerClient.Properties.Settings.Default.WaterfallSignalType;
                menuShowAxisLabels.Checked = RFExplorerClient.Properties.Settings.Default.ShowAxisTitle;
                menuItemSoundAlarmLimitLine.Checked = RFExplorerClient.Properties.Settings.Default.LimitLinesSoundAlarm;
                menuAutoLoadAmplitudeData.Checked = RFExplorerClient.Properties.Settings.Default.AutoLoadCorrectionModel;
                menuRemoteAmplitudeUpdate.Checked = RFExplorerClient.Properties.Settings.Default.AutoAmplitudeRemoteUpdate;
                menuRemoteMaxHold.Checked = RFExplorerClient.Properties.Settings.Default.AutoMaxHold;
                if (m_objRFEAnalyzer != null)
                {
                    m_objRFEAnalyzer.UseMaxHold = menuRemoteMaxHold.Checked;
                }

                m_controlWaterfall.DrawFloor = RFExplorerClient.Properties.Settings.Default.WaterfallFloor;
                m_controlWaterfall.Transparent = RFExplorerClient.Properties.Settings.Default.TransparentWaterfall;
                m_controlWaterfall.PerspectiveView = (RFEWaterfallGL.SharpGLForm.WaterfallPerspectives)RFExplorerClient.Properties.Settings.Default.WaterfallView;
                UpdateAllWaterfallMenuItems();

                menuPlaceWaterfallAtBottom.Checked = RFExplorerClient.Properties.Settings.Default.WaterfallBottom;
                menuPlaceWaterfallOnTheRight.Checked = RFExplorerClient.Properties.Settings.Default.WaterfallRight;
                menuPlaceWaterfallNone.Checked = RFExplorerClient.Properties.Settings.Default.WaterfallNoSA;
                m_nRFGENIterationAverage.Value = RFExplorerClient.Properties.Settings.Default.TrackingAverage;


                DefineCommonFiles();

                m_sSettingsFile = m_sAppDataFolder + "\\" + _Filename_RFExplorer_Settings;
                try
                {
                    //Check if old settings file exists, and not the new one, thus move it to reuse it. This "old file" was
                    //created in v1.09.04 and has the problem of some users with limited access rights cannot create it.
                    string sOldSettingsFile = Assembly.GetExecutingAssembly().Location + ".Settings.xml";
                    if (File.Exists(sOldSettingsFile) && !File.Exists(m_sSettingsFile))
                    {
                        //We do not really move it as there may be restricted permissions and want to avoid any problem
                        File.Copy(sOldSettingsFile, m_sSettingsFile);
                        MessageBox.Show("NOTE: Old named-settings file has been migrated to the new location " + m_sSettingsFile);
                        //we try to delete it now, may fail but worth trying. We already copied it, anyway
                        File.Delete(sOldSettingsFile);
                    }
                }
                catch { };
                //open new settings file
                m_DataSettings = new DataSet("RF_Explorer_Settings");
                if (!File.Exists(m_sSettingsFile))
                {
                    CreateSettingsSchema();
                }

                //Load custom name saved properties
                if (m_DataSettings.Tables.Count == 0)
                {
                    //do not load it twice or records will be repeated
                    m_DataSettings.ReadXml(m_sSettingsFile);
                }
                PopulateReadedSettings();
                RestoreSettingsXML(_Default);

                if (!String.IsNullOrEmpty(sTemp))
                {
                    m_sDefaultDataFolder = sTemp;
                }
                edDefaultFilePath.Text = m_sDefaultDataFolder;

                if (RFExplorerClient.Properties.Settings.Default.CustomCommandList.Length > 0)
                {
                    string[] arrCustomCommands = null;
                    GetStringArrayFromStringList(RFExplorerClient.Properties.Settings.Default.CustomCommandList, out arrCustomCommands);
                    foreach (string sCmd in arrCustomCommands)
                    {
                        comboCustomCommand.Items.Add(sCmd);
                    }
                }

                if (RFExplorerClient.Properties.Settings.Default.UserDefinedTitleList.Length > 0)
                {
                    string[] arrStrings = null;
                    GetStringArrayFromStringList(RFExplorerClient.Properties.Settings.Default.UserDefinedTitleList, out arrStrings);
                    foreach (string sText in arrStrings)
                    {
                        if (sText.Length > 0)
                        {
                            m_dlgUserDefinedText.m_comboText.Items.Add(sText);
                        }
                    }
                }

                menuItemDBM.Checked = true;

                m_bPropertiesReadOk = true;
            }
            catch (Exception obEx)
            {
                MessageBox.Show(obEx.Message);
            }
        }
 public void SetMarkerText(int nMarkerID, RFExplorerSignalType eType, string sText)
 {
     m_arrMarkers[nMarkerID][(int)eType].FullText = sText;
 }
 /// <summary>
 /// Update a marker amplitude based on signal type and marker ID
 /// </summary>
 /// <param name="nMarkerID"></param>
 /// <param name="eType"></param>
 /// <param name="dAmplitude"></param>
 public void UpdateMarker(int nMarkerID, RFExplorerSignalType eType, double dAmplitude)
 {
     m_arrMarkers[nMarkerID][(int)eType].Location.X = m_arrMarkers[nMarkerID][0].Location.X;
     m_arrMarkers[nMarkerID][(int)eType].Location.Y = dAmplitude;
     m_arrMarkers[nMarkerID][(int)eType].IsVisible = true;
 }
示例#10
0
 /// <summary>
 /// Gets the dominant marker amplitude in whatever current measurement unit was stored
 /// </summary>
 /// <param name="nMarkerID"></param>
 /// <returns></returns>
 public double GetMarkerAmplitude(int nMarkerID, RFExplorerSignalType eSignalType)
 {
     if (m_arrMarkers != null)
     {
         return m_arrMarkers[nMarkerID][(int)eSignalType].Location.Y;
     }
     else
     {
         return 0.0;
     }
 }