SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
Public Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
Bladerf1InputGui Class Reference

#include <bladerf1inputgui.h>

+ Inheritance diagram for Bladerf1InputGui:
+ Collaboration diagram for Bladerf1InputGui:

Public Member Functions

 Bladerf1InputGui (DeviceUISet *deviceUISet, QWidget *parent=0)
 
virtual ~Bladerf1InputGui ()
 
virtual void destroy ()
 
void setName (const QString &name)
 
QString getName () const
 
void resetToDefaults ()
 
virtual qint64 getCenterFrequency () const
 
virtual void setCenterFrequency (qint64 centerFrequency)
 
QByteArray serialize () const
 
bool deserialize (const QByteArray &data)
 
virtual MessageQueuegetInputMessageQueue ()
 
virtual bool handleMessage (const Message &message)
 
- Public Member Functions inherited from PluginInstanceGUI
 PluginInstanceGUI ()
 
virtual ~PluginInstanceGUI ()
 

Private Slots

void handleInputMessages ()
 
void on_centerFrequency_changed (quint64 value)
 
void on_sampleRate_changed (quint64 value)
 
void on_dcOffset_toggled (bool checked)
 
void on_iqImbalance_toggled (bool checked)
 
void on_bandwidth_currentIndexChanged (int index)
 
void on_decim_currentIndexChanged (int index)
 
void on_lna_currentIndexChanged (int index)
 
void on_vga1_valueChanged (int value)
 
void on_vga2_valueChanged (int value)
 
void on_xb200_currentIndexChanged (int index)
 
void on_fcPos_currentIndexChanged (int index)
 
void on_startStop_toggled (bool checked)
 
void on_record_toggled (bool checked)
 
void on_sampleRateMode_toggled (bool checked)
 
void updateHardware ()
 
void updateStatus ()
 
void openDeviceSettingsDialog (const QPoint &p)
 

Private Member Functions

void displaySettings ()
 
void displaySampleRate ()
 
void displayFcTooltip ()
 
void sendSettings ()
 
unsigned int getXb200Index (bool xb_200, bladerf_xb200_path xb200Path, bladerf_xb200_filter xb200Filter)
 
void updateSampleRateAndFrequency ()
 
void blockApplySettings (bool block)
 

Private Attributes

Ui::Bladerf1InputGui * ui
 
DeviceUISetm_deviceUISet
 
bool m_forceSettings
 
bool m_doApplySettings
 
BladeRF1InputSettings m_settings
 
bool m_sampleRateMode
 true: device, false: base band sample rate update mode More...
 
QTimer m_updateTimer
 
QTimer m_statusTimer
 
std::vector< int > m_gains
 
DeviceSampleSourcem_sampleSource
 
int m_sampleRate
 
quint64 m_deviceCenterFrequency
 Center frequency in device. More...
 
int m_lastEngineState
 
MessageQueue m_inputMessageQueue
 

Detailed Description

Definition at line 35 of file bladerf1inputgui.h.

Constructor & Destructor Documentation

◆ Bladerf1InputGui()

Bladerf1InputGui::Bladerf1InputGui ( DeviceUISet deviceUISet,
QWidget *  parent = 0 
)
explicit

Definition at line 35 of file bladerf1inputgui.cpp.

References displaySettings(), BladerfBandwidths::getBandwidth(), BladerfBandwidths::getNbBandwidths(), DeviceAPI::getSampleSource(), ColorMapper::GrayGold, ColorMapper::GrayGreenYellow, handleInputMessages(), i, DeviceUISet::m_deviceAPI, m_deviceUISet, m_inputMessageQueue, m_sampleSource, m_statusTimer, m_updateTimer, openDeviceSettingsDialog(), sendSettings(), DeviceSampleSource::setMessageQueueToGUI(), ui, updateHardware(), and updateStatus().

35  :
36  QWidget(parent),
37  ui(new Ui::Bladerf1InputGui),
38  m_deviceUISet(deviceUISet),
39  m_forceSettings(true),
40  m_doApplySettings(true),
41  m_settings(),
42  m_sampleRateMode(true),
43  m_sampleSource(NULL),
44  m_sampleRate(0),
46 {
48 
49  ui->setupUi(this);
50  ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
51  ui->centerFrequency->setValueRange(7, BLADERF_FREQUENCY_MIN_XB200/1000, BLADERF_FREQUENCY_MAX/1000);
52 
53  ui->sampleRate->setColorMapper(ColorMapper(ColorMapper::GrayGreenYellow));
54  // BladeRF can go as low as 80 kS/s but because of buffering in practice experience is not good below 330 kS/s
55  ui->sampleRate->setValueRange(8, 330000U, BLADERF_SAMPLERATE_REC_MAX);
56 
57  ui->bandwidth->clear();
58  for (unsigned int i = 0; i < BladerfBandwidths::getNbBandwidths(); i++)
59  {
60  ui->bandwidth->addItem(QString::number(BladerfBandwidths::getBandwidth(i)));
61  }
62 
63  connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
64  connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
65  m_statusTimer.start(500);
66 
67  CRightClickEnabler *startStopRightClickEnabler = new CRightClickEnabler(ui->startStop);
68  connect(startStopRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(openDeviceSettingsDialog(const QPoint &)));
69 
71 
72  connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
74 
75  sendSettings();
76 }
DeviceSampleSource * getSampleSource()
Return pointer to the device sample source (single Rx) or nullptr.
Definition: deviceapi.cpp:213
bool m_sampleRateMode
true: device, false: base band sample rate update mode
DeviceSampleSource * m_sampleSource
static unsigned int getBandwidth(unsigned int bandwidth_index)
DeviceUISet * m_deviceUISet
engine is before initialization
Definition: deviceapi.h:53
DeviceAPI * m_deviceAPI
Definition: deviceuiset.h:48
int32_t i
Definition: decimators.h:244
BladeRF1InputSettings m_settings
static unsigned int getNbBandwidths()
void openDeviceSettingsDialog(const QPoint &p)
virtual void setMessageQueueToGUI(MessageQueue *queue)=0
Ui::Bladerf1InputGui * ui
MessageQueue m_inputMessageQueue
+ Here is the call graph for this function:

