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
PerseusGui Class Reference

#include <perseusgui.h>

+ Inheritance diagram for PerseusGui:
+ Collaboration diagram for PerseusGui:

Public Member Functions

 PerseusGui (DeviceUISet *deviceUISet, QWidget *parent=0)
 
virtual ~PerseusGui ()
 
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)
 
uint32_t getDevSampleRate (unsigned int index)
 
int getDevSampleRateIndex (uint32_t sampleRate)
 
- Public Member Functions inherited from PluginInstanceGUI
 PluginInstanceGUI ()
 
virtual ~PluginInstanceGUI ()
 

Private Slots

void on_centerFrequency_changed (quint64 value)
 
void on_LOppm_valueChanged (int value)
 
void on_resetLOppm_clicked ()
 
void on_sampleRate_currentIndexChanged (int index)
 
void on_wideband_toggled (bool checked)
 
void on_decim_currentIndexChanged (int index)
 
void on_startStop_toggled (bool checked)
 
void on_record_toggled (bool checked)
 
void on_transverter_clicked ()
 
void on_attenuator_currentIndexChanged (int index)
 
void on_adcDither_toggled (bool checked)
 
void on_adcPreamp_toggled (bool checked)
 
void updateHardware ()
 
void updateStatus ()
 
void handleInputMessages ()
 
void openDeviceSettingsDialog (const QPoint &p)
 

Private Member Functions

void blockApplySettings (bool block)
 
void displaySettings ()
 
void displaySampleRates ()
 
void updateFrequencyLimits ()
 
void sendSettings ()
 
void updateSampleRateAndFrequency ()
 

Private Attributes

Ui::PerseusGui * ui
 
DeviceUISetm_deviceUISet
 
bool m_doApplySettings
 
bool m_forceSettings
 
PerseusSettings m_settings
 
QTimer m_updateTimer
 
QTimer m_statusTimer
 
std::vector< uint32_tm_rates
 
PerseusInputm_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 perseusgui.h.

Constructor & Destructor Documentation

◆ PerseusGui()

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

Definition at line 34 of file perseusgui.cpp.

References displaySampleRates(), displaySettings(), PerseusInput::getSampleRates(), DeviceAPI::getSampleSource(), ColorMapper::GrayGold, handleInputMessages(), DeviceUISet::m_deviceAPI, m_deviceUISet, m_inputMessageQueue, m_rates, m_sampleSource, m_statusTimer, m_updateTimer, openDeviceSettingsDialog(), sendSettings(), PerseusInput::setMessageQueueToGUI(), ui, updateFrequencyLimits(), updateHardware(), and updateStatus().

34  :
35  QWidget(parent),
36  ui(new Ui::PerseusGui),
37  m_deviceUISet(deviceUISet),
38  m_doApplySettings(true),
39  m_forceSettings(true),
40  m_settings(),
41  m_sampleSource(0),
43 {
45 
46  ui->setupUi(this);
47  ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
49 
50  connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
51  connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
52  m_statusTimer.start(500);
53 
54  CRightClickEnabler *startStopRightClickEnabler = new CRightClickEnabler(ui->startStop);
55  connect(startStopRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(openDeviceSettingsDialog(const QPoint &)));
56 
58 
61  connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
63 
64  sendSettings();
65 }
QTimer m_statusTimer
Definition: perseusgui.h:64
bool m_forceSettings
Definition: perseusgui.h:61
bool m_doApplySettings
Definition: perseusgui.h:60
DeviceSampleSource * getSampleSource()
Return pointer to the device sample source (single Rx) or nullptr.
Definition: deviceapi.cpp:213
const std::vector< uint32_t > & getSampleRates() const
Definition: perseusinput.h:143
DeviceUISet * m_deviceUISet
Definition: perseusgui.h:59
virtual void setMessageQueueToGUI(MessageQueue *queue)
Definition: perseusinput.h:111
std::vector< uint32_t > m_rates
Definition: perseusgui.h:65
void updateFrequencyLimits()
Definition: perseusgui.cpp:232
engine is before initialization
Definition: deviceapi.h:53
Ui::PerseusGui * ui
Definition: perseusgui.h:57
DeviceAPI * m_deviceAPI
Definition: deviceuiset.h:48
void displaySettings()
Definition: perseusgui.cpp:186
PerseusInput * m_sampleSource
Definition: perseusgui.h:66
void displaySampleRates()
Definition: perseusgui.cpp:204
PerseusSettings m_settings
Definition: perseusgui.h:62
void updateHardware()
Definition: perseusgui.cpp:344
int m_lastEngineState
Definition: perseusgui.h:69
QTimer m_updateTimer
Definition: perseusgui.h:63
void sendSettings()
Definition: perseusgui.cpp:248
MessageQueue m_inputMessageQueue
Definition: perseusgui.h:70
void handleInputMessages()
Definition: perseusgui.cpp:151
void openDeviceSettingsDialog(const QPoint &p)
Definition: perseusgui.cpp:407
void updateStatus()
Definition: perseusgui.cpp:353
+ Here is the call graph for this function:

