public static DeviceDisplay[] GetActiveDevices() { uint count = LibraryWrapper.rtlsdr_get_device_count(); var result = new DeviceDisplay[count]; for (var i = 0u; i < count; i++) { string name = LibraryWrapper.rtlsdr_get_device_name(i); result[i] = new DeviceDisplay { Index = i, Name = name }; } return(result); }
public void Open() { DeviceDisplay[] devices = DeviceDisplay.GetActiveDevices(); foreach (DeviceDisplay 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"); }