19 #include <QMessageBox> 21 #include <libbladeRF.h> 23 #include "ui_bladerf2outputgui.h" 38 m_deviceUISet(deviceUISet),
39 m_doApplySettings(true),
40 m_forceSettings(true),
42 m_sampleRateMode(true),
44 m_lastEngineState(
DeviceAPI::StNotStarted)
53 qDebug(
"BladeRF2OutputGui::BladeRF2OutputGui: getFrequencyRange: [%lu,%lu] step: %d", f_min, f_max, step);
55 ui->centerFrequency->setValueRange(7, f_min/1000, f_max/1000);
58 qDebug(
"BladeRF2OutputGui::BladeRF2OutputGui: getSampleRateRange: [%d,%d] step: %d", min, max, step);
60 ui->sampleRate->setValueRange(8, min, max);
63 qDebug(
"BladeRF2OutputGui::BladeRF2OutputGui: getBandwidthRange: [%d,%d] step: %d", min, max, step);
65 ui->bandwidth->setValueRange(5, min/1000, max/1000);
68 qDebug(
"BladeRF2OutputGui::BladeRF2OutputGui: getGlobalGainRange: [%d,%d] step: %d", min, max, step);
69 ui->gain->setMinimum((min-max)/1000);
70 ui->gain->setMaximum(0);
71 ui->gain->setPageStep(1);
72 ui->gain->setSingleStep(1);
79 connect(startStopRightClickEnabler, SIGNAL(rightClick(
const QPoint &)),
this, SLOT(
openDeviceSettingsDialog(
const QPoint &)));
151 qint64 minLimit = f_min/1000 + deltaFrequency;
152 qint64 maxLimit = f_max/1000 + deltaFrequency;
154 minLimit = minLimit < 0 ? 0 : minLimit > 9999999 ? 9999999 : minLimit;
155 maxLimit = maxLimit < 0 ? 0 : maxLimit > 9999999 ? 9999999 : maxLimit;
157 qDebug(
"BladeRF2OutputGui::updateFrequencyLimits: delta: %lld min: %lld max: %lld", deltaFrequency, minLimit, maxLimit);
159 ui->centerFrequency->setValueRange(7, minLimit, maxLimit);
164 int64_t centerFrequency = kHzValue*1000;
167 ui->centerFrequency->setToolTip(QString(
"Main center frequency in kHz (LO: %1 kHz)").
arg(centerFrequency/1000));
179 ui->gain->setMinimum((min-max)/1000);
180 ui->gain->setMaximum(0);
181 ui->gain->setPageStep(1);
182 ui->gain->setSingleStep(1);
192 ui->gain->setMaximum(0);
193 ui->gain->setSingleStep(1);
194 ui->gain->setPageStep(1);
219 qDebug(
"BladeRF2OutputGui::handleInputMessages: message: %s", message->
getIdentifier());
226 qDebug(
"BladeRF2OutputGui::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu", notif->
getSampleRate(), notif->
getCenterFrequency());
253 ui->sampleRate->blockSignals(
true);
257 ui->sampleRateMode->setStyleSheet(
"QToolButton { background:rgb(60,60,60); }");
258 ui->sampleRateMode->setText(
"SR");
259 ui->sampleRate->setValueRange(8, min, max);
261 ui->sampleRate->setToolTip(
"Host to device sample rate (S/s)");
262 ui->deviceRateText->setToolTip(
"Baseband sample rate (S/s)");
264 ui->deviceRateText->setText(tr(
"%1k").
arg(QString::number(basebandSampleRate / 1000.0f,
'g', 5)));
268 ui->sampleRateMode->setStyleSheet(
"QToolButton { background:rgb(50,50,50); }");
269 ui->sampleRateMode->setText(
"BB");
272 ui->sampleRate->setToolTip(
"Baseband sample rate (S/s)");
273 ui->deviceRateText->setToolTip(
"Host to device sample rate (S/s)");
277 ui->sampleRate->blockSignals(
false);
316 ui->LOppmText->setText(QString(
"%1").
arg(QString::number(value/10.0,
'f', 1)));
346 if ((index <0) || (index > 6)) {
364 ui->gainText->setText(tr(
"%1 dB").
arg(value));
398 qDebug() <<
"BladeRF2OutputGui::updateHardware";
415 ui->startStop->setStyleSheet(
"QToolButton { background:rgb(79,79,79); }");
418 ui->startStop->setStyleSheet(
"QToolButton { background-color : blue; }");
421 ui->startStop->setStyleSheet(
"QToolButton { background-color : green; }");
424 ui->startStop->setStyleSheet(
"QToolButton { background-color : red; }");
Message * pop()
Pop message from queue.
const QString & getReverseAPIAddress() const
void updateSampleRateAndFrequency()
Ui::BladeRF2OutputGui * ui
void push(Message *message, bool emitSignal=true)
Push message onto queue.
void setSampleRate(qint32 sampleRate)
void on_biasTee_toggled(bool checked)
void setCenterFrequencySetting(uint64_t kHzValue)
uint16_t m_reverseAPIPort
void setUseReverseAPI(bool useReverseAPI)
virtual QByteArray serialize() const
DeviceUISet * m_deviceUISet
bool getStartStop() const
uint16_t getReverseAPIDeviceIndex() const
BladeRF2Output * m_sampleSink
QString errorMessage()
Last error message from the device engine.
DeviceSampleSink * getSampleSink()
Return pointer to the device sample sink (single Tx) or nullptr.
qint64 m_transverterDeltaFrequency
QByteArray serialize() const
void getBandwidthRange(int &min, int &max, int &step)
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
void on_gain_valueChanged(int value)
GLSpectrum * getSpectrum()
Direct spectrum getter.
engine is before initialization
void openDeviceSettingsDialog(const QPoint &p)
qint64 getCenterFrequency() const
EngineState state() const
Return the state of the device engine corresponding to the stream type.
virtual bool deserialize(const QByteArray &data)
virtual qint64 getCenterFrequency() const
MessageQueue * getInputMessageQueue()
virtual ~BladeRF2OutputGui()
void on_startStop_toggled(bool checked)
void updateFrequencyLimits()
quint64 m_deviceCenterFrequency
Center frequency in device.
uint16_t getReverseAPIPort() const
void setName(const QString &name)
virtual void setCenterFrequency(qint64 centerFrequency)
void on_sampleRate_changed(quint64 value)
uint16_t m_reverseAPIDeviceIndex
void on_transverter_clicked()
static bool match(const Message *message)
BladeRF2OutputSettings m_settings
bool m_sampleRateMode
true: device, false: base band sample rate update mode
virtual bool handleMessage(const Message &message)
static MsgStartStop * create(bool startStop)
void on_bandwidth_changed(quint64 value)
virtual void setMessageQueueToGUI(MessageQueue *queue)
void on_sampleRateMode_toggled(bool checked)
MessageQueue m_inputMessageQueue
void on_centerFrequency_changed(quint64 value)
void blockApplySettings(bool block)
int getSampleRate() const
void setCenterFrequency(qint64 frequency)
virtual const char * getIdentifier() const
void getGlobalGainRange(int &min, int &max, int &step)
void on_interp_currentIndexChanged(int index)
void setReverseAPIAddress(const QString &address)
void setReverseAPIDeviceIndex(uint16_t deviceIndex)
void getFrequencyRange(uint64_t &min, uint64_t &max, int &step)
void setReverseAPIPort(uint16_t port)
void getSampleRateRange(int &min, int &max, int &step)
void handleInputMessages()
bool useReverseAPI() const
QString m_reverseAPIAddress
quint64 m_centerFrequency
BladeRF2OutputGui(DeviceUISet *deviceUISet, QWidget *parent=0)
T max(const T &x, const T &y)
bool deserialize(const QByteArray &data)
void on_LOppm_valueChanged(int value)
T min(const T &x, const T &y)
unsigned __int64 uint64_t