◆ ~PerseusGui()

PerseusGui::~PerseusGui ( )
virtual

Definition at line 67 of file perseusgui.cpp.

References ui.

68 {
69  delete ui;
70 }
Ui::PerseusGui * ui
Definition: perseusgui.h:57

Member Function Documentation

◆ blockApplySettings()

void PerseusGui::blockApplySettings ( bool  block)
inlineprivate

Definition at line 72 of file perseusgui.h.

Referenced by displaySettings(), and handleMessage().

72 { m_doApplySettings = !block; }
bool m_doApplySettings
Definition: perseusgui.h:60
+ Here is the caller graph for this function:

◆ deserialize()

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

Implements PluginInstanceGUI.

Definition at line 111 of file perseusgui.cpp.

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

112 {
113  if(m_settings.deserialize(data)) {
114  displaySettings();
115  m_forceSettings = true;
116  sendSettings();
117  return true;
118  } else {
119  resetToDefaults();
120  return false;
121  }
122 }
bool m_forceSettings
Definition: perseusgui.h:61
void resetToDefaults()
Definition: perseusgui.cpp:87
void displaySettings()
Definition: perseusgui.cpp:186
PerseusSettings m_settings
Definition: perseusgui.h:62
bool deserialize(const QByteArray &data)
void sendSettings()
Definition: perseusgui.cpp:248
+ Here is the call graph for this function:

◆ destroy()

void PerseusGui::destroy ( )
virtual

Implements PluginInstanceGUI.

Definition at line 72 of file perseusgui.cpp.

73 {
74  delete this;
75 }

◆ displaySampleRates()

void PerseusGui::displaySampleRates ( )
private

Definition at line 204 of file perseusgui.cpp.

References arg(), i, PerseusSettings::m_devSampleRateIndex, m_rates, m_settings, and ui.

Referenced by PerseusGui().

205 {
206  unsigned int savedIndex = m_settings.m_devSampleRateIndex;
207  ui->sampleRate->blockSignals(true);
208 
209  if (m_rates.size() > 0)
210  {
211  ui->sampleRate->clear();
212 
213  for (unsigned int i = 0; i < m_rates.size(); i++)
214  {
215  int sampleRate = m_rates[i]/1000;
216  ui->sampleRate->addItem(QString("%1").arg(QString("%1").arg(sampleRate, 5, 10, QChar(' '))));
217  }
218  }
219 
220  ui->sampleRate->blockSignals(false);
221 
222  if (savedIndex < m_rates.size())
223  {
224  ui->sampleRate->setCurrentIndex(savedIndex);
225  }
226  else
227  {
228  ui->sampleRate->setCurrentIndex((int) m_rates.size()-1);
229  }
230 }
quint32 m_devSampleRateIndex
std::vector< uint32_t > m_rates
Definition: perseusgui.h:65
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
Ui::PerseusGui * ui
Definition: perseusgui.h:57
int32_t i
Definition: decimators.h:244
PerseusSettings m_settings
Definition: perseusgui.h:62
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ displaySettings()