◆ ~Bladerf1InputGui()

Bladerf1InputGui::~Bladerf1InputGui ( )
virtual

Definition at line 78 of file bladerf1inputgui.cpp.

References ui.

79 {
80  delete ui;
81 }
Ui::Bladerf1InputGui * ui

Member Function Documentation

◆ blockApplySettings()

void Bladerf1InputGui::blockApplySettings ( bool  block)
private

Definition at line 467 of file bladerf1inputgui.cpp.

References m_doApplySettings.

Referenced by displaySettings(), and handleMessage().

468 {
469  m_doApplySettings = !block;
470 }
+ Here is the caller graph for this function:

◆ deserialize()

bool Bladerf1InputGui::deserialize ( const QByteArray &  data)
virtual

Implements PluginInstanceGUI.

Definition at line 122 of file bladerf1inputgui.cpp.

References BladeRF1InputSettings::deserialize(), displaySettings(), m_forceSettings, m_settings, resetToDefaults(), and sendSettings().

123 {
124  if(m_settings.deserialize(data)) {
125  displaySettings();
126  m_forceSettings = true;
127  sendSettings();
128  return true;
129  } else {
130  resetToDefaults();
131  return false;
132  }
133 }
BladeRF1InputSettings m_settings
bool deserialize(const QByteArray &data)
+ Here is the call graph for this function:

◆ destroy()

void Bladerf1InputGui::destroy ( )
virtual

Implements PluginInstanceGUI.

Definition at line 83 of file bladerf1inputgui.cpp.

84 {
85  delete this;
86 }

◆ displayFcTooltip()

void Bladerf1InputGui::displayFcTooltip ( )
private

Definition at line 228 of file bladerf1inputgui.cpp.

References arg(), DeviceSampleSource::calculateFrequencyShift(), BladeRF1InputSettings::m_devSampleRate, BladeRF1InputSettings::m_fcPos, BladeRF1InputSettings::m_log2Decim, m_settings, and ui.

Referenced by displaySampleRate(), on_fcPos_currentIndexChanged(), and on_sampleRate_changed().

229 {
234  DeviceSampleSource::FrequencyShiftScheme::FSHIFT_STD
235  );
236  ui->fcPos->setToolTip(tr("Relative position of device center frequency: %1 kHz").arg(QString::number(fShift / 1000.0f, 'g', 5)));
237 }
static qint32 calculateFrequencyShift(int log2Decim, fcPos_t fcPos, quint32 devSampleRate, FrequencyShiftScheme frequencyShiftScheme)
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
int int32_t
Definition: rtptypes_win.h:45
BladeRF1InputSettings m_settings
Ui::Bladerf1InputGui * ui
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ displaySampleRate()

void Bladerf1InputGui::displaySampleRate ( )
private

Definition at line 196 of file bladerf1inputgui.cpp.

References arg(), displayFcTooltip(), BladeRF1InputSettings::m_devSampleRate, BladeRF1InputSettings::m_log2Decim, m_sampleRateMode, m_settings, and ui.

Referenced by displaySettings(), on_decim_currentIndexChanged(), on_sampleRateMode_toggled(), and updateSampleRateAndFrequency().

