Exemplo n.º 1
0
        private void BladeRFControllerDialog_VisibleChanged(object sender, EventArgs e)
        {
            refreshTimer.Enabled = Visible;
            if (Visible)
            {
                deviceComboBox.Enabled = !_owner.Device.IsStreaming;
                xb200Checkbox.Enabled  = !_owner.Device.IsStreaming;

                if (!_owner.Device.IsStreaming)
                {
                    var devices = DeviceDisplay.GetActiveDevices();
                    deviceComboBox.Items.Clear();
                    if (devices != null)
                    {
                        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;
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        public BladeRFControllerDialog(BladeRFIO owner)
        {
            InitializeComponent();

            _owner = owner;
            InitSampleRates();
            InitBandwidths();
            InitXB200Filters();
            var devices = DeviceDisplay.GetActiveDevices();

            deviceComboBox.Items.Clear();
            if (devices != null)
            {
                deviceComboBox.Items.AddRange(devices);
            }

            samplerateComboBox.SelectedIndex   = Utils.GetIntSetting("BladeRFSampleRate", 3);
            samplingModeComboBox.SelectedIndex = Utils.GetIntSetting("BladeRFSamplingMode", (int)bladerf_sampling.BLADERF_SAMPLING_INTERNAL);
            rxVga1GainTrackBar.Value           = Utils.GetIntSetting("BladeRFVGA1Gain", 20);
            rxVga2GainTrackBar.Value           = Utils.GetIntSetting("BladeRFVGA2Gain", 20);
            lnaGainTrackBar.Value           = Utils.GetIntSetting("BladeRFLNAGain", (int)bladerf_lna_gain.BLADERF_LNA_GAIN_MID);
            fpgaTextBox.Text                = Utils.GetStringSetting("BladeRFFPGA", "");
            bandwidthComboBox.SelectedIndex = Utils.GetIntSetting("BladeRFBandwidth", 0);

            xb200Checkbox.Checked             = Utils.GetBooleanSetting("BladeRFXB200Enabled");
            xb200FilterCombobox.SelectedIndex = Utils.GetIntSetting("BladeRFXB200Filter", 0);

            labelVersion.Text = "libbladerf " + NativeMethods.bladerf_version().describe;

            rxVga1gainLabel.Text = rxVga1GainTrackBar.Value + " dB";
            rxVga2gainLabel.Text = rxVga2GainTrackBar.Value + " dB";
            lnaGainLabel.Text    = String.Format("{0} dB", 3 * (lnaGainTrackBar.Value - 1));;

            _initialized = true;
        }
Exemplo n.º 3
0
 public void Open()
 {
     DeviceDisplay[] activeDevices = DeviceDisplay.GetActiveDevices();
     if (null == activeDevices)
     {
         throw new ApplicationException("No compatible devices found");
     }
     foreach (DeviceDisplay deviceDisplay in activeDevices)
     {
         try
         {
             SelectDevice(deviceDisplay.Serial);
             return;
         }
         catch
         {
         }
     }
     if (activeDevices.Length > 0)
     {
         throw new ApplicationException(activeDevices.Length + " compatible devices have been found but are all busy");
     }
     else
     {
         throw new ApplicationException("No compatible devices found");
     }
 }