public virtual bool OpenTuner() { /* display the wait message */ #if false WaitDialog waitDlg = new WaitDialog(); waitDlg.Show(); waitDlg.Refresh(); #endif try { } catch (BadImageFormatException e) { ErrorMessage = "Unsupported architecture."; base.Close(); return(false); } catch (Exception e) { ErrorMessage = "Unhandled exception." + Environment.NewLine + e; base.Close(); return(false); } ErrorMessage = ""; SelectFiles(true); Connected = true; /* close wait dialog and show ours */ #if false waitDlg.Close(); #endif Show(); radioAcqOff.Checked = true; radioTuner.Checked = true; radioAgcOff.Checked = true; chkAtt.Checked = false; chkPreAmp.Checked = false; radioTuner_CheckedChanged(null, null); chkAtt_CheckedChanged(null, null); chkPreAmp_CheckedChanged(null, null); radioAgcOff_CheckedChanged(null, null); radioAcqBlock.Checked = true; return(true); }
public virtual bool OpenTuner() { /* display the wait message */ #if false WaitDialog waitDlg = new WaitDialog(); waitDlg.Show(); waitDlg.Refresh(); #endif USBRX = new USBRXDevice(); //USBRX.ShowConsole(true); USBRX.TunerCombination = TunerCombination; try { if (!USBRX.Init()) { ErrorMessage = "Could not find USB-RX on USB."; #if false waitDlg.Close(); #endif base.Close(); return(false); } } catch (BadImageFormatException e) { ErrorMessage = "Unsupported architecture."; #if false waitDlg.Close(); #endif base.Close(); return(false); } catch (Exception e) { ErrorMessage = "Unhandled exception." + Environment.NewLine + e; #if false waitDlg.Close(); #endif base.Close(); return(false); } ErrorMessage = ""; FilterList.NCOFreq = USBRX.Atmel.TCXOFreq; FilterList.UpdateFilters("Filter"); FilterList.AddFilters("..\\..\\..\\Filter"); FilterList.FilterSelected += new EventHandler(FilterList_FilterSelected); USBRX.Tuner.SamplingRateChanged += new EventHandler(Tuner_FilterRateChanged); USBRX.Tuner.FilterWidthChanged += new EventHandler(Tuner_FilterWidthChanged); USBRX.Tuner.InvertedSpectrumChanged += new EventHandler(Tuner_InvertedSpectrumChanged); USBRX.Tuner.DeviceDisappeared += new EventHandler(Tuner_DeviceDisappeared); frequencySelector1.UpperLimit = USBRX.Tuner.HighestFrequency; frequencySelector1.LowerLimit = USBRX.Tuner.LowestFrequency; CurrentFrequency = USBRX.Tuner.GetFrequency(); SetFreqTextbox(CurrentFrequency); _SampleSource = new ShmemSampleSource("USB-RX Device Control", USBRX.ShmemChannel, 1, 0); _SampleSource.InvertedSpectrum = InvertedSpectrum; _SampleSource.DataFormat = ByteUtil.eSampleFormat.Direct16BitIQFixedPointLE; ToolTip ttFreq = new ToolTip(); ttFreq.SetToolTip(frequencySelector1, "Min Freq: " + FrequencyFormatter.FreqToStringAccurate(USBRX.Tuner.LowestFrequency) + Environment.NewLine + "Max Freq: " + FrequencyFormatter.FreqToStringAccurate(USBRX.Tuner.HighestFrequency)); ttFreq.AutomaticDelay = 500; UpdateAtmelFilters(); SelectFiles(true); Connected = true; /* small hack to select first (widest) filter */ FilterList.FilterSelect(FilterList.FirstFilter); /* close wait dialog and show ours */ #if false waitDlg.Close(); #endif Show(); radioAcqOff.Checked = true; radioTunerInt.Checked = true; radioAgcOff.Checked = true; chkAtt.Checked = false; chkPreAmp.Checked = false; radioTunerInt_CheckedChanged(null, null); chkAtt_CheckedChanged(null, null); chkPreAmp_CheckedChanged(null, null); radioAgcOff_CheckedChanged(null, null); radioAcqBlock.Checked = true; DeviceOpened?.Invoke(this, EventArgs.Empty); return(true); }