197 {
198  ui->sampleRate->blockSignals(true);
200 
201  if (m_sampleRateMode)
202  {
203  ui->sampleRateMode->setStyleSheet("QToolButton { background:rgb(60,60,60); }");
204  ui->sampleRateMode->setText("SR");
205  // BladeRF can go as low as 80 kS/s but because of buffering in practice experience is not good below 330 kS/s
206  ui->sampleRate->setValueRange(8, 330000U, BLADERF_SAMPLERATE_REC_MAX);
207  ui->sampleRate->setValue(m_settings.m_devSampleRate);
208  ui->sampleRate->setToolTip("Device to host sample rate (S/s)");
209  ui->deviceRateText->setToolTip("Baseband sample rate (S/s)");
210  uint32_t basebandSampleRate = m_settings.m_devSampleRate/(1<<m_settings.m_log2Decim);
211  ui->deviceRateText->setText(tr("%1k").arg(QString::number(basebandSampleRate / 1000.0f, 'g', 5)));
212  }
213  else
214  {
215  ui->sampleRateMode->setStyleSheet("QToolButton { background:rgb(50,50,50); }");
216  ui->sampleRateMode->setText("BB");
217  // BladeRF can go as low as 80 kS/s but because of buffering in practice experience is not good below 330 kS/s
218  ui->sampleRate->setValueRange(8, 330000U/(1<<m_settings.m_log2Decim), BLADERF_SAMPLERATE_REC_MAX/(1<<m_settings.m_log2Decim));
219  ui->sampleRate->setValue(m_settings.m_devSampleRate/(1<<m_settings.m_log2Decim));
220  ui->sampleRate->setToolTip("Baseband sample rate (S/s)");
221  ui->deviceRateText->setToolTip("Device to host sample rate (S/s)");
222  ui->deviceRateText->setText(tr("%1k").arg(QString::number(m_settings.m_devSampleRate / 1000.0f, 'g', 5)));
223  }
224 
225  ui->sampleRate->blockSignals(false);
226 }
bool m_sampleRateMode
true: device, false: base band sample rate update mode
unsigned int uint32_t
Definition: rtptypes_win.h:46
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
BladeRF1InputSettings m_settings
Ui::Bladerf1InputGui * ui
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ displaySettings()

void Bladerf1InputGui::displaySettings ( )
private

Definition at line 239 of file bladerf1inputgui.cpp.

References arg(), blockApplySettings(), displaySampleRate(), BladerfBandwidths::getBandwidthIndex(), getXb200Index(), BladeRF1InputSettings::m_bandwidth, BladeRF1InputSettings::m_centerFrequency, BladeRF1InputSettings::m_dcBlock, BladeRF1InputSettings::m_fcPos, BladeRF1InputSettings::m_iqCorrection, BladeRF1InputSettings::m_lnaGain, BladeRF1InputSettings::m_log2Decim, m_settings, BladeRF1InputSettings::m_vga1, BladeRF1InputSettings::m_vga2, BladeRF1InputSettings::m_xb200, BladeRF1InputSettings::m_xb200Filter, BladeRF1InputSettings::m_xb200Path, and ui.

Referenced by Bladerf1InputGui(), deserialize(), handleMessage(), resetToDefaults(), and setCenterFrequency().

240 {
241  blockApplySettings(true);
242 
243  ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
245 
246  ui->dcOffset->setChecked(m_settings.m_dcBlock);
247  ui->iqImbalance->setChecked(m_settings.m_iqCorrection);
248 
249  unsigned int bandwidthIndex = BladerfBandwidths::getBandwidthIndex(m_settings.m_bandwidth);
250  ui->bandwidth->setCurrentIndex(bandwidthIndex);
251 
252  ui->decim->setCurrentIndex(m_settings.m_log2Decim);
253 
254  ui->fcPos->setCurrentIndex((int) m_settings.m_fcPos);
255 
256  ui->lna->setCurrentIndex(m_settings.m_lnaGain);
257 
258  ui->vga1Text->setText(tr("%1dB").arg(m_settings.m_vga1));
259  ui->vga1->setValue(m_settings.m_vga1);
260 
261  ui->vga2Text->setText(tr("%1dB").arg(m_settings.m_vga2));
262  ui->vga2->setValue(m_settings.m_vga2);
263 
265 
266  blockApplySettings(false);
267 }
bladerf_xb200_filter m_xb200Filter
void blockApplySettings(bool block)
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
bladerf_xb200_path m_xb200Path
unsigned int getXb200Index(bool xb_200, bladerf_xb200_path xb200Path, bladerf_xb200_filter xb200Filter)
BladeRF1InputSettings m_settings
static unsigned int getBandwidthIndex(unsigned int bandwidth)
Ui::Bladerf1InputGui * ui
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCenterFrequency()

qint64 Bladerf1InputGui::getCenterFrequency ( ) const
virtual

Implements PluginInstanceGUI.

Definition at line 105 of file bladerf1inputgui.cpp.

References BladeRF1InputSettings::m_centerFrequency, and m_settings.

106 {
108 }
BladeRF1InputSettings m_settings

◆ getInputMessageQueue()

virtual MessageQueue* Bladerf1InputGui::getInputMessageQueue ( )
inlinevirtual

Implements PluginInstanceGUI.

Definition at line 51 of file bladerf1inputgui.h.

51 { return &m_inputMessageQueue; }
MessageQueue m_inputMessageQueue

◆ getName()

QString Bladerf1InputGui::getName ( ) const
virtual

Implements PluginInstanceGUI.

Definition at line 93 of file bladerf1inputgui.cpp.

94 {
95  return objectName();
96 }

◆ getXb200Index()

