19 #include <QMessageBox> 21 #include <libbladeRF.h> 23 #include "ui_bladerf2inputgui.h" 37 ui(new
Ui::Bladerf2InputGui),
38 m_deviceUISet(deviceUISet),
39 m_forceSettings(true),
40 m_doApplySettings(true),
42 m_sampleRateMode(true),
45 m_lastEngineState(
DeviceAPI::StNotStarted)
55 ui->centerFrequency->setValueRange(7, f_min/1000, f_max/1000);
59 ui->sampleRate->setValueRange(8, min, max);
63 ui->bandwidth->setValueRange(5, min/1000, max/1000);
66 std::vector<BladeRF2Input::GainMode>::const_iterator it = modes.begin();
68 ui->gainMode->blockSignals(
true);
70 for (; it != modes.end(); ++it) {
71 ui->gainMode->addItem(it->m_name);
74 ui->gainMode->blockSignals(
false);
77 ui->gain->setMinimum(min);
78 ui->gain->setMaximum(max);
79 ui->gain->setPageStep(step);
80 ui->gain->setSingleStep(step);
82 ui->label_decim->setText(QString::fromUtf8(
"D\u2193"));
89 connect(startStopRightClickEnabler, SIGNAL(rightClick(
const QPoint &)),
this, SLOT(
openDeviceSettingsDialog(
const QPoint &)));
163 qint64 minLimit = f_min/1000 + deltaFrequency;
164 qint64 maxLimit = f_max/1000 + deltaFrequency;
166 minLimit = minLimit < 0 ? 0 : minLimit > 9999999 ? 9999999 : minLimit;
167 maxLimit = maxLimit < 0 ? 0 : maxLimit > 9999999 ? 9999999 : maxLimit;
169 qDebug(
"BladeRF2OutputGui::updateFrequencyLimits: delta: %lld min: %lld max: %lld", deltaFrequency, minLimit, maxLimit);
171 ui->centerFrequency->setValueRange(7, minLimit, maxLimit);
176 int64_t centerFrequency = kHzValue*1000;
179 ui->centerFrequency->setToolTip(QString(
"Main center frequency in kHz (LO: %1 kHz)").
arg(centerFrequency/1000));
191 ui->gain->setMinimum(min);
192 ui->gain->setMaximum(max);
193 ui->gain->setPageStep(step);
194 ui->gain->setSingleStep(step);
231 qDebug(
"BladeRF2InputGui::handleInputMessages: message: %s", message->
getIdentifier());
238 qDebug(
"BladeRF2InputGui::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu", notif->
getSampleRate(), notif->
getCenterFrequency());
265 ui->sampleRate->blockSignals(
true);
270 ui->sampleRateMode->setStyleSheet(
"QToolButton { background:rgb(60,60,60); }");
271 ui->sampleRateMode->setText(
"SR");
273 ui->sampleRate->setValueRange(8, min, max);
275 ui->sampleRate->setToolTip(
"Device to host sample rate (S/s)");
276 ui->deviceRateText->setToolTip(
"Baseband sample rate (S/s)");
278 ui->deviceRateText->setText(tr(
"%1k").
arg(QString::number(basebandSampleRate / 1000.0f,
'g', 5)));
282 ui->sampleRateMode->setStyleSheet(
"QToolButton { background:rgb(50,50,50); }");
283 ui->sampleRateMode->setText(
"BB");
287 ui->sampleRate->setToolTip(
"Baseband sample rate (S/s)");
288 ui->deviceRateText->setToolTip(
"Device to host sample rate (S/s)");
292 ui->sampleRate->blockSignals(
false);
301 DeviceSampleSource::FrequencyShiftScheme::FSHIFT_STD
303 ui->fcPos->setToolTip(tr(
"Relative position of device center frequency: %1 kHz").
arg(QString::number(fShift / 1000.0f,
'g', 5)));
331 ui->gain->setEnabled(
true);
333 ui->gain->setEnabled(
false);
353 ui->LOppmText->setText(QString(
"%1").
arg(QString::number(value/10.0,
'f', 1)));
396 if ((index <0) || (index > 6)) {
422 unsigned int uindex = index < 0 ? 0 : (
unsigned int) index;
424 if (uindex < modes.size())
430 if (mode.
m_value == BLADERF_GAIN_MANUAL)
433 ui->gain->setEnabled(
true);
435 ui->gain->setEnabled(
false);
446 ui->gainText->setText(tr(
"%1 dB").
arg(value));
473 ui->record->setStyleSheet(
"QToolButton { background-color : red; }");
475 ui->record->setStyleSheet(
"QToolButton { background:rgb(79,79,79); }");
492 qDebug() <<
"BladeRF2InputGui::updateHardware";
514 ui->startStop->setStyleSheet(
"QToolButton { background:rgb(79,79,79); }");
517 ui->startStop->setStyleSheet(
"QToolButton { background-color : blue; }");
520 ui->startStop->setStyleSheet(
"QToolButton { background-color : green; }");
523 ui->startStop->setStyleSheet(
"QToolButton { background-color : red; }");
Message * pop()
Pop message from queue.
const QString & getReverseAPIAddress() const
static qint32 calculateFrequencyShift(int log2Decim, fcPos_t fcPos, quint32 devSampleRate, FrequencyShiftScheme frequencyShiftScheme)
void push(Message *message, bool emitSignal=true)
Push message onto queue.
void setSampleRate(qint32 sampleRate)
DeviceSampleSource * getSampleSource()
Return pointer to the device sample source (single Rx) or nullptr.
void setUseReverseAPI(bool useReverseAPI)
MessageQueue * getInputMessageQueue()
uint16_t getReverseAPIDeviceIndex() const
QString errorMessage()
Last error message from the device engine.
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
GLSpectrum * getSpectrum()
Direct spectrum getter.
engine is before initialization
qint64 getCenterFrequency() const
EngineState state() const
Return the state of the device engine corresponding to the stream type.
uint16_t getReverseAPIPort() const
static bool match(const Message *message)
int getSampleRate() const
void setCenterFrequency(qint64 frequency)
virtual const char * getIdentifier() const
void setReverseAPIAddress(const QString &address)
void setReverseAPIDeviceIndex(uint16_t deviceIndex)
void setReverseAPIPort(uint16_t port)
bool useReverseAPI() const
T max(const T &x, const T &y)
T min(const T &x, const T &y)
unsigned __int64 uint64_t