private void RtlSdrControllerDialog_VisibleChanged(object sender, EventArgs e)
        {
            refreshTimer.Enabled = Visible;
            if (Visible)
            {
                samplerateComboBox.Enabled   = !_owner.Device.IsStreaming;
                deviceComboBox.Enabled       = !_owner.Device.IsStreaming;
                samplingModeComboBox.Enabled = !_owner.Device.IsStreaming;

                if (!_owner.Device.IsStreaming)
                {
                    var devices = DeviceDisplay.GetActiveDevices();
                    deviceComboBox.Items.Clear();
                    deviceComboBox.Items.AddRange(devices);

                    for (var i = 0; i < devices.Length; i++)
                    {
                        if (devices[i].Index == ((DeviceDisplay)deviceComboBox.Items[i]).Index)
                        {
                            _initialized = false;
                            deviceComboBox.SelectedIndex = i;
                            _initialized = true;
                            break;
                        }
                    }
                }
            }
        }
        public RtlSdrControllerDialog(RtlSdrIO owner)
        {
            InitializeComponent();

            _owner = owner;
            var devices = DeviceDisplay.GetActiveDevices();

            deviceComboBox.Items.Clear();
            deviceComboBox.Items.AddRange(devices);

            frequencyCorrectionNumericUpDown.Value = Utils.GetIntSetting("RTLFrequencyCorrection", 0);
            samplerateComboBox.SelectedIndex       = Utils.GetIntSetting("RTLSampleRate", 3);
            samplingModeComboBox.SelectedIndex     = Utils.GetIntSetting("RTLSamplingMode", 0);
            offsetTuningCheckBox.Checked           = Utils.GetBooleanSetting("RTLOffsetTuning");
            rtlAgcCheckBox.Checked   = Utils.GetBooleanSetting("RTLChipAgc");
            tunerAgcCheckBox.Checked = Utils.GetBooleanSetting("RTLTunerAgc");
            tunerGainTrackBar.Value  = Utils.GetIntSetting("RTLTunerGain", 0);

            tunerAgcCheckBox.Enabled     = samplingModeComboBox.SelectedIndex == 0;
            gainLabel.Visible            = tunerAgcCheckBox.Enabled && !tunerAgcCheckBox.Checked;
            tunerGainTrackBar.Enabled    = tunerAgcCheckBox.Enabled && !tunerAgcCheckBox.Checked;
            offsetTuningCheckBox.Enabled = samplingModeComboBox.SelectedIndex == 0;

            _initialized = true;
        }
Example #3
0
 private void RtlSdrControllerDialog_VisibleChanged(object sender, EventArgs e)
 {
     this.refreshTimer.Enabled = base.Visible;
     if (base.Visible)
     {
         this.samplerateComboBox.Enabled   = !this._owner.Device.IsStreaming;
         this.deviceComboBox.Enabled       = !this._owner.Device.IsStreaming;
         this.samplingModeComboBox.Enabled = !this._owner.Device.IsStreaming;
         if (!this._owner.Device.IsStreaming)
         {
             DeviceDisplay[] activeDevices = DeviceDisplay.GetActiveDevices();
             this.deviceComboBox.Items.Clear();
             this.deviceComboBox.Items.AddRange(activeDevices);
             int num = 0;
             while (true)
             {
                 if (num < activeDevices.Length)
                 {
                     if (activeDevices[num].Index != ((DeviceDisplay)this.deviceComboBox.Items[num]).Index)
                     {
                         num++;
                         continue;
                     }
                     break;
                 }
                 return;
             }
             this._initialized = false;
             this.deviceComboBox.SelectedIndex = num;
             this._initialized = true;
         }
     }
 }
        public static DeviceDisplay[] GetActiveDevices()
        {
            var count = NativeMethods.rtlsdr_get_device_count();
            var result = new DeviceDisplay[count];

            for (var i = 0u; i < count; i++)
            {
                var name = NativeMethods.rtlsdr_get_device_name(i);
                result[i] = new DeviceDisplay { Index = i, Name = name };
            }

            return result;
        }
        public static DeviceDisplay[] GetActiveDevices()
        {
            var count  = NativeMethods.rtlsdr_get_device_count();
            var result = new DeviceDisplay[count];

            for (var i = 0u; i < count; i++)
            {
                var name = NativeMethods.rtlsdr_get_device_name(i);
                result[i] = new DeviceDisplay {
                    Index = i, Name = name
                };
            }

            return(result);
        }
