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

#include <fileinputgui.h>

+ Inheritance diagram for FileInputGUI:
+ Collaboration diagram for FileInputGUI:

Public Member Functions

 FileInputGUI (DeviceUISet *deviceUISet, QWidget *parent=0)
 
virtual ~FileInputGUI ()
 
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_startStop_toggled (bool checked)
 
void on_playLoop_toggled (bool checked)
 
void on_play_toggled (bool checked)
 
void on_navTimeSlider_valueChanged (int value)
 
void on_showFileDialog_clicked (bool checked)
 
void on_acceleration_currentIndexChanged (int index)
 
void updateStatus ()
 
void tick ()
 
void openDeviceSettingsDialog (const QPoint &p)
 

Private Member Functions

void blockApplySettings (bool block)
 
void displaySettings ()
 
void displayTime ()
 
void sendSettings ()
 
void updateSampleRateAndFrequency ()
 
void configureFileName ()
 
void updateWithAcquisition ()
 
void updateWithStreamData ()
 
void updateWithStreamTime ()
 
void setAccelerationCombo ()
 
void setNumberStr (int n, QString &s)
 

Private Attributes

Ui::FileInputGUI * ui
 
DeviceUISetm_deviceUISet
 
FileInputSettings m_settings
 
bool m_doApplySettings
 
QTimer m_statusTimer
 
std::vector< int > m_gains
 
DeviceSampleSourcem_sampleSource
 
bool m_acquisition
 
QString m_fileName
 
int m_sampleRate
 
quint32 m_sampleSize
 
quint64 m_centerFrequency
 
quint64 m_recordLength
 
quint64 m_startingTimeStamp
 
quint64 m_samplesCount
 
std::size_t m_tickCount
 
bool m_enableNavTime
 
int m_deviceSampleRate
 
quint64 m_deviceCenterFrequency
 Center frequency in device. More...
 
int m_lastEngineState
 
MessageQueue m_inputMessageQueue
 

Detailed Description

Definition at line 36 of file fileinputgui.h.

Constructor & Destructor Documentation

◆ FileInputGUI()

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

Definition at line 41 of file fileinputgui.cpp.

References displaySettings(), DeviceAPI::getMasterTimer(), DeviceAPI::getSampleSource(), ColorMapper::GrayGold, handleInputMessages(), DeviceUISet::m_deviceAPI, m_deviceUISet, m_fileName, m_inputMessageQueue, m_sampleSource, m_statusTimer, openDeviceSettingsDialog(), setAccelerationCombo(), DeviceSampleSource::setMessageQueueToGUI(), tick(), ui, and updateStatus().

41  :
42  QWidget(parent),
43  ui(new Ui::FileInputGUI),
44  m_deviceUISet(deviceUISet),
45  m_settings(),
46  m_doApplySettings(true),
47  m_sampleSource(0),
48  m_acquisition(false),
49  m_fileName("..."),
50  m_sampleRate(0),
52  m_recordLength(0),
54  m_samplesCount(0),
55  m_tickCount(0),
56  m_enableNavTime(false),
58 {
59  ui->setupUi(this);
60  ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
61  ui->centerFrequency->setValueRange(7, 0, pow(10,7));
62  ui->fileNameText->setText(m_fileName);
63  ui->crcLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
64 
65  connect(&(m_deviceUISet->m_deviceAPI->getMasterTimer()), SIGNAL(timeout()), this, SLOT(tick()));
66  connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
67  m_statusTimer.start(500);
68 
69  CRightClickEnabler *startStopRightClickEnabler = new CRightClickEnabler(ui->startStop);
70  connect(startStopRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(openDeviceSettingsDialog(const QPoint &)));
71 
74 
75  ui->navTimeSlider->setEnabled(false);
76  ui->acceleration->setEnabled(false);
77 
79 
80  connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
82 }
quint64 m_centerFrequency
Definition: fileinputgui.h:68
bool m_doApplySettings
Definition: fileinputgui.h:60
FileInputSettings m_settings
Definition: fileinputgui.h:59
DeviceSampleSource * getSampleSource()
Return pointer to the device sample source (single Rx) or nullptr.
Definition: deviceapi.cpp:213
int m_lastEngineState
Definition: fileinputgui.h:76
quint64 m_startingTimeStamp
Definition: fileinputgui.h:70
const QTimer & getMasterTimer() const
This is the DSPEngine master timer.
Definition: deviceapi.h:173
DeviceUISet * m_deviceUISet
Definition: fileinputgui.h:58
std::size_t m_tickCount
Definition: fileinputgui.h:72
Ui::FileInputGUI * ui
Definition: fileinputgui.h:56
engine is before initialization
Definition: deviceapi.h:53
DeviceAPI * m_deviceAPI
Definition: deviceuiset.h:48
quint64 m_samplesCount
Definition: fileinputgui.h:71
QString m_fileName
Definition: fileinputgui.h:65
MessageQueue m_inputMessageQueue
Definition: fileinputgui.h:77
void setAccelerationCombo()
void handleInputMessages()
QTimer m_statusTimer
Definition: fileinputgui.h:61
void openDeviceSettingsDialog(const QPoint &p)
void displaySettings()
void updateStatus()
bool m_acquisition
Definition: fileinputgui.h:64
quint64 m_recordLength
Definition: fileinputgui.h:69
virtual void setMessageQueueToGUI(MessageQueue *queue)=0
DeviceSampleSource * m_sampleSource
Definition: fileinputgui.h:63
bool m_enableNavTime
Definition: fileinputgui.h:73
+ Here is the call graph for this function:

