20 #include "libhackrf/hackrf.h" 33 QString(
"HackRF Input"),
35 QString(
"(c) Edouard Griffiths, F4EXB"),
36 QString(
"https://github.com/f4exb/sdrangel"),
38 QString(
"https://github.com/f4exb/sdrangel")
70 hackrf_device_list_t *hackrf_devices = hackrf_device_list();
71 hackrf_device *hackrf_ptr;
72 read_partid_serialno_t read_partid_serialno;
75 for (i=0; i < hackrf_devices->devicecount; i++)
77 hackrf_error rc = (hackrf_error) hackrf_device_list_open(hackrf_devices, i, &hackrf_ptr);
79 if (rc == HACKRF_SUCCESS)
81 qDebug(
"HackRFPlugin::enumSampleSources: try to enumerate HackRF device #%d", i);
83 rc = (hackrf_error) hackrf_board_partid_serialno_read(hackrf_ptr, &read_partid_serialno);
85 if (rc != HACKRF_SUCCESS)
87 qDebug(
"HackRFPlugin::enumSampleSources: failed to read serial no: %s", hackrf_error_name(rc));
88 hackrf_close(hackrf_ptr);
92 uint32_t serial_msb = read_partid_serialno.serial_no[2];
93 uint32_t serial_lsb = read_partid_serialno.serial_no[3];
95 QString serial_str = QString::number(serial_msb, 16) + QString::number(serial_lsb, 16);
97 QString displayedName(QString(
"HackRF[%1] %2").
arg(i).
arg(serial_str));
109 qDebug(
"HackRFPlugin::enumSampleSources: enumerated HackRF device #%d", i);
111 hackrf_close(hackrf_ptr);
115 qDebug(
"HackRFPlugin::enumSampleSources: failed to enumerate HackRF device #%d: %s", i, hackrf_error_name(rc));
119 hackrf_device_list_free(hackrf_devices);
128 const QString& sourceId,
139 const QString& sourceId,
void registerSampleSource(const QString &sourceName, PluginInterface *plugin)
static DeviceHackRF & instance()
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Exposes a single input stream that can be one of the streams of a physical device.
QList< SamplingDevice > SamplingDevices