void PerseusGui::displaySettings ( )
private

Definition at line 186 of file perseusgui.cpp.

References arg(), blockApplySettings(), PerseusSettings::m_adcDither, PerseusSettings::m_adcPreamp, PerseusSettings::m_attenuator, PerseusSettings::m_centerFrequency, PerseusSettings::m_devSampleRateIndex, PerseusSettings::m_log2Decim, PerseusSettings::m_LOppmTenths, m_settings, PerseusSettings::m_transverterDeltaFrequency, PerseusSettings::m_transverterMode, PerseusSettings::m_wideBand, ui, and updateFrequencyLimits().

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

187 {
188  blockApplySettings(true);
190  ui->transverter->setDeltaFrequency(m_settings.m_transverterDeltaFrequency);
191  ui->transverter->setDeltaFrequencyActive(m_settings.m_transverterMode);
192  ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
193  ui->LOppm->setValue(m_settings.m_LOppmTenths);
194  ui->LOppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmTenths/10.0, 'f', 1)));
195  ui->sampleRate->setCurrentIndex(m_settings.m_devSampleRateIndex);
196  ui->decim->setCurrentIndex(m_settings.m_log2Decim);
197  ui->wideband->setChecked(m_settings.m_wideBand);
198  ui->adcDither->setChecked(m_settings.m_adcDither);
199  ui->adcPreamp->setChecked(m_settings.m_adcPreamp);
200  ui->attenuator->setCurrentIndex((int) m_settings.m_attenuator);
201  blockApplySettings(false);
202 }
qint64 m_transverterDeltaFrequency
Attenuator m_attenuator
quint32 m_devSampleRateIndex
void updateFrequencyLimits()
Definition: perseusgui.cpp:232
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
quint64 m_centerFrequency
Ui::PerseusGui * ui
Definition: perseusgui.h:57
void blockApplySettings(bool block)
Definition: perseusgui.h:72
PerseusSettings m_settings
Definition: perseusgui.h:62
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCenterFrequency()

qint64 PerseusGui::getCenterFrequency ( ) const
virtual

Implements PluginInstanceGUI.

Definition at line 94 of file perseusgui.cpp.

References PerseusSettings::m_centerFrequency, and m_settings.

95 {
97 }
quint64 m_centerFrequency
PerseusSettings m_settings
Definition: perseusgui.h:62

◆ getDevSampleRate()

uint32_t PerseusGui::getDevSampleRate ( unsigned int  index)

Definition at line 382 of file perseusgui.cpp.

References m_rates.

383 {
384  if (rate_index < m_rates.size())
385  {
386  return m_rates[rate_index];
387  }
388  else
389  {
390  return m_rates[0];
391  }
392 }
std::vector< uint32_t > m_rates
Definition: perseusgui.h:65

◆ getDevSampleRateIndex()

int PerseusGui::getDevSampleRateIndex ( uint32_t  sampleRate)

Definition at line 394 of file perseusgui.cpp.

References i, and m_rates.

395 {
396  for (unsigned int i=0; i < m_rates.size(); i++)
397  {
398  if (sampeRate == m_rates[i])
399  {
400  return i;
401  }
402  }
403 
404  return -1;
405 }
std::vector< uint32_t > m_rates
Definition: perseusgui.h:65
int32_t i
Definition: decimators.h:244

◆ getInputMessageQueue()

virtual MessageQueue* PerseusGui::getInputMessageQueue ( )
inlinevirtual

Implements PluginInstanceGUI.

Definition at line 51 of file perseusgui.h.

51 { return &m_inputMessageQueue; }
MessageQueue m_inputMessageQueue
Definition: perseusgui.h:70

