private void HackRFControllerDialog_VisibleChanged(object sender, EventArgs e) { refreshTimer.Enabled = Visible; if (Visible) { samplerateComboBox.Enabled = !_owner.Device.IsStreaming; deviceComboBox.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 HackRFControllerDialog(HackRFIO owner) { InitializeComponent(); _owner = owner; var devices = DeviceDisplay.GetActiveDevices(); deviceComboBox.Items.Clear(); deviceComboBox.Items.AddRange(devices); samplerateComboBox.SelectedIndex = Utils.GetIntSetting("HackRFSampleRate", 3); tunerAmpCheckBox.Checked = Utils.GetBooleanSetting("HackRFTunerAmp"); tunerLNAGainTrackBar.Value = Utils.GetIntSetting("LNATunerGain", 3); tunerVGAGainTrackBar.Value = Utils.GetIntSetting("VGATunerGain", 12); tunerIFFreq.Value = Utils.GetIntSetting("HackRFIFFreq", 0); gainLNALabel.Text = (tunerLNAGainTrackBar.Value * LNAGainStep) + " dB"; gainVGALabel.Text = (tunerVGAGainTrackBar.Value * VGAGainStep) + " dB"; IFLabel.Text = (tunerIFFreq.Value + IFFreqOffset) + " MHz"; //gainLabel.Visible = tunerAmpCheckBox.Enabled && !tunerAmpCheckBox.Checked; //tunerGainTrackBar.Enabled = tunerAmpCheckBox.Enabled && !tunerAmpCheckBox.Checked; gainLNALabel.Visible = tunerLNAGainTrackBar.Enabled = true; gainVGALabel.Visible = tunerVGAGainTrackBar.Enabled = true; IFLabel.Visible = tunerIFFreq.Enabled = true; tunerAmpCheckBox.Enabled = true; _initialized = true; }
public static DeviceDisplay[] GetActiveDevices() { var count = 1; var result = new DeviceDisplay[count]; var name = NativeMethods.hackrf_board_id_name(1); result[0] = new DeviceDisplay { Index = 0, Name = name }; /* 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 HackRFControllerDialog(HackRFIO owner) { InitializeComponent(); _owner = owner; var devices = DeviceDisplay.GetActiveDevices(); deviceComboBox.Items.Clear(); deviceComboBox.Items.AddRange(devices); frequencyCorrectionNumericUpDown.Value = (decimal)Utils.GetDoubleSetting("HackRFFrequencyCorrection", 0); samplerateComboBox.SelectedIndex = Utils.GetIntSetting("HackRFSampleRate", 3); lnaGainTrackBar.Value = Utils.GetIntSetting("HackRFLNAGain", 0); vgaGainTrackBar.Value = Utils.GetIntSetting("HackRFVGAGain", 0); externalAmpCb.Checked = Utils.GetBooleanSetting("HackRFExternalAmp"); _initialized = true; }
public static DeviceDisplay[] GetActiveDevices() { var count = 1; var result = new DeviceDisplay[count]; var name = NativeMethods.hackrf_board_id_name(1); result[0] = new DeviceDisplay { Index = 0, Name = name }; /* * 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 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"); }