◆ ~FileInputGUI()

FileInputGUI::~FileInputGUI ( )
virtual

Definition at line 84 of file fileinputgui.cpp.

References ui.

85 {
86  delete ui;
87 }
Ui::FileInputGUI * ui
Definition: fileinputgui.h:56

Member Function Documentation

◆ blockApplySettings()

void FileInputGUI::blockApplySettings ( bool  block)
inlineprivate

Definition at line 79 of file fileinputgui.h.

Referenced by displaySettings(), and handleMessage().

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

◆ configureFileName()

void FileInputGUI::configureFileName ( )
private

Definition at line 344 of file fileinputgui.cpp.

References FileInput::MsgConfigureFileSourceName::create(), DeviceSampleSource::getInputMessageQueue(), m_fileName, m_sampleSource, and MessageQueue::push().

Referenced by on_showFileDialog_clicked().

345 {
346  qDebug() << "FileInputGUI::configureFileName: " << m_fileName.toStdString().c_str();
349 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue * getInputMessageQueue()
QString m_fileName
Definition: fileinputgui.h:65
static MsgConfigureFileSourceName * create(const QString &fileName)
Definition: fileinput.h:70
DeviceSampleSource * m_sampleSource
Definition: fileinputgui.h:63
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deserialize()

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

Implements PluginInstanceGUI.

Definition at line 128 of file fileinputgui.cpp.

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

129 {
130  if(m_settings.deserialize(data)) {
131  displaySettings();
132  sendSettings();
133  return true;
134  } else {
135  resetToDefaults();
136  return false;
137  }
138 }
FileInputSettings m_settings
Definition: fileinputgui.h:59
bool deserialize(const QByteArray &data)
void displaySettings()
void resetToDefaults()
void sendSettings()
+ Here is the call graph for this function:

◆ destroy()

void FileInputGUI::destroy ( )
virtual

Implements PluginInstanceGUI.

Definition at line 89 of file fileinputgui.cpp.

90 {
91  delete this;
92 }

◆ displaySettings()

void FileInputGUI::displaySettings ( )
private

Definition at line 241 of file fileinputgui.cpp.

References blockApplySettings(), FileInputSettings::getAccelerationIndex(), FileInputSettings::m_accelerationFactor, FileInputSettings::m_loop, m_settings, and ui.

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

242 {
243  blockApplySettings(true);
244  ui->playLoop->setChecked(m_settings.m_loop);
246  blockApplySettings(false);
247 }
void blockApplySettings(bool block)
Definition: fileinputgui.h:79
FileInputSettings m_settings
Definition: fileinputgui.h:59
Ui::FileInputGUI * ui
Definition: fileinputgui.h:56
static int getAccelerationIndex(int averaging)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ displayTime()

void FileInputGUI::displayTime ( )
private

◆ getCenterFrequency()

qint64 FileInputGUI::getCenterFrequency ( ) const
virtual

Implements PluginInstanceGUI.

Definition at line 111 of file fileinputgui.cpp.

References m_centerFrequency.

112 {
113  return m_centerFrequency;
114 }
quint64 m_centerFrequency
Definition: fileinputgui.h:68

◆ getInputMessageQueue()

virtual MessageQueue* FileInputGUI::getInputMessageQueue ( )
inlinevirtual

Implements PluginInstanceGUI.

Definition at line 52 of file fileinputgui.h.

52 { return &m_inputMessageQueue; }
MessageQueue m_inputMessageQueue
Definition: fileinputgui.h:77

◆ getName()

QString FileInputGUI::getName ( ) const
virtual

Implements PluginInstanceGUI.

Definition at line 99 of file fileinputgui.cpp.

100 {
101  return objectName();
102 }

◆ handleInputMessages

void FileInputGUI::handleInputMessages ( )
privateslot

Definition at line 140 of file fileinputgui.cpp.

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

Referenced by FileInputGUI().

141 {
142  Message* message;
143 
144  while ((message = m_inputMessageQueue.pop()) != 0)
145  {
146  if (DSPSignalNotification::match(*message))
147  {
148  DSPSignalNotification* notif = (DSPSignalNotification*) message;
151  qDebug("FileInputGUI::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
153 
154  delete message;
155  }
156  else
157  {
158  if (handleMessage(*message))
159  {
160  delete message;
161  }
162  }
163  }
164 }
Message * pop()
Pop message from queue.
int m_deviceSampleRate
Definition: fileinputgui.h:74
qint64 getCenterFrequency() const
Definition: dspcommands.h:329
void updateSampleRateAndFrequency()
MessageQueue m_inputMessageQueue
Definition: fileinputgui.h:77
static bool match(const Message *message)
Definition: message.cpp:45
quint64 m_deviceCenterFrequency
Center frequency in device.
Definition: fileinputgui.h:75
int getSampleRate() const
Definition: dspcommands.h:328
virtual bool handleMessage(const Message &message)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleMessage()

bool FileInputGUI::handleMessage ( const Message message)
virtual

Implements PluginInstanceGUI.

Definition at line 166 of file fileinputgui.cpp.

References blockApplySettings(), displaySettings(), FileInput::MsgPlayPause::getPlayPause(), FileInput::MsgConfigureFileInput::getSettings(), FileInput::MsgStartStop::getStartStop(), FileInput::MsgReportHeaderCRC::isOK(), m_acquisition, m_centerFrequency, m_enableNavTime, m_recordLength, m_sampleRate, m_samplesCount, m_sampleSize, m_settings, m_startingTimeStamp, Message::match(), ui, updateWithAcquisition(), updateWithStreamData(), and updateWithStreamTime().

Referenced by handleInputMessages().

167 {
169  {
171  m_settings = cfg.getSettings();
172  displaySettings();
173  return true;
174  }
176  {
177  m_acquisition = ((FileInput::MsgReportFileSourceAcquisition&)message).getAcquisition();
179  return true;
180  }
182  {
183  m_sampleRate = ((FileInput::MsgReportFileInputStreamData&)message).getSampleRate();
184  m_sampleSize = ((FileInput::MsgReportFileInputStreamData&)message).getSampleSize();
185  m_centerFrequency = ((FileInput::MsgReportFileInputStreamData&)message).getCenterFrequency();
186  m_startingTimeStamp = ((FileInput::MsgReportFileInputStreamData&)message).getStartingTimeStamp();
187  m_recordLength = ((FileInput::MsgReportFileInputStreamData&)message).getRecordLength();
189  return true;
190  }
192  {
193  m_samplesCount = ((FileInput::MsgReportFileInputStreamTiming&)message).getSamplesCount();
195  return true;
196  }
197  else if (FileInput::MsgStartStop::match(message))
198  {
200  blockApplySettings(true);
201  ui->startStop->setChecked(notif.getStartStop());
202  blockApplySettings(false);
203 
204  return true;
205  }
206  else if (FileInput::MsgPlayPause::match(message))
207  {
209  bool checked = notif.getPlayPause();
210  ui->play->setChecked(checked);
211  ui->navTimeSlider->setEnabled(!checked);
212  ui->acceleration->setEnabled(!checked);
213  m_enableNavTime = !checked;
214 
215  return true;
216  }
217  else if (FileInput::MsgReportHeaderCRC::match(message))
218  {
220  if (notif.isOK()) {
221  ui->crcLabel->setStyleSheet("QLabel { background-color : green; }");
222  } else {
223  ui->crcLabel->setStyleSheet("QLabel { background-color : red; }");
224  }
225 
226  return true;
227  }
228  else
229  {
230  return false;
231  }
232 }
quint64 m_centerFrequency
Definition: fileinputgui.h:68
void blockApplySettings(bool block)
Definition: fileinputgui.h:79
FileInputSettings m_settings
Definition: fileinputgui.h:59
quint64 m_startingTimeStamp
Definition: fileinputgui.h:70
quint32 m_sampleSize
Definition: fileinputgui.h:67
Ui::FileInputGUI * ui
Definition: fileinputgui.h:56
void updateWithStreamTime()
quint64 m_samplesCount
Definition: fileinputgui.h:71
void updateWithStreamData()
static bool match(const Message *message)
Definition: message.cpp:45
const FileInputSettings & getSettings() const
Definition: fileinput.h:45
bool getStartStop() const
Definition: fileinput.h:165
void displaySettings()
void updateWithAcquisition()
bool m_acquisition
Definition: fileinputgui.h:64
quint64 m_recordLength
Definition: fileinputgui.h:69
bool m_enableNavTime
Definition: fileinputgui.h:73
bool getPlayPause() const
Definition: fileinput.h:184
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ on_acceleration_currentIndexChanged

void FileInputGUI::on_acceleration_currentIndexChanged ( int  index)
privateslot

Definition at line 334 of file fileinputgui.cpp.

References FileInput::MsgConfigureFileInput::create(), FileInputSettings::getAccelerationValue(), DeviceSampleSource::getInputMessageQueue(), FileInputSettings::m_accelerationFactor, m_doApplySettings, m_sampleSource, m_settings, and MessageQueue::push().

335 {
336  if (m_doApplySettings)
337  {
341  }
342 }
bool m_doApplySettings
Definition: fileinputgui.h:60
void push(Message *message, bool emitSignal=true)
Push message onto queue.
FileInputSettings m_settings
Definition: fileinputgui.h:59
MessageQueue * getInputMessageQueue()
static MsgConfigureFileInput * create(const FileInputSettings &settings, bool force)
Definition: fileinput.h:48
static int getAccelerationValue(int averagingIndex)
DeviceSampleSource * m_sampleSource
Definition: fileinputgui.h:63
+ Here is the call graph for this function:

◆ on_navTimeSlider_valueChanged

void FileInputGUI::on_navTimeSlider_valueChanged ( int  value)
privateslot

Definition at line 310 of file fileinputgui.cpp.

References FileInput::MsgConfigureFileSourceSeek::create(), DeviceSampleSource::getInputMessageQueue(), m_enableNavTime, m_sampleSource, and MessageQueue::push().

311 {
312  if (m_enableNavTime && ((value >= 0) && (value <= 1000)))
313  {
316  }
317 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue * getInputMessageQueue()
static MsgConfigureFileSourceSeek * create(int seekMillis)
Definition: fileinput.h:127
DeviceSampleSource * m_sampleSource
Definition: fileinputgui.h:63
bool m_enableNavTime
Definition: fileinputgui.h:73
+ Here is the call graph for this function:

◆ on_play_toggled

void FileInputGUI::on_play_toggled ( bool  checked)
privateslot

Definition at line 301 of file fileinputgui.cpp.

References FileInput::MsgConfigureFileInputWork::create(), DeviceSampleSource::getInputMessageQueue(), m_enableNavTime, m_sampleSource, MessageQueue::push(), and ui.

302 {
305  ui->navTimeSlider->setEnabled(!checked);
306  ui->acceleration->setEnabled(!checked);
307  m_enableNavTime = !checked;
308 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue * getInputMessageQueue()
static MsgConfigureFileInputWork * create(bool working)
Definition: fileinput.h:90
Ui::FileInputGUI * ui
Definition: fileinputgui.h:56
DeviceSampleSource * m_sampleSource
Definition: fileinputgui.h:63
bool m_enableNavTime
Definition: fileinputgui.h:73
+ Here is the call graph for this function:

◆ on_playLoop_toggled

void FileInputGUI::on_playLoop_toggled ( bool  checked)
privateslot

Definition at line 253 of file fileinputgui.cpp.

References FileInput::MsgConfigureFileInput::create(), DeviceSampleSource::getInputMessageQueue(), m_doApplySettings, FileInputSettings::m_loop, m_sampleSource, m_settings, and MessageQueue::push().

254 {
255  if (m_doApplySettings)
256  {
257  m_settings.m_loop = checked;
260  }
261 }
bool m_doApplySettings
Definition: fileinputgui.h:60
void push(Message *message, bool emitSignal=true)
Push message onto queue.
FileInputSettings m_settings
Definition: fileinputgui.h:59
MessageQueue * getInputMessageQueue()
static MsgConfigureFileInput * create(const FileInputSettings &settings, bool force)
Definition: fileinput.h:48
DeviceSampleSource * m_sampleSource
Definition: fileinputgui.h:63
+ Here is the call graph for this function:

◆ on_showFileDialog_clicked

void FileInputGUI::on_showFileDialog_clicked ( bool  checked)
privateslot

Definition at line 319 of file fileinputgui.cpp.

References configureFileName(), m_fileName, and ui.

320 {
321  (void) checked;
322  QString fileName = QFileDialog::getOpenFileName(this,
323  tr("Open I/Q record file"), ".", tr("SDR I/Q Files (*.sdriq)"), 0, QFileDialog::DontUseNativeDialog);
324 
325  if (fileName != "")
326  {
327  m_fileName = fileName;
328  ui->fileNameText->setText(m_fileName);
329  ui->crcLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
331  }
332 }
void configureFileName()
Ui::FileInputGUI * ui
Definition: fileinputgui.h:56
QString m_fileName
Definition: fileinputgui.h:65
+ Here is the call graph for this function:

◆ on_startStop_toggled

void FileInputGUI::on_startStop_toggled ( bool  checked)
privateslot

Definition at line 263 of file fileinputgui.cpp.

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

264 {
265  if (m_doApplySettings)
266  {
269  }
270 }
bool m_doApplySettings
Definition: fileinputgui.h:60
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue * getInputMessageQueue()
DeviceSampleSource * m_sampleSource
Definition: fileinputgui.h:63
static MsgStartStop * create(bool startStop)
Definition: fileinput.h:167
+ Here is the call graph for this function:

◆ openDeviceSettingsDialog

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

Definition at line 448 of file fileinputgui.cpp.

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

Referenced by FileInputGUI().

449 {
450  BasicDeviceSettingsDialog dialog(this);
451  dialog.setUseReverseAPI(m_settings.m_useReverseAPI);
452  dialog.setReverseAPIAddress(m_settings.m_reverseAPIAddress);
453  dialog.setReverseAPIPort(m_settings.m_reverseAPIPort);
454  dialog.setReverseAPIDeviceIndex(m_settings.m_reverseAPIDeviceIndex);
455 
456  dialog.move(p);
457  dialog.exec();
458 
459  m_settings.m_useReverseAPI = dialog.useReverseAPI();
460  m_settings.m_reverseAPIAddress = dialog.getReverseAPIAddress();
461  m_settings.m_reverseAPIPort = dialog.getReverseAPIPort();
462  m_settings.m_reverseAPIDeviceIndex = dialog.getReverseAPIDeviceIndex();
463 
464  sendSettings();
465 }
FileInputSettings m_settings
Definition: fileinputgui.h:59
uint16_t m_reverseAPIDeviceIndex
void sendSettings()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetToDefaults()

void FileInputGUI::resetToDefaults ( )
virtual

Implements PluginInstanceGUI.

Definition at line 104 of file fileinputgui.cpp.

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

Referenced by deserialize().

105 {
107  displaySettings();
108  sendSettings();
109 }
FileInputSettings m_settings
Definition: fileinputgui.h:59
void displaySettings()
void sendSettings()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendSettings()

void FileInputGUI::sendSettings ( )
private

Definition at line 249 of file fileinputgui.cpp.

Referenced by deserialize(), openDeviceSettingsDialog(), resetToDefaults(), and setCenterFrequency().

250 {
251 }
+ Here is the caller graph for this function:

◆ serialize()

QByteArray FileInputGUI::serialize ( ) const
virtual

Implements PluginInstanceGUI.

Definition at line 123 of file fileinputgui.cpp.

References m_settings, and FileInputSettings::serialize().

124 {
125  return m_settings.serialize();
126 }
FileInputSettings m_settings
Definition: fileinputgui.h:59
QByteArray serialize() const
+ Here is the call graph for this function:

◆ setAccelerationCombo()

void FileInputGUI::setAccelerationCombo ( )
private

Definition at line 409 of file fileinputgui.cpp.

References i, FileInputSettings::m_accelerationMaxScale, setNumberStr(), and ui.

Referenced by FileInputGUI().

410 {
411  ui->acceleration->blockSignals(true);
412  ui->acceleration->clear();
413  ui->acceleration->addItem(QString("1"));
414 
415  for (unsigned int i = 0; i <= FileInputSettings::m_accelerationMaxScale; i++)
416  {
417  QString s;
418  int m = pow(10.0, i);
419  int x = 2*m;
420  setNumberStr(x, s);
421  ui->acceleration->addItem(s);
422  x = 5*m;
423  setNumberStr(x, s);
424  ui->acceleration->addItem(s);
425  x = 10*m;
426  setNumberStr(x, s);
427  ui->acceleration->addItem(s);
428  }
429 
430  ui->acceleration->blockSignals(false);
431 }
Ui::FileInputGUI * ui
Definition: fileinputgui.h:56
int32_t i
Definition: decimators.h:244
void setNumberStr(int n, QString &s)
static const unsigned int m_accelerationMaxScale
Max power of 10 multiplier to 2,5,10 base ex: 2 -> 2,5,10,20,50,100,200,500,1000. ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCenterFrequency()

void FileInputGUI::setCenterFrequency ( qint64  centerFrequency)
virtual

Implements PluginInstanceGUI.

Definition at line 116 of file fileinputgui.cpp.

References displaySettings(), m_centerFrequency, and sendSettings().

117 {
118  m_centerFrequency = centerFrequency;
119  displaySettings();
120  sendSettings();
121 }
quint64 m_centerFrequency
Definition: fileinputgui.h:68
void displaySettings()
void sendSettings()
+ Here is the call graph for this function:

◆ setName()

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

Implements PluginInstanceGUI.

Definition at line 94 of file fileinputgui.cpp.

95 {
96  setObjectName(name);
97 }

◆ setNumberStr()

void FileInputGUI::setNumberStr ( int  n,
QString &  s 
)
private

Definition at line 433 of file fileinputgui.cpp.

Referenced by setAccelerationCombo().

434 {
435  if (n < 1000) {
436  s = tr("%1").arg(n);
437  } else if (n < 100000) {
438  s = tr("%1k").arg(n/1000);
439  } else if (n < 1000000) {
440  s = tr("%1e5").arg(n/100000);
441  } else if (n < 1000000000) {
442  s = tr("%1M").arg(n/1000000);
443  } else {
444  s = tr("%1G").arg(n/1000000000);
445  }
446 }
+ Here is the caller graph for this function:

◆ tick

void FileInputGUI::tick ( )
privateslot

Definition at line 401 of file fileinputgui.cpp.

References FileInput::MsgConfigureFileInputStreamTiming::create(), DeviceSampleSource::getInputMessageQueue(), m_sampleSource, m_tickCount, and MessageQueue::push().

Referenced by FileInputGUI().

402 {
403  if ((++m_tickCount & 0xf) == 0) {
406  }
407 }
static MsgConfigureFileInputStreamTiming * create()
Definition: fileinput.h:109
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue * getInputMessageQueue()
std::size_t m_tickCount
Definition: fileinputgui.h:72
DeviceSampleSource * m_sampleSource
Definition: fileinputgui.h:63
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateSampleRateAndFrequency()

void FileInputGUI::updateSampleRateAndFrequency ( )
private

Definition at line 234 of file fileinputgui.cpp.

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

Referenced by handleInputMessages().

235 {
238  ui->deviceRateText->setText(tr("%1k").arg((float)m_deviceSampleRate / 1000));
239 }
void setSampleRate(qint32 sampleRate)
Definition: glspectrum.cpp:211
DeviceUISet * m_deviceUISet
Definition: fileinputgui.h:58
int m_deviceSampleRate
Definition: fileinputgui.h:74
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
Ui::FileInputGUI * ui
Definition: fileinputgui.h:56
GLSpectrum * getSpectrum()
Direct spectrum getter.
Definition: deviceuiset.h:57
quint64 m_deviceCenterFrequency
Center frequency in device.
Definition: fileinputgui.h:75
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 FileInputGUI::updateStatus ( )
privateslot

Definition at line 272 of file fileinputgui.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 FileInputGUI().

273 {
274  int state = m_deviceUISet->m_deviceAPI->state();
275 
276  if(m_lastEngineState != state)
277  {
278  switch(state)
279  {
281  ui->startStop->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
282  break;
283  case DeviceAPI::StIdle:
284  ui->startStop->setStyleSheet("QToolButton { background-color : blue; }");
285  break;
287  ui->startStop->setStyleSheet("QToolButton { background-color : green; }");
288  break;
289  case DeviceAPI::StError:
290  ui->startStop->setStyleSheet("QToolButton { background-color : red; }");
291  QMessageBox::information(this, tr("Message"), m_deviceUISet->m_deviceAPI->errorMessage());
292  break;
293  default:
294  break;
295  }
296 
297  m_lastEngineState = state;
298  }
299 }
int m_lastEngineState
Definition: fileinputgui.h:76
DeviceUISet * m_deviceUISet
Definition: fileinputgui.h:58
QString errorMessage()
Last error message from the device engine.
Definition: deviceapi.cpp:290
Ui::FileInputGUI * ui
Definition: fileinputgui.h:56
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
engine is in error
Definition: deviceapi.h:57
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateWithAcquisition()

void FileInputGUI::updateWithAcquisition ( )
private

Definition at line 351 of file fileinputgui.cpp.

References m_acquisition, and ui.

Referenced by handleMessage().

352 {
353  ui->play->setEnabled(m_acquisition);
354  ui->play->setChecked(m_acquisition);
355  ui->showFileDialog->setEnabled(!m_acquisition);
356 }
Ui::FileInputGUI * ui
Definition: fileinputgui.h:56
bool m_acquisition
Definition: fileinputgui.h:64
+ Here is the caller graph for this function:

◆ updateWithStreamData()

void FileInputGUI::updateWithStreamData ( )
private

Definition at line 358 of file fileinputgui.cpp.

References arg(), m_acquisition, m_centerFrequency, m_recordLength, m_sampleRate, m_sampleSize, ui, and updateWithStreamTime().

Referenced by handleMessage().

359 {
360  ui->centerFrequency->setValue(m_centerFrequency/1000);
361  ui->sampleRateText->setText(tr("%1k").arg((float)m_sampleRate / 1000));
362  ui->sampleSizeText->setText(tr("%1b").arg(m_sampleSize));
363  ui->play->setEnabled(m_acquisition);
364  QTime recordLength(0, 0, 0, 0);
365  recordLength = recordLength.addSecs(m_recordLength);
366  QString s_time = recordLength.toString("HH:mm:ss");
367  ui->recordLengthText->setText(s_time);
369 }
quint64 m_centerFrequency
Definition: fileinputgui.h:68
quint32 m_sampleSize
Definition: fileinputgui.h:67
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
Ui::FileInputGUI * ui
Definition: fileinputgui.h:56
void updateWithStreamTime()
bool m_acquisition
Definition: fileinputgui.h:64
quint64 m_recordLength
Definition: fileinputgui.h:69
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateWithStreamTime()

void FileInputGUI::updateWithStreamTime ( )
private

Definition at line 371 of file fileinputgui.cpp.

References m_enableNavTime, m_recordLength, m_sampleRate, m_samplesCount, m_startingTimeStamp, and ui.

Referenced by handleMessage(), and updateWithStreamData().

372 {
373  qint64 t_sec = 0;
374  qint64 t_msec = 0;
375 
376  if (m_sampleRate > 0){
377  t_sec = m_samplesCount / m_sampleRate;
378  t_msec = (m_samplesCount - (t_sec * m_sampleRate)) * 1000LL / m_sampleRate;
379  }
380 
381  QTime t(0, 0, 0, 0);
382  t = t.addSecs(t_sec);
383  t = t.addMSecs(t_msec);
384  QString s_timems = t.toString("HH:mm:ss.zzz");
385  ui->relTimeText->setText(s_timems);
386 
387  qint64 startingTimeStampMsec = m_startingTimeStamp * 1000LL;
388  QDateTime dt = QDateTime::fromMSecsSinceEpoch(startingTimeStampMsec);
389  dt = dt.addSecs(t_sec);
390  dt = dt.addMSecs(t_msec);
391  QString s_date = dt.toString("yyyy-MM-dd HH:mm:ss.zzz");
392  ui->absTimeText->setText(s_date);
393 
394  if (!m_enableNavTime)
395  {
396  float posRatio = (float) t_sec / (float) m_recordLength;
397  ui->navTimeSlider->setValue((int) (posRatio * 1000.0));
398  }
399 }
quint64 m_startingTimeStamp
Definition: fileinputgui.h:70
Ui::FileInputGUI * ui
Definition: fileinputgui.h:56
quint64 m_samplesCount
Definition: fileinputgui.h:71
quint64 m_recordLength
Definition: fileinputgui.h:69
bool m_enableNavTime
Definition: fileinputgui.h:73
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_acquisition

bool FileInputGUI::m_acquisition
private

Definition at line 64 of file fileinputgui.h.

Referenced by handleMessage(), updateWithAcquisition(), and updateWithStreamData().

◆ m_centerFrequency

quint64 FileInputGUI::m_centerFrequency
private

◆ m_deviceCenterFrequency

quint64 FileInputGUI::m_deviceCenterFrequency
private

Center frequency in device.

Definition at line 75 of file fileinputgui.h.

Referenced by handleInputMessages(), and updateSampleRateAndFrequency().

◆ m_deviceSampleRate

int FileInputGUI::m_deviceSampleRate
private

Definition at line 74 of file fileinputgui.h.

Referenced by handleInputMessages(), and updateSampleRateAndFrequency().

◆ m_deviceUISet

DeviceUISet* FileInputGUI::m_deviceUISet
private

Definition at line 58 of file fileinputgui.h.

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

◆ m_doApplySettings

bool FileInputGUI::m_doApplySettings
private

◆ m_enableNavTime

bool FileInputGUI::m_enableNavTime
private

◆ m_fileName

QString FileInputGUI::m_fileName
private

Definition at line 65 of file fileinputgui.h.

Referenced by configureFileName(), FileInputGUI(), and on_showFileDialog_clicked().

◆ m_gains

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

Definition at line 62 of file fileinputgui.h.

◆ m_inputMessageQueue

MessageQueue FileInputGUI::m_inputMessageQueue
private

Definition at line 77 of file fileinputgui.h.

Referenced by FileInputGUI(), and handleInputMessages().

◆ m_lastEngineState

int FileInputGUI::m_lastEngineState
private

Definition at line 76 of file fileinputgui.h.

Referenced by updateStatus().

◆ m_recordLength

quint64 FileInputGUI::m_recordLength
private

Definition at line 69 of file fileinputgui.h.

Referenced by handleMessage(), updateWithStreamData(), and updateWithStreamTime().

◆ m_sampleRate

int FileInputGUI::m_sampleRate
private

Definition at line 66 of file fileinputgui.h.

Referenced by handleMessage(), updateWithStreamData(), and updateWithStreamTime().

◆ m_samplesCount

quint64 FileInputGUI::m_samplesCount
private

Definition at line 71 of file fileinputgui.h.

Referenced by handleMessage(), and updateWithStreamTime().

◆ m_sampleSize

quint32 FileInputGUI::m_sampleSize
private

Definition at line 67 of file fileinputgui.h.

Referenced by handleMessage(), and updateWithStreamData().

◆ m_sampleSource

DeviceSampleSource* FileInputGUI::m_sampleSource
private

◆ m_settings

FileInputSettings FileInputGUI::m_settings
private

◆ m_startingTimeStamp

quint64 FileInputGUI::m_startingTimeStamp
private

Definition at line 70 of file fileinputgui.h.

Referenced by handleMessage(), and updateWithStreamTime().

◆ m_statusTimer

QTimer FileInputGUI::m_statusTimer
private

Definition at line 61 of file fileinputgui.h.

Referenced by FileInputGUI().

◆ m_tickCount

std::size_t FileInputGUI::m_tickCount
private

Definition at line 72 of file fileinputgui.h.

Referenced by tick().

◆ ui

Ui::FileInputGUI* FileInputGUI::ui
private

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