◆ getName()

QString PerseusGui::getName ( ) const
virtual

Implements PluginInstanceGUI.

Definition at line 82 of file perseusgui.cpp.

83 {
84  return objectName();
85 }

◆ handleInputMessages

void PerseusGui::handleInputMessages ( )
privateslot

Definition at line 151 of file perseusgui.cpp.

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

Referenced by PerseusGui().

152 {
153  Message* message;
154 
155  while ((message = m_inputMessageQueue.pop()) != 0)
156  {
157  if (DSPSignalNotification::match(*message))
158  {
159  DSPSignalNotification* notif = (DSPSignalNotification*) message;
160  m_sampleRate = notif->getSampleRate();
162  qDebug("PerseusGui::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
164 
165  delete message;
166  }
167  else
168  {
169  qDebug("PerseusGui::handleInputMessages: message: %s", message->getIdentifier());
170 
171  if (handleMessage(*message))
172  {
173  delete message;
174  }
175  }
176  }
177 }
Message * pop()
Pop message from queue.
virtual bool handleMessage(const Message &message)
Definition: perseusgui.cpp:124
qint64 getCenterFrequency() const
Definition: dspcommands.h:329
static bool match(const Message *message)
Definition: message.cpp:45
quint64 m_deviceCenterFrequency
Center frequency in device.
Definition: perseusgui.h:68
int getSampleRate() const
Definition: dspcommands.h:328
virtual const char * getIdentifier() const
Definition: message.cpp:35
void updateSampleRateAndFrequency()
Definition: perseusgui.cpp:179
int m_sampleRate
Definition: perseusgui.h:67
MessageQueue m_inputMessageQueue
Definition: perseusgui.h:70
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleMessage()

bool PerseusGui::handleMessage ( const Message message)
virtual

Implements PluginInstanceGUI.

Definition at line 124 of file perseusgui.cpp.

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

Referenced by handleInputMessages().

125 {
126  // Returned messages to update the GUI (usually from web interface)
128  {
130  m_settings = cfg.getSettings();
131  blockApplySettings(true);
132  displaySettings();
133  blockApplySettings(false);
134  return true;
135  }
136  else if (PerseusInput::MsgStartStop::match(message))
137  {
139  blockApplySettings(true);
140  ui->startStop->setChecked(notif.getStartStop());
141  blockApplySettings(false);
142 
143  return true;
144  }
145  else
146  {
147  return false;
148  }
149 }
Ui::PerseusGui * ui
Definition: perseusgui.h:57
void blockApplySettings(bool block)
Definition: perseusgui.h:72
void displaySettings()
Definition: perseusgui.cpp:186
static bool match(const Message *message)
Definition: message.cpp:45
PerseusSettings m_settings
Definition: perseusgui.h:62
const PerseusSettings & getSettings() const
Definition: perseusinput.h:43
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ on_adcDither_toggled

void PerseusGui::on_adcDither_toggled ( bool  checked)
privateslot

Definition at line 332 of file perseusgui.cpp.

References PerseusSettings::m_adcDither, m_settings, and sendSettings().

333 {
334  m_settings.m_adcDither = checked;
335  sendSettings();
336 }
PerseusSettings m_settings
Definition: perseusgui.h:62
void sendSettings()
Definition: perseusgui.cpp:248
+ Here is the call graph for this function:

◆ on_adcPreamp_toggled

void PerseusGui::on_adcPreamp_toggled ( bool  checked)
privateslot

Definition at line 338 of file perseusgui.cpp.

References PerseusSettings::m_adcPreamp, m_settings, and sendSettings().

339 {
340  m_settings.m_adcPreamp = checked;
341  sendSettings();
342 }
PerseusSettings m_settings
Definition: perseusgui.h:62
void sendSettings()
Definition: perseusgui.cpp:248
+ Here is the call graph for this function:

◆ on_attenuator_currentIndexChanged

void PerseusGui::on_attenuator_currentIndexChanged ( int  index)
privateslot

Definition at line 323 of file perseusgui.cpp.

References PerseusSettings::Attenuator_last, PerseusSettings::m_attenuator, m_settings, and sendSettings().

324 {
325  if ((index < 0) || (index >= (int) PerseusSettings::Attenuator_last)) {
326  return;
327  }
329  sendSettings();
330 }
Attenuator m_attenuator
PerseusSettings m_settings
Definition: perseusgui.h:62
void sendSettings()
Definition: perseusgui.cpp:248
+ Here is the call graph for this function:

◆ on_centerFrequency_changed

void PerseusGui::on_centerFrequency_changed ( quint64  value)
privateslot

Definition at line 254 of file perseusgui.cpp.

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

255 {
256  m_settings.m_centerFrequency = value * 1000;
257  sendSettings();
258 }
quint64 m_centerFrequency
PerseusSettings m_settings
Definition: perseusgui.h:62
void sendSettings()
Definition: perseusgui.cpp:248
+ Here is the call graph for this function:

◆ on_decim_currentIndexChanged

void PerseusGui::on_decim_currentIndexChanged ( int  index)
privateslot

Definition at line 284 of file perseusgui.cpp.

References PerseusSettings::m_log2Decim, m_settings, and sendSettings().

285 {
286  if ((index < 0) || (index > 5))
287  return;
288  m_settings.m_log2Decim = index;
289  sendSettings();
290 }
PerseusSettings m_settings
Definition: perseusgui.h:62
void sendSettings()
Definition: perseusgui.cpp:248
+ Here is the call graph for this function:

◆ on_LOppm_valueChanged

void PerseusGui::on_LOppm_valueChanged ( int  value)
privateslot

Definition at line 260 of file perseusgui.cpp.

References arg(), PerseusSettings::m_LOppmTenths, m_settings, sendSettings(), and ui.

261 {
262  m_settings.m_LOppmTenths = value;
263  ui->LOppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmTenths/10.0, 'f', 1)));
264  sendSettings();
265 }
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
Ui::PerseusGui * ui
Definition: perseusgui.h:57
PerseusSettings m_settings
Definition: perseusgui.h:62
void sendSettings()
Definition: perseusgui.cpp:248
+ Here is the call graph for this function:

◆ on_record_toggled

void PerseusGui::on_record_toggled ( bool  checked)
privateslot

Definition at line 301 of file perseusgui.cpp.

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

302 {
303  if (checked) {
304  ui->record->setStyleSheet("QToolButton { background-color : red; }");
305  } else {
306  ui->record->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
307  }
308 
311 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue * getInputMessageQueue()
Ui::PerseusGui * ui
Definition: perseusgui.h:57
PerseusInput * m_sampleSource
Definition: perseusgui.h:66
static MsgFileRecord * create(bool startStop)
Definition: perseusinput.h:68
+ Here is the call graph for this function:

◆ on_resetLOppm_clicked

void PerseusGui::on_resetLOppm_clicked ( )
privateslot

Definition at line 267 of file perseusgui.cpp.

References ui.

268 {
269  ui->LOppm->setValue(0);
270 }
Ui::PerseusGui * ui
Definition: perseusgui.h:57

◆ on_sampleRate_currentIndexChanged

void PerseusGui::on_sampleRate_currentIndexChanged ( int  index)
privateslot

Definition at line 272 of file perseusgui.cpp.

References PerseusSettings::m_devSampleRateIndex, m_settings, and sendSettings().

273 {
275  sendSettings();
276 }
quint32 m_devSampleRateIndex
PerseusSettings m_settings
Definition: perseusgui.h:62
void sendSettings()
Definition: perseusgui.cpp:248
+ Here is the call graph for this function:

◆ on_startStop_toggled

void PerseusGui::on_startStop_toggled ( bool  checked)
privateslot

Definition at line 292 of file perseusgui.cpp.

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

293 {
294  if (m_doApplySettings)
295  {
298  }
299 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
bool m_doApplySettings
Definition: perseusgui.h:60
MessageQueue * getInputMessageQueue()
PerseusInput * m_sampleSource
Definition: perseusgui.h:66
static MsgStartStop * create(bool startStop)
Definition: perseusinput.h:87
+ Here is the call graph for this function:

◆ on_transverter_clicked

void PerseusGui::on_transverter_clicked ( )
privateslot

Definition at line 313 of file perseusgui.cpp.

References PerseusSettings::m_centerFrequency, m_settings, PerseusSettings::m_transverterDeltaFrequency, PerseusSettings::m_transverterMode, sendSettings(), ui, and updateFrequencyLimits().

314 {
315  m_settings.m_transverterMode = ui->transverter->getDeltaFrequencyAcive();
316  m_settings.m_transverterDeltaFrequency = ui->transverter->getDeltaFrequency();
317  qDebug("PerseusGui::on_transverter_clicked: %lld Hz %s", m_settings.m_transverterDeltaFrequency, m_settings.m_transverterMode ? "on" : "off");
319  m_settings.m_centerFrequency = ui->centerFrequency->getValueNew()*1000;
320  sendSettings();
321 }
qint64 m_transverterDeltaFrequency
void updateFrequencyLimits()
Definition: perseusgui.cpp:232
quint64 m_centerFrequency
Ui::PerseusGui * ui
Definition: perseusgui.h:57
PerseusSettings m_settings
Definition: perseusgui.h:62
void sendSettings()
Definition: perseusgui.cpp:248
+ Here is the call graph for this function:

◆ on_wideband_toggled

void PerseusGui::on_wideband_toggled ( bool  checked)
privateslot

Definition at line 278 of file perseusgui.cpp.

References m_settings, PerseusSettings::m_wideBand, and sendSettings().

279 {
280  m_settings.m_wideBand = checked;
281  sendSettings();
282 }
PerseusSettings m_settings
Definition: perseusgui.h:62
void sendSettings()
Definition: perseusgui.cpp:248
+ Here is the call graph for this function:

◆ openDeviceSettingsDialog

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

Definition at line 407 of file perseusgui.cpp.

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

Referenced by PerseusGui().

408 {
409  BasicDeviceSettingsDialog dialog(this);
410  dialog.setUseReverseAPI(m_settings.m_useReverseAPI);
411  dialog.setReverseAPIAddress(m_settings.m_reverseAPIAddress);
412  dialog.setReverseAPIPort(m_settings.m_reverseAPIPort);
413  dialog.setReverseAPIDeviceIndex(m_settings.m_reverseAPIDeviceIndex);
414 
415  dialog.move(p);
416  dialog.exec();
417 
418  m_settings.m_useReverseAPI = dialog.useReverseAPI();
419  m_settings.m_reverseAPIAddress = dialog.getReverseAPIAddress();
420  m_settings.m_reverseAPIPort = dialog.getReverseAPIPort();
421  m_settings.m_reverseAPIDeviceIndex = dialog.getReverseAPIDeviceIndex();
422 
423  sendSettings();
424 }
uint16_t m_reverseAPIDeviceIndex
QString m_reverseAPIAddress
PerseusSettings m_settings
Definition: perseusgui.h:62
uint16_t m_reverseAPIPort
void sendSettings()
Definition: perseusgui.cpp:248
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetToDefaults()

void PerseusGui::resetToDefaults ( )
virtual

Implements PluginInstanceGUI.

Definition at line 87 of file perseusgui.cpp.

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

Referenced by deserialize().

88 {
91  sendSettings();
92 }
void displaySettings()
Definition: perseusgui.cpp:186
PerseusSettings m_settings
Definition: perseusgui.h:62
void sendSettings()
Definition: perseusgui.cpp:248
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendSettings()

void PerseusGui::sendSettings ( )
private

◆ serialize()

QByteArray PerseusGui::serialize ( ) const
virtual

Implements PluginInstanceGUI.

Definition at line 106 of file perseusgui.cpp.

References m_settings, and PerseusSettings::serialize().

107 {
108  return m_settings.serialize();
109 }
QByteArray serialize() const
PerseusSettings m_settings
Definition: perseusgui.h:62
+ Here is the call graph for this function:

◆ setCenterFrequency()

void PerseusGui::setCenterFrequency ( qint64  centerFrequency)
virtual

Implements PluginInstanceGUI.

Definition at line 99 of file perseusgui.cpp.

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

100 {
101  m_settings.m_centerFrequency = centerFrequency;
102  displaySettings();
103  sendSettings();
104 }
quint64 m_centerFrequency
void displaySettings()
Definition: perseusgui.cpp:186
PerseusSettings m_settings
Definition: perseusgui.h:62
void sendSettings()
Definition: perseusgui.cpp:248
+ Here is the call graph for this function:

◆ setName()

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

Implements PluginInstanceGUI.

Definition at line 77 of file perseusgui.cpp.

78 {
79  setObjectName(name);
80 }

◆ updateFrequencyLimits()

void PerseusGui::updateFrequencyLimits ( )
private

Definition at line 232 of file perseusgui.cpp.

References m_settings, PerseusSettings::m_transverterDeltaFrequency, PerseusSettings::m_transverterMode, and ui.

Referenced by displaySettings(), on_transverter_clicked(), and PerseusGui().

233 {
234  // values in kHz
235  qint64 deltaFrequency = m_settings.m_transverterMode ? m_settings.m_transverterDeltaFrequency/1000 : 0;
236 
237  qint64 minLimit = 10 + deltaFrequency;
238  qint64 maxLimit = 40000 + deltaFrequency;
239 
240  minLimit = minLimit < 0 ? 0 : minLimit > 9999999 ? 9999999 : minLimit;
241  maxLimit = maxLimit < 0 ? 0 : maxLimit > 9999999 ? 9999999 : maxLimit;
242 
243  qDebug("PerseusGui::updateFrequencyLimits: delta: %lld min: %lld max: %lld", deltaFrequency, minLimit, maxLimit);
244 
245  ui->centerFrequency->setValueRange(7, minLimit, maxLimit);
246 }
qint64 m_transverterDeltaFrequency
Ui::PerseusGui * ui
Definition: perseusgui.h:57
PerseusSettings m_settings
Definition: perseusgui.h:62
+ Here is the caller graph for this function:

◆ updateHardware

void PerseusGui::updateHardware ( )
privateslot

Definition at line 344 of file perseusgui.cpp.

References PerseusInput::MsgConfigurePerseus::create(), DeviceSampleSource::getInputMessageQueue(), m_forceSettings, m_sampleSource, m_settings, m_updateTimer, and MessageQueue::push().

Referenced by PerseusGui().

345 {
346  qDebug() << "PerseusGui::updateHardware";
349  m_forceSettings = false;
350  m_updateTimer.stop();
351 }
bool m_forceSettings
Definition: perseusgui.h:61
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue * getInputMessageQueue()
static MsgConfigurePerseus * create(const PerseusSettings &settings, bool force)
Definition: perseusinput.h:46
PerseusInput * m_sampleSource
Definition: perseusgui.h:66
PerseusSettings m_settings
Definition: perseusgui.h:62
QTimer m_updateTimer
Definition: perseusgui.h:63
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateSampleRateAndFrequency()

void PerseusGui::updateSampleRateAndFrequency ( )
private

Definition at line 179 of file perseusgui.cpp.

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

Referenced by handleInputMessages().

180 {
183  ui->deviceRateText->setText(tr("%1k").arg((float)m_sampleRate / 1000));
184 }
void setSampleRate(qint32 sampleRate)
Definition: glspectrum.cpp:211
DeviceUISet * m_deviceUISet
Definition: perseusgui.h:59
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
GLSpectrum * getSpectrum()
Direct spectrum getter.
Definition: deviceuiset.h:57
Ui::PerseusGui * ui
Definition: perseusgui.h:57
quint64 m_deviceCenterFrequency
Center frequency in device.
Definition: perseusgui.h:68
void setCenterFrequency(qint64 frequency)
Definition: glspectrum.cpp:175
int m_sampleRate
Definition: perseusgui.h:67
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateStatus

void PerseusGui::updateStatus ( )
privateslot

Definition at line 353 of file perseusgui.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 PerseusGui().

354 {
355  int state = m_deviceUISet->m_deviceAPI->state();
356 
357  if(m_lastEngineState != state)
358  {
359  switch(state)
360  {
362  ui->startStop->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
363  break;
364  case DeviceAPI::StIdle:
365  ui->startStop->setStyleSheet("QToolButton { background-color : blue; }");
366  break;
368  ui->startStop->setStyleSheet("QToolButton { background-color : green; }");
369  break;
370  case DeviceAPI::StError:
371  ui->startStop->setStyleSheet("QToolButton { background-color : red; }");
372  QMessageBox::information(this, tr("Message"), m_deviceUISet->m_deviceAPI->errorMessage());
373  break;
374  default:
375  break;
376  }
377 
378  m_lastEngineState = state;
379  }
380 }
DeviceUISet * m_deviceUISet
Definition: perseusgui.h:59
QString errorMessage()
Last error message from the device engine.
Definition: deviceapi.cpp:290
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
Ui::PerseusGui * ui
Definition: perseusgui.h:57
DeviceAPI * m_deviceAPI
Definition: deviceuiset.h:48
engine is idle
Definition: deviceapi.h:54
int m_lastEngineState
Definition: perseusgui.h:69
engine is running
Definition: deviceapi.h:56
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 PerseusGui::m_deviceCenterFrequency
private

Center frequency in device.

Definition at line 68 of file perseusgui.h.

Referenced by handleInputMessages(), and updateSampleRateAndFrequency().

◆ m_deviceUISet

DeviceUISet* PerseusGui::m_deviceUISet
private

Definition at line 59 of file perseusgui.h.

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

◆ m_doApplySettings

bool PerseusGui::m_doApplySettings
private

Definition at line 60 of file perseusgui.h.

Referenced by on_startStop_toggled().

◆ m_forceSettings

bool PerseusGui::m_forceSettings
private

Definition at line 61 of file perseusgui.h.

Referenced by deserialize(), and updateHardware().

◆ m_inputMessageQueue

MessageQueue PerseusGui::m_inputMessageQueue
private

Definition at line 70 of file perseusgui.h.

Referenced by handleInputMessages(), and PerseusGui().

◆ m_lastEngineState

int PerseusGui::m_lastEngineState
private

Definition at line 69 of file perseusgui.h.

Referenced by updateStatus().

◆ m_rates

std::vector<uint32_t> PerseusGui::m_rates
private

◆ m_sampleRate

int PerseusGui::m_sampleRate
private

Definition at line 67 of file perseusgui.h.

Referenced by handleInputMessages(), and updateSampleRateAndFrequency().

◆ m_sampleSource

PerseusInput* PerseusGui::m_sampleSource
private

Definition at line 66 of file perseusgui.h.

Referenced by on_record_toggled(), on_startStop_toggled(), PerseusGui(), and updateHardware().

◆ m_settings

PerseusSettings PerseusGui::m_settings
private

◆ m_statusTimer

QTimer PerseusGui::m_statusTimer
private

Definition at line 64 of file perseusgui.h.

Referenced by PerseusGui().

◆ m_updateTimer

QTimer PerseusGui::m_updateTimer
private

Definition at line 63 of file perseusgui.h.

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

◆ ui

Ui::PerseusGui* PerseusGui::ui
private

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