unsigned int Bladerf1InputGui::getXb200Index ( bool  xb_200,
bladerf_xb200_path  xb200Path,
bladerf_xb200_filter  xb200Filter 
)
private

Definition at line 501 of file bladerf1inputgui.cpp.

Referenced by displaySettings().

502 {
503  if (xb_200)
504  {
505  if (xb200Path == BLADERF_XB200_BYPASS)
506  {
507  return 1;
508  }
509  else
510  {
511  if (xb200Filter == BLADERF_XB200_AUTO_1DB)
512  {
513  return 2;
514  }
515  else if (xb200Filter == BLADERF_XB200_AUTO_3DB)
516  {
517  return 3;
518  }
519  else if (xb200Filter == BLADERF_XB200_CUSTOM)
520  {
521  return 4;
522  }
523  else if (xb200Filter == BLADERF_XB200_50M)
524  {
525  return 5;
526  }
527  else if (xb200Filter == BLADERF_XB200_144M)
528  {
529  return 6;
530  }
531  else // xb200Filter == BLADERF_XB200_222M
532  {
533  return 7;
534  }
535  }
536  }
537  else
538  {
539  return 0;
540  }
541 }
+ Here is the caller graph for this function:

◆ handleInputMessages

void Bladerf1InputGui::handleInputMessages ( )
privateslot

Definition at line 161 of file bladerf1inputgui.cpp.

References DSPSignalNotification::getCenterFrequency(), Message::getIdentifier(), DSPSignalNotification::getSampleRate(), handleMessage(), m_deviceCenterFrequency, m_inputMessageQueue, m_sampleRate, Message::match(), MessageQueue::pop(), and updateSampleRateAndFrequency().

Referenced by Bladerf1InputGui().