Example #6
0
 private void deviceComboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (this._initialized)
     {
         DeviceDisplay deviceDisplay = (DeviceDisplay)this.deviceComboBox.SelectedItem;
         if (deviceDisplay != null)
         {
             try
             {
                 this._owner.SelectDevice(deviceDisplay.Index);
             }
             catch (Exception ex)
             {
                 this.deviceComboBox.SelectedIndex = -1;
                 MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
             }
         }
     }
 }
Example #7
0
 public static DeviceDisplay[] GetActiveDevices()
 {
     uint deviceCount = NativeMethods.rtlsdr_get_device_count();
       DeviceDisplay[] deviceDisplayArray = new DeviceDisplay[(IntPtr) deviceCount];
       for (uint index = 0U; index < deviceCount; ++index)
       {
     string deviceName = NativeMethods.rtlsdr_get_device_name(index);
     deviceDisplayArray[(IntPtr) index] = new DeviceDisplay()
     {
       Index = index,
       Name = string.Concat(new object[4]
       {
     (object) deviceName,
     (object) " (",
     (object) index,
     (object) ")"
       })
     };
       }
       return deviceDisplayArray;
 }
Example #8
0
 public void Open()
 {
     DeviceDisplay[] activeDevices = DeviceDisplay.GetActiveDevices();
     DeviceDisplay[] array         = activeDevices;
     foreach (DeviceDisplay deviceDisplay in array)
     {
         try
         {
             this.SelectDevice(deviceDisplay.Index);
             return;
         }
         catch (ApplicationException)
         {
         }
     }
     if (activeDevices.Length > 0)
     {
         throw new ApplicationException(activeDevices.Length + " compatible devices have been found but are all busy");
     }
     throw new ApplicationException("No compatible devices found");
 }
Example #9
0
 public RtlSdrControllerDialog(RtlSdrIO owner)
 {
     this.InitializeComponent();
     this._owner = owner;
     DeviceDisplay[] activeDevices = DeviceDisplay.GetActiveDevices();
     this.deviceComboBox.Items.Clear();
     this.deviceComboBox.Items.AddRange(activeDevices);
     this.frequencyCorrectionNumericUpDown.Value = Utils.GetIntSetting("RTLFrequencyCorrection", 0);
     this.samplerateComboBox.SelectedIndex       = Utils.GetIntSetting("RTLSampleRate", 3);
     this.samplingModeComboBox.SelectedIndex     = Utils.GetIntSetting("RTLSamplingMode", 0);
     this.offsetTuningCheckBox.Checked           = Utils.GetBooleanSetting("RTLOffsetTuning");
     this.rtlAgcCheckBox.Checked       = Utils.GetBooleanSetting("RTLChipAgc");
     this.tunerAgcCheckBox.Checked     = Utils.GetBooleanSetting("RTLTunerAgc");
     this.lnaGainTrackBar.Value        = Utils.GetIntSetting("LNAGain", 0);
     this.mixerGainTrackBar.Value      = Utils.GetIntSetting("MixerGain", 0);
     this.vgaGainTrackBar.Value        = Utils.GetIntSetting("VGAGain", 0);
     this.tunerAgcCheckBox.Enabled     = (this.samplingModeComboBox.SelectedIndex == 0);
     this.vgaGainTrackBar.Enabled      = (this.tunerAgcCheckBox.Enabled && !this.tunerAgcCheckBox.Checked);
     this.offsetTuningCheckBox.Enabled = (this.samplingModeComboBox.SelectedIndex == 0);
     this._initialized = true;
 }
Example #10
0
        public void ConfigureGUI()
        {
            this.tunerTypeLabel.Text          = this._owner.Device.TunerType.ToString();
            this.offsetTuningCheckBox.Enabled = this._owner.Device.SupportsOffsetTuning;
            int num = 0;

            while (true)
            {
                if (num < this.deviceComboBox.Items.Count)
                {
                    DeviceDisplay deviceDisplay = (DeviceDisplay)this.deviceComboBox.Items[num];
                    if (deviceDisplay.Index != this._owner.Device.Index)
                    {
                        num++;
                        continue;
                    }
                    break;
                }
                return;
            }
            this.deviceComboBox.SelectedIndex = num;
        }
Example #11
0
        public void Open()
        {
            var devices = DeviceDisplay.GetActiveDevices();

            foreach (var device in devices)
            {
                try
                {
                    SelectDevice(device.Index);
                    return;
                }
                catch (ApplicationException)
                {
                    // Just ignore it
                }
            }
            if (devices.Length > 0)
            {
                throw new ApplicationException(devices.Length + " compatible devices have been found but are all busy");
            }
            throw new ApplicationException("No compatible devices found");
        }