Ejemplo n.º 1
0
 public SDRIQControllerDialog(SdrIqIO owner)
 {
     this.InitializeComponent();
     this._owner = owner;
     DeviceDisplay[] activeDevices = DeviceDisplay.GetActiveDevices();
     this.deviceComboBox.Items.Clear();
     this.deviceComboBox.Items.AddRange(activeDevices);
     this.samplerateComboBox.SelectedIndex = Utils.GetIntSetting("SDRIQSampleRate", 5);
     this.ifGainTrackBar.Value             = Utils.GetIntSetting("SDRIQIFGain", 5);
     this.rfGainTrackBar.Value             = Utils.GetIntSetting("SDRIQRFGain", 2);
     this._initialized = true;
 }
        public static DeviceDisplay[] GetActiveDevices()
        {
            var count = NativeMethods.sdriq_get_device_count();
            var result = new DeviceDisplay[count];

            for (var i = 0u; i < count; i++)
            {
                var name = "SDR-IQ #" + i + " S/N: " +NativeMethods.sdriq_get_serial_number(i);
                result[i] = new DeviceDisplay { Index = i, Name = name };
            }

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

            for (var i = 0u; i < count; i++)
            {
                var name = "SDR-IQ #" + i + " S/N: " + NativeMethods.sdriq_get_serial_number(i);
                result[i] = new DeviceDisplay {
                    Index = i, Name = name
                };
            }

            return(result);
        }
Ejemplo n.º 4
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);
             }
         }
     }
 }
Ejemplo n.º 5
0
        public void ConfigureGUI()
        {
            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;
        }
Ejemplo n.º 6
0
 public static DeviceDisplay[] GetActiveDevices()
 {
     uint deviceCount = NativeMethods.sdriq_get_device_count();
       DeviceDisplay[] deviceDisplayArray = new DeviceDisplay[(IntPtr) deviceCount];
       for (uint index = 0U; index < deviceCount; ++index)
       {
     string str = string.Concat(new object[4]
     {
       (object) "SDR-IQ #",
       (object) index,
       (object) " S/N: ",
       (object) NativeMethods.sdriq_get_serial_number(index)
     });
     deviceDisplayArray[(IntPtr) index] = new DeviceDisplay()
     {
       Index = index,
       Name = str
     };
       }
       return deviceDisplayArray;
 }
Ejemplo n.º 7
0
 public void Open()
 {
     NativeMethods.sdriq_destroy();
     NativeMethods.sdriq_initialise();
     DeviceDisplay[] activeDevices = DeviceDisplay.GetActiveDevices();
     DeviceDisplay[] array         = activeDevices;
     foreach (DeviceDisplay deviceDisplay in array)
     {
         try
         {
             this.SelectDevice(deviceDisplay.Index);
             return;
         }
         catch (ApplicationException)
         {
         }
     }
     NativeMethods.sdriq_destroy();
     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");
 }