162 {
163  Message* message;
164 
165  while ((message = m_inputMessageQueue.pop()) != 0)
166  {
167  qDebug("BladerfGui::handleInputMessages: message: %s", message->getIdentifier());
168 
169  if (DSPSignalNotification::match(*message))
170  {
171  DSPSignalNotification* notif = (DSPSignalNotification*) message;
172  m_sampleRate = notif->getSampleRate();
174  qDebug("BladerfGui::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
176 
177  delete message;
178  }
179  else
180  {
181  if (handleMessage(*message))
182  {
183  delete message;
184  }
185  }
186  }
187 }
Message * pop()
Pop message from queue.
void updateSampleRateAndFrequency()
virtual bool handleMessage(const Message &message)
qint64 getCenterFrequency() const
Definition: dspcommands.h:329
static bool match(const Message *message)
Definition: message.cpp:45
int getSampleRate() const
Definition: dspcommands.h:328
quint64 m_deviceCenterFrequency
Center frequency in device.
virtual const char * getIdentifier() const
Definition: message.cpp:35
MessageQueue m_inputMessageQueue
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleMessage()

bool Bladerf1InputGui::handleMessage ( const Message message)
virtual

Implements PluginInstanceGUI.

Definition at line 135 of file bladerf1inputgui.cpp.

References blockApplySettings(), displaySettings(), Bladerf1Input::MsgConfigureBladerf1::getSettings(), Bladerf1Input::MsgStartStop::getStartStop(), m_settings, Message::match(), and ui.

Referenced by handleInputMessages().

136 {
138  {
140  m_settings = cfg.getSettings();
141  blockApplySettings(true);
142  displaySettings();
143  blockApplySettings(false);
144  return true;
145  }
146  else if (Bladerf1Input::MsgStartStop::match(message))
147  {
149  blockApplySettings(true);
150  ui->startStop->setChecked(notif.getStartStop());
151  blockApplySettings(false);
152 
153  return true;
154  }
155  else
156  {
157  return false;
158  }
159 }
const BladeRF1InputSettings & getSettings() const
Definition: bladerf1input.h:45
void blockApplySettings(bool block)
static bool match(const Message *message)
Definition: message.cpp:45
BladeRF1InputSettings m_settings
Ui::Bladerf1InputGui * ui
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ on_bandwidth_currentIndexChanged

void Bladerf1InputGui::on_bandwidth_currentIndexChanged ( int  index)
privateslot

Definition at line 305 of file bladerf1inputgui.cpp.

References BladerfBandwidths::getBandwidth(), BladeRF1InputSettings::m_bandwidth, m_settings, and sendSettings().

306 {
307  int newbw = BladerfBandwidths::getBandwidth(index);
308  m_settings.m_bandwidth = newbw * 1000;
309  sendSettings();
310 }
static unsigned int getBandwidth(unsigned int bandwidth_index)
BladeRF1InputSettings m_settings
+ Here is the call graph for this function:

◆ on_centerFrequency_changed

void Bladerf1InputGui::on_centerFrequency_changed ( quint64  value)
privateslot

Definition at line 275 of file bladerf1inputgui.cpp.

References BladeRF1InputSettings::m_centerFrequency, m_settings, and sendSettings().

276 {
277  m_settings.m_centerFrequency = value * 1000;
278  sendSettings();
279 }
BladeRF1InputSettings m_settings
+ Here is the call graph for this function:

◆ on_dcOffset_toggled

void Bladerf1InputGui::on_dcOffset_toggled ( bool  checked)
privateslot

Definition at line 293 of file bladerf1inputgui.cpp.

References BladeRF1InputSettings::m_dcBlock, m_settings, and sendSettings().

294 {
295  m_settings.m_dcBlock = checked;
296  sendSettings();
297 }
BladeRF1InputSettings m_settings
+ Here is the call graph for this function:

◆ on_decim_currentIndexChanged

void Bladerf1InputGui::on_decim_currentIndexChanged ( int  index)
privateslot

Definition at line 312 of file bladerf1inputgui.cpp.

References displaySampleRate(), BladeRF1InputSettings::m_devSampleRate, BladeRF1InputSettings::m_log2Decim, m_sampleRateMode, m_settings, sendSettings(), and ui.

313 {
314  if ((index <0) || (index > 6)) {
315  return;
316  }
317 
318  m_settings.m_log2Decim = index;
320 
321  if (m_sampleRateMode) {
322  m_settings.m_devSampleRate = ui->sampleRate->getValueNew();
323  } else {
324  m_settings.m_devSampleRate = ui->sampleRate->getValueNew() * (1 << m_settings.m_log2Decim);
325  }
326 
327  sendSettings();
328 }
bool m_sampleRateMode
true: device, false: base band sample rate update mode
BladeRF1InputSettings m_settings
Ui::Bladerf1InputGui * ui
+ Here is the call graph for this function:

◆ on_fcPos_currentIndexChanged

void Bladerf1InputGui::on_fcPos_currentIndexChanged ( int  index)
privateslot

Definition at line 330 of file bladerf1inputgui.cpp.

References displayFcTooltip(), BladeRF1InputSettings::m_fcPos, m_settings, and sendSettings().

331 {
332  m_settings.m_fcPos = (BladeRF1InputSettings::fcPos_t) (index < 0 ? 0 : index > 2 ? 2 : index);
334  sendSettings();
335 }
BladeRF1InputSettings m_settings
+ Here is the call graph for this function:

◆ on_iqImbalance_toggled

void Bladerf1InputGui::on_iqImbalance_toggled ( bool  checked)
privateslot

Definition at line 299 of file bladerf1inputgui.cpp.

References BladeRF1InputSettings::m_iqCorrection, m_settings, and sendSettings().

300 {
301  m_settings.m_iqCorrection = checked;
302  sendSettings();
303 }
BladeRF1InputSettings m_settings
+ Here is the call graph for this function:

◆ on_lna_currentIndexChanged

void Bladerf1InputGui::on_lna_currentIndexChanged ( int  index)
privateslot

Definition at line 337 of file bladerf1inputgui.cpp.

References BladeRF1InputSettings::m_lnaGain, m_settings, and sendSettings().

338 {
339  qDebug() << "BladerfGui: LNA gain = " << index * 3 << " dB";
340 
341  if ((index < 0) || (index > 2))
342  return;
343 
344  m_settings.m_lnaGain = index;
345  sendSettings();
346 }
BladeRF1InputSettings m_settings
+ Here is the call graph for this function:

◆ on_record_toggled

void Bladerf1InputGui::on_record_toggled ( bool  checked)
privateslot

Definition at line 437 of file bladerf1inputgui.cpp.

References Bladerf1Input::MsgFileRecord::create(), DeviceSampleSource::getInputMessageQueue(), m_sampleSource, MessageQueue::push(), and ui.

438 {
439  if (checked) {
440  ui->record->setStyleSheet("QToolButton { background-color : red; }");
441  } else {
442  ui->record->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
443  }
444 
447 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue * getInputMessageQueue()
DeviceSampleSource * m_sampleSource
Ui::Bladerf1InputGui * ui
static MsgFileRecord * create(bool startStop)
Definition: bladerf1input.h:70
+ Here is the call graph for this function:

◆ on_sampleRate_changed

void Bladerf1InputGui::on_sampleRate_changed ( quint64  value)
privateslot

Definition at line 281 of file bladerf1inputgui.cpp.

References displayFcTooltip(), BladeRF1InputSettings::m_devSampleRate, BladeRF1InputSettings::m_log2Decim, m_sampleRateMode, m_settings, and sendSettings().

282 {
283  if (m_sampleRateMode) {
284  m_settings.m_devSampleRate = value;
285  } else {
287  }
288 
290  sendSettings();
291 }
bool m_sampleRateMode
true: device, false: base band sample rate update mode
BladeRF1InputSettings m_settings
+ Here is the call graph for this function:

◆ on_sampleRateMode_toggled

void Bladerf1InputGui::on_sampleRateMode_toggled ( bool  checked)
privateslot

Definition at line 449 of file bladerf1inputgui.cpp.

References displaySampleRate(), and m_sampleRateMode.

450 {
451  m_sampleRateMode = checked;
453 }
bool m_sampleRateMode
true: device, false: base band sample rate update mode
+ Here is the call graph for this function:

◆ on_startStop_toggled

void Bladerf1InputGui::on_startStop_toggled ( bool  checked)
privateslot

Definition at line 428 of file bladerf1inputgui.cpp.

References Bladerf1Input::MsgStartStop::create(), DeviceSampleSource::getInputMessageQueue(), m_doApplySettings, m_sampleSource, and MessageQueue::push().

429 {
430  if (m_doApplySettings)
431  {
434  }
435 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue * getInputMessageQueue()
DeviceSampleSource * m_sampleSource
static MsgStartStop * create(bool startStop)
Definition: bladerf1input.h:89
+ Here is the call graph for this function:

◆ on_vga1_valueChanged

void Bladerf1InputGui::on_vga1_valueChanged ( int  value)
privateslot

Definition at line 348 of file bladerf1inputgui.cpp.

References arg(), m_settings, BladeRF1InputSettings::m_vga1, sendSettings(), and ui.

349 {
350  if ((value < BLADERF_RXVGA1_GAIN_MIN) || (value > BLADERF_RXVGA1_GAIN_MAX))
351  return;
352 
353  ui->vga1Text->setText(tr("%1dB").arg(value));
354  m_settings.m_vga1 = value;
355  sendSettings();
356 }
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
BladeRF1InputSettings m_settings
Ui::Bladerf1InputGui * ui
+ Here is the call graph for this function:

◆ on_vga2_valueChanged

void Bladerf1InputGui::on_vga2_valueChanged ( int  value)
privateslot

Definition at line 358 of file bladerf1inputgui.cpp.

References arg(), m_settings, BladeRF1InputSettings::m_vga2, sendSettings(), and ui.

359 {
360  if ((value < BLADERF_RXVGA2_GAIN_MIN) || (value > BLADERF_RXVGA2_GAIN_MAX))
361  return;
362 
363  ui->vga2Text->setText(tr("%1dB").arg(value));
364  m_settings.m_vga2 = value;
365  sendSettings();
366 }
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
BladeRF1InputSettings m_settings
Ui::Bladerf1InputGui * ui
+ Here is the call graph for this function:

◆ on_xb200_currentIndexChanged

void Bladerf1InputGui::on_xb200_currentIndexChanged ( int  index)
privateslot

Definition at line 368 of file bladerf1inputgui.cpp.

References m_settings, BladeRF1InputSettings::m_xb200, BladeRF1InputSettings::m_xb200Filter, BladeRF1InputSettings::m_xb200Path, sendSettings(), and ui.

369 {
370  if (index == 1) // bypass
371  {
372  m_settings.m_xb200 = true;
373  m_settings.m_xb200Path = BLADERF_XB200_BYPASS;
374  }
375  else if (index == 2) // Auto 1dB
376  {
377  m_settings.m_xb200 = true;
378  m_settings.m_xb200Path = BLADERF_XB200_MIX;
379  m_settings.m_xb200Filter = BLADERF_XB200_AUTO_1DB;
380  }
381  else if (index == 3) // Auto 3dB
382  {
383  m_settings.m_xb200 = true;
384  m_settings.m_xb200Path = BLADERF_XB200_MIX;
385  m_settings.m_xb200Filter = BLADERF_XB200_AUTO_3DB;
386  }
387  else if (index == 4) // Custom
388  {
389  m_settings.m_xb200 = true;
390  m_settings.m_xb200Path = BLADERF_XB200_MIX;
391  m_settings.m_xb200Filter = BLADERF_XB200_CUSTOM;
392  }
393  else if (index == 5) // 50 MHz
394  {
395  m_settings.m_xb200 = true;
396  m_settings.m_xb200Path = BLADERF_XB200_MIX;
397  m_settings.m_xb200Filter = BLADERF_XB200_50M;
398  }
399  else if (index == 6) // 144 MHz
400  {
401  m_settings.m_xb200 = true;
402  m_settings.m_xb200Path = BLADERF_XB200_MIX;
403  m_settings.m_xb200Filter = BLADERF_XB200_144M;
404  }
405  else if (index == 7) // 222 MHz
406  {
407  m_settings.m_xb200 = true;
408  m_settings.m_xb200Path = BLADERF_XB200_MIX;
409  m_settings.m_xb200Filter = BLADERF_XB200_222M;
410  }
411  else // no xb200
412  {
413  m_settings.m_xb200 = false;
414  }
415 
416  if (m_settings.m_xb200)
417  {
418  ui->centerFrequency->setValueRange(7, BLADERF_FREQUENCY_MIN_XB200/1000, BLADERF_FREQUENCY_MAX/1000);
419  }
420  else
421  {
422  ui->centerFrequency->setValueRange(7, BLADERF_FREQUENCY_MIN/1000, BLADERF_FREQUENCY_MAX/1000);
423  }
424 
425  sendSettings();
426 }
bladerf_xb200_filter m_xb200Filter
bladerf_xb200_path m_xb200Path
BladeRF1InputSettings m_settings
Ui::Bladerf1InputGui * ui
+ Here is the call graph for this function:

◆ openDeviceSettingsDialog

void Bladerf1InputGui::openDeviceSettingsDialog ( const QPoint &  p)
privateslot

Definition at line 543 of file bladerf1inputgui.cpp.

References BasicDeviceSettingsDialog::getReverseAPIAddress(), BasicDeviceSettingsDialog::getReverseAPIDeviceIndex(), BasicDeviceSettingsDialog::getReverseAPIPort(), BladeRF1InputSettings::m_reverseAPIAddress, BladeRF1InputSettings::m_reverseAPIDeviceIndex, BladeRF1InputSettings::m_reverseAPIPort, m_settings, BladeRF1InputSettings::m_useReverseAPI, sendSettings(), BasicDeviceSettingsDialog::setReverseAPIAddress(), BasicDeviceSettingsDialog::setReverseAPIDeviceIndex(), BasicDeviceSettingsDialog::setReverseAPIPort(), BasicDeviceSettingsDialog::setUseReverseAPI(), and BasicDeviceSettingsDialog::useReverseAPI().

Referenced by Bladerf1InputGui().

544 {
545  BasicDeviceSettingsDialog dialog(this);
546  dialog.setUseReverseAPI(m_settings.m_useReverseAPI);
547  dialog.setReverseAPIAddress(m_settings.m_reverseAPIAddress);
548  dialog.setReverseAPIPort(m_settings.m_reverseAPIPort);
549  dialog.setReverseAPIDeviceIndex(m_settings.m_reverseAPIDeviceIndex);
550 
551  dialog.move(p);
552  dialog.exec();
553 
554  m_settings.m_useReverseAPI = dialog.useReverseAPI();
555  m_settings.m_reverseAPIAddress = dialog.getReverseAPIAddress();
556  m_settings.m_reverseAPIPort = dialog.getReverseAPIPort();
557  m_settings.m_reverseAPIDeviceIndex = dialog.getReverseAPIDeviceIndex();
558 
559  sendSettings();
560 }
BladeRF1InputSettings m_settings
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetToDefaults()

void Bladerf1InputGui::resetToDefaults ( )
virtual

Implements PluginInstanceGUI.

Definition at line 98 of file bladerf1inputgui.cpp.

References displaySettings(), m_settings, BladeRF1InputSettings::resetToDefaults(), and sendSettings().

Referenced by deserialize().

99 {
101  displaySettings();
102  sendSettings();
103 }
BladeRF1InputSettings m_settings
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendSettings()

void Bladerf1InputGui::sendSettings ( )
private

◆ serialize()

QByteArray Bladerf1InputGui::serialize ( ) const
virtual

Implements PluginInstanceGUI.

Definition at line 117 of file bladerf1inputgui.cpp.

References m_settings, and BladeRF1InputSettings::serialize().

118 {
119  return m_settings.serialize();
120 }
QByteArray serialize() const
BladeRF1InputSettings m_settings
+ Here is the call graph for this function:

◆ setCenterFrequency()

void Bladerf1InputGui::setCenterFrequency ( qint64  centerFrequency)
virtual

Implements PluginInstanceGUI.

Definition at line 110 of file bladerf1inputgui.cpp.

References displaySettings(), BladeRF1InputSettings::m_centerFrequency, m_settings, and sendSettings().

111 {
112  m_settings.m_centerFrequency = centerFrequency;
113  displaySettings();
114  sendSettings();
115 }
BladeRF1InputSettings m_settings
+ Here is the call graph for this function:

◆ setName()

void Bladerf1InputGui::setName ( const QString &  name)
virtual

Implements PluginInstanceGUI.

Definition at line 88 of file bladerf1inputgui.cpp.

89 {
90  setObjectName(name);
91 }

◆ updateHardware

void Bladerf1InputGui::updateHardware ( )
privateslot

Definition at line 455 of file bladerf1inputgui.cpp.

References Bladerf1Input::MsgConfigureBladerf1::create(), DeviceSampleSource::getInputMessageQueue(), m_doApplySettings, m_forceSettings, m_sampleSource, m_settings, m_updateTimer, and MessageQueue::push().

Referenced by Bladerf1InputGui().

456 {
457  if (m_doApplySettings)
458  {
459  qDebug() << "BladerfGui::updateHardware";
462  m_forceSettings = false;
463  m_updateTimer.stop();
464  }
465 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue * getInputMessageQueue()
DeviceSampleSource * m_sampleSource
BladeRF1InputSettings m_settings
static MsgConfigureBladerf1 * create(const BladeRF1InputSettings &settings, bool force)
Definition: bladerf1input.h:48
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateSampleRateAndFrequency()

void Bladerf1InputGui::updateSampleRateAndFrequency ( )
private

Definition at line 189 of file bladerf1inputgui.cpp.

References displaySampleRate(), DeviceUISet::getSpectrum(), m_deviceCenterFrequency, m_deviceUISet, m_sampleRate, GLSpectrum::setCenterFrequency(), and GLSpectrum::setSampleRate().

Referenced by handleInputMessages().

190 {
194 }
void setSampleRate(qint32 sampleRate)
Definition: glspectrum.cpp:211
DeviceUISet * m_deviceUISet
GLSpectrum * getSpectrum()
Direct spectrum getter.
Definition: deviceuiset.h:57
quint64 m_deviceCenterFrequency
Center frequency in device.
void setCenterFrequency(qint64 frequency)
Definition: glspectrum.cpp:175
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateStatus

void Bladerf1InputGui::updateStatus ( )
privateslot

Definition at line 472 of file bladerf1inputgui.cpp.

References DeviceAPI::errorMessage(), DeviceUISet::m_deviceAPI, m_deviceUISet, m_lastEngineState, DeviceAPI::state(), DeviceAPI::StError, DeviceAPI::StIdle, DeviceAPI::StNotStarted, DeviceAPI::StRunning, and ui.

Referenced by Bladerf1InputGui().

473 {
474  int state = m_deviceUISet->m_deviceAPI->state();
475 
476  if(m_lastEngineState != state)
477  {
478  switch(state)
479  {
481  ui->startStop->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
482  break;
483  case DeviceAPI::StIdle:
484  ui->startStop->setStyleSheet("QToolButton { background-color : blue; }");
485  break;
487  ui->startStop->setStyleSheet("QToolButton { background-color : green; }");
488  break;
489  case DeviceAPI::StError:
490  ui->startStop->setStyleSheet("QToolButton { background-color : red; }");
491  QMessageBox::information(this, tr("Message"), m_deviceUISet->m_deviceAPI->errorMessage());
492  break;
493  default:
494  break;
495  }
496 
497  m_lastEngineState = state;
498  }
499 }
QString errorMessage()
Last error message from the device engine.
Definition: deviceapi.cpp:290
DeviceUISet * m_deviceUISet
engine is before initialization
Definition: deviceapi.h:53
EngineState state() const
Return the state of the device engine corresponding to the stream type.
Definition: deviceapi.cpp:277
DeviceAPI * m_deviceAPI
Definition: deviceuiset.h:48
engine is idle
Definition: deviceapi.h:54
engine is running
Definition: deviceapi.h:56
Ui::Bladerf1InputGui * ui
engine is in error
Definition: deviceapi.h:57
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_deviceCenterFrequency

quint64 Bladerf1InputGui::m_deviceCenterFrequency
private

Center frequency in device.

Definition at line 67 of file bladerf1inputgui.h.

Referenced by handleInputMessages(), and updateSampleRateAndFrequency().

◆ m_deviceUISet

DeviceUISet* Bladerf1InputGui::m_deviceUISet
private

Definition at line 57 of file bladerf1inputgui.h.

Referenced by Bladerf1InputGui(), updateSampleRateAndFrequency(), and updateStatus().

◆ m_doApplySettings

bool Bladerf1InputGui::m_doApplySettings
private

Definition at line 59 of file bladerf1inputgui.h.

Referenced by blockApplySettings(), on_startStop_toggled(), and updateHardware().

◆ m_forceSettings

bool Bladerf1InputGui::m_forceSettings
private

Definition at line 58 of file bladerf1inputgui.h.

Referenced by deserialize(), and updateHardware().

◆ m_gains

std::vector<int> Bladerf1InputGui::m_gains
private

Definition at line 64 of file bladerf1inputgui.h.

◆ m_inputMessageQueue

MessageQueue Bladerf1InputGui::m_inputMessageQueue
private

Definition at line 69 of file bladerf1inputgui.h.

Referenced by Bladerf1InputGui(), and handleInputMessages().

◆ m_lastEngineState

int Bladerf1InputGui::m_lastEngineState
private

Definition at line 68 of file bladerf1inputgui.h.

Referenced by updateStatus().

◆ m_sampleRate

int Bladerf1InputGui::m_sampleRate
private

Definition at line 66 of file bladerf1inputgui.h.

Referenced by handleInputMessages(), and updateSampleRateAndFrequency().

◆ m_sampleRateMode

bool Bladerf1InputGui::m_sampleRateMode
private

true: device, false: base band sample rate update mode

Definition at line 61 of file bladerf1inputgui.h.

Referenced by displaySampleRate(), on_decim_currentIndexChanged(), on_sampleRate_changed(), and on_sampleRateMode_toggled().

◆ m_sampleSource

DeviceSampleSource* Bladerf1InputGui::m_sampleSource
private

◆ m_settings

BladeRF1InputSettings Bladerf1InputGui::m_settings
private

◆ m_statusTimer

QTimer Bladerf1InputGui::m_statusTimer
private

Definition at line 63 of file bladerf1inputgui.h.

Referenced by Bladerf1InputGui().

◆ m_updateTimer

QTimer Bladerf1InputGui::m_updateTimer
private

Definition at line 62 of file bladerf1inputgui.h.

Referenced by Bladerf1InputGui(), sendSettings(), and updateHardware().

◆ ui

Ui::Bladerf1InputGui* Bladerf1InputGui::ui
private

The documentation for this class was generated from the following files: