mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-21 23:55:13 -05:00
Sonar fixes
This commit is contained in:
parent
3a7de65ee5
commit
36349e2837
@ -59,6 +59,7 @@ void WDSPRxBaseband::reset()
|
|||||||
{
|
{
|
||||||
QMutexLocker mutexLocker(&m_mutex);
|
QMutexLocker mutexLocker(&m_mutex);
|
||||||
m_sink.applyAudioSampleRate(DSPEngine::instance()->getAudioDeviceManager()->getOutputSampleRate());
|
m_sink.applyAudioSampleRate(DSPEngine::instance()->getAudioDeviceManager()->getOutputSampleRate());
|
||||||
|
mutexLocker.unlock();
|
||||||
m_sampleFifo.reset();
|
m_sampleFifo.reset();
|
||||||
m_channelSampleRate = 0;
|
m_channelSampleRate = 0;
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
|
|
||||||
WDSPRxGUI* WDSPRxGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel)
|
WDSPRxGUI* WDSPRxGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel)
|
||||||
{
|
{
|
||||||
WDSPRxGUI* gui = new WDSPRxGUI(pluginAPI, deviceUISet, rxChannel);
|
auto* gui = new WDSPRxGUI(pluginAPI, deviceUISet, rxChannel);
|
||||||
return gui;
|
return gui;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ bool WDSPRxGUI::handleMessage(const Message& message)
|
|||||||
if (WDSPRx::MsgConfigureWDSPRx::match(message))
|
if (WDSPRx::MsgConfigureWDSPRx::match(message))
|
||||||
{
|
{
|
||||||
qDebug("WDSPRxGUI::handleMessage: WDSPRx::MsgConfigureWDSPRx");
|
qDebug("WDSPRxGUI::handleMessage: WDSPRx::MsgConfigureWDSPRx");
|
||||||
const WDSPRx::MsgConfigureWDSPRx& cfg = (WDSPRx::MsgConfigureWDSPRx&) message;
|
auto& cfg = (const WDSPRx::MsgConfigureWDSPRx&) message;
|
||||||
m_settings = cfg.getSettings();
|
m_settings = cfg.getSettings();
|
||||||
blockApplySettings(true);
|
blockApplySettings(true);
|
||||||
ui->spectrumGUI->updateSettings();
|
ui->spectrumGUI->updateSettings();
|
||||||
@ -118,7 +118,7 @@ bool WDSPRxGUI::handleMessage(const Message& message)
|
|||||||
}
|
}
|
||||||
else if (DSPSignalNotification::match(message))
|
else if (DSPSignalNotification::match(message))
|
||||||
{
|
{
|
||||||
const DSPSignalNotification& notif = (const DSPSignalNotification&) message;
|
auto& notif = (const DSPSignalNotification&) message;
|
||||||
m_deviceCenterFrequency = notif.getCenterFrequency();
|
m_deviceCenterFrequency = notif.getCenterFrequency();
|
||||||
m_basebandSampleRate = notif.getSampleRate();
|
m_basebandSampleRate = notif.getSampleRate();
|
||||||
qDebug("WDSPRxGUI::handleMessage: DSPSignalNotification: centerFrequency: %lld sampleRate: %d",
|
qDebug("WDSPRxGUI::handleMessage: DSPSignalNotification: centerFrequency: %lld sampleRate: %d",
|
||||||
@ -138,7 +138,7 @@ void WDSPRxGUI::handleInputMessages()
|
|||||||
{
|
{
|
||||||
Message* message;
|
Message* message;
|
||||||
|
|
||||||
while ((message = getInputMessageQueue()->pop()) != 0)
|
while ((message = getInputMessageQueue()->pop()) != nullptr)
|
||||||
{
|
{
|
||||||
if (handleMessage(*message))
|
if (handleMessage(*message))
|
||||||
{
|
{
|
||||||
@ -183,7 +183,7 @@ void WDSPRxGUI::on_dsb_toggled(bool dsb)
|
|||||||
|
|
||||||
void WDSPRxGUI::on_deltaFrequency_changed(qint64 value)
|
void WDSPRxGUI::on_deltaFrequency_changed(qint64 value)
|
||||||
{
|
{
|
||||||
m_channelMarker.setCenterFrequency(value);
|
m_channelMarker.setCenterFrequency((int) value);
|
||||||
m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency();
|
m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency();
|
||||||
updateAbsoluteCenterFrequency();
|
updateAbsoluteCenterFrequency();
|
||||||
applySettings();
|
applySettings();
|
||||||
@ -205,7 +205,7 @@ void WDSPRxGUI::on_lowCut_valueChanged(int value)
|
|||||||
void WDSPRxGUI::on_volume_valueChanged(int value)
|
void WDSPRxGUI::on_volume_valueChanged(int value)
|
||||||
{
|
{
|
||||||
ui->volumeText->setText(QString("%1").arg(value));
|
ui->volumeText->setText(QString("%1").arg(value));
|
||||||
m_settings.m_volume = CalcDb::powerFromdB(value);
|
m_settings.m_volume = (Real) CalcDb::powerFromdB(value);
|
||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,7 +279,7 @@ void WDSPRxGUI::on_rit_toggled(bool checked)
|
|||||||
{
|
{
|
||||||
m_settings.m_rit = checked;
|
m_settings.m_rit = checked;
|
||||||
m_settings.m_profiles[m_settings.m_profileIndex].m_rit = m_settings.m_rit;
|
m_settings.m_profiles[m_settings.m_profileIndex].m_rit = m_settings.m_rit;
|
||||||
m_channelMarker.setShift(checked ? m_settings.m_ritFrequency: 0);
|
m_channelMarker.setShift(checked ? (int) m_settings.m_ritFrequency: 0);
|
||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -406,7 +406,7 @@ void WDSPRxGUI::on_profileIndex_valueChanged(int value)
|
|||||||
|
|
||||||
void WDSPRxGUI::on_demod_currentIndexChanged(int index)
|
void WDSPRxGUI::on_demod_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
WDSPRxProfile::WDSPRxDemod demod = (WDSPRxProfile::WDSPRxDemod) index;
|
auto demod = (WDSPRxProfile::WDSPRxDemod) index;
|
||||||
|
|
||||||
if ((m_settings.m_demod != WDSPRxProfile::DemodSSB) && (demod == WDSPRxProfile::DemodSSB)) {
|
if ((m_settings.m_demod != WDSPRxProfile::DemodSSB) && (demod == WDSPRxProfile::DemodSSB)) {
|
||||||
m_settings.m_dsb = false;
|
m_settings.m_dsb = false;
|
||||||
@ -480,7 +480,7 @@ void WDSPRxGUI::onMenuDialogCalled(const QPoint &p)
|
|||||||
resetContextMenuType();
|
resetContextMenuType();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WDSPRxGUI::onWidgetRolled(QWidget* widget, bool rollDown)
|
void WDSPRxGUI::onWidgetRolled(const QWidget* widget, bool rollDown)
|
||||||
{
|
{
|
||||||
(void) widget;
|
(void) widget;
|
||||||
(void) rollDown;
|
(void) rollDown;
|
||||||
@ -524,7 +524,7 @@ WDSPRxGUI::WDSPRxGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam
|
|||||||
m_wdspRx = (WDSPRx*) rxChannel;
|
m_wdspRx = (WDSPRx*) rxChannel;
|
||||||
m_spectrumVis = m_wdspRx->getSpectrumVis();
|
m_spectrumVis = m_wdspRx->getSpectrumVis();
|
||||||
m_spectrumVis->setGLSpectrum(ui->glSpectrum);
|
m_spectrumVis->setGLSpectrum(ui->glSpectrum);
|
||||||
m_wdspRx->setMessageQueueToGUI(getInputMessageQueue());
|
m_wdspRx->setMessageQueueToGUI(WDSPRxGUI::getInputMessageQueue());
|
||||||
|
|
||||||
m_audioMuteRightClickEnabler = new CRightClickEnabler(ui->audioMute);
|
m_audioMuteRightClickEnabler = new CRightClickEnabler(ui->audioMute);
|
||||||
connect(m_audioMuteRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(audioSelect(const QPoint &)));
|
connect(m_audioMuteRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(audioSelect(const QPoint &)));
|
||||||
@ -588,7 +588,7 @@ WDSPRxGUI::WDSPRxGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam
|
|||||||
m_deviceUISet->addChannelMarker(&m_channelMarker);
|
m_deviceUISet->addChannelMarker(&m_channelMarker);
|
||||||
connect(&m_channelMarker, SIGNAL(changedByCursor()), this, SLOT(channelMarkerChangedByCursor()));
|
connect(&m_channelMarker, SIGNAL(changedByCursor()), this, SLOT(channelMarkerChangedByCursor()));
|
||||||
connect(&m_channelMarker, SIGNAL(highlightedByCursor()), this, SLOT(channelMarkerHighlightedByCursor()));
|
connect(&m_channelMarker, SIGNAL(highlightedByCursor()), this, SLOT(channelMarkerHighlightedByCursor()));
|
||||||
connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
|
connect(WDSPRxGUI::getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
|
||||||
|
|
||||||
|
|
||||||
m_iconDSBUSB.addPixmap(QPixmap("://dsb.png"), QIcon::Normal, QIcon::On);
|
m_iconDSBUSB.addPixmap(QPixmap("://dsb.png"), QIcon::Normal, QIcon::On);
|
||||||
@ -654,7 +654,7 @@ uint32_t WDSPRxGUI::getValidAudioSampleRate() const
|
|||||||
return sr;
|
return sr;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int WDSPRxGUI::spanLog2Max()
|
unsigned int WDSPRxGUI::spanLog2Max() const
|
||||||
{
|
{
|
||||||
unsigned int spanLog2 = 0;
|
unsigned int spanLog2 = 0;
|
||||||
for (; getValidAudioSampleRate() / (1<<spanLog2) >= 1000; spanLog2++);
|
for (; getValidAudioSampleRate() / (1<<spanLog2) >= 1000; spanLog2++);
|
||||||
@ -668,7 +668,6 @@ void WDSPRxGUI::applyBandwidths(unsigned int spanLog2, bool force)
|
|||||||
unsigned int limit = s2max < 1 ? 0 : s2max - 1;
|
unsigned int limit = s2max < 1 ? 0 : s2max - 1;
|
||||||
ui->spanLog2->setMaximum(limit);
|
ui->spanLog2->setMaximum(limit);
|
||||||
bool dsb = ui->dsb->isChecked();
|
bool dsb = ui->dsb->isChecked();
|
||||||
//int spanLog2 = ui->spanLog2->value();
|
|
||||||
m_spectrumRate = getValidAudioSampleRate() / (1<<spanLog2);
|
m_spectrumRate = getValidAudioSampleRate() / (1<<spanLog2);
|
||||||
int bw = ui->BW->value();
|
int bw = ui->BW->value();
|
||||||
int lw = ui->lowCut->value();
|
int lw = ui->lowCut->value();
|
||||||
@ -764,8 +763,8 @@ void WDSPRxGUI::applyBandwidths(unsigned int spanLog2, bool force)
|
|||||||
m_settings.m_dsb = dsb;
|
m_settings.m_dsb = dsb;
|
||||||
m_settings.m_profiles[m_settings.m_profileIndex].m_dsb = dsb;
|
m_settings.m_profiles[m_settings.m_profileIndex].m_dsb = dsb;
|
||||||
m_settings.m_profiles[m_settings.m_profileIndex].m_spanLog2 = spanLog2;
|
m_settings.m_profiles[m_settings.m_profileIndex].m_spanLog2 = spanLog2;
|
||||||
m_settings.m_profiles[m_settings.m_profileIndex].m_highCutoff = bw * 100;
|
m_settings.m_profiles[m_settings.m_profileIndex].m_highCutoff = (Real) (bw * 100);
|
||||||
m_settings.m_profiles[m_settings.m_profileIndex].m_lowCutoff = lw * 100;
|
m_settings.m_profiles[m_settings.m_profileIndex].m_lowCutoff = (Real) (lw * 100);
|
||||||
|
|
||||||
applySettings(force);
|
applySettings(force);
|
||||||
|
|
||||||
@ -785,11 +784,11 @@ void WDSPRxGUI::displaySettings()
|
|||||||
{
|
{
|
||||||
m_channelMarker.blockSignals(true);
|
m_channelMarker.blockSignals(true);
|
||||||
m_channelMarker.setCenterFrequency(m_settings.m_inputFrequencyOffset);
|
m_channelMarker.setCenterFrequency(m_settings.m_inputFrequencyOffset);
|
||||||
m_channelMarker.setBandwidth(m_settings.m_profiles[m_settings.m_profileIndex].m_highCutoff * 2);
|
m_channelMarker.setBandwidth((int) (m_settings.m_profiles[m_settings.m_profileIndex].m_highCutoff * 2));
|
||||||
m_channelMarker.setTitle(m_settings.m_title);
|
m_channelMarker.setTitle(m_settings.m_title);
|
||||||
m_channelMarker.setLowCutoff(m_settings.m_profiles[m_settings.m_profileIndex].m_lowCutoff);
|
m_channelMarker.setLowCutoff((int) m_settings.m_profiles[m_settings.m_profileIndex].m_lowCutoff);
|
||||||
int shift = m_settings.m_profiles[m_settings.m_profileIndex].m_rit ?
|
int shift = m_settings.m_profiles[m_settings.m_profileIndex].m_rit ?
|
||||||
m_settings.m_profiles[m_settings.m_profileIndex].m_ritFrequency :
|
(int) m_settings.m_profiles[m_settings.m_profileIndex].m_ritFrequency :
|
||||||
0;
|
0;
|
||||||
m_channelMarker.setShift(shift);
|
m_channelMarker.setShift(shift);
|
||||||
|
|
||||||
@ -880,7 +879,7 @@ void WDSPRxGUI::displaySettings()
|
|||||||
ui->dsb->setChecked(m_settings.m_dsb);
|
ui->dsb->setChecked(m_settings.m_dsb);
|
||||||
ui->spanLog2->setValue(1 + ui->spanLog2->maximum() - m_settings.m_profiles[m_settings.m_profileIndex].m_spanLog2);
|
ui->spanLog2->setValue(1 + ui->spanLog2->maximum() - m_settings.m_profiles[m_settings.m_profileIndex].m_spanLog2);
|
||||||
|
|
||||||
ui->BW->setValue(m_settings.m_profiles[m_settings.m_profileIndex].m_highCutoff / 100.0);
|
ui->BW->setValue((int) (m_settings.m_profiles[m_settings.m_profileIndex].m_highCutoff / 100.0));
|
||||||
s = QString::number(m_settings.m_profiles[m_settings.m_profileIndex].m_highCutoff/1000.0, 'f', 1);
|
s = QString::number(m_settings.m_profiles[m_settings.m_profileIndex].m_highCutoff/1000.0, 'f', 1);
|
||||||
|
|
||||||
if (m_settings.m_dsb) {
|
if (m_settings.m_dsb) {
|
||||||
@ -899,10 +898,10 @@ void WDSPRxGUI::displaySettings()
|
|||||||
|
|
||||||
// The only one of the four signals triggering applyBandwidths will trigger it once only with all other values
|
// The only one of the four signals triggering applyBandwidths will trigger it once only with all other values
|
||||||
// set correctly and therefore validate the settings and apply them to dependent widgets
|
// set correctly and therefore validate the settings and apply them to dependent widgets
|
||||||
ui->lowCut->setValue(m_settings.m_profiles[m_settings.m_profileIndex].m_lowCutoff / 100.0);
|
ui->lowCut->setValue((int) (m_settings.m_profiles[m_settings.m_profileIndex].m_lowCutoff / 100.0));
|
||||||
ui->lowCutText->setText(tr("%1k").arg(m_settings.m_profiles[m_settings.m_profileIndex].m_lowCutoff / 1000.0));
|
ui->lowCutText->setText(tr("%1k").arg(m_settings.m_profiles[m_settings.m_profileIndex].m_lowCutoff / 1000.0));
|
||||||
|
|
||||||
int volume = CalcDb::dbPower(m_settings.m_volume);
|
auto volume = (int) CalcDb::dbPower(m_settings.m_volume);
|
||||||
ui->volume->setValue(volume);
|
ui->volume->setValue(volume);
|
||||||
ui->volumeText->setText(QString("%1").arg(volume));
|
ui->volumeText->setText(QString("%1").arg(volume));
|
||||||
|
|
||||||
@ -1199,15 +1198,11 @@ void WDSPRxGUI::amSetup(int iValueChanged)
|
|||||||
|
|
||||||
auto valueChanged = (WDSPRxAMDialog::ValueChanged) iValueChanged;
|
auto valueChanged = (WDSPRxAMDialog::ValueChanged) iValueChanged;
|
||||||
|
|
||||||
switch (valueChanged)
|
if (valueChanged == WDSPRxAMDialog::ChangedFadeLevel)
|
||||||
{
|
{
|
||||||
case WDSPRxAMDialog::ChangedFadeLevel:
|
|
||||||
m_settings.m_amFadeLevel = m_amDialog->getFadeLevel();
|
m_settings.m_amFadeLevel = m_amDialog->getFadeLevel();
|
||||||
m_settings.m_profiles[m_settings.m_profileIndex].m_amFadeLevel = m_settings.m_amFadeLevel;
|
m_settings.m_profiles[m_settings.m_profileIndex].m_amFadeLevel = m_settings.m_amFadeLevel;
|
||||||
applySettings();
|
applySettings();
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1369,21 +1364,18 @@ void WDSPRxGUI::panSetup(int iValueChanged)
|
|||||||
|
|
||||||
auto valueChanged = (WDSPRxPanDialog::ValueChanged) iValueChanged;
|
auto valueChanged = (WDSPRxPanDialog::ValueChanged) iValueChanged;
|
||||||
|
|
||||||
switch (valueChanged)
|
if (valueChanged == WDSPRxPanDialog::ChangedPan)
|
||||||
{
|
{
|
||||||
case WDSPRxPanDialog::ChangedPan:
|
|
||||||
m_settings.m_audioPan = m_panDialog->getPan();
|
m_settings.m_audioPan = m_panDialog->getPan();
|
||||||
m_settings.m_profiles[m_settings.m_profileIndex].m_audioPan = m_settings.m_audioPan;
|
m_settings.m_profiles[m_settings.m_profileIndex].m_audioPan = m_settings.m_audioPan;
|
||||||
applySettings();
|
applySettings();
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WDSPRxGUI::tick()
|
void WDSPRxGUI::tick()
|
||||||
{
|
{
|
||||||
double powDbAvg, powDbPeak;
|
double powDbAvg;
|
||||||
|
double powDbPeak;
|
||||||
int nbMagsqSamples;
|
int nbMagsqSamples;
|
||||||
m_wdspRx->getMagSqLevels(powDbAvg, powDbPeak, nbMagsqSamples); // powers directly in dB
|
m_wdspRx->getMagSqLevels(powDbAvg, powDbPeak, nbMagsqSamples); // powers directly in dB
|
||||||
|
|
||||||
@ -1416,7 +1408,7 @@ void WDSPRxGUI::tick()
|
|||||||
m_tickCount++;
|
m_tickCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WDSPRxGUI::makeUIConnections()
|
void WDSPRxGUI::makeUIConnections() const
|
||||||
{
|
{
|
||||||
QObject::connect(ui->deltaFrequency, &ValueDialZ::changed, this, &WDSPRxGUI::on_deltaFrequency_changed);
|
QObject::connect(ui->deltaFrequency, &ValueDialZ::changed, this, &WDSPRxGUI::on_deltaFrequency_changed);
|
||||||
QObject::connect(ui->audioBinaural, &QToolButton::toggled, this, &WDSPRxGUI::on_audioBinaural_toggled);
|
QObject::connect(ui->audioBinaural, &QToolButton::toggled, this, &WDSPRxGUI::on_audioBinaural_toggled);
|
||||||
|
@ -58,21 +58,21 @@ public:
|
|||||||
static WDSPRxGUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel);
|
static WDSPRxGUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel);
|
||||||
virtual void destroy();
|
virtual void destroy();
|
||||||
|
|
||||||
void resetToDefaults();
|
void resetToDefaults() final;
|
||||||
QByteArray serialize() const;
|
QByteArray serialize() const final;
|
||||||
bool deserialize(const QByteArray& data);
|
bool deserialize(const QByteArray& data) final;
|
||||||
virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
|
MessageQueue *getInputMessageQueue() final { return &m_inputMessageQueue; }
|
||||||
virtual void setWorkspaceIndex(int index) { m_settings.m_workspaceIndex = index; };
|
void setWorkspaceIndex(int index) final { m_settings.m_workspaceIndex = index; };
|
||||||
virtual int getWorkspaceIndex() const { return m_settings.m_workspaceIndex; };
|
int getWorkspaceIndex() const final { return m_settings.m_workspaceIndex; };
|
||||||
virtual void setGeometryBytes(const QByteArray& blob) { m_settings.m_geometryBytes = blob; };
|
void setGeometryBytes(const QByteArray& blob) final { m_settings.m_geometryBytes = blob; };
|
||||||
virtual QByteArray getGeometryBytes() const { return m_settings.m_geometryBytes; };
|
QByteArray getGeometryBytes() const final { return m_settings.m_geometryBytes; };
|
||||||
virtual QString getTitle() const { return m_settings.m_title; };
|
QString getTitle() const final { return m_settings.m_title; };
|
||||||
virtual QColor getTitleColor() const { return m_settings.m_rgbColor; };
|
QColor getTitleColor() const final { return m_settings.m_rgbColor; };
|
||||||
virtual void zetHidden(bool hidden) { m_settings.m_hidden = hidden; }
|
void zetHidden(bool hidden) final { m_settings.m_hidden = hidden; }
|
||||||
virtual bool getHidden() const { return m_settings.m_hidden; }
|
bool getHidden() const final { return m_settings.m_hidden; }
|
||||||
virtual ChannelMarker& getChannelMarker() { return m_channelMarker; }
|
ChannelMarker& getChannelMarker() final { return m_channelMarker; }
|
||||||
virtual int getStreamIndex() const { return m_settings.m_streamIndex; }
|
int getStreamIndex() const final { return m_settings.m_streamIndex; }
|
||||||
virtual void setStreamIndex(int streamIndex) { m_settings.m_streamIndex = streamIndex; }
|
void setStreamIndex(int streamIndex) final { m_settings.m_streamIndex = streamIndex; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void channelMarkerChangedByCursor();
|
void channelMarkerChangedByCursor();
|
||||||
@ -122,21 +122,21 @@ private:
|
|||||||
QIcon m_iconDSBUSB;
|
QIcon m_iconDSBUSB;
|
||||||
QIcon m_iconDSBLSB;
|
QIcon m_iconDSBLSB;
|
||||||
|
|
||||||
explicit WDSPRxGUI(PluginAPI* pluginAPI, DeviceUISet* deviceUISet, BasebandSampleSink *rxChannel, QWidget* parent = 0);
|
explicit WDSPRxGUI(PluginAPI* pluginAPI, DeviceUISet* deviceUISet, BasebandSampleSink *rxChannel, QWidget* parent = nullptr);
|
||||||
virtual ~WDSPRxGUI();
|
~WDSPRxGUI() final;
|
||||||
|
|
||||||
bool blockApplySettings(bool block);
|
bool blockApplySettings(bool block);
|
||||||
void applySettings(bool force = false);
|
void applySettings(bool force = false);
|
||||||
void applyBandwidths(unsigned int spanLog2, bool force = false);
|
void applyBandwidths(unsigned int spanLog2, bool force = false);
|
||||||
unsigned int spanLog2Max();
|
unsigned int spanLog2Max() const;
|
||||||
void displaySettings();
|
void displaySettings();
|
||||||
bool handleMessage(const Message& message);
|
bool handleMessage(const Message& message);
|
||||||
void makeUIConnections();
|
void makeUIConnections() const;
|
||||||
void updateAbsoluteCenterFrequency();
|
void updateAbsoluteCenterFrequency();
|
||||||
uint32_t getValidAudioSampleRate() const;
|
uint32_t getValidAudioSampleRate() const;
|
||||||
|
|
||||||
void leaveEvent(QEvent*);
|
void leaveEvent(QEvent*) final;
|
||||||
void enterEvent(EnterEventType*);
|
void enterEvent(EnterEventType*) final;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_deltaFrequency_changed(qint64 value);
|
void on_deltaFrequency_changed(qint64 value);
|
||||||
@ -164,7 +164,7 @@ private slots:
|
|||||||
void on_rit_toggled(bool checked);
|
void on_rit_toggled(bool checked);
|
||||||
void on_ritFrequency_valueChanged(int value);
|
void on_ritFrequency_valueChanged(int value);
|
||||||
void on_dbOrS_toggled(bool checked);
|
void on_dbOrS_toggled(bool checked);
|
||||||
void onWidgetRolled(QWidget* widget, bool rollDown);
|
void onWidgetRolled(const QWidget* widget, bool rollDown);
|
||||||
void onMenuDialogCalled(const QPoint& p);
|
void onMenuDialogCalled(const QPoint& p);
|
||||||
void handleInputMessages();
|
void handleInputMessages();
|
||||||
void audioSelect(const QPoint& p);
|
void audioSelect(const QPoint& p);
|
||||||
|
@ -55,12 +55,7 @@ const char* const AMMod::m_channelId ="AMMod";
|
|||||||
|
|
||||||
AMMod::AMMod(DeviceAPI *deviceAPI) :
|
AMMod::AMMod(DeviceAPI *deviceAPI) :
|
||||||
ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSource),
|
ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSource),
|
||||||
m_deviceAPI(deviceAPI),
|
m_deviceAPI(deviceAPI)
|
||||||
m_running(false),
|
|
||||||
m_fileSize(0),
|
|
||||||
m_recordLength(0),
|
|
||||||
m_sampleRate(48000),
|
|
||||||
m_levelMeter(nullptr)
|
|
||||||
{
|
{
|
||||||
setObjectName(m_channelId);
|
setObjectName(m_channelId);
|
||||||
applySettings(m_settings, true);
|
applySettings(m_settings, true);
|
||||||
@ -89,7 +84,7 @@ AMMod::~AMMod()
|
|||||||
m_deviceAPI->removeChannelSourceAPI(this);
|
m_deviceAPI->removeChannelSourceAPI(this);
|
||||||
m_deviceAPI->removeChannelSource(this);
|
m_deviceAPI->removeChannelSource(this);
|
||||||
|
|
||||||
stop();
|
AMMod::stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AMMod::setDeviceAPI(DeviceAPI *deviceAPI)
|
void AMMod::setDeviceAPI(DeviceAPI *deviceAPI)
|
||||||
@ -185,7 +180,7 @@ bool AMMod::handleMessage(const Message& cmd)
|
|||||||
{
|
{
|
||||||
if (MsgConfigureAMMod::match(cmd))
|
if (MsgConfigureAMMod::match(cmd))
|
||||||
{
|
{
|
||||||
MsgConfigureAMMod& cfg = (MsgConfigureAMMod&) cmd;
|
auto& cfg = (const MsgConfigureAMMod&) cmd;
|
||||||
qDebug() << "AMMod::handleMessage: MsgConfigureAMMod";
|
qDebug() << "AMMod::handleMessage: MsgConfigureAMMod";
|
||||||
|
|
||||||
applySettings(cfg.getSettings(), cfg.getForce());
|
applySettings(cfg.getSettings(), cfg.getForce());
|
||||||
@ -194,7 +189,7 @@ bool AMMod::handleMessage(const Message& cmd)
|
|||||||
}
|
}
|
||||||
else if (MsgConfigureFileSourceName::match(cmd))
|
else if (MsgConfigureFileSourceName::match(cmd))
|
||||||
{
|
{
|
||||||
MsgConfigureFileSourceName& conf = (MsgConfigureFileSourceName&) cmd;
|
auto& conf = (const MsgConfigureFileSourceName&) cmd;
|
||||||
m_fileName = conf.getFileName();
|
m_fileName = conf.getFileName();
|
||||||
qDebug() << "AMMod::handleMessage: MsgConfigureFileSourceName";
|
qDebug() << "AMMod::handleMessage: MsgConfigureFileSourceName";
|
||||||
openFileStream();
|
openFileStream();
|
||||||
@ -202,7 +197,7 @@ bool AMMod::handleMessage(const Message& cmd)
|
|||||||
}
|
}
|
||||||
else if (MsgConfigureFileSourceSeek::match(cmd))
|
else if (MsgConfigureFileSourceSeek::match(cmd))
|
||||||
{
|
{
|
||||||
MsgConfigureFileSourceSeek& conf = (MsgConfigureFileSourceSeek&) cmd;
|
auto& conf = (const MsgConfigureFileSourceSeek&) cmd;
|
||||||
int seekPercentage = conf.getPercentage();
|
int seekPercentage = conf.getPercentage();
|
||||||
qDebug() << "AMMod::handleMessage: MsgConfigureFileSourceSeek";
|
qDebug() << "AMMod::handleMessage: MsgConfigureFileSourceSeek";
|
||||||
seekFileStream(seekPercentage);
|
seekFileStream(seekPercentage);
|
||||||
@ -211,13 +206,13 @@ bool AMMod::handleMessage(const Message& cmd)
|
|||||||
}
|
}
|
||||||
else if (MsgConfigureFileSourceStreamTiming::match(cmd))
|
else if (MsgConfigureFileSourceStreamTiming::match(cmd))
|
||||||
{
|
{
|
||||||
std::size_t samplesCount;
|
std::size_t samplesCount;
|
||||||
|
|
||||||
if (m_ifstream.eof()) {
|
if (m_ifstream.eof()) {
|
||||||
samplesCount = m_fileSize / sizeof(Real);
|
samplesCount = m_fileSize / sizeof(Real);
|
||||||
} else {
|
} else {
|
||||||
samplesCount = m_ifstream.tellg() / sizeof(Real);
|
samplesCount = m_ifstream.tellg() / sizeof(Real);
|
||||||
}
|
}
|
||||||
|
|
||||||
MsgReportFileSourceStreamTiming *report;
|
MsgReportFileSourceStreamTiming *report;
|
||||||
report = MsgReportFileSourceStreamTiming::create(samplesCount);
|
report = MsgReportFileSourceStreamTiming::create(samplesCount);
|
||||||
@ -227,7 +222,7 @@ bool AMMod::handleMessage(const Message& cmd)
|
|||||||
}
|
}
|
||||||
else if (CWKeyer::MsgConfigureCWKeyer::match(cmd))
|
else if (CWKeyer::MsgConfigureCWKeyer::match(cmd))
|
||||||
{
|
{
|
||||||
const CWKeyer::MsgConfigureCWKeyer& cfg = (CWKeyer::MsgConfigureCWKeyer&) cmd;
|
auto& cfg = (const CWKeyer::MsgConfigureCWKeyer&) cmd;
|
||||||
qDebug() << "AMMod::handleMessage: MsgConfigureCWKeyer";
|
qDebug() << "AMMod::handleMessage: MsgConfigureCWKeyer";
|
||||||
|
|
||||||
if (m_settings.m_useReverseAPI) {
|
if (m_settings.m_useReverseAPI) {
|
||||||
@ -240,7 +235,7 @@ bool AMMod::handleMessage(const Message& cmd)
|
|||||||
{
|
{
|
||||||
qDebug() << "AMMod::handleMessage: DSPSignalNotification";
|
qDebug() << "AMMod::handleMessage: DSPSignalNotification";
|
||||||
// Forward to the source
|
// Forward to the source
|
||||||
DSPSignalNotification& notif = (DSPSignalNotification&) cmd;
|
auto& notif = (const DSPSignalNotification&) cmd;
|
||||||
|
|
||||||
if (m_running) {
|
if (m_running) {
|
||||||
m_basebandSource->getInputMessageQueue()->push(new DSPSignalNotification(notif));
|
m_basebandSource->getInputMessageQueue()->push(new DSPSignalNotification(notif));
|
||||||
@ -276,7 +271,7 @@ void AMMod::openFileStream()
|
|||||||
m_ifstream.seekg(0,std::ios_base::beg);
|
m_ifstream.seekg(0,std::ios_base::beg);
|
||||||
|
|
||||||
m_sampleRate = 48000; // fixed rate
|
m_sampleRate = 48000; // fixed rate
|
||||||
m_recordLength = m_fileSize / (sizeof(Real) * m_sampleRate);
|
m_recordLength = (quint32) (m_fileSize / (sizeof(Real) * m_sampleRate));
|
||||||
|
|
||||||
qDebug() << "AMMod::openFileStream: " << m_fileName.toStdString().c_str()
|
qDebug() << "AMMod::openFileStream: " << m_fileName.toStdString().c_str()
|
||||||
<< " fileSize: " << m_fileSize << "bytes"
|
<< " fileSize: " << m_fileSize << "bytes"
|
||||||
@ -394,7 +389,7 @@ void AMMod::applySettings(const AMModSettings& settings, bool force)
|
|||||||
QList<ObjectPipe*> pipes;
|
QList<ObjectPipe*> pipes;
|
||||||
MainCore::instance()->getMessagePipes().getMessagePipes(this, "settings", pipes);
|
MainCore::instance()->getMessagePipes().getMessagePipes(this, "settings", pipes);
|
||||||
|
|
||||||
if (pipes.size() > 0) {
|
if (!pipes.empty()) {
|
||||||
sendChannelSettings(pipes, reverseAPIKeys, settings, force);
|
sendChannelSettings(pipes, reverseAPIKeys, settings, force);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -423,12 +418,12 @@ bool AMMod::deserialize(const QByteArray& data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AMMod::sendSampleRateToDemodAnalyzer()
|
void AMMod::sendSampleRateToDemodAnalyzer() const
|
||||||
{
|
{
|
||||||
QList<ObjectPipe*> pipes;
|
QList<ObjectPipe*> pipes;
|
||||||
MainCore::instance()->getMessagePipes().getMessagePipes(this, "reportdemod", pipes);
|
MainCore::instance()->getMessagePipes().getMessagePipes(this, "reportdemod", pipes);
|
||||||
|
|
||||||
if (pipes.size() > 0)
|
if (!pipes.empty())
|
||||||
{
|
{
|
||||||
for (const auto& pipe : pipes)
|
for (const auto& pipe : pipes)
|
||||||
{
|
{
|
||||||
@ -555,13 +550,13 @@ void AMMod::webapiUpdateChannelSettings(
|
|||||||
settings.m_reverseAPIAddress = *response.getAmModSettings()->getReverseApiAddress();
|
settings.m_reverseAPIAddress = *response.getAmModSettings()->getReverseApiAddress();
|
||||||
}
|
}
|
||||||
if (channelSettingsKeys.contains("reverseAPIPort")) {
|
if (channelSettingsKeys.contains("reverseAPIPort")) {
|
||||||
settings.m_reverseAPIPort = response.getAmModSettings()->getReverseApiPort();
|
settings.m_reverseAPIPort = (uint16_t) response.getAmModSettings()->getReverseApiPort();
|
||||||
}
|
}
|
||||||
if (channelSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
if (channelSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||||
settings.m_reverseAPIDeviceIndex = response.getAmModSettings()->getReverseApiDeviceIndex();
|
settings.m_reverseAPIDeviceIndex = (uint16_t) response.getAmModSettings()->getReverseApiDeviceIndex();
|
||||||
}
|
}
|
||||||
if (channelSettingsKeys.contains("reverseAPIChannelIndex")) {
|
if (channelSettingsKeys.contains("reverseAPIChannelIndex")) {
|
||||||
settings.m_reverseAPIChannelIndex = response.getAmModSettings()->getReverseApiChannelIndex();
|
settings.m_reverseAPIChannelIndex = (uint16_t) response.getAmModSettings()->getReverseApiChannelIndex();
|
||||||
}
|
}
|
||||||
if (settings.m_channelMarker && channelSettingsKeys.contains("channelMarker")) {
|
if (settings.m_channelMarker && channelSettingsKeys.contains("channelMarker")) {
|
||||||
settings.m_channelMarker->updateFrom(channelSettingsKeys, response.getAmModSettings()->getChannelMarker());
|
settings.m_channelMarker->updateFrom(channelSettingsKeys, response.getAmModSettings()->getChannelMarker());
|
||||||
@ -631,7 +626,7 @@ void AMMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respons
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGChannelMarker *swgChannelMarker = new SWGSDRangel::SWGChannelMarker();
|
auto *swgChannelMarker = new SWGSDRangel::SWGChannelMarker();
|
||||||
settings.m_channelMarker->formatTo(swgChannelMarker);
|
settings.m_channelMarker->formatTo(swgChannelMarker);
|
||||||
response.getAmModSettings()->setChannelMarker(swgChannelMarker);
|
response.getAmModSettings()->setChannelMarker(swgChannelMarker);
|
||||||
}
|
}
|
||||||
@ -645,16 +640,16 @@ void AMMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respons
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGRollupState *swgRollupState = new SWGSDRangel::SWGRollupState();
|
auto *swgRollupState = new SWGSDRangel::SWGRollupState();
|
||||||
settings.m_rollupState->formatTo(swgRollupState);
|
settings.m_rollupState->formatTo(swgRollupState);
|
||||||
response.getAmModSettings()->setRollupState(swgRollupState);
|
response.getAmModSettings()->setRollupState(swgRollupState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AMMod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response)
|
void AMMod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response) const
|
||||||
{
|
{
|
||||||
response.getAmModReport()->setChannelPowerDb(CalcDb::dbPower(getMagSq()));
|
response.getAmModReport()->setChannelPowerDb((float) CalcDb::dbPower(getMagSq()));
|
||||||
|
|
||||||
if (m_running)
|
if (m_running)
|
||||||
{
|
{
|
||||||
@ -663,9 +658,9 @@ void AMMod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AMMod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const AMModSettings& settings, bool force)
|
void AMMod::webapiReverseSendSettings(const QList<QString>& channelSettingsKeys, const AMModSettings& settings, bool force)
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGChannelSettings *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
|
auto *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
|
||||||
webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force);
|
webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force);
|
||||||
|
|
||||||
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
|
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
|
||||||
@ -676,8 +671,8 @@ void AMMod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const
|
|||||||
m_networkRequest.setUrl(QUrl(channelSettingsURL));
|
m_networkRequest.setUrl(QUrl(channelSettingsURL));
|
||||||
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||||
|
|
||||||
QBuffer *buffer = new QBuffer();
|
auto *buffer = new QBuffer();
|
||||||
buffer->open((QBuffer::ReadWrite));
|
buffer->open(QBuffer::ReadWrite);
|
||||||
buffer->write(swgChannelSettings->asJson().toUtf8());
|
buffer->write(swgChannelSettings->asJson().toUtf8());
|
||||||
buffer->seek(0);
|
buffer->seek(0);
|
||||||
|
|
||||||
@ -690,7 +685,7 @@ void AMMod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const
|
|||||||
|
|
||||||
void AMMod::webapiReverseSendCWSettings(const CWKeyerSettings& cwKeyerSettings)
|
void AMMod::webapiReverseSendCWSettings(const CWKeyerSettings& cwKeyerSettings)
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGChannelSettings *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
|
auto *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
|
||||||
swgChannelSettings->setDirection(1); // single source (Tx)
|
swgChannelSettings->setDirection(1); // single source (Tx)
|
||||||
swgChannelSettings->setChannelType(new QString("AMMod"));
|
swgChannelSettings->setChannelType(new QString("AMMod"));
|
||||||
swgChannelSettings->setAmModSettings(new SWGSDRangel::SWGAMModSettings());
|
swgChannelSettings->setAmModSettings(new SWGSDRangel::SWGAMModSettings());
|
||||||
@ -698,7 +693,7 @@ void AMMod::webapiReverseSendCWSettings(const CWKeyerSettings& cwKeyerSettings)
|
|||||||
|
|
||||||
swgAMModSettings->setCwKeyer(new SWGSDRangel::SWGCWKeyerSettings());
|
swgAMModSettings->setCwKeyer(new SWGSDRangel::SWGCWKeyerSettings());
|
||||||
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = swgAMModSettings->getCwKeyer();
|
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = swgAMModSettings->getCwKeyer();
|
||||||
getCWKeyer()->webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
|
CWKeyer::webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
|
||||||
|
|
||||||
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
|
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
|
||||||
.arg(m_settings.m_reverseAPIAddress)
|
.arg(m_settings.m_reverseAPIAddress)
|
||||||
@ -708,8 +703,8 @@ void AMMod::webapiReverseSendCWSettings(const CWKeyerSettings& cwKeyerSettings)
|
|||||||
m_networkRequest.setUrl(QUrl(channelSettingsURL));
|
m_networkRequest.setUrl(QUrl(channelSettingsURL));
|
||||||
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||||
|
|
||||||
QBuffer *buffer = new QBuffer();
|
auto *buffer = new QBuffer();
|
||||||
buffer->open((QBuffer::ReadWrite));
|
buffer->open(QBuffer::ReadWrite);
|
||||||
buffer->write(swgChannelSettings->asJson().toUtf8());
|
buffer->write(swgChannelSettings->asJson().toUtf8());
|
||||||
buffer->seek(0);
|
buffer->seek(0);
|
||||||
|
|
||||||
@ -722,7 +717,7 @@ void AMMod::webapiReverseSendCWSettings(const CWKeyerSettings& cwKeyerSettings)
|
|||||||
|
|
||||||
void AMMod::sendChannelSettings(
|
void AMMod::sendChannelSettings(
|
||||||
const QList<ObjectPipe*>& pipes,
|
const QList<ObjectPipe*>& pipes,
|
||||||
QList<QString>& channelSettingsKeys,
|
const QList<QString>& channelSettingsKeys,
|
||||||
const AMModSettings& settings,
|
const AMModSettings& settings,
|
||||||
bool force)
|
bool force)
|
||||||
{
|
{
|
||||||
@ -732,7 +727,7 @@ void AMMod::sendChannelSettings(
|
|||||||
|
|
||||||
if (messageQueue)
|
if (messageQueue)
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGChannelSettings *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
|
auto *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
|
||||||
webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force);
|
webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force);
|
||||||
MainCore::MsgChannelSettings *msg = MainCore::MsgChannelSettings::create(
|
MainCore::MsgChannelSettings *msg = MainCore::MsgChannelSettings::create(
|
||||||
this,
|
this,
|
||||||
@ -746,7 +741,7 @@ void AMMod::sendChannelSettings(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AMMod::webapiFormatChannelSettings(
|
void AMMod::webapiFormatChannelSettings(
|
||||||
QList<QString>& channelSettingsKeys,
|
const QList<QString>& channelSettingsKeys,
|
||||||
SWGSDRangel::SWGChannelSettings *swgChannelSettings,
|
SWGSDRangel::SWGChannelSettings *swgChannelSettings,
|
||||||
const AMModSettings& settings,
|
const AMModSettings& settings,
|
||||||
bool force
|
bool force
|
||||||
@ -803,25 +798,25 @@ void AMMod::webapiFormatChannelSettings(
|
|||||||
const CWKeyerSettings& cwKeyerSettings = getCWKeyer()->getSettings();
|
const CWKeyerSettings& cwKeyerSettings = getCWKeyer()->getSettings();
|
||||||
swgAMModSettings->setCwKeyer(new SWGSDRangel::SWGCWKeyerSettings());
|
swgAMModSettings->setCwKeyer(new SWGSDRangel::SWGCWKeyerSettings());
|
||||||
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = swgAMModSettings->getCwKeyer();
|
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = swgAMModSettings->getCwKeyer();
|
||||||
getCWKeyer()->webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
|
CWKeyer::webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings.m_channelMarker && (channelSettingsKeys.contains("channelMarker") || force))
|
if (settings.m_channelMarker && (channelSettingsKeys.contains("channelMarker") || force))
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGChannelMarker *swgChannelMarker = new SWGSDRangel::SWGChannelMarker();
|
auto *swgChannelMarker = new SWGSDRangel::SWGChannelMarker();
|
||||||
settings.m_channelMarker->formatTo(swgChannelMarker);
|
settings.m_channelMarker->formatTo(swgChannelMarker);
|
||||||
swgAMModSettings->setChannelMarker(swgChannelMarker);
|
swgAMModSettings->setChannelMarker(swgChannelMarker);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings.m_rollupState && (channelSettingsKeys.contains("rollupState") || force))
|
if (settings.m_rollupState && (channelSettingsKeys.contains("rollupState") || force))
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGRollupState *swgRollupState = new SWGSDRangel::SWGRollupState();
|
auto *swgRollupState = new SWGSDRangel::SWGRollupState();
|
||||||
settings.m_rollupState->formatTo(swgRollupState);
|
settings.m_rollupState->formatTo(swgRollupState);
|
||||||
swgAMModSettings->setRollupState(swgRollupState);
|
swgAMModSettings->setRollupState(swgRollupState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AMMod::networkManagerFinished(QNetworkReply *reply)
|
void AMMod::networkManagerFinished(QNetworkReply *reply) const
|
||||||
{
|
{
|
||||||
QNetworkReply::NetworkError replyError = reply->error();
|
QNetworkReply::NetworkError replyError = reply->error();
|
||||||
|
|
||||||
|
@ -251,7 +251,7 @@ private:
|
|||||||
|
|
||||||
DeviceAPI* m_deviceAPI;
|
DeviceAPI* m_deviceAPI;
|
||||||
QThread *m_thread;
|
QThread *m_thread;
|
||||||
bool m_running;
|
bool m_running = false;
|
||||||
AMModBaseband* m_basebandSource;
|
AMModBaseband* m_basebandSource;
|
||||||
AMModSettings m_settings;
|
AMModSettings m_settings;
|
||||||
|
|
||||||
@ -260,38 +260,38 @@ private:
|
|||||||
|
|
||||||
std::ifstream m_ifstream;
|
std::ifstream m_ifstream;
|
||||||
QString m_fileName;
|
QString m_fileName;
|
||||||
quint64 m_fileSize; //!< raw file size (bytes)
|
quint64 m_fileSize = 0; //!< raw file size (bytes)
|
||||||
quint32 m_recordLength; //!< record length in seconds computed from file size
|
quint32 m_recordLength = 0; //!< record length in seconds computed from file size
|
||||||
int m_sampleRate;
|
int m_sampleRate = 48000;
|
||||||
|
|
||||||
QNetworkAccessManager *m_networkManager;
|
QNetworkAccessManager *m_networkManager;
|
||||||
QNetworkRequest m_networkRequest;
|
QNetworkRequest m_networkRequest;
|
||||||
CWKeyer m_cwKeyer;
|
CWKeyer m_cwKeyer;
|
||||||
QObject *m_levelMeter;
|
QObject *m_levelMeter = nullptr;
|
||||||
|
|
||||||
virtual bool handleMessage(const Message& cmd);
|
virtual bool handleMessage(const Message& cmd);
|
||||||
void applySettings(const AMModSettings& settings, bool force = false);
|
void applySettings(const AMModSettings& settings, bool force = false);
|
||||||
void sendSampleRateToDemodAnalyzer();
|
void sendSampleRateToDemodAnalyzer() const;
|
||||||
void openFileStream();
|
void openFileStream();
|
||||||
void seekFileStream(int seekPercentage);
|
void seekFileStream(int seekPercentage);
|
||||||
void webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response);
|
void webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response) const;
|
||||||
void webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const AMModSettings& settings, bool force);
|
void webapiReverseSendSettings(const QList<QString>& channelSettingsKeys, const AMModSettings& settings, bool force);
|
||||||
void webapiReverseSendCWSettings(const CWKeyerSettings& settings);
|
void webapiReverseSendCWSettings(const CWKeyerSettings& settings);
|
||||||
void sendChannelSettings(
|
void sendChannelSettings(
|
||||||
const QList<ObjectPipe*>& pipes,
|
const QList<ObjectPipe*>& pipes,
|
||||||
QList<QString>& channelSettingsKeys,
|
const QList<QString>& channelSettingsKeys,
|
||||||
const AMModSettings& settings,
|
const AMModSettings& settings,
|
||||||
bool force
|
bool force
|
||||||
);
|
);
|
||||||
void webapiFormatChannelSettings(
|
void webapiFormatChannelSettings(
|
||||||
QList<QString>& channelSettingsKeys,
|
const QList<QString>& channelSettingsKeys,
|
||||||
SWGSDRangel::SWGChannelSettings *swgChannelSettings,
|
SWGSDRangel::SWGChannelSettings *swgChannelSettings,
|
||||||
const AMModSettings& settings,
|
const AMModSettings& settings,
|
||||||
bool force
|
bool force
|
||||||
);
|
);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void networkManagerFinished(QNetworkReply *reply);
|
void networkManagerFinished(QNetworkReply *reply) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
|
|
||||||
AMModGUI* AMModGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx)
|
AMModGUI* AMModGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx)
|
||||||
{
|
{
|
||||||
AMModGUI* gui = new AMModGUI(pluginAPI, deviceUISet, channelTx);
|
auto* gui = new AMModGUI(pluginAPI, deviceUISet, channelTx);
|
||||||
return gui;
|
return gui;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,21 +82,23 @@ bool AMModGUI::handleMessage(const Message& message)
|
|||||||
{
|
{
|
||||||
if (AMMod::MsgReportFileSourceStreamData::match(message))
|
if (AMMod::MsgReportFileSourceStreamData::match(message))
|
||||||
{
|
{
|
||||||
m_recordSampleRate = ((AMMod::MsgReportFileSourceStreamData&)message).getSampleRate();
|
auto& cmd = (const AMMod::MsgReportFileSourceStreamData&) message;
|
||||||
m_recordLength = ((AMMod::MsgReportFileSourceStreamData&)message).getRecordLength();
|
m_recordSampleRate = cmd.getSampleRate();
|
||||||
|
m_recordLength = cmd.getRecordLength();
|
||||||
m_samplesCount = 0;
|
m_samplesCount = 0;
|
||||||
updateWithStreamData();
|
updateWithStreamData();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (AMMod::MsgReportFileSourceStreamTiming::match(message))
|
else if (AMMod::MsgReportFileSourceStreamTiming::match(message))
|
||||||
{
|
{
|
||||||
m_samplesCount = ((AMMod::MsgReportFileSourceStreamTiming&)message).getSamplesCount();
|
auto& cmd = (const AMMod::MsgReportFileSourceStreamTiming&) message;
|
||||||
|
m_samplesCount = (int) cmd.getSamplesCount();
|
||||||
updateWithStreamTime();
|
updateWithStreamTime();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (AMMod::MsgConfigureAMMod::match(message))
|
else if (AMMod::MsgConfigureAMMod::match(message))
|
||||||
{
|
{
|
||||||
const AMMod::MsgConfigureAMMod& cfg = (AMMod::MsgConfigureAMMod&) message;
|
auto& cfg = (const AMMod::MsgConfigureAMMod&) message;
|
||||||
m_settings = cfg.getSettings();
|
m_settings = cfg.getSettings();
|
||||||
blockApplySettings(true);
|
blockApplySettings(true);
|
||||||
m_channelMarker.updateSettings(static_cast<const ChannelMarker*>(m_settings.m_channelMarker));
|
m_channelMarker.updateSettings(static_cast<const ChannelMarker*>(m_settings.m_channelMarker));
|
||||||
@ -106,14 +108,14 @@ bool AMModGUI::handleMessage(const Message& message)
|
|||||||
}
|
}
|
||||||
else if (CWKeyer::MsgConfigureCWKeyer::match(message))
|
else if (CWKeyer::MsgConfigureCWKeyer::match(message))
|
||||||
{
|
{
|
||||||
const CWKeyer::MsgConfigureCWKeyer& cfg = (CWKeyer::MsgConfigureCWKeyer&) message;
|
auto& cfg = (const CWKeyer::MsgConfigureCWKeyer&) message;
|
||||||
ui->cwKeyerGUI->setSettings(cfg.getSettings());
|
ui->cwKeyerGUI->setSettings(cfg.getSettings());
|
||||||
ui->cwKeyerGUI->displaySettings();
|
ui->cwKeyerGUI->displaySettings();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (DSPSignalNotification::match(message))
|
else if (DSPSignalNotification::match(message))
|
||||||
{
|
{
|
||||||
const DSPSignalNotification& notif = (const DSPSignalNotification&) message;
|
auto& notif = (const DSPSignalNotification&) message;
|
||||||
m_deviceCenterFrequency = notif.getCenterFrequency();
|
m_deviceCenterFrequency = notif.getCenterFrequency();
|
||||||
m_basebandSampleRate = notif.getSampleRate();
|
m_basebandSampleRate = notif.getSampleRate();
|
||||||
ui->deltaFrequency->setValueRange(false, 7, -m_basebandSampleRate/2, m_basebandSampleRate/2);
|
ui->deltaFrequency->setValueRange(false, 7, -m_basebandSampleRate/2, m_basebandSampleRate/2);
|
||||||
@ -138,7 +140,7 @@ void AMModGUI::handleSourceMessages()
|
|||||||
{
|
{
|
||||||
Message* message;
|
Message* message;
|
||||||
|
|
||||||
while ((message = getInputMessageQueue()->pop()) != 0)
|
while ((message = getInputMessageQueue()->pop()) != nullptr)
|
||||||
{
|
{
|
||||||
if (handleMessage(*message))
|
if (handleMessage(*message))
|
||||||
{
|
{
|
||||||
@ -149,7 +151,7 @@ void AMModGUI::handleSourceMessages()
|
|||||||
|
|
||||||
void AMModGUI::on_deltaFrequency_changed(qint64 value)
|
void AMModGUI::on_deltaFrequency_changed(qint64 value)
|
||||||
{
|
{
|
||||||
m_channelMarker.setCenterFrequency(value);
|
m_channelMarker.setCenterFrequency((int) value);
|
||||||
m_settings.m_inputFrequencyOffset = value;
|
m_settings.m_inputFrequencyOffset = value;
|
||||||
updateAbsoluteCenterFrequency();
|
updateAbsoluteCenterFrequency();
|
||||||
applySettings();
|
applySettings();
|
||||||
@ -158,7 +160,7 @@ void AMModGUI::on_deltaFrequency_changed(qint64 value)
|
|||||||
void AMModGUI::on_rfBW_valueChanged(int value)
|
void AMModGUI::on_rfBW_valueChanged(int value)
|
||||||
{
|
{
|
||||||
ui->rfBWText->setText(QString("%1 kHz").arg(value / 10.0, 0, 'f', 1));
|
ui->rfBWText->setText(QString("%1 kHz").arg(value / 10.0, 0, 'f', 1));
|
||||||
m_settings.m_rfBandwidth = value * 100.0;
|
m_settings.m_rfBandwidth = (float) value * 100.0f;
|
||||||
m_channelMarker.setBandwidth(value * 100);
|
m_channelMarker.setBandwidth(value * 100);
|
||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
@ -166,21 +168,21 @@ void AMModGUI::on_rfBW_valueChanged(int value)
|
|||||||
void AMModGUI::on_modPercent_valueChanged(int value)
|
void AMModGUI::on_modPercent_valueChanged(int value)
|
||||||
{
|
{
|
||||||
ui->modPercentText->setText(QString("%1").arg(value));
|
ui->modPercentText->setText(QString("%1").arg(value));
|
||||||
m_settings.m_modFactor = value / 100.0;
|
m_settings.m_modFactor = (float) value / 100.0f;
|
||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AMModGUI::on_volume_valueChanged(int value)
|
void AMModGUI::on_volume_valueChanged(int value)
|
||||||
{
|
{
|
||||||
ui->volumeText->setText(QString("%1").arg(value / 10.0, 0, 'f', 1));
|
ui->volumeText->setText(QString("%1").arg(value / 10.0, 0, 'f', 1));
|
||||||
m_settings.m_volumeFactor = value / 10.0;
|
m_settings.m_volumeFactor = (float) value / 10.0f;
|
||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AMModGUI::on_toneFrequency_valueChanged(int value)
|
void AMModGUI::on_toneFrequency_valueChanged(int value)
|
||||||
{
|
{
|
||||||
ui->toneFrequencyText->setText(QString("%1k").arg(value / 100.0, 0, 'f', 2));
|
ui->toneFrequencyText->setText(QString("%1k").arg(value / 100.0, 0, 'f', 2));
|
||||||
m_settings.m_toneFrequency = value * 10.0;
|
m_settings.m_toneFrequency = (float) value * 10.0f;
|
||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,7 +246,7 @@ void AMModGUI::on_feedbackEnable_toggled(bool checked)
|
|||||||
void AMModGUI::on_feedbackVolume_valueChanged(int value)
|
void AMModGUI::on_feedbackVolume_valueChanged(int value)
|
||||||
{
|
{
|
||||||
ui->feedbackVolumeText->setText(QString("%1").arg(value / 100.0, 0, 'f', 2));
|
ui->feedbackVolumeText->setText(QString("%1").arg(value / 100.0, 0, 'f', 2));
|
||||||
m_settings.m_feedbackVolumeFactor = value / 100.0;
|
m_settings.m_feedbackVolumeFactor = (float) value / 100.0f;
|
||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,7 +267,7 @@ void AMModGUI::on_showFileDialog_clicked(bool checked)
|
|||||||
{
|
{
|
||||||
(void) checked;
|
(void) checked;
|
||||||
QString fileName = QFileDialog::getOpenFileName(this,
|
QString fileName = QFileDialog::getOpenFileName(this,
|
||||||
tr("Open raw audio file"), ".", tr("Raw audio Files (*.raw)"), 0, QFileDialog::DontUseNativeDialog);
|
tr("Open raw audio file"), ".", tr("Raw audio Files (*.raw)"), nullptr, QFileDialog::DontUseNativeDialog);
|
||||||
|
|
||||||
if (fileName != "")
|
if (fileName != "")
|
||||||
{
|
{
|
||||||
@ -283,7 +285,7 @@ void AMModGUI::configureFileName()
|
|||||||
m_amMod->getInputMessageQueue()->push(message);
|
m_amMod->getInputMessageQueue()->push(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AMModGUI::onWidgetRolled(QWidget* widget, bool rollDown)
|
void AMModGUI::onWidgetRolled(const QWidget* widget, bool rollDown)
|
||||||
{
|
{
|
||||||
(void) widget;
|
(void) widget;
|
||||||
(void) rollDown;
|
(void) rollDown;
|
||||||
@ -367,15 +369,15 @@ AMModGUI::AMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampl
|
|||||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
|
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
|
||||||
|
|
||||||
m_amMod = (AMMod*) channelTx;
|
m_amMod = (AMMod*) channelTx;
|
||||||
m_amMod->setMessageQueueToGUI(getInputMessageQueue());
|
m_amMod->setMessageQueueToGUI(AMModGUI::getInputMessageQueue());
|
||||||
|
|
||||||
connect(&MainCore::instance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
|
connect(&MainCore::instance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
|
||||||
|
|
||||||
CRightClickEnabler *audioMuteRightClickEnabler = new CRightClickEnabler(ui->mic);
|
m_audioMuteRightClickEnabler = new CRightClickEnabler(ui->mic);
|
||||||
connect(audioMuteRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(audioSelect(const QPoint &)));
|
connect(m_audioMuteRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(audioSelect(const QPoint &)));
|
||||||
|
|
||||||
CRightClickEnabler *feedbackRightClickEnabler = new CRightClickEnabler(ui->feedbackEnable);
|
m_feedbackRightClickEnabler = new CRightClickEnabler(ui->feedbackEnable);
|
||||||
connect(feedbackRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(audioFeedbackSelect(const QPoint &)));
|
connect(m_feedbackRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(audioFeedbackSelect(const QPoint &)));
|
||||||
|
|
||||||
ui->deltaFrequencyLabel->setText(QString("%1f").arg(QChar(0x94, 0x03)));
|
ui->deltaFrequencyLabel->setText(QString("%1f").arg(QChar(0x94, 0x03)));
|
||||||
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
|
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
|
||||||
@ -406,7 +408,7 @@ AMModGUI::AMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampl
|
|||||||
|
|
||||||
ui->cwKeyerGUI->setCWKeyer(m_amMod->getCWKeyer());
|
ui->cwKeyerGUI->setCWKeyer(m_amMod->getCWKeyer());
|
||||||
|
|
||||||
connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
|
connect(AMModGUI::getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
|
||||||
m_amMod->setLevelMeter(ui->volumeMeter);
|
m_amMod->setLevelMeter(ui->volumeMeter);
|
||||||
|
|
||||||
displaySettings();
|
displaySettings();
|
||||||
@ -419,6 +421,8 @@ AMModGUI::AMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampl
|
|||||||
AMModGUI::~AMModGUI()
|
AMModGUI::~AMModGUI()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
|
delete m_audioMuteRightClickEnabler;
|
||||||
|
delete m_feedbackRightClickEnabler;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AMModGUI::blockApplySettings(bool block)
|
void AMModGUI::blockApplySettings(bool block)
|
||||||
@ -439,9 +443,9 @@ void AMModGUI::applySettings(bool force)
|
|||||||
void AMModGUI::displaySettings()
|
void AMModGUI::displaySettings()
|
||||||
{
|
{
|
||||||
m_channelMarker.blockSignals(true);
|
m_channelMarker.blockSignals(true);
|
||||||
m_channelMarker.setCenterFrequency(m_settings.m_inputFrequencyOffset);
|
m_channelMarker.setCenterFrequency((int) m_settings.m_inputFrequencyOffset);
|
||||||
m_channelMarker.setTitle(m_settings.m_title);
|
m_channelMarker.setTitle(m_settings.m_title);
|
||||||
m_channelMarker.setBandwidth(m_settings.m_rfBandwidth);
|
m_channelMarker.setBandwidth((int) m_settings.m_rfBandwidth);
|
||||||
m_channelMarker.blockSignals(false);
|
m_channelMarker.blockSignals(false);
|
||||||
m_channelMarker.setColor(m_settings.m_rgbColor); // activate signal on the last setting only
|
m_channelMarker.setColor(m_settings.m_rgbColor); // activate signal on the last setting only
|
||||||
|
|
||||||
@ -453,17 +457,17 @@ void AMModGUI::displaySettings()
|
|||||||
|
|
||||||
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
|
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
|
||||||
|
|
||||||
ui->rfBW->setValue(roundf(m_settings.m_rfBandwidth / 100.0));
|
ui->rfBW->setValue((int) roundf(m_settings.m_rfBandwidth / 100.f));
|
||||||
ui->rfBWText->setText(QString("%1 kHz").arg(m_settings.m_rfBandwidth / 1000.0, 0, 'f', 1));
|
ui->rfBWText->setText(QString("%1 kHz").arg(m_settings.m_rfBandwidth / 1000.0, 0, 'f', 1));
|
||||||
|
|
||||||
int modPercent = roundf(m_settings.m_modFactor * 100.0);
|
auto modPercent = (int) roundf(m_settings.m_modFactor * 100.0f);
|
||||||
ui->modPercent->setValue(modPercent);
|
ui->modPercent->setValue(modPercent);
|
||||||
ui->modPercentText->setText(QString("%1").arg(modPercent));
|
ui->modPercentText->setText(QString("%1").arg(modPercent));
|
||||||
|
|
||||||
ui->toneFrequency->setValue(roundf(m_settings.m_toneFrequency / 10.0));
|
ui->toneFrequency->setValue((int) roundf(m_settings.m_toneFrequency / 10.0f));
|
||||||
ui->toneFrequencyText->setText(QString("%1k").arg(m_settings.m_toneFrequency / 1000.0, 0, 'f', 2));
|
ui->toneFrequencyText->setText(QString("%1k").arg(m_settings.m_toneFrequency / 1000.0, 0, 'f', 2));
|
||||||
|
|
||||||
ui->volume->setValue(roundf(m_settings.m_volumeFactor * 10.0));
|
ui->volume->setValue((int) roundf(m_settings.m_volumeFactor * 10.0f));
|
||||||
ui->volumeText->setText(QString("%1").arg(m_settings.m_volumeFactor, 0, 'f', 1));
|
ui->volumeText->setText(QString("%1").arg(m_settings.m_volumeFactor, 0, 'f', 1));
|
||||||
|
|
||||||
ui->channelMute->setChecked(m_settings.m_channelMute);
|
ui->channelMute->setChecked(m_settings.m_channelMute);
|
||||||
@ -480,7 +484,7 @@ void AMModGUI::displaySettings()
|
|||||||
ui->morseKeyer->setChecked(m_settings.m_modAFInput == AMModSettings::AMModInputAF::AMModInputCWTone);
|
ui->morseKeyer->setChecked(m_settings.m_modAFInput == AMModSettings::AMModInputAF::AMModInputCWTone);
|
||||||
|
|
||||||
ui->feedbackEnable->setChecked(m_settings.m_feedbackAudioEnable);
|
ui->feedbackEnable->setChecked(m_settings.m_feedbackAudioEnable);
|
||||||
ui->feedbackVolume->setValue(roundf(m_settings.m_feedbackVolumeFactor * 100.0));
|
ui->feedbackVolume->setValue((int) roundf(m_settings.m_feedbackVolumeFactor * 100.0f));
|
||||||
ui->feedbackVolumeText->setText(QString("%1").arg(m_settings.m_feedbackVolumeFactor, 0, 'f', 2));
|
ui->feedbackVolumeText->setText(QString("%1").arg(m_settings.m_feedbackVolumeFactor, 0, 'f', 2));
|
||||||
|
|
||||||
updateIndexLabel();
|
updateIndexLabel();
|
||||||
@ -605,7 +609,7 @@ void AMModGUI::updateWithStreamTime()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AMModGUI::makeUIConnections()
|
void AMModGUI::makeUIConnections() const
|
||||||
{
|
{
|
||||||
QObject::connect(ui->deltaFrequency, &ValueDialZ::changed, this, &AMModGUI::on_deltaFrequency_changed);
|
QObject::connect(ui->deltaFrequency, &ValueDialZ::changed, this, &AMModGUI::on_deltaFrequency_changed);
|
||||||
QObject::connect(ui->rfBW, &QSlider::valueChanged, this, &AMModGUI::on_rfBW_valueChanged);
|
QObject::connect(ui->rfBW, &QSlider::valueChanged, this, &AMModGUI::on_rfBW_valueChanged);
|
||||||
|
@ -33,6 +33,7 @@ class DeviceUISet;
|
|||||||
|
|
||||||
class AMMod;
|
class AMMod;
|
||||||
class BasebandSampleSource;
|
class BasebandSampleSource;
|
||||||
|
class CRightClickEnabler;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class AMModGUI;
|
class AMModGUI;
|
||||||
@ -45,21 +46,21 @@ public:
|
|||||||
static AMModGUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx);
|
static AMModGUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx);
|
||||||
virtual void destroy();
|
virtual void destroy();
|
||||||
|
|
||||||
void resetToDefaults();
|
void resetToDefaults() final;
|
||||||
QByteArray serialize() const;
|
QByteArray serialize() const final;
|
||||||
bool deserialize(const QByteArray& data);
|
bool deserialize(const QByteArray& data) final;
|
||||||
virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
|
MessageQueue *getInputMessageQueue() final { return &m_inputMessageQueue; }
|
||||||
virtual void setWorkspaceIndex(int index) { m_settings.m_workspaceIndex = index; };
|
void setWorkspaceIndex(int index) final { m_settings.m_workspaceIndex = index; };
|
||||||
virtual int getWorkspaceIndex() const { return m_settings.m_workspaceIndex; };
|
int getWorkspaceIndex() const final { return m_settings.m_workspaceIndex; };
|
||||||
virtual void setGeometryBytes(const QByteArray& blob) { m_settings.m_geometryBytes = blob; };
|
void setGeometryBytes(const QByteArray& blob) final { m_settings.m_geometryBytes = blob; };
|
||||||
virtual QByteArray getGeometryBytes() const { return m_settings.m_geometryBytes; };
|
QByteArray getGeometryBytes() const final { return m_settings.m_geometryBytes; };
|
||||||
virtual QString getTitle() const { return m_settings.m_title; };
|
QString getTitle() const final { return m_settings.m_title; };
|
||||||
virtual QColor getTitleColor() const { return m_settings.m_rgbColor; };
|
QColor getTitleColor() const final { return m_settings.m_rgbColor; };
|
||||||
virtual void zetHidden(bool hidden) { m_settings.m_hidden = hidden; }
|
void zetHidden(bool hidden) final { m_settings.m_hidden = hidden; }
|
||||||
virtual bool getHidden() const { return m_settings.m_hidden; }
|
bool getHidden() const final { return m_settings.m_hidden; }
|
||||||
virtual ChannelMarker& getChannelMarker() { return m_channelMarker; }
|
ChannelMarker& getChannelMarker() final { return m_channelMarker; }
|
||||||
virtual int getStreamIndex() const { return m_settings.m_streamIndex; }
|
int getStreamIndex() const final { return m_settings.m_streamIndex; }
|
||||||
virtual void setStreamIndex(int streamIndex) { m_settings.m_streamIndex = streamIndex; }
|
void setStreamIndex(int streamIndex) final { m_settings.m_streamIndex = streamIndex; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void channelMarkerChangedByCursor();
|
void channelMarkerChangedByCursor();
|
||||||
@ -75,6 +76,9 @@ private:
|
|||||||
int m_basebandSampleRate;
|
int m_basebandSampleRate;
|
||||||
bool m_doApplySettings;
|
bool m_doApplySettings;
|
||||||
|
|
||||||
|
CRightClickEnabler *m_audioMuteRightClickEnabler;
|
||||||
|
CRightClickEnabler *m_feedbackRightClickEnabler;
|
||||||
|
|
||||||
AMMod* m_amMod;
|
AMMod* m_amMod;
|
||||||
MovingAverageUtil<double, double, 20> m_channelPowerDbAvg;
|
MovingAverageUtil<double, double, 20> m_channelPowerDbAvg;
|
||||||
|
|
||||||
@ -88,8 +92,8 @@ private:
|
|||||||
bool m_enableNavTime;
|
bool m_enableNavTime;
|
||||||
MessageQueue m_inputMessageQueue;
|
MessageQueue m_inputMessageQueue;
|
||||||
|
|
||||||
explicit AMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx, QWidget* parent = 0);
|
explicit AMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx, QWidget* parent = nullptr);
|
||||||
virtual ~AMModGUI();
|
~AMModGUI() final;
|
||||||
|
|
||||||
void blockApplySettings(bool block);
|
void blockApplySettings(bool block);
|
||||||
void applySettings(bool force = false);
|
void applySettings(bool force = false);
|
||||||
@ -97,11 +101,11 @@ private:
|
|||||||
void updateWithStreamData();
|
void updateWithStreamData();
|
||||||
void updateWithStreamTime();
|
void updateWithStreamTime();
|
||||||
bool handleMessage(const Message& message);
|
bool handleMessage(const Message& message);
|
||||||
void makeUIConnections();
|
void makeUIConnections() const;
|
||||||
void updateAbsoluteCenterFrequency();
|
void updateAbsoluteCenterFrequency();
|
||||||
|
|
||||||
void leaveEvent(QEvent*);
|
void leaveEvent(QEvent*) final;
|
||||||
void enterEvent(EnterEventType*);
|
void enterEvent(EnterEventType*) final;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleSourceMessages();
|
void handleSourceMessages();
|
||||||
@ -124,7 +128,7 @@ private slots:
|
|||||||
void on_feedbackEnable_toggled(bool checked);
|
void on_feedbackEnable_toggled(bool checked);
|
||||||
void on_feedbackVolume_valueChanged(int value);
|
void on_feedbackVolume_valueChanged(int value);
|
||||||
|
|
||||||
void onWidgetRolled(QWidget* widget, bool rollDown);
|
void onWidgetRolled(const QWidget* widget, bool rollDown);
|
||||||
void onMenuDialogCalled(const QPoint& p);
|
void onMenuDialogCalled(const QPoint& p);
|
||||||
|
|
||||||
void configureFileName();
|
void configureFileName();
|
||||||
|
@ -41,7 +41,7 @@ const PluginDescriptor AMModPlugin::m_pluginDescriptor = {
|
|||||||
|
|
||||||
AMModPlugin::AMModPlugin(QObject* parent) :
|
AMModPlugin::AMModPlugin(QObject* parent) :
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
m_pluginAPI(0)
|
m_pluginAPI(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ void AMModPlugin::createTxChannel(DeviceAPI *deviceAPI, BasebandSampleSource **b
|
|||||||
{
|
{
|
||||||
if (bs || cs)
|
if (bs || cs)
|
||||||
{
|
{
|
||||||
AMMod *instance = new AMMod(deviceAPI);
|
auto *instance = new AMMod(deviceAPI);
|
||||||
|
|
||||||
if (bs) {
|
if (bs) {
|
||||||
*bs = instance;
|
*bs = instance;
|
||||||
|
@ -27,20 +27,20 @@
|
|||||||
class DeviceUISet;
|
class DeviceUISet;
|
||||||
class BasebandSampleSource;
|
class BasebandSampleSource;
|
||||||
|
|
||||||
class AMModPlugin : public QObject, PluginInterface {
|
class AMModPlugin : public QObject, public PluginInterface {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_INTERFACES(PluginInterface)
|
Q_INTERFACES(PluginInterface)
|
||||||
Q_PLUGIN_METADATA(IID "sdrangel.channeltx.ammod")
|
Q_PLUGIN_METADATA(IID "sdrangel.channeltx.ammod")
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AMModPlugin(QObject* parent = 0);
|
explicit AMModPlugin(QObject* parent = nullptr);
|
||||||
|
|
||||||
const PluginDescriptor& getPluginDescriptor() const;
|
const PluginDescriptor& getPluginDescriptor() const final;
|
||||||
void initPlugin(PluginAPI* pluginAPI);
|
void initPlugin(PluginAPI* pluginAPI) final;
|
||||||
|
|
||||||
virtual void createTxChannel(DeviceAPI *deviceAPI, BasebandSampleSource **bs, ChannelAPI **cs) const;
|
void createTxChannel(DeviceAPI *deviceAPI, BasebandSampleSource **bs, ChannelAPI **cs) const final;
|
||||||
virtual ChannelGUI* createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel) const;
|
ChannelGUI* createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel) const final;
|
||||||
virtual ChannelWebAPIAdapter* createChannelWebAPIAdapter() const;
|
ChannelWebAPIAdapter* createChannelWebAPIAdapter() const final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const PluginDescriptor m_pluginDescriptor;
|
static const PluginDescriptor m_pluginDescriptor;
|
||||||
|
@ -28,16 +28,8 @@
|
|||||||
const int AMModSource::m_levelNbSamples = 480; // every 10ms
|
const int AMModSource::m_levelNbSamples = 480; // every 10ms
|
||||||
|
|
||||||
AMModSource::AMModSource() :
|
AMModSource::AMModSource() :
|
||||||
m_channelSampleRate(48000),
|
|
||||||
m_channelFrequencyOffset(0),
|
|
||||||
m_audioSampleRate(48000),
|
|
||||||
m_audioFifo(12000),
|
m_audioFifo(12000),
|
||||||
m_feedbackAudioFifo(48000),
|
m_feedbackAudioFifo(48000)
|
||||||
m_levelCalcCount(0),
|
|
||||||
m_peakLevel(0.0f),
|
|
||||||
m_levelSum(0.0f),
|
|
||||||
m_ifstream(nullptr),
|
|
||||||
m_cwKeyer(nullptr)
|
|
||||||
{
|
{
|
||||||
m_audioFifo.setLabel("AMModSource.m_audioFifo");
|
m_audioFifo.setLabel("AMModSource.m_audioFifo");
|
||||||
m_feedbackAudioFifo.setLabel("AMModSource.m_feedbackAudioFifo");
|
m_feedbackAudioFifo.setLabel("AMModSource.m_feedbackAudioFifo");
|
||||||
@ -57,9 +49,7 @@ AMModSource::AMModSource() :
|
|||||||
applyChannelSettings(m_channelSampleRate, m_channelFrequencyOffset, true);
|
applyChannelSettings(m_channelSampleRate, m_channelFrequencyOffset, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
AMModSource::~AMModSource()
|
AMModSource::~AMModSource() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void AMModSource::pull(SampleVector::iterator begin, unsigned int nbSamples)
|
void AMModSource::pull(SampleVector::iterator begin, unsigned int nbSamples)
|
||||||
{
|
{
|
||||||
@ -111,7 +101,7 @@ void AMModSource::pullOne(Sample& sample)
|
|||||||
sample.m_real = (FixReal) ci.real();
|
sample.m_real = (FixReal) ci.real();
|
||||||
sample.m_imag = (FixReal) ci.imag();
|
sample.m_imag = (FixReal) ci.imag();
|
||||||
|
|
||||||
m_demodBuffer[m_demodBufferFill] = ci.real() + ci.imag();
|
m_demodBuffer[m_demodBufferFill] = (qint16) (ci.real() + ci.imag());
|
||||||
++m_demodBufferFill;
|
++m_demodBufferFill;
|
||||||
|
|
||||||
if (m_demodBufferFill >= m_demodBuffer.size())
|
if (m_demodBufferFill >= m_demodBuffer.size())
|
||||||
@ -119,13 +109,11 @@ void AMModSource::pullOne(Sample& sample)
|
|||||||
QList<ObjectPipe*> dataPipes;
|
QList<ObjectPipe*> dataPipes;
|
||||||
MainCore::instance()->getDataPipes().getDataPipes(m_channel, "demod", dataPipes);
|
MainCore::instance()->getDataPipes().getDataPipes(m_channel, "demod", dataPipes);
|
||||||
|
|
||||||
if (dataPipes.size() > 0)
|
if (!dataPipes.empty())
|
||||||
{
|
{
|
||||||
QList<ObjectPipe*>::iterator it = dataPipes.begin();
|
for (auto& dataPipe : dataPipes)
|
||||||
|
|
||||||
for (; it != dataPipes.end(); ++it)
|
|
||||||
{
|
{
|
||||||
DataFifo *fifo = qobject_cast<DataFifo*>((*it)->m_element);
|
DataFifo *fifo = qobject_cast<DataFifo*>(dataPipe->m_element);
|
||||||
|
|
||||||
if (fifo) {
|
if (fifo) {
|
||||||
fifo->write((quint8*) &m_demodBuffer[0], m_demodBuffer.size() * sizeof(qint16), DataFifo::DataTypeI16);
|
fifo->write((quint8*) &m_demodBuffer[0], m_demodBuffer.size() * sizeof(qint16), DataFifo::DataTypeI16);
|
||||||
@ -139,7 +127,7 @@ void AMModSource::pullOne(Sample& sample)
|
|||||||
|
|
||||||
void AMModSource::prefetch(unsigned int nbSamples)
|
void AMModSource::prefetch(unsigned int nbSamples)
|
||||||
{
|
{
|
||||||
unsigned int nbSamplesAudio = nbSamples * ((Real) m_audioSampleRate / (Real) m_channelSampleRate);
|
auto nbSamplesAudio = (nbSamples * (unsigned int) ((Real) m_audioSampleRate / (Real) m_channelSampleRate));
|
||||||
pullAudio(nbSamplesAudio);
|
pullAudio(nbSamplesAudio);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +151,7 @@ void AMModSource::pullAudio(unsigned int nbSamples)
|
|||||||
|
|
||||||
void AMModSource::modulateSample()
|
void AMModSource::modulateSample()
|
||||||
{
|
{
|
||||||
Real t;
|
Real t = 0.0f;
|
||||||
|
|
||||||
pullAF(t);
|
pullAF(t);
|
||||||
|
|
||||||
@ -186,17 +174,12 @@ void AMModSource::pullAF(Real& sample)
|
|||||||
sample = m_toneNco.next();
|
sample = m_toneNco.next();
|
||||||
break;
|
break;
|
||||||
case AMModSettings::AMModInputFile:
|
case AMModSettings::AMModInputFile:
|
||||||
// sox f4exb_call.wav --encoding float --endian little f4exb_call.raw
|
|
||||||
// ffplay -f f32le -ar 48k -ac 1 f4exb_call.raw
|
|
||||||
if (m_ifstream && m_ifstream->is_open())
|
if (m_ifstream && m_ifstream->is_open())
|
||||||
{
|
{
|
||||||
if (m_ifstream->eof())
|
if ((m_ifstream->eof()) && (m_settings.m_playLoop))
|
||||||
{
|
{
|
||||||
if (m_settings.m_playLoop)
|
m_ifstream->clear();
|
||||||
{
|
m_ifstream->seekg(0, std::ios::beg);
|
||||||
m_ifstream->clear();
|
|
||||||
m_ifstream->seekg(0, std::ios::beg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_ifstream->eof())
|
if (m_ifstream->eof())
|
||||||
@ -242,7 +225,6 @@ void AMModSource::pullAF(Real& sample)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AMModSettings::AMModInputNone:
|
|
||||||
default:
|
default:
|
||||||
sample = 0.0f;
|
sample = 0.0f;
|
||||||
break;
|
break;
|
||||||
@ -272,10 +254,10 @@ void AMModSource::pushFeedback(Real sample)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AMModSource::processOneSample(Complex& ci)
|
void AMModSource::processOneSample(const Complex& ci)
|
||||||
{
|
{
|
||||||
m_feedbackAudioBuffer[m_feedbackAudioBufferFill].l = ci.real();
|
m_feedbackAudioBuffer[m_feedbackAudioBufferFill].l = (qint16) ci.real();
|
||||||
m_feedbackAudioBuffer[m_feedbackAudioBufferFill].r = ci.imag();
|
m_feedbackAudioBuffer[m_feedbackAudioBufferFill].r = (qint16) ci.imag();
|
||||||
++m_feedbackAudioBufferFill;
|
++m_feedbackAudioBufferFill;
|
||||||
|
|
||||||
if (m_feedbackAudioBufferFill >= m_feedbackAudioBuffer.size())
|
if (m_feedbackAudioBufferFill >= m_feedbackAudioBuffer.size())
|
||||||
@ -293,7 +275,7 @@ void AMModSource::processOneSample(Complex& ci)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AMModSource::calculateLevel(Real& sample)
|
void AMModSource::calculateLevel(const Real& sample)
|
||||||
{
|
{
|
||||||
if (m_levelCalcCount < m_levelNbSamples)
|
if (m_levelCalcCount < m_levelNbSamples)
|
||||||
{
|
{
|
||||||
@ -325,7 +307,7 @@ void AMModSource::applyAudioSampleRate(int sampleRate)
|
|||||||
m_interpolatorConsumed = false;
|
m_interpolatorConsumed = false;
|
||||||
m_interpolatorDistance = (Real) sampleRate / (Real) m_channelSampleRate;
|
m_interpolatorDistance = (Real) sampleRate / (Real) m_channelSampleRate;
|
||||||
m_interpolator.create(48, sampleRate, m_settings.m_rfBandwidth / 2.2, 3.0);
|
m_interpolator.create(48, sampleRate, m_settings.m_rfBandwidth / 2.2, 3.0);
|
||||||
m_toneNco.setFreq(m_settings.m_toneFrequency, sampleRate);
|
m_toneNco.setFreq(m_settings.m_toneFrequency, (float) sampleRate);
|
||||||
|
|
||||||
if (m_cwKeyer)
|
if (m_cwKeyer)
|
||||||
{
|
{
|
||||||
@ -336,7 +318,7 @@ void AMModSource::applyAudioSampleRate(int sampleRate)
|
|||||||
QList<ObjectPipe*> pipes;
|
QList<ObjectPipe*> pipes;
|
||||||
MainCore::instance()->getMessagePipes().getMessagePipes(m_channel, "reportdemod", pipes);
|
MainCore::instance()->getMessagePipes().getMessagePipes(m_channel, "reportdemod", pipes);
|
||||||
|
|
||||||
if (pipes.size() > 0)
|
if (!pipes.empty())
|
||||||
{
|
{
|
||||||
for (const auto& pipe : pipes)
|
for (const auto& pipe : pipes)
|
||||||
{
|
{
|
||||||
@ -362,7 +344,7 @@ void AMModSource::applyFeedbackAudioSampleRate(int sampleRate)
|
|||||||
|
|
||||||
m_feedbackInterpolatorDistanceRemain = 0;
|
m_feedbackInterpolatorDistanceRemain = 0;
|
||||||
m_feedbackInterpolatorDistance = (Real) sampleRate / (Real) m_audioSampleRate;
|
m_feedbackInterpolatorDistance = (Real) sampleRate / (Real) m_audioSampleRate;
|
||||||
Real cutoff = std::min(sampleRate, m_audioSampleRate) / 2.2f;
|
Real cutoff = ((float) std::min(sampleRate, m_audioSampleRate)) / 2.2f;
|
||||||
m_feedbackInterpolator.create(48, sampleRate, cutoff, 3.0);
|
m_feedbackInterpolator.create(48, sampleRate, cutoff, 3.0);
|
||||||
m_feedbackAudioSampleRate = sampleRate;
|
m_feedbackAudioSampleRate = sampleRate;
|
||||||
}
|
}
|
||||||
@ -375,9 +357,8 @@ void AMModSource::applySettings(const AMModSettings& settings, bool force)
|
|||||||
applyAudioSampleRate(m_audioSampleRate);
|
applyAudioSampleRate(m_audioSampleRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((settings.m_toneFrequency != m_settings.m_toneFrequency) || force)
|
if ((settings.m_toneFrequency != m_settings.m_toneFrequency) || force) {
|
||||||
{
|
m_toneNco.setFreq(settings.m_toneFrequency, (float) m_audioSampleRate);
|
||||||
m_toneNco.setFreq(settings.m_toneFrequency, m_audioSampleRate);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((settings.m_modAFInput != m_settings.m_modAFInput) || force)
|
if ((settings.m_modAFInput != m_settings.m_modAFInput) || force)
|
||||||
@ -401,7 +382,7 @@ void AMModSource::applyChannelSettings(int channelSampleRate, int channelFrequen
|
|||||||
if ((channelFrequencyOffset != m_channelFrequencyOffset)
|
if ((channelFrequencyOffset != m_channelFrequencyOffset)
|
||||||
|| (channelSampleRate != m_channelSampleRate) || force)
|
|| (channelSampleRate != m_channelSampleRate) || force)
|
||||||
{
|
{
|
||||||
m_carrierNco.setFreq(channelFrequencyOffset, channelSampleRate);
|
m_carrierNco.setFreq((float) channelFrequencyOffset, (float) channelSampleRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((channelSampleRate != m_channelSampleRate) || force)
|
if ((channelSampleRate != m_channelSampleRate) || force)
|
||||||
@ -418,7 +399,6 @@ void AMModSource::applyChannelSettings(int channelSampleRate, int channelFrequen
|
|||||||
|
|
||||||
void AMModSource::handleAudio()
|
void AMModSource::handleAudio()
|
||||||
{
|
{
|
||||||
QMutexLocker mlock(&m_mutex);
|
|
||||||
unsigned int nbRead;
|
unsigned int nbRead;
|
||||||
|
|
||||||
while ((nbRead = m_audioFifo.read(reinterpret_cast<quint8*>(&m_audioReadBuffer[m_audioReadBufferFill]), 4096)) != 0)
|
while ((nbRead = m_audioFifo.read(reinterpret_cast<quint8*>(&m_audioReadBuffer[m_audioReadBufferFill]), 4096)) != 0)
|
||||||
|
@ -43,11 +43,11 @@ class AMModSource : public QObject, public ChannelSampleSource
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
AMModSource();
|
AMModSource();
|
||||||
virtual ~AMModSource();
|
~AMModSource() final;
|
||||||
|
|
||||||
virtual void pull(SampleVector::iterator begin, unsigned int nbSamples);
|
void pull(SampleVector::iterator begin, unsigned int nbSamples) final;
|
||||||
virtual void pullOne(Sample& sample);
|
void pullOne(Sample& sample) final;
|
||||||
virtual void prefetch(unsigned int nbSamples);
|
void prefetch(unsigned int nbSamples) final;
|
||||||
|
|
||||||
void setInputFileStream(std::ifstream *ifstream) { m_ifstream = ifstream; }
|
void setInputFileStream(std::ifstream *ifstream) { m_ifstream = ifstream; }
|
||||||
AudioFifo *getAudioFifo() { return &m_audioFifo; }
|
AudioFifo *getAudioFifo() { return &m_audioFifo; }
|
||||||
@ -70,8 +70,8 @@ public:
|
|||||||
void applyChannelSettings(int channelSampleRate, int channelFrequencyOffset, bool force = false);
|
void applyChannelSettings(int channelSampleRate, int channelFrequencyOffset, bool force = false);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_channelSampleRate;
|
int m_channelSampleRate = 48000;
|
||||||
int m_channelFrequencyOffset;
|
int m_channelFrequencyOffset = 0;
|
||||||
AMModSettings m_settings;
|
AMModSettings m_settings;
|
||||||
ChannelAPI *m_channel;
|
ChannelAPI *m_channel;
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ private:
|
|||||||
double m_magsq;
|
double m_magsq;
|
||||||
MovingAverageUtil<double, double, 16> m_movingAverage;
|
MovingAverageUtil<double, double, 16> m_movingAverage;
|
||||||
|
|
||||||
int m_audioSampleRate;
|
int m_audioSampleRate = 48000;
|
||||||
AudioVector m_audioBuffer;
|
AudioVector m_audioBuffer;
|
||||||
unsigned int m_audioBufferFill;
|
unsigned int m_audioBufferFill;
|
||||||
AudioVector m_audioReadBuffer;
|
AudioVector m_audioReadBuffer;
|
||||||
@ -106,24 +106,24 @@ private:
|
|||||||
int m_demodBufferFill;
|
int m_demodBufferFill;
|
||||||
bool m_demodBufferEnabled;
|
bool m_demodBufferEnabled;
|
||||||
|
|
||||||
quint32 m_levelCalcCount;
|
quint32 m_levelCalcCount = 0;
|
||||||
qreal m_rmsLevel;
|
qreal m_rmsLevel;
|
||||||
qreal m_peakLevelOut;
|
qreal m_peakLevelOut;
|
||||||
Real m_peakLevel;
|
Real m_peakLevel = 0.0f;
|
||||||
Real m_levelSum;
|
Real m_levelSum = 0.0f;
|
||||||
|
|
||||||
std::ifstream *m_ifstream;
|
std::ifstream *m_ifstream = nullptr;
|
||||||
CWKeyer *m_cwKeyer;
|
CWKeyer *m_cwKeyer = nullptr;
|
||||||
|
|
||||||
QRecursiveMutex m_mutex;
|
QRecursiveMutex m_mutex;
|
||||||
|
|
||||||
static const int m_levelNbSamples;
|
static const int m_levelNbSamples;
|
||||||
|
|
||||||
void processOneSample(Complex& ci);
|
void processOneSample(const Complex& ci);
|
||||||
void pullAF(Real& sample);
|
void pullAF(Real& sample);
|
||||||
void pullAudio(unsigned int nbSamples);
|
void pullAudio(unsigned int nbSamples);
|
||||||
void pushFeedback(Real sample);
|
void pushFeedback(Real sample);
|
||||||
void calculateLevel(Real& sample);
|
void calculateLevel(const Real& sample);
|
||||||
void modulateSample();
|
void modulateSample();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -56,12 +56,7 @@ const char* const NFMMod::m_channelId = "NFMMod";
|
|||||||
|
|
||||||
NFMMod::NFMMod(DeviceAPI *deviceAPI) :
|
NFMMod::NFMMod(DeviceAPI *deviceAPI) :
|
||||||
ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSource),
|
ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSource),
|
||||||
m_deviceAPI(deviceAPI),
|
m_deviceAPI(deviceAPI)
|
||||||
m_running(false),
|
|
||||||
m_fileSize(0),
|
|
||||||
m_recordLength(0),
|
|
||||||
m_sampleRate(48000),
|
|
||||||
m_levelMeter(nullptr)
|
|
||||||
{
|
{
|
||||||
setObjectName(m_channelId);
|
setObjectName(m_channelId);
|
||||||
|
|
||||||
@ -91,7 +86,7 @@ NFMMod::~NFMMod()
|
|||||||
m_deviceAPI->removeChannelSourceAPI(this);
|
m_deviceAPI->removeChannelSourceAPI(this);
|
||||||
m_deviceAPI->removeChannelSource(this);
|
m_deviceAPI->removeChannelSource(this);
|
||||||
|
|
||||||
stop();
|
NFMMod::stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NFMMod::setDeviceAPI(DeviceAPI *deviceAPI)
|
void NFMMod::setDeviceAPI(DeviceAPI *deviceAPI)
|
||||||
@ -182,7 +177,7 @@ bool NFMMod::handleMessage(const Message& cmd)
|
|||||||
{
|
{
|
||||||
if (MsgConfigureNFMMod::match(cmd))
|
if (MsgConfigureNFMMod::match(cmd))
|
||||||
{
|
{
|
||||||
MsgConfigureNFMMod& cfg = (MsgConfigureNFMMod&) cmd;
|
auto& cfg = (const MsgConfigureNFMMod&) cmd;
|
||||||
qDebug() << "NFMMod::handleMessage: MsgConfigureNFMMod";
|
qDebug() << "NFMMod::handleMessage: MsgConfigureNFMMod";
|
||||||
|
|
||||||
applySettings(cfg.getSettings(), cfg.getForce());
|
applySettings(cfg.getSettings(), cfg.getForce());
|
||||||
@ -191,7 +186,7 @@ bool NFMMod::handleMessage(const Message& cmd)
|
|||||||
}
|
}
|
||||||
else if (MsgConfigureFileSourceName::match(cmd))
|
else if (MsgConfigureFileSourceName::match(cmd))
|
||||||
{
|
{
|
||||||
MsgConfigureFileSourceName& conf = (MsgConfigureFileSourceName&) cmd;
|
auto& conf = (const MsgConfigureFileSourceName&) cmd;
|
||||||
m_fileName = conf.getFileName();
|
m_fileName = conf.getFileName();
|
||||||
openFileStream();
|
openFileStream();
|
||||||
qDebug() << "NFMMod::handleMessage: MsgConfigureFileSourceName:"
|
qDebug() << "NFMMod::handleMessage: MsgConfigureFileSourceName:"
|
||||||
@ -200,7 +195,7 @@ bool NFMMod::handleMessage(const Message& cmd)
|
|||||||
}
|
}
|
||||||
else if (MsgConfigureFileSourceSeek::match(cmd))
|
else if (MsgConfigureFileSourceSeek::match(cmd))
|
||||||
{
|
{
|
||||||
MsgConfigureFileSourceSeek& conf = (MsgConfigureFileSourceSeek&) cmd;
|
auto& conf = (const MsgConfigureFileSourceSeek&) cmd;
|
||||||
int seekPercentage = conf.getPercentage();
|
int seekPercentage = conf.getPercentage();
|
||||||
seekFileStream(seekPercentage);
|
seekFileStream(seekPercentage);
|
||||||
qDebug() << "NFMMod::handleMessage: MsgConfigureFileSourceSeek:"
|
qDebug() << "NFMMod::handleMessage: MsgConfigureFileSourceSeek:"
|
||||||
@ -226,7 +221,7 @@ bool NFMMod::handleMessage(const Message& cmd)
|
|||||||
}
|
}
|
||||||
else if (MsgConfigureFileSourceName::match(cmd))
|
else if (MsgConfigureFileSourceName::match(cmd))
|
||||||
{
|
{
|
||||||
MsgConfigureFileSourceName& conf = (MsgConfigureFileSourceName&) cmd;
|
auto& conf = (const MsgConfigureFileSourceName&) cmd;
|
||||||
m_fileName = conf.getFileName();
|
m_fileName = conf.getFileName();
|
||||||
openFileStream();
|
openFileStream();
|
||||||
qDebug() << "NFMMod::handleMessage: MsgConfigureFileSourceName:"
|
qDebug() << "NFMMod::handleMessage: MsgConfigureFileSourceName:"
|
||||||
@ -235,7 +230,7 @@ bool NFMMod::handleMessage(const Message& cmd)
|
|||||||
}
|
}
|
||||||
else if (MsgConfigureFileSourceSeek::match(cmd))
|
else if (MsgConfigureFileSourceSeek::match(cmd))
|
||||||
{
|
{
|
||||||
MsgConfigureFileSourceSeek& conf = (MsgConfigureFileSourceSeek&) cmd;
|
auto& conf = (const MsgConfigureFileSourceSeek&) cmd;
|
||||||
int seekPercentage = conf.getPercentage();
|
int seekPercentage = conf.getPercentage();
|
||||||
seekFileStream(seekPercentage);
|
seekFileStream(seekPercentage);
|
||||||
qDebug() << "NFMMod::handleMessage: MsgConfigureFileSourceSeek:"
|
qDebug() << "NFMMod::handleMessage: MsgConfigureFileSourceSeek:"
|
||||||
@ -261,7 +256,7 @@ bool NFMMod::handleMessage(const Message& cmd)
|
|||||||
}
|
}
|
||||||
else if (CWKeyer::MsgConfigureCWKeyer::match(cmd))
|
else if (CWKeyer::MsgConfigureCWKeyer::match(cmd))
|
||||||
{
|
{
|
||||||
const CWKeyer::MsgConfigureCWKeyer& cfg = (CWKeyer::MsgConfigureCWKeyer&) cmd;
|
auto& cfg = (const CWKeyer::MsgConfigureCWKeyer&) cmd;
|
||||||
|
|
||||||
if (m_settings.m_useReverseAPI) {
|
if (m_settings.m_useReverseAPI) {
|
||||||
webapiReverseSendCWSettings(cfg.getSettings());
|
webapiReverseSendCWSettings(cfg.getSettings());
|
||||||
@ -274,8 +269,8 @@ bool NFMMod::handleMessage(const Message& cmd)
|
|||||||
// Forward to the source
|
// Forward to the source
|
||||||
if (m_running)
|
if (m_running)
|
||||||
{
|
{
|
||||||
DSPSignalNotification& notif = (DSPSignalNotification&) cmd;
|
auto& notif = (const DSPSignalNotification&) cmd;
|
||||||
DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy
|
auto* rep = new DSPSignalNotification(notif); // make a copy
|
||||||
qDebug() << "NFMMod::handleMessage: DSPSignalNotification";
|
qDebug() << "NFMMod::handleMessage: DSPSignalNotification";
|
||||||
m_basebandSource->getInputMessageQueue()->push(rep);
|
m_basebandSource->getInputMessageQueue()->push(rep);
|
||||||
// Forward to GUI if any
|
// Forward to GUI if any
|
||||||
@ -310,7 +305,7 @@ void NFMMod::openFileStream()
|
|||||||
m_ifstream.seekg(0,std::ios_base::beg);
|
m_ifstream.seekg(0,std::ios_base::beg);
|
||||||
|
|
||||||
m_sampleRate = 48000; // fixed rate
|
m_sampleRate = 48000; // fixed rate
|
||||||
m_recordLength = m_fileSize / (sizeof(Real) * m_sampleRate);
|
m_recordLength = (quint32) (m_fileSize / (sizeof(Real) * m_sampleRate));
|
||||||
|
|
||||||
qDebug() << "NFMMod::openFileStream: " << m_fileName.toStdString().c_str()
|
qDebug() << "NFMMod::openFileStream: " << m_fileName.toStdString().c_str()
|
||||||
<< " fileSize: " << m_fileSize << "bytes"
|
<< " fileSize: " << m_fileSize << "bytes"
|
||||||
@ -444,7 +439,7 @@ void NFMMod::applySettings(const NFMModSettings& settings, bool force)
|
|||||||
QList<ObjectPipe*> pipes;
|
QList<ObjectPipe*> pipes;
|
||||||
MainCore::instance()->getMessagePipes().getMessagePipes(this, "settings", pipes);
|
MainCore::instance()->getMessagePipes().getMessagePipes(this, "settings", pipes);
|
||||||
|
|
||||||
if (pipes.size() > 0) {
|
if (!pipes.empty()) {
|
||||||
sendChannelSettings(pipes, reverseAPIKeys, settings, force);
|
sendChannelSettings(pipes, reverseAPIKeys, settings, force);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -472,12 +467,12 @@ bool NFMMod::deserialize(const QByteArray& data)
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NFMMod::sendSampleRateToDemodAnalyzer()
|
void NFMMod::sendSampleRateToDemodAnalyzer() const
|
||||||
{
|
{
|
||||||
QList<ObjectPipe*> pipes;
|
QList<ObjectPipe*> pipes;
|
||||||
MainCore::instance()->getMessagePipes().getMessagePipes(this, "reportdemod", pipes);
|
MainCore::instance()->getMessagePipes().getMessagePipes(this, "reportdemod", pipes);
|
||||||
|
|
||||||
if (pipes.size() > 0)
|
if (!pipes.empty())
|
||||||
{
|
{
|
||||||
for (const auto& pipe : pipes)
|
for (const auto& pipe : pipes)
|
||||||
{
|
{
|
||||||
@ -625,13 +620,13 @@ void NFMMod::webapiUpdateChannelSettings(
|
|||||||
settings.m_reverseAPIAddress = *response.getNfmModSettings()->getReverseApiAddress();
|
settings.m_reverseAPIAddress = *response.getNfmModSettings()->getReverseApiAddress();
|
||||||
}
|
}
|
||||||
if (channelSettingsKeys.contains("reverseAPIPort")) {
|
if (channelSettingsKeys.contains("reverseAPIPort")) {
|
||||||
settings.m_reverseAPIPort = response.getNfmModSettings()->getReverseApiPort();
|
settings.m_reverseAPIPort = (uint16_t) response.getNfmModSettings()->getReverseApiPort();
|
||||||
}
|
}
|
||||||
if (channelSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
if (channelSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||||
settings.m_reverseAPIDeviceIndex = response.getNfmModSettings()->getReverseApiDeviceIndex();
|
settings.m_reverseAPIDeviceIndex = (uint16_t) response.getNfmModSettings()->getReverseApiDeviceIndex();
|
||||||
}
|
}
|
||||||
if (channelSettingsKeys.contains("reverseAPIChannelIndex")) {
|
if (channelSettingsKeys.contains("reverseAPIChannelIndex")) {
|
||||||
settings.m_reverseAPIChannelIndex = response.getNfmModSettings()->getReverseApiChannelIndex();
|
settings.m_reverseAPIChannelIndex = (uint16_t) response.getNfmModSettings()->getReverseApiChannelIndex();
|
||||||
}
|
}
|
||||||
if (settings.m_channelMarker && channelSettingsKeys.contains("channelMarker")) {
|
if (settings.m_channelMarker && channelSettingsKeys.contains("channelMarker")) {
|
||||||
settings.m_channelMarker->updateFrom(channelSettingsKeys, response.getNfmModSettings()->getChannelMarker());
|
settings.m_channelMarker->updateFrom(channelSettingsKeys, response.getNfmModSettings()->getChannelMarker());
|
||||||
@ -709,7 +704,7 @@ void NFMMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respon
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGChannelMarker *swgChannelMarker = new SWGSDRangel::SWGChannelMarker();
|
auto *swgChannelMarker = new SWGSDRangel::SWGChannelMarker();
|
||||||
settings.m_channelMarker->formatTo(swgChannelMarker);
|
settings.m_channelMarker->formatTo(swgChannelMarker);
|
||||||
response.getNfmModSettings()->setChannelMarker(swgChannelMarker);
|
response.getNfmModSettings()->setChannelMarker(swgChannelMarker);
|
||||||
}
|
}
|
||||||
@ -723,16 +718,16 @@ void NFMMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respon
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGRollupState *swgRollupState = new SWGSDRangel::SWGRollupState();
|
auto *swgRollupState = new SWGSDRangel::SWGRollupState();
|
||||||
settings.m_rollupState->formatTo(swgRollupState);
|
settings.m_rollupState->formatTo(swgRollupState);
|
||||||
response.getNfmModSettings()->setRollupState(swgRollupState);
|
response.getNfmModSettings()->setRollupState(swgRollupState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NFMMod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response)
|
void NFMMod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response) const
|
||||||
{
|
{
|
||||||
response.getNfmModReport()->setChannelPowerDb(CalcDb::dbPower(getMagSq()));
|
response.getNfmModReport()->setChannelPowerDb((float) CalcDb::dbPower(getMagSq()));
|
||||||
|
|
||||||
if (m_running)
|
if (m_running)
|
||||||
{
|
{
|
||||||
@ -741,9 +736,9 @@ void NFMMod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NFMMod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const NFMModSettings& settings, bool force)
|
void NFMMod::webapiReverseSendSettings(const QList<QString>& channelSettingsKeys, const NFMModSettings& settings, bool force)
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGChannelSettings *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
|
auto *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
|
||||||
webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force);
|
webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force);
|
||||||
|
|
||||||
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
|
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
|
||||||
@ -754,8 +749,8 @@ void NFMMod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, cons
|
|||||||
m_networkRequest.setUrl(QUrl(channelSettingsURL));
|
m_networkRequest.setUrl(QUrl(channelSettingsURL));
|
||||||
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||||
|
|
||||||
QBuffer *buffer = new QBuffer();
|
auto *buffer = new QBuffer();
|
||||||
buffer->open((QBuffer::ReadWrite));
|
buffer->open(QBuffer::ReadWrite);
|
||||||
buffer->write(swgChannelSettings->asJson().toUtf8());
|
buffer->write(swgChannelSettings->asJson().toUtf8());
|
||||||
buffer->seek(0);
|
buffer->seek(0);
|
||||||
|
|
||||||
@ -768,7 +763,7 @@ void NFMMod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, cons
|
|||||||
|
|
||||||
void NFMMod::webapiReverseSendCWSettings(const CWKeyerSettings& cwKeyerSettings)
|
void NFMMod::webapiReverseSendCWSettings(const CWKeyerSettings& cwKeyerSettings)
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGChannelSettings *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
|
auto *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
|
||||||
swgChannelSettings->setDirection(1); // single source (Tx)
|
swgChannelSettings->setDirection(1); // single source (Tx)
|
||||||
swgChannelSettings->setChannelType(new QString("NFMMod"));
|
swgChannelSettings->setChannelType(new QString("NFMMod"));
|
||||||
swgChannelSettings->setNfmModSettings(new SWGSDRangel::SWGNFMModSettings());
|
swgChannelSettings->setNfmModSettings(new SWGSDRangel::SWGNFMModSettings());
|
||||||
@ -776,7 +771,7 @@ void NFMMod::webapiReverseSendCWSettings(const CWKeyerSettings& cwKeyerSettings)
|
|||||||
|
|
||||||
swgNFModSettings->setCwKeyer(new SWGSDRangel::SWGCWKeyerSettings());
|
swgNFModSettings->setCwKeyer(new SWGSDRangel::SWGCWKeyerSettings());
|
||||||
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = swgNFModSettings->getCwKeyer();
|
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = swgNFModSettings->getCwKeyer();
|
||||||
getCWKeyer()->webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
|
CWKeyer::webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
|
||||||
|
|
||||||
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
|
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
|
||||||
.arg(m_settings.m_reverseAPIAddress)
|
.arg(m_settings.m_reverseAPIAddress)
|
||||||
@ -786,8 +781,8 @@ void NFMMod::webapiReverseSendCWSettings(const CWKeyerSettings& cwKeyerSettings)
|
|||||||
m_networkRequest.setUrl(QUrl(channelSettingsURL));
|
m_networkRequest.setUrl(QUrl(channelSettingsURL));
|
||||||
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||||
|
|
||||||
QBuffer *buffer = new QBuffer();
|
auto *buffer = new QBuffer();
|
||||||
buffer->open((QBuffer::ReadWrite));
|
buffer->open(QBuffer::ReadWrite);
|
||||||
buffer->write(swgChannelSettings->asJson().toUtf8());
|
buffer->write(swgChannelSettings->asJson().toUtf8());
|
||||||
buffer->seek(0);
|
buffer->seek(0);
|
||||||
|
|
||||||
@ -800,7 +795,7 @@ void NFMMod::webapiReverseSendCWSettings(const CWKeyerSettings& cwKeyerSettings)
|
|||||||
|
|
||||||
void NFMMod::sendChannelSettings(
|
void NFMMod::sendChannelSettings(
|
||||||
const QList<ObjectPipe*>& pipes,
|
const QList<ObjectPipe*>& pipes,
|
||||||
QList<QString>& channelSettingsKeys,
|
const QList<QString>& channelSettingsKeys,
|
||||||
const NFMModSettings& settings,
|
const NFMModSettings& settings,
|
||||||
bool force)
|
bool force)
|
||||||
{
|
{
|
||||||
@ -810,7 +805,7 @@ void NFMMod::sendChannelSettings(
|
|||||||
|
|
||||||
if (messageQueue)
|
if (messageQueue)
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGChannelSettings *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
|
auto *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
|
||||||
webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force);
|
webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force);
|
||||||
MainCore::MsgChannelSettings *msg = MainCore::MsgChannelSettings::create(
|
MainCore::MsgChannelSettings *msg = MainCore::MsgChannelSettings::create(
|
||||||
this,
|
this,
|
||||||
@ -824,7 +819,7 @@ void NFMMod::sendChannelSettings(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void NFMMod::webapiFormatChannelSettings(
|
void NFMMod::webapiFormatChannelSettings(
|
||||||
QList<QString>& channelSettingsKeys,
|
const QList<QString>& channelSettingsKeys,
|
||||||
SWGSDRangel::SWGChannelSettings *swgChannelSettings,
|
SWGSDRangel::SWGChannelSettings *swgChannelSettings,
|
||||||
const NFMModSettings& settings,
|
const NFMModSettings& settings,
|
||||||
bool force
|
bool force
|
||||||
@ -902,14 +897,14 @@ void NFMMod::webapiFormatChannelSettings(
|
|||||||
|
|
||||||
if (settings.m_channelMarker && (channelSettingsKeys.contains("channelMarker") || force))
|
if (settings.m_channelMarker && (channelSettingsKeys.contains("channelMarker") || force))
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGChannelMarker *swgChannelMarker = new SWGSDRangel::SWGChannelMarker();
|
auto *swgChannelMarker = new SWGSDRangel::SWGChannelMarker();
|
||||||
settings.m_channelMarker->formatTo(swgChannelMarker);
|
settings.m_channelMarker->formatTo(swgChannelMarker);
|
||||||
swgNFMModSettings->setChannelMarker(swgChannelMarker);
|
swgNFMModSettings->setChannelMarker(swgChannelMarker);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings.m_rollupState && (channelSettingsKeys.contains("rollupState") || force))
|
if (settings.m_rollupState && (channelSettingsKeys.contains("rollupState") || force))
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGRollupState *swgRollupState = new SWGSDRangel::SWGRollupState();
|
auto *swgRollupState = new SWGSDRangel::SWGRollupState();
|
||||||
settings.m_rollupState->formatTo(swgRollupState);
|
settings.m_rollupState->formatTo(swgRollupState);
|
||||||
swgNFMModSettings->setRollupState(swgRollupState);
|
swgNFMModSettings->setRollupState(swgRollupState);
|
||||||
}
|
}
|
||||||
@ -919,11 +914,11 @@ void NFMMod::webapiFormatChannelSettings(
|
|||||||
const CWKeyerSettings& cwKeyerSettings = getCWKeyer()->getSettings();
|
const CWKeyerSettings& cwKeyerSettings = getCWKeyer()->getSettings();
|
||||||
swgNFMModSettings->setCwKeyer(new SWGSDRangel::SWGCWKeyerSettings());
|
swgNFMModSettings->setCwKeyer(new SWGSDRangel::SWGCWKeyerSettings());
|
||||||
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = swgNFMModSettings->getCwKeyer();
|
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = swgNFMModSettings->getCwKeyer();
|
||||||
getCWKeyer()->webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
|
CWKeyer::webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NFMMod::networkManagerFinished(QNetworkReply *reply)
|
void NFMMod::networkManagerFinished(QNetworkReply *reply) const
|
||||||
{
|
{
|
||||||
QNetworkReply::NetworkError replyError = reply->error();
|
QNetworkReply::NetworkError replyError = reply->error();
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
QString m_fileName;
|
QString m_fileName;
|
||||||
|
|
||||||
MsgConfigureFileSourceName(const QString& fileName) :
|
explicit MsgConfigureFileSourceName(const QString& fileName) :
|
||||||
Message(),
|
Message(),
|
||||||
m_fileName(fileName)
|
m_fileName(fileName)
|
||||||
{ }
|
{ }
|
||||||
@ -100,10 +100,10 @@ public:
|
|||||||
return new MsgConfigureFileSourceSeek(seekPercentage);
|
return new MsgConfigureFileSourceSeek(seekPercentage);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
int m_seekPercentage; //!< percentage of seek position from the beginning 0..100
|
int m_seekPercentage; //!< percentage of seek position from the beginning 0..100
|
||||||
|
|
||||||
MsgConfigureFileSourceSeek(int seekPercentage) :
|
explicit MsgConfigureFileSourceSeek(int seekPercentage) :
|
||||||
Message(),
|
Message(),
|
||||||
m_seekPercentage(seekPercentage)
|
m_seekPercentage(seekPercentage)
|
||||||
{ }
|
{ }
|
||||||
@ -138,10 +138,10 @@ public:
|
|||||||
return new MsgReportFileSourceStreamTiming(samplesCount);
|
return new MsgReportFileSourceStreamTiming(samplesCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
std::size_t m_samplesCount;
|
std::size_t m_samplesCount;
|
||||||
|
|
||||||
MsgReportFileSourceStreamTiming(std::size_t samplesCount) :
|
explicit MsgReportFileSourceStreamTiming(std::size_t samplesCount) :
|
||||||
Message(),
|
Message(),
|
||||||
m_samplesCount(samplesCount)
|
m_samplesCount(samplesCount)
|
||||||
{ }
|
{ }
|
||||||
@ -160,7 +160,7 @@ public:
|
|||||||
return new MsgReportFileSourceStreamData(sampleRate, recordLength);
|
return new MsgReportFileSourceStreamData(sampleRate, recordLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
int m_sampleRate;
|
int m_sampleRate;
|
||||||
quint32 m_recordLength;
|
quint32 m_recordLength;
|
||||||
|
|
||||||
@ -174,55 +174,55 @@ public:
|
|||||||
|
|
||||||
//=================================================================
|
//=================================================================
|
||||||
|
|
||||||
NFMMod(DeviceAPI *deviceAPI);
|
explicit NFMMod(DeviceAPI *deviceAPI);
|
||||||
virtual ~NFMMod();
|
~NFMMod() final;
|
||||||
virtual void destroy() { delete this; }
|
void destroy() final { delete this; }
|
||||||
virtual void setDeviceAPI(DeviceAPI *deviceAPI);
|
void setDeviceAPI(DeviceAPI *deviceAPI) final;
|
||||||
virtual DeviceAPI *getDeviceAPI() { return m_deviceAPI; }
|
DeviceAPI *getDeviceAPI() final { return m_deviceAPI; }
|
||||||
|
|
||||||
virtual void start();
|
void start() final;
|
||||||
virtual void stop();
|
void stop() final;
|
||||||
virtual void pull(SampleVector::iterator& begin, unsigned int nbSamples);
|
void pull(SampleVector::iterator& begin, unsigned int nbSamples) final;
|
||||||
virtual void pushMessage(Message *msg) { m_inputMessageQueue.push(msg); }
|
void pushMessage(Message *msg) final { m_inputMessageQueue.push(msg); }
|
||||||
virtual QString getSourceName() { return objectName(); }
|
QString getSourceName() final { return objectName(); }
|
||||||
|
|
||||||
virtual void getIdentifier(QString& id) { id = objectName(); }
|
void getIdentifier(QString& id) final { id = objectName(); }
|
||||||
virtual QString getIdentifier() const { return objectName(); }
|
QString getIdentifier() const final { return objectName(); }
|
||||||
virtual void getTitle(QString& title) { title = m_settings.m_title; }
|
void getTitle(QString& title) final { title = m_settings.m_title; }
|
||||||
virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; }
|
qint64 getCenterFrequency() const final { return m_settings.m_inputFrequencyOffset; }
|
||||||
virtual void setCenterFrequency(qint64 frequency);
|
void setCenterFrequency(qint64 frequency) final;
|
||||||
|
|
||||||
virtual QByteArray serialize() const;
|
QByteArray serialize() const final;
|
||||||
virtual bool deserialize(const QByteArray& data);
|
bool deserialize(const QByteArray& data) final;
|
||||||
|
|
||||||
virtual int getNbSinkStreams() const { return 1; }
|
int getNbSinkStreams() const final { return 1; }
|
||||||
virtual int getNbSourceStreams() const { return 0; }
|
int getNbSourceStreams() const final { return 0; }
|
||||||
virtual int getStreamIndex() const { return m_settings.m_streamIndex; }
|
int getStreamIndex() const final { return m_settings.m_streamIndex; }
|
||||||
|
|
||||||
virtual qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const
|
qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const final
|
||||||
{
|
{
|
||||||
(void) streamIndex;
|
(void) streamIndex;
|
||||||
(void) sinkElseSource;
|
(void) sinkElseSource;
|
||||||
return m_settings.m_inputFrequencyOffset;
|
return m_settings.m_inputFrequencyOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int webapiSettingsGet(
|
int webapiSettingsGet(
|
||||||
SWGSDRangel::SWGChannelSettings& response,
|
SWGSDRangel::SWGChannelSettings& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage) final;
|
||||||
|
|
||||||
virtual int webapiWorkspaceGet(
|
int webapiWorkspaceGet(
|
||||||
SWGSDRangel::SWGWorkspaceInfo& response,
|
SWGSDRangel::SWGWorkspaceInfo& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage) final;
|
||||||
|
|
||||||
virtual int webapiSettingsPutPatch(
|
int webapiSettingsPutPatch(
|
||||||
bool force,
|
bool force,
|
||||||
const QStringList& channelSettingsKeys,
|
const QStringList& channelSettingsKeys,
|
||||||
SWGSDRangel::SWGChannelSettings& response,
|
SWGSDRangel::SWGChannelSettings& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage) final;
|
||||||
|
|
||||||
virtual int webapiReportGet(
|
int webapiReportGet(
|
||||||
SWGSDRangel::SWGChannelReport& response,
|
SWGSDRangel::SWGChannelReport& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage) final;
|
||||||
|
|
||||||
static void webapiFormatChannelSettings(
|
static void webapiFormatChannelSettings(
|
||||||
SWGSDRangel::SWGChannelSettings& response,
|
SWGSDRangel::SWGChannelSettings& response,
|
||||||
@ -251,7 +251,7 @@ private:
|
|||||||
|
|
||||||
DeviceAPI* m_deviceAPI;
|
DeviceAPI* m_deviceAPI;
|
||||||
QThread *m_thread;
|
QThread *m_thread;
|
||||||
bool m_running;
|
bool m_running = false;
|
||||||
NFMModBaseband* m_basebandSource;
|
NFMModBaseband* m_basebandSource;
|
||||||
NFMModSettings m_settings;
|
NFMModSettings m_settings;
|
||||||
|
|
||||||
@ -260,39 +260,39 @@ private:
|
|||||||
|
|
||||||
std::ifstream m_ifstream;
|
std::ifstream m_ifstream;
|
||||||
QString m_fileName;
|
QString m_fileName;
|
||||||
quint64 m_fileSize; //!< raw file size (bytes)
|
quint64 m_fileSize = 0; //!< raw file size (bytes)
|
||||||
quint32 m_recordLength; //!< record length in seconds computed from file size
|
quint32 m_recordLength = 0; //!< record length in seconds computed from file size
|
||||||
int m_sampleRate;
|
int m_sampleRate = 48000;
|
||||||
|
|
||||||
QNetworkAccessManager *m_networkManager;
|
QNetworkAccessManager *m_networkManager;
|
||||||
QNetworkRequest m_networkRequest;
|
QNetworkRequest m_networkRequest;
|
||||||
|
|
||||||
CWKeyer m_cwKeyer;
|
CWKeyer m_cwKeyer;
|
||||||
QObject *m_levelMeter;
|
QObject *m_levelMeter = nullptr;
|
||||||
|
|
||||||
virtual bool handleMessage(const Message& cmd);
|
bool handleMessage(const Message& cmd) final;
|
||||||
void applySettings(const NFMModSettings& settings, bool force = false);
|
void applySettings(const NFMModSettings& settings, bool force = false);
|
||||||
void sendSampleRateToDemodAnalyzer();
|
void sendSampleRateToDemodAnalyzer() const;
|
||||||
void openFileStream();
|
void openFileStream();
|
||||||
void seekFileStream(int seekPercentage);
|
void seekFileStream(int seekPercentage);
|
||||||
void webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response);
|
void webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response) const;
|
||||||
void webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const NFMModSettings& settings, bool force);
|
void webapiReverseSendSettings(const QList<QString>& channelSettingsKeys, const NFMModSettings& settings, bool force);
|
||||||
void webapiReverseSendCWSettings(const CWKeyerSettings& settings);
|
void webapiReverseSendCWSettings(const CWKeyerSettings& settings);
|
||||||
void sendChannelSettings(
|
void sendChannelSettings(
|
||||||
const QList<ObjectPipe*>& pipes,
|
const QList<ObjectPipe*>& pipes,
|
||||||
QList<QString>& channelSettingsKeys,
|
const QList<QString>& channelSettingsKeys,
|
||||||
const NFMModSettings& settings,
|
const NFMModSettings& settings,
|
||||||
bool force
|
bool force
|
||||||
);
|
);
|
||||||
void webapiFormatChannelSettings(
|
void webapiFormatChannelSettings(
|
||||||
QList<QString>& channelSettingsKeys,
|
const QList<QString>& channelSettingsKeys,
|
||||||
SWGSDRangel::SWGChannelSettings *swgChannelSettings,
|
SWGSDRangel::SWGChannelSettings *swgChannelSettings,
|
||||||
const NFMModSettings& settings,
|
const NFMModSettings& settings,
|
||||||
bool force
|
bool force
|
||||||
);
|
);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void networkManagerFinished(QNetworkReply *reply);
|
void networkManagerFinished(QNetworkReply *reply) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,21 +27,12 @@
|
|||||||
#include "nfmmodsource.h"
|
#include "nfmmodsource.h"
|
||||||
|
|
||||||
const int NFMModSource::m_levelNbSamples = 480; // every 10ms
|
const int NFMModSource::m_levelNbSamples = 480; // every 10ms
|
||||||
const float NFMModSource::m_preemphasis = 120.0e-6; // 120us
|
const float NFMModSource::m_preemphasis = 120.0e-6f; // 120us
|
||||||
|
|
||||||
NFMModSource::NFMModSource() :
|
NFMModSource::NFMModSource() :
|
||||||
m_channelSampleRate(48000),
|
|
||||||
m_channelFrequencyOffset(0),
|
|
||||||
m_modPhasor(0.0f),
|
|
||||||
m_preemphasisFilter(m_preemphasis*48000),
|
m_preemphasisFilter(m_preemphasis*48000),
|
||||||
m_audioSampleRate(48000),
|
|
||||||
m_audioFifo(12000),
|
m_audioFifo(12000),
|
||||||
m_feedbackAudioFifo(48000),
|
m_feedbackAudioFifo(48000)
|
||||||
m_levelCalcCount(0),
|
|
||||||
m_peakLevel(0.0f),
|
|
||||||
m_levelSum(0.0f),
|
|
||||||
m_ifstream(nullptr),
|
|
||||||
m_cwKeyer(nullptr)
|
|
||||||
{
|
{
|
||||||
m_audioFifo.setLabel("NFMModSource.m_audioFifo");
|
m_audioFifo.setLabel("NFMModSource.m_audioFifo");
|
||||||
m_feedbackAudioFifo.setLabel("NFMModSource.m_feedbackAudioFifo");
|
m_feedbackAudioFifo.setLabel("NFMModSource.m_feedbackAudioFifo");
|
||||||
@ -64,7 +55,7 @@ NFMModSource::NFMModSource() :
|
|||||||
-20, // threshold (dB)
|
-20, // threshold (dB)
|
||||||
20, // knee (dB)
|
20, // knee (dB)
|
||||||
15, // ratio (dB)
|
15, // ratio (dB)
|
||||||
0.003, // attack (s)
|
0.003f,// attack (s)
|
||||||
0.25 // release (s)
|
0.25 // release (s)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -72,9 +63,7 @@ NFMModSource::NFMModSource() :
|
|||||||
applyChannelSettings(m_channelSampleRate, m_channelFrequencyOffset, true);
|
applyChannelSettings(m_channelSampleRate, m_channelFrequencyOffset, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
NFMModSource::~NFMModSource()
|
NFMModSource::~NFMModSource() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void NFMModSource::pull(SampleVector::iterator begin, unsigned int nbSamples)
|
void NFMModSource::pull(SampleVector::iterator begin, unsigned int nbSamples)
|
||||||
{
|
{
|
||||||
@ -130,7 +119,7 @@ void NFMModSource::pullOne(Sample& sample)
|
|||||||
|
|
||||||
void NFMModSource::prefetch(unsigned int nbSamples)
|
void NFMModSource::prefetch(unsigned int nbSamples)
|
||||||
{
|
{
|
||||||
unsigned int nbSamplesAudio = nbSamples * ((Real) m_audioSampleRate / (Real) m_channelSampleRate);
|
unsigned int nbSamplesAudio = (nbSamples * (unsigned int) ((Real) m_audioSampleRate / (Real) m_channelSampleRate));
|
||||||
pullAudio(nbSamplesAudio);
|
pullAudio(nbSamplesAudio);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,7 +143,9 @@ void NFMModSource::pullAudio(unsigned int nbSamplesAudio)
|
|||||||
|
|
||||||
void NFMModSource::modulateSample()
|
void NFMModSource::modulateSample()
|
||||||
{
|
{
|
||||||
Real t0, t1, t;
|
Real t0 = 0.0f;
|
||||||
|
Real t1 = 0.0f;
|
||||||
|
Real t = 0.0f;
|
||||||
|
|
||||||
pullAF(t0);
|
pullAF(t0);
|
||||||
|
|
||||||
@ -173,24 +164,24 @@ void NFMModSource::modulateSample()
|
|||||||
if (m_settings.m_ctcssOn) {
|
if (m_settings.m_ctcssOn) {
|
||||||
t1 = 0.85f * m_bandpass.filter(t) + 0.15f * 0.625f * m_ctcssNco.next();
|
t1 = 0.85f * m_bandpass.filter(t) + 0.15f * 0.625f * m_ctcssNco.next();
|
||||||
} else if (m_settings.m_dcsOn) {
|
} else if (m_settings.m_dcsOn) {
|
||||||
t1 = 0.9f * m_bandpass.filter(t) + 0.1f * 0.625f * m_dcsMod.next();
|
t1 = 0.9f * m_bandpass.filter(t) + 0.1f * 0.625f * (float) m_dcsMod.next();
|
||||||
} else if (m_settings.m_bpfOn) {
|
} else if (m_settings.m_bpfOn) {
|
||||||
t1 = m_bandpass.filter(t);
|
t1 = m_bandpass.filter(t);
|
||||||
} else {
|
} else {
|
||||||
t1 = m_lowpass.filter(t);
|
t1 = m_lowpass.filter(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_modPhasor += (M_PI * m_settings.m_fmDeviation / (float) m_audioSampleRate) * t1;
|
m_modPhasor += (float) ((M_PI * m_settings.m_fmDeviation / (float) m_audioSampleRate) * t1);
|
||||||
|
|
||||||
// limit phasor range to ]-pi,pi]
|
// limit phasor range to ]-pi,pi]
|
||||||
if (m_modPhasor > M_PI) {
|
if (m_modPhasor > M_PI) {
|
||||||
m_modPhasor -= (2.0f * M_PI);
|
m_modPhasor -= (float) (2.0 * M_PI);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_modSample.real(cos(m_modPhasor) * 0.891235351562f * SDR_TX_SCALEF); // -1 dB
|
m_modSample.real((float) (cos(m_modPhasor) * 0.891235351562f * SDR_TX_SCALEF)); // -1 dB
|
||||||
m_modSample.imag(sin(m_modPhasor) * 0.891235351562f * SDR_TX_SCALEF);
|
m_modSample.imag((float) (sin(m_modPhasor) * 0.891235351562f * SDR_TX_SCALEF));
|
||||||
|
|
||||||
m_demodBuffer[m_demodBufferFill] = t1 * std::numeric_limits<int16_t>::max();
|
m_demodBuffer[m_demodBufferFill] = (qint16) (t1 * std::numeric_limits<int16_t>::max());
|
||||||
++m_demodBufferFill;
|
++m_demodBufferFill;
|
||||||
|
|
||||||
if (m_demodBufferFill >= m_demodBuffer.size())
|
if (m_demodBufferFill >= m_demodBuffer.size())
|
||||||
@ -198,13 +189,11 @@ void NFMModSource::modulateSample()
|
|||||||
QList<ObjectPipe*> dataPipes;
|
QList<ObjectPipe*> dataPipes;
|
||||||
MainCore::instance()->getDataPipes().getDataPipes(m_channel, "demod", dataPipes);
|
MainCore::instance()->getDataPipes().getDataPipes(m_channel, "demod", dataPipes);
|
||||||
|
|
||||||
if (dataPipes.size() > 0)
|
if (!dataPipes.empty())
|
||||||
{
|
{
|
||||||
QList<ObjectPipe*>::iterator it = dataPipes.begin();
|
for (auto& dataPipe : dataPipes)
|
||||||
|
|
||||||
for (; it != dataPipes.end(); ++it)
|
|
||||||
{
|
{
|
||||||
DataFifo *fifo = qobject_cast<DataFifo*>((*it)->m_element);
|
DataFifo *fifo = qobject_cast<DataFifo*>(dataPipe->m_element);
|
||||||
|
|
||||||
if (fifo) {
|
if (fifo) {
|
||||||
fifo->write((quint8*) &m_demodBuffer[0], m_demodBuffer.size() * sizeof(qint16), DataFifo::DataTypeI16);
|
fifo->write((quint8*) &m_demodBuffer[0], m_demodBuffer.size() * sizeof(qint16), DataFifo::DataTypeI16);
|
||||||
@ -224,17 +213,12 @@ void NFMModSource::pullAF(Real& sample)
|
|||||||
sample = m_toneNco.next();
|
sample = m_toneNco.next();
|
||||||
break;
|
break;
|
||||||
case NFMModSettings::NFMModInputFile:
|
case NFMModSettings::NFMModInputFile:
|
||||||
// sox f4exb_call.wav --encoding float --endian little f4exb_call.raw
|
|
||||||
// ffplay -f f32le -ar 48k -ac 1 f4exb_call.raw
|
|
||||||
if (m_ifstream && m_ifstream->is_open())
|
if (m_ifstream && m_ifstream->is_open())
|
||||||
{
|
{
|
||||||
if (m_ifstream->eof())
|
if (m_ifstream->eof() && m_settings.m_playLoop)
|
||||||
{
|
{
|
||||||
if (m_settings.m_playLoop)
|
m_ifstream->clear();
|
||||||
{
|
m_ifstream->seekg(0, std::ios::beg);
|
||||||
m_ifstream->clear();
|
|
||||||
m_ifstream->seekg(0, std::ios::beg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_ifstream->eof())
|
if (m_ifstream->eof())
|
||||||
@ -269,8 +253,8 @@ void NFMModSource::pullAF(Real& sample)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned int size = m_audioBuffer.size();
|
std::size_t size = m_audioBuffer.size();
|
||||||
qDebug("NFMModSource::pullAF: starve audio samples: size: %u", size);
|
qDebug("NFMModSource::pullAF: starve audio samples: size: %lu", size);
|
||||||
sample = ((m_audioBuffer[size-1].l + m_audioBuffer[size-1].r) / 65536.0f) * m_settings.m_volumeFactor;
|
sample = ((m_audioBuffer[size-1].l + m_audioBuffer[size-1].r) / 65536.0f) * m_settings.m_volumeFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -300,7 +284,6 @@ void NFMModSource::pullAF(Real& sample)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NFMModSettings::NFMModInputNone:
|
|
||||||
default:
|
default:
|
||||||
sample = 0.0f;
|
sample = 0.0f;
|
||||||
break;
|
break;
|
||||||
@ -330,10 +313,10 @@ void NFMModSource::pushFeedback(Real sample)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NFMModSource::processOneSample(Complex& ci)
|
void NFMModSource::processOneSample(const Complex& ci)
|
||||||
{
|
{
|
||||||
m_feedbackAudioBuffer[m_feedbackAudioBufferFill].l = ci.real();
|
m_feedbackAudioBuffer[m_feedbackAudioBufferFill].l = (qint16) ci.real();
|
||||||
m_feedbackAudioBuffer[m_feedbackAudioBufferFill].r = ci.imag();
|
m_feedbackAudioBuffer[m_feedbackAudioBufferFill].r = (qint16) ci.imag();
|
||||||
++m_feedbackAudioBufferFill;
|
++m_feedbackAudioBufferFill;
|
||||||
|
|
||||||
if (m_feedbackAudioBufferFill >= m_feedbackAudioBuffer.size())
|
if (m_feedbackAudioBufferFill >= m_feedbackAudioBuffer.size())
|
||||||
@ -351,7 +334,7 @@ void NFMModSource::processOneSample(Complex& ci)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NFMModSource::calculateLevel(Real& sample)
|
void NFMModSource::calculateLevel(const Real& sample)
|
||||||
{
|
{
|
||||||
if (m_levelCalcCount < m_levelNbSamples)
|
if (m_levelCalcCount < m_levelNbSamples)
|
||||||
{
|
{
|
||||||
@ -385,8 +368,8 @@ void NFMModSource::applyAudioSampleRate(int sampleRate)
|
|||||||
m_interpolator.create(48, sampleRate, m_settings.m_rfBandwidth / 2.2, 3.0);
|
m_interpolator.create(48, sampleRate, m_settings.m_rfBandwidth / 2.2, 3.0);
|
||||||
m_lowpass.create(301, sampleRate, m_settings.m_afBandwidth);
|
m_lowpass.create(301, sampleRate, m_settings.m_afBandwidth);
|
||||||
m_bandpass.create(301, sampleRate, 300.0, m_settings.m_afBandwidth);
|
m_bandpass.create(301, sampleRate, 300.0, m_settings.m_afBandwidth);
|
||||||
m_toneNco.setFreq(m_settings.m_toneFrequency, sampleRate);
|
m_toneNco.setFreq(m_settings.m_toneFrequency, (float) sampleRate);
|
||||||
m_ctcssNco.setFreq(NFMModSettings::getCTCSSFreq(m_settings.m_ctcssIndex), sampleRate);
|
m_ctcssNco.setFreq(NFMModSettings::getCTCSSFreq(m_settings.m_ctcssIndex), (float) sampleRate);
|
||||||
m_dcsMod.setSampleRate(sampleRate);
|
m_dcsMod.setSampleRate(sampleRate);
|
||||||
|
|
||||||
if (m_cwKeyer)
|
if (m_cwKeyer)
|
||||||
@ -395,8 +378,8 @@ void NFMModSource::applyAudioSampleRate(int sampleRate)
|
|||||||
m_cwKeyer->reset();
|
m_cwKeyer->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_preemphasisFilter.configure(m_preemphasis*sampleRate);
|
m_preemphasisFilter.configure(m_preemphasis * (float) sampleRate);
|
||||||
m_audioCompressor.m_rate = sampleRate;
|
m_audioCompressor.m_rate = (float) sampleRate;
|
||||||
m_audioCompressor.initState();
|
m_audioCompressor.initState();
|
||||||
m_audioSampleRate = sampleRate;
|
m_audioSampleRate = sampleRate;
|
||||||
applyFeedbackAudioSampleRate(m_feedbackAudioSampleRate);
|
applyFeedbackAudioSampleRate(m_feedbackAudioSampleRate);
|
||||||
@ -404,7 +387,7 @@ void NFMModSource::applyAudioSampleRate(int sampleRate)
|
|||||||
QList<ObjectPipe*> pipes;
|
QList<ObjectPipe*> pipes;
|
||||||
MainCore::instance()->getMessagePipes().getMessagePipes(m_channel, "reportdemod", pipes);
|
MainCore::instance()->getMessagePipes().getMessagePipes(m_channel, "reportdemod", pipes);
|
||||||
|
|
||||||
if (pipes.size() > 0)
|
if (!pipes.empty())
|
||||||
{
|
{
|
||||||
for (const auto& pipe : pipes)
|
for (const auto& pipe : pipes)
|
||||||
{
|
{
|
||||||
@ -428,7 +411,7 @@ void NFMModSource::applyFeedbackAudioSampleRate(int sampleRate)
|
|||||||
m_feedbackInterpolatorDistanceRemain = 0;
|
m_feedbackInterpolatorDistanceRemain = 0;
|
||||||
m_feedbackInterpolatorConsumed = false;
|
m_feedbackInterpolatorConsumed = false;
|
||||||
m_feedbackInterpolatorDistance = (Real) sampleRate / (Real) m_audioSampleRate;
|
m_feedbackInterpolatorDistance = (Real) sampleRate / (Real) m_audioSampleRate;
|
||||||
Real cutoff = std::min(sampleRate, m_audioSampleRate) / 2.2f;
|
Real cutoff = (float) std::min(sampleRate, m_audioSampleRate) / 2.2f;
|
||||||
m_feedbackInterpolator.create(48, sampleRate, cutoff, 3.0);
|
m_feedbackInterpolator.create(48, sampleRate, cutoff, 3.0);
|
||||||
m_feedbackAudioSampleRate = sampleRate;
|
m_feedbackAudioSampleRate = sampleRate;
|
||||||
}
|
}
|
||||||
@ -444,11 +427,11 @@ void NFMModSource::applySettings(const NFMModSettings& settings, bool force)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((settings.m_toneFrequency != m_settings.m_toneFrequency) || force) {
|
if ((settings.m_toneFrequency != m_settings.m_toneFrequency) || force) {
|
||||||
m_toneNco.setFreq(settings.m_toneFrequency, m_audioSampleRate);
|
m_toneNco.setFreq(settings.m_toneFrequency, (float) m_audioSampleRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((settings.m_ctcssIndex != m_settings.m_ctcssIndex) || force) {
|
if ((settings.m_ctcssIndex != m_settings.m_ctcssIndex) || force) {
|
||||||
m_ctcssNco.setFreq(NFMModSettings::getCTCSSFreq(settings.m_ctcssIndex), m_audioSampleRate);
|
m_ctcssNco.setFreq(NFMModSettings::getCTCSSFreq(settings.m_ctcssIndex), (float) m_audioSampleRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((settings.m_dcsCode != m_settings.m_dcsCode) || force) {
|
if ((settings.m_dcsCode != m_settings.m_dcsCode) || force) {
|
||||||
@ -480,7 +463,7 @@ void NFMModSource::applyChannelSettings(int channelSampleRate, int channelFreque
|
|||||||
if ((channelFrequencyOffset != m_channelFrequencyOffset)
|
if ((channelFrequencyOffset != m_channelFrequencyOffset)
|
||||||
|| (channelSampleRate != m_channelSampleRate) || force)
|
|| (channelSampleRate != m_channelSampleRate) || force)
|
||||||
{
|
{
|
||||||
m_carrierNco.setFreq(channelFrequencyOffset, channelSampleRate);
|
m_carrierNco.setFreq((float) channelFrequencyOffset, (float) channelSampleRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((channelSampleRate != m_channelSampleRate) || force)
|
if ((channelSampleRate != m_channelSampleRate) || force)
|
||||||
@ -497,7 +480,6 @@ void NFMModSource::applyChannelSettings(int channelSampleRate, int channelFreque
|
|||||||
|
|
||||||
void NFMModSource::handleAudio()
|
void NFMModSource::handleAudio()
|
||||||
{
|
{
|
||||||
QMutexLocker mlock(&m_mutex);
|
|
||||||
unsigned int nbRead;
|
unsigned int nbRead;
|
||||||
|
|
||||||
while ((nbRead = m_audioFifo.read(reinterpret_cast<quint8*>(&m_audioReadBuffer[m_audioReadBufferFill]), 4096)) != 0)
|
while ((nbRead = m_audioFifo.read(reinterpret_cast<quint8*>(&m_audioReadBuffer[m_audioReadBufferFill]), 4096)) != 0)
|
||||||
|
@ -47,11 +47,11 @@ class NFMModSource : public QObject, public ChannelSampleSource
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
NFMModSource();
|
NFMModSource();
|
||||||
virtual ~NFMModSource();
|
~NFMModSource() final;
|
||||||
|
|
||||||
virtual void pull(SampleVector::iterator begin, unsigned int nbSamples);
|
void pull(SampleVector::iterator begin, unsigned int nbSamples) final;
|
||||||
virtual void pullOne(Sample& sample);
|
void pullOne(Sample& sample) final;
|
||||||
virtual void prefetch(unsigned int nbSamples);
|
void prefetch(unsigned int nbSamples) final;
|
||||||
|
|
||||||
void setInputFileStream(std::ifstream *ifstream) { m_ifstream = ifstream; }
|
void setInputFileStream(std::ifstream *ifstream) { m_ifstream = ifstream; }
|
||||||
AudioFifo *getAudioFifo() { return &m_audioFifo; }
|
AudioFifo *getAudioFifo() { return &m_audioFifo; }
|
||||||
@ -74,8 +74,8 @@ public:
|
|||||||
void applyChannelSettings(int channelSampleRate, int channelFrequencyOffset, bool force = false);
|
void applyChannelSettings(int channelSampleRate, int channelFrequencyOffset, bool force = false);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_channelSampleRate;
|
int m_channelSampleRate = 48000;
|
||||||
int m_channelFrequencyOffset;
|
int m_channelFrequencyOffset = 0;
|
||||||
NFMModSettings m_settings;
|
NFMModSettings m_settings;
|
||||||
ChannelAPI *m_channel;
|
ChannelAPI *m_channel;
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ private:
|
|||||||
NCOF m_toneNco;
|
NCOF m_toneNco;
|
||||||
NCOF m_ctcssNco;
|
NCOF m_ctcssNco;
|
||||||
NFMModDCS m_dcsMod;
|
NFMModDCS m_dcsMod;
|
||||||
float m_modPhasor; //!< baseband modulator phasor
|
float m_modPhasor = 0.0f; //!< baseband modulator phasor
|
||||||
Complex m_modSample;
|
Complex m_modSample;
|
||||||
|
|
||||||
Interpolator m_interpolator;
|
Interpolator m_interpolator;
|
||||||
@ -106,7 +106,7 @@ private:
|
|||||||
double m_magsq;
|
double m_magsq;
|
||||||
MovingAverageUtil<double, double, 16> m_movingAverage;
|
MovingAverageUtil<double, double, 16> m_movingAverage;
|
||||||
|
|
||||||
int m_audioSampleRate;
|
int m_audioSampleRate = 48000;
|
||||||
AudioVector m_audioBuffer;
|
AudioVector m_audioBuffer;
|
||||||
unsigned int m_audioBufferFill;
|
unsigned int m_audioBufferFill;
|
||||||
AudioVector m_audioReadBuffer;
|
AudioVector m_audioReadBuffer;
|
||||||
@ -118,14 +118,14 @@ private:
|
|||||||
uint m_feedbackAudioBufferFill;
|
uint m_feedbackAudioBufferFill;
|
||||||
AudioFifo m_feedbackAudioFifo;
|
AudioFifo m_feedbackAudioFifo;
|
||||||
|
|
||||||
quint32 m_levelCalcCount;
|
quint32 m_levelCalcCount = 0;
|
||||||
qreal m_rmsLevel;
|
qreal m_rmsLevel;
|
||||||
qreal m_peakLevelOut;
|
qreal m_peakLevelOut;
|
||||||
Real m_peakLevel;
|
Real m_peakLevel = 0.0f;
|
||||||
Real m_levelSum;
|
Real m_levelSum = 0.0f;
|
||||||
|
|
||||||
std::ifstream *m_ifstream;
|
std::ifstream *m_ifstream = nullptr;
|
||||||
CWKeyer *m_cwKeyer;
|
CWKeyer *m_cwKeyer = nullptr;
|
||||||
|
|
||||||
AudioCompressorSnd m_audioCompressor;
|
AudioCompressorSnd m_audioCompressor;
|
||||||
|
|
||||||
@ -134,11 +134,11 @@ private:
|
|||||||
static const int m_levelNbSamples;
|
static const int m_levelNbSamples;
|
||||||
static const float m_preemphasis;
|
static const float m_preemphasis;
|
||||||
|
|
||||||
void processOneSample(Complex& ci);
|
void processOneSample(const Complex& ci);
|
||||||
void pullAF(Real& sample);
|
void pullAF(Real& sample);
|
||||||
void pullAudio(unsigned int nbSamples);
|
void pullAudio(unsigned int nbSamples);
|
||||||
void pushFeedback(Real sample);
|
void pushFeedback(Real sample);
|
||||||
void calculateLevel(Real& sample);
|
void calculateLevel(const Real& sample);
|
||||||
void modulateSample();
|
void modulateSample();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -57,11 +57,7 @@ const char* const SSBMod::m_channelId = "SSBMod";
|
|||||||
SSBMod::SSBMod(DeviceAPI *deviceAPI) :
|
SSBMod::SSBMod(DeviceAPI *deviceAPI) :
|
||||||
ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSource),
|
ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSource),
|
||||||
m_deviceAPI(deviceAPI),
|
m_deviceAPI(deviceAPI),
|
||||||
m_running(false),
|
m_spectrumVis(SDR_TX_SCALEF)
|
||||||
m_spectrumVis(SDR_TX_SCALEF),
|
|
||||||
m_fileSize(0),
|
|
||||||
m_recordLength(0),
|
|
||||||
m_sampleRate(48000)
|
|
||||||
{
|
{
|
||||||
setObjectName(m_channelId);
|
setObjectName(m_channelId);
|
||||||
applySettings(m_settings, true);
|
applySettings(m_settings, true);
|
||||||
@ -90,7 +86,7 @@ SSBMod::~SSBMod()
|
|||||||
m_deviceAPI->removeChannelSourceAPI(this);
|
m_deviceAPI->removeChannelSourceAPI(this);
|
||||||
m_deviceAPI->removeChannelSource(this);
|
m_deviceAPI->removeChannelSource(this);
|
||||||
|
|
||||||
stop();
|
SSBMod::stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SSBMod::setDeviceAPI(DeviceAPI *deviceAPI)
|
void SSBMod::setDeviceAPI(DeviceAPI *deviceAPI)
|
||||||
@ -182,7 +178,7 @@ bool SSBMod::handleMessage(const Message& cmd)
|
|||||||
{
|
{
|
||||||
if (MsgConfigureSSBMod::match(cmd))
|
if (MsgConfigureSSBMod::match(cmd))
|
||||||
{
|
{
|
||||||
MsgConfigureSSBMod& cfg = (MsgConfigureSSBMod&) cmd;
|
auto& cfg = (const MsgConfigureSSBMod&) cmd;
|
||||||
qDebug() << "SSBMod::handleMessage: MsgConfigureSSBMod";
|
qDebug() << "SSBMod::handleMessage: MsgConfigureSSBMod";
|
||||||
|
|
||||||
applySettings(cfg.getSettings(), cfg.getForce());
|
applySettings(cfg.getSettings(), cfg.getForce());
|
||||||
@ -191,14 +187,14 @@ bool SSBMod::handleMessage(const Message& cmd)
|
|||||||
}
|
}
|
||||||
else if (MsgConfigureFileSourceName::match(cmd))
|
else if (MsgConfigureFileSourceName::match(cmd))
|
||||||
{
|
{
|
||||||
MsgConfigureFileSourceName& conf = (MsgConfigureFileSourceName&) cmd;
|
auto& conf = (const MsgConfigureFileSourceName&) cmd;
|
||||||
m_fileName = conf.getFileName();
|
m_fileName = conf.getFileName();
|
||||||
openFileStream();
|
openFileStream();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (MsgConfigureFileSourceSeek::match(cmd))
|
else if (MsgConfigureFileSourceSeek::match(cmd))
|
||||||
{
|
{
|
||||||
MsgConfigureFileSourceSeek& conf = (MsgConfigureFileSourceSeek&) cmd;
|
auto& conf = (const MsgConfigureFileSourceSeek&) cmd;
|
||||||
int seekPercentage = conf.getPercentage();
|
int seekPercentage = conf.getPercentage();
|
||||||
seekFileStream(seekPercentage);
|
seekFileStream(seekPercentage);
|
||||||
|
|
||||||
@ -206,18 +202,17 @@ bool SSBMod::handleMessage(const Message& cmd)
|
|||||||
}
|
}
|
||||||
else if (MsgConfigureFileSourceStreamTiming::match(cmd))
|
else if (MsgConfigureFileSourceStreamTiming::match(cmd))
|
||||||
{
|
{
|
||||||
std::size_t samplesCount;
|
std::size_t samplesCount;
|
||||||
|
|
||||||
if (m_ifstream.eof()) {
|
if (m_ifstream.eof()) {
|
||||||
samplesCount = m_fileSize / sizeof(Real);
|
samplesCount = m_fileSize / sizeof(Real);
|
||||||
} else {
|
} else {
|
||||||
samplesCount = m_ifstream.tellg() / sizeof(Real);
|
samplesCount = m_ifstream.tellg() / sizeof(Real);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMessageQueueToGUI())
|
if (getMessageQueueToGUI())
|
||||||
{
|
{
|
||||||
MsgReportFileSourceStreamTiming *report;
|
auto *report = MsgReportFileSourceStreamTiming::create(samplesCount);
|
||||||
report = MsgReportFileSourceStreamTiming::create(samplesCount);
|
|
||||||
getMessageQueueToGUI()->push(report);
|
getMessageQueueToGUI()->push(report);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,7 +220,7 @@ bool SSBMod::handleMessage(const Message& cmd)
|
|||||||
}
|
}
|
||||||
else if (CWKeyer::MsgConfigureCWKeyer::match(cmd))
|
else if (CWKeyer::MsgConfigureCWKeyer::match(cmd))
|
||||||
{
|
{
|
||||||
const CWKeyer::MsgConfigureCWKeyer& cfg = (CWKeyer::MsgConfigureCWKeyer&) cmd;
|
auto& cfg = (const CWKeyer::MsgConfigureCWKeyer&) cmd;
|
||||||
|
|
||||||
if (m_settings.m_useReverseAPI) {
|
if (m_settings.m_useReverseAPI) {
|
||||||
webapiReverseSendCWSettings(cfg.getSettings());
|
webapiReverseSendCWSettings(cfg.getSettings());
|
||||||
@ -235,11 +230,11 @@ bool SSBMod::handleMessage(const Message& cmd)
|
|||||||
}
|
}
|
||||||
else if (DSPSignalNotification::match(cmd))
|
else if (DSPSignalNotification::match(cmd))
|
||||||
{
|
{
|
||||||
DSPSignalNotification& notif = (DSPSignalNotification&) cmd;
|
auto& notif = (const DSPSignalNotification&) cmd;
|
||||||
// Forward to the source
|
// Forward to the source
|
||||||
if (m_running)
|
if (m_running)
|
||||||
{
|
{
|
||||||
DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy
|
auto* rep = new DSPSignalNotification(notif); // make a copy
|
||||||
qDebug() << "SSBMod::handleMessage: DSPSignalNotification";
|
qDebug() << "SSBMod::handleMessage: DSPSignalNotification";
|
||||||
m_basebandSource->getInputMessageQueue()->push(rep);
|
m_basebandSource->getInputMessageQueue()->push(rep);
|
||||||
}
|
}
|
||||||
@ -274,7 +269,7 @@ void SSBMod::openFileStream()
|
|||||||
m_ifstream.seekg(0,std::ios_base::beg);
|
m_ifstream.seekg(0,std::ios_base::beg);
|
||||||
|
|
||||||
m_sampleRate = 48000; // fixed rate
|
m_sampleRate = 48000; // fixed rate
|
||||||
m_recordLength = m_fileSize / (sizeof(Real) * m_sampleRate);
|
m_recordLength = (quint32) (m_fileSize / (sizeof(Real) * m_sampleRate));
|
||||||
|
|
||||||
qDebug() << "SSBMod::openFileStream: " << m_fileName.toStdString().c_str()
|
qDebug() << "SSBMod::openFileStream: " << m_fileName.toStdString().c_str()
|
||||||
<< " fileSize: " << m_fileSize << "bytes"
|
<< " fileSize: " << m_fileSize << "bytes"
|
||||||
@ -416,7 +411,7 @@ void SSBMod::applySettings(const SSBModSettings& settings, bool force)
|
|||||||
QList<ObjectPipe*> pipes;
|
QList<ObjectPipe*> pipes;
|
||||||
MainCore::instance()->getMessagePipes().getMessagePipes(this, "settings", pipes);
|
MainCore::instance()->getMessagePipes().getMessagePipes(this, "settings", pipes);
|
||||||
|
|
||||||
if (pipes.size() > 0) {
|
if (!pipes.empty()) {
|
||||||
sendChannelSettings(pipes, reverseAPIKeys, settings, force);
|
sendChannelSettings(pipes, reverseAPIKeys, settings, force);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,12 +443,12 @@ bool SSBMod::deserialize(const QByteArray& data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SSBMod::sendSampleRateToDemodAnalyzer()
|
void SSBMod::sendSampleRateToDemodAnalyzer() const
|
||||||
{
|
{
|
||||||
QList<ObjectPipe*> pipes;
|
QList<ObjectPipe*> pipes;
|
||||||
MainCore::instance()->getMessagePipes().getMessagePipes(this, "reportdemod", pipes);
|
MainCore::instance()->getMessagePipes().getMessagePipes(this, "reportdemod", pipes);
|
||||||
|
|
||||||
if (pipes.size() > 0)
|
if (!pipes.empty())
|
||||||
{
|
{
|
||||||
for (const auto& pipe : pipes)
|
for (const auto& pipe : pipes)
|
||||||
{
|
{
|
||||||
@ -604,13 +599,13 @@ void SSBMod::webapiUpdateChannelSettings(
|
|||||||
settings.m_reverseAPIAddress = *response.getSsbModSettings()->getReverseApiAddress();
|
settings.m_reverseAPIAddress = *response.getSsbModSettings()->getReverseApiAddress();
|
||||||
}
|
}
|
||||||
if (channelSettingsKeys.contains("reverseAPIPort")) {
|
if (channelSettingsKeys.contains("reverseAPIPort")) {
|
||||||
settings.m_reverseAPIPort = response.getSsbModSettings()->getReverseApiPort();
|
settings.m_reverseAPIPort = (uint16_t) response.getSsbModSettings()->getReverseApiPort();
|
||||||
}
|
}
|
||||||
if (channelSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
if (channelSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||||
settings.m_reverseAPIDeviceIndex = response.getSsbModSettings()->getReverseApiDeviceIndex();
|
settings.m_reverseAPIDeviceIndex = (uint16_t) response.getSsbModSettings()->getReverseApiDeviceIndex();
|
||||||
}
|
}
|
||||||
if (channelSettingsKeys.contains("reverseAPIChannelIndex")) {
|
if (channelSettingsKeys.contains("reverseAPIChannelIndex")) {
|
||||||
settings.m_reverseAPIChannelIndex = response.getSsbModSettings()->getReverseApiChannelIndex();
|
settings.m_reverseAPIChannelIndex = (uint16_t) response.getSsbModSettings()->getReverseApiChannelIndex();
|
||||||
}
|
}
|
||||||
if (settings.m_spectrumGUI && channelSettingsKeys.contains("spectrumConfig")) {
|
if (settings.m_spectrumGUI && channelSettingsKeys.contains("spectrumConfig")) {
|
||||||
settings.m_spectrumGUI->updateFrom(channelSettingsKeys, response.getSsbModSettings()->getSpectrumConfig());
|
settings.m_spectrumGUI->updateFrom(channelSettingsKeys, response.getSsbModSettings()->getSpectrumConfig());
|
||||||
@ -691,7 +686,7 @@ void SSBMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respon
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGGLSpectrum *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum();
|
auto *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum();
|
||||||
settings.m_spectrumGUI->formatTo(swgGLSpectrum);
|
settings.m_spectrumGUI->formatTo(swgGLSpectrum);
|
||||||
response.getSsbModSettings()->setSpectrumConfig(swgGLSpectrum);
|
response.getSsbModSettings()->setSpectrumConfig(swgGLSpectrum);
|
||||||
}
|
}
|
||||||
@ -705,7 +700,7 @@ void SSBMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respon
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGChannelMarker *swgChannelMarker = new SWGSDRangel::SWGChannelMarker();
|
auto *swgChannelMarker = new SWGSDRangel::SWGChannelMarker();
|
||||||
settings.m_channelMarker->formatTo(swgChannelMarker);
|
settings.m_channelMarker->formatTo(swgChannelMarker);
|
||||||
response.getSsbModSettings()->setChannelMarker(swgChannelMarker);
|
response.getSsbModSettings()->setChannelMarker(swgChannelMarker);
|
||||||
}
|
}
|
||||||
@ -719,16 +714,16 @@ void SSBMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respon
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGRollupState *swgRollupState = new SWGSDRangel::SWGRollupState();
|
auto *swgRollupState = new SWGSDRangel::SWGRollupState();
|
||||||
settings.m_rollupState->formatTo(swgRollupState);
|
settings.m_rollupState->formatTo(swgRollupState);
|
||||||
response.getSsbModSettings()->setRollupState(swgRollupState);
|
response.getSsbModSettings()->setRollupState(swgRollupState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SSBMod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response)
|
void SSBMod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response) const
|
||||||
{
|
{
|
||||||
response.getSsbModReport()->setChannelPowerDb(CalcDb::dbPower(getMagSq()));
|
response.getSsbModReport()->setChannelPowerDb((float) CalcDb::dbPower(getMagSq()));
|
||||||
|
|
||||||
if (m_running)
|
if (m_running)
|
||||||
{
|
{
|
||||||
@ -737,9 +732,9 @@ void SSBMod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SSBMod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const SSBModSettings& settings, bool force)
|
void SSBMod::webapiReverseSendSettings(const QList<QString>& channelSettingsKeys, const SSBModSettings& settings, bool force)
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGChannelSettings *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
|
auto *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
|
||||||
webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force);
|
webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force);
|
||||||
|
|
||||||
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
|
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
|
||||||
@ -750,8 +745,8 @@ void SSBMod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, cons
|
|||||||
m_networkRequest.setUrl(QUrl(channelSettingsURL));
|
m_networkRequest.setUrl(QUrl(channelSettingsURL));
|
||||||
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||||
|
|
||||||
QBuffer *buffer = new QBuffer();
|
auto *buffer = new QBuffer();
|
||||||
buffer->open((QBuffer::ReadWrite));
|
buffer->open(QBuffer::ReadWrite);
|
||||||
buffer->write(swgChannelSettings->asJson().toUtf8());
|
buffer->write(swgChannelSettings->asJson().toUtf8());
|
||||||
buffer->seek(0);
|
buffer->seek(0);
|
||||||
|
|
||||||
@ -764,7 +759,7 @@ void SSBMod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, cons
|
|||||||
|
|
||||||
void SSBMod::webapiReverseSendCWSettings(const CWKeyerSettings& cwKeyerSettings)
|
void SSBMod::webapiReverseSendCWSettings(const CWKeyerSettings& cwKeyerSettings)
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGChannelSettings *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
|
auto *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
|
||||||
swgChannelSettings->setDirection(1); // single source (Tx)
|
swgChannelSettings->setDirection(1); // single source (Tx)
|
||||||
swgChannelSettings->setChannelType(new QString("SSBMod"));
|
swgChannelSettings->setChannelType(new QString("SSBMod"));
|
||||||
swgChannelSettings->setSsbModSettings(new SWGSDRangel::SWGSSBModSettings());
|
swgChannelSettings->setSsbModSettings(new SWGSDRangel::SWGSSBModSettings());
|
||||||
@ -772,7 +767,7 @@ void SSBMod::webapiReverseSendCWSettings(const CWKeyerSettings& cwKeyerSettings)
|
|||||||
|
|
||||||
swgSSBModSettings->setCwKeyer(new SWGSDRangel::SWGCWKeyerSettings());
|
swgSSBModSettings->setCwKeyer(new SWGSDRangel::SWGCWKeyerSettings());
|
||||||
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = swgSSBModSettings->getCwKeyer();
|
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = swgSSBModSettings->getCwKeyer();
|
||||||
m_cwKeyer.webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
|
CWKeyer::webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
|
||||||
|
|
||||||
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
|
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
|
||||||
.arg(m_settings.m_reverseAPIAddress)
|
.arg(m_settings.m_reverseAPIAddress)
|
||||||
@ -782,8 +777,8 @@ void SSBMod::webapiReverseSendCWSettings(const CWKeyerSettings& cwKeyerSettings)
|
|||||||
m_networkRequest.setUrl(QUrl(channelSettingsURL));
|
m_networkRequest.setUrl(QUrl(channelSettingsURL));
|
||||||
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||||
|
|
||||||
QBuffer *buffer = new QBuffer();
|
auto *buffer = new QBuffer();
|
||||||
buffer->open((QBuffer::ReadWrite));
|
buffer->open(QBuffer::ReadWrite);
|
||||||
buffer->write(swgChannelSettings->asJson().toUtf8());
|
buffer->write(swgChannelSettings->asJson().toUtf8());
|
||||||
buffer->seek(0);
|
buffer->seek(0);
|
||||||
|
|
||||||
@ -796,9 +791,9 @@ void SSBMod::webapiReverseSendCWSettings(const CWKeyerSettings& cwKeyerSettings)
|
|||||||
|
|
||||||
void SSBMod::sendChannelSettings(
|
void SSBMod::sendChannelSettings(
|
||||||
const QList<ObjectPipe*>& pipes,
|
const QList<ObjectPipe*>& pipes,
|
||||||
QList<QString>& channelSettingsKeys,
|
const QList<QString>& channelSettingsKeys,
|
||||||
const SSBModSettings& settings,
|
const SSBModSettings& settings,
|
||||||
bool force)
|
bool force) const
|
||||||
{
|
{
|
||||||
for (const auto& pipe : pipes)
|
for (const auto& pipe : pipes)
|
||||||
{
|
{
|
||||||
@ -806,7 +801,7 @@ void SSBMod::sendChannelSettings(
|
|||||||
|
|
||||||
if (messageQueue)
|
if (messageQueue)
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGChannelSettings *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
|
auto *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
|
||||||
webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force);
|
webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force);
|
||||||
MainCore::MsgChannelSettings *msg = MainCore::MsgChannelSettings::create(
|
MainCore::MsgChannelSettings *msg = MainCore::MsgChannelSettings::create(
|
||||||
this,
|
this,
|
||||||
@ -820,11 +815,11 @@ void SSBMod::sendChannelSettings(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SSBMod::webapiFormatChannelSettings(
|
void SSBMod::webapiFormatChannelSettings(
|
||||||
QList<QString>& channelSettingsKeys,
|
const QList<QString>& channelSettingsKeys,
|
||||||
SWGSDRangel::SWGChannelSettings *swgChannelSettings,
|
SWGSDRangel::SWGChannelSettings *swgChannelSettings,
|
||||||
const SSBModSettings& settings,
|
const SSBModSettings& settings,
|
||||||
bool force
|
bool force
|
||||||
)
|
) const
|
||||||
{
|
{
|
||||||
swgChannelSettings->setDirection(1); // single source (Tx)
|
swgChannelSettings->setDirection(1); // single source (Tx)
|
||||||
swgChannelSettings->setOriginatorChannelIndex(getIndexInDeviceSet());
|
swgChannelSettings->setOriginatorChannelIndex(getIndexInDeviceSet());
|
||||||
@ -898,21 +893,21 @@ void SSBMod::webapiFormatChannelSettings(
|
|||||||
|
|
||||||
if (settings.m_spectrumGUI && (channelSettingsKeys.contains("spectrunConfig") || force))
|
if (settings.m_spectrumGUI && (channelSettingsKeys.contains("spectrunConfig") || force))
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGGLSpectrum *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum();
|
auto *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum();
|
||||||
settings.m_spectrumGUI->formatTo(swgGLSpectrum);
|
settings.m_spectrumGUI->formatTo(swgGLSpectrum);
|
||||||
swgSSBModSettings->setSpectrumConfig(swgGLSpectrum);
|
swgSSBModSettings->setSpectrumConfig(swgGLSpectrum);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings.m_channelMarker && (channelSettingsKeys.contains("channelMarker") || force))
|
if (settings.m_channelMarker && (channelSettingsKeys.contains("channelMarker") || force))
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGChannelMarker *swgChannelMarker = new SWGSDRangel::SWGChannelMarker();
|
auto *swgChannelMarker = new SWGSDRangel::SWGChannelMarker();
|
||||||
settings.m_channelMarker->formatTo(swgChannelMarker);
|
settings.m_channelMarker->formatTo(swgChannelMarker);
|
||||||
swgSSBModSettings->setChannelMarker(swgChannelMarker);
|
swgSSBModSettings->setChannelMarker(swgChannelMarker);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings.m_rollupState && (channelSettingsKeys.contains("rollupState") || force))
|
if (settings.m_rollupState && (channelSettingsKeys.contains("rollupState") || force))
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGRollupState *swgRollupState = new SWGSDRangel::SWGRollupState();
|
auto *swgRollupState = new SWGSDRangel::SWGRollupState();
|
||||||
settings.m_rollupState->formatTo(swgRollupState);
|
settings.m_rollupState->formatTo(swgRollupState);
|
||||||
swgSSBModSettings->setRollupState(swgRollupState);
|
swgSSBModSettings->setRollupState(swgRollupState);
|
||||||
}
|
}
|
||||||
@ -922,11 +917,11 @@ void SSBMod::webapiFormatChannelSettings(
|
|||||||
const CWKeyerSettings& cwKeyerSettings = m_cwKeyer.getSettings();
|
const CWKeyerSettings& cwKeyerSettings = m_cwKeyer.getSettings();
|
||||||
swgSSBModSettings->setCwKeyer(new SWGSDRangel::SWGCWKeyerSettings());
|
swgSSBModSettings->setCwKeyer(new SWGSDRangel::SWGCWKeyerSettings());
|
||||||
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = swgSSBModSettings->getCwKeyer();
|
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = swgSSBModSettings->getCwKeyer();
|
||||||
m_cwKeyer.webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
|
CWKeyer::webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SSBMod::networkManagerFinished(QNetworkReply *reply)
|
void SSBMod::networkManagerFinished(QNetworkReply *reply) const
|
||||||
{
|
{
|
||||||
QNetworkReply::NetworkError replyError = reply->error();
|
QNetworkReply::NetworkError replyError = reply->error();
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
QString m_fileName;
|
QString m_fileName;
|
||||||
|
|
||||||
MsgConfigureFileSourceName(const QString& fileName) :
|
explicit MsgConfigureFileSourceName(const QString& fileName) :
|
||||||
Message(),
|
Message(),
|
||||||
m_fileName(fileName)
|
m_fileName(fileName)
|
||||||
{ }
|
{ }
|
||||||
@ -101,10 +101,10 @@ public:
|
|||||||
return new MsgConfigureFileSourceSeek(seekPercentage);
|
return new MsgConfigureFileSourceSeek(seekPercentage);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
int m_seekPercentage; //!< percentage of seek position from the beginning 0..100
|
int m_seekPercentage; //!< percentage of seek position from the beginning 0..100
|
||||||
|
|
||||||
MsgConfigureFileSourceSeek(int seekPercentage) :
|
explicit MsgConfigureFileSourceSeek(int seekPercentage) :
|
||||||
Message(),
|
Message(),
|
||||||
m_seekPercentage(seekPercentage)
|
m_seekPercentage(seekPercentage)
|
||||||
{ }
|
{ }
|
||||||
@ -139,10 +139,10 @@ public:
|
|||||||
return new MsgReportFileSourceStreamTiming(samplesCount);
|
return new MsgReportFileSourceStreamTiming(samplesCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
std::size_t m_samplesCount;
|
std::size_t m_samplesCount;
|
||||||
|
|
||||||
MsgReportFileSourceStreamTiming(std::size_t samplesCount) :
|
explicit MsgReportFileSourceStreamTiming(std::size_t samplesCount) :
|
||||||
Message(),
|
Message(),
|
||||||
m_samplesCount(samplesCount)
|
m_samplesCount(samplesCount)
|
||||||
{ }
|
{ }
|
||||||
@ -161,7 +161,7 @@ public:
|
|||||||
return new MsgReportFileSourceStreamData(sampleRate, recordLength);
|
return new MsgReportFileSourceStreamData(sampleRate, recordLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
int m_sampleRate;
|
int m_sampleRate;
|
||||||
quint32 m_recordLength;
|
quint32 m_recordLength;
|
||||||
|
|
||||||
@ -175,55 +175,55 @@ public:
|
|||||||
|
|
||||||
//=================================================================
|
//=================================================================
|
||||||
|
|
||||||
SSBMod(DeviceAPI *deviceAPI);
|
explicit SSBMod(DeviceAPI *deviceAPI);
|
||||||
virtual ~SSBMod();
|
~SSBMod() final;
|
||||||
virtual void destroy() { delete this; }
|
void destroy() final { delete this; }
|
||||||
virtual void setDeviceAPI(DeviceAPI *deviceAPI);
|
void setDeviceAPI(DeviceAPI *deviceAPI) final;
|
||||||
virtual DeviceAPI *getDeviceAPI() { return m_deviceAPI; }
|
DeviceAPI *getDeviceAPI() final { return m_deviceAPI; }
|
||||||
|
|
||||||
virtual void start();
|
void start() final;
|
||||||
virtual void stop();
|
void stop() final;
|
||||||
virtual void pull(SampleVector::iterator& begin, unsigned int nbSamples);
|
void pull(SampleVector::iterator& begin, unsigned int nbSamples) final;
|
||||||
virtual void pushMessage(Message *msg) { m_inputMessageQueue.push(msg); }
|
void pushMessage(Message *msg) final { m_inputMessageQueue.push(msg); }
|
||||||
virtual QString getSourceName() { return objectName(); }
|
QString getSourceName() final { return objectName(); }
|
||||||
|
|
||||||
virtual void getIdentifier(QString& id) { id = objectName(); }
|
void getIdentifier(QString& id) final { id = objectName(); }
|
||||||
virtual QString getIdentifier() const { return objectName(); }
|
QString getIdentifier() const final { return objectName(); }
|
||||||
virtual void getTitle(QString& title) { title = m_settings.m_title; }
|
void getTitle(QString& title) final { title = m_settings.m_title; }
|
||||||
virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; }
|
qint64 getCenterFrequency() const final { return m_settings.m_inputFrequencyOffset; }
|
||||||
virtual void setCenterFrequency(qint64 frequency);
|
void setCenterFrequency(qint64 frequency) final;
|
||||||
|
|
||||||
virtual QByteArray serialize() const;
|
QByteArray serialize() const final;
|
||||||
virtual bool deserialize(const QByteArray& data);
|
bool deserialize(const QByteArray& data) final;
|
||||||
|
|
||||||
virtual int getNbSinkStreams() const { return 1; }
|
int getNbSinkStreams() const final { return 1; }
|
||||||
virtual int getNbSourceStreams() const { return 0; }
|
int getNbSourceStreams() const final { return 0; }
|
||||||
virtual int getStreamIndex() const { return m_settings.m_streamIndex; }
|
int getStreamIndex() const final { return m_settings.m_streamIndex; }
|
||||||
|
|
||||||
virtual qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const
|
qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const final
|
||||||
{
|
{
|
||||||
(void) streamIndex;
|
(void) streamIndex;
|
||||||
(void) sinkElseSource;
|
(void) sinkElseSource;
|
||||||
return m_settings.m_inputFrequencyOffset;
|
return m_settings.m_inputFrequencyOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int webapiSettingsGet(
|
int webapiSettingsGet(
|
||||||
SWGSDRangel::SWGChannelSettings& response,
|
SWGSDRangel::SWGChannelSettings& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage) final;
|
||||||
|
|
||||||
virtual int webapiWorkspaceGet(
|
int webapiWorkspaceGet(
|
||||||
SWGSDRangel::SWGWorkspaceInfo& response,
|
SWGSDRangel::SWGWorkspaceInfo& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage) final;
|
||||||
|
|
||||||
virtual int webapiSettingsPutPatch(
|
int webapiSettingsPutPatch(
|
||||||
bool force,
|
bool force,
|
||||||
const QStringList& channelSettingsKeys,
|
const QStringList& channelSettingsKeys,
|
||||||
SWGSDRangel::SWGChannelSettings& response,
|
SWGSDRangel::SWGChannelSettings& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage) final;
|
||||||
|
|
||||||
virtual int webapiReportGet(
|
int webapiReportGet(
|
||||||
SWGSDRangel::SWGChannelReport& response,
|
SWGSDRangel::SWGChannelReport& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage) final;
|
||||||
|
|
||||||
static void webapiFormatChannelSettings(
|
static void webapiFormatChannelSettings(
|
||||||
SWGSDRangel::SWGChannelSettings& response,
|
SWGSDRangel::SWGChannelSettings& response,
|
||||||
@ -253,7 +253,7 @@ private:
|
|||||||
|
|
||||||
DeviceAPI* m_deviceAPI;
|
DeviceAPI* m_deviceAPI;
|
||||||
QThread *m_thread;
|
QThread *m_thread;
|
||||||
bool m_running;
|
bool m_running = false;
|
||||||
SSBModBaseband* m_basebandSource;
|
SSBModBaseband* m_basebandSource;
|
||||||
SSBModSettings m_settings;
|
SSBModSettings m_settings;
|
||||||
SpectrumVis m_spectrumVis;
|
SpectrumVis m_spectrumVis;
|
||||||
@ -263,38 +263,38 @@ private:
|
|||||||
|
|
||||||
std::ifstream m_ifstream;
|
std::ifstream m_ifstream;
|
||||||
QString m_fileName;
|
QString m_fileName;
|
||||||
quint64 m_fileSize; //!< raw file size (bytes)
|
quint64 m_fileSize = 0; //!< raw file size (bytes)
|
||||||
quint32 m_recordLength; //!< record length in seconds computed from file size
|
quint32 m_recordLength = 0; //!< record length in seconds computed from file size
|
||||||
int m_sampleRate;
|
int m_sampleRate = 48000;
|
||||||
|
|
||||||
QNetworkAccessManager *m_networkManager;
|
QNetworkAccessManager *m_networkManager;
|
||||||
QNetworkRequest m_networkRequest;
|
QNetworkRequest m_networkRequest;
|
||||||
CWKeyer m_cwKeyer;
|
CWKeyer m_cwKeyer;
|
||||||
QObject *m_levelMeter;
|
QObject *m_levelMeter;
|
||||||
|
|
||||||
virtual bool handleMessage(const Message& cmd);
|
bool handleMessage(const Message& cmd) final;
|
||||||
void applySettings(const SSBModSettings& settings, bool force = false);
|
void applySettings(const SSBModSettings& settings, bool force = false);
|
||||||
void sendSampleRateToDemodAnalyzer();
|
void sendSampleRateToDemodAnalyzer() const;
|
||||||
void openFileStream();
|
void openFileStream();
|
||||||
void seekFileStream(int seekPercentage);
|
void seekFileStream(int seekPercentage);
|
||||||
void webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response);
|
void webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response) const;
|
||||||
void webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const SSBModSettings& settings, bool force);
|
void webapiReverseSendSettings(const QList<QString>& channelSettingsKeys, const SSBModSettings& settings, bool force);
|
||||||
void webapiReverseSendCWSettings(const CWKeyerSettings& settings);
|
void webapiReverseSendCWSettings(const CWKeyerSettings& settings);
|
||||||
void sendChannelSettings(
|
void sendChannelSettings(
|
||||||
const QList<ObjectPipe*>& pipes,
|
const QList<ObjectPipe*>& pipes,
|
||||||
QList<QString>& channelSettingsKeys,
|
const QList<QString>& channelSettingsKeys,
|
||||||
const SSBModSettings& settings,
|
const SSBModSettings& settings,
|
||||||
bool force
|
bool force
|
||||||
);
|
) const;
|
||||||
void webapiFormatChannelSettings(
|
void webapiFormatChannelSettings(
|
||||||
QList<QString>& channelSettingsKeys,
|
const QList<QString>& channelSettingsKeys,
|
||||||
SWGSDRangel::SWGChannelSettings *swgChannelSettings,
|
SWGSDRangel::SWGChannelSettings *swgChannelSettings,
|
||||||
const SSBModSettings& settings,
|
const SSBModSettings& settings,
|
||||||
bool force
|
bool force
|
||||||
);
|
) const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void networkManagerFinished(QNetworkReply *reply);
|
void networkManagerFinished(QNetworkReply *reply) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,22 +30,13 @@ const int SSBModSource::m_ssbFftLen = 1024;
|
|||||||
const int SSBModSource::m_levelNbSamples = 480; // every 10ms
|
const int SSBModSource::m_levelNbSamples = 480; // every 10ms
|
||||||
|
|
||||||
SSBModSource::SSBModSource() :
|
SSBModSource::SSBModSource() :
|
||||||
m_channelSampleRate(48000),
|
|
||||||
m_channelFrequencyOffset(0),
|
|
||||||
m_spectrumSink(nullptr),
|
|
||||||
m_audioSampleRate(48000),
|
|
||||||
m_audioFifo(12000),
|
m_audioFifo(12000),
|
||||||
m_feedbackAudioFifo(12000),
|
m_feedbackAudioFifo(12000)
|
||||||
m_levelCalcCount(0),
|
|
||||||
m_peakLevel(0.0f),
|
|
||||||
m_levelSum(0.0f),
|
|
||||||
m_ifstream(nullptr),
|
|
||||||
m_cwKeyer(nullptr)
|
|
||||||
{
|
{
|
||||||
m_audioFifo.setLabel("SSBModSource.m_audioFifo");
|
m_audioFifo.setLabel("SSBModSource.m_audioFifo");
|
||||||
m_feedbackAudioFifo.setLabel("SSBModSource.m_feedbackAudioFifo");
|
m_feedbackAudioFifo.setLabel("SSBModSource.m_feedbackAudioFifo");
|
||||||
m_SSBFilter = new fftfilt(m_settings.m_lowCutoff / m_audioSampleRate, m_settings.m_bandwidth / m_audioSampleRate, m_ssbFftLen);
|
m_SSBFilter = new fftfilt(m_settings.m_lowCutoff / (float) m_audioSampleRate, m_settings.m_bandwidth / (float) m_audioSampleRate, m_ssbFftLen);
|
||||||
m_DSBFilter = new fftfilt((2.0f * m_settings.m_bandwidth) / m_audioSampleRate, 2 * m_ssbFftLen);
|
m_DSBFilter = new fftfilt((2.0f * m_settings.m_bandwidth) / (float) m_audioSampleRate, 2 * m_ssbFftLen);
|
||||||
m_SSBFilterBuffer = new Complex[m_ssbFftLen>>1]; // filter returns data exactly half of its size
|
m_SSBFilterBuffer = new Complex[m_ssbFftLen>>1]; // filter returns data exactly half of its size
|
||||||
m_DSBFilterBuffer = new Complex[m_ssbFftLen];
|
m_DSBFilterBuffer = new Complex[m_ssbFftLen];
|
||||||
std::fill(m_SSBFilterBuffer, m_SSBFilterBuffer+(m_ssbFftLen>>1), Complex{0,0});
|
std::fill(m_SSBFilterBuffer, m_SSBFilterBuffer+(m_ssbFftLen>>1), Complex{0,0});
|
||||||
@ -68,15 +59,15 @@ SSBModSource::SSBModSource() :
|
|||||||
m_sumCount = 0;
|
m_sumCount = 0;
|
||||||
|
|
||||||
m_magsq = 0.0;
|
m_magsq = 0.0;
|
||||||
m_toneNco.setFreq(1000.0, m_audioSampleRate);
|
m_toneNco.setFreq(1000.0, (float) m_audioSampleRate);
|
||||||
|
|
||||||
m_audioCompressor.initSimple(
|
m_audioCompressor.initSimple(
|
||||||
m_audioSampleRate,
|
m_audioSampleRate,
|
||||||
m_settings.m_cmpPreGainDB, // pregain (dB)
|
(float) m_settings.m_cmpPreGainDB, // pregain (dB)
|
||||||
m_settings.m_cmpThresholdDB, // threshold (dB)
|
(float) m_settings.m_cmpThresholdDB, // threshold (dB)
|
||||||
20, // knee (dB)
|
20, // knee (dB)
|
||||||
12, // ratio (dB)
|
12, // ratio (dB)
|
||||||
0.003, // attack (s)
|
0.003f,// attack (s)
|
||||||
0.25 // release (s)
|
0.25 // release (s)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -140,7 +131,7 @@ void SSBModSource::pullOne(Sample& sample)
|
|||||||
|
|
||||||
void SSBModSource::prefetch(unsigned int nbSamples)
|
void SSBModSource::prefetch(unsigned int nbSamples)
|
||||||
{
|
{
|
||||||
unsigned int nbSamplesAudio = nbSamples * ((Real) m_audioSampleRate / (Real) m_channelSampleRate);
|
unsigned int nbSamplesAudio = (nbSamples * (unsigned int) ((Real) m_audioSampleRate / (Real) m_channelSampleRate));
|
||||||
pullAudio(nbSamplesAudio);
|
pullAudio(nbSamplesAudio);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,13 +165,16 @@ void SSBModSource::modulateSample()
|
|||||||
|
|
||||||
if (m_settings.m_audioBinaural)
|
if (m_settings.m_audioBinaural)
|
||||||
{
|
{
|
||||||
m_demodBuffer[m_demodBufferFill++] = m_modSample.real() * std::numeric_limits<int16_t>::max();
|
m_demodBuffer[m_demodBufferFill] = (qint16) (m_modSample.real() * std::numeric_limits<int16_t>::max());
|
||||||
m_demodBuffer[m_demodBufferFill++] = m_modSample.imag() * std::numeric_limits<int16_t>::max();
|
m_demodBufferFill++;
|
||||||
|
m_demodBuffer[m_demodBufferFill] = (qint16) (m_modSample.imag() * std::numeric_limits<int16_t>::max());
|
||||||
|
m_demodBufferFill++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// take projection on real axis
|
// take projection on real axis
|
||||||
m_demodBuffer[m_demodBufferFill++] = m_modSample.real() * std::numeric_limits<int16_t>::max();
|
m_demodBuffer[m_demodBufferFill] = (qint16) (m_modSample.real() * std::numeric_limits<int16_t>::max());
|
||||||
|
m_demodBufferFill++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_demodBufferFill >= m_demodBuffer.size())
|
if (m_demodBufferFill >= m_demodBuffer.size())
|
||||||
@ -188,13 +182,11 @@ void SSBModSource::modulateSample()
|
|||||||
QList<ObjectPipe*> dataPipes;
|
QList<ObjectPipe*> dataPipes;
|
||||||
MainCore::instance()->getDataPipes().getDataPipes(m_channel, "demod", dataPipes);
|
MainCore::instance()->getDataPipes().getDataPipes(m_channel, "demod", dataPipes);
|
||||||
|
|
||||||
if (dataPipes.size() > 0)
|
if (!dataPipes.empty())
|
||||||
{
|
{
|
||||||
QList<ObjectPipe*>::iterator it = dataPipes.begin();
|
for (auto& dataPipe : dataPipes)
|
||||||
|
|
||||||
for (; it != dataPipes.end(); ++it)
|
|
||||||
{
|
{
|
||||||
DataFifo *fifo = qobject_cast<DataFifo*>((*it)->m_element);
|
DataFifo *fifo = qobject_cast<DataFifo*>(dataPipe->m_element);
|
||||||
|
|
||||||
if (fifo)
|
if (fifo)
|
||||||
{
|
{
|
||||||
@ -225,42 +217,33 @@ void SSBModSource::pullAF(Complex& sample)
|
|||||||
int n_out = 0;
|
int n_out = 0;
|
||||||
|
|
||||||
int decim = 1<<(m_settings.m_spanLog2 - 1);
|
int decim = 1<<(m_settings.m_spanLog2 - 1);
|
||||||
unsigned char decim_mask = decim - 1; // counter LSB bit mask for decimation by 2^(m_scaleLog2 - 1)
|
auto decim_mask = (unsigned char) ((decim - 1) & 0xFF); // counter LSB bit mask for decimation by 2^(m_scaleLog2 - 1)
|
||||||
|
|
||||||
switch (m_settings.m_modAFInput)
|
switch (m_settings.m_modAFInput)
|
||||||
{
|
{
|
||||||
case SSBModSettings::SSBModInputTone:
|
case SSBModSettings::SSBModInputTone:
|
||||||
if (m_settings.m_dsb)
|
if (m_settings.m_dsb)
|
||||||
{
|
{
|
||||||
Real t = m_toneNco.next()/1.25;
|
Real t = m_toneNco.next()/1.25f;
|
||||||
sample.real(t);
|
sample.real(t);
|
||||||
sample.imag(t);
|
sample.imag(t);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_settings.m_usb) {
|
if (m_settings.m_usb) {
|
||||||
sample = m_toneNco.nextIQ();
|
sample = m_toneNco.nextIQ();
|
||||||
} else {
|
} else {
|
||||||
sample = m_toneNco.nextQI();
|
sample = m_toneNco.nextQI();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SSBModSettings::SSBModInputFile:
|
case SSBModSettings::SSBModInputFile:
|
||||||
// Monaural (mono):
|
|
||||||
// sox f4exb_call.wav --encoding float --endian little f4exb_call.raw
|
|
||||||
// ffplay -f f32le -ar 48k -ac 1 f4exb_call.raw
|
|
||||||
// Binaural (stereo):
|
|
||||||
// sox f4exb_call.wav --encoding float --endian little f4exb_call.raw
|
|
||||||
// ffplay -f f32le -ar 48k -ac 2 f4exb_call.raw
|
|
||||||
if (m_ifstream && m_ifstream->is_open())
|
if (m_ifstream && m_ifstream->is_open())
|
||||||
{
|
{
|
||||||
if (m_ifstream->eof())
|
if (m_ifstream->eof() && m_settings.m_playLoop)
|
||||||
{
|
{
|
||||||
if (m_settings.m_playLoop)
|
m_ifstream->clear();
|
||||||
{
|
m_ifstream->seekg(0, std::ios::beg);
|
||||||
m_ifstream->clear();
|
|
||||||
m_ifstream->seekg(0, std::ios::beg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_ifstream->eof())
|
if (m_ifstream->eof())
|
||||||
@ -270,38 +253,38 @@ void SSBModSource::pullAF(Complex& sample)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_settings.m_audioBinaural)
|
if (m_settings.m_audioBinaural)
|
||||||
{
|
{
|
||||||
Complex c;
|
Complex c;
|
||||||
m_ifstream->read(reinterpret_cast<char*>(&c), sizeof(Complex));
|
m_ifstream->read(reinterpret_cast<char*>(&c), sizeof(Complex));
|
||||||
|
|
||||||
if (m_settings.m_audioFlipChannels)
|
if (m_settings.m_audioFlipChannels)
|
||||||
{
|
{
|
||||||
ci.real(c.imag() * m_settings.m_volumeFactor);
|
ci.real(c.imag() * m_settings.m_volumeFactor);
|
||||||
ci.imag(c.real() * m_settings.m_volumeFactor);
|
ci.imag(c.real() * m_settings.m_volumeFactor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ci = c * m_settings.m_volumeFactor;
|
ci = c * m_settings.m_volumeFactor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Real real;
|
Real real;
|
||||||
m_ifstream->read(reinterpret_cast<char*>(&real), sizeof(Real));
|
m_ifstream->read(reinterpret_cast<char*>(&real), sizeof(Real));
|
||||||
|
|
||||||
if (m_settings.m_agc)
|
if (m_settings.m_agc)
|
||||||
{
|
{
|
||||||
ci.real(clamp<float>(m_audioCompressor.compress(real), -1.0f, 1.0f));
|
ci.real(clamp<float>(m_audioCompressor.compress(real), -1.0f, 1.0f));
|
||||||
ci.imag(0.0f);
|
ci.imag(0.0f);
|
||||||
ci *= m_settings.m_volumeFactor;
|
ci *= m_settings.m_volumeFactor;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ci.real(real * m_settings.m_volumeFactor);
|
ci.real(real * m_settings.m_volumeFactor);
|
||||||
ci.imag(0.0f);
|
ci.imag(0.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -312,24 +295,24 @@ void SSBModSource::pullAF(Complex& sample)
|
|||||||
break;
|
break;
|
||||||
case SSBModSettings::SSBModInputAudio:
|
case SSBModSettings::SSBModInputAudio:
|
||||||
if (m_settings.m_audioBinaural)
|
if (m_settings.m_audioBinaural)
|
||||||
{
|
{
|
||||||
if (m_settings.m_audioFlipChannels)
|
if (m_settings.m_audioFlipChannels)
|
||||||
{
|
{
|
||||||
ci.real((m_audioBuffer[m_audioBufferFill].r / SDR_TX_SCALEF) * m_settings.m_volumeFactor);
|
ci.real((m_audioBuffer[m_audioBufferFill].r / SDR_TX_SCALEF) * m_settings.m_volumeFactor);
|
||||||
ci.imag((m_audioBuffer[m_audioBufferFill].l / SDR_TX_SCALEF) * m_settings.m_volumeFactor);
|
ci.imag((m_audioBuffer[m_audioBufferFill].l / SDR_TX_SCALEF) * m_settings.m_volumeFactor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ci.real((m_audioBuffer[m_audioBufferFill].l / SDR_TX_SCALEF) * m_settings.m_volumeFactor);
|
ci.real((m_audioBuffer[m_audioBufferFill].l / SDR_TX_SCALEF) * m_settings.m_volumeFactor);
|
||||||
ci.imag((m_audioBuffer[m_audioBufferFill].r / SDR_TX_SCALEF) * m_settings.m_volumeFactor);
|
ci.imag((m_audioBuffer[m_audioBufferFill].r / SDR_TX_SCALEF) * m_settings.m_volumeFactor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_settings.m_agc)
|
if (m_settings.m_agc)
|
||||||
{
|
{
|
||||||
float sample = (m_audioBuffer[m_audioBufferFill].l + m_audioBuffer[m_audioBufferFill].r) / 65536.0f;
|
float xsample = (m_audioBuffer[m_audioBufferFill].l + m_audioBuffer[m_audioBufferFill].r) / 65536.0f;
|
||||||
ci.real(clamp<float>(m_audioCompressor.compress(sample), -1.0f, 1.0f));
|
ci.real(clamp<float>(m_audioCompressor.compress(xsample), -1.0f, 1.0f));
|
||||||
ci.imag(0.0f);
|
ci.imag(0.0f);
|
||||||
ci *= m_settings.m_volumeFactor;
|
ci *= m_settings.m_volumeFactor;
|
||||||
}
|
}
|
||||||
@ -347,7 +330,7 @@ void SSBModSource::pullAF(Complex& sample)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug("SSBModSource::pullAF: starve audio samples: size: %lu", m_audioBuffer.size());
|
qDebug("SSBModSource::pullAF: starve audio samples: size: %lu", m_audioBuffer.size());
|
||||||
m_audioBufferFill = m_audioBuffer.size() - 1;
|
m_audioBufferFill = (unsigned int) (m_audioBuffer.size() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -356,56 +339,55 @@ void SSBModSource::pullAF(Complex& sample)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Real fadeFactor;
|
Real fadeFactor;
|
||||||
|
|
||||||
if (m_cwKeyer->getSample())
|
if (m_cwKeyer->getSample())
|
||||||
{
|
{
|
||||||
m_cwKeyer->getCWSmoother().getFadeSample(true, fadeFactor);
|
m_cwKeyer->getCWSmoother().getFadeSample(true, fadeFactor);
|
||||||
|
|
||||||
if (m_settings.m_dsb)
|
if (m_settings.m_dsb)
|
||||||
{
|
{
|
||||||
Real t = m_toneNco.next() * fadeFactor;
|
Real t = m_toneNco.next() * fadeFactor;
|
||||||
sample.real(t);
|
sample.real(t);
|
||||||
sample.imag(t);
|
sample.imag(t);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_settings.m_usb) {
|
if (m_settings.m_usb) {
|
||||||
sample = m_toneNco.nextIQ() * fadeFactor;
|
sample = m_toneNco.nextIQ() * fadeFactor;
|
||||||
} else {
|
} else {
|
||||||
sample = m_toneNco.nextQI() * fadeFactor;
|
sample = m_toneNco.nextQI() * fadeFactor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_cwKeyer->getCWSmoother().getFadeSample(false, fadeFactor))
|
if (m_cwKeyer->getCWSmoother().getFadeSample(false, fadeFactor))
|
||||||
{
|
{
|
||||||
if (m_settings.m_dsb)
|
if (m_settings.m_dsb)
|
||||||
{
|
{
|
||||||
Real t = (m_toneNco.next() * fadeFactor)/1.25;
|
Real t = (m_toneNco.next() * fadeFactor)/1.25f;
|
||||||
sample.real(t);
|
sample.real(t);
|
||||||
sample.imag(t);
|
sample.imag(t);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_settings.m_usb) {
|
if (m_settings.m_usb) {
|
||||||
sample = m_toneNco.nextIQ() * fadeFactor;
|
sample = m_toneNco.nextIQ() * fadeFactor;
|
||||||
} else {
|
} else {
|
||||||
sample = m_toneNco.nextQI() * fadeFactor;
|
sample = m_toneNco.nextQI() * fadeFactor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sample.real(0.0f);
|
sample.real(0.0f);
|
||||||
sample.imag(0.0f);
|
sample.imag(0.0f);
|
||||||
m_toneNco.setPhase(0);
|
m_toneNco.setPhase(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case SSBModSettings::SSBModInputNone:
|
|
||||||
default:
|
default:
|
||||||
sample.real(0.0f);
|
sample.real(0.0f);
|
||||||
sample.imag(0.0f);
|
sample.imag(0.0f);
|
||||||
@ -415,35 +397,35 @@ void SSBModSource::pullAF(Complex& sample)
|
|||||||
if ((m_settings.m_modAFInput == SSBModSettings::SSBModInputFile)
|
if ((m_settings.m_modAFInput == SSBModSettings::SSBModInputFile)
|
||||||
|| (m_settings.m_modAFInput == SSBModSettings::SSBModInputAudio)) // real audio
|
|| (m_settings.m_modAFInput == SSBModSettings::SSBModInputAudio)) // real audio
|
||||||
{
|
{
|
||||||
if (m_settings.m_dsb)
|
if (m_settings.m_dsb)
|
||||||
{
|
{
|
||||||
n_out = m_DSBFilter->runDSB(ci, &filtered);
|
n_out = m_DSBFilter->runDSB(ci, &filtered);
|
||||||
|
|
||||||
if (n_out > 0)
|
if (n_out > 0)
|
||||||
{
|
{
|
||||||
memcpy((void *) m_DSBFilterBuffer, (const void *) filtered, n_out*sizeof(Complex));
|
memcpy((void *) m_DSBFilterBuffer, (const void *) filtered, n_out*sizeof(Complex));
|
||||||
m_DSBFilterBufferIndex = 0;
|
m_DSBFilterBufferIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sample = m_DSBFilterBuffer[m_DSBFilterBufferIndex];
|
sample = m_DSBFilterBuffer[m_DSBFilterBufferIndex];
|
||||||
m_DSBFilterBufferIndex++;
|
m_DSBFilterBufferIndex++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
n_out = m_SSBFilter->runSSB(ci, &filtered, m_settings.m_usb);
|
n_out = m_SSBFilter->runSSB(ci, &filtered, m_settings.m_usb);
|
||||||
|
|
||||||
if (n_out > 0)
|
if (n_out > 0)
|
||||||
{
|
{
|
||||||
memcpy((void *) m_SSBFilterBuffer, (const void *) filtered, n_out*sizeof(Complex));
|
memcpy((void *) m_SSBFilterBuffer, (const void *) filtered, n_out*sizeof(Complex));
|
||||||
m_SSBFilterBufferIndex = 0;
|
m_SSBFilterBufferIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sample = m_SSBFilterBuffer[m_SSBFilterBufferIndex];
|
sample = m_SSBFilterBuffer[m_SSBFilterBufferIndex];
|
||||||
m_SSBFilterBufferIndex++;
|
m_SSBFilterBufferIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n_out > 0)
|
if (n_out > 0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < n_out; i++)
|
for (int i = 0; i < n_out; i++)
|
||||||
{
|
{
|
||||||
// Downsample by 2^(m_scaleLog2 - 1) for SSB band spectrum display
|
// Downsample by 2^(m_scaleLog2 - 1) for SSB band spectrum display
|
||||||
@ -453,23 +435,23 @@ void SSBModSource::pullAF(Complex& sample)
|
|||||||
|
|
||||||
if (!(m_undersampleCount++ & decim_mask))
|
if (!(m_undersampleCount++ & decim_mask))
|
||||||
{
|
{
|
||||||
Real avgr = (m_sum.real() / decim) * 0.891235351562f * SDR_TX_SCALEF; //scaling at -1 dB to account for possible filter overshoot
|
Real avgr = (m_sum.real() / (float) decim) * 0.891235351562f * SDR_TX_SCALEF; //scaling at -1 dB to account for possible filter overshoot
|
||||||
Real avgi = (m_sum.imag() / decim) * 0.891235351562f * SDR_TX_SCALEF;
|
Real avgi = (m_sum.imag() / (float) decim) * 0.891235351562f * SDR_TX_SCALEF;
|
||||||
|
|
||||||
if (!m_settings.m_dsb & !m_settings.m_usb)
|
if (!m_settings.m_dsb && !m_settings.m_usb)
|
||||||
{ // invert spectrum for LSB
|
{ // invert spectrum for LSB
|
||||||
m_sampleBuffer.push_back(Sample(avgi, avgr));
|
m_sampleBuffer.push_back(Sample((FixReal) avgi, (FixReal) avgr));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_sampleBuffer.push_back(Sample(avgr, avgi));
|
m_sampleBuffer.push_back(Sample((FixReal) avgr, (FixReal)avgi));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sum.real(0.0);
|
m_sum.real(0.0);
|
||||||
m_sum.imag(0.0);
|
m_sum.imag(0.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // Real audio
|
} // Real audio
|
||||||
else if ((m_settings.m_modAFInput == SSBModSettings::SSBModInputTone)
|
else if ((m_settings.m_modAFInput == SSBModSettings::SSBModInputTone)
|
||||||
|| (m_settings.m_modAFInput == SSBModSettings::SSBModInputCWTone)) // tone
|
|| (m_settings.m_modAFInput == SSBModSettings::SSBModInputCWTone)) // tone
|
||||||
@ -478,16 +460,16 @@ void SSBModSource::pullAF(Complex& sample)
|
|||||||
|
|
||||||
if (!(m_undersampleCount++ & decim_mask))
|
if (!(m_undersampleCount++ & decim_mask))
|
||||||
{
|
{
|
||||||
Real avgr = (m_sum.real() / decim) * 0.891235351562f * SDR_TX_SCALEF; //scaling at -1 dB to account for possible filter overshoot
|
Real avgr = (m_sum.real() / (float) decim) * 0.891235351562f * SDR_TX_SCALEF; //scaling at -1 dB to account for possible filter overshoot
|
||||||
Real avgi = (m_sum.imag() / decim) * 0.891235351562f * SDR_TX_SCALEF;
|
Real avgi = (m_sum.imag() / (float) decim) * 0.891235351562f * SDR_TX_SCALEF;
|
||||||
|
|
||||||
if (!m_settings.m_dsb & !m_settings.m_usb)
|
if (!m_settings.m_dsb && !m_settings.m_usb)
|
||||||
{ // invert spectrum for LSB
|
{ // invert spectrum for LSB
|
||||||
m_sampleBuffer.push_back(Sample(avgi, avgr));
|
m_sampleBuffer.push_back(Sample((FixReal) avgi, (FixReal) avgr));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_sampleBuffer.push_back(Sample(avgr, avgi));
|
m_sampleBuffer.push_back(Sample((FixReal) avgr, (FixReal) avgi));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sum.real(0.0);
|
m_sum.real(0.0);
|
||||||
@ -538,18 +520,18 @@ void SSBModSource::pushFeedback(Complex c)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SSBModSource::processOneSample(Complex& ci)
|
void SSBModSource::processOneSample(const Complex& ci)
|
||||||
{
|
{
|
||||||
if (m_settings.m_modAFInput == SSBModSettings::SSBModInputCWTone) // minimize latency for CW
|
if (m_settings.m_modAFInput == SSBModSettings::SSBModInputCWTone) // minimize latency for CW
|
||||||
{
|
{
|
||||||
m_feedbackAudioBuffer[0].l = ci.real();
|
m_feedbackAudioBuffer[0].l = (qint16) ci.real();
|
||||||
m_feedbackAudioBuffer[0].r = ci.imag();
|
m_feedbackAudioBuffer[0].r = (qint16) ci.imag();
|
||||||
m_feedbackAudioFifo.writeOne((const quint8*) &m_feedbackAudioBuffer[0]);
|
m_feedbackAudioFifo.writeOne((const quint8*) &m_feedbackAudioBuffer[0]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_feedbackAudioBuffer[m_feedbackAudioBufferFill].l = ci.real();
|
m_feedbackAudioBuffer[m_feedbackAudioBufferFill].l = (qint16) ci.real();
|
||||||
m_feedbackAudioBuffer[m_feedbackAudioBufferFill].r = ci.imag();
|
m_feedbackAudioBuffer[m_feedbackAudioBufferFill].r = (qint16) ci.imag();
|
||||||
++m_feedbackAudioBufferFill;
|
++m_feedbackAudioBufferFill;
|
||||||
|
|
||||||
if (m_feedbackAudioBufferFill >= m_feedbackAudioBuffer.size())
|
if (m_feedbackAudioBufferFill >= m_feedbackAudioBuffer.size())
|
||||||
@ -568,9 +550,9 @@ void SSBModSource::processOneSample(Complex& ci)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SSBModSource::calculateLevel(Complex& sample)
|
void SSBModSource::calculateLevel(const Complex& sample)
|
||||||
{
|
{
|
||||||
Real t = sample.real(); // TODO: possibly adjust depending on sample type
|
Real t = sample.real();
|
||||||
|
|
||||||
if (m_levelCalcCount < m_levelNbSamples)
|
if (m_levelCalcCount < m_levelNbSamples)
|
||||||
{
|
{
|
||||||
@ -617,14 +599,14 @@ void SSBModSource::applyAudioSampleRate(int sampleRate)
|
|||||||
lowCutoff = band - 100.0f;
|
lowCutoff = band - 100.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_SSBFilter->create_filter(lowCutoff / sampleRate, band / sampleRate);
|
m_SSBFilter->create_filter(lowCutoff / (float) sampleRate, band / (float) sampleRate);
|
||||||
m_DSBFilter->create_dsb_filter((2.0f * band) / sampleRate);
|
m_DSBFilter->create_dsb_filter((2.0f * band) / (float) sampleRate);
|
||||||
|
|
||||||
m_settings.m_bandwidth = band;
|
m_settings.m_bandwidth = band;
|
||||||
m_settings.m_lowCutoff = lowCutoff;
|
m_settings.m_lowCutoff = lowCutoff;
|
||||||
m_settings.m_usb = usb;
|
m_settings.m_usb = usb;
|
||||||
|
|
||||||
m_toneNco.setFreq(m_settings.m_toneFrequency, sampleRate);
|
m_toneNco.setFreq(m_settings.m_toneFrequency, (float) sampleRate);
|
||||||
|
|
||||||
if (m_cwKeyer)
|
if (m_cwKeyer)
|
||||||
{
|
{
|
||||||
@ -632,7 +614,7 @@ void SSBModSource::applyAudioSampleRate(int sampleRate)
|
|||||||
m_cwKeyer->reset();
|
m_cwKeyer->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_audioCompressor.m_rate = sampleRate;
|
m_audioCompressor.m_rate = (float) sampleRate;
|
||||||
m_audioCompressor.initState();
|
m_audioCompressor.initState();
|
||||||
m_audioSampleRate = sampleRate;
|
m_audioSampleRate = sampleRate;
|
||||||
|
|
||||||
@ -641,7 +623,7 @@ void SSBModSource::applyAudioSampleRate(int sampleRate)
|
|||||||
QList<ObjectPipe*> pipes;
|
QList<ObjectPipe*> pipes;
|
||||||
MainCore::instance()->getMessagePipes().getMessagePipes(m_channel, "reportdemod", pipes);
|
MainCore::instance()->getMessagePipes().getMessagePipes(m_channel, "reportdemod", pipes);
|
||||||
|
|
||||||
if (pipes.size() > 0)
|
if (!pipes.empty())
|
||||||
{
|
{
|
||||||
for (const auto& pipe : pipes)
|
for (const auto& pipe : pipes)
|
||||||
{
|
{
|
||||||
@ -665,7 +647,7 @@ void SSBModSource::applyFeedbackAudioSampleRate(int sampleRate)
|
|||||||
m_feedbackInterpolatorDistanceRemain = 0;
|
m_feedbackInterpolatorDistanceRemain = 0;
|
||||||
m_feedbackInterpolatorConsumed = false;
|
m_feedbackInterpolatorConsumed = false;
|
||||||
m_feedbackInterpolatorDistance = (Real) sampleRate / (Real) m_audioSampleRate;
|
m_feedbackInterpolatorDistance = (Real) sampleRate / (Real) m_audioSampleRate;
|
||||||
Real cutoff = std::min(sampleRate, m_audioSampleRate) / 2.2f;
|
Real cutoff = (float) (std::min(sampleRate, m_audioSampleRate)) / 2.2f;
|
||||||
m_feedbackInterpolator.create(48, sampleRate, cutoff, 3.0);
|
m_feedbackInterpolator.create(48, sampleRate, cutoff, 3.0);
|
||||||
m_feedbackAudioSampleRate = sampleRate;
|
m_feedbackAudioSampleRate = sampleRate;
|
||||||
}
|
}
|
||||||
@ -693,12 +675,12 @@ void SSBModSource::applySettings(const SSBModSettings& settings, bool force)
|
|||||||
m_interpolatorConsumed = false;
|
m_interpolatorConsumed = false;
|
||||||
m_interpolatorDistance = (Real) m_audioSampleRate / (Real) m_channelSampleRate;
|
m_interpolatorDistance = (Real) m_audioSampleRate / (Real) m_channelSampleRate;
|
||||||
m_interpolator.create(48, m_audioSampleRate, band, 3.0);
|
m_interpolator.create(48, m_audioSampleRate, band, 3.0);
|
||||||
m_SSBFilter->create_filter(lowCutoff / m_audioSampleRate, band / m_audioSampleRate);
|
m_SSBFilter->create_filter(lowCutoff / (float) m_audioSampleRate, band / (float) m_audioSampleRate);
|
||||||
m_DSBFilter->create_dsb_filter((2.0f * band) / m_audioSampleRate);
|
m_DSBFilter->create_dsb_filter((2.0f * band) / (float) m_audioSampleRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((settings.m_toneFrequency != m_settings.m_toneFrequency) || force) {
|
if ((settings.m_toneFrequency != m_settings.m_toneFrequency) || force) {
|
||||||
m_toneNco.setFreq(settings.m_toneFrequency, m_audioSampleRate);
|
m_toneNco.setFreq(settings.m_toneFrequency, (float) m_audioSampleRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((settings.m_dsb != m_settings.m_dsb) || force)
|
if ((settings.m_dsb != m_settings.m_dsb) || force)
|
||||||
@ -729,11 +711,11 @@ void SSBModSource::applySettings(const SSBModSettings& settings, bool force)
|
|||||||
{
|
{
|
||||||
m_audioCompressor.initSimple(
|
m_audioCompressor.initSimple(
|
||||||
m_audioSampleRate,
|
m_audioSampleRate,
|
||||||
settings.m_cmpPreGainDB, // pregain (dB)
|
(float) settings.m_cmpPreGainDB, // pregain (dB)
|
||||||
settings.m_cmpThresholdDB, // threshold (dB)
|
(float) settings.m_cmpThresholdDB, // threshold (dB)
|
||||||
20, // knee (dB)
|
20, // knee (dB)
|
||||||
12, // ratio (dB)
|
12, // ratio (dB)
|
||||||
0.003, // attack (s)
|
0.003f,// attack (s)
|
||||||
0.25 // release (s)
|
0.25 // release (s)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -751,8 +733,8 @@ void SSBModSource::applyChannelSettings(int channelSampleRate, int channelFreque
|
|||||||
<< " channelFrequencyOffset: " << channelFrequencyOffset;
|
<< " channelFrequencyOffset: " << channelFrequencyOffset;
|
||||||
|
|
||||||
if ((channelFrequencyOffset != m_channelFrequencyOffset)
|
if ((channelFrequencyOffset != m_channelFrequencyOffset)
|
||||||
|| (channelSampleRate != m_channelSampleRate) || force) {
|
|| (channelSampleRate != m_channelSampleRate) || force) {
|
||||||
m_carrierNco.setFreq(channelFrequencyOffset, channelSampleRate);
|
m_carrierNco.setFreq((float) channelFrequencyOffset, (float) channelSampleRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((channelSampleRate != m_channelSampleRate) || force)
|
if ((channelSampleRate != m_channelSampleRate) || force)
|
||||||
@ -769,7 +751,6 @@ void SSBModSource::applyChannelSettings(int channelSampleRate, int channelFreque
|
|||||||
|
|
||||||
void SSBModSource::handleAudio()
|
void SSBModSource::handleAudio()
|
||||||
{
|
{
|
||||||
QMutexLocker mlock(&m_mutex);
|
|
||||||
unsigned int nbRead;
|
unsigned int nbRead;
|
||||||
|
|
||||||
while ((nbRead = m_audioFifo.read(reinterpret_cast<quint8*>(&m_audioReadBuffer[m_audioReadBufferFill]), 4096)) != 0)
|
while ((nbRead = m_audioFifo.read(reinterpret_cast<quint8*>(&m_audioReadBuffer[m_audioReadBufferFill]), 4096)) != 0)
|
||||||
|
@ -46,11 +46,11 @@ class SSBModSource : public QObject, public ChannelSampleSource
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
SSBModSource();
|
SSBModSource();
|
||||||
virtual ~SSBModSource();
|
~SSBModSource() final;
|
||||||
|
|
||||||
virtual void pull(SampleVector::iterator begin, unsigned int nbSamples);
|
void pull(SampleVector::iterator begin, unsigned int nbSamples) final;
|
||||||
virtual void pullOne(Sample& sample);
|
void pullOne(Sample& sample) final;
|
||||||
virtual void prefetch(unsigned int nbSamples);
|
void prefetch(unsigned int nbSamples) final;
|
||||||
|
|
||||||
void setInputFileStream(std::ifstream *ifstream) { m_ifstream = ifstream; }
|
void setInputFileStream(std::ifstream *ifstream) { m_ifstream = ifstream; }
|
||||||
AudioFifo *getAudioFifo() { return &m_audioFifo; }
|
AudioFifo *getAudioFifo() { return &m_audioFifo; }
|
||||||
@ -70,12 +70,12 @@ public:
|
|||||||
numSamples = m_levelNbSamples;
|
numSamples = m_levelNbSamples;
|
||||||
}
|
}
|
||||||
void applySettings(const SSBModSettings& settings, bool force = false);
|
void applySettings(const SSBModSettings& settings, bool force = false);
|
||||||
void applyChannelSettings(int channelSampleRate, int channelFrequencyOffset, bool force = 0);
|
void applyChannelSettings(int channelSampleRate, int channelFrequencyOffset, bool force = false);
|
||||||
void setSpectrumSink(SpectrumVis *sampleSink) { m_spectrumSink = sampleSink; }
|
void setSpectrumSink(SpectrumVis *sampleSink) { m_spectrumSink = sampleSink; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_channelSampleRate;
|
int m_channelSampleRate = 48000;
|
||||||
int m_channelFrequencyOffset;
|
int m_channelFrequencyOffset = 0;
|
||||||
SSBModSettings m_settings;
|
SSBModSettings m_settings;
|
||||||
ChannelAPI *m_channel;
|
ChannelAPI *m_channel;
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ private:
|
|||||||
int m_DSBFilterBufferIndex;
|
int m_DSBFilterBufferIndex;
|
||||||
static const int m_ssbFftLen;
|
static const int m_ssbFftLen;
|
||||||
|
|
||||||
SpectrumVis* m_spectrumSink;
|
SpectrumVis* m_spectrumSink = nullptr;
|
||||||
SampleVector m_sampleBuffer;
|
SampleVector m_sampleBuffer;
|
||||||
|
|
||||||
fftfilt::cmplx m_sum;
|
fftfilt::cmplx m_sum;
|
||||||
@ -114,7 +114,7 @@ private:
|
|||||||
double m_magsq;
|
double m_magsq;
|
||||||
MovingAverageUtil<double, double, 16> m_movingAverage;
|
MovingAverageUtil<double, double, 16> m_movingAverage;
|
||||||
|
|
||||||
int m_audioSampleRate;
|
int m_audioSampleRate = 48000;
|
||||||
AudioVector m_audioBuffer;
|
AudioVector m_audioBuffer;
|
||||||
unsigned int m_audioBufferFill;
|
unsigned int m_audioBufferFill;
|
||||||
AudioVector m_audioReadBuffer;
|
AudioVector m_audioReadBuffer;
|
||||||
@ -126,14 +126,14 @@ private:
|
|||||||
uint m_feedbackAudioBufferFill;
|
uint m_feedbackAudioBufferFill;
|
||||||
AudioFifo m_feedbackAudioFifo;
|
AudioFifo m_feedbackAudioFifo;
|
||||||
|
|
||||||
quint32 m_levelCalcCount;
|
quint32 m_levelCalcCount = 0;
|
||||||
qreal m_rmsLevel;
|
qreal m_rmsLevel;
|
||||||
qreal m_peakLevelOut;
|
qreal m_peakLevelOut;
|
||||||
Real m_peakLevel;
|
Real m_peakLevel = 0.0f;
|
||||||
Real m_levelSum;
|
Real m_levelSum = 0.0f;
|
||||||
|
|
||||||
std::ifstream *m_ifstream;
|
std::ifstream *m_ifstream = nullptr;
|
||||||
CWKeyer *m_cwKeyer;
|
CWKeyer *m_cwKeyer = nullptr;
|
||||||
|
|
||||||
AudioCompressorSnd m_audioCompressor;
|
AudioCompressorSnd m_audioCompressor;
|
||||||
int m_agcStepLength;
|
int m_agcStepLength;
|
||||||
@ -142,11 +142,11 @@ private:
|
|||||||
|
|
||||||
static const int m_levelNbSamples;
|
static const int m_levelNbSamples;
|
||||||
|
|
||||||
void processOneSample(Complex& ci);
|
void processOneSample(const Complex& ci);
|
||||||
void pullAF(Complex& sample);
|
void pullAF(Complex& sample);
|
||||||
void pullAudio(unsigned int nbSamples);
|
void pullAudio(unsigned int nbSamples);
|
||||||
void pushFeedback(Complex sample);
|
void pushFeedback(Complex sample);
|
||||||
void calculateLevel(Complex& sample);
|
void calculateLevel(const Complex& sample);
|
||||||
void modulateSample();
|
void modulateSample();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -68,11 +68,11 @@ Bladerf1Output::~Bladerf1Output()
|
|||||||
delete m_networkManager;
|
delete m_networkManager;
|
||||||
|
|
||||||
if (m_running) {
|
if (m_running) {
|
||||||
stop();
|
Bladerf1Output::stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
closeDevice();
|
closeDevice();
|
||||||
m_deviceAPI->setBuddySharedPtr(0);
|
m_deviceAPI->setBuddySharedPtr(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bladerf1Output::destroy()
|
void Bladerf1Output::destroy()
|
||||||
@ -82,7 +82,7 @@ void Bladerf1Output::destroy()
|
|||||||
|
|
||||||
bool Bladerf1Output::openDevice()
|
bool Bladerf1Output::openDevice()
|
||||||
{
|
{
|
||||||
if (m_dev != 0) {
|
if (m_dev != nullptr) {
|
||||||
closeDevice();
|
closeDevice();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,24 +90,24 @@ bool Bladerf1Output::openDevice()
|
|||||||
|
|
||||||
m_sampleSourceFifo.resize(SampleSourceFifo::getSizePolicy(m_settings.m_devSampleRate));
|
m_sampleSourceFifo.resize(SampleSourceFifo::getSizePolicy(m_settings.m_devSampleRate));
|
||||||
|
|
||||||
if (m_deviceAPI->getSourceBuddies().size() > 0)
|
if (!m_deviceAPI->getSourceBuddies().empty())
|
||||||
{
|
{
|
||||||
DeviceAPI *sourceBuddy = m_deviceAPI->getSourceBuddies()[0];
|
const DeviceAPI *sourceBuddy = m_deviceAPI->getSourceBuddies()[0];
|
||||||
DeviceBladeRF1Params *buddySharedParams = (DeviceBladeRF1Params *) sourceBuddy->getBuddySharedPtr();
|
const DeviceBladeRF1Params *buddySharedParams = (DeviceBladeRF1Params *) sourceBuddy->getBuddySharedPtr();
|
||||||
|
|
||||||
if (buddySharedParams == 0)
|
if (buddySharedParams == nullptr)
|
||||||
{
|
{
|
||||||
qCritical("BladerfOutput::start: could not get shared parameters from buddy");
|
qCritical("BladerfOutput::start: could not get shared parameters from buddy");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buddySharedParams->m_dev == 0) // device is not opened by buddy
|
if (buddySharedParams->m_dev == nullptr) // device is not opened by buddy
|
||||||
{
|
{
|
||||||
qCritical("BladerfOutput::start: could not get BladeRF handle from buddy");
|
qCritical("BladerfOutput::start: could not get BladeRF handle from buddy");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sharedParams = *(buddySharedParams); // copy parameters from buddy
|
m_sharedParams = *buddySharedParams; // copy parameters from buddy
|
||||||
m_dev = m_sharedParams.m_dev; // get BladeRF handle
|
m_dev = m_sharedParams.m_dev; // get BladeRF handle
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -121,7 +121,6 @@ bool Bladerf1Output::openDevice()
|
|||||||
m_sharedParams.m_dev = m_dev;
|
m_sharedParams.m_dev = m_dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: adjust USB transfer data according to sample rate
|
|
||||||
if ((res = bladerf_sync_config(m_dev, BLADERF_TX_X1, BLADERF_FORMAT_SC16_Q11, 64, 8192, 32, 10000)) < 0)
|
if ((res = bladerf_sync_config(m_dev, BLADERF_TX_X1, BLADERF_FORMAT_SC16_Q11, 64, 8192, 32, 10000)) < 0)
|
||||||
{
|
{
|
||||||
qCritical("BladerfOutput::start: bladerf_sync_config with return code %d", res);
|
qCritical("BladerfOutput::start: bladerf_sync_config with return code %d", res);
|
||||||
@ -183,14 +182,14 @@ void Bladerf1Output::closeDevice()
|
|||||||
{
|
{
|
||||||
qDebug("BladerfOutput::closeDevice: closing device since Rx side is not open");
|
qDebug("BladerfOutput::closeDevice: closing device since Rx side is not open");
|
||||||
|
|
||||||
if (m_dev != 0) // close BladeRF
|
if (m_dev != nullptr) // close BladeRF
|
||||||
{
|
{
|
||||||
bladerf_close(m_dev);
|
bladerf_close(m_dev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sharedParams.m_dev = nullptr;
|
m_sharedParams.m_dev = nullptr;
|
||||||
m_dev = 0;
|
m_dev = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bladerf1Output::stop()
|
void Bladerf1Output::stop()
|
||||||
@ -273,7 +272,7 @@ bool Bladerf1Output::handleMessage(const Message& message)
|
|||||||
{
|
{
|
||||||
if (MsgConfigureBladerf1::match(message))
|
if (MsgConfigureBladerf1::match(message))
|
||||||
{
|
{
|
||||||
MsgConfigureBladerf1& conf = (MsgConfigureBladerf1&) message;
|
auto& conf = (const MsgConfigureBladerf1&) message;
|
||||||
qDebug() << "BladerfOutput::handleMessage: MsgConfigureBladerf";
|
qDebug() << "BladerfOutput::handleMessage: MsgConfigureBladerf";
|
||||||
|
|
||||||
if (!applySettings(conf.getSettings(), conf.getSettingsKeys(), conf.getForce())) {
|
if (!applySettings(conf.getSettings(), conf.getSettingsKeys(), conf.getForce())) {
|
||||||
@ -284,7 +283,7 @@ bool Bladerf1Output::handleMessage(const Message& message)
|
|||||||
}
|
}
|
||||||
else if (MsgStartStop::match(message))
|
else if (MsgStartStop::match(message))
|
||||||
{
|
{
|
||||||
MsgStartStop& cmd = (MsgStartStop&) message;
|
auto& cmd = (const MsgStartStop&) message;
|
||||||
qDebug() << "BladerfOutput::handleMessage: MsgStartStop: " << (cmd.getStartStop() ? "start" : "stop");
|
qDebug() << "BladerfOutput::handleMessage: MsgStartStop: " << (cmd.getStartStop() ? "start" : "stop");
|
||||||
|
|
||||||
if (cmd.getStartStop())
|
if (cmd.getStartStop())
|
||||||
@ -316,7 +315,7 @@ bool Bladerf1Output::applySettings(const BladeRF1OutputSettings& settings, const
|
|||||||
bool forwardChange = false;
|
bool forwardChange = false;
|
||||||
bool suspendOwnThread = false;
|
bool suspendOwnThread = false;
|
||||||
bool threadWasRunning = false;
|
bool threadWasRunning = false;
|
||||||
// QMutexLocker mutexLocker(&m_mutex);
|
QMutexLocker mutexLocker(&m_mutex);
|
||||||
|
|
||||||
if (settingsKeys.contains("devSampleRate") ||
|
if (settingsKeys.contains("devSampleRate") ||
|
||||||
settingsKeys.contains("log2Interp") || force)
|
settingsKeys.contains("log2Interp") || force)
|
||||||
@ -324,16 +323,10 @@ bool Bladerf1Output::applySettings(const BladeRF1OutputSettings& settings, const
|
|||||||
suspendOwnThread = true;
|
suspendOwnThread = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (suspendOwnThread)
|
if (suspendOwnThread && m_bladerfThread && m_bladerfThread->isRunning())
|
||||||
{
|
{
|
||||||
if (m_bladerfThread)
|
m_bladerfThread->stopWork();
|
||||||
{
|
threadWasRunning = true;
|
||||||
if (m_bladerfThread->isRunning())
|
|
||||||
{
|
|
||||||
m_bladerfThread->stopWork();
|
|
||||||
threadWasRunning = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settingsKeys.contains("devSampleRate") ||
|
if (settingsKeys.contains("devSampleRate") ||
|
||||||
@ -354,7 +347,7 @@ bool Bladerf1Output::applySettings(const BladeRF1OutputSettings& settings, const
|
|||||||
{
|
{
|
||||||
forwardChange = true;
|
forwardChange = true;
|
||||||
|
|
||||||
if (m_dev != 0)
|
if (m_dev != nullptr)
|
||||||
{
|
{
|
||||||
unsigned int actualSamplerate;
|
unsigned int actualSamplerate;
|
||||||
|
|
||||||
@ -370,129 +363,108 @@ bool Bladerf1Output::applySettings(const BladeRF1OutputSettings& settings, const
|
|||||||
{
|
{
|
||||||
forwardChange = true;
|
forwardChange = true;
|
||||||
|
|
||||||
if (m_bladerfThread != 0)
|
if (m_bladerfThread != nullptr)
|
||||||
{
|
{
|
||||||
m_bladerfThread->setLog2Interpolation(settings.m_log2Interp);
|
m_bladerfThread->setLog2Interpolation(settings.m_log2Interp);
|
||||||
qDebug() << "BladerfOutput::applySettings: set interpolation to " << (1<<settings.m_log2Interp);
|
qDebug() << "BladerfOutput::applySettings: set interpolation to " << (1<<settings.m_log2Interp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settingsKeys.contains("vga1") || force)
|
if ((m_dev != nullptr) && (settingsKeys.contains("vga1") || force))
|
||||||
{
|
{
|
||||||
if (m_dev != 0)
|
if (bladerf_set_txvga1(m_dev, settings.m_vga1) != 0) {
|
||||||
{
|
qDebug("BladerfOutput::applySettings: bladerf_set_txvga1() failed");
|
||||||
if (bladerf_set_txvga1(m_dev, settings.m_vga1) != 0) {
|
} else {
|
||||||
qDebug("BladerfOutput::applySettings: bladerf_set_txvga1() failed");
|
qDebug() << "BladerfOutput::applySettings: VGA1 gain set to " << settings.m_vga1;
|
||||||
} else {
|
|
||||||
qDebug() << "BladerfOutput::applySettings: VGA1 gain set to " << settings.m_vga1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (settingsKeys.contains("vga2") || force)
|
|
||||||
{
|
|
||||||
if(m_dev != 0)
|
|
||||||
{
|
|
||||||
if (bladerf_set_txvga2(m_dev, settings.m_vga2) != 0) {
|
|
||||||
qDebug("BladerfOutput::applySettings:bladerf_set_rxvga2() failed");
|
|
||||||
} else {
|
|
||||||
qDebug() << "BladerfOutput::applySettings: VGA2 gain set to " << settings.m_vga2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (settingsKeys.contains("xb200") || force)
|
|
||||||
{
|
|
||||||
if (m_dev != 0)
|
|
||||||
{
|
|
||||||
bool changeSettings;
|
|
||||||
|
|
||||||
if (m_deviceAPI->getSourceBuddies().size() > 0)
|
|
||||||
{
|
|
||||||
DeviceAPI *buddy = m_deviceAPI->getSourceBuddies()[0];
|
|
||||||
|
|
||||||
if (buddy->getDeviceSourceEngine()->state() == DSPDeviceSourceEngine::StRunning) { // Tx side running
|
|
||||||
changeSettings = false;
|
|
||||||
} else {
|
|
||||||
changeSettings = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else // No Rx open
|
|
||||||
{
|
|
||||||
changeSettings = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (changeSettings)
|
|
||||||
{
|
|
||||||
if (settings.m_xb200)
|
|
||||||
{
|
|
||||||
if (bladerf_expansion_attach(m_dev, BLADERF_XB_200) != 0) {
|
|
||||||
qDebug("BladerfOutput::applySettings: bladerf_expansion_attach(xb200) failed");
|
|
||||||
} else {
|
|
||||||
qDebug() << "BladerfOutput::applySettings: Attach XB200";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (bladerf_expansion_attach(m_dev, BLADERF_XB_NONE) != 0) {
|
|
||||||
qDebug("BladerfOutput::applySettings: bladerf_expansion_attach(none) failed");
|
|
||||||
} else {
|
|
||||||
qDebug() << "BladerfOutput::applySettings: Detach XB200";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_sharedParams.m_xb200Attached = settings.m_xb200;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settingsKeys.contains("xb200Path") || force)
|
if ((m_dev != nullptr) && (settingsKeys.contains("vga2") || force))
|
||||||
{
|
{
|
||||||
if (m_dev != 0)
|
if (bladerf_set_txvga2(m_dev, settings.m_vga2) != 0) {
|
||||||
{
|
qDebug("BladerfOutput::applySettings:bladerf_set_rxvga2() failed");
|
||||||
if (bladerf_xb200_set_path(m_dev, BLADERF_MODULE_TX, settings.m_xb200Path) != 0) {
|
} else {
|
||||||
qDebug("BladerfOutput::applySettings: bladerf_xb200_set_path(BLADERF_MODULE_TX) failed");
|
qDebug() << "BladerfOutput::applySettings: VGA2 gain set to " << settings.m_vga2;
|
||||||
} else {
|
}
|
||||||
qDebug() << "BladerfOutput::applySettings: set xb200 path to " << settings.m_xb200Path;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settingsKeys.contains("xb200Filter") || force)
|
if ((m_dev != nullptr) && (settingsKeys.contains("xb200") || force))
|
||||||
{
|
{
|
||||||
if (m_dev != 0)
|
bool changeSettings;
|
||||||
{
|
|
||||||
if (bladerf_xb200_set_filterbank(m_dev, BLADERF_MODULE_TX, settings.m_xb200Filter) != 0) {
|
if (!m_deviceAPI->getSourceBuddies().empty())
|
||||||
qDebug("BladerfOutput::applySettings: bladerf_xb200_set_filterbank(BLADERF_MODULE_TX) failed");
|
{
|
||||||
} else {
|
DeviceAPI *buddy = m_deviceAPI->getSourceBuddies()[0];
|
||||||
qDebug() << "BladerfOutput::applySettings: set xb200 filter to " << settings.m_xb200Filter;
|
|
||||||
}
|
if (buddy->getDeviceSourceEngine()->state() == DSPDeviceSourceEngine::State::StRunning) { // Tx side running
|
||||||
}
|
changeSettings = false;
|
||||||
|
} else {
|
||||||
|
changeSettings = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // No Rx open
|
||||||
|
{
|
||||||
|
changeSettings = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changeSettings)
|
||||||
|
{
|
||||||
|
if (settings.m_xb200)
|
||||||
|
{
|
||||||
|
if (bladerf_expansion_attach(m_dev, BLADERF_XB_200) != 0) {
|
||||||
|
qDebug("BladerfOutput::applySettings: bladerf_expansion_attach(xb200) failed");
|
||||||
|
} else {
|
||||||
|
qDebug() << "BladerfOutput::applySettings: Attach XB200";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (bladerf_expansion_attach(m_dev, BLADERF_XB_NONE) != 0) {
|
||||||
|
qDebug("BladerfOutput::applySettings: bladerf_expansion_attach(none) failed");
|
||||||
|
} else {
|
||||||
|
qDebug() << "BladerfOutput::applySettings: Detach XB200";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_sharedParams.m_xb200Attached = settings.m_xb200;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settingsKeys.contains("bandwidth") || force)
|
if ((m_dev != nullptr) && (settingsKeys.contains("xb200Path") || force))
|
||||||
{
|
{
|
||||||
if (m_dev != 0)
|
if (bladerf_xb200_set_path(m_dev, BLADERF_MODULE_TX, settings.m_xb200Path) != 0) {
|
||||||
{
|
qDebug("BladerfOutput::applySettings: bladerf_xb200_set_path(BLADERF_MODULE_TX) failed");
|
||||||
unsigned int actualBandwidth;
|
} else {
|
||||||
|
qDebug() << "BladerfOutput::applySettings: set xb200 path to " << settings.m_xb200Path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (bladerf_set_bandwidth(m_dev, BLADERF_MODULE_TX, settings.m_bandwidth, &actualBandwidth) < 0) {
|
if ((m_dev != nullptr) && (settingsKeys.contains("xb200Filter") || force))
|
||||||
qCritical("BladerfOutput::applySettings: could not set bandwidth: %d", settings.m_bandwidth);
|
{
|
||||||
} else {
|
if (bladerf_xb200_set_filterbank(m_dev, BLADERF_MODULE_TX, settings.m_xb200Filter) != 0) {
|
||||||
qDebug() << "BladerfOutput::applySettings: bladerf_set_bandwidth(BLADERF_MODULE_TX) actual bandwidth is " << actualBandwidth;
|
qDebug("BladerfOutput::applySettings: bladerf_xb200_set_filterbank(BLADERF_MODULE_TX) failed");
|
||||||
}
|
} else {
|
||||||
}
|
qDebug() << "BladerfOutput::applySettings: set xb200 filter to " << settings.m_xb200Filter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((m_dev != nullptr) && (settingsKeys.contains("bandwidth") || force))
|
||||||
|
{
|
||||||
|
unsigned int actualBandwidth;
|
||||||
|
|
||||||
|
if (bladerf_set_bandwidth(m_dev, BLADERF_MODULE_TX, settings.m_bandwidth, &actualBandwidth) < 0) {
|
||||||
|
qCritical("BladerfOutput::applySettings: could not set bandwidth: %d", settings.m_bandwidth);
|
||||||
|
} else {
|
||||||
|
qDebug() << "BladerfOutput::applySettings: bladerf_set_bandwidth(BLADERF_MODULE_TX) actual bandwidth is " << actualBandwidth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settingsKeys.contains("centerFrequency"))
|
if (settingsKeys.contains("centerFrequency"))
|
||||||
{
|
{
|
||||||
forwardChange = true;
|
forwardChange = true;
|
||||||
|
|
||||||
if (m_dev != 0)
|
if ((m_dev != nullptr) && (bladerf_set_frequency( m_dev, BLADERF_MODULE_TX, settings.m_centerFrequency ) != 0)) {
|
||||||
{
|
qDebug("BladerfOutput::applySettings: bladerf_set_frequency(%lld) failed", settings.m_centerFrequency);
|
||||||
if (bladerf_set_frequency( m_dev, BLADERF_MODULE_TX, settings.m_centerFrequency ) != 0) {
|
|
||||||
qDebug("BladerfOutput::applySettings: bladerf_set_frequency(%lld) failed", settings.m_centerFrequency);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -519,7 +491,7 @@ bool Bladerf1Output::applySettings(const BladeRF1OutputSettings& settings, const
|
|||||||
if (forwardChange)
|
if (forwardChange)
|
||||||
{
|
{
|
||||||
int sampleRate = m_settings.m_devSampleRate/(1<<m_settings.m_log2Interp);
|
int sampleRate = m_settings.m_devSampleRate/(1<<m_settings.m_log2Interp);
|
||||||
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, m_settings.m_centerFrequency);
|
auto *notif = new DSPSignalNotification(sampleRate, m_settings.m_centerFrequency);
|
||||||
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
|
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -608,7 +580,7 @@ void Bladerf1Output::webapiUpdateDeviceSettings(
|
|||||||
settings.m_log2Interp = response.getBladeRf1OutputSettings()->getLog2Interp();
|
settings.m_log2Interp = response.getBladeRf1OutputSettings()->getLog2Interp();
|
||||||
}
|
}
|
||||||
if (deviceSettingsKeys.contains("xb200")) {
|
if (deviceSettingsKeys.contains("xb200")) {
|
||||||
settings.m_xb200 = response.getBladeRf1OutputSettings()->getXb200() == 0 ? 0 : 1;
|
settings.m_xb200 = response.getBladeRf1OutputSettings()->getXb200() == 0 ? false : true;
|
||||||
}
|
}
|
||||||
if (deviceSettingsKeys.contains("xb200Path")) {
|
if (deviceSettingsKeys.contains("xb200Path")) {
|
||||||
settings.m_xb200Path = static_cast<bladerf_xb200_path>(response.getBladeRf1OutputSettings()->getXb200Path());
|
settings.m_xb200Path = static_cast<bladerf_xb200_path>(response.getBladeRf1OutputSettings()->getXb200Path());
|
||||||
@ -623,10 +595,10 @@ void Bladerf1Output::webapiUpdateDeviceSettings(
|
|||||||
settings.m_reverseAPIAddress = *response.getBladeRf1OutputSettings()->getReverseApiAddress();
|
settings.m_reverseAPIAddress = *response.getBladeRf1OutputSettings()->getReverseApiAddress();
|
||||||
}
|
}
|
||||||
if (deviceSettingsKeys.contains("reverseAPIPort")) {
|
if (deviceSettingsKeys.contains("reverseAPIPort")) {
|
||||||
settings.m_reverseAPIPort = response.getBladeRf1OutputSettings()->getReverseApiPort();
|
settings.m_reverseAPIPort = (uint16_t) response.getBladeRf1OutputSettings()->getReverseApiPort();
|
||||||
}
|
}
|
||||||
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||||
settings.m_reverseAPIDeviceIndex = response.getBladeRf1OutputSettings()->getReverseApiDeviceIndex();
|
settings.m_reverseAPIDeviceIndex = (uint16_t) response.getBladeRf1OutputSettings()->getReverseApiDeviceIndex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -660,7 +632,7 @@ int Bladerf1Output::webapiRun(
|
|||||||
|
|
||||||
void Bladerf1Output::webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const BladeRF1OutputSettings& settings, bool force)
|
void Bladerf1Output::webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const BladeRF1OutputSettings& settings, bool force)
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
auto *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
||||||
swgDeviceSettings->setDirection(1); // single Tx
|
swgDeviceSettings->setDirection(1); // single Tx
|
||||||
swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex());
|
swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex());
|
||||||
swgDeviceSettings->setDeviceHwType(new QString("BladeRF1"));
|
swgDeviceSettings->setDeviceHwType(new QString("BladeRF1"));
|
||||||
@ -704,8 +676,8 @@ void Bladerf1Output::webapiReverseSendSettings(const QList<QString>& deviceSetti
|
|||||||
m_networkRequest.setUrl(QUrl(deviceSettingsURL));
|
m_networkRequest.setUrl(QUrl(deviceSettingsURL));
|
||||||
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||||
|
|
||||||
QBuffer *buffer = new QBuffer();
|
auto *buffer = new QBuffer();
|
||||||
buffer->open((QBuffer::ReadWrite));
|
buffer->open(QBuffer::ReadWrite);
|
||||||
buffer->write(swgDeviceSettings->asJson().toUtf8());
|
buffer->write(swgDeviceSettings->asJson().toUtf8());
|
||||||
buffer->seek(0);
|
buffer->seek(0);
|
||||||
|
|
||||||
@ -718,7 +690,7 @@ void Bladerf1Output::webapiReverseSendSettings(const QList<QString>& deviceSetti
|
|||||||
|
|
||||||
void Bladerf1Output::webapiReverseSendStartStop(bool start)
|
void Bladerf1Output::webapiReverseSendStartStop(bool start)
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
auto *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
||||||
swgDeviceSettings->setDirection(1); // single Tx
|
swgDeviceSettings->setDirection(1); // single Tx
|
||||||
swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex());
|
swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex());
|
||||||
swgDeviceSettings->setDeviceHwType(new QString("BladeRF1"));
|
swgDeviceSettings->setDeviceHwType(new QString("BladeRF1"));
|
||||||
@ -730,8 +702,8 @@ void Bladerf1Output::webapiReverseSendStartStop(bool start)
|
|||||||
m_networkRequest.setUrl(QUrl(deviceSettingsURL));
|
m_networkRequest.setUrl(QUrl(deviceSettingsURL));
|
||||||
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||||
|
|
||||||
QBuffer *buffer = new QBuffer();
|
auto *buffer = new QBuffer();
|
||||||
buffer->open((QBuffer::ReadWrite));
|
buffer->open(QBuffer::ReadWrite);
|
||||||
buffer->write(swgDeviceSettings->asJson().toUtf8());
|
buffer->write(swgDeviceSettings->asJson().toUtf8());
|
||||||
buffer->seek(0);
|
buffer->seek(0);
|
||||||
QNetworkReply *reply;
|
QNetworkReply *reply;
|
||||||
@ -746,7 +718,7 @@ void Bladerf1Output::webapiReverseSendStartStop(bool start)
|
|||||||
delete swgDeviceSettings;
|
delete swgDeviceSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bladerf1Output::networkManagerFinished(QNetworkReply *reply)
|
void Bladerf1Output::networkManagerFinished(QNetworkReply *reply) const
|
||||||
{
|
{
|
||||||
QNetworkReply::NetworkError replyError = reply->error();
|
QNetworkReply::NetworkError replyError = reply->error();
|
||||||
|
|
||||||
|
@ -74,10 +74,10 @@ public:
|
|||||||
return new MsgStartStop(startStop);
|
return new MsgStartStop(startStop);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
bool m_startStop;
|
bool m_startStop;
|
||||||
|
|
||||||
MsgStartStop(bool startStop) :
|
explicit MsgStartStop(bool startStop) :
|
||||||
Message(),
|
Message(),
|
||||||
m_startStop(startStop)
|
m_startStop(startStop)
|
||||||
{ }
|
{ }
|
||||||
@ -100,57 +100,57 @@ public:
|
|||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
Bladerf1Output(DeviceAPI *deviceAPI);
|
explicit Bladerf1Output(DeviceAPI *deviceAPI);
|
||||||
virtual ~Bladerf1Output();
|
~Bladerf1Output() final;
|
||||||
virtual void destroy();
|
void destroy() final;
|
||||||
|
|
||||||
virtual void init();
|
void init() final;
|
||||||
virtual bool start();
|
bool start() final;
|
||||||
virtual void stop();
|
void stop() final;
|
||||||
|
|
||||||
virtual QByteArray serialize() const;
|
QByteArray serialize() const final;
|
||||||
virtual bool deserialize(const QByteArray& data);
|
bool deserialize(const QByteArray& data) final;
|
||||||
|
|
||||||
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
|
void setMessageQueueToGUI(MessageQueue *queue) final { m_guiMessageQueue = queue; }
|
||||||
virtual const QString& getDeviceDescription() const;
|
const QString& getDeviceDescription() const final;
|
||||||
virtual int getSampleRate() const;
|
int getSampleRate() const final;
|
||||||
virtual void setSampleRate(int sampleRate) { (void) sampleRate; }
|
void setSampleRate(int sampleRate) final { (void) sampleRate; }
|
||||||
virtual quint64 getCenterFrequency() const;
|
quint64 getCenterFrequency() const final;
|
||||||
virtual void setCenterFrequency(qint64 centerFrequency);
|
void setCenterFrequency(qint64 centerFrequency) final;
|
||||||
|
|
||||||
virtual bool handleMessage(const Message& message);
|
bool handleMessage(const Message& message) final;
|
||||||
|
|
||||||
virtual int webapiSettingsGet(
|
int webapiSettingsGet(
|
||||||
SWGSDRangel::SWGDeviceSettings& response,
|
SWGSDRangel::SWGDeviceSettings& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage) final;
|
||||||
|
|
||||||
virtual int webapiSettingsPutPatch(
|
int webapiSettingsPutPatch(
|
||||||
bool force,
|
bool force,
|
||||||
const QStringList& deviceSettingsKeys,
|
const QStringList& deviceSettingsKeys,
|
||||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||||
QString& errorMessage);
|
QString& errorMessage) final;
|
||||||
|
|
||||||
virtual int webapiRunGet(
|
int webapiRunGet(
|
||||||
SWGSDRangel::SWGDeviceState& response,
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage) final;
|
||||||
|
|
||||||
virtual int webapiRun(
|
int webapiRun(
|
||||||
bool run,
|
bool run,
|
||||||
SWGSDRangel::SWGDeviceState& response,
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage) final;
|
||||||
|
|
||||||
static void webapiFormatDeviceSettings(
|
static void webapiFormatDeviceSettings(
|
||||||
SWGSDRangel::SWGDeviceSettings& response,
|
SWGSDRangel::SWGDeviceSettings& response,
|
||||||
const BladeRF1OutputSettings& settings);
|
const BladeRF1OutputSettings& settings);
|
||||||
|
|
||||||
static void webapiUpdateDeviceSettings(
|
static void webapiUpdateDeviceSettings(
|
||||||
BladeRF1OutputSettings& settings,
|
BladeRF1OutputSettings& settings,
|
||||||
const QStringList& deviceSettingsKeys,
|
const QStringList& deviceSettingsKeys,
|
||||||
SWGSDRangel::SWGDeviceSettings& response);
|
SWGSDRangel::SWGDeviceSettings& response);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DeviceAPI *m_deviceAPI;
|
DeviceAPI *m_deviceAPI;
|
||||||
QMutex m_mutex;
|
QRecursiveMutex m_mutex;
|
||||||
BladeRF1OutputSettings m_settings;
|
BladeRF1OutputSettings m_settings;
|
||||||
struct bladerf* m_dev;
|
struct bladerf* m_dev;
|
||||||
Bladerf1OutputThread* m_bladerfThread;
|
Bladerf1OutputThread* m_bladerfThread;
|
||||||
@ -167,7 +167,7 @@ private:
|
|||||||
void webapiReverseSendStartStop(bool start);
|
void webapiReverseSendStartStop(bool start);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void networkManagerFinished(QNetworkReply *reply);
|
void networkManagerFinished(QNetworkReply *reply) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDE_BLADERFOUTPUT_H
|
#endif // INCLUDE_BLADERFOUTPUT_H
|
||||||
|
@ -44,11 +44,8 @@ MESSAGE_CLASS_DEFINITION(FileOutput::MsgReportFileOutputStreamTiming, Message)
|
|||||||
|
|
||||||
FileOutput::FileOutput(DeviceAPI *deviceAPI) :
|
FileOutput::FileOutput(DeviceAPI *deviceAPI) :
|
||||||
m_deviceAPI(deviceAPI),
|
m_deviceAPI(deviceAPI),
|
||||||
m_running(false),
|
|
||||||
m_settings(),
|
m_settings(),
|
||||||
m_fileOutputWorker(nullptr),
|
|
||||||
m_deviceDescription("FileOutput"),
|
m_deviceDescription("FileOutput"),
|
||||||
m_startingTimeStamp(0),
|
|
||||||
m_masterTimer(deviceAPI->getMasterTimer())
|
m_masterTimer(deviceAPI->getMasterTimer())
|
||||||
{
|
{
|
||||||
m_deviceAPI->setNbSinkStreams(1);
|
m_deviceAPI->setNbSinkStreams(1);
|
||||||
@ -58,7 +55,7 @@ FileOutput::FileOutput(DeviceAPI *deviceAPI) :
|
|||||||
FileOutput::~FileOutput()
|
FileOutput::~FileOutput()
|
||||||
{
|
{
|
||||||
delete m_networkManager;
|
delete m_networkManager;
|
||||||
stop();
|
FileOutput::stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileOutput::destroy()
|
void FileOutput::destroy()
|
||||||
@ -75,7 +72,7 @@ void FileOutput::openFileStream()
|
|||||||
m_ofstream.open(m_settings.m_fileName.toStdString().c_str(), std::ios::binary);
|
m_ofstream.open(m_settings.m_fileName.toStdString().c_str(), std::ios::binary);
|
||||||
|
|
||||||
FileRecord::Header header;
|
FileRecord::Header header;
|
||||||
int actualSampleRate = m_settings.m_sampleRate * (1<<m_settings.m_log2Interp);
|
auto actualSampleRate = (int) (m_settings.m_sampleRate * (1<<m_settings.m_log2Interp));
|
||||||
header.sampleRate = actualSampleRate;
|
header.sampleRate = actualSampleRate;
|
||||||
header.centerFrequency = m_settings.m_centerFrequency;
|
header.centerFrequency = m_settings.m_centerFrequency;
|
||||||
m_startingTimeStamp = QDateTime::currentMSecsSinceEpoch();
|
m_startingTimeStamp = QDateTime::currentMSecsSinceEpoch();
|
||||||
@ -106,14 +103,13 @@ bool FileOutput::start()
|
|||||||
|
|
||||||
m_fileOutputWorker = new FileOutputWorker(&m_ofstream, &m_sampleSourceFifo);
|
m_fileOutputWorker = new FileOutputWorker(&m_ofstream, &m_sampleSourceFifo);
|
||||||
m_fileOutputWorker->moveToThread(&m_fileOutputWorkerThread);
|
m_fileOutputWorker->moveToThread(&m_fileOutputWorkerThread);
|
||||||
m_fileOutputWorker->setSamplerate(m_settings.m_sampleRate);
|
m_fileOutputWorker->setSamplerate((int) m_settings.m_sampleRate);
|
||||||
m_fileOutputWorker->setLog2Interpolation(m_settings.m_log2Interp);
|
m_fileOutputWorker->setLog2Interpolation(m_settings.m_log2Interp);
|
||||||
m_fileOutputWorker->connectTimer(m_masterTimer);
|
m_fileOutputWorker->connectTimer(m_masterTimer);
|
||||||
startWorker();
|
startWorker();
|
||||||
m_running = true;
|
m_running = true;
|
||||||
|
|
||||||
mutexLocker.unlock();
|
mutexLocker.unlock();
|
||||||
//applySettings(m_generalSettings, m_settings, true);
|
|
||||||
qDebug("FileOutput::start: started");
|
qDebug("FileOutput::start: started");
|
||||||
|
|
||||||
if (getMessageQueueToGUI())
|
if (getMessageQueueToGUI())
|
||||||
@ -201,7 +197,7 @@ const QString& FileOutput::getDeviceDescription() const
|
|||||||
|
|
||||||
int FileOutput::getSampleRate() const
|
int FileOutput::getSampleRate() const
|
||||||
{
|
{
|
||||||
return m_settings.m_sampleRate;
|
return (int) m_settings.m_sampleRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
quint64 FileOutput::getCenterFrequency() const
|
quint64 FileOutput::getCenterFrequency() const
|
||||||
@ -233,14 +229,14 @@ bool FileOutput::handleMessage(const Message& message)
|
|||||||
{
|
{
|
||||||
if (MsgConfigureFileOutputName::match(message))
|
if (MsgConfigureFileOutputName::match(message))
|
||||||
{
|
{
|
||||||
MsgConfigureFileOutputName& conf = (MsgConfigureFileOutputName&) message;
|
auto& conf = (const MsgConfigureFileOutputName&) message;
|
||||||
m_settings.m_fileName = conf.getFileName();
|
m_settings.m_fileName = conf.getFileName();
|
||||||
openFileStream();
|
openFileStream();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (MsgStartStop::match(message))
|
else if (MsgStartStop::match(message))
|
||||||
{
|
{
|
||||||
MsgStartStop& cmd = (MsgStartStop&) message;
|
auto& cmd = (const MsgStartStop&) message;
|
||||||
qDebug() << "FileOutput::handleMessage: MsgStartStop: " << (cmd.getStartStop() ? "start" : "stop");
|
qDebug() << "FileOutput::handleMessage: MsgStartStop: " << (cmd.getStartStop() ? "start" : "stop");
|
||||||
|
|
||||||
if (cmd.getStartStop())
|
if (cmd.getStartStop())
|
||||||
@ -262,17 +258,17 @@ bool FileOutput::handleMessage(const Message& message)
|
|||||||
}
|
}
|
||||||
else if (MsgConfigureFileOutput::match(message))
|
else if (MsgConfigureFileOutput::match(message))
|
||||||
{
|
{
|
||||||
qDebug() << "FileOutput::handleMessage: MsgConfigureFileOutput";
|
qDebug() << "FileOutput::handleMessage: MsgConfigureFileOutput";
|
||||||
MsgConfigureFileOutput& conf = (MsgConfigureFileOutput&) message;
|
auto& conf = (const MsgConfigureFileOutput&) message;
|
||||||
applySettings(conf.getSettings(), conf.getSettingsKeys(), conf.getForce());
|
applySettings(conf.getSettings(), conf.getSettingsKeys(), conf.getForce());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (MsgConfigureFileOutputWork::match(message))
|
else if (MsgConfigureFileOutputWork::match(message))
|
||||||
{
|
{
|
||||||
MsgConfigureFileOutputWork& conf = (MsgConfigureFileOutputWork&) message;
|
auto& conf = (const MsgConfigureFileOutputWork&) message;
|
||||||
bool working = conf.isWorking();
|
bool working = conf.isWorking();
|
||||||
|
|
||||||
if (m_fileOutputWorker != 0)
|
if (m_fileOutputWorker != nullptr)
|
||||||
{
|
{
|
||||||
if (working) {
|
if (working) {
|
||||||
startWorker();
|
startWorker();
|
||||||
@ -285,11 +281,9 @@ bool FileOutput::handleMessage(const Message& message)
|
|||||||
}
|
}
|
||||||
else if (MsgConfigureFileOutputStreamTiming::match(message))
|
else if (MsgConfigureFileOutputStreamTiming::match(message))
|
||||||
{
|
{
|
||||||
MsgReportFileOutputStreamTiming *report;
|
if (m_fileOutputWorker != nullptr && getMessageQueueToGUI())
|
||||||
|
|
||||||
if (m_fileOutputWorker != 0 && getMessageQueueToGUI())
|
|
||||||
{
|
{
|
||||||
report = MsgReportFileOutputStreamTiming::create(m_fileOutputWorker->getSamplesCount());
|
auto *report = MsgReportFileOutputStreamTiming::create(m_fileOutputWorker->getSamplesCount());
|
||||||
getMessageQueueToGUI()->push(report);
|
getMessageQueueToGUI()->push(report);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -314,8 +308,8 @@ void FileOutput::applySettings(const FileOutputSettings& settings, const QList<Q
|
|||||||
|
|
||||||
if (force || settingsKeys.contains("sampleRate"))
|
if (force || settingsKeys.contains("sampleRate"))
|
||||||
{
|
{
|
||||||
if (m_fileOutputWorker != 0) {
|
if (m_fileOutputWorker != nullptr) {
|
||||||
m_fileOutputWorker->setSamplerate(settings.m_sampleRate);
|
m_fileOutputWorker->setSamplerate((int) settings.m_sampleRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
forwardChange = true;
|
forwardChange = true;
|
||||||
@ -323,7 +317,7 @@ void FileOutput::applySettings(const FileOutputSettings& settings, const QList<Q
|
|||||||
|
|
||||||
if (force || settingsKeys.contains("log2Interp"))
|
if (force || settingsKeys.contains("log2Interp"))
|
||||||
{
|
{
|
||||||
if (m_fileOutputWorker != 0) {
|
if (m_fileOutputWorker != nullptr) {
|
||||||
m_fileOutputWorker->setLog2Interpolation(settings.m_log2Interp);
|
m_fileOutputWorker->setLog2Interpolation(settings.m_log2Interp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -351,7 +345,7 @@ void FileOutput::applySettings(const FileOutputSettings& settings, const QList<Q
|
|||||||
m_settings.m_centerFrequency,
|
m_settings.m_centerFrequency,
|
||||||
m_settings.m_sampleRate,
|
m_settings.m_sampleRate,
|
||||||
m_settings.m_log2Interp);
|
m_settings.m_log2Interp);
|
||||||
DSPSignalNotification *notif = new DSPSignalNotification(m_settings.m_sampleRate, m_settings.m_centerFrequency);
|
auto *notif = new DSPSignalNotification((int) m_settings.m_sampleRate, m_settings.m_centerFrequency);
|
||||||
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
|
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -461,16 +455,16 @@ void FileOutput::webapiUpdateDeviceSettings(
|
|||||||
settings.m_reverseAPIAddress = *response.getFileOutputSettings()->getReverseApiAddress();
|
settings.m_reverseAPIAddress = *response.getFileOutputSettings()->getReverseApiAddress();
|
||||||
}
|
}
|
||||||
if (deviceSettingsKeys.contains("reverseAPIPort")) {
|
if (deviceSettingsKeys.contains("reverseAPIPort")) {
|
||||||
settings.m_reverseAPIPort = response.getFileOutputSettings()->getReverseApiPort();
|
settings.m_reverseAPIPort = (uint16_t) response.getFileOutputSettings()->getReverseApiPort();
|
||||||
}
|
}
|
||||||
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||||
settings.m_reverseAPIDeviceIndex = response.getFileOutputSettings()->getReverseApiDeviceIndex();
|
settings.m_reverseAPIDeviceIndex = (uint16_t) response.getFileOutputSettings()->getReverseApiDeviceIndex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileOutput::webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const FileOutputSettings& settings, bool force)
|
void FileOutput::webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const FileOutputSettings& settings, bool force)
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
auto *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
||||||
swgDeviceSettings->setDirection(1); // single Tx
|
swgDeviceSettings->setDirection(1); // single Tx
|
||||||
swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex());
|
swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex());
|
||||||
swgDeviceSettings->setDeviceHwType(new QString("FileOutput"));
|
swgDeviceSettings->setDeviceHwType(new QString("FileOutput"));
|
||||||
@ -499,8 +493,8 @@ void FileOutput::webapiReverseSendSettings(const QList<QString>& deviceSettingsK
|
|||||||
m_networkRequest.setUrl(QUrl(deviceSettingsURL));
|
m_networkRequest.setUrl(QUrl(deviceSettingsURL));
|
||||||
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||||
|
|
||||||
QBuffer *buffer = new QBuffer();
|
auto *buffer = new QBuffer();
|
||||||
buffer->open((QBuffer::ReadWrite));
|
buffer->open(QBuffer::ReadWrite);
|
||||||
buffer->write(swgDeviceSettings->asJson().toUtf8());
|
buffer->write(swgDeviceSettings->asJson().toUtf8());
|
||||||
buffer->seek(0);
|
buffer->seek(0);
|
||||||
|
|
||||||
@ -513,7 +507,7 @@ void FileOutput::webapiReverseSendSettings(const QList<QString>& deviceSettingsK
|
|||||||
|
|
||||||
void FileOutput::webapiReverseSendStartStop(bool start)
|
void FileOutput::webapiReverseSendStartStop(bool start)
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
auto *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
||||||
swgDeviceSettings->setDirection(1); // single Tx
|
swgDeviceSettings->setDirection(1); // single Tx
|
||||||
swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex());
|
swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex());
|
||||||
swgDeviceSettings->setDeviceHwType(new QString("FileOutput"));
|
swgDeviceSettings->setDeviceHwType(new QString("FileOutput"));
|
||||||
@ -525,8 +519,8 @@ void FileOutput::webapiReverseSendStartStop(bool start)
|
|||||||
m_networkRequest.setUrl(QUrl(deviceSettingsURL));
|
m_networkRequest.setUrl(QUrl(deviceSettingsURL));
|
||||||
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||||
|
|
||||||
QBuffer *buffer = new QBuffer();
|
auto *buffer = new QBuffer();
|
||||||
buffer->open((QBuffer::ReadWrite));
|
buffer->open(QBuffer::ReadWrite);
|
||||||
buffer->write(swgDeviceSettings->asJson().toUtf8());
|
buffer->write(swgDeviceSettings->asJson().toUtf8());
|
||||||
buffer->seek(0);
|
buffer->seek(0);
|
||||||
QNetworkReply *reply;
|
QNetworkReply *reply;
|
||||||
@ -541,7 +535,7 @@ void FileOutput::webapiReverseSendStartStop(bool start)
|
|||||||
delete swgDeviceSettings;
|
delete swgDeviceSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileOutput::networkManagerFinished(QNetworkReply *reply)
|
void FileOutput::networkManagerFinished(QNetworkReply *reply) const
|
||||||
{
|
{
|
||||||
QNetworkReply::NetworkError replyError = reply->error();
|
QNetworkReply::NetworkError replyError = reply->error();
|
||||||
|
|
||||||
|
@ -76,10 +76,10 @@ public:
|
|||||||
return new MsgStartStop(startStop);
|
return new MsgStartStop(startStop);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
bool m_startStop;
|
bool m_startStop;
|
||||||
|
|
||||||
MsgStartStop(bool startStop) :
|
explicit MsgStartStop(bool startStop) :
|
||||||
Message(),
|
Message(),
|
||||||
m_startStop(startStop)
|
m_startStop(startStop)
|
||||||
{ }
|
{ }
|
||||||
@ -99,7 +99,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
QString m_fileName;
|
QString m_fileName;
|
||||||
|
|
||||||
MsgConfigureFileOutputName(const QString& fileName) :
|
explicit MsgConfigureFileOutputName(const QString& fileName) :
|
||||||
Message(),
|
Message(),
|
||||||
m_fileName(fileName)
|
m_fileName(fileName)
|
||||||
{ }
|
{ }
|
||||||
@ -119,7 +119,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
bool m_working;
|
bool m_working;
|
||||||
|
|
||||||
MsgConfigureFileOutputWork(bool working) :
|
explicit MsgConfigureFileOutputWork(bool working) :
|
||||||
Message(),
|
Message(),
|
||||||
m_working(working)
|
m_working(working)
|
||||||
{ }
|
{ }
|
||||||
@ -153,10 +153,10 @@ public:
|
|||||||
return new MsgReportFileOutputGeneration(acquisition);
|
return new MsgReportFileOutputGeneration(acquisition);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
bool m_acquisition;
|
bool m_acquisition;
|
||||||
|
|
||||||
MsgReportFileOutputGeneration(bool acquisition) :
|
explicit MsgReportFileOutputGeneration(bool acquisition) :
|
||||||
Message(),
|
Message(),
|
||||||
m_acquisition(acquisition)
|
m_acquisition(acquisition)
|
||||||
{ }
|
{ }
|
||||||
@ -173,54 +173,54 @@ public:
|
|||||||
return new MsgReportFileOutputStreamTiming(samplesCount);
|
return new MsgReportFileOutputStreamTiming(samplesCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
std::size_t m_samplesCount;
|
std::size_t m_samplesCount;
|
||||||
|
|
||||||
MsgReportFileOutputStreamTiming(std::size_t samplesCount) :
|
explicit MsgReportFileOutputStreamTiming(std::size_t samplesCount) :
|
||||||
Message(),
|
Message(),
|
||||||
m_samplesCount(samplesCount)
|
m_samplesCount(samplesCount)
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
FileOutput(DeviceAPI *deviceAPI);
|
explicit FileOutput(DeviceAPI *deviceAPI);
|
||||||
virtual ~FileOutput();
|
~FileOutput() final;
|
||||||
virtual void destroy();
|
void destroy() final;
|
||||||
|
|
||||||
virtual void init();
|
void init() final;
|
||||||
virtual bool start();
|
bool start() final;
|
||||||
virtual void stop();
|
void stop() final;
|
||||||
|
|
||||||
virtual QByteArray serialize() const;
|
QByteArray serialize() const final;
|
||||||
virtual bool deserialize(const QByteArray& data);
|
bool deserialize(const QByteArray& data) final;
|
||||||
|
|
||||||
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
|
void setMessageQueueToGUI(MessageQueue *queue) final { m_guiMessageQueue = queue; }
|
||||||
virtual const QString& getDeviceDescription() const;
|
const QString& getDeviceDescription() const final;
|
||||||
virtual int getSampleRate() const;
|
int getSampleRate() const final;
|
||||||
virtual void setSampleRate(int sampleRate) { (void) sampleRate; }
|
void setSampleRate(int sampleRate) final { (void) sampleRate; }
|
||||||
virtual quint64 getCenterFrequency() const;
|
quint64 getCenterFrequency() const final;
|
||||||
virtual void setCenterFrequency(qint64 centerFrequency);
|
void setCenterFrequency(qint64 centerFrequency) final;
|
||||||
std::time_t getStartingTimeStamp() const;
|
std::time_t getStartingTimeStamp() const;
|
||||||
|
|
||||||
virtual bool handleMessage(const Message& message);
|
bool handleMessage(const Message& message) final;
|
||||||
|
|
||||||
virtual int webapiSettingsGet(
|
int webapiSettingsGet(
|
||||||
SWGSDRangel::SWGDeviceSettings& response,
|
SWGSDRangel::SWGDeviceSettings& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage) final;
|
||||||
|
|
||||||
virtual int webapiSettingsPutPatch(
|
int webapiSettingsPutPatch(
|
||||||
bool force,
|
bool force,
|
||||||
const QStringList& deviceSettingsKeys,
|
const QStringList& deviceSettingsKeys,
|
||||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||||
QString& errorMessage);
|
QString& errorMessage) final;
|
||||||
|
|
||||||
virtual int webapiRunGet(
|
int webapiRunGet(
|
||||||
SWGSDRangel::SWGDeviceState& response,
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage) final;
|
||||||
|
|
||||||
virtual int webapiRun(
|
int webapiRun(
|
||||||
bool run,
|
bool run,
|
||||||
SWGSDRangel::SWGDeviceState& response,
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage) final;
|
||||||
|
|
||||||
static void webapiFormatDeviceSettings(
|
static void webapiFormatDeviceSettings(
|
||||||
SWGSDRangel::SWGDeviceSettings& response,
|
SWGSDRangel::SWGDeviceSettings& response,
|
||||||
@ -234,13 +234,13 @@ public:
|
|||||||
private:
|
private:
|
||||||
DeviceAPI *m_deviceAPI;
|
DeviceAPI *m_deviceAPI;
|
||||||
QMutex m_mutex;
|
QMutex m_mutex;
|
||||||
bool m_running;
|
bool m_running = false;
|
||||||
FileOutputSettings m_settings;
|
FileOutputSettings m_settings;
|
||||||
std::ofstream m_ofstream;
|
std::ofstream m_ofstream;
|
||||||
FileOutputWorker* m_fileOutputWorker;
|
FileOutputWorker* m_fileOutputWorker = nullptr;
|
||||||
QThread m_fileOutputWorkerThread;
|
QThread m_fileOutputWorkerThread;
|
||||||
QString m_deviceDescription;
|
QString m_deviceDescription;
|
||||||
qint64 m_startingTimeStamp;
|
qint64 m_startingTimeStamp = 0;
|
||||||
const QTimer& m_masterTimer;
|
const QTimer& m_masterTimer;
|
||||||
QNetworkAccessManager *m_networkManager;
|
QNetworkAccessManager *m_networkManager;
|
||||||
QNetworkRequest m_networkRequest;
|
QNetworkRequest m_networkRequest;
|
||||||
@ -253,7 +253,7 @@ private:
|
|||||||
void webapiReverseSendStartStop(bool start);
|
void webapiReverseSendStartStop(bool start);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void networkManagerFinished(QNetworkReply *reply);
|
void networkManagerFinished(QNetworkReply *reply) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDE_FILEOUTPUT_H
|
#endif // INCLUDE_FILEOUTPUT_H
|
||||||
|
@ -84,7 +84,7 @@ RemoteOutput::~RemoteOutput()
|
|||||||
this,
|
this,
|
||||||
&RemoteOutput::networkManagerFinished
|
&RemoteOutput::networkManagerFinished
|
||||||
);
|
);
|
||||||
stop();
|
RemoteOutput::stop();
|
||||||
delete m_networkManager;
|
delete m_networkManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,21 +211,21 @@ bool RemoteOutput::handleMessage(const Message& message)
|
|||||||
if (MsgConfigureRemoteOutput::match(message))
|
if (MsgConfigureRemoteOutput::match(message))
|
||||||
{
|
{
|
||||||
qDebug() << "RemoteOutput::handleMessage:" << message.getIdentifier();
|
qDebug() << "RemoteOutput::handleMessage:" << message.getIdentifier();
|
||||||
MsgConfigureRemoteOutput& conf = (MsgConfigureRemoteOutput&) message;
|
auto& conf = (const MsgConfigureRemoteOutput&) message;
|
||||||
applySettings(conf.getSettings(), conf.getSettingsKeys(), conf.getForce());
|
applySettings(conf.getSettings(), conf.getSettingsKeys(), conf.getForce());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (MsgConfigureRemoteOutputWork::match(message))
|
else if (MsgConfigureRemoteOutputWork::match(message))
|
||||||
{
|
{
|
||||||
MsgConfigureRemoteOutputWork& conf = (MsgConfigureRemoteOutputWork&) message;
|
auto& conf = (const MsgConfigureRemoteOutputWork&) message;
|
||||||
bool working = conf.isWorking();
|
bool working = conf.isWorking();
|
||||||
|
|
||||||
if (m_remoteOutputWorker != nullptr)
|
if (m_remoteOutputWorker != nullptr)
|
||||||
{
|
{
|
||||||
if (working) {
|
if (working) {
|
||||||
m_remoteOutputWorker->startWork();
|
m_remoteOutputWorker->startWork();
|
||||||
} else {
|
} else {
|
||||||
m_remoteOutputWorker->stopWork();
|
m_remoteOutputWorker->stopWork();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,7 +233,7 @@ bool RemoteOutput::handleMessage(const Message& message)
|
|||||||
}
|
}
|
||||||
else if (MsgStartStop::match(message))
|
else if (MsgStartStop::match(message))
|
||||||
{
|
{
|
||||||
MsgStartStop& cmd = (MsgStartStop&) message;
|
auto& cmd = (const MsgStartStop&) message;
|
||||||
qDebug() << "RemoteOutput::handleMessage: MsgStartStop: " << (cmd.getStartStop() ? "start" : "stop");
|
qDebug() << "RemoteOutput::handleMessage: MsgStartStop: " << (cmd.getStartStop() ? "start" : "stop");
|
||||||
|
|
||||||
if (cmd.getStartStop())
|
if (cmd.getStartStop())
|
||||||
@ -255,13 +255,13 @@ bool RemoteOutput::handleMessage(const Message& message)
|
|||||||
}
|
}
|
||||||
else if (MsgConfigureRemoteOutputChunkCorrection::match(message))
|
else if (MsgConfigureRemoteOutputChunkCorrection::match(message))
|
||||||
{
|
{
|
||||||
MsgConfigureRemoteOutputChunkCorrection& conf = (MsgConfigureRemoteOutputChunkCorrection&) message;
|
auto& conf = (const MsgConfigureRemoteOutputChunkCorrection&) message;
|
||||||
|
|
||||||
if (m_remoteOutputWorker != nullptr) {
|
if (m_remoteOutputWorker != nullptr) {
|
||||||
m_remoteOutputWorker->setChunkCorrection(conf.getChunkCorrection());
|
m_remoteOutputWorker->setChunkCorrection(conf.getChunkCorrection());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (MsgRequestFixedData::match(message))
|
else if (MsgRequestFixedData::match(message))
|
||||||
{
|
{
|
||||||
@ -287,30 +287,23 @@ void RemoteOutput::applySettings(const RemoteOutputSettings& settings, const QLi
|
|||||||
qDebug() << "RemoteOutput::applySettings: force:" << force << settings.getDebugString(settingsKeys, force);
|
qDebug() << "RemoteOutput::applySettings: force:" << force << settings.getDebugString(settingsKeys, force);
|
||||||
QMutexLocker mutexLocker(&m_mutex);
|
QMutexLocker mutexLocker(&m_mutex);
|
||||||
|
|
||||||
if (force ||
|
if ((force ||
|
||||||
settingsKeys.contains("dataAddress") ||
|
settingsKeys.contains("dataAddress") ||
|
||||||
settingsKeys.contains("dataPort"))
|
settingsKeys.contains("dataPort")) && m_remoteOutputWorker)
|
||||||
{
|
{
|
||||||
if (m_remoteOutputWorker) {
|
m_remoteOutputWorker->setDataAddress(settings.m_dataAddress, settings.m_dataPort);
|
||||||
m_remoteOutputWorker->setDataAddress(settings.m_dataAddress, settings.m_dataPort);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (force || settingsKeys.contains("nbFECBlocks"))
|
if ((force || settingsKeys.contains("nbFECBlocks")) && m_remoteOutputWorker)
|
||||||
{
|
{
|
||||||
if (m_remoteOutputWorker) {
|
m_remoteOutputWorker->setNbBlocksFEC(settings.m_nbFECBlocks);
|
||||||
m_remoteOutputWorker->setNbBlocksFEC(settings.m_nbFECBlocks);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (force || settingsKeys.contains("nbTxBytes"))
|
if ((force || settingsKeys.contains("nbTxBytes")) && m_remoteOutputWorker)
|
||||||
{
|
{
|
||||||
if (m_remoteOutputWorker)
|
stopWorker();
|
||||||
{
|
m_remoteOutputWorker->setNbTxBytes(settings.m_nbTxBytes);
|
||||||
stopWorker();
|
startWorker();
|
||||||
m_remoteOutputWorker->setNbTxBytes(settings.m_nbTxBytes);
|
|
||||||
startWorker();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mutexLocker.unlock();
|
mutexLocker.unlock();
|
||||||
@ -333,7 +326,7 @@ void RemoteOutput::applySettings(const RemoteOutputSettings& settings, const QLi
|
|||||||
|
|
||||||
void RemoteOutput::applyCenterFrequency()
|
void RemoteOutput::applyCenterFrequency()
|
||||||
{
|
{
|
||||||
DSPSignalNotification *notif = new DSPSignalNotification(m_sampleRate, m_centerFrequency);
|
auto *notif = new DSPSignalNotification(m_sampleRate, m_centerFrequency);
|
||||||
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
|
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -344,10 +337,11 @@ void RemoteOutput::applySampleRate()
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_tickMultiplier = 480000 / m_sampleRate;
|
m_tickMultiplier = 480000 / m_sampleRate;
|
||||||
m_tickMultiplier = m_tickMultiplier < 1 ? 1 : m_tickMultiplier > 10 ? 10 : m_tickMultiplier;
|
m_tickMultiplier = m_tickMultiplier < 1 ? 1 : m_tickMultiplier;
|
||||||
|
m_tickMultiplier = m_tickMultiplier > 10 ? 10 : m_tickMultiplier;
|
||||||
m_greaterTickCount = 0;
|
m_greaterTickCount = 0;
|
||||||
|
|
||||||
DSPSignalNotification *notif = new DSPSignalNotification(m_sampleRate, m_centerFrequency);
|
auto *notif = new DSPSignalNotification(m_sampleRate, m_centerFrequency);
|
||||||
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
|
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -428,13 +422,13 @@ void RemoteOutput::webapiUpdateDeviceSettings(
|
|||||||
settings.m_apiAddress = *response.getRemoteOutputSettings()->getApiAddress();
|
settings.m_apiAddress = *response.getRemoteOutputSettings()->getApiAddress();
|
||||||
}
|
}
|
||||||
if (deviceSettingsKeys.contains("apiPort")) {
|
if (deviceSettingsKeys.contains("apiPort")) {
|
||||||
settings.m_apiPort = response.getRemoteOutputSettings()->getApiPort();
|
settings.m_apiPort = (quint16) response.getRemoteOutputSettings()->getApiPort();
|
||||||
}
|
}
|
||||||
if (deviceSettingsKeys.contains("dataAddress")) {
|
if (deviceSettingsKeys.contains("dataAddress")) {
|
||||||
settings.m_dataAddress = *response.getRemoteOutputSettings()->getDataAddress();
|
settings.m_dataAddress = *response.getRemoteOutputSettings()->getDataAddress();
|
||||||
}
|
}
|
||||||
if (deviceSettingsKeys.contains("dataPort")) {
|
if (deviceSettingsKeys.contains("dataPort")) {
|
||||||
settings.m_dataPort = response.getRemoteOutputSettings()->getDataPort();
|
settings.m_dataPort = (quint16) response.getRemoteOutputSettings()->getDataPort();
|
||||||
}
|
}
|
||||||
if (deviceSettingsKeys.contains("deviceIndex")) {
|
if (deviceSettingsKeys.contains("deviceIndex")) {
|
||||||
settings.m_deviceIndex = response.getRemoteOutputSettings()->getDeviceIndex();
|
settings.m_deviceIndex = response.getRemoteOutputSettings()->getDeviceIndex();
|
||||||
@ -449,10 +443,10 @@ void RemoteOutput::webapiUpdateDeviceSettings(
|
|||||||
settings.m_reverseAPIAddress = *response.getRemoteOutputSettings()->getReverseApiAddress();
|
settings.m_reverseAPIAddress = *response.getRemoteOutputSettings()->getReverseApiAddress();
|
||||||
}
|
}
|
||||||
if (deviceSettingsKeys.contains("reverseAPIPort")) {
|
if (deviceSettingsKeys.contains("reverseAPIPort")) {
|
||||||
settings.m_reverseAPIPort = response.getRemoteOutputSettings()->getReverseApiPort();
|
settings.m_reverseAPIPort = (quint16) response.getRemoteOutputSettings()->getReverseApiPort();
|
||||||
}
|
}
|
||||||
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||||
settings.m_reverseAPIDeviceIndex = response.getRemoteOutputSettings()->getReverseApiDeviceIndex();
|
settings.m_reverseAPIDeviceIndex = (uint16_t) response.getRemoteOutputSettings()->getReverseApiDeviceIndex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -489,10 +483,10 @@ void RemoteOutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& re
|
|||||||
response.getRemoteOutputSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex);
|
response.getRemoteOutputSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteOutput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response)
|
void RemoteOutput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response) const
|
||||||
{
|
{
|
||||||
uint64_t nowus = TimeUtil::nowus();
|
uint64_t nowus = TimeUtil::nowus();
|
||||||
response.getRemoteOutputReport()->setTvSec(nowus / 1000000U);
|
response.getRemoteOutputReport()->setTvSec((qint32) (nowus / 1000000U));
|
||||||
response.getRemoteOutputReport()->setTvUSec(nowus % 1000000U);
|
response.getRemoteOutputReport()->setTvUSec(nowus % 1000000U);
|
||||||
response.getRemoteOutputReport()->setCenterFrequency(m_centerFrequency);
|
response.getRemoteOutputReport()->setCenterFrequency(m_centerFrequency);
|
||||||
response.getRemoteOutputReport()->setSampleRate(m_sampleRate);
|
response.getRemoteOutputReport()->setSampleRate(m_sampleRate);
|
||||||
@ -666,7 +660,7 @@ void RemoteOutput::queueLengthCompensation(
|
|||||||
|
|
||||||
void RemoteOutput::webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const RemoteOutputSettings& settings, bool force)
|
void RemoteOutput::webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const RemoteOutputSettings& settings, bool force)
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
auto *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
||||||
swgDeviceSettings->setDirection(1); // single Tx
|
swgDeviceSettings->setDirection(1); // single Tx
|
||||||
swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex());
|
swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex());
|
||||||
swgDeviceSettings->setDeviceHwType(new QString("RemoteOutput"));
|
swgDeviceSettings->setDeviceHwType(new QString("RemoteOutput"));
|
||||||
@ -707,8 +701,8 @@ void RemoteOutput::webapiReverseSendSettings(const QList<QString>& deviceSetting
|
|||||||
m_networkRequest.setUrl(QUrl(deviceSettingsURL));
|
m_networkRequest.setUrl(QUrl(deviceSettingsURL));
|
||||||
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||||
|
|
||||||
QBuffer *buffer = new QBuffer();
|
auto *buffer = new QBuffer();
|
||||||
buffer->open((QBuffer::ReadWrite));
|
buffer->open(QBuffer::ReadWrite);
|
||||||
buffer->write(swgDeviceSettings->asJson().toUtf8());
|
buffer->write(swgDeviceSettings->asJson().toUtf8());
|
||||||
buffer->seek(0);
|
buffer->seek(0);
|
||||||
|
|
||||||
@ -721,7 +715,7 @@ void RemoteOutput::webapiReverseSendSettings(const QList<QString>& deviceSetting
|
|||||||
|
|
||||||
void RemoteOutput::webapiReverseSendStartStop(bool start)
|
void RemoteOutput::webapiReverseSendStartStop(bool start)
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
auto *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
||||||
swgDeviceSettings->setDirection(1); // single Tx
|
swgDeviceSettings->setDirection(1); // single Tx
|
||||||
swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex());
|
swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex());
|
||||||
swgDeviceSettings->setDeviceHwType(new QString("RemoteOutput"));
|
swgDeviceSettings->setDeviceHwType(new QString("RemoteOutput"));
|
||||||
@ -733,8 +727,8 @@ void RemoteOutput::webapiReverseSendStartStop(bool start)
|
|||||||
m_networkRequest.setUrl(QUrl(deviceSettingsURL));
|
m_networkRequest.setUrl(QUrl(deviceSettingsURL));
|
||||||
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||||
|
|
||||||
QBuffer *buffer = new QBuffer();
|
auto *buffer = new QBuffer();
|
||||||
buffer->open((QBuffer::ReadWrite));
|
buffer->open(QBuffer::ReadWrite);
|
||||||
buffer->write(swgDeviceSettings->asJson().toUtf8());
|
buffer->write(swgDeviceSettings->asJson().toUtf8());
|
||||||
buffer->seek(0);
|
buffer->seek(0);
|
||||||
QNetworkReply *reply;
|
QNetworkReply *reply;
|
||||||
|
@ -83,7 +83,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
bool m_working;
|
bool m_working;
|
||||||
|
|
||||||
MsgConfigureRemoteOutputWork(bool working) :
|
explicit MsgConfigureRemoteOutputWork(bool working) :
|
||||||
Message(),
|
Message(),
|
||||||
m_working(working)
|
m_working(working)
|
||||||
{ }
|
{ }
|
||||||
@ -99,10 +99,10 @@ public:
|
|||||||
return new MsgStartStop(startStop);
|
return new MsgStartStop(startStop);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
bool m_startStop;
|
bool m_startStop;
|
||||||
|
|
||||||
MsgStartStop(bool startStop) :
|
explicit MsgStartStop(bool startStop) :
|
||||||
Message(),
|
Message(),
|
||||||
m_startStop(startStop)
|
m_startStop(startStop)
|
||||||
{ }
|
{ }
|
||||||
@ -122,7 +122,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
int m_chunkCorrection;
|
int m_chunkCorrection;
|
||||||
|
|
||||||
MsgConfigureRemoteOutputChunkCorrection(int chunkCorrection) :
|
explicit MsgConfigureRemoteOutputChunkCorrection(int chunkCorrection) :
|
||||||
Message(),
|
Message(),
|
||||||
m_chunkCorrection(chunkCorrection)
|
m_chunkCorrection(chunkCorrection)
|
||||||
{ }
|
{ }
|
||||||
@ -153,7 +153,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
RemoteData m_remoteData;
|
RemoteData m_remoteData;
|
||||||
|
|
||||||
MsgReportRemoteData(const RemoteData& remoteData) :
|
explicit MsgReportRemoteData(const RemoteData& remoteData) :
|
||||||
Message(),
|
Message(),
|
||||||
m_remoteData(remoteData)
|
m_remoteData(remoteData)
|
||||||
{}
|
{}
|
||||||
@ -182,7 +182,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
RemoteData m_remoteData;
|
RemoteData m_remoteData;
|
||||||
|
|
||||||
MsgReportRemoteFixedData(const RemoteData& remoteData) :
|
explicit MsgReportRemoteFixedData(const RemoteData& remoteData) :
|
||||||
Message(),
|
Message(),
|
||||||
m_remoteData(remoteData)
|
m_remoteData(remoteData)
|
||||||
{}
|
{}
|
||||||
@ -203,58 +203,58 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
RemoteOutput(DeviceAPI *deviceAPI);
|
explicit RemoteOutput(DeviceAPI *deviceAPI);
|
||||||
virtual ~RemoteOutput();
|
~RemoteOutput() final;
|
||||||
virtual void destroy();
|
void destroy() final;
|
||||||
|
|
||||||
virtual void init();
|
void init() final;
|
||||||
virtual bool start();
|
bool start() final;
|
||||||
virtual void stop();
|
void stop() final;
|
||||||
|
|
||||||
virtual QByteArray serialize() const;
|
QByteArray serialize() const final;
|
||||||
virtual bool deserialize(const QByteArray& data);
|
bool deserialize(const QByteArray& data) final;
|
||||||
|
|
||||||
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
|
void setMessageQueueToGUI(MessageQueue *queue) final { m_guiMessageQueue = queue; }
|
||||||
virtual const QString& getDeviceDescription() const;
|
const QString& getDeviceDescription() const final;
|
||||||
virtual int getSampleRate() const;
|
int getSampleRate() const final;
|
||||||
virtual void setSampleRate(int sampleRate) { (void) sampleRate; }
|
void setSampleRate(int sampleRate) final { (void) sampleRate; }
|
||||||
virtual quint64 getCenterFrequency() const;
|
quint64 getCenterFrequency() const final;
|
||||||
virtual void setCenterFrequency(qint64 centerFrequency) { (void) centerFrequency; }
|
void setCenterFrequency(qint64 centerFrequency) final { (void) centerFrequency; }
|
||||||
std::time_t getStartingTimeStamp() const;
|
std::time_t getStartingTimeStamp() const;
|
||||||
|
|
||||||
virtual bool handleMessage(const Message& message);
|
bool handleMessage(const Message& message) final;
|
||||||
|
|
||||||
virtual int webapiSettingsGet(
|
int webapiSettingsGet(
|
||||||
SWGSDRangel::SWGDeviceSettings& response,
|
SWGSDRangel::SWGDeviceSettings& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage) final;
|
||||||
|
|
||||||
virtual int webapiSettingsPutPatch(
|
int webapiSettingsPutPatch(
|
||||||
bool force,
|
bool force,
|
||||||
const QStringList& deviceSettingsKeys,
|
const QStringList& deviceSettingsKeys,
|
||||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||||
QString& errorMessage);
|
QString& errorMessage) final;
|
||||||
|
|
||||||
virtual int webapiReportGet(
|
int webapiReportGet(
|
||||||
SWGSDRangel::SWGDeviceReport& response,
|
SWGSDRangel::SWGDeviceReport& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage) final;
|
||||||
|
|
||||||
virtual int webapiRunGet(
|
int webapiRunGet(
|
||||||
SWGSDRangel::SWGDeviceState& response,
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage) final;
|
||||||
|
|
||||||
virtual int webapiRun(
|
int webapiRun(
|
||||||
bool run,
|
bool run,
|
||||||
SWGSDRangel::SWGDeviceState& response,
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage) final;
|
||||||
|
|
||||||
static void webapiFormatDeviceSettings(
|
static void webapiFormatDeviceSettings(
|
||||||
SWGSDRangel::SWGDeviceSettings& response,
|
SWGSDRangel::SWGDeviceSettings& response,
|
||||||
const RemoteOutputSettings& settings);
|
const RemoteOutputSettings& settings);
|
||||||
|
|
||||||
static void webapiUpdateDeviceSettings(
|
static void webapiUpdateDeviceSettings(
|
||||||
RemoteOutputSettings& settings,
|
RemoteOutputSettings& settings,
|
||||||
const QStringList& deviceSettingsKeys,
|
const QStringList& deviceSettingsKeys,
|
||||||
SWGSDRangel::SWGDeviceSettings& response);
|
SWGSDRangel::SWGDeviceSettings& response);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DeviceAPI *m_deviceAPI;
|
DeviceAPI *m_deviceAPI;
|
||||||
@ -284,7 +284,7 @@ private:
|
|||||||
void applySettings(const RemoteOutputSettings& settings, const QList<QString>& settingsKeys, bool force = false);
|
void applySettings(const RemoteOutputSettings& settings, const QList<QString>& settingsKeys, bool force = false);
|
||||||
void applyCenterFrequency();
|
void applyCenterFrequency();
|
||||||
void applySampleRate();
|
void applySampleRate();
|
||||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response) const;
|
||||||
|
|
||||||
void analyzeApiReply(const QJsonObject& jsonObject, const QString& answer);
|
void analyzeApiReply(const QJsonObject& jsonObject, const QString& answer);
|
||||||
void queueLengthCompensation(
|
void queueLengthCompensation(
|
||||||
|
@ -40,7 +40,7 @@ MESSAGE_CLASS_DEFINITION(Bladerf1Input::MsgStartStop, Message)
|
|||||||
Bladerf1Input::Bladerf1Input(DeviceAPI *deviceAPI) :
|
Bladerf1Input::Bladerf1Input(DeviceAPI *deviceAPI) :
|
||||||
m_deviceAPI(deviceAPI),
|
m_deviceAPI(deviceAPI),
|
||||||
m_settings(),
|
m_settings(),
|
||||||
m_dev(0),
|
m_dev(nullptr),
|
||||||
m_bladerfThread(nullptr),
|
m_bladerfThread(nullptr),
|
||||||
m_deviceDescription("BladeRFInput"),
|
m_deviceDescription("BladeRFInput"),
|
||||||
m_running(false)
|
m_running(false)
|
||||||
@ -70,11 +70,11 @@ Bladerf1Input::~Bladerf1Input()
|
|||||||
delete m_networkManager;
|
delete m_networkManager;
|
||||||
|
|
||||||
if (m_running) {
|
if (m_running) {
|
||||||
stop();
|
Bladerf1Input::stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
closeDevice();
|
closeDevice();
|
||||||
m_deviceAPI->setBuddySharedPtr(0);
|
m_deviceAPI->setBuddySharedPtr(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bladerf1Input::destroy()
|
void Bladerf1Input::destroy()
|
||||||
@ -84,7 +84,7 @@ void Bladerf1Input::destroy()
|
|||||||
|
|
||||||
bool Bladerf1Input::openDevice()
|
bool Bladerf1Input::openDevice()
|
||||||
{
|
{
|
||||||
if (m_dev != 0)
|
if (m_dev != nullptr)
|
||||||
{
|
{
|
||||||
closeDevice();
|
closeDevice();
|
||||||
}
|
}
|
||||||
@ -97,24 +97,24 @@ bool Bladerf1Input::openDevice()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_deviceAPI->getSinkBuddies().size() > 0)
|
if (!m_deviceAPI->getSinkBuddies().empty())
|
||||||
{
|
{
|
||||||
DeviceAPI *sinkBuddy = m_deviceAPI->getSinkBuddies()[0];
|
const DeviceAPI *sinkBuddy = m_deviceAPI->getSinkBuddies()[0];
|
||||||
DeviceBladeRF1Params *buddySharedParams = (DeviceBladeRF1Params *) sinkBuddy->getBuddySharedPtr();
|
const DeviceBladeRF1Params *buddySharedParams = (DeviceBladeRF1Params *) sinkBuddy->getBuddySharedPtr();
|
||||||
|
|
||||||
if (buddySharedParams == 0)
|
if (buddySharedParams == nullptr)
|
||||||
{
|
{
|
||||||
qCritical("BladerfInput::openDevice: could not get shared parameters from buddy");
|
qCritical("BladerfInput::openDevice: could not get shared parameters from buddy");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buddySharedParams->m_dev == 0) // device is not opened by buddy
|
if (buddySharedParams->m_dev == nullptr) // device is not opened by buddy
|
||||||
{
|
{
|
||||||
qCritical("BladerfInput::openDevice: could not get BladeRF handle from buddy");
|
qCritical("BladerfInput::openDevice: could not get BladeRF handle from buddy");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sharedParams = *(buddySharedParams); // copy parameters from buddy
|
m_sharedParams = *buddySharedParams; // copy parameters from buddy
|
||||||
m_dev = m_sharedParams.m_dev; // get BladeRF handle
|
m_dev = m_sharedParams.m_dev; // get BladeRF handle
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -128,7 +128,6 @@ bool Bladerf1Input::openDevice()
|
|||||||
m_sharedParams.m_dev = m_dev;
|
m_sharedParams.m_dev = m_dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: adjust USB transfer data according to sample rate
|
|
||||||
if ((res = bladerf_sync_config(m_dev, BLADERF_RX_X1, BLADERF_FORMAT_SC16_Q11, 64, 8192, 32, 10000)) < 0)
|
if ((res = bladerf_sync_config(m_dev, BLADERF_RX_X1, BLADERF_FORMAT_SC16_Q11, 64, 8192, 32, 10000)) < 0)
|
||||||
{
|
{
|
||||||
qCritical("BladerfInput::start: bladerf_sync_config with return code %d", res);
|
qCritical("BladerfInput::start: bladerf_sync_config with return code %d", res);
|
||||||
@ -182,7 +181,7 @@ void Bladerf1Input::closeDevice()
|
|||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
if (m_dev == 0) { // was never open
|
if (m_dev == nullptr) { // was never open
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,7 +190,7 @@ void Bladerf1Input::closeDevice()
|
|||||||
qCritical("BladerfInput::stop: bladerf_enable_module with return code %d", res);
|
qCritical("BladerfInput::stop: bladerf_enable_module with return code %d", res);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_deviceAPI->getSinkBuddies().size() == 0)
|
if (m_deviceAPI->getSinkBuddies().empty())
|
||||||
{
|
{
|
||||||
qDebug("BladerfInput::closeDevice: closing device since Tx side is not open");
|
qDebug("BladerfInput::closeDevice: closing device since Tx side is not open");
|
||||||
|
|
||||||
@ -286,7 +285,7 @@ bool Bladerf1Input::handleMessage(const Message& message)
|
|||||||
{
|
{
|
||||||
if (MsgConfigureBladerf1::match(message))
|
if (MsgConfigureBladerf1::match(message))
|
||||||
{
|
{
|
||||||
MsgConfigureBladerf1& conf = (MsgConfigureBladerf1&) message;
|
auto& conf = (const MsgConfigureBladerf1&) message;
|
||||||
qDebug() << "Bladerf1Input::handleMessage: MsgConfigureBladerf1";
|
qDebug() << "Bladerf1Input::handleMessage: MsgConfigureBladerf1";
|
||||||
|
|
||||||
if (!applySettings(conf.getSettings(), conf.getSettingsKeys(), conf.getForce())) {
|
if (!applySettings(conf.getSettings(), conf.getSettingsKeys(), conf.getForce())) {
|
||||||
@ -297,7 +296,7 @@ bool Bladerf1Input::handleMessage(const Message& message)
|
|||||||
}
|
}
|
||||||
else if (MsgStartStop::match(message))
|
else if (MsgStartStop::match(message))
|
||||||
{
|
{
|
||||||
MsgStartStop& cmd = (MsgStartStop&) message;
|
auto& cmd = (const MsgStartStop&) message;
|
||||||
qDebug() << "BladerfInput::handleMessage: MsgStartStop: " << (cmd.getStartStop() ? "start" : "stop");
|
qDebug() << "BladerfInput::handleMessage: MsgStartStop: " << (cmd.getStartStop() ? "start" : "stop");
|
||||||
|
|
||||||
if (cmd.getStartStop())
|
if (cmd.getStartStop())
|
||||||
@ -326,126 +325,107 @@ bool Bladerf1Input::handleMessage(const Message& message)
|
|||||||
bool Bladerf1Input::applySettings(const BladeRF1InputSettings& settings, const QList<QString>& settingsKeys, bool force)
|
bool Bladerf1Input::applySettings(const BladeRF1InputSettings& settings, const QList<QString>& settingsKeys, bool force)
|
||||||
{
|
{
|
||||||
bool forwardChange = false;
|
bool forwardChange = false;
|
||||||
// QMutexLocker mutexLocker(&m_mutex);
|
|
||||||
|
|
||||||
qDebug() << "BladerfInput::applySettings: force: " << force << settings.getDebugString(settingsKeys, force);
|
qDebug() << "BladerfInput::applySettings: force: " << force << settings.getDebugString(settingsKeys, force);
|
||||||
|
|
||||||
if ((settingsKeys.contains("dcBlock")) ||
|
if ((settingsKeys.contains("dcBlock")) ||
|
||||||
settingsKeys.contains("iqCorrection") || force)
|
settingsKeys.contains("iqCorrection") || force)
|
||||||
{
|
{
|
||||||
m_deviceAPI->configureCorrections(settings.m_dcBlock, settings.m_iqCorrection);
|
m_deviceAPI->configureCorrections(settings.m_dcBlock, settings.m_iqCorrection);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settingsKeys.contains("lnaGain") || force)
|
if ((m_dev != nullptr) && (settingsKeys.contains("lnaGain") || force))
|
||||||
{
|
{
|
||||||
if (m_dev != 0)
|
if(bladerf_set_lna_gain(m_dev, getLnaGain(settings.m_lnaGain)) != 0) {
|
||||||
{
|
qDebug("BladerfInput::applySettings: bladerf_set_lna_gain() failed");
|
||||||
if(bladerf_set_lna_gain(m_dev, getLnaGain(settings.m_lnaGain)) != 0) {
|
} else {
|
||||||
qDebug("BladerfInput::applySettings: bladerf_set_lna_gain() failed");
|
qDebug() << "BladerfInput::applySettings: LNA gain set to " << getLnaGain(settings.m_lnaGain);
|
||||||
} else {
|
}
|
||||||
qDebug() << "BladerfInput::applySettings: LNA gain set to " << getLnaGain(settings.m_lnaGain);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settingsKeys.contains("vga1") || force)
|
if ((m_dev != nullptr) && (settingsKeys.contains("vga1") || force))
|
||||||
{
|
{
|
||||||
if (m_dev != 0)
|
if(bladerf_set_rxvga1(m_dev, settings.m_vga1) != 0) {
|
||||||
{
|
qDebug("BladerfInput::applySettings: bladerf_set_rxvga1() failed");
|
||||||
if(bladerf_set_rxvga1(m_dev, settings.m_vga1) != 0) {
|
} else {
|
||||||
qDebug("BladerfInput::applySettings: bladerf_set_rxvga1() failed");
|
qDebug() << "BladerfInput::applySettings: VGA1 gain set to " << settings.m_vga1;
|
||||||
} else {
|
}
|
||||||
qDebug() << "BladerfInput::applySettings: VGA1 gain set to " << settings.m_vga1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settingsKeys.contains("vga2") || force)
|
if ((m_dev != nullptr) && (settingsKeys.contains("vga2") || force))
|
||||||
{
|
{
|
||||||
if(m_dev != 0)
|
if(bladerf_set_rxvga2(m_dev, settings.m_vga2) != 0) {
|
||||||
{
|
qDebug("BladerfInput::applySettings: bladerf_set_rxvga2() failed");
|
||||||
if(bladerf_set_rxvga2(m_dev, settings.m_vga2) != 0) {
|
} else {
|
||||||
qDebug("BladerfInput::applySettings: bladerf_set_rxvga2() failed");
|
qDebug() << "BladerfInput::applySettings: VGA2 gain set to " << settings.m_vga2;
|
||||||
} else {
|
}
|
||||||
qDebug() << "BladerfInput::applySettings: VGA2 gain set to " << settings.m_vga2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settingsKeys.contains("xb200") || force)
|
if ((m_dev != nullptr) && (settingsKeys.contains("xb200") || force))
|
||||||
{
|
{
|
||||||
if (m_dev != 0)
|
bool changeSettings;
|
||||||
{
|
|
||||||
bool changeSettings;
|
|
||||||
|
|
||||||
if (m_deviceAPI->getSinkBuddies().size() > 0)
|
if (!m_deviceAPI->getSinkBuddies().empty())
|
||||||
{
|
{
|
||||||
DeviceAPI *buddy = m_deviceAPI->getSinkBuddies()[0];
|
DeviceAPI *buddy = m_deviceAPI->getSinkBuddies()[0];
|
||||||
|
|
||||||
if (buddy->getDeviceSinkEngine()->state() == DSPDeviceSinkEngine::StRunning) { // Tx side running
|
if (buddy->getDeviceSinkEngine()->state() == DSPDeviceSinkEngine::State::StRunning) { // Tx side running
|
||||||
changeSettings = false;
|
changeSettings = false;
|
||||||
} else {
|
} else {
|
||||||
changeSettings = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else // No Tx open
|
|
||||||
{
|
|
||||||
changeSettings = true;
|
changeSettings = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else // No Tx open
|
||||||
|
{
|
||||||
|
changeSettings = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (changeSettings)
|
if (changeSettings)
|
||||||
{
|
{
|
||||||
if (settings.m_xb200)
|
if (settings.m_xb200)
|
||||||
{
|
{
|
||||||
if (bladerf_expansion_attach(m_dev, BLADERF_XB_200) != 0) {
|
if (bladerf_expansion_attach(m_dev, BLADERF_XB_200) != 0) {
|
||||||
qDebug("BladerfInput::applySettings: bladerf_expansion_attach(xb200) failed");
|
qDebug("BladerfInput::applySettings: bladerf_expansion_attach(xb200) failed");
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "BladerfInput::applySettings: Attach XB200";
|
qDebug() << "BladerfInput::applySettings: Attach XB200";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (bladerf_expansion_attach(m_dev, BLADERF_XB_NONE) != 0) {
|
if (bladerf_expansion_attach(m_dev, BLADERF_XB_NONE) != 0) {
|
||||||
qDebug("BladerfInput::applySettings: bladerf_expansion_attach(none) failed");
|
qDebug("BladerfInput::applySettings: bladerf_expansion_attach(none) failed");
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "BladerfInput::applySettings: Detach XB200";
|
qDebug() << "BladerfInput::applySettings: Detach XB200";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sharedParams.m_xb200Attached = settings.m_xb200;
|
m_sharedParams.m_xb200Attached = settings.m_xb200;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settingsKeys.contains("xb200Path") || force)
|
if ((m_dev != nullptr) && (settingsKeys.contains("xb200Path") || force))
|
||||||
{
|
{
|
||||||
if (m_dev != 0)
|
if(bladerf_xb200_set_path(m_dev, BLADERF_MODULE_RX, settings.m_xb200Path) != 0) {
|
||||||
{
|
qDebug("BladerfInput::applySettings: bladerf_xb200_set_path(BLADERF_MODULE_RX) failed");
|
||||||
if(bladerf_xb200_set_path(m_dev, BLADERF_MODULE_RX, settings.m_xb200Path) != 0) {
|
} else {
|
||||||
qDebug("BladerfInput::applySettings: bladerf_xb200_set_path(BLADERF_MODULE_RX) failed");
|
qDebug() << "BladerfInput::applySettings: set xb200 path to " << settings.m_xb200Path;
|
||||||
} else {
|
}
|
||||||
qDebug() << "BladerfInput::applySettings: set xb200 path to " << settings.m_xb200Path;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settingsKeys.contains("xb200Filter") || force)
|
if ((m_dev != nullptr) && (settingsKeys.contains("xb200Filter") || force))
|
||||||
{
|
{
|
||||||
if (m_dev != 0)
|
if(bladerf_xb200_set_filterbank(m_dev, BLADERF_MODULE_RX, settings.m_xb200Filter) != 0) {
|
||||||
{
|
qDebug("BladerfInput::applySettings: bladerf_xb200_set_filterbank(BLADERF_MODULE_RX) failed");
|
||||||
if(bladerf_xb200_set_filterbank(m_dev, BLADERF_MODULE_RX, settings.m_xb200Filter) != 0) {
|
} else {
|
||||||
qDebug("BladerfInput::applySettings: bladerf_xb200_set_filterbank(BLADERF_MODULE_RX) failed");
|
qDebug() << "BladerfInput::applySettings: set xb200 filter to " << settings.m_xb200Filter;
|
||||||
} else {
|
}
|
||||||
qDebug() << "BladerfInput::applySettings: set xb200 filter to " << settings.m_xb200Filter;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settingsKeys.contains("devSampleRate") || force)
|
if (settingsKeys.contains("devSampleRate") || force)
|
||||||
{
|
{
|
||||||
forwardChange = true;
|
forwardChange = true;
|
||||||
|
|
||||||
if (m_dev != 0)
|
if (m_dev != nullptr)
|
||||||
{
|
{
|
||||||
unsigned int actualSamplerate;
|
unsigned int actualSamplerate;
|
||||||
|
|
||||||
@ -457,27 +437,21 @@ bool Bladerf1Input::applySettings(const BladeRF1InputSettings& settings, const Q
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settingsKeys.contains("bandwidth") || force)
|
if ((m_dev != nullptr) && (settingsKeys.contains("bandwidth") || force))
|
||||||
{
|
{
|
||||||
if(m_dev != 0)
|
unsigned int actualBandwidth;
|
||||||
{
|
|
||||||
unsigned int actualBandwidth;
|
|
||||||
|
|
||||||
if( bladerf_set_bandwidth(m_dev, BLADERF_MODULE_RX, settings.m_bandwidth, &actualBandwidth) < 0) {
|
if( bladerf_set_bandwidth(m_dev, BLADERF_MODULE_RX, settings.m_bandwidth, &actualBandwidth) < 0) {
|
||||||
qCritical("BladerfInput::applySettings: could not set bandwidth: %d", settings.m_bandwidth);
|
qCritical("BladerfInput::applySettings: could not set bandwidth: %d", settings.m_bandwidth);
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "BladerfInput::applySettings: bladerf_set_bandwidth(BLADERF_MODULE_RX) actual bandwidth is " << actualBandwidth;
|
qDebug() << "BladerfInput::applySettings: bladerf_set_bandwidth(BLADERF_MODULE_RX) actual bandwidth is " << actualBandwidth;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settingsKeys.contains("fcPos") || force)
|
if (m_bladerfThread && (settingsKeys.contains("fcPos") || force))
|
||||||
{
|
{
|
||||||
if (m_bladerfThread)
|
m_bladerfThread->setFcPos((int) settings.m_fcPos);
|
||||||
{
|
qDebug() << "BladerfInput::applySettings: set fc pos (enum) to " << (int) settings.m_fcPos;
|
||||||
m_bladerfThread->setFcPos((int) settings.m_fcPos);
|
|
||||||
qDebug() << "BladerfInput::applySettings: set fc pos (enum) to " << (int) settings.m_fcPos;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settingsKeys.contains("log2Decim") || force)
|
if (settingsKeys.contains("log2Decim") || force)
|
||||||
@ -491,11 +465,9 @@ bool Bladerf1Input::applySettings(const BladeRF1InputSettings& settings, const Q
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settingsKeys.contains("iqOrder") || force)
|
if (m_bladerfThread && (settingsKeys.contains("iqOrder") || force))
|
||||||
{
|
{
|
||||||
if (m_bladerfThread) {
|
m_bladerfThread->setIQOrder(settings.m_iqOrder);
|
||||||
m_bladerfThread->setIQOrder(settings.m_iqOrder);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settingsKeys.contains("centerFrequency")
|
if (settingsKeys.contains("centerFrequency")
|
||||||
@ -514,7 +486,7 @@ bool Bladerf1Input::applySettings(const BladeRF1InputSettings& settings, const Q
|
|||||||
|
|
||||||
forwardChange = true;
|
forwardChange = true;
|
||||||
|
|
||||||
if (m_dev != 0)
|
if (m_dev != nullptr)
|
||||||
{
|
{
|
||||||
if (bladerf_set_frequency( m_dev, BLADERF_MODULE_RX, deviceCenterFrequency ) != 0) {
|
if (bladerf_set_frequency( m_dev, BLADERF_MODULE_RX, deviceCenterFrequency ) != 0) {
|
||||||
qWarning("BladerfInput::applySettings: bladerf_set_frequency(%lld) failed", settings.m_centerFrequency);
|
qWarning("BladerfInput::applySettings: bladerf_set_frequency(%lld) failed", settings.m_centerFrequency);
|
||||||
@ -527,7 +499,7 @@ bool Bladerf1Input::applySettings(const BladeRF1InputSettings& settings, const Q
|
|||||||
if (forwardChange)
|
if (forwardChange)
|
||||||
{
|
{
|
||||||
int sampleRate = settings.m_devSampleRate/(1<<settings.m_log2Decim);
|
int sampleRate = settings.m_devSampleRate/(1<<settings.m_log2Decim);
|
||||||
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, settings.m_centerFrequency);
|
auto *notif = new DSPSignalNotification(sampleRate, settings.m_centerFrequency);
|
||||||
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
|
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -549,7 +521,7 @@ bool Bladerf1Input::applySettings(const BladeRF1InputSettings& settings, const Q
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bladerf_lna_gain Bladerf1Input::getLnaGain(int lnaGain)
|
bladerf_lna_gain Bladerf1Input::getLnaGain(int lnaGain) const
|
||||||
{
|
{
|
||||||
if (lnaGain == 2) {
|
if (lnaGain == 2) {
|
||||||
return BLADERF_LNA_GAIN_MAX;
|
return BLADERF_LNA_GAIN_MAX;
|
||||||
@ -656,7 +628,7 @@ void Bladerf1Input::webapiUpdateDeviceSettings(
|
|||||||
settings.m_fcPos = static_cast<BladeRF1InputSettings::fcPos_t>(response.getBladeRf1InputSettings()->getFcPos());
|
settings.m_fcPos = static_cast<BladeRF1InputSettings::fcPos_t>(response.getBladeRf1InputSettings()->getFcPos());
|
||||||
}
|
}
|
||||||
if (deviceSettingsKeys.contains("xb200")) {
|
if (deviceSettingsKeys.contains("xb200")) {
|
||||||
settings.m_xb200 = response.getBladeRf1InputSettings()->getXb200() == 0 ? 0 : 1;
|
settings.m_xb200 = response.getBladeRf1InputSettings()->getXb200() == 0 ? false : true;
|
||||||
}
|
}
|
||||||
if (deviceSettingsKeys.contains("xb200Path")) {
|
if (deviceSettingsKeys.contains("xb200Path")) {
|
||||||
settings.m_xb200Path = static_cast<bladerf_xb200_path>(response.getBladeRf1InputSettings()->getXb200Path());
|
settings.m_xb200Path = static_cast<bladerf_xb200_path>(response.getBladeRf1InputSettings()->getXb200Path());
|
||||||
@ -677,10 +649,10 @@ void Bladerf1Input::webapiUpdateDeviceSettings(
|
|||||||
settings.m_reverseAPIAddress = *response.getBladeRf1InputSettings()->getReverseApiAddress();
|
settings.m_reverseAPIAddress = *response.getBladeRf1InputSettings()->getReverseApiAddress();
|
||||||
}
|
}
|
||||||
if (deviceSettingsKeys.contains("reverseAPIPort")) {
|
if (deviceSettingsKeys.contains("reverseAPIPort")) {
|
||||||
settings.m_reverseAPIPort = response.getBladeRf1InputSettings()->getReverseApiPort();
|
settings.m_reverseAPIPort = (uint16_t) response.getBladeRf1InputSettings()->getReverseApiPort();
|
||||||
}
|
}
|
||||||
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||||
settings.m_reverseAPIDeviceIndex = response.getBladeRf1InputSettings()->getReverseApiDeviceIndex();
|
settings.m_reverseAPIDeviceIndex = (uint16_t) response.getBladeRf1InputSettings()->getReverseApiDeviceIndex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -714,7 +686,7 @@ int Bladerf1Input::webapiRun(
|
|||||||
|
|
||||||
void Bladerf1Input::webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const BladeRF1InputSettings& settings, bool force)
|
void Bladerf1Input::webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const BladeRF1InputSettings& settings, bool force)
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
auto *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
||||||
swgDeviceSettings->setDirection(0); // single Rx
|
swgDeviceSettings->setDirection(0); // single Rx
|
||||||
swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex());
|
swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex());
|
||||||
swgDeviceSettings->setDeviceHwType(new QString("BladeRF1"));
|
swgDeviceSettings->setDeviceHwType(new QString("BladeRF1"));
|
||||||
@ -773,8 +745,8 @@ void Bladerf1Input::webapiReverseSendSettings(const QList<QString>& deviceSettin
|
|||||||
m_networkRequest.setUrl(QUrl(deviceSettingsURL));
|
m_networkRequest.setUrl(QUrl(deviceSettingsURL));
|
||||||
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||||
|
|
||||||
QBuffer *buffer = new QBuffer();
|
auto *buffer = new QBuffer();
|
||||||
buffer->open((QBuffer::ReadWrite));
|
buffer->open(QBuffer::ReadWrite);
|
||||||
buffer->write(swgDeviceSettings->asJson().toUtf8());
|
buffer->write(swgDeviceSettings->asJson().toUtf8());
|
||||||
buffer->seek(0);
|
buffer->seek(0);
|
||||||
|
|
||||||
@ -787,7 +759,7 @@ void Bladerf1Input::webapiReverseSendSettings(const QList<QString>& deviceSettin
|
|||||||
|
|
||||||
void Bladerf1Input::webapiReverseSendStartStop(bool start)
|
void Bladerf1Input::webapiReverseSendStartStop(bool start)
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
auto *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
||||||
swgDeviceSettings->setDirection(0); // single Rx
|
swgDeviceSettings->setDirection(0); // single Rx
|
||||||
swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex());
|
swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex());
|
||||||
swgDeviceSettings->setDeviceHwType(new QString("BladeRF1"));
|
swgDeviceSettings->setDeviceHwType(new QString("BladeRF1"));
|
||||||
@ -799,8 +771,8 @@ void Bladerf1Input::webapiReverseSendStartStop(bool start)
|
|||||||
m_networkRequest.setUrl(QUrl(deviceSettingsURL));
|
m_networkRequest.setUrl(QUrl(deviceSettingsURL));
|
||||||
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||||
|
|
||||||
QBuffer *buffer = new QBuffer();
|
auto *buffer = new QBuffer();
|
||||||
buffer->open((QBuffer::ReadWrite));
|
buffer->open(QBuffer::ReadWrite);
|
||||||
buffer->write(swgDeviceSettings->asJson().toUtf8());
|
buffer->write(swgDeviceSettings->asJson().toUtf8());
|
||||||
buffer->seek(0);
|
buffer->seek(0);
|
||||||
QNetworkReply *reply;
|
QNetworkReply *reply;
|
||||||
@ -815,7 +787,7 @@ void Bladerf1Input::webapiReverseSendStartStop(bool start)
|
|||||||
delete swgDeviceSettings;
|
delete swgDeviceSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bladerf1Input::networkManagerFinished(QNetworkReply *reply)
|
void Bladerf1Input::networkManagerFinished(QNetworkReply *reply) const
|
||||||
{
|
{
|
||||||
QNetworkReply::NetworkError replyError = reply->error();
|
QNetworkReply::NetworkError replyError = reply->error();
|
||||||
|
|
||||||
|
@ -76,62 +76,62 @@ public:
|
|||||||
return new MsgStartStop(startStop);
|
return new MsgStartStop(startStop);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
bool m_startStop;
|
bool m_startStop;
|
||||||
|
|
||||||
MsgStartStop(bool startStop) :
|
explicit MsgStartStop(bool startStop) :
|
||||||
Message(),
|
Message(),
|
||||||
m_startStop(startStop)
|
m_startStop(startStop)
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
Bladerf1Input(DeviceAPI *deviceAPI);
|
explicit Bladerf1Input(DeviceAPI *deviceAPI);
|
||||||
virtual ~Bladerf1Input();
|
~Bladerf1Input() final;
|
||||||
virtual void destroy();
|
void destroy() final;
|
||||||
|
|
||||||
virtual void init();
|
void init() final;
|
||||||
virtual bool start();
|
bool start() final;
|
||||||
virtual void stop();
|
void stop() final;
|
||||||
|
|
||||||
virtual QByteArray serialize() const;
|
QByteArray serialize() const final;
|
||||||
virtual bool deserialize(const QByteArray& data);
|
bool deserialize(const QByteArray& data) final;
|
||||||
|
|
||||||
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
|
void setMessageQueueToGUI(MessageQueue *queue) final { m_guiMessageQueue = queue; }
|
||||||
virtual const QString& getDeviceDescription() const;
|
const QString& getDeviceDescription() const final;
|
||||||
virtual int getSampleRate() const;
|
int getSampleRate() const final;
|
||||||
virtual void setSampleRate(int sampleRate) { (void) sampleRate; }
|
void setSampleRate(int sampleRate) final { (void) sampleRate; }
|
||||||
virtual quint64 getCenterFrequency() const;
|
quint64 getCenterFrequency() const final;
|
||||||
virtual void setCenterFrequency(qint64 centerFrequency);
|
void setCenterFrequency(qint64 centerFrequency) final;
|
||||||
|
|
||||||
virtual bool handleMessage(const Message& message);
|
bool handleMessage(const Message& message) final;
|
||||||
|
|
||||||
virtual int webapiSettingsGet(
|
int webapiSettingsGet(
|
||||||
SWGSDRangel::SWGDeviceSettings& response,
|
SWGSDRangel::SWGDeviceSettings& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage) final;
|
||||||
|
|
||||||
virtual int webapiSettingsPutPatch(
|
int webapiSettingsPutPatch(
|
||||||
bool force,
|
bool force,
|
||||||
const QStringList& deviceSettingsKeys,
|
const QStringList& deviceSettingsKeys,
|
||||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||||
QString& errorMessage);
|
QString& errorMessage) final;
|
||||||
|
|
||||||
virtual int webapiRunGet(
|
int webapiRunGet(
|
||||||
SWGSDRangel::SWGDeviceState& response,
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage) final;
|
||||||
|
|
||||||
virtual int webapiRun(
|
int webapiRun(
|
||||||
bool run,
|
bool run,
|
||||||
SWGSDRangel::SWGDeviceState& response,
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage) final;
|
||||||
|
|
||||||
static void webapiFormatDeviceSettings(
|
static void webapiFormatDeviceSettings(
|
||||||
SWGSDRangel::SWGDeviceSettings& response,
|
SWGSDRangel::SWGDeviceSettings& response,
|
||||||
const BladeRF1InputSettings& settings);
|
const BladeRF1InputSettings& settings);
|
||||||
|
|
||||||
static void webapiUpdateDeviceSettings(
|
static void webapiUpdateDeviceSettings(
|
||||||
BladeRF1InputSettings& settings,
|
BladeRF1InputSettings& settings,
|
||||||
const QStringList& deviceSettingsKeys,
|
const QStringList& deviceSettingsKeys,
|
||||||
SWGSDRangel::SWGDeviceSettings& response);
|
SWGSDRangel::SWGDeviceSettings& response);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DeviceAPI *m_deviceAPI;
|
DeviceAPI *m_deviceAPI;
|
||||||
@ -148,12 +148,12 @@ private:
|
|||||||
bool openDevice();
|
bool openDevice();
|
||||||
void closeDevice();
|
void closeDevice();
|
||||||
bool applySettings(const BladeRF1InputSettings& settings, const QList<QString>& settingsKeys, bool force);
|
bool applySettings(const BladeRF1InputSettings& settings, const QList<QString>& settingsKeys, bool force);
|
||||||
bladerf_lna_gain getLnaGain(int lnaGain);
|
bladerf_lna_gain getLnaGain(int lnaGain) const;
|
||||||
void webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const BladeRF1InputSettings& settings, bool force);
|
void webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const BladeRF1InputSettings& settings, bool force);
|
||||||
void webapiReverseSendStartStop(bool start);
|
void webapiReverseSendStartStop(bool start);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void networkManagerFinished(QNetworkReply *reply);
|
void networkManagerFinished(QNetworkReply *reply) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDE_BLADERFINPUT_H
|
#endif // INCLUDE_BLADERFINPUT_H
|
||||||
|
@ -61,21 +61,8 @@ MESSAGE_CLASS_DEFINITION(SigMFFileInput::MsgReportTotalSamplesCheck, Message)
|
|||||||
|
|
||||||
SigMFFileInput::SigMFFileInput(DeviceAPI *deviceAPI) :
|
SigMFFileInput::SigMFFileInput(DeviceAPI *deviceAPI) :
|
||||||
m_deviceAPI(deviceAPI),
|
m_deviceAPI(deviceAPI),
|
||||||
m_running(false),
|
|
||||||
m_settings(),
|
m_settings(),
|
||||||
m_trackMode(false),
|
m_deviceDescription("SigMFFileInput")
|
||||||
m_currentTrackIndex(0),
|
|
||||||
m_recordOpen(false),
|
|
||||||
m_crcAvailable(false),
|
|
||||||
m_crcOK(false),
|
|
||||||
m_recordLengthOK(false),
|
|
||||||
m_fileInputWorker(nullptr),
|
|
||||||
m_deviceDescription("SigMFFileInput"),
|
|
||||||
m_sampleRate(48000),
|
|
||||||
m_sampleBytes(1),
|
|
||||||
m_centerFrequency(0),
|
|
||||||
m_recordLength(0),
|
|
||||||
m_startingTimeStamp(0)
|
|
||||||
{
|
{
|
||||||
m_sampleFifo.setLabel(m_deviceDescription);
|
m_sampleFifo.setLabel(m_deviceDescription);
|
||||||
m_deviceAPI->setNbSourceStreams(1);
|
m_deviceAPI->setNbSourceStreams(1);
|
||||||
@ -104,7 +91,7 @@ SigMFFileInput::~SigMFFileInput()
|
|||||||
);
|
);
|
||||||
delete m_networkManager;
|
delete m_networkManager;
|
||||||
|
|
||||||
stop();
|
SigMFFileInput::stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SigMFFileInput::destroy()
|
void SigMFFileInput::destroy()
|
||||||
@ -156,8 +143,8 @@ bool SigMFFileInput::openFileStreams(const QString& fileName)
|
|||||||
extractCaptures(&metaRecord);
|
extractCaptures(&metaRecord);
|
||||||
m_metaInfo.m_totalTimeMs = m_captures.back().m_cumulativeTime + ((m_captures.back().m_length * 1000)/m_captures.back().m_sampleRate);
|
m_metaInfo.m_totalTimeMs = m_captures.back().m_cumulativeTime + ((m_captures.back().m_length * 1000)/m_captures.back().m_sampleRate);
|
||||||
|
|
||||||
uint64_t centerFrequency = (m_captures.size() > 0) ? m_captures.at(0).m_centerFrequency : 0;
|
uint64_t centerFrequency = (!m_captures.empty()) ? m_captures.at(0).m_centerFrequency : 0;
|
||||||
DSPSignalNotification *notif = new DSPSignalNotification(m_metaInfo.m_coreSampleRate, centerFrequency);
|
auto *notif = new DSPSignalNotification((int) m_metaInfo.m_coreSampleRate, centerFrequency);
|
||||||
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
|
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
|
||||||
|
|
||||||
if (getMessageQueueToGUI())
|
if (getMessageQueueToGUI())
|
||||||
@ -244,14 +231,13 @@ void SigMFFileInput::extractMeta(
|
|||||||
m_metaInfo.m_arch = QString::fromStdString(metaRecord->global.access<sdrangel::GlobalT>().arch);
|
m_metaInfo.m_arch = QString::fromStdString(metaRecord->global.access<sdrangel::GlobalT>().arch);
|
||||||
m_metaInfo.m_os = QString::fromStdString(metaRecord->global.access<sdrangel::GlobalT>().os);
|
m_metaInfo.m_os = QString::fromStdString(metaRecord->global.access<sdrangel::GlobalT>().os);
|
||||||
// lists
|
// lists
|
||||||
m_metaInfo.m_nbCaptures = metaRecord->captures.size();
|
m_metaInfo.m_nbCaptures = (unsigned int) metaRecord->captures.size();
|
||||||
m_metaInfo.m_nbAnnotations = metaRecord->annotations.size();
|
m_metaInfo.m_nbAnnotations = (unsigned int) metaRecord->annotations.size();
|
||||||
// correct sample bits if sdrangel
|
// correct sample bits if sdrangel
|
||||||
if (m_metaInfo.m_sdrAngelVersion.size() > 0)
|
if ((m_metaInfo.m_sdrAngelVersion.size() > 0)
|
||||||
|
&& (m_metaInfo.m_dataType.m_sampleBits == 32))
|
||||||
{
|
{
|
||||||
if (m_metaInfo.m_dataType.m_sampleBits == 32) {
|
m_metaInfo.m_dataType.m_sampleBits = 24;
|
||||||
m_metaInfo.m_dataType.m_sampleBits = 24;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// negative sample rate means inversion
|
// negative sample rate means inversion
|
||||||
m_metaInfo.m_dataType.m_swapIQ = m_metaInfo.m_coreSampleRate < 0;
|
m_metaInfo.m_dataType.m_swapIQ = m_metaInfo.m_coreSampleRate < 0;
|
||||||
@ -270,8 +256,7 @@ void SigMFFileInput::extractCaptures(
|
|||||||
std::regex datetime_reg("(\\d{4})-(\\d\\d)-(\\d\\d)T(\\d\\d):(\\d\\d):(\\d\\d)(\\.\\d+)?(([+-]\\d\\d:\\d\\d)|Z)?");
|
std::regex datetime_reg("(\\d{4})-(\\d\\d)-(\\d\\d)T(\\d\\d):(\\d\\d):(\\d\\d)(\\.\\d+)?(([+-]\\d\\d:\\d\\d)|Z)?");
|
||||||
std::smatch datetime_match;
|
std::smatch datetime_match;
|
||||||
|
|
||||||
sigmf::SigMFVector<sigmf::Capture<core::DescrT, sdrangel::DescrT>>::iterator it =
|
auto it = metaRecord->captures.begin();
|
||||||
metaRecord->captures.begin();
|
|
||||||
uint64_t lastSampleStart = 0;
|
uint64_t lastSampleStart = 0;
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
uint64_t cumulativeTime = 0;
|
uint64_t cumulativeTime = 0;
|
||||||
@ -279,7 +264,7 @@ void SigMFFileInput::extractCaptures(
|
|||||||
for (; it != metaRecord->captures.end(); ++it, i++)
|
for (; it != metaRecord->captures.end(); ++it, i++)
|
||||||
{
|
{
|
||||||
m_captures.push_back(SigMFFileCapture());
|
m_captures.push_back(SigMFFileCapture());
|
||||||
m_captures.back().m_centerFrequency = it->get<core::DescrT>().frequency;
|
m_captures.back().m_centerFrequency = (uint64_t) it->get<core::DescrT>().frequency;
|
||||||
m_captures.back().m_sampleStart = it->get<core::DescrT>().sample_start;
|
m_captures.back().m_sampleStart = it->get<core::DescrT>().sample_start;
|
||||||
m_captureStarts.push_back(m_captures.back().m_sampleStart);
|
m_captureStarts.push_back(m_captures.back().m_sampleStart);
|
||||||
m_captures.back().m_cumulativeTime = cumulativeTime;
|
m_captures.back().m_cumulativeTime = cumulativeTime;
|
||||||
@ -287,7 +272,7 @@ void SigMFFileInput::extractCaptures(
|
|||||||
double globalSampleRate = metaRecord->global.access<core::GlobalT>().sample_rate;
|
double globalSampleRate = metaRecord->global.access<core::GlobalT>().sample_rate;
|
||||||
|
|
||||||
if (sdrangelSampleRate == 0) {
|
if (sdrangelSampleRate == 0) {
|
||||||
m_captures.back().m_sampleRate = globalSampleRate < 0 ? -globalSampleRate : globalSampleRate;
|
m_captures.back().m_sampleRate = (unsigned int) (globalSampleRate < 0 ? -globalSampleRate : globalSampleRate);
|
||||||
} else {
|
} else {
|
||||||
m_captures.back().m_sampleRate = sdrangelSampleRate;
|
m_captures.back().m_sampleRate = sdrangelSampleRate;
|
||||||
}
|
}
|
||||||
@ -326,7 +311,7 @@ void SigMFFileInput::extractCaptures(
|
|||||||
dateTime = QDateTime::currentDateTimeUtc();
|
dateTime = QDateTime::currentDateTimeUtc();
|
||||||
}
|
}
|
||||||
|
|
||||||
double seconds = dateTime.toSecsSinceEpoch();
|
auto seconds = (double) dateTime.toSecsSinceEpoch();
|
||||||
// the subsecond part can be milli (strict ISO-8601) or micro or nano (RFC-3339). This will take any width
|
// the subsecond part can be milli (strict ISO-8601) or micro or nano (RFC-3339). This will take any width
|
||||||
if (datetime_match.size() > 7)
|
if (datetime_match.size() > 7)
|
||||||
{
|
{
|
||||||
@ -335,13 +320,13 @@ void SigMFFileInput::extractCaptures(
|
|||||||
double fractionalSecs = boost::lexical_cast<double>(datetime_match[7]);
|
double fractionalSecs = boost::lexical_cast<double>(datetime_match[7]);
|
||||||
seconds += fractionalSecs;
|
seconds += fractionalSecs;
|
||||||
}
|
}
|
||||||
catch (const boost::bad_lexical_cast &e)
|
catch (const boost::bad_lexical_cast&)
|
||||||
{
|
{
|
||||||
qDebug("SigMFFileInput::extractCaptures: invalid fractional seconds");
|
qDebug("SigMFFileInput::extractCaptures: invalid fractional seconds");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_captures.back().m_tsms = seconds * 1000.0;
|
m_captures.back().m_tsms = (uint64_t) (seconds * 1000.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_captures.back().m_length = it->get<core::DescrT>().length;
|
m_captures.back().m_length = it->get<core::DescrT>().length;
|
||||||
@ -390,7 +375,7 @@ void SigMFFileInput::analyzeDataType(const std::string& dataTypeString, SigMFFil
|
|||||||
{
|
{
|
||||||
dataType.m_sampleBits = boost::lexical_cast<int>(dataType_match[3]);
|
dataType.m_sampleBits = boost::lexical_cast<int>(dataType_match[3]);
|
||||||
}
|
}
|
||||||
catch(const boost::bad_lexical_cast &e)
|
catch(const boost::bad_lexical_cast&)
|
||||||
{
|
{
|
||||||
qDebug("SigMFFileInput::analyzeDataType: invalid sample bits. Assume 32");
|
qDebug("SigMFFileInput::analyzeDataType: invalid sample bits. Assume 32");
|
||||||
dataType.m_sampleBits = 32;
|
dataType.m_sampleBits = 32;
|
||||||
@ -414,7 +399,7 @@ uint64_t SigMFFileInput::getTrackSampleStart(unsigned int trackIndex)
|
|||||||
int SigMFFileInput::getTrackIndex(uint64_t sampleIndex)
|
int SigMFFileInput::getTrackIndex(uint64_t sampleIndex)
|
||||||
{
|
{
|
||||||
auto it = std::upper_bound(m_captureStarts.begin(), m_captureStarts.end(), sampleIndex);
|
auto it = std::upper_bound(m_captureStarts.begin(), m_captureStarts.end(), sampleIndex);
|
||||||
return (it - m_captureStarts.begin()) - 1;
|
return (int) ((it - m_captureStarts.begin()) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SigMFFileInput::seekFileStream(uint64_t sampleIndex)
|
void SigMFFileInput::seekFileStream(uint64_t sampleIndex)
|
||||||
@ -441,7 +426,7 @@ void SigMFFileInput::seekFileMillis(int seekMillis)
|
|||||||
|
|
||||||
void SigMFFileInput::init()
|
void SigMFFileInput::init()
|
||||||
{
|
{
|
||||||
DSPSignalNotification *notif = new DSPSignalNotification(m_sampleRate, m_centerFrequency);
|
auto *notif = new DSPSignalNotification(m_sampleRate, m_centerFrequency);
|
||||||
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
|
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -596,13 +581,13 @@ bool SigMFFileInput::handleMessage(const Message& message)
|
|||||||
{
|
{
|
||||||
if (MsgConfigureSigMFFileInput::match(message))
|
if (MsgConfigureSigMFFileInput::match(message))
|
||||||
{
|
{
|
||||||
MsgConfigureSigMFFileInput& conf = (MsgConfigureSigMFFileInput&) message;
|
auto& conf = (const MsgConfigureSigMFFileInput&) message;
|
||||||
applySettings(conf.getSettings(), conf.getSettingsKeys(), conf.getForce());
|
applySettings(conf.getSettings(), conf.getSettingsKeys(), conf.getForce());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (MsgConfigureTrackIndex::match(message))
|
else if (MsgConfigureTrackIndex::match(message))
|
||||||
{
|
{
|
||||||
MsgConfigureTrackIndex& conf = (MsgConfigureTrackIndex&) message;
|
auto& conf = (const MsgConfigureTrackIndex&) message;
|
||||||
m_currentTrackIndex = conf.getTrackIndex();
|
m_currentTrackIndex = conf.getTrackIndex();
|
||||||
qDebug("SigMFFileInput::handleMessage MsgConfigureTrackIndex: m_currentTrackIndex: %d", m_currentTrackIndex);
|
qDebug("SigMFFileInput::handleMessage MsgConfigureTrackIndex: m_currentTrackIndex: %d", m_currentTrackIndex);
|
||||||
seekTrackMillis(0);
|
seekTrackMillis(0);
|
||||||
@ -623,7 +608,7 @@ bool SigMFFileInput::handleMessage(const Message& message)
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (working) {
|
if (working) {
|
||||||
startWorker();
|
startWorker();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -631,7 +616,7 @@ bool SigMFFileInput::handleMessage(const Message& message)
|
|||||||
}
|
}
|
||||||
else if (MsgConfigureTrackWork::match(message))
|
else if (MsgConfigureTrackWork::match(message))
|
||||||
{
|
{
|
||||||
MsgConfigureTrackWork& conf = (MsgConfigureTrackWork&) message;
|
auto& conf = (const MsgConfigureTrackWork&) message;
|
||||||
bool working = conf.isWorking();
|
bool working = conf.isWorking();
|
||||||
m_trackMode = true;
|
m_trackMode = true;
|
||||||
|
|
||||||
@ -653,7 +638,7 @@ bool SigMFFileInput::handleMessage(const Message& message)
|
|||||||
}
|
}
|
||||||
else if (MsgConfigureTrackSeek::match(message))
|
else if (MsgConfigureTrackSeek::match(message))
|
||||||
{
|
{
|
||||||
MsgConfigureTrackSeek& conf = (MsgConfigureTrackSeek&) message;
|
auto& conf = (const MsgConfigureTrackSeek&) message;
|
||||||
int seekMillis = conf.getMillis();
|
int seekMillis = conf.getMillis();
|
||||||
seekTrackMillis(seekMillis);
|
seekTrackMillis(seekMillis);
|
||||||
|
|
||||||
@ -669,7 +654,7 @@ bool SigMFFileInput::handleMessage(const Message& message)
|
|||||||
m_captures[m_currentTrackIndex].m_sampleStart + ((m_captures[m_currentTrackIndex].m_length*seekMillis)/1000UL));
|
m_captures[m_currentTrackIndex].m_sampleStart + ((m_captures[m_currentTrackIndex].m_length*seekMillis)/1000UL));
|
||||||
|
|
||||||
if (working) {
|
if (working) {
|
||||||
startWorker();
|
startWorker();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -677,7 +662,7 @@ bool SigMFFileInput::handleMessage(const Message& message)
|
|||||||
}
|
}
|
||||||
else if (MsgConfigureFileSeek::match(message))
|
else if (MsgConfigureFileSeek::match(message))
|
||||||
{
|
{
|
||||||
MsgConfigureFileSeek& conf = (MsgConfigureFileSeek&) message;
|
auto& conf = (const MsgConfigureFileSeek&) message;
|
||||||
int seekMillis = conf.getMillis();
|
int seekMillis = conf.getMillis();
|
||||||
seekFileStream(seekMillis);
|
seekFileStream(seekMillis);
|
||||||
uint64_t sampleCount = (m_metaInfo.m_totalSamples*seekMillis)/1000UL;
|
uint64_t sampleCount = (m_metaInfo.m_totalSamples*seekMillis)/1000UL;
|
||||||
@ -695,7 +680,7 @@ bool SigMFFileInput::handleMessage(const Message& message)
|
|||||||
m_fileInputWorker->setSamplesCount(sampleCount);
|
m_fileInputWorker->setSamplesCount(sampleCount);
|
||||||
|
|
||||||
if (working) {
|
if (working) {
|
||||||
startWorker();
|
startWorker();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -703,7 +688,7 @@ bool SigMFFileInput::handleMessage(const Message& message)
|
|||||||
}
|
}
|
||||||
else if (MsgConfigureFileWork::match(message))
|
else if (MsgConfigureFileWork::match(message))
|
||||||
{
|
{
|
||||||
MsgConfigureFileWork& conf = (MsgConfigureFileWork&) message;
|
auto& conf = (const MsgConfigureFileWork&) message;
|
||||||
bool working = conf.isWorking();
|
bool working = conf.isWorking();
|
||||||
m_trackMode = false;
|
m_trackMode = false;
|
||||||
|
|
||||||
@ -724,27 +709,24 @@ bool SigMFFileInput::handleMessage(const Message& message)
|
|||||||
}
|
}
|
||||||
else if (MsgConfigureFileInputStreamTiming::match(message))
|
else if (MsgConfigureFileInputStreamTiming::match(message))
|
||||||
{
|
{
|
||||||
if (m_fileInputWorker)
|
if (m_fileInputWorker && getMessageQueueToGUI())
|
||||||
{
|
{
|
||||||
if (getMessageQueueToGUI())
|
quint64 totalSamplesCount = m_fileInputWorker->getSamplesCount();
|
||||||
{
|
quint64 trackSamplesCount = totalSamplesCount - m_captures[m_currentTrackIndex].m_sampleStart;
|
||||||
quint64 totalSamplesCount = m_fileInputWorker->getSamplesCount();
|
MsgReportFileInputStreamTiming *report = MsgReportFileInputStreamTiming::create(
|
||||||
quint64 trackSamplesCount = totalSamplesCount - m_captures[m_currentTrackIndex].m_sampleStart;
|
totalSamplesCount,
|
||||||
MsgReportFileInputStreamTiming *report = MsgReportFileInputStreamTiming::create(
|
trackSamplesCount,
|
||||||
totalSamplesCount,
|
m_captures[m_currentTrackIndex].m_cumulativeTime,
|
||||||
trackSamplesCount,
|
m_currentTrackIndex
|
||||||
m_captures[m_currentTrackIndex].m_cumulativeTime,
|
);
|
||||||
m_currentTrackIndex
|
getMessageQueueToGUI()->push(report);
|
||||||
);
|
|
||||||
getMessageQueueToGUI()->push(report);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (MsgStartStop::match(message))
|
else if (MsgStartStop::match(message))
|
||||||
{
|
{
|
||||||
MsgStartStop& cmd = (MsgStartStop&) message;
|
auto& cmd = (const MsgStartStop&) message;
|
||||||
qDebug() << "FileInput::handleMessage: MsgStartStop: " << (cmd.getStartStop() ? "start" : "stop");
|
qDebug() << "FileInput::handleMessage: MsgStartStop: " << (cmd.getStartStop() ? "start" : "stop");
|
||||||
|
|
||||||
if (cmd.getStartStop())
|
if (cmd.getStartStop())
|
||||||
@ -798,7 +780,7 @@ bool SigMFFileInput::handleMessage(const Message& message)
|
|||||||
}
|
}
|
||||||
else if (SigMFFileInputWorker::MsgReportTrackChange::match(message))
|
else if (SigMFFileInputWorker::MsgReportTrackChange::match(message))
|
||||||
{
|
{
|
||||||
SigMFFileInputWorker::MsgReportTrackChange& report = (SigMFFileInputWorker::MsgReportTrackChange&) message;
|
auto& report = (const SigMFFileInputWorker::MsgReportTrackChange&) message;
|
||||||
m_currentTrackIndex = report.getTrackIndex();
|
m_currentTrackIndex = report.getTrackIndex();
|
||||||
qDebug("SigMFFileInput::handleMessage MsgReportTrackChange: m_currentTrackIndex: %d", m_currentTrackIndex);
|
qDebug("SigMFFileInput::handleMessage MsgReportTrackChange: m_currentTrackIndex: %d", m_currentTrackIndex);
|
||||||
int sampleRate = m_captures.at(m_currentTrackIndex).m_sampleRate;
|
int sampleRate = m_captures.at(m_currentTrackIndex).m_sampleRate;
|
||||||
@ -806,7 +788,7 @@ bool SigMFFileInput::handleMessage(const Message& message)
|
|||||||
|
|
||||||
if ((m_sampleRate != sampleRate) || (m_centerFrequency != centerFrequency))
|
if ((m_sampleRate != sampleRate) || (m_centerFrequency != centerFrequency))
|
||||||
{
|
{
|
||||||
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, centerFrequency);
|
auto *notif = new DSPSignalNotification(sampleRate, centerFrequency);
|
||||||
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
|
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
|
||||||
|
|
||||||
m_sampleRate = sampleRate;
|
m_sampleRate = sampleRate;
|
||||||
@ -831,18 +813,15 @@ bool SigMFFileInput::applySettings(const SigMFFileInputSettings& settings, const
|
|||||||
{
|
{
|
||||||
qDebug() << "SigMFFileInput::applySettings: force: " << force << settings.getDebugString(settingsKeys, force);
|
qDebug() << "SigMFFileInput::applySettings: force: " << force << settings.getDebugString(settingsKeys, force);
|
||||||
|
|
||||||
if (settingsKeys.contains("accelerationFactor") || force)
|
if (m_fileInputWorker && (settingsKeys.contains("accelerationFactor") || force))
|
||||||
{
|
{
|
||||||
if (m_fileInputWorker)
|
QMutexLocker mutexLocker(&m_mutex);
|
||||||
{
|
if (!m_sampleFifo.setSize(m_settings.m_accelerationFactor * m_sampleRate * sizeof(Sample))) {
|
||||||
QMutexLocker mutexLocker(&m_mutex);
|
qCritical("SigMFFileInput::applySettings: could not reallocate sample FIFO size to %lu",
|
||||||
if (!m_sampleFifo.setSize(m_settings.m_accelerationFactor * m_sampleRate * sizeof(Sample))) {
|
m_settings.m_accelerationFactor * m_sampleRate * sizeof(Sample));
|
||||||
qCritical("SigMFFileInput::applySettings: could not reallocate sample FIFO size to %lu",
|
|
||||||
m_settings.m_accelerationFactor * m_sampleRate * sizeof(Sample));
|
|
||||||
}
|
|
||||||
|
|
||||||
m_fileInputWorker->setAccelerationFactor(settings.m_accelerationFactor); // Fast Forward: 1 corresponds to live. 1/2 is half speed, 2 is double speed
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_fileInputWorker->setAccelerationFactor(settings.m_accelerationFactor); // Fast Forward: 1 corresponds to live. 1/2 is half speed, 2 is double speed
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settingsKeys.contains("fileName")) {
|
if (settingsKeys.contains("fileName")) {
|
||||||
@ -925,10 +904,10 @@ void SigMFFileInput::webapiUpdateDeviceSettings(
|
|||||||
settings.m_reverseAPIAddress = *response.getSigMfFileInputSettings()->getReverseApiAddress();
|
settings.m_reverseAPIAddress = *response.getSigMfFileInputSettings()->getReverseApiAddress();
|
||||||
}
|
}
|
||||||
if (deviceSettingsKeys.contains("reverseAPIPort")) {
|
if (deviceSettingsKeys.contains("reverseAPIPort")) {
|
||||||
settings.m_reverseAPIPort = response.getSigMfFileInputSettings()->getReverseApiPort();
|
settings.m_reverseAPIPort = (uint16_t) response.getSigMfFileInputSettings()->getReverseApiPort();
|
||||||
}
|
}
|
||||||
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||||
settings.m_reverseAPIDeviceIndex = response.getSigMfFileInputSettings()->getReverseApiDeviceIndex();
|
settings.m_reverseAPIDeviceIndex = (uint16_t) response.getSigMfFileInputSettings()->getReverseApiDeviceIndex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1080,7 +1059,11 @@ void SigMFFileInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& resp
|
|||||||
response.getSigMfFileInputReport()->setSampleFormat(m_metaInfo.m_dataType.m_floatingPoint ? 1 : 0);
|
response.getSigMfFileInputReport()->setSampleFormat(m_metaInfo.m_dataType.m_floatingPoint ? 1 : 0);
|
||||||
response.getSigMfFileInputReport()->setSampleSigned(m_metaInfo.m_dataType.m_signed ? 1 : 0);
|
response.getSigMfFileInputReport()->setSampleSigned(m_metaInfo.m_dataType.m_signed ? 1 : 0);
|
||||||
response.getSigMfFileInputReport()->setSampleSwapIq(m_metaInfo.m_dataType.m_swapIQ ? 1 : 0);
|
response.getSigMfFileInputReport()->setSampleSwapIq(m_metaInfo.m_dataType.m_swapIQ ? 1 : 0);
|
||||||
response.getSigMfFileInputReport()->setCrcStatus(!m_crcAvailable ? 0 : m_crcOK ? 1 : 2);
|
if (!m_crcAvailable) {
|
||||||
|
response.getSigMfFileInputReport()->setCrcStatus(0);
|
||||||
|
} else {
|
||||||
|
response.getSigMfFileInputReport()->setCrcStatus(m_crcOK ? 1 : 2);
|
||||||
|
}
|
||||||
response.getSigMfFileInputReport()->setTotalBytesStatus(m_recordLengthOK);
|
response.getSigMfFileInputReport()->setTotalBytesStatus(m_recordLengthOK);
|
||||||
response.getSigMfFileInputReport()->setTrackNumber(m_currentTrackIndex);
|
response.getSigMfFileInputReport()->setTrackNumber(m_currentTrackIndex);
|
||||||
QList<SigMFFileCapture>::const_iterator it = m_captures.begin();
|
QList<SigMFFileCapture>::const_iterator it = m_captures.begin();
|
||||||
@ -1124,7 +1107,7 @@ void SigMFFileInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& resp
|
|||||||
posRatio = (float) totalSamplesCount / (float) m_metaInfo.m_totalSamples;
|
posRatio = (float) totalSamplesCount / (float) m_metaInfo.m_totalSamples;
|
||||||
response.getSigMfFileInputReport()->setRecordSamplesRatio(posRatio);
|
response.getSigMfFileInputReport()->setRecordSamplesRatio(posRatio);
|
||||||
|
|
||||||
if (m_captures.size() > 0 )
|
if (!m_captures.empty() )
|
||||||
{
|
{
|
||||||
uint64_t totalTimeMs = m_captures.back().m_cumulativeTime + ((m_captures.back().m_length * 1000) / m_captures.back().m_sampleRate);
|
uint64_t totalTimeMs = m_captures.back().m_cumulativeTime + ((m_captures.back().m_length * 1000) / m_captures.back().m_sampleRate);
|
||||||
response.getSigMfFileInputReport()->setRecordDurationMs(totalTimeMs);
|
response.getSigMfFileInputReport()->setRecordDurationMs(totalTimeMs);
|
||||||
@ -1137,7 +1120,7 @@ void SigMFFileInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& resp
|
|||||||
|
|
||||||
void SigMFFileInput::webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const SigMFFileInputSettings& settings, bool force)
|
void SigMFFileInput::webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const SigMFFileInputSettings& settings, bool force)
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
auto *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
||||||
swgDeviceSettings->setDirection(0); // single Rx
|
swgDeviceSettings->setDirection(0); // single Rx
|
||||||
swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex());
|
swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex());
|
||||||
swgDeviceSettings->setDeviceHwType(new QString("SigMFFileInput"));
|
swgDeviceSettings->setDeviceHwType(new QString("SigMFFileInput"));
|
||||||
@ -1166,8 +1149,8 @@ void SigMFFileInput::webapiReverseSendSettings(const QList<QString>& deviceSetti
|
|||||||
m_networkRequest.setUrl(QUrl(deviceSettingsURL));
|
m_networkRequest.setUrl(QUrl(deviceSettingsURL));
|
||||||
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||||
|
|
||||||
QBuffer *buffer = new QBuffer();
|
auto *buffer = new QBuffer();
|
||||||
buffer->open((QBuffer::ReadWrite));
|
buffer->open(QBuffer::ReadWrite);
|
||||||
buffer->write(swgDeviceSettings->asJson().toUtf8());
|
buffer->write(swgDeviceSettings->asJson().toUtf8());
|
||||||
buffer->seek(0);
|
buffer->seek(0);
|
||||||
|
|
||||||
@ -1180,7 +1163,7 @@ void SigMFFileInput::webapiReverseSendSettings(const QList<QString>& deviceSetti
|
|||||||
|
|
||||||
void SigMFFileInput::webapiReverseSendStartStop(bool start)
|
void SigMFFileInput::webapiReverseSendStartStop(bool start)
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
auto *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
||||||
swgDeviceSettings->setDirection(0); // single Rx
|
swgDeviceSettings->setDirection(0); // single Rx
|
||||||
swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex());
|
swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex());
|
||||||
swgDeviceSettings->setDeviceHwType(new QString("SigMFFileInput"));
|
swgDeviceSettings->setDeviceHwType(new QString("SigMFFileInput"));
|
||||||
@ -1192,8 +1175,8 @@ void SigMFFileInput::webapiReverseSendStartStop(bool start)
|
|||||||
m_networkRequest.setUrl(QUrl(deviceSettingsURL));
|
m_networkRequest.setUrl(QUrl(deviceSettingsURL));
|
||||||
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||||
|
|
||||||
QBuffer *buffer = new QBuffer();
|
auto *buffer = new QBuffer();
|
||||||
buffer->open((QBuffer::ReadWrite));
|
buffer->open(QBuffer::ReadWrite);
|
||||||
buffer->write(swgDeviceSettings->asJson().toUtf8());
|
buffer->write(swgDeviceSettings->asJson().toUtf8());
|
||||||
buffer->seek(0);
|
buffer->seek(0);
|
||||||
QNetworkReply *reply;
|
QNetworkReply *reply;
|
||||||
@ -1208,7 +1191,7 @@ void SigMFFileInput::webapiReverseSendStartStop(bool start)
|
|||||||
delete swgDeviceSettings;
|
delete swgDeviceSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SigMFFileInput::networkManagerFinished(QNetworkReply *reply)
|
void SigMFFileInput::networkManagerFinished(QNetworkReply *reply) const
|
||||||
{
|
{
|
||||||
QNetworkReply::NetworkError replyError = reply->error();
|
QNetworkReply::NetworkError replyError = reply->error();
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
bool m_working;
|
bool m_working;
|
||||||
|
|
||||||
MsgConfigureTrackWork(bool working) :
|
explicit MsgConfigureTrackWork(bool working) :
|
||||||
Message(),
|
Message(),
|
||||||
m_working(working)
|
m_working(working)
|
||||||
{ }
|
{ }
|
||||||
@ -109,7 +109,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
bool m_working;
|
bool m_working;
|
||||||
|
|
||||||
MsgConfigureFileWork(bool working) :
|
explicit MsgConfigureFileWork(bool working) :
|
||||||
Message(),
|
Message(),
|
||||||
m_working(working)
|
m_working(working)
|
||||||
{ }
|
{ }
|
||||||
@ -132,7 +132,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
int m_trackIndex;
|
int m_trackIndex;
|
||||||
|
|
||||||
MsgConfigureTrackIndex(int trackIndex) :
|
explicit MsgConfigureTrackIndex(int trackIndex) :
|
||||||
Message(),
|
Message(),
|
||||||
m_trackIndex(trackIndex)
|
m_trackIndex(trackIndex)
|
||||||
{ }
|
{ }
|
||||||
@ -152,10 +152,10 @@ public:
|
|||||||
return new MsgConfigureTrackSeek(seekMillis);
|
return new MsgConfigureTrackSeek(seekMillis);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
int m_seekMillis; //!< millis of seek position from the beginning 0..1000
|
int m_seekMillis; //!< millis of seek position from the beginning 0..1000
|
||||||
|
|
||||||
MsgConfigureTrackSeek(int seekMillis) :
|
explicit MsgConfigureTrackSeek(int seekMillis) :
|
||||||
Message(),
|
Message(),
|
||||||
m_seekMillis(seekMillis)
|
m_seekMillis(seekMillis)
|
||||||
{ }
|
{ }
|
||||||
@ -175,10 +175,10 @@ public:
|
|||||||
return new MsgConfigureFileSeek(seekMillis);
|
return new MsgConfigureFileSeek(seekMillis);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
int m_seekMillis; //!< millis of seek position from the beginning 0..1000
|
int m_seekMillis; //!< millis of seek position from the beginning 0..1000
|
||||||
|
|
||||||
MsgConfigureFileSeek(int seekMillis) :
|
explicit MsgConfigureFileSeek(int seekMillis) :
|
||||||
Message(),
|
Message(),
|
||||||
m_seekMillis(seekMillis)
|
m_seekMillis(seekMillis)
|
||||||
{ }
|
{ }
|
||||||
@ -217,10 +217,10 @@ public:
|
|||||||
return new MsgStartStop(startStop);
|
return new MsgStartStop(startStop);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
bool m_startStop;
|
bool m_startStop;
|
||||||
|
|
||||||
MsgStartStop(bool startStop) :
|
explicit MsgStartStop(bool startStop) :
|
||||||
Message(),
|
Message(),
|
||||||
m_startStop(startStop)
|
m_startStop(startStop)
|
||||||
{ }
|
{ }
|
||||||
@ -240,10 +240,10 @@ public:
|
|||||||
return new MsgReportStartStop(startStop);
|
return new MsgReportStartStop(startStop);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
bool m_startStop;
|
bool m_startStop;
|
||||||
|
|
||||||
MsgReportStartStop(bool startStop) :
|
explicit MsgReportStartStop(bool startStop) :
|
||||||
Message(),
|
Message(),
|
||||||
m_startStop(startStop)
|
m_startStop(startStop)
|
||||||
{ }
|
{ }
|
||||||
@ -257,13 +257,13 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
const SigMFFileMetaInfo& getMetaInfo() const { return m_metaInfo; }
|
const SigMFFileMetaInfo& getMetaInfo() const { return m_metaInfo; }
|
||||||
const QList<SigMFFileCapture>& getCaptures() { return m_captures; }
|
const QList<SigMFFileCapture>& getCaptures() const { return m_captures; }
|
||||||
|
|
||||||
static MsgReportMetaData* create(const SigMFFileMetaInfo& metaInfo, const QList<SigMFFileCapture>& captures) {
|
static MsgReportMetaData* create(const SigMFFileMetaInfo& metaInfo, const QList<SigMFFileCapture>& captures) {
|
||||||
return new MsgReportMetaData(metaInfo, captures);
|
return new MsgReportMetaData(metaInfo, captures);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
SigMFFileMetaInfo m_metaInfo;
|
SigMFFileMetaInfo m_metaInfo;
|
||||||
QList<SigMFFileCapture> m_captures;
|
QList<SigMFFileCapture> m_captures;
|
||||||
|
|
||||||
@ -288,7 +288,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
int m_trackIndex;
|
int m_trackIndex;
|
||||||
MsgReportTrackChange(int trackIndex) :
|
explicit MsgReportTrackChange(int trackIndex) :
|
||||||
Message(),
|
Message(),
|
||||||
m_trackIndex(trackIndex)
|
m_trackIndex(trackIndex)
|
||||||
{ }
|
{ }
|
||||||
@ -321,7 +321,7 @@ public:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
quint64 m_samplesCount;
|
quint64 m_samplesCount;
|
||||||
quint64 m_trackSamplesCount;
|
quint64 m_trackSamplesCount;
|
||||||
quint64 m_trackTimeStart;
|
quint64 m_trackTimeStart;
|
||||||
@ -354,10 +354,10 @@ public:
|
|||||||
return new MsgReportCRC(ok);
|
return new MsgReportCRC(ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
bool m_ok;
|
bool m_ok;
|
||||||
|
|
||||||
MsgReportCRC(bool ok) :
|
explicit MsgReportCRC(bool ok) :
|
||||||
Message(),
|
Message(),
|
||||||
m_ok(ok)
|
m_ok(ok)
|
||||||
{ }
|
{ }
|
||||||
@ -376,98 +376,98 @@ public:
|
|||||||
return new MsgReportTotalSamplesCheck(ok);
|
return new MsgReportTotalSamplesCheck(ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
bool m_ok;
|
bool m_ok;
|
||||||
|
|
||||||
MsgReportTotalSamplesCheck(bool ok) :
|
explicit MsgReportTotalSamplesCheck(bool ok) :
|
||||||
Message(),
|
Message(),
|
||||||
m_ok(ok)
|
m_ok(ok)
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
SigMFFileInput(DeviceAPI *deviceAPI);
|
explicit SigMFFileInput(DeviceAPI *deviceAPI);
|
||||||
virtual ~SigMFFileInput();
|
~SigMFFileInput() final;
|
||||||
virtual void destroy();
|
void destroy() final;
|
||||||
|
|
||||||
virtual void init();
|
void init() final;
|
||||||
virtual bool start();
|
bool start() final;
|
||||||
virtual void stop();
|
void stop() final;
|
||||||
|
|
||||||
virtual QByteArray serialize() const;
|
QByteArray serialize() const final;
|
||||||
virtual bool deserialize(const QByteArray& data);
|
bool deserialize(const QByteArray& data) final;
|
||||||
|
|
||||||
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
|
void setMessageQueueToGUI(MessageQueue *queue) final { m_guiMessageQueue = queue; }
|
||||||
virtual const QString& getDeviceDescription() const;
|
const QString& getDeviceDescription() const final;
|
||||||
virtual int getSampleRate() const;
|
int getSampleRate() const final;
|
||||||
virtual void setSampleRate(int sampleRate) { (void) sampleRate; }
|
void setSampleRate(int sampleRate) final { (void) sampleRate; }
|
||||||
virtual quint64 getCenterFrequency() const;
|
quint64 getCenterFrequency() const final;
|
||||||
virtual void setCenterFrequency(qint64 centerFrequency);
|
void setCenterFrequency(qint64 centerFrequency) final;
|
||||||
quint64 getStartingTimeStamp() const;
|
quint64 getStartingTimeStamp() const;
|
||||||
|
|
||||||
virtual bool handleMessage(const Message& message);
|
bool handleMessage(const Message& message) final;
|
||||||
|
|
||||||
virtual int webapiSettingsGet(
|
int webapiSettingsGet(
|
||||||
SWGSDRangel::SWGDeviceSettings& response,
|
SWGSDRangel::SWGDeviceSettings& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage) final;
|
||||||
|
|
||||||
virtual int webapiSettingsPutPatch(
|
int webapiSettingsPutPatch(
|
||||||
bool force,
|
bool force,
|
||||||
const QStringList& deviceSettingsKeys,
|
const QStringList& deviceSettingsKeys,
|
||||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||||
QString& errorMessage);
|
QString& errorMessage) final;
|
||||||
|
|
||||||
virtual int webapiRunGet(
|
int webapiRunGet(
|
||||||
SWGSDRangel::SWGDeviceState& response,
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage) final;
|
||||||
|
|
||||||
virtual int webapiActionsPost(
|
int webapiActionsPost(
|
||||||
const QStringList& deviceActionsKeys,
|
const QStringList& deviceActionsKeys,
|
||||||
SWGSDRangel::SWGDeviceActions& query,
|
SWGSDRangel::SWGDeviceActions& query,
|
||||||
QString& errorMessage);
|
QString& errorMessage) final;
|
||||||
|
|
||||||
virtual int webapiRun(
|
int webapiRun(
|
||||||
bool run,
|
bool run,
|
||||||
SWGSDRangel::SWGDeviceState& response,
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage) final;
|
||||||
|
|
||||||
virtual int webapiReportGet(
|
int webapiReportGet(
|
||||||
SWGSDRangel::SWGDeviceReport& response,
|
SWGSDRangel::SWGDeviceReport& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage) final;
|
||||||
|
|
||||||
static void webapiFormatDeviceSettings(
|
static void webapiFormatDeviceSettings(
|
||||||
SWGSDRangel::SWGDeviceSettings& response,
|
SWGSDRangel::SWGDeviceSettings& response,
|
||||||
const SigMFFileInputSettings& settings);
|
const SigMFFileInputSettings& settings);
|
||||||
|
|
||||||
static void webapiUpdateDeviceSettings(
|
static void webapiUpdateDeviceSettings(
|
||||||
SigMFFileInputSettings& settings,
|
SigMFFileInputSettings& settings,
|
||||||
const QStringList& deviceSettingsKeys,
|
const QStringList& deviceSettingsKeys,
|
||||||
SWGSDRangel::SWGDeviceSettings& response);
|
SWGSDRangel::SWGDeviceSettings& response);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DeviceAPI *m_deviceAPI;
|
DeviceAPI *m_deviceAPI;
|
||||||
QMutex m_mutex;
|
QMutex m_mutex;
|
||||||
bool m_running;
|
bool m_running = false;
|
||||||
SigMFFileInputSettings m_settings;
|
SigMFFileInputSettings m_settings;
|
||||||
std::ifstream m_metaStream;
|
std::ifstream m_metaStream;
|
||||||
std::ifstream m_dataStream;
|
std::ifstream m_dataStream;
|
||||||
SigMFFileMetaInfo m_metaInfo;
|
SigMFFileMetaInfo m_metaInfo;
|
||||||
QList<SigMFFileCapture> m_captures;
|
QList<SigMFFileCapture> m_captures;
|
||||||
std::vector<uint64_t> m_captureStarts;
|
std::vector<uint64_t> m_captureStarts;
|
||||||
bool m_trackMode;
|
bool m_trackMode = false;
|
||||||
int m_currentTrackIndex;
|
int m_currentTrackIndex = 0;
|
||||||
bool m_recordOpen;
|
bool m_recordOpen = false;
|
||||||
bool m_crcAvailable;
|
bool m_crcAvailable = false;
|
||||||
bool m_crcOK;
|
bool m_crcOK = false;
|
||||||
bool m_recordLengthOK;
|
bool m_recordLengthOK = false;
|
||||||
QString m_recordSummary;
|
QString m_recordSummary;
|
||||||
SigMFFileInputWorker* m_fileInputWorker;
|
SigMFFileInputWorker* m_fileInputWorker = nullptr;
|
||||||
QThread m_fileInputWorkerThread;
|
QThread m_fileInputWorkerThread;
|
||||||
QString m_deviceDescription;
|
QString m_deviceDescription;
|
||||||
int m_sampleRate;
|
int m_sampleRate = 48000;
|
||||||
unsigned int m_sampleBytes;
|
unsigned int m_sampleBytes = 1;
|
||||||
quint64 m_centerFrequency;
|
quint64 m_centerFrequency = 0;
|
||||||
quint64 m_recordLength; //!< record length in seconds computed from file size
|
quint64 m_recordLength = 0; //!< record length in seconds computed from file size
|
||||||
quint64 m_startingTimeStamp;
|
quint64 m_startingTimeStamp = 0;
|
||||||
QTimer m_masterTimer;
|
QTimer m_masterTimer;
|
||||||
QNetworkAccessManager *m_networkManager;
|
QNetworkAccessManager *m_networkManager;
|
||||||
QNetworkRequest m_networkRequest;
|
QNetworkRequest m_networkRequest;
|
||||||
@ -498,7 +498,7 @@ private:
|
|||||||
void webapiReverseSendStartStop(bool start);
|
void webapiReverseSendStartStop(bool start);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void networkManagerFinished(QNetworkReply *reply);
|
void networkManagerFinished(QNetworkReply *reply) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDE_SIGMFFILEINPUT_H
|
#endif // INCLUDE_SIGMFFILEINPUT_H
|
||||||
|
@ -65,9 +65,7 @@ DeviceAPI::DeviceAPI(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceAPI::~DeviceAPI()
|
DeviceAPI::~DeviceAPI() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeviceAPI::setSpectrumSinkInput(bool sourceElseSink, unsigned int index)
|
void DeviceAPI::setSpectrumSinkInput(bool sourceElseSink, unsigned int index)
|
||||||
{
|
{
|
||||||
@ -269,7 +267,7 @@ DeviceAPI::EngineState DeviceAPI::state(int subsystemIndex) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DeviceAPI::errorMessage(int subsystemIndex)
|
QString DeviceAPI::errorMessage(int subsystemIndex) const
|
||||||
{
|
{
|
||||||
if (m_deviceSourceEngine) {
|
if (m_deviceSourceEngine) {
|
||||||
return m_deviceSourceEngine->errorMessage();
|
return m_deviceSourceEngine->errorMessage();
|
||||||
@ -360,28 +358,28 @@ void DeviceAPI::setDeviceItemIndex(uint32_t index)
|
|||||||
|
|
||||||
void DeviceAPI::setSamplingDevicePluginInterface(PluginInterface *iface)
|
void DeviceAPI::setSamplingDevicePluginInterface(PluginInterface *iface)
|
||||||
{
|
{
|
||||||
m_pluginInterface = iface;
|
m_pluginInterface = iface;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceAPI::getDeviceEngineStateStr(QString& state, int subsystemIndex)
|
void DeviceAPI::getDeviceEngineStateStr(QString& state, int subsystemIndex) const
|
||||||
{
|
{
|
||||||
if (m_deviceSourceEngine)
|
if (m_deviceSourceEngine)
|
||||||
{
|
{
|
||||||
switch(m_deviceSourceEngine->state())
|
switch(m_deviceSourceEngine->state())
|
||||||
{
|
{
|
||||||
case DSPDeviceSourceEngine::StNotStarted:
|
case DSPDeviceSourceEngine::State::StNotStarted:
|
||||||
state = "notStarted";
|
state = "notStarted";
|
||||||
break;
|
break;
|
||||||
case DSPDeviceSourceEngine::StIdle:
|
case DSPDeviceSourceEngine::State::StIdle:
|
||||||
state = "idle";
|
state = "idle";
|
||||||
break;
|
break;
|
||||||
case DSPDeviceSourceEngine::StReady:
|
case DSPDeviceSourceEngine::State::StReady:
|
||||||
state = "ready";
|
state = "ready";
|
||||||
break;
|
break;
|
||||||
case DSPDeviceSourceEngine::StRunning:
|
case DSPDeviceSourceEngine::State::StRunning:
|
||||||
state = "running";
|
state = "running";
|
||||||
break;
|
break;
|
||||||
case DSPDeviceSourceEngine::StError:
|
case DSPDeviceSourceEngine::State::StError:
|
||||||
state = "error";
|
state = "error";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -393,19 +391,19 @@ void DeviceAPI::getDeviceEngineStateStr(QString& state, int subsystemIndex)
|
|||||||
{
|
{
|
||||||
switch(m_deviceSinkEngine->state())
|
switch(m_deviceSinkEngine->state())
|
||||||
{
|
{
|
||||||
case DSPDeviceSinkEngine::StNotStarted:
|
case DSPDeviceSinkEngine::State::StNotStarted:
|
||||||
state = "notStarted";
|
state = "notStarted";
|
||||||
break;
|
break;
|
||||||
case DSPDeviceSinkEngine::StIdle:
|
case DSPDeviceSinkEngine::State::StIdle:
|
||||||
state = "idle";
|
state = "idle";
|
||||||
break;
|
break;
|
||||||
case DSPDeviceSinkEngine::StReady:
|
case DSPDeviceSinkEngine::State::StReady:
|
||||||
state = "ready";
|
state = "ready";
|
||||||
break;
|
break;
|
||||||
case DSPDeviceSinkEngine::StRunning:
|
case DSPDeviceSinkEngine::State::StRunning:
|
||||||
state = "running";
|
state = "running";
|
||||||
break;
|
break;
|
||||||
case DSPDeviceSinkEngine::StError:
|
case DSPDeviceSinkEngine::State::StError:
|
||||||
state = "error";
|
state = "error";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -417,19 +415,19 @@ void DeviceAPI::getDeviceEngineStateStr(QString& state, int subsystemIndex)
|
|||||||
{
|
{
|
||||||
switch(m_deviceMIMOEngine->state(subsystemIndex))
|
switch(m_deviceMIMOEngine->state(subsystemIndex))
|
||||||
{
|
{
|
||||||
case DSPDeviceMIMOEngine::StNotStarted:
|
case DSPDeviceMIMOEngine::State::StNotStarted:
|
||||||
state = "notStarted";
|
state = "notStarted";
|
||||||
break;
|
break;
|
||||||
case DSPDeviceMIMOEngine::StIdle:
|
case DSPDeviceMIMOEngine::State::StIdle:
|
||||||
state = "idle";
|
state = "idle";
|
||||||
break;
|
break;
|
||||||
case DSPDeviceMIMOEngine::StReady:
|
case DSPDeviceMIMOEngine::State::StReady:
|
||||||
state = "ready";
|
state = "ready";
|
||||||
break;
|
break;
|
||||||
case DSPDeviceMIMOEngine::StRunning:
|
case DSPDeviceMIMOEngine::State::StRunning:
|
||||||
state = "running";
|
state = "running";
|
||||||
break;
|
break;
|
||||||
case DSPDeviceMIMOEngine::StError:
|
case DSPDeviceMIMOEngine::State::StError:
|
||||||
state = "error";
|
state = "error";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -546,26 +544,26 @@ bool DeviceAPI::deserialize(const QByteArray& data)
|
|||||||
|
|
||||||
if (d.getVersion() == 1)
|
if (d.getVersion() == 1)
|
||||||
{
|
{
|
||||||
QByteArray data;
|
QByteArray bdata;
|
||||||
QList<quint64> centerFrequency;
|
QList<quint64> centerFrequency;
|
||||||
|
|
||||||
if (m_deviceSourceEngine && m_deviceSourceEngine->getSource())
|
if (m_deviceSourceEngine && m_deviceSourceEngine->getSource())
|
||||||
{
|
{
|
||||||
d.readBlob(1, &data);
|
d.readBlob(1, &bdata);
|
||||||
if (data.size() > 0) {
|
if (data.size() > 0) {
|
||||||
m_deviceSourceEngine->getSource()->deserialize(data);
|
m_deviceSourceEngine->getSource()->deserialize(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_deviceSinkEngine && m_deviceSinkEngine->getSink())
|
if (m_deviceSinkEngine && m_deviceSinkEngine->getSink())
|
||||||
{
|
{
|
||||||
d.readBlob(2, &data);
|
d.readBlob(2, &bdata);
|
||||||
if (data.size() > 0) {
|
if (data.size() > 0) {
|
||||||
m_deviceSinkEngine->getSink()->deserialize(data);
|
m_deviceSinkEngine->getSink()->deserialize(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_deviceMIMOEngine && m_deviceMIMOEngine->getMIMO())
|
if (m_deviceMIMOEngine && m_deviceMIMOEngine->getMIMO())
|
||||||
{
|
{
|
||||||
d.readBlob(3, &data);
|
d.readBlob(3, &bdata);
|
||||||
if (data.size() > 0) {
|
if (data.size() > 0) {
|
||||||
m_deviceMIMOEngine->getMIMO()->deserialize(data);
|
m_deviceMIMOEngine->getMIMO()->deserialize(data);
|
||||||
}
|
}
|
||||||
@ -596,7 +594,7 @@ void DeviceAPI::loadSamplingDeviceSettings(const Preset* preset)
|
|||||||
qDebug("DeviceAPI::loadSamplingDeviceSettings: deserializing source %s[%d]: %s",
|
qDebug("DeviceAPI::loadSamplingDeviceSettings: deserializing source %s[%d]: %s",
|
||||||
qPrintable(m_samplingDeviceId), m_samplingDeviceSequence, qPrintable(m_samplingDeviceSerial));
|
qPrintable(m_samplingDeviceId), m_samplingDeviceSequence, qPrintable(m_samplingDeviceSerial));
|
||||||
|
|
||||||
if (m_deviceSourceEngine->getSource() != 0) // Server flavor
|
if (m_deviceSourceEngine->getSource() != nullptr) // Server flavor
|
||||||
{
|
{
|
||||||
m_deviceSourceEngine->getSource()->deserialize(*sourceConfig);
|
m_deviceSourceEngine->getSource()->deserialize(*sourceConfig);
|
||||||
}
|
}
|
||||||
@ -791,8 +789,8 @@ void DeviceAPI::removeBuddy(DeviceAPI* buddy)
|
|||||||
|
|
||||||
void DeviceAPI::clearBuddiesLists()
|
void DeviceAPI::clearBuddiesLists()
|
||||||
{
|
{
|
||||||
std::vector<DeviceAPI*>::iterator itSource = m_sourceBuddies.begin();
|
auto itSource = m_sourceBuddies.begin();
|
||||||
std::vector<DeviceAPI*>::iterator itSink = m_sinkBuddies.begin();
|
auto itSink = m_sinkBuddies.begin();
|
||||||
bool leaderElected = false;
|
bool leaderElected = false;
|
||||||
|
|
||||||
for (;itSource != m_sourceBuddies.end(); ++itSource)
|
for (;itSource != m_sourceBuddies.end(); ++itSource)
|
||||||
|
@ -65,7 +65,7 @@ public:
|
|||||||
DSPDeviceSinkEngine *deviceSinkEngine,
|
DSPDeviceSinkEngine *deviceSinkEngine,
|
||||||
DSPDeviceMIMOEngine *deviceMIMOEngine
|
DSPDeviceMIMOEngine *deviceMIMOEngine
|
||||||
);
|
);
|
||||||
~DeviceAPI();
|
~DeviceAPI() override;
|
||||||
|
|
||||||
void setSpectrumSinkInput(bool sourceElseSink = true, unsigned int index = 0); //!< Used in the MIMO case to select which stream is used as input to main spectrum
|
void setSpectrumSinkInput(bool sourceElseSink = true, unsigned int index = 0); //!< Used in the MIMO case to select which stream is used as input to main spectrum
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ public:
|
|||||||
bool startDeviceEngine(int subsystemIndex = 0); //!< Start the device engine corresponding to the stream type
|
bool startDeviceEngine(int subsystemIndex = 0); //!< Start the device engine corresponding to the stream type
|
||||||
void stopDeviceEngine(int subsystemIndex = 0); //!< Stop the device engine corresponding to the stream type
|
void stopDeviceEngine(int subsystemIndex = 0); //!< Stop the device engine corresponding to the stream type
|
||||||
EngineState state(int subsystemIndex = 0) const; //!< Return the state of the device engine corresponding to the stream type
|
EngineState state(int subsystemIndex = 0) const; //!< Return the state of the device engine corresponding to the stream type
|
||||||
QString errorMessage(int subsystemIndex = 0); //!< Last error message from the device engine
|
QString errorMessage(int subsystemIndex = 0) const; //!< Last error message from the device engine
|
||||||
uint getDeviceUID() const; //!< Return the current device engine unique ID
|
uint getDeviceUID() const; //!< Return the current device engine unique ID
|
||||||
|
|
||||||
MessageQueue *getDeviceEngineInputMessageQueue(); //!< Device engine message queue
|
MessageQueue *getDeviceEngineInputMessageQueue(); //!< Device engine message queue
|
||||||
@ -131,7 +131,7 @@ public:
|
|||||||
void setDeviceSetIndex(int deviceSetIndex);
|
void setDeviceSetIndex(int deviceSetIndex);
|
||||||
PluginInterface *getPluginInterface() { return m_pluginInterface; }
|
PluginInterface *getPluginInterface() { return m_pluginInterface; }
|
||||||
|
|
||||||
void getDeviceEngineStateStr(QString& state, int subsystemIndex = 0);
|
void getDeviceEngineStateStr(QString& state, int subsystemIndex = 0) const;
|
||||||
|
|
||||||
ChannelAPI *getChanelSinkAPIAt(int index);
|
ChannelAPI *getChanelSinkAPIAt(int index);
|
||||||
ChannelAPI *getChanelSourceAPIAt(int index);
|
ChannelAPI *getChanelSourceAPIAt(int index);
|
||||||
@ -142,11 +142,7 @@ public:
|
|||||||
int getNbMIMOChannels() const { return m_mimoChannelAPIs.size(); }
|
int getNbMIMOChannels() const { return m_mimoChannelAPIs.size(); }
|
||||||
|
|
||||||
void loadSamplingDeviceSettings(const Preset* preset);
|
void loadSamplingDeviceSettings(const Preset* preset);
|
||||||
// void loadSourceSettings(const Preset* preset);
|
|
||||||
// void loadSinkSettings(const Preset* preset);
|
|
||||||
void saveSamplingDeviceSettings(Preset* preset);
|
void saveSamplingDeviceSettings(Preset* preset);
|
||||||
// void saveSourceSettings(Preset* preset);
|
|
||||||
// void saveSinkSettings(Preset* preset);
|
|
||||||
|
|
||||||
QByteArray serialize() const override;
|
QByteArray serialize() const override;
|
||||||
bool deserialize(const QByteArray& data) override;
|
bool deserialize(const QByteArray& data) override;
|
||||||
@ -176,7 +172,7 @@ public:
|
|||||||
|
|
||||||
const QTimer& getMasterTimer() const { return m_masterTimer; } //!< This is the DSPEngine master timer
|
const QTimer& getMasterTimer() const { return m_masterTimer; } //!< This is the DSPEngine master timer
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
// common
|
// common
|
||||||
|
|
||||||
StreamType m_streamType;
|
StreamType m_streamType;
|
||||||
@ -217,7 +213,6 @@ protected:
|
|||||||
DSPDeviceMIMOEngine *m_deviceMIMOEngine;
|
DSPDeviceMIMOEngine *m_deviceMIMOEngine;
|
||||||
QList<ChannelAPI*> m_mimoChannelAPIs;
|
QList<ChannelAPI*> m_mimoChannelAPIs;
|
||||||
|
|
||||||
private:
|
|
||||||
void renumerateChannels();
|
void renumerateChannels();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -43,14 +43,14 @@ MESSAGE_CLASS_DEFINITION(DSPDeviceMIMOEngine::SetSpectrumSinkInput, Message)
|
|||||||
DSPDeviceMIMOEngine::DSPDeviceMIMOEngine(uint32_t uid, QObject* parent) :
|
DSPDeviceMIMOEngine::DSPDeviceMIMOEngine(uint32_t uid, QObject* parent) :
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
m_uid(uid),
|
m_uid(uid),
|
||||||
m_stateRx(StNotStarted),
|
m_stateRx(State::StNotStarted),
|
||||||
m_stateTx(StNotStarted),
|
m_stateTx(State::StNotStarted),
|
||||||
m_deviceSampleMIMO(nullptr),
|
m_deviceSampleMIMO(nullptr),
|
||||||
m_spectrumInputSourceElseSink(true),
|
m_spectrumInputSourceElseSink(true),
|
||||||
m_spectrumInputIndex(0)
|
m_spectrumInputIndex(0)
|
||||||
{
|
{
|
||||||
setStateRx(StIdle);
|
setStateRx(State::StIdle);
|
||||||
setStateTx(StIdle);
|
setStateTx(State::StIdle);
|
||||||
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
|
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ void DSPDeviceMIMOEngine::stopProcess(int subsystemIndex)
|
|||||||
}
|
}
|
||||||
else if (subsystemIndex == 1) // Tx side
|
else if (subsystemIndex == 1) // Tx side
|
||||||
{
|
{
|
||||||
DSPGenerationStop *cmd = new DSPGenerationStop();
|
auto *cmd = new DSPGenerationStop();
|
||||||
getInputMessageQueue()->push(cmd);
|
getInputMessageQueue()->push(cmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -255,11 +255,9 @@ void DSPDeviceMIMOEngine::workSampleSinkFifos()
|
|||||||
unsigned int iPart2Begin;
|
unsigned int iPart2Begin;
|
||||||
unsigned int iPart2End;
|
unsigned int iPart2End;
|
||||||
const std::vector<SampleVector>& data = sampleFifo->getData();
|
const std::vector<SampleVector>& data = sampleFifo->getData();
|
||||||
//unsigned int samplesDone = 0;
|
|
||||||
|
|
||||||
while ((sampleFifo->fillSync() > 0) && (m_inputMessageQueue.size() == 0))
|
while ((sampleFifo->fillSync() > 0) && (m_inputMessageQueue.size() == 0))
|
||||||
{
|
{
|
||||||
//unsigned int count = sampleFifo->readSync(sampleFifo->fillSync(), iPart1Begin, iPart1End, iPart2Begin, iPart2End);
|
|
||||||
sampleFifo->readSync(iPart1Begin, iPart1End, iPart2Begin, iPart2End);
|
sampleFifo->readSync(iPart1Begin, iPart1End, iPart2Begin, iPart2End);
|
||||||
|
|
||||||
if (iPart1Begin != iPart1End)
|
if (iPart1Begin != iPart1End)
|
||||||
@ -288,7 +286,10 @@ void DSPDeviceMIMOEngine::workSampleSourceFifos()
|
|||||||
|
|
||||||
std::vector<SampleVector::iterator> vbegin;
|
std::vector<SampleVector::iterator> vbegin;
|
||||||
std::vector<SampleVector>& data = sampleFifo->getData();
|
std::vector<SampleVector>& data = sampleFifo->getData();
|
||||||
unsigned int iPart1Begin, iPart1End, iPart2Begin, iPart2End;
|
unsigned int iPart1Begin;
|
||||||
|
unsigned int iPart1End;
|
||||||
|
unsigned int iPart2Begin;
|
||||||
|
unsigned int iPart2End;
|
||||||
unsigned int remainder = sampleFifo->remainderSync();
|
unsigned int remainder = sampleFifo->remainderSync();
|
||||||
|
|
||||||
while ((remainder > 0) && (m_inputMessageQueue.size() == 0))
|
while ((remainder > 0) && (m_inputMessageQueue.size() == 0))
|
||||||
@ -331,7 +332,6 @@ void DSPDeviceMIMOEngine::workSampleSinkFifo(unsigned int streamIndex)
|
|||||||
|
|
||||||
while ((sampleFifo->fillAsync(streamIndex) > 0) && (m_inputMessageQueue.size() == 0))
|
while ((sampleFifo->fillAsync(streamIndex) > 0) && (m_inputMessageQueue.size() == 0))
|
||||||
{
|
{
|
||||||
//unsigned int count = sampleFifo->readAsync(sampleFifo->fillAsync(stream), &part1begin, &part1end, &part2begin, &part2end, stream);
|
|
||||||
sampleFifo->readAsync(&part1begin, &part1end, &part2begin, &part2end, streamIndex);
|
sampleFifo->readAsync(&part1begin, &part1end, &part2begin, &part2end, streamIndex);
|
||||||
|
|
||||||
if (part1begin != part1end) { // first part of FIFO data
|
if (part1begin != part1end) { // first part of FIFO data
|
||||||
@ -354,7 +354,10 @@ void DSPDeviceMIMOEngine::workSampleSourceFifo(unsigned int streamIndex)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SampleVector& data = sampleFifo->getData(streamIndex);
|
SampleVector& data = sampleFifo->getData(streamIndex);
|
||||||
unsigned int iPart1Begin, iPart1End, iPart2Begin, iPart2End;
|
unsigned int iPart1Begin;
|
||||||
|
unsigned int iPart1End;
|
||||||
|
unsigned int iPart2Begin;
|
||||||
|
unsigned int iPart2End;
|
||||||
unsigned int amount = sampleFifo->remainderAsync(streamIndex);
|
unsigned int amount = sampleFifo->remainderAsync(streamIndex);
|
||||||
|
|
||||||
while ((amount > 0) && (m_inputMessageQueue.size() == 0))
|
while ((amount > 0) && (m_inputMessageQueue.size() == 0))
|
||||||
@ -382,11 +385,6 @@ void DSPDeviceMIMOEngine::workSamplesSink(const SampleVector::const_iterator& vb
|
|||||||
std::map<int, bool>::const_iterator rcIt = m_rxRealElseComplex.find(streamIndex);
|
std::map<int, bool>::const_iterator rcIt = m_rxRealElseComplex.find(streamIndex);
|
||||||
bool positiveOnly = (rcIt == m_rxRealElseComplex.end() ? false : rcIt->second);
|
bool positiveOnly = (rcIt == m_rxRealElseComplex.end() ? false : rcIt->second);
|
||||||
|
|
||||||
// DC and IQ corrections
|
|
||||||
// if (m_sourcesCorrections[streamIndex].m_dcOffsetCorrection) {
|
|
||||||
// iqCorrections(vbegin, vend, streamIndex, m_sourcesCorrections[streamIndex].m_iqImbalanceCorrection);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// feed data to direct sinks
|
// feed data to direct sinks
|
||||||
if (streamIndex < m_basebandSampleSinks.size())
|
if (streamIndex < m_basebandSampleSinks.size())
|
||||||
{
|
{
|
||||||
@ -396,7 +394,7 @@ void DSPDeviceMIMOEngine::workSamplesSink(const SampleVector::const_iterator& vb
|
|||||||
}
|
}
|
||||||
|
|
||||||
// possibly feed data to spectrum sink
|
// possibly feed data to spectrum sink
|
||||||
if ((m_spectrumSink) && (m_spectrumInputSourceElseSink) && (streamIndex == m_spectrumInputIndex)) {
|
if (m_spectrumSink && m_spectrumInputSourceElseSink && (streamIndex == m_spectrumInputIndex)) {
|
||||||
m_spectrumSink->feed(vbegin, vend, positiveOnly);
|
m_spectrumSink->feed(vbegin, vend, positiveOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -445,14 +443,14 @@ void DSPDeviceMIMOEngine::workSamplesSource(SampleVector& data, unsigned int iBe
|
|||||||
for (; srcIt != m_basebandSampleSources[streamIndex].end(); ++srcIt, m_sumIndex++)
|
for (; srcIt != m_basebandSampleSources[streamIndex].end(); ++srcIt, m_sumIndex++)
|
||||||
{
|
{
|
||||||
sampleSource = *srcIt;
|
sampleSource = *srcIt;
|
||||||
SampleVector::iterator aBegin = m_sourceSampleBuffers[streamIndex].m_vector.begin();
|
auto aBegin = m_sourceSampleBuffers[streamIndex].m_vector.begin();
|
||||||
sampleSource->pull(aBegin, nbSamples);
|
sampleSource->pull(aBegin, nbSamples);
|
||||||
std::transform(
|
std::transform(
|
||||||
aBegin,
|
aBegin,
|
||||||
aBegin + nbSamples,
|
aBegin + nbSamples,
|
||||||
begin,
|
begin,
|
||||||
begin,
|
begin,
|
||||||
[this](Sample& a, const Sample& b) -> Sample {
|
[this](Sample const& a, const Sample& b) -> Sample {
|
||||||
FixReal den = m_sumIndex + 1; // at each stage scale sum by n/n+1 and input by 1/n+1
|
FixReal den = m_sumIndex + 1; // at each stage scale sum by n/n+1 and input by 1/n+1
|
||||||
FixReal nom = m_sumIndex; // so that final sum is scaled by N (number of channels)
|
FixReal nom = m_sumIndex; // so that final sum is scaled by N (number of channels)
|
||||||
FixReal x = a.real()/den + nom*(b.real()/den);
|
FixReal x = a.real()/den + nom*(b.real()/den);
|
||||||
@ -468,7 +466,7 @@ void DSPDeviceMIMOEngine::workSamplesSource(SampleVector& data, unsigned int iBe
|
|||||||
std::map<int, bool>::const_iterator rcIt = m_txRealElseComplex.find(streamIndex);
|
std::map<int, bool>::const_iterator rcIt = m_txRealElseComplex.find(streamIndex);
|
||||||
bool positiveOnly = (rcIt == m_txRealElseComplex.end() ? false : rcIt->second);
|
bool positiveOnly = (rcIt == m_txRealElseComplex.end() ? false : rcIt->second);
|
||||||
|
|
||||||
if ((m_spectrumSink) && (!m_spectrumInputSourceElseSink) && (streamIndex == m_spectrumInputIndex)) {
|
if (m_spectrumSink && (!m_spectrumInputSourceElseSink) && (streamIndex == m_spectrumInputIndex)) {
|
||||||
m_spectrumSink->feed(begin, begin + nbSamples, positiveOnly);
|
m_spectrumSink->feed(begin, begin + nbSamples, positiveOnly);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -482,21 +480,21 @@ DSPDeviceMIMOEngine::State DSPDeviceMIMOEngine::gotoIdle(int subsystemIndex)
|
|||||||
qDebug() << "DSPDeviceMIMOEngine::gotoIdle: subsystemIndex:" << subsystemIndex;
|
qDebug() << "DSPDeviceMIMOEngine::gotoIdle: subsystemIndex:" << subsystemIndex;
|
||||||
|
|
||||||
if (!m_deviceSampleMIMO) {
|
if (!m_deviceSampleMIMO) {
|
||||||
return StIdle;
|
return State::StIdle;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (subsystemIndex == 0) // Rx
|
if (subsystemIndex == 0) // Rx
|
||||||
{
|
{
|
||||||
switch (m_stateRx) {
|
switch (m_stateRx) {
|
||||||
case StNotStarted:
|
case State::StNotStarted:
|
||||||
return StNotStarted;
|
return State::StNotStarted;
|
||||||
|
|
||||||
case StIdle:
|
case State::StIdle:
|
||||||
case StError:
|
case State::StError:
|
||||||
return StIdle;
|
return State::StIdle;
|
||||||
|
|
||||||
case StReady:
|
case State::StReady:
|
||||||
case StRunning:
|
case State::StRunning:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -506,7 +504,7 @@ DSPDeviceMIMOEngine::State DSPDeviceMIMOEngine::gotoIdle(int subsystemIndex)
|
|||||||
|
|
||||||
for (; vbit != m_basebandSampleSinks.end(); ++vbit)
|
for (; vbit != m_basebandSampleSinks.end(); ++vbit)
|
||||||
{
|
{
|
||||||
for (BasebandSampleSinks::const_iterator it = vbit->begin(); it != vbit->end(); ++it)
|
for (auto it = vbit->begin(); it != vbit->end(); ++it)
|
||||||
{
|
{
|
||||||
qDebug() << "DSPDeviceMIMOEngine::gotoIdle: stopping BasebandSampleSink: " << (*it)->getSinkName().toStdString().c_str();
|
qDebug() << "DSPDeviceMIMOEngine::gotoIdle: stopping BasebandSampleSink: " << (*it)->getSinkName().toStdString().c_str();
|
||||||
(*it)->stop();
|
(*it)->stop();
|
||||||
@ -522,15 +520,15 @@ DSPDeviceMIMOEngine::State DSPDeviceMIMOEngine::gotoIdle(int subsystemIndex)
|
|||||||
else if (subsystemIndex == 1) // Tx
|
else if (subsystemIndex == 1) // Tx
|
||||||
{
|
{
|
||||||
switch (m_stateTx) {
|
switch (m_stateTx) {
|
||||||
case StNotStarted:
|
case State::StNotStarted:
|
||||||
return StNotStarted;
|
return State::StNotStarted;
|
||||||
|
|
||||||
case StIdle:
|
case State::StIdle:
|
||||||
case StError:
|
case State::StError:
|
||||||
return StIdle;
|
return State::StIdle;
|
||||||
|
|
||||||
case StReady:
|
case State::StReady:
|
||||||
case StRunning:
|
case State::StRunning:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -540,7 +538,7 @@ DSPDeviceMIMOEngine::State DSPDeviceMIMOEngine::gotoIdle(int subsystemIndex)
|
|||||||
|
|
||||||
for (; vSourceIt != m_basebandSampleSources.end(); vSourceIt++)
|
for (; vSourceIt != m_basebandSampleSources.end(); vSourceIt++)
|
||||||
{
|
{
|
||||||
for (BasebandSampleSources::const_iterator it = vSourceIt->begin(); it != vSourceIt->end(); ++it)
|
for (auto it = vSourceIt->begin(); it != vSourceIt->end(); ++it)
|
||||||
{
|
{
|
||||||
qDebug() << "DSPDeviceMIMOEngine::gotoIdle: stopping BasebandSampleSource(" << (*it)->getSourceName().toStdString().c_str() << ")";
|
qDebug() << "DSPDeviceMIMOEngine::gotoIdle: stopping BasebandSampleSource(" << (*it)->getSourceName().toStdString().c_str() << ")";
|
||||||
(*it)->stop();
|
(*it)->stop();
|
||||||
@ -555,12 +553,12 @@ DSPDeviceMIMOEngine::State DSPDeviceMIMOEngine::gotoIdle(int subsystemIndex)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return StIdle;
|
return State::StIdle;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_deviceDescription.clear();
|
m_deviceDescription.clear();
|
||||||
|
|
||||||
return StIdle;
|
return State::StIdle;
|
||||||
}
|
}
|
||||||
|
|
||||||
DSPDeviceMIMOEngine::State DSPDeviceMIMOEngine::gotoInit(int subsystemIndex)
|
DSPDeviceMIMOEngine::State DSPDeviceMIMOEngine::gotoInit(int subsystemIndex)
|
||||||
@ -578,17 +576,17 @@ DSPDeviceMIMOEngine::State DSPDeviceMIMOEngine::gotoInit(int subsystemIndex)
|
|||||||
if (subsystemIndex == 0) // Rx
|
if (subsystemIndex == 0) // Rx
|
||||||
{
|
{
|
||||||
switch(m_stateRx) {
|
switch(m_stateRx) {
|
||||||
case StNotStarted:
|
case State::StNotStarted:
|
||||||
return StNotStarted;
|
return State::StNotStarted;
|
||||||
|
|
||||||
case StRunning: // FIXME: assumes it goes first through idle state. Could we get back to init from running directly?
|
case State::StRunning:
|
||||||
return StRunning;
|
return State::StRunning;
|
||||||
|
|
||||||
case StReady:
|
case State::StReady:
|
||||||
return StReady;
|
return State::StReady;
|
||||||
|
|
||||||
case StIdle:
|
case State::StIdle:
|
||||||
case StError:
|
case State::StError:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -624,17 +622,17 @@ DSPDeviceMIMOEngine::State DSPDeviceMIMOEngine::gotoInit(int subsystemIndex)
|
|||||||
else if (subsystemIndex == 1) // Tx
|
else if (subsystemIndex == 1) // Tx
|
||||||
{
|
{
|
||||||
switch(m_stateTx) {
|
switch(m_stateTx) {
|
||||||
case StNotStarted:
|
case State::StNotStarted:
|
||||||
return StNotStarted;
|
return State::StNotStarted;
|
||||||
|
|
||||||
case StRunning: // FIXME: assumes it goes first through idle state. Could we get back to init from running directly?
|
case State::StRunning:
|
||||||
return StRunning;
|
return State::StRunning;
|
||||||
|
|
||||||
case StReady:
|
case State::StReady:
|
||||||
return StReady;
|
return State::StReady;
|
||||||
|
|
||||||
case StIdle:
|
case State::StIdle:
|
||||||
case StError:
|
case State::StError:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -659,7 +657,7 @@ DSPDeviceMIMOEngine::State DSPDeviceMIMOEngine::gotoInit(int subsystemIndex)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return StReady;
|
return State::StReady;
|
||||||
}
|
}
|
||||||
|
|
||||||
DSPDeviceMIMOEngine::State DSPDeviceMIMOEngine::gotoRunning(int subsystemIndex)
|
DSPDeviceMIMOEngine::State DSPDeviceMIMOEngine::gotoRunning(int subsystemIndex)
|
||||||
@ -676,17 +674,17 @@ DSPDeviceMIMOEngine::State DSPDeviceMIMOEngine::gotoRunning(int subsystemIndex)
|
|||||||
{
|
{
|
||||||
switch (m_stateRx)
|
switch (m_stateRx)
|
||||||
{
|
{
|
||||||
case StNotStarted:
|
case State::StNotStarted:
|
||||||
return StNotStarted;
|
return State::StNotStarted;
|
||||||
|
|
||||||
case StIdle:
|
case State::StIdle:
|
||||||
return StIdle;
|
return State::StIdle;
|
||||||
|
|
||||||
case StRunning:
|
case State::StRunning:
|
||||||
return StRunning;
|
return State::StRunning;
|
||||||
|
|
||||||
case StReady:
|
case State::StReady:
|
||||||
case StError:
|
case State::StError:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -698,7 +696,7 @@ DSPDeviceMIMOEngine::State DSPDeviceMIMOEngine::gotoRunning(int subsystemIndex)
|
|||||||
|
|
||||||
for (; vbit != m_basebandSampleSinks.end(); ++vbit)
|
for (; vbit != m_basebandSampleSinks.end(); ++vbit)
|
||||||
{
|
{
|
||||||
for (BasebandSampleSinks::const_iterator it = vbit->begin(); it != vbit->end(); ++it)
|
for (auto it = vbit->begin(); it != vbit->end(); ++it)
|
||||||
{
|
{
|
||||||
qDebug() << "DSPDeviceMIMOEngine::gotoRunning: starting BasebandSampleSink: " << (*it)->getSinkName().toStdString().c_str();
|
qDebug() << "DSPDeviceMIMOEngine::gotoRunning: starting BasebandSampleSink: " << (*it)->getSinkName().toStdString().c_str();
|
||||||
(*it)->start();
|
(*it)->start();
|
||||||
@ -715,17 +713,17 @@ DSPDeviceMIMOEngine::State DSPDeviceMIMOEngine::gotoRunning(int subsystemIndex)
|
|||||||
{
|
{
|
||||||
switch (m_stateTx)
|
switch (m_stateTx)
|
||||||
{
|
{
|
||||||
case StNotStarted:
|
case State::StNotStarted:
|
||||||
return StNotStarted;
|
return State::StNotStarted;
|
||||||
|
|
||||||
case StIdle:
|
case State::StIdle:
|
||||||
return StIdle;
|
return State::StIdle;
|
||||||
|
|
||||||
case StRunning:
|
case State::StRunning:
|
||||||
return StRunning;
|
return State::StRunning;
|
||||||
|
|
||||||
case StReady:
|
case State::StReady:
|
||||||
case StError:
|
case State::StError:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -737,7 +735,7 @@ DSPDeviceMIMOEngine::State DSPDeviceMIMOEngine::gotoRunning(int subsystemIndex)
|
|||||||
|
|
||||||
for (; vSourceIt != m_basebandSampleSources.end(); vSourceIt++)
|
for (; vSourceIt != m_basebandSampleSources.end(); vSourceIt++)
|
||||||
{
|
{
|
||||||
for (BasebandSampleSources::const_iterator it = vSourceIt->begin(); it != vSourceIt->end(); ++it)
|
for (auto it = vSourceIt->begin(); it != vSourceIt->end(); ++it)
|
||||||
{
|
{
|
||||||
qDebug() << "DSPDeviceMIMOEngine::gotoRunning: starting BasebandSampleSource(" << (*it)->getSourceName().toStdString().c_str() << ")";
|
qDebug() << "DSPDeviceMIMOEngine::gotoRunning: starting BasebandSampleSource(" << (*it)->getSourceName().toStdString().c_str() << ")";
|
||||||
(*it)->start();
|
(*it)->start();
|
||||||
@ -753,7 +751,7 @@ DSPDeviceMIMOEngine::State DSPDeviceMIMOEngine::gotoRunning(int subsystemIndex)
|
|||||||
|
|
||||||
qDebug() << "DSPDeviceMIMOEngine::gotoRunning:input message queue pending: " << m_inputMessageQueue.size();
|
qDebug() << "DSPDeviceMIMOEngine::gotoRunning:input message queue pending: " << m_inputMessageQueue.size();
|
||||||
|
|
||||||
return StRunning;
|
return State::StRunning;
|
||||||
}
|
}
|
||||||
|
|
||||||
DSPDeviceMIMOEngine::State DSPDeviceMIMOEngine::gotoError(int subsystemIndex, const QString& errorMessage)
|
DSPDeviceMIMOEngine::State DSPDeviceMIMOEngine::gotoError(int subsystemIndex, const QString& errorMessage)
|
||||||
@ -765,42 +763,42 @@ DSPDeviceMIMOEngine::State DSPDeviceMIMOEngine::gotoError(int subsystemIndex, co
|
|||||||
|
|
||||||
if (subsystemIndex == 0)
|
if (subsystemIndex == 0)
|
||||||
{
|
{
|
||||||
m_errorMessageRx = errorMessage;
|
m_errorMessageRx = errorMessage;
|
||||||
setStateRx(StError);
|
setStateRx(State::StError);
|
||||||
}
|
}
|
||||||
else if (subsystemIndex == 1)
|
else if (subsystemIndex == 1)
|
||||||
{
|
{
|
||||||
m_errorMessageTx = errorMessage;
|
m_errorMessageTx = errorMessage;
|
||||||
setStateTx(StError);
|
setStateTx(State::StError);
|
||||||
}
|
}
|
||||||
|
|
||||||
return StError;
|
return State::StError;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSPDeviceMIMOEngine::handleDataRxSync()
|
void DSPDeviceMIMOEngine::handleDataRxSync()
|
||||||
{
|
{
|
||||||
if (m_stateRx == StRunning) {
|
if (m_stateRx == State::StRunning) {
|
||||||
workSampleSinkFifos();
|
workSampleSinkFifos();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSPDeviceMIMOEngine::handleDataRxAsync(int streamIndex)
|
void DSPDeviceMIMOEngine::handleDataRxAsync(int streamIndex)
|
||||||
{
|
{
|
||||||
if (m_stateRx == StRunning) {
|
if (m_stateRx == State::StRunning) {
|
||||||
workSampleSinkFifo(streamIndex);
|
workSampleSinkFifo(streamIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSPDeviceMIMOEngine::handleDataTxSync()
|
void DSPDeviceMIMOEngine::handleDataTxSync()
|
||||||
{
|
{
|
||||||
if (m_stateTx == StRunning) {
|
if (m_stateTx == State::StRunning) {
|
||||||
workSampleSourceFifos();
|
workSampleSourceFifos();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSPDeviceMIMOEngine::handleDataTxAsync(int streamIndex)
|
void DSPDeviceMIMOEngine::handleDataTxAsync(int streamIndex)
|
||||||
{
|
{
|
||||||
if (m_stateTx == StRunning) {
|
if (m_stateTx == State::StRunning) {
|
||||||
workSampleSourceFifo(streamIndex);
|
workSampleSourceFifo(streamIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -815,21 +813,20 @@ void DSPDeviceMIMOEngine::handleSetMIMO(DeviceSampleMIMO* mimo)
|
|||||||
|
|
||||||
for (unsigned int i = 0; i < m_deviceSampleMIMO->getNbSinkFifos(); i++)
|
for (unsigned int i = 0; i < m_deviceSampleMIMO->getNbSinkFifos(); i++)
|
||||||
{
|
{
|
||||||
m_basebandSampleSinks.push_back(BasebandSampleSinks());
|
m_basebandSampleSinks.emplace_back();
|
||||||
m_sourcesCorrections.push_back(SourceCorrection());
|
m_sourcesCorrections.emplace_back();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int i = 0; i < m_deviceSampleMIMO->getNbSourceFifos(); i++)
|
for (unsigned int i = 0; i < m_deviceSampleMIMO->getNbSourceFifos(); i++)
|
||||||
{
|
{
|
||||||
m_basebandSampleSources.push_back(BasebandSampleSources());
|
m_basebandSampleSources.emplace_back();
|
||||||
m_sourceSampleBuffers.push_back(IncrementalVector<Sample>());
|
m_sourceSampleBuffers.emplace_back();
|
||||||
m_sourceZeroBuffers.push_back(IncrementalVector<Sample>());
|
m_sourceZeroBuffers.emplace_back();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_deviceSampleMIMO->getMIMOType() == DeviceSampleMIMO::MIMOHalfSynchronous) // synchronous FIFOs on Rx and not with Tx
|
if (m_deviceSampleMIMO->getMIMOType() == DeviceSampleMIMO::MIMOHalfSynchronous) // synchronous FIFOs on Rx and not with Tx
|
||||||
{
|
{
|
||||||
qDebug("DSPDeviceMIMOEngine::handleSetMIMO: synchronous sources set %s", qPrintable(mimo->getDeviceDescription()));
|
qDebug("DSPDeviceMIMOEngine::handleSetMIMO: synchronous sources set %s", qPrintable(mimo->getDeviceDescription()));
|
||||||
// connect(m_deviceSampleMIMO->getSampleSinkFifo(m_sampleSinkConnectionIndexes[0]), SIGNAL(dataReady()), this, SLOT(handleData()), Qt::QueuedConnection);
|
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
m_deviceSampleMIMO->getSampleMIFifo(),
|
m_deviceSampleMIMO->getSampleMIFifo(),
|
||||||
&SampleMIFifo::dataSyncReady,
|
&SampleMIFifo::dataSyncReady,
|
||||||
@ -865,13 +862,6 @@ void DSPDeviceMIMOEngine::handleSetMIMO(DeviceSampleMIMO* mimo)
|
|||||||
&DSPDeviceMIMOEngine::handleDataTxAsync,
|
&DSPDeviceMIMOEngine::handleDataTxAsync,
|
||||||
Qt::QueuedConnection
|
Qt::QueuedConnection
|
||||||
);
|
);
|
||||||
// QObject::connect(
|
|
||||||
// m_deviceSampleMIMO->getSampleSinkFifo(stream),
|
|
||||||
// &SampleSinkFifo::dataReady,
|
|
||||||
// this,
|
|
||||||
// [=](){ this->handleDataRxAsync(stream); },
|
|
||||||
// Qt::QueuedConnection
|
|
||||||
// );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -950,7 +940,7 @@ bool DSPDeviceMIMOEngine::handleMessage(const Message& message)
|
|||||||
{
|
{
|
||||||
if (sourceElseSink)
|
if (sourceElseSink)
|
||||||
{
|
{
|
||||||
if ((istream < m_deviceSampleMIMO->getNbSourceStreams()))
|
if (istream < m_deviceSampleMIMO->getNbSourceStreams())
|
||||||
{
|
{
|
||||||
|
|
||||||
// forward source changes to ancillary sinks
|
// forward source changes to ancillary sinks
|
||||||
@ -983,7 +973,7 @@ bool DSPDeviceMIMOEngine::handleMessage(const Message& message)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((istream < m_deviceSampleMIMO->getNbSinkStreams()))
|
if (istream < m_deviceSampleMIMO->getNbSinkStreams())
|
||||||
{
|
{
|
||||||
|
|
||||||
// forward source changes to channel sources with immediate execution (no queuing)
|
// forward source changes to channel sources with immediate execution (no queuing)
|
||||||
@ -1023,7 +1013,7 @@ bool DSPDeviceMIMOEngine::handleMessage(const Message& message)
|
|||||||
{
|
{
|
||||||
setStateRx(gotoIdle(0));
|
setStateRx(gotoIdle(0));
|
||||||
|
|
||||||
if (m_stateRx == StIdle) {
|
if (m_stateRx == State::StIdle) {
|
||||||
setStateRx(gotoInit(0)); // State goes ready if init is performed
|
setStateRx(gotoInit(0)); // State goes ready if init is performed
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1031,7 +1021,7 @@ bool DSPDeviceMIMOEngine::handleMessage(const Message& message)
|
|||||||
}
|
}
|
||||||
else if (DSPAcquisitionStart::match(message))
|
else if (DSPAcquisitionStart::match(message))
|
||||||
{
|
{
|
||||||
if (m_stateRx == StReady) {
|
if (m_stateRx == State::StReady) {
|
||||||
setStateRx(gotoRunning(0));
|
setStateRx(gotoRunning(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1046,7 +1036,7 @@ bool DSPDeviceMIMOEngine::handleMessage(const Message& message)
|
|||||||
{
|
{
|
||||||
setStateTx(gotoIdle(1));
|
setStateTx(gotoIdle(1));
|
||||||
|
|
||||||
if (m_stateTx == StIdle) {
|
if (m_stateTx == State::StIdle) {
|
||||||
setStateTx(gotoInit(1)); // State goes ready if init is performed
|
setStateTx(gotoInit(1)); // State goes ready if init is performed
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1054,7 +1044,7 @@ bool DSPDeviceMIMOEngine::handleMessage(const Message& message)
|
|||||||
}
|
}
|
||||||
else if (DSPGenerationStart::match(message))
|
else if (DSPGenerationStart::match(message))
|
||||||
{
|
{
|
||||||
if (m_stateTx == StReady) {
|
if (m_stateTx == State::StReady) {
|
||||||
setStateTx(gotoRunning(1));
|
setStateTx(gotoRunning(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1085,7 +1075,7 @@ bool DSPDeviceMIMOEngine::handleMessage(const Message& message)
|
|||||||
auto *msgToSink = new DSPSignalNotification(sourceStreamSampleRate, sourceCenterFrequency);
|
auto *msgToSink = new DSPSignalNotification(sourceStreamSampleRate, sourceCenterFrequency);
|
||||||
sink->pushMessage(msgToSink);
|
sink->pushMessage(msgToSink);
|
||||||
// start the sink:
|
// start the sink:
|
||||||
if (m_stateRx == StRunning) {
|
if (m_stateRx == State::StRunning) {
|
||||||
sink->start();
|
sink->start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1100,7 +1090,7 @@ bool DSPDeviceMIMOEngine::handleMessage(const Message& message)
|
|||||||
|
|
||||||
if (isource < m_basebandSampleSinks.size())
|
if (isource < m_basebandSampleSinks.size())
|
||||||
{
|
{
|
||||||
if (m_stateRx == StRunning) {
|
if (m_stateRx == State::StRunning) {
|
||||||
sink->stop();
|
sink->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1124,7 +1114,7 @@ bool DSPDeviceMIMOEngine::handleMessage(const Message& message)
|
|||||||
auto *msgToSource = new DSPSignalNotification(sinkStreamSampleRate, sinkCenterFrequency);
|
auto *msgToSource = new DSPSignalNotification(sinkStreamSampleRate, sinkCenterFrequency);
|
||||||
sampleSource->pushMessage(msgToSource);
|
sampleSource->pushMessage(msgToSource);
|
||||||
// start the sink:
|
// start the sink:
|
||||||
if (m_stateTx == StRunning) {
|
if (m_stateTx == State::StRunning) {
|
||||||
sampleSource->start();
|
sampleSource->start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1173,11 +1163,11 @@ bool DSPDeviceMIMOEngine::handleMessage(const Message& message)
|
|||||||
channel->pushMessage(notif);
|
channel->pushMessage(notif);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_stateRx == StRunning) {
|
if (m_stateRx == State::StRunning) {
|
||||||
channel->startSinks();
|
channel->startSinks();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_stateTx == StRunning) {
|
if (m_stateTx == State::StRunning) {
|
||||||
channel->startSources();
|
channel->startSources();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1214,15 +1204,14 @@ bool DSPDeviceMIMOEngine::handleMessage(const Message& message)
|
|||||||
|
|
||||||
if ((spectrumInputSourceElseSink != m_spectrumInputSourceElseSink) || (spectrumInputIndex != m_spectrumInputIndex))
|
if ((spectrumInputSourceElseSink != m_spectrumInputSourceElseSink) || (spectrumInputIndex != m_spectrumInputIndex))
|
||||||
{
|
{
|
||||||
if ((!spectrumInputSourceElseSink) && (spectrumInputIndex < m_deviceSampleMIMO->getNbSinkStreams())) // add the source listener
|
if ((!spectrumInputSourceElseSink)
|
||||||
|
&& (spectrumInputIndex < m_deviceSampleMIMO->getNbSinkStreams())
|
||||||
|
&& m_spectrumSink) // add the source listener
|
||||||
{
|
{
|
||||||
if (m_spectrumSink)
|
auto *notif = new DSPSignalNotification(
|
||||||
{
|
m_deviceSampleMIMO->getSinkSampleRate(spectrumInputIndex),
|
||||||
auto *notif = new DSPSignalNotification(
|
m_deviceSampleMIMO->getSinkCenterFrequency(spectrumInputIndex));
|
||||||
m_deviceSampleMIMO->getSinkSampleRate(spectrumInputIndex),
|
m_spectrumSink->pushMessage(notif);
|
||||||
m_deviceSampleMIMO->getSinkCenterFrequency(spectrumInputIndex));
|
|
||||||
m_spectrumSink->pushMessage(notif);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_spectrumSink && spectrumInputSourceElseSink && (spectrumInputIndex < m_deviceSampleMIMO->getNbSinkFifos()))
|
if (m_spectrumSink && spectrumInputSourceElseSink && (spectrumInputIndex < m_deviceSampleMIMO->getNbSinkFifos()))
|
||||||
@ -1248,7 +1237,7 @@ void DSPDeviceMIMOEngine::handleInputMessages()
|
|||||||
{
|
{
|
||||||
Message* message;
|
Message* message;
|
||||||
|
|
||||||
while ((message = m_inputMessageQueue.pop()) != 0)
|
while ((message = m_inputMessageQueue.pop()) != nullptr)
|
||||||
{
|
{
|
||||||
qDebug("DSPDeviceMIMOEngine::handleInputMessages: message: %s", message->getIdentifier());
|
qDebug("DSPDeviceMIMOEngine::handleInputMessages: message: %s", message->getIdentifier());
|
||||||
|
|
||||||
@ -1261,7 +1250,7 @@ void DSPDeviceMIMOEngine::handleInputMessages()
|
|||||||
void DSPDeviceMIMOEngine::configureCorrections(bool dcOffsetCorrection, bool iqImbalanceCorrection, int isource)
|
void DSPDeviceMIMOEngine::configureCorrections(bool dcOffsetCorrection, bool iqImbalanceCorrection, int isource)
|
||||||
{
|
{
|
||||||
qDebug() << "DSPDeviceMIMOEngine::configureCorrections";
|
qDebug() << "DSPDeviceMIMOEngine::configureCorrections";
|
||||||
ConfigureCorrection* cmd = new ConfigureCorrection(dcOffsetCorrection, iqImbalanceCorrection, isource);
|
auto* cmd = new ConfigureCorrection(dcOffsetCorrection, iqImbalanceCorrection, isource);
|
||||||
m_inputMessageQueue.push(cmd);
|
m_inputMessageQueue.push(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1313,8 +1302,8 @@ void DSPDeviceMIMOEngine::iqCorrections(SampleVector::iterator begin, SampleVect
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
// DC correction and conversion
|
// DC correction and conversion
|
||||||
float xi = (it->m_real - (int32_t) m_sourcesCorrections[isource].m_iBeta) / SDR_RX_SCALEF;
|
float xi = (float) (it->m_real - (int32_t) m_sourcesCorrections[isource].m_iBeta) / SDR_RX_SCALEF;
|
||||||
float xq = (it->m_imag - (int32_t) m_sourcesCorrections[isource].m_qBeta) / SDR_RX_SCALEF;
|
float xq = (float) (it->m_imag - (int32_t) m_sourcesCorrections[isource].m_qBeta) / SDR_RX_SCALEF;
|
||||||
|
|
||||||
// phase imbalance
|
// phase imbalance
|
||||||
m_sourcesCorrections[isource].m_avgII(xi*xi); // <I", I">
|
m_sourcesCorrections[isource].m_avgII(xi*xi); // <I", I">
|
||||||
@ -1325,8 +1314,8 @@ void DSPDeviceMIMOEngine::iqCorrections(SampleVector::iterator begin, SampleVect
|
|||||||
m_sourcesCorrections[isource].m_avgPhi(m_sourcesCorrections[isource].m_avgIQ.asDouble()/m_sourcesCorrections[isource].m_avgII.asDouble());
|
m_sourcesCorrections[isource].m_avgPhi(m_sourcesCorrections[isource].m_avgIQ.asDouble()/m_sourcesCorrections[isource].m_avgII.asDouble());
|
||||||
}
|
}
|
||||||
|
|
||||||
float& yi = xi; // the in phase remains the reference
|
const float& yi = xi; // the in phase remains the reference
|
||||||
float yq = xq - m_sourcesCorrections[isource].m_avgPhi.asDouble()*xi;
|
float yq = xq - (float) m_sourcesCorrections[isource].m_avgPhi.asDouble()*xi;
|
||||||
|
|
||||||
// amplitude I/Q imbalance
|
// amplitude I/Q imbalance
|
||||||
m_sourcesCorrections[isource].m_avgII2(yi*yi); // <I, I>
|
m_sourcesCorrections[isource].m_avgII2(yi*yi); // <I, I>
|
||||||
@ -1337,12 +1326,12 @@ void DSPDeviceMIMOEngine::iqCorrections(SampleVector::iterator begin, SampleVect
|
|||||||
}
|
}
|
||||||
|
|
||||||
// final correction
|
// final correction
|
||||||
float& zi = yi; // the in phase remains the reference
|
const float& zi = yi; // the in phase remains the reference
|
||||||
float zq = m_sourcesCorrections[isource].m_avgAmp.asDouble() * yq;
|
auto zq = (float) (m_sourcesCorrections[isource].m_avgAmp.asDouble() * yq);
|
||||||
|
|
||||||
// convert and store
|
// convert and store
|
||||||
it->m_real = zi * SDR_RX_SCALEF;
|
it->m_real = (FixReal) (zi * SDR_RX_SCALEF);
|
||||||
it->m_imag = zq * SDR_RX_SCALEF;
|
it->m_imag = (FixReal) (zq * SDR_RX_SCALEF);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -40,7 +40,7 @@ public:
|
|||||||
class SetSampleMIMO : public Message {
|
class SetSampleMIMO : public Message {
|
||||||
MESSAGE_CLASS_DECLARATION
|
MESSAGE_CLASS_DECLARATION
|
||||||
public:
|
public:
|
||||||
SetSampleMIMO(DeviceSampleMIMO* sampleMIMO) : Message(), m_sampleMIMO(sampleMIMO) { }
|
explicit SetSampleMIMO(DeviceSampleMIMO* sampleMIMO) : Message(), m_sampleMIMO(sampleMIMO) { }
|
||||||
DeviceSampleMIMO* getSampleMIMO() const { return m_sampleMIMO; }
|
DeviceSampleMIMO* getSampleMIMO() const { return m_sampleMIMO; }
|
||||||
private:
|
private:
|
||||||
DeviceSampleMIMO* m_sampleMIMO;
|
DeviceSampleMIMO* m_sampleMIMO;
|
||||||
@ -80,7 +80,7 @@ public:
|
|||||||
class AddMIMOChannel : public Message {
|
class AddMIMOChannel : public Message {
|
||||||
MESSAGE_CLASS_DECLARATION
|
MESSAGE_CLASS_DECLARATION
|
||||||
public:
|
public:
|
||||||
AddMIMOChannel(MIMOChannel* channel) :
|
explicit AddMIMOChannel(MIMOChannel* channel) :
|
||||||
Message(),
|
Message(),
|
||||||
m_channel(channel)
|
m_channel(channel)
|
||||||
{ }
|
{ }
|
||||||
@ -92,7 +92,7 @@ public:
|
|||||||
class RemoveMIMOChannel : public Message {
|
class RemoveMIMOChannel : public Message {
|
||||||
MESSAGE_CLASS_DECLARATION
|
MESSAGE_CLASS_DECLARATION
|
||||||
public:
|
public:
|
||||||
RemoveMIMOChannel(MIMOChannel* channel) :
|
explicit RemoveMIMOChannel(MIMOChannel* channel) :
|
||||||
Message(),
|
Message(),
|
||||||
m_channel(channel)
|
m_channel(channel)
|
||||||
{ }
|
{ }
|
||||||
@ -134,7 +134,7 @@ public:
|
|||||||
class AddSpectrumSink : public Message {
|
class AddSpectrumSink : public Message {
|
||||||
MESSAGE_CLASS_DECLARATION
|
MESSAGE_CLASS_DECLARATION
|
||||||
public:
|
public:
|
||||||
AddSpectrumSink(BasebandSampleSink* sampleSink) : Message(), m_sampleSink(sampleSink) { }
|
explicit AddSpectrumSink(BasebandSampleSink* sampleSink) : Message(), m_sampleSink(sampleSink) { }
|
||||||
BasebandSampleSink* getSampleSink() const { return m_sampleSink; }
|
BasebandSampleSink* getSampleSink() const { return m_sampleSink; }
|
||||||
private:
|
private:
|
||||||
BasebandSampleSink* m_sampleSink;
|
BasebandSampleSink* m_sampleSink;
|
||||||
@ -143,7 +143,7 @@ public:
|
|||||||
class RemoveSpectrumSink : public Message {
|
class RemoveSpectrumSink : public Message {
|
||||||
MESSAGE_CLASS_DECLARATION
|
MESSAGE_CLASS_DECLARATION
|
||||||
public:
|
public:
|
||||||
RemoveSpectrumSink(BasebandSampleSink* sampleSink) : Message(), m_sampleSink(sampleSink) { }
|
explicit RemoveSpectrumSink(BasebandSampleSink* sampleSink) : Message(), m_sampleSink(sampleSink) { }
|
||||||
BasebandSampleSink* getSampleSink() const { return m_sampleSink; }
|
BasebandSampleSink* getSampleSink() const { return m_sampleSink; }
|
||||||
private:
|
private:
|
||||||
BasebandSampleSink* m_sampleSink;
|
BasebandSampleSink* m_sampleSink;
|
||||||
@ -152,7 +152,7 @@ public:
|
|||||||
class GetErrorMessage : public Message {
|
class GetErrorMessage : public Message {
|
||||||
MESSAGE_CLASS_DECLARATION
|
MESSAGE_CLASS_DECLARATION
|
||||||
public:
|
public:
|
||||||
GetErrorMessage(unsigned int subsystemIndex) :
|
explicit GetErrorMessage(unsigned int subsystemIndex) :
|
||||||
m_subsystemIndex(subsystemIndex)
|
m_subsystemIndex(subsystemIndex)
|
||||||
{}
|
{}
|
||||||
void setErrorMessage(const QString& text) { m_errorMessage = text; }
|
void setErrorMessage(const QString& text) { m_errorMessage = text; }
|
||||||
@ -204,7 +204,7 @@ public:
|
|||||||
int m_index;
|
int m_index;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum State {
|
enum class State {
|
||||||
StNotStarted, //!< engine is before initialization
|
StNotStarted, //!< engine is before initialization
|
||||||
StIdle, //!< engine is idle
|
StIdle, //!< engine is idle
|
||||||
StReady, //!< engine is ready to run
|
StReady, //!< engine is ready to run
|
||||||
@ -244,7 +244,7 @@ public:
|
|||||||
} else if (subsystemIndex == 1) {
|
} else if (subsystemIndex == 1) {
|
||||||
return m_stateTx;
|
return m_stateTx;
|
||||||
} else {
|
} else {
|
||||||
return StNotStarted;
|
return State::StNotStarted;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,13 +256,13 @@ public:
|
|||||||
private:
|
private:
|
||||||
struct SourceCorrection
|
struct SourceCorrection
|
||||||
{
|
{
|
||||||
bool m_dcOffsetCorrection;
|
bool m_dcOffsetCorrection = false;
|
||||||
bool m_iqImbalanceCorrection;
|
bool m_iqImbalanceCorrection = false;
|
||||||
double m_iOffset;
|
double m_iOffset = 0;
|
||||||
double m_qOffset;
|
double m_qOffset = 0;
|
||||||
int m_iRange;
|
int m_iRange = 1 << 16;
|
||||||
int m_qRange;
|
int m_qRange = 1 << 16;
|
||||||
int m_imbalance;
|
int m_imbalance = 65536;
|
||||||
MovingAverageUtil<int32_t, int64_t, 1024> m_iBeta;
|
MovingAverageUtil<int32_t, int64_t, 1024> m_iBeta;
|
||||||
MovingAverageUtil<int32_t, int64_t, 1024> m_qBeta;
|
MovingAverageUtil<int32_t, int64_t, 1024> m_qBeta;
|
||||||
#if IMBALANCE_INT
|
#if IMBALANCE_INT
|
||||||
@ -284,13 +284,6 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
SourceCorrection()
|
SourceCorrection()
|
||||||
{
|
{
|
||||||
m_dcOffsetCorrection = false;
|
|
||||||
m_iqImbalanceCorrection = false;
|
|
||||||
m_iOffset = 0;
|
|
||||||
m_qOffset = 0;
|
|
||||||
m_iRange = 1 << 16;
|
|
||||||
m_qRange = 1 << 16;
|
|
||||||
m_imbalance = 65536;
|
|
||||||
m_iBeta.reset();
|
m_iBeta.reset();
|
||||||
m_qBeta.reset();
|
m_qBeta.reset();
|
||||||
m_avgAmp.reset();
|
m_avgAmp.reset();
|
||||||
@ -317,17 +310,17 @@ private:
|
|||||||
|
|
||||||
MessageQueue m_inputMessageQueue; //<! Input message queue. Post here.
|
MessageQueue m_inputMessageQueue; //<! Input message queue. Post here.
|
||||||
|
|
||||||
typedef std::list<BasebandSampleSink*> BasebandSampleSinks;
|
using BasebandSampleSinks = std::list<BasebandSampleSink *>;
|
||||||
std::vector<BasebandSampleSinks> m_basebandSampleSinks; //!< ancillary sample sinks on main thread (per input stream)
|
std::vector<BasebandSampleSinks> m_basebandSampleSinks; //!< ancillary sample sinks on main thread (per input stream)
|
||||||
std::map<int, bool> m_rxRealElseComplex; //!< map of real else complex indicators for device sources (by input stream)
|
std::map<int, bool> m_rxRealElseComplex; //!< map of real else complex indicators for device sources (by input stream)
|
||||||
typedef std::list<BasebandSampleSource*> BasebandSampleSources;
|
using BasebandSampleSources = std::list<BasebandSampleSource *>;
|
||||||
std::vector<BasebandSampleSources> m_basebandSampleSources; //!< channel sample sources (per output stream)
|
std::vector<BasebandSampleSources> m_basebandSampleSources; //!< channel sample sources (per output stream)
|
||||||
std::map<int, bool> m_txRealElseComplex; //!< map of real else complex indicators for device sinks (by input stream)
|
std::map<int, bool> m_txRealElseComplex; //!< map of real else complex indicators for device sinks (by input stream)
|
||||||
std::vector<IncrementalVector<Sample>> m_sourceSampleBuffers;
|
std::vector<IncrementalVector<Sample>> m_sourceSampleBuffers;
|
||||||
std::vector<IncrementalVector<Sample>> m_sourceZeroBuffers;
|
std::vector<IncrementalVector<Sample>> m_sourceZeroBuffers;
|
||||||
unsigned int m_sumIndex; //!< channel index when summing channels
|
unsigned int m_sumIndex; //!< channel index when summing channels
|
||||||
|
|
||||||
typedef std::list<MIMOChannel*> MIMOChannels;
|
using MIMOChannels = std::list<MIMOChannel *>;
|
||||||
MIMOChannels m_mimoChannels; //!< MIMO channels
|
MIMOChannels m_mimoChannels; //!< MIMO channels
|
||||||
|
|
||||||
std::vector<SourceCorrection> m_sourcesCorrections;
|
std::vector<SourceCorrection> m_sourcesCorrections;
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
DSPDeviceSinkEngine::DSPDeviceSinkEngine(uint32_t uid, QObject* parent) :
|
DSPDeviceSinkEngine::DSPDeviceSinkEngine(uint32_t uid, QObject* parent) :
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
m_uid(uid),
|
m_uid(uid),
|
||||||
m_state(StNotStarted),
|
m_state(State::StNotStarted),
|
||||||
m_deviceSampleSink(nullptr),
|
m_deviceSampleSink(nullptr),
|
||||||
m_sampleSinkSequence(0),
|
m_sampleSinkSequence(0),
|
||||||
m_basebandSampleSources(),
|
m_basebandSampleSources(),
|
||||||
@ -39,7 +39,7 @@ DSPDeviceSinkEngine::DSPDeviceSinkEngine(uint32_t uid, QObject* parent) :
|
|||||||
m_centerFrequency(0),
|
m_centerFrequency(0),
|
||||||
m_realElseComplex(false)
|
m_realElseComplex(false)
|
||||||
{
|
{
|
||||||
setState(StIdle);
|
setState(State::StIdle);
|
||||||
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
|
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,13 +121,13 @@ void DSPDeviceSinkEngine::removeSpectrumSink(BasebandSampleSink* spectrumSink)
|
|||||||
getInputMessageQueue()->push(cmd);
|
getInputMessageQueue()->push(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DSPDeviceSinkEngine::errorMessage()
|
QString DSPDeviceSinkEngine::errorMessage() const
|
||||||
{
|
{
|
||||||
qDebug() << "DSPDeviceSinkEngine::errorMessage";
|
qDebug() << "DSPDeviceSinkEngine::errorMessage";
|
||||||
return m_errorMessage;
|
return m_errorMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DSPDeviceSinkEngine::sinkDeviceDescription()
|
QString DSPDeviceSinkEngine::sinkDeviceDescription() const
|
||||||
{
|
{
|
||||||
qDebug() << "DSPDeviceSinkEngine::sinkDeviceDescription";
|
qDebug() << "DSPDeviceSinkEngine::sinkDeviceDescription";
|
||||||
return m_deviceDescription;
|
return m_deviceDescription;
|
||||||
@ -202,7 +202,7 @@ void DSPDeviceSinkEngine::workSamples(SampleVector& data, unsigned int iBegin, u
|
|||||||
sBegin + nbSamples,
|
sBegin + nbSamples,
|
||||||
data.begin() + iBegin,
|
data.begin() + iBegin,
|
||||||
data.begin() + iBegin,
|
data.begin() + iBegin,
|
||||||
[this](Sample& a, const Sample& b) -> Sample {
|
[this](const Sample& a, const Sample& b) -> Sample {
|
||||||
FixReal den = m_sumIndex + 1; // at each stage scale sum by n/n+1 and input by 1/n+1
|
FixReal den = m_sumIndex + 1; // at each stage scale sum by n/n+1 and input by 1/n+1
|
||||||
FixReal nom = m_sumIndex; // so that final sum is scaled by N (number of channels)
|
FixReal nom = m_sumIndex; // so that final sum is scaled by N (number of channels)
|
||||||
FixReal x = a.real()/den + nom*(b.real()/den);
|
FixReal x = a.real()/den + nom*(b.real()/den);
|
||||||
@ -228,20 +228,20 @@ DSPDeviceSinkEngine::State DSPDeviceSinkEngine::gotoIdle()
|
|||||||
qDebug() << "DSPDeviceSinkEngine::gotoIdle";
|
qDebug() << "DSPDeviceSinkEngine::gotoIdle";
|
||||||
|
|
||||||
switch(m_state) {
|
switch(m_state) {
|
||||||
case StNotStarted:
|
case State::StNotStarted:
|
||||||
return StNotStarted;
|
return State::StNotStarted;
|
||||||
|
|
||||||
case StIdle:
|
case State::StIdle:
|
||||||
case StError:
|
case State::StError:
|
||||||
return StIdle;
|
return State::StIdle;
|
||||||
|
|
||||||
case StReady:
|
case State::StReady:
|
||||||
case StRunning:
|
case State::StRunning:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_deviceSampleSink) {
|
if (!m_deviceSampleSink) {
|
||||||
return StIdle;
|
return State::StIdle;
|
||||||
}
|
}
|
||||||
|
|
||||||
// stop everything
|
// stop everything
|
||||||
@ -256,23 +256,23 @@ DSPDeviceSinkEngine::State DSPDeviceSinkEngine::gotoIdle()
|
|||||||
m_deviceDescription.clear();
|
m_deviceDescription.clear();
|
||||||
m_sampleRate = 0;
|
m_sampleRate = 0;
|
||||||
|
|
||||||
return StIdle;
|
return State::StIdle;
|
||||||
}
|
}
|
||||||
|
|
||||||
DSPDeviceSinkEngine::State DSPDeviceSinkEngine::gotoInit()
|
DSPDeviceSinkEngine::State DSPDeviceSinkEngine::gotoInit()
|
||||||
{
|
{
|
||||||
switch(m_state) {
|
switch(m_state) {
|
||||||
case StNotStarted:
|
case State::StNotStarted:
|
||||||
return StNotStarted;
|
return State::StNotStarted;
|
||||||
|
|
||||||
case StRunning: // FIXME: assumes it goes first through idle state. Could we get back to init from running directly?
|
case State::StRunning:
|
||||||
return StRunning;
|
return State::StRunning;
|
||||||
|
|
||||||
case StReady:
|
case State::StReady:
|
||||||
return StReady;
|
return State::StReady;
|
||||||
|
|
||||||
case StIdle:
|
case State::StIdle:
|
||||||
case StError:
|
case State::StError:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -310,7 +310,7 @@ DSPDeviceSinkEngine::State DSPDeviceSinkEngine::gotoInit()
|
|||||||
m_deviceSampleSink->getMessageQueueToGUI()->push(rep);
|
m_deviceSampleSink->getMessageQueueToGUI()->push(rep);
|
||||||
}
|
}
|
||||||
|
|
||||||
return StReady;
|
return State::StReady;
|
||||||
}
|
}
|
||||||
|
|
||||||
DSPDeviceSinkEngine::State DSPDeviceSinkEngine::gotoRunning()
|
DSPDeviceSinkEngine::State DSPDeviceSinkEngine::gotoRunning()
|
||||||
@ -319,17 +319,17 @@ DSPDeviceSinkEngine::State DSPDeviceSinkEngine::gotoRunning()
|
|||||||
|
|
||||||
switch(m_state)
|
switch(m_state)
|
||||||
{
|
{
|
||||||
case StNotStarted:
|
case State::StNotStarted:
|
||||||
return StNotStarted;
|
return State::StNotStarted;
|
||||||
|
|
||||||
case StIdle:
|
case State::StIdle:
|
||||||
return StIdle;
|
return State::StIdle;
|
||||||
|
|
||||||
case StRunning:
|
case State::StRunning:
|
||||||
return StRunning;
|
return State::StRunning;
|
||||||
|
|
||||||
case StReady:
|
case State::StReady:
|
||||||
case StError:
|
case State::StError:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -358,7 +358,7 @@ DSPDeviceSinkEngine::State DSPDeviceSinkEngine::gotoRunning()
|
|||||||
|
|
||||||
qDebug() << "DSPDeviceSinkEngine::gotoRunning: input message queue pending: " << m_inputMessageQueue.size();
|
qDebug() << "DSPDeviceSinkEngine::gotoRunning: input message queue pending: " << m_inputMessageQueue.size();
|
||||||
|
|
||||||
return StRunning;
|
return State::StRunning;
|
||||||
}
|
}
|
||||||
|
|
||||||
DSPDeviceSinkEngine::State DSPDeviceSinkEngine::gotoError(const QString& errorMessage)
|
DSPDeviceSinkEngine::State DSPDeviceSinkEngine::gotoError(const QString& errorMessage)
|
||||||
@ -367,11 +367,11 @@ DSPDeviceSinkEngine::State DSPDeviceSinkEngine::gotoError(const QString& errorMe
|
|||||||
|
|
||||||
m_errorMessage = errorMessage;
|
m_errorMessage = errorMessage;
|
||||||
m_deviceDescription.clear();
|
m_deviceDescription.clear();
|
||||||
setState(StError);
|
setState(State::StError);
|
||||||
return StError;
|
return State::StError;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSPDeviceSinkEngine::handleSetSink(DeviceSampleSink*)
|
void DSPDeviceSinkEngine::handleSetSink(const DeviceSampleSink*)
|
||||||
{
|
{
|
||||||
if (!m_deviceSampleSink) { // Early leave
|
if (!m_deviceSampleSink) { // Early leave
|
||||||
return;
|
return;
|
||||||
@ -390,7 +390,7 @@ void DSPDeviceSinkEngine::handleSetSink(DeviceSampleSink*)
|
|||||||
|
|
||||||
void DSPDeviceSinkEngine::handleData()
|
void DSPDeviceSinkEngine::handleData()
|
||||||
{
|
{
|
||||||
if (m_state == StRunning) {
|
if (m_state == State::StRunning) {
|
||||||
workSampleFifo();
|
workSampleFifo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -441,7 +441,7 @@ bool DSPDeviceSinkEngine::handleMessage(const Message& message)
|
|||||||
{
|
{
|
||||||
setState(gotoIdle());
|
setState(gotoIdle());
|
||||||
|
|
||||||
if(m_state == StIdle) {
|
if(m_state == State::StIdle) {
|
||||||
setState(gotoInit()); // State goes ready if init is performed
|
setState(gotoInit()); // State goes ready if init is performed
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -449,7 +449,7 @@ bool DSPDeviceSinkEngine::handleMessage(const Message& message)
|
|||||||
}
|
}
|
||||||
else if (DSPGenerationStart::match(message))
|
else if (DSPGenerationStart::match(message))
|
||||||
{
|
{
|
||||||
if(m_state == StReady) {
|
if(m_state == State::StReady) {
|
||||||
setState(gotoRunning());
|
setState(gotoRunning());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -462,7 +462,7 @@ bool DSPDeviceSinkEngine::handleMessage(const Message& message)
|
|||||||
}
|
}
|
||||||
else if (DSPSetSink::match(message))
|
else if (DSPSetSink::match(message))
|
||||||
{
|
{
|
||||||
const DSPSetSink& cmd = (const DSPSetSink&) message;
|
const auto& cmd = (const DSPSetSink&) message;
|
||||||
handleSetSink(cmd.getSampleSink());
|
handleSetSink(cmd.getSampleSink());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -471,7 +471,7 @@ bool DSPDeviceSinkEngine::handleMessage(const Message& message)
|
|||||||
auto& cmd = (const DSPRemoveSpectrumSink&) message;
|
auto& cmd = (const DSPRemoveSpectrumSink&) message;
|
||||||
BasebandSampleSink* spectrumSink = cmd.getSampleSink();
|
BasebandSampleSink* spectrumSink = cmd.getSampleSink();
|
||||||
|
|
||||||
if(m_state == StRunning) {
|
if(m_state == State::StRunning) {
|
||||||
spectrumSink->stop();
|
spectrumSink->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -486,7 +486,7 @@ bool DSPDeviceSinkEngine::handleMessage(const Message& message)
|
|||||||
auto *notif = new DSPSignalNotification(m_sampleRate, m_centerFrequency);
|
auto *notif = new DSPSignalNotification(m_sampleRate, m_centerFrequency);
|
||||||
source->pushMessage(notif);
|
source->pushMessage(notif);
|
||||||
|
|
||||||
if (m_state == StRunning) {
|
if (m_state == State::StRunning) {
|
||||||
source->start();
|
source->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -497,7 +497,7 @@ bool DSPDeviceSinkEngine::handleMessage(const Message& message)
|
|||||||
auto& cmd = (const DSPRemoveBasebandSampleSource&) message;
|
auto& cmd = (const DSPRemoveBasebandSampleSource&) message;
|
||||||
BasebandSampleSource* source = cmd.getSampleSource();
|
BasebandSampleSource* source = cmd.getSampleSource();
|
||||||
|
|
||||||
if(m_state == StRunning) {
|
if(m_state == State::StRunning) {
|
||||||
source->stop();
|
source->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ class SDRBASE_API DSPDeviceSinkEngine : public QObject {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum State {
|
enum class State {
|
||||||
StNotStarted, //!< engine is before initialization
|
StNotStarted, //!< engine is before initialization
|
||||||
StIdle, //!< engine is idle
|
StIdle, //!< engine is idle
|
||||||
StReady, //!< engine is ready to run
|
StReady, //!< engine is ready to run
|
||||||
@ -53,7 +53,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
DSPDeviceSinkEngine(uint32_t uid, QObject* parent = nullptr);
|
DSPDeviceSinkEngine(uint32_t uid, QObject* parent = nullptr);
|
||||||
~DSPDeviceSinkEngine();
|
~DSPDeviceSinkEngine() final;
|
||||||
|
|
||||||
uint32_t getUID() const { return m_uid; }
|
uint32_t getUID() const { return m_uid; }
|
||||||
|
|
||||||
@ -75,8 +75,8 @@ public:
|
|||||||
|
|
||||||
State state() const { return m_state; } //!< Return DSP engine current state
|
State state() const { return m_state; } //!< Return DSP engine current state
|
||||||
|
|
||||||
QString errorMessage(); //!< Return the current error message
|
QString errorMessage() const; //!< Return the current error message
|
||||||
QString sinkDeviceDescription(); //!< Return the sink device description
|
QString sinkDeviceDescription() const; //!< Return the sink device description
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32_t m_uid; //!< unique ID
|
uint32_t m_uid; //!< unique ID
|
||||||
@ -91,7 +91,7 @@ private:
|
|||||||
DeviceSampleSink* m_deviceSampleSink;
|
DeviceSampleSink* m_deviceSampleSink;
|
||||||
int m_sampleSinkSequence;
|
int m_sampleSinkSequence;
|
||||||
|
|
||||||
typedef std::list<BasebandSampleSource*> BasebandSampleSources;
|
using BasebandSampleSources = std::list<BasebandSampleSource *>;
|
||||||
BasebandSampleSources m_basebandSampleSources; //!< baseband sample sources within main thread (usually file input)
|
BasebandSampleSources m_basebandSampleSources; //!< baseband sample sources within main thread (usually file input)
|
||||||
|
|
||||||
BasebandSampleSink *m_spectrumSink;
|
BasebandSampleSink *m_spectrumSink;
|
||||||
@ -112,7 +112,7 @@ private:
|
|||||||
State gotoError(const QString& errorMsg); //!< Go to an error state
|
State gotoError(const QString& errorMsg); //!< Go to an error state
|
||||||
void setState(State state);
|
void setState(State state);
|
||||||
|
|
||||||
void handleSetSink(DeviceSampleSink* sink); //!< Manage sink setting
|
void handleSetSink(const DeviceSampleSink* sink); //!< Manage sink setting
|
||||||
bool handleMessage(const Message& cmd);
|
bool handleMessage(const Message& cmd);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
DSPDeviceSourceEngine::DSPDeviceSourceEngine(uint uid, QObject* parent) :
|
DSPDeviceSourceEngine::DSPDeviceSourceEngine(uint uid, QObject* parent) :
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
m_uid(uid),
|
m_uid(uid),
|
||||||
m_state(StNotStarted),
|
m_state(State::StNotStarted),
|
||||||
m_deviceSampleSource(nullptr),
|
m_deviceSampleSource(nullptr),
|
||||||
m_sampleSourceSequence(0),
|
m_sampleSourceSequence(0),
|
||||||
m_basebandSampleSinks(),
|
m_basebandSampleSinks(),
|
||||||
@ -46,7 +46,7 @@ DSPDeviceSourceEngine::DSPDeviceSourceEngine(uint uid, QObject* parent) :
|
|||||||
m_qRange(1 << 16),
|
m_qRange(1 << 16),
|
||||||
m_imbalance(65536)
|
m_imbalance(65536)
|
||||||
{
|
{
|
||||||
setState(StIdle);
|
setState(State::StIdle);
|
||||||
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
|
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ void DSPDeviceSourceEngine::setState(State state)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DSPDeviceSourceEngine::initAcquisition()
|
bool DSPDeviceSourceEngine::initAcquisition() const
|
||||||
{
|
{
|
||||||
qDebug("DSPDeviceSourceEngine::initAcquisition (dummy)");
|
qDebug("DSPDeviceSourceEngine::initAcquisition (dummy)");
|
||||||
return true;
|
return true;
|
||||||
@ -195,8 +195,8 @@ void DSPDeviceSourceEngine::iqCorrections(SampleVector::iterator begin, SampleVe
|
|||||||
m_avgPhi(m_avgIQ.asDouble()/m_avgII.asDouble());
|
m_avgPhi(m_avgIQ.asDouble()/m_avgII.asDouble());
|
||||||
}
|
}
|
||||||
|
|
||||||
float& yi = xi; // the in phase remains the reference
|
const float& yi = xi; // the in phase remains the reference
|
||||||
float yq = xq - m_avgPhi.asDouble()*xi;
|
float yq = xq - (float) m_avgPhi.asDouble()*xi;
|
||||||
|
|
||||||
// amplitude I/Q imbalance
|
// amplitude I/Q imbalance
|
||||||
m_avgII2(yi*yi); // <I, I>
|
m_avgII2(yi*yi); // <I, I>
|
||||||
@ -207,12 +207,12 @@ void DSPDeviceSourceEngine::iqCorrections(SampleVector::iterator begin, SampleVe
|
|||||||
}
|
}
|
||||||
|
|
||||||
// final correction
|
// final correction
|
||||||
float& zi = yi; // the in phase remains the reference
|
const float& zi = yi; // the in phase remains the reference
|
||||||
float zq = m_avgAmp.asDouble() * yq;
|
auto zq = (float) (m_avgAmp.asDouble() * yq);
|
||||||
|
|
||||||
// convert and store
|
// convert and store
|
||||||
it->m_real = zi * SDR_RX_SCALEF;
|
it->m_real = (FixReal) (zi * SDR_RX_SCALEF);
|
||||||
it->m_imag = zq * SDR_RX_SCALEF;
|
it->m_imag = (FixReal) (zq * SDR_RX_SCALEF);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -345,20 +345,20 @@ DSPDeviceSourceEngine::State DSPDeviceSourceEngine::gotoIdle()
|
|||||||
qDebug("DSPDeviceSourceEngine::gotoIdle");
|
qDebug("DSPDeviceSourceEngine::gotoIdle");
|
||||||
|
|
||||||
switch(m_state) {
|
switch(m_state) {
|
||||||
case StNotStarted:
|
case State::StNotStarted:
|
||||||
return StNotStarted;
|
return State::StNotStarted;
|
||||||
|
|
||||||
case StIdle:
|
case State::StIdle:
|
||||||
case StError:
|
case State::StError:
|
||||||
return StIdle;
|
return State::StIdle;
|
||||||
|
|
||||||
case StReady:
|
case State::StReady:
|
||||||
case StRunning:
|
case State::StRunning:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_deviceSampleSource) {
|
if (!m_deviceSampleSource) {
|
||||||
return StIdle;
|
return State::StIdle;
|
||||||
}
|
}
|
||||||
|
|
||||||
// stop everything
|
// stop everything
|
||||||
@ -372,23 +372,23 @@ DSPDeviceSourceEngine::State DSPDeviceSourceEngine::gotoIdle()
|
|||||||
m_deviceDescription.clear();
|
m_deviceDescription.clear();
|
||||||
m_sampleRate = 0;
|
m_sampleRate = 0;
|
||||||
|
|
||||||
return StIdle;
|
return State::StIdle;
|
||||||
}
|
}
|
||||||
|
|
||||||
DSPDeviceSourceEngine::State DSPDeviceSourceEngine::gotoInit()
|
DSPDeviceSourceEngine::State DSPDeviceSourceEngine::gotoInit()
|
||||||
{
|
{
|
||||||
switch(m_state) {
|
switch(m_state) {
|
||||||
case StNotStarted:
|
case State::StNotStarted:
|
||||||
return StNotStarted;
|
return State::StNotStarted;
|
||||||
|
|
||||||
case StRunning: // FIXME: assumes it goes first through idle state. Could we get back to init from running directly?
|
case State::StRunning:
|
||||||
return StRunning;
|
return State::StRunning;
|
||||||
|
|
||||||
case StReady:
|
case State::StReady:
|
||||||
return StReady;
|
return State::StReady;
|
||||||
|
|
||||||
case StIdle:
|
case State::StIdle:
|
||||||
case StError:
|
case State::StError:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -427,7 +427,7 @@ DSPDeviceSourceEngine::State DSPDeviceSourceEngine::gotoInit()
|
|||||||
m_deviceSampleSource->getMessageQueueToGUI()->push(rep);
|
m_deviceSampleSource->getMessageQueueToGUI()->push(rep);
|
||||||
}
|
}
|
||||||
|
|
||||||
return StReady;
|
return State::StReady;
|
||||||
}
|
}
|
||||||
|
|
||||||
DSPDeviceSourceEngine::State DSPDeviceSourceEngine::gotoRunning()
|
DSPDeviceSourceEngine::State DSPDeviceSourceEngine::gotoRunning()
|
||||||
@ -436,17 +436,17 @@ DSPDeviceSourceEngine::State DSPDeviceSourceEngine::gotoRunning()
|
|||||||
|
|
||||||
switch(m_state)
|
switch(m_state)
|
||||||
{
|
{
|
||||||
case StNotStarted:
|
case State::StNotStarted:
|
||||||
return StNotStarted;
|
return State::StNotStarted;
|
||||||
|
|
||||||
case StIdle:
|
case State::StIdle:
|
||||||
return StIdle;
|
return State::StIdle;
|
||||||
|
|
||||||
case StRunning:
|
case State::StRunning:
|
||||||
return StRunning;
|
return State::StRunning;
|
||||||
|
|
||||||
case StReady:
|
case State::StReady:
|
||||||
case StError:
|
case State::StError:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -470,7 +470,7 @@ DSPDeviceSourceEngine::State DSPDeviceSourceEngine::gotoRunning()
|
|||||||
|
|
||||||
qDebug() << "DSPDeviceSourceEngine::gotoRunning:input message queue pending: " << m_inputMessageQueue.size();
|
qDebug() << "DSPDeviceSourceEngine::gotoRunning:input message queue pending: " << m_inputMessageQueue.size();
|
||||||
|
|
||||||
return StRunning;
|
return State::StRunning;
|
||||||
}
|
}
|
||||||
|
|
||||||
DSPDeviceSourceEngine::State DSPDeviceSourceEngine::gotoError(const QString& errorMessage)
|
DSPDeviceSourceEngine::State DSPDeviceSourceEngine::gotoError(const QString& errorMessage)
|
||||||
@ -479,8 +479,8 @@ DSPDeviceSourceEngine::State DSPDeviceSourceEngine::gotoError(const QString& err
|
|||||||
|
|
||||||
m_errorMessage = errorMessage;
|
m_errorMessage = errorMessage;
|
||||||
m_deviceDescription.clear();
|
m_deviceDescription.clear();
|
||||||
setState(StError);
|
setState(State::StError);
|
||||||
return StError;
|
return State::StError;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSPDeviceSourceEngine::handleSetSource(DeviceSampleSource* source)
|
void DSPDeviceSourceEngine::handleSetSource(DeviceSampleSource* source)
|
||||||
@ -502,7 +502,7 @@ void DSPDeviceSourceEngine::handleSetSource(DeviceSampleSource* source)
|
|||||||
|
|
||||||
void DSPDeviceSourceEngine::handleData()
|
void DSPDeviceSourceEngine::handleData()
|
||||||
{
|
{
|
||||||
if(m_state == StRunning)
|
if(m_state == State::StRunning)
|
||||||
{
|
{
|
||||||
work();
|
work();
|
||||||
}
|
}
|
||||||
@ -588,11 +588,11 @@ bool DSPDeviceSourceEngine::handleMessage(const Message& message)
|
|||||||
{
|
{
|
||||||
setState(gotoIdle());
|
setState(gotoIdle());
|
||||||
|
|
||||||
if(m_state == StIdle) {
|
if(m_state == State::StIdle) {
|
||||||
setState(gotoInit()); // State goes ready if init is performed
|
setState(gotoInit()); // State goes ready if init is performed
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_state == StReady) {
|
if(m_state == State::StReady) {
|
||||||
setState(gotoRunning());
|
setState(gotoRunning());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -617,7 +617,7 @@ bool DSPDeviceSourceEngine::handleMessage(const Message& message)
|
|||||||
auto *msg = new DSPSignalNotification(m_sampleRate, m_centerFrequency);
|
auto *msg = new DSPSignalNotification(m_sampleRate, m_centerFrequency);
|
||||||
sink->pushMessage(msg);
|
sink->pushMessage(msg);
|
||||||
// start the sink:
|
// start the sink:
|
||||||
if(m_state == StRunning) {
|
if(m_state == State::StRunning) {
|
||||||
sink->start();
|
sink->start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -626,7 +626,7 @@ bool DSPDeviceSourceEngine::handleMessage(const Message& message)
|
|||||||
auto cmd = (const DSPRemoveBasebandSampleSink&) message;
|
auto cmd = (const DSPRemoveBasebandSampleSink&) message;
|
||||||
BasebandSampleSink* sink = cmd.getSampleSink();
|
BasebandSampleSink* sink = cmd.getSampleSink();
|
||||||
|
|
||||||
if(m_state == StRunning) {
|
if(m_state == State::StRunning) {
|
||||||
sink->stop();
|
sink->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ class SDRBASE_API DSPDeviceSourceEngine : public QObject {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum State {
|
enum class State {
|
||||||
StNotStarted, //!< engine is before initialization
|
StNotStarted, //!< engine is before initialization
|
||||||
StIdle, //!< engine is idle
|
StIdle, //!< engine is idle
|
||||||
StReady, //!< engine is ready to run
|
StReady, //!< engine is ready to run
|
||||||
@ -47,13 +47,13 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
DSPDeviceSourceEngine(uint uid, QObject* parent = nullptr);
|
DSPDeviceSourceEngine(uint uid, QObject* parent = nullptr);
|
||||||
~DSPDeviceSourceEngine();
|
~DSPDeviceSourceEngine() final;
|
||||||
|
|
||||||
uint getUID() const { return m_uid; }
|
uint getUID() const { return m_uid; }
|
||||||
|
|
||||||
MessageQueue* getInputMessageQueue() { return &m_inputMessageQueue; }
|
MessageQueue* getInputMessageQueue() { return &m_inputMessageQueue; }
|
||||||
|
|
||||||
bool initAcquisition(); //!< Initialize acquisition sequence
|
bool initAcquisition() const; //!< Initialize acquisition sequence
|
||||||
bool startAcquisition(); //!< Start acquisition sequence
|
bool startAcquisition(); //!< Start acquisition sequence
|
||||||
void stopAcquistion(); //!< Stop acquisition sequence
|
void stopAcquistion(); //!< Stop acquisition sequence
|
||||||
|
|
||||||
|
@ -84,8 +84,8 @@ public:
|
|||||||
StreamType streamType; //!< This is the type of stream supported
|
StreamType streamType; //!< This is the type of stream supported
|
||||||
int deviceNbItems; //!< Number of items (or streams) in the device. >1 for composite devices.
|
int deviceNbItems; //!< Number of items (or streams) in the device. >1 for composite devices.
|
||||||
int deviceItemIndex; //!< For composite devices this is the Rx or Tx stream index. -1 if not initialized
|
int deviceItemIndex; //!< For composite devices this is the Rx or Tx stream index. -1 if not initialized
|
||||||
int claimed; //!< This is the device set index if claimed else -1
|
int claimed = -1; //!< This is the device set index if claimed else -1
|
||||||
bool removed; //!< Set if device has been removed
|
bool removed = false; //!< Set if device has been removed
|
||||||
|
|
||||||
SamplingDevice(const QString& _displayedName,
|
SamplingDevice(const QString& _displayedName,
|
||||||
const QString& _hardwareId,
|
const QString& _hardwareId,
|
||||||
@ -104,9 +104,7 @@ public:
|
|||||||
type(_type),
|
type(_type),
|
||||||
streamType(_streamType),
|
streamType(_streamType),
|
||||||
deviceNbItems(_deviceNbItems),
|
deviceNbItems(_deviceNbItems),
|
||||||
deviceItemIndex(_deviceItemIndex),
|
deviceItemIndex(_deviceItemIndex)
|
||||||
claimed(-1),
|
|
||||||
removed(false)
|
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
bool operator==(const SamplingDevice& rhs) const
|
bool operator==(const SamplingDevice& rhs) const
|
||||||
@ -117,7 +115,7 @@ public:
|
|||||||
&& serial == rhs.serial;
|
&& serial == rhs.serial;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
typedef QList<SamplingDevice> SamplingDevices;
|
using SamplingDevices = QList<SamplingDevice>;
|
||||||
|
|
||||||
/** This is the device from which the sampling devices are derived. For physical devices this represents
|
/** This is the device from which the sampling devices are derived. For physical devices this represents
|
||||||
* a single physical unit (a LimeSDR, HackRF, BladeRF, RTL-SDR dongle, ...) that is enumerated once and
|
* a single physical unit (a LimeSDR, HackRF, BladeRF, RTL-SDR dongle, ...) that is enumerated once and
|
||||||
@ -148,9 +146,9 @@ public:
|
|||||||
nbTxStreams(_nbTxStreams)
|
nbTxStreams(_nbTxStreams)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
typedef QList<OriginDevice> OriginDevices;
|
using OriginDevices = QList<OriginDevice>;
|
||||||
|
|
||||||
virtual ~PluginInterface() { }
|
virtual ~PluginInterface() = default;
|
||||||
|
|
||||||
virtual const PluginDescriptor& getPluginDescriptor() const = 0;
|
virtual const PluginDescriptor& getPluginDescriptor() const = 0;
|
||||||
virtual void initPlugin(PluginAPI* pluginAPI) = 0;
|
virtual void initPlugin(PluginAPI* pluginAPI) = 0;
|
||||||
|
@ -78,10 +78,7 @@ DeviceUISet::DeviceUISet(int deviceSetIndex, DeviceSet *deviceSet)
|
|||||||
|
|
||||||
DeviceUISet::~DeviceUISet()
|
DeviceUISet::~DeviceUISet()
|
||||||
{
|
{
|
||||||
// delete m_channelWindow;
|
|
||||||
delete m_mainSpectrumGUI;
|
delete m_mainSpectrumGUI;
|
||||||
// delete m_spectrumGUI; // done above
|
|
||||||
// delete m_spectrum;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceUISet::setIndex(int deviceSetIndex)
|
void DeviceUISet::setIndex(int deviceSetIndex)
|
||||||
@ -119,7 +116,7 @@ void DeviceUISet::registerRxChannelInstance(ChannelAPI *channelAPI, ChannelGUI*
|
|||||||
channelGUI,
|
channelGUI,
|
||||||
&ChannelGUI::closing,
|
&ChannelGUI::closing,
|
||||||
this,
|
this,
|
||||||
[=](){ this->handleChannelGUIClosing(channelGUI); },
|
[this, channelGUI](){ this->handleChannelGUIClosing(channelGUI); },
|
||||||
Qt::QueuedConnection
|
Qt::QueuedConnection
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -132,7 +129,7 @@ void DeviceUISet::registerTxChannelInstance(ChannelAPI *channelAPI, ChannelGUI*
|
|||||||
channelGUI,
|
channelGUI,
|
||||||
&ChannelGUI::closing,
|
&ChannelGUI::closing,
|
||||||
this,
|
this,
|
||||||
[=](){ this->handleChannelGUIClosing(channelGUI); },
|
[this, channelGUI](){ this->handleChannelGUIClosing(channelGUI); },
|
||||||
Qt::QueuedConnection
|
Qt::QueuedConnection
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -145,7 +142,7 @@ void DeviceUISet::registerChannelInstance(ChannelAPI *channelAPI, ChannelGUI* ch
|
|||||||
channelGUI,
|
channelGUI,
|
||||||
&ChannelGUI::closing,
|
&ChannelGUI::closing,
|
||||||
this,
|
this,
|
||||||
[=](){ this->handleChannelGUIClosing(channelGUI); },
|
[this, channelGUI](){ this->handleChannelGUIClosing(channelGUI); },
|
||||||
Qt::QueuedConnection
|
Qt::QueuedConnection
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -226,14 +223,14 @@ bool DeviceUISet::deserialize(const QByteArray& data)
|
|||||||
|
|
||||||
if (d.getVersion() == 1)
|
if (d.getVersion() == 1)
|
||||||
{
|
{
|
||||||
QByteArray data;
|
QByteArray bdata;
|
||||||
|
|
||||||
d.readBlob(1, &data);
|
d.readBlob(1, &bdata);
|
||||||
m_deviceAPI->deserialize(data);
|
m_deviceAPI->deserialize(bdata);
|
||||||
d.readBlob(2, &data);
|
d.readBlob(2, &bdata);
|
||||||
m_deviceGUI->deserialize(data);
|
m_deviceGUI->deserialize(bdata);
|
||||||
d.readBlob(3, &data);
|
d.readBlob(3, &bdata);
|
||||||
m_spectrumGUI->deserialize(data);
|
m_spectrumGUI->deserialize(bdata);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -331,9 +328,9 @@ void DeviceUISet::loadRxChannelSettings(const Preset *preset, PluginAPI *pluginA
|
|||||||
m_deviceSet->clearChannels();
|
m_deviceSet->clearChannels();
|
||||||
qDebug("DeviceUISet::loadRxChannelSettings: %d channel(s) in preset", preset->getChannelCount());
|
qDebug("DeviceUISet::loadRxChannelSettings: %d channel(s) in preset", preset->getChannelCount());
|
||||||
|
|
||||||
for (int i = 0; i < preset->getChannelCount(); i++)
|
for (int j = 0; j < preset->getChannelCount(); j++)
|
||||||
{
|
{
|
||||||
const Preset::ChannelConfig& channelConfig = preset->getChannelConfig(i);
|
const Preset::ChannelConfig& channelConfig = preset->getChannelConfig(j);
|
||||||
ChannelGUI *rxChannelGUI = nullptr;
|
ChannelGUI *rxChannelGUI = nullptr;
|
||||||
ChannelAPI *channelAPI = nullptr;
|
ChannelAPI *channelAPI = nullptr;
|
||||||
|
|
||||||
@ -348,7 +345,7 @@ void DeviceUISet::loadRxChannelSettings(const Preset *preset, PluginAPI *pluginA
|
|||||||
qPrintable((*channelRegistrations)[i].m_channelIdURI),
|
qPrintable((*channelRegistrations)[i].m_channelIdURI),
|
||||||
qPrintable(channelConfig.m_channelIdURI));
|
qPrintable(channelConfig.m_channelIdURI));
|
||||||
BasebandSampleSink *rxChannel = nullptr;
|
BasebandSampleSink *rxChannel = nullptr;
|
||||||
PluginInterface *pluginInterface = (*channelRegistrations)[i].m_plugin;
|
const PluginInterface *pluginInterface = (*channelRegistrations)[i].m_plugin;
|
||||||
pluginInterface->createRxChannel(m_deviceAPI, &rxChannel, &channelAPI);
|
pluginInterface->createRxChannel(m_deviceAPI, &rxChannel, &channelAPI);
|
||||||
rxChannelGUI = pluginInterface->createRxChannelGUI(this, rxChannel);
|
rxChannelGUI = pluginInterface->createRxChannelGUI(this, rxChannel);
|
||||||
rxChannelGUI->setDisplayedame(pluginInterface->getPluginDescriptor().displayedName);
|
rxChannelGUI->setDisplayedame(pluginInterface->getPluginDescriptor().displayedName);
|
||||||
@ -357,7 +354,7 @@ void DeviceUISet::loadRxChannelSettings(const Preset *preset, PluginAPI *pluginA
|
|||||||
rxChannelGUI,
|
rxChannelGUI,
|
||||||
&ChannelGUI::closing,
|
&ChannelGUI::closing,
|
||||||
this,
|
this,
|
||||||
[=](){ this->handleChannelGUIClosing(rxChannelGUI); },
|
[this, rxChannelGUI](){ this->handleChannelGUIClosing(rxChannelGUI); },
|
||||||
Qt::QueuedConnection
|
Qt::QueuedConnection
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
@ -370,7 +367,7 @@ void DeviceUISet::loadRxChannelSettings(const Preset *preset, PluginAPI *pluginA
|
|||||||
rxChannelGUI->deserialize(channelConfig.m_config);
|
rxChannelGUI->deserialize(channelConfig.m_config);
|
||||||
int originalWorkspaceIndex = rxChannelGUI->getWorkspaceIndex();
|
int originalWorkspaceIndex = rxChannelGUI->getWorkspaceIndex();
|
||||||
|
|
||||||
if (workspaces && (workspaces->size() > 0) && (originalWorkspaceIndex < workspaces->size())) // restore in original workspace
|
if (workspaces && (!workspaces->empty()) && (originalWorkspaceIndex < workspaces->size())) // restore in original workspace
|
||||||
{
|
{
|
||||||
(*workspaces)[originalWorkspaceIndex]->addToMdiArea((QMdiSubWindow*) rxChannelGUI);
|
(*workspaces)[originalWorkspaceIndex]->addToMdiArea((QMdiSubWindow*) rxChannelGUI);
|
||||||
}
|
}
|
||||||
@ -395,19 +392,19 @@ void DeviceUISet::loadRxChannelSettings(const Preset *preset, PluginAPI *pluginA
|
|||||||
rxChannelGUI,
|
rxChannelGUI,
|
||||||
&ChannelGUI::moveToWorkspace,
|
&ChannelGUI::moveToWorkspace,
|
||||||
this,
|
this,
|
||||||
[=](int wsIndexDest){ MainWindow::getInstance()->channelMove(rxChannelGUI, wsIndexDest); }
|
[rxChannelGUI](int wsIndexDest){ MainWindow::getInstance()->channelMove(rxChannelGUI, wsIndexDest); }
|
||||||
);
|
);
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
rxChannelGUI,
|
rxChannelGUI,
|
||||||
&ChannelGUI::duplicateChannelEmitted,
|
&ChannelGUI::duplicateChannelEmitted,
|
||||||
this,
|
this,
|
||||||
[=](){ MainWindow::getInstance()->channelDuplicate(rxChannelGUI); }
|
[rxChannelGUI](){ MainWindow::getInstance()->channelDuplicate(rxChannelGUI); }
|
||||||
);
|
);
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
rxChannelGUI,
|
rxChannelGUI,
|
||||||
&ChannelGUI::moveToDeviceSet,
|
&ChannelGUI::moveToDeviceSet,
|
||||||
this,
|
this,
|
||||||
[=](int dsIndexDest){ MainWindow::getInstance()->channelMoveToDeviceSet(rxChannelGUI, dsIndexDest); }
|
[rxChannelGUI](int dsIndexDest){ MainWindow::getInstance()->channelMoveToDeviceSet(rxChannelGUI, dsIndexDest); }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -460,9 +457,9 @@ void DeviceUISet::loadTxChannelSettings(const Preset *preset, PluginAPI *pluginA
|
|||||||
m_deviceSet->clearChannels();
|
m_deviceSet->clearChannels();
|
||||||
qDebug("DeviceUISet::loadTxChannelSettings: %d channel(s) in preset", preset->getChannelCount());
|
qDebug("DeviceUISet::loadTxChannelSettings: %d channel(s) in preset", preset->getChannelCount());
|
||||||
|
|
||||||
for (int i = 0; i < preset->getChannelCount(); i++)
|
for (int j = 0; j < preset->getChannelCount(); j++)
|
||||||
{
|
{
|
||||||
const Preset::ChannelConfig& channelConfig = preset->getChannelConfig(i);
|
const Preset::ChannelConfig& channelConfig = preset->getChannelConfig(j);
|
||||||
ChannelGUI *txChannelGUI = nullptr;
|
ChannelGUI *txChannelGUI = nullptr;
|
||||||
ChannelAPI *channelAPI = nullptr;
|
ChannelAPI *channelAPI = nullptr;
|
||||||
|
|
||||||
@ -475,8 +472,8 @@ void DeviceUISet::loadTxChannelSettings(const Preset *preset, PluginAPI *pluginA
|
|||||||
qDebug("DeviceUISet::loadTxChannelSettings: creating new channel [%s] from config [%s]",
|
qDebug("DeviceUISet::loadTxChannelSettings: creating new channel [%s] from config [%s]",
|
||||||
qPrintable((*channelRegistrations)[i].m_channelIdURI),
|
qPrintable((*channelRegistrations)[i].m_channelIdURI),
|
||||||
qPrintable(channelConfig.m_channelIdURI));
|
qPrintable(channelConfig.m_channelIdURI));
|
||||||
BasebandSampleSource *txChannel;
|
BasebandSampleSource *txChannel = nullptr;
|
||||||
PluginInterface *pluginInterface = (*channelRegistrations)[i].m_plugin;
|
const PluginInterface *pluginInterface = (*channelRegistrations)[i].m_plugin;
|
||||||
pluginInterface->createTxChannel(m_deviceAPI, &txChannel, &channelAPI);
|
pluginInterface->createTxChannel(m_deviceAPI, &txChannel, &channelAPI);
|
||||||
txChannelGUI = pluginInterface->createTxChannelGUI(this, txChannel);
|
txChannelGUI = pluginInterface->createTxChannelGUI(this, txChannel);
|
||||||
txChannelGUI->setDisplayedame(pluginInterface->getPluginDescriptor().displayedName);
|
txChannelGUI->setDisplayedame(pluginInterface->getPluginDescriptor().displayedName);
|
||||||
@ -485,7 +482,7 @@ void DeviceUISet::loadTxChannelSettings(const Preset *preset, PluginAPI *pluginA
|
|||||||
txChannelGUI,
|
txChannelGUI,
|
||||||
&ChannelGUI::closing,
|
&ChannelGUI::closing,
|
||||||
this,
|
this,
|
||||||
[=](){ this->handleChannelGUIClosing(txChannelGUI); },
|
[this, txChannelGUI](){ this->handleChannelGUIClosing(txChannelGUI); },
|
||||||
Qt::QueuedConnection
|
Qt::QueuedConnection
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
@ -498,7 +495,7 @@ void DeviceUISet::loadTxChannelSettings(const Preset *preset, PluginAPI *pluginA
|
|||||||
txChannelGUI->deserialize(channelConfig.m_config);
|
txChannelGUI->deserialize(channelConfig.m_config);
|
||||||
int originalWorkspaceIndex = txChannelGUI->getWorkspaceIndex();
|
int originalWorkspaceIndex = txChannelGUI->getWorkspaceIndex();
|
||||||
|
|
||||||
if (workspaces && (workspaces->size() > 0) && (originalWorkspaceIndex < workspaces->size())) // restore in original workspace
|
if (workspaces && (!workspaces->empty()) && (originalWorkspaceIndex < workspaces->size())) // restore in original workspace
|
||||||
{
|
{
|
||||||
(*workspaces)[originalWorkspaceIndex]->addToMdiArea((QMdiSubWindow*) txChannelGUI);
|
(*workspaces)[originalWorkspaceIndex]->addToMdiArea((QMdiSubWindow*) txChannelGUI);
|
||||||
}
|
}
|
||||||
@ -523,19 +520,19 @@ void DeviceUISet::loadTxChannelSettings(const Preset *preset, PluginAPI *pluginA
|
|||||||
txChannelGUI,
|
txChannelGUI,
|
||||||
&ChannelGUI::moveToWorkspace,
|
&ChannelGUI::moveToWorkspace,
|
||||||
this,
|
this,
|
||||||
[=](int wsIndexDest){ MainWindow::getInstance()->channelMove(txChannelGUI, wsIndexDest); }
|
[txChannelGUI](int wsIndexDest){ MainWindow::getInstance()->channelMove(txChannelGUI, wsIndexDest); }
|
||||||
);
|
);
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
txChannelGUI,
|
txChannelGUI,
|
||||||
&ChannelGUI::duplicateChannelEmitted,
|
&ChannelGUI::duplicateChannelEmitted,
|
||||||
this,
|
this,
|
||||||
[=](){ MainWindow::getInstance()->channelDuplicate(txChannelGUI); }
|
[txChannelGUI](){ MainWindow::getInstance()->channelDuplicate(txChannelGUI); }
|
||||||
);
|
);
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
txChannelGUI,
|
txChannelGUI,
|
||||||
&ChannelGUI::moveToDeviceSet,
|
&ChannelGUI::moveToDeviceSet,
|
||||||
this,
|
this,
|
||||||
[=](int dsIndexDest){ MainWindow::getInstance()->channelMoveToDeviceSet(txChannelGUI, dsIndexDest); }
|
[txChannelGUI](int dsIndexDest){ MainWindow::getInstance()->channelMoveToDeviceSet(txChannelGUI, dsIndexDest); }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -586,9 +583,9 @@ void DeviceUISet::loadMIMOChannelSettings(const Preset *preset, PluginAPI *plugi
|
|||||||
m_deviceSet->clearChannels();
|
m_deviceSet->clearChannels();
|
||||||
qDebug("DeviceUISet::loadMIMOChannelSettings: %d channel(s) in preset", preset->getChannelCount());
|
qDebug("DeviceUISet::loadMIMOChannelSettings: %d channel(s) in preset", preset->getChannelCount());
|
||||||
|
|
||||||
for (int i = 0; i < preset->getChannelCount(); i++)
|
for (int j = 0; j < preset->getChannelCount(); j++)
|
||||||
{
|
{
|
||||||
const Preset::ChannelConfig& channelConfig = preset->getChannelConfig(i);
|
const Preset::ChannelConfig& channelConfig = preset->getChannelConfig(j);
|
||||||
ChannelGUI *channelGUI = nullptr;
|
ChannelGUI *channelGUI = nullptr;
|
||||||
ChannelAPI *channelAPI = nullptr;
|
ChannelAPI *channelAPI = nullptr;
|
||||||
|
|
||||||
@ -602,8 +599,8 @@ void DeviceUISet::loadMIMOChannelSettings(const Preset *preset, PluginAPI *plugi
|
|||||||
qDebug("DeviceUISet::loadMIMOChannelSettings: creating new MIMO channel [%s] from config [%s]",
|
qDebug("DeviceUISet::loadMIMOChannelSettings: creating new MIMO channel [%s] from config [%s]",
|
||||||
qPrintable((*channelMIMORegistrations)[i].m_channelIdURI),
|
qPrintable((*channelMIMORegistrations)[i].m_channelIdURI),
|
||||||
qPrintable(channelConfig.m_channelIdURI));
|
qPrintable(channelConfig.m_channelIdURI));
|
||||||
MIMOChannel *mimoChannel;
|
MIMOChannel *mimoChannel = nullptr;
|
||||||
PluginInterface *pluginInterface = (*channelMIMORegistrations)[i].m_plugin;
|
const PluginInterface *pluginInterface = (*channelMIMORegistrations)[i].m_plugin;
|
||||||
pluginInterface->createMIMOChannel(m_deviceAPI, &mimoChannel, &channelAPI);
|
pluginInterface->createMIMOChannel(m_deviceAPI, &mimoChannel, &channelAPI);
|
||||||
channelGUI = pluginInterface->createMIMOChannelGUI(this, mimoChannel);
|
channelGUI = pluginInterface->createMIMOChannelGUI(this, mimoChannel);
|
||||||
channelGUI->setDisplayedame(pluginInterface->getPluginDescriptor().displayedName);
|
channelGUI->setDisplayedame(pluginInterface->getPluginDescriptor().displayedName);
|
||||||
@ -612,7 +609,7 @@ void DeviceUISet::loadMIMOChannelSettings(const Preset *preset, PluginAPI *plugi
|
|||||||
channelGUI,
|
channelGUI,
|
||||||
&ChannelGUI::closing,
|
&ChannelGUI::closing,
|
||||||
this,
|
this,
|
||||||
[=](){ this->handleChannelGUIClosing(channelGUI); },
|
[this, channelGUI](){ this->handleChannelGUIClosing(channelGUI); },
|
||||||
Qt::QueuedConnection
|
Qt::QueuedConnection
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
@ -629,8 +626,8 @@ void DeviceUISet::loadMIMOChannelSettings(const Preset *preset, PluginAPI *plugi
|
|||||||
qDebug("DeviceUISet::loadMIMOChannelSettings: creating new Rx channel [%s] from config [%s]",
|
qDebug("DeviceUISet::loadMIMOChannelSettings: creating new Rx channel [%s] from config [%s]",
|
||||||
qPrintable((*channelRxRegistrations)[i].m_channelIdURI),
|
qPrintable((*channelRxRegistrations)[i].m_channelIdURI),
|
||||||
qPrintable(channelConfig.m_channelIdURI));
|
qPrintable(channelConfig.m_channelIdURI));
|
||||||
BasebandSampleSink *rxChannel;
|
BasebandSampleSink *rxChannel = nullptr;
|
||||||
PluginInterface *pluginInterface = (*channelRxRegistrations)[i].m_plugin;
|
const PluginInterface *pluginInterface = (*channelRxRegistrations)[i].m_plugin;
|
||||||
pluginInterface->createRxChannel(m_deviceAPI, &rxChannel, &channelAPI);
|
pluginInterface->createRxChannel(m_deviceAPI, &rxChannel, &channelAPI);
|
||||||
channelGUI = pluginInterface->createRxChannelGUI(this, rxChannel);
|
channelGUI = pluginInterface->createRxChannelGUI(this, rxChannel);
|
||||||
channelGUI->setDisplayedame(pluginInterface->getPluginDescriptor().displayedName);
|
channelGUI->setDisplayedame(pluginInterface->getPluginDescriptor().displayedName);
|
||||||
@ -639,7 +636,7 @@ void DeviceUISet::loadMIMOChannelSettings(const Preset *preset, PluginAPI *plugi
|
|||||||
channelGUI,
|
channelGUI,
|
||||||
&ChannelGUI::closing,
|
&ChannelGUI::closing,
|
||||||
this,
|
this,
|
||||||
[=](){ this->handleChannelGUIClosing(channelGUI); },
|
[this, channelGUI](){ this->handleChannelGUIClosing(channelGUI); },
|
||||||
Qt::QueuedConnection
|
Qt::QueuedConnection
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
@ -656,8 +653,8 @@ void DeviceUISet::loadMIMOChannelSettings(const Preset *preset, PluginAPI *plugi
|
|||||||
qDebug("DeviceUISet::loadMIMOChannelSettings: creating new Tx channel [%s] from config [%s]",
|
qDebug("DeviceUISet::loadMIMOChannelSettings: creating new Tx channel [%s] from config [%s]",
|
||||||
qPrintable((*channelTxRegistrations)[i].m_channelIdURI),
|
qPrintable((*channelTxRegistrations)[i].m_channelIdURI),
|
||||||
qPrintable(channelConfig.m_channelIdURI));
|
qPrintable(channelConfig.m_channelIdURI));
|
||||||
BasebandSampleSource *txChannel;
|
BasebandSampleSource *txChannel = nullptr;
|
||||||
PluginInterface *pluginInterface = (*channelTxRegistrations)[i].m_plugin;
|
const PluginInterface *pluginInterface = (*channelTxRegistrations)[i].m_plugin;
|
||||||
pluginInterface->createTxChannel(m_deviceAPI, &txChannel, &channelAPI);
|
pluginInterface->createTxChannel(m_deviceAPI, &txChannel, &channelAPI);
|
||||||
channelGUI = pluginInterface->createTxChannelGUI(this, txChannel);
|
channelGUI = pluginInterface->createTxChannelGUI(this, txChannel);
|
||||||
channelGUI->setDisplayedame(pluginInterface->getPluginDescriptor().displayedName);
|
channelGUI->setDisplayedame(pluginInterface->getPluginDescriptor().displayedName);
|
||||||
@ -672,7 +669,7 @@ void DeviceUISet::loadMIMOChannelSettings(const Preset *preset, PluginAPI *plugi
|
|||||||
channelGUI->deserialize(channelConfig.m_config);
|
channelGUI->deserialize(channelConfig.m_config);
|
||||||
int originalWorkspaceIndex = channelGUI->getWorkspaceIndex();
|
int originalWorkspaceIndex = channelGUI->getWorkspaceIndex();
|
||||||
|
|
||||||
if (workspaces && (workspaces->size() > 0) && (originalWorkspaceIndex < workspaces->size())) // restore in original workspace
|
if (workspaces && (!workspaces->empty()) && (originalWorkspaceIndex < workspaces->size())) // restore in original workspace
|
||||||
{
|
{
|
||||||
(*workspaces)[originalWorkspaceIndex]->addToMdiArea((QMdiSubWindow*) channelGUI);
|
(*workspaces)[originalWorkspaceIndex]->addToMdiArea((QMdiSubWindow*) channelGUI);
|
||||||
}
|
}
|
||||||
@ -697,26 +694,26 @@ void DeviceUISet::loadMIMOChannelSettings(const Preset *preset, PluginAPI *plugi
|
|||||||
channelGUI,
|
channelGUI,
|
||||||
&ChannelGUI::closing,
|
&ChannelGUI::closing,
|
||||||
this,
|
this,
|
||||||
[=](){ this->handleChannelGUIClosing(channelGUI); },
|
[this, channelGUI](){ this->handleChannelGUIClosing(channelGUI); },
|
||||||
Qt::QueuedConnection
|
Qt::QueuedConnection
|
||||||
);
|
);
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
channelGUI,
|
channelGUI,
|
||||||
&ChannelGUI::moveToWorkspace,
|
&ChannelGUI::moveToWorkspace,
|
||||||
this,
|
this,
|
||||||
[=](int wsIndexDest){ MainWindow::getInstance()->channelMove(channelGUI, wsIndexDest); }
|
[channelGUI](int wsIndexDest){ MainWindow::getInstance()->channelMove(channelGUI, wsIndexDest); }
|
||||||
);
|
);
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
channelGUI,
|
channelGUI,
|
||||||
&ChannelGUI::duplicateChannelEmitted,
|
&ChannelGUI::duplicateChannelEmitted,
|
||||||
this,
|
this,
|
||||||
[=](){ MainWindow::getInstance()->channelDuplicate(channelGUI); }
|
[channelGUI](){ MainWindow::getInstance()->channelDuplicate(channelGUI); }
|
||||||
);
|
);
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
channelGUI,
|
channelGUI,
|
||||||
&ChannelGUI::moveToDeviceSet,
|
&ChannelGUI::moveToDeviceSet,
|
||||||
this,
|
this,
|
||||||
[=](int dsIndexDest){ MainWindow::getInstance()->channelMoveToDeviceSet(channelGUI, dsIndexDest); }
|
[channelGUI](int dsIndexDest){ MainWindow::getInstance()->channelMoveToDeviceSet(channelGUI, dsIndexDest); }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -766,11 +763,11 @@ bool DeviceUISet::ChannelInstanceRegistration::operator<(const ChannelInstanceRe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceUISet::handleChannelGUIClosing(ChannelGUI* channelGUI)
|
void DeviceUISet::handleChannelGUIClosing(const ChannelGUI* channelGUI)
|
||||||
{
|
{
|
||||||
qDebug("DeviceUISet::handleChannelGUIClosing: %s: %d", qPrintable(channelGUI->getTitle()), channelGUI->getIndex());
|
qDebug("DeviceUISet::handleChannelGUIClosing: %s: %d", qPrintable(channelGUI->getTitle()), channelGUI->getIndex());
|
||||||
|
|
||||||
for (ChannelInstanceRegistrations::iterator it = m_channelInstanceRegistrations.begin(); it != m_channelInstanceRegistrations.end(); ++it)
|
for (auto it = m_channelInstanceRegistrations.begin(); it != m_channelInstanceRegistrations.end(); ++it)
|
||||||
{
|
{
|
||||||
if (it->m_gui == channelGUI)
|
if (it->m_gui == channelGUI)
|
||||||
{
|
{
|
||||||
@ -793,7 +790,7 @@ void DeviceUISet::handleChannelGUIClosing(ChannelGUI* channelGUI)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceUISet::handleDeleteChannel(ChannelAPI *channelAPI)
|
void DeviceUISet::handleDeleteChannel(ChannelAPI *channelAPI) const
|
||||||
{
|
{
|
||||||
channelAPI->destroy();
|
channelAPI->destroy();
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,6 @@ class SpectrumVis;
|
|||||||
class GLSpectrum;
|
class GLSpectrum;
|
||||||
class GLSpectrumGUI;
|
class GLSpectrumGUI;
|
||||||
class MainSpectrumGUI;
|
class MainSpectrumGUI;
|
||||||
// class ChannelWindow;
|
|
||||||
class DeviceAPI;
|
class DeviceAPI;
|
||||||
class DeviceSet;
|
class DeviceSet;
|
||||||
class DSPDeviceSourceEngine;
|
class DSPDeviceSourceEngine;
|
||||||
@ -61,7 +60,6 @@ public:
|
|||||||
GLSpectrum *m_spectrum;
|
GLSpectrum *m_spectrum;
|
||||||
GLSpectrumGUI *m_spectrumGUI;
|
GLSpectrumGUI *m_spectrumGUI;
|
||||||
MainSpectrumGUI *m_mainSpectrumGUI;
|
MainSpectrumGUI *m_mainSpectrumGUI;
|
||||||
// ChannelWindow *m_channelWindow;
|
|
||||||
DeviceAPI *m_deviceAPI;
|
DeviceAPI *m_deviceAPI;
|
||||||
DeviceGUI *m_deviceGUI;
|
DeviceGUI *m_deviceGUI;
|
||||||
DSPDeviceSourceEngine *m_deviceSourceEngine;
|
DSPDeviceSourceEngine *m_deviceSourceEngine;
|
||||||
@ -74,7 +72,7 @@ public:
|
|||||||
int m_selectedDeviceItemImdex;
|
int m_selectedDeviceItemImdex;
|
||||||
|
|
||||||
DeviceUISet(int deviceSetIndex, DeviceSet *deviceSet);
|
DeviceUISet(int deviceSetIndex, DeviceSet *deviceSet);
|
||||||
~DeviceUISet();
|
~DeviceUISet() final;
|
||||||
|
|
||||||
void setIndex(int deviceSetIndex);
|
void setIndex(int deviceSetIndex);
|
||||||
int getIndex() const { return m_deviceSetIndex; }
|
int getIndex() const { return m_deviceSetIndex; }
|
||||||
@ -146,10 +144,8 @@ private:
|
|||||||
bool operator<(const ChannelInstanceRegistration& other) const;
|
bool operator<(const ChannelInstanceRegistration& other) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef QList<ChannelInstanceRegistration> ChannelInstanceRegistrations;
|
using ChannelInstanceRegistrations = QList<ChannelInstanceRegistration>;
|
||||||
|
|
||||||
// ChannelInstanceRegistrations m_rxChannelInstanceRegistrations;
|
|
||||||
// ChannelInstanceRegistrations m_txChannelInstanceRegistrations;
|
|
||||||
ChannelInstanceRegistrations m_channelInstanceRegistrations;
|
ChannelInstanceRegistrations m_channelInstanceRegistrations;
|
||||||
int m_deviceSetIndex;
|
int m_deviceSetIndex;
|
||||||
DeviceSet *m_deviceSet;
|
DeviceSet *m_deviceSet;
|
||||||
@ -165,8 +161,8 @@ private:
|
|||||||
void saveMIMOChannelSettings(Preset* preset) const;
|
void saveMIMOChannelSettings(Preset* preset) const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleChannelGUIClosing(ChannelGUI* channelGUI);
|
void handleChannelGUIClosing(const ChannelGUI* channelGUI);
|
||||||
void handleDeleteChannel(ChannelAPI *channelAPI);
|
void handleDeleteChannel(ChannelAPI *channelAPI) const;
|
||||||
void onTimeSelected(int deviceSetIndex, float time);
|
void onTimeSelected(int deviceSetIndex, float time);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -69,27 +69,23 @@ class SerializableInterface;
|
|||||||
class QMenuBar;
|
class QMenuBar;
|
||||||
class Workspace;
|
class Workspace;
|
||||||
|
|
||||||
// namespace Ui {
|
|
||||||
// class MainWindow;
|
|
||||||
// }
|
|
||||||
|
|
||||||
class SDRGUI_API MainWindow : public QMainWindow {
|
class SDRGUI_API MainWindow : public QMainWindow {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parser, QWidget* parent = nullptr);
|
explicit MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parser, QWidget* parent = nullptr);
|
||||||
~MainWindow();
|
~MainWindow() final;
|
||||||
static MainWindow *getInstance() { return m_instance; } // Main Window is de facto a singleton so this just returns its reference
|
static MainWindow *getInstance() { return m_instance; } // Main Window is de facto a singleton so this just returns its reference
|
||||||
MessageQueue* getInputMessageQueue() { return &m_inputMessageQueue; }
|
MessageQueue* getInputMessageQueue() { return &m_inputMessageQueue; }
|
||||||
const PluginManager *getPluginManager() const { return m_pluginManager; }
|
const PluginManager *getPluginManager() const { return m_pluginManager; }
|
||||||
std::vector<DeviceUISet*>& getDeviceUISets() { return m_deviceUIs; }
|
std::vector<DeviceUISet*>& getDeviceUISets() { return m_deviceUIs; }
|
||||||
void commandKeysConnect(QObject *object, const char *slot);
|
void commandKeysConnect(const QObject *object, const char *slot);
|
||||||
void commandKeysDisconnect(QObject *object, const char *slot);
|
void commandKeysDisconnect(const QObject *object, const char *slot) const;
|
||||||
int getNumberOfWorkspaces() const { return m_workspaces.size(); }
|
int getNumberOfWorkspaces() const { return m_workspaces.size(); }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void channelMove(ChannelGUI *gui, int wsIndexDestination);
|
void channelMove(ChannelGUI *gui, int wsIndexDestination);
|
||||||
void channelDuplicate(ChannelGUI *gui);
|
void channelDuplicate(const ChannelGUI *gui);
|
||||||
void channelMoveToDeviceSet(ChannelGUI *gui, int dsIndexDestination);
|
void channelMoveToDeviceSet(ChannelGUI *gui, int dsIndexDestination);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -101,14 +97,13 @@ private:
|
|||||||
struct DeviceWidgetTabData
|
struct DeviceWidgetTabData
|
||||||
{
|
{
|
||||||
QWidget *gui;
|
QWidget *gui;
|
||||||
QString displayName;
|
QString displayName;
|
||||||
QString tabName;
|
QString tabName;
|
||||||
};
|
};
|
||||||
|
|
||||||
static MainWindow *m_instance;
|
static MainWindow *m_instance;
|
||||||
QList<Workspace*> m_workspaces;
|
QList<Workspace*> m_workspaces;
|
||||||
Workspace *m_currentWorkspace;
|
Workspace *m_currentWorkspace;
|
||||||
// Ui::MainWindow* ui;
|
|
||||||
MessageQueue m_inputMessageQueue;
|
MessageQueue m_inputMessageQueue;
|
||||||
MainCore *m_mainCore;
|
MainCore *m_mainCore;
|
||||||
std::vector<DeviceUISet*> m_deviceUIs;
|
std::vector<DeviceUISet*> m_deviceUIs;
|
||||||
@ -143,10 +138,10 @@ private:
|
|||||||
void loadFeatureSetPresetSettings(const FeatureSetPreset* preset, int featureSetIndex, Workspace *workspace);
|
void loadFeatureSetPresetSettings(const FeatureSetPreset* preset, int featureSetIndex, Workspace *workspace);
|
||||||
void saveFeatureSetPresetSettings(FeatureSetPreset* preset, int featureSetIndex);
|
void saveFeatureSetPresetSettings(FeatureSetPreset* preset, int featureSetIndex);
|
||||||
|
|
||||||
QString openGLVersion();
|
QString openGLVersion() const;
|
||||||
void createMenuBar(QToolButton *button);
|
void createMenuBar(QToolButton *button) const;
|
||||||
void createStatusBar();
|
void createStatusBar();
|
||||||
void closeEvent(QCloseEvent*);
|
void closeEvent(QCloseEvent*) final;
|
||||||
void applySettings();
|
void applySettings();
|
||||||
|
|
||||||
void removeDeviceSet(int deviceSetIndex);
|
void removeDeviceSet(int deviceSetIndex);
|
||||||
@ -155,7 +150,7 @@ private:
|
|||||||
void removeFeatureSet(unsigned int featureSetIndex);
|
void removeFeatureSet(unsigned int featureSetIndex);
|
||||||
void removeAllFeatureSets();
|
void removeAllFeatureSets();
|
||||||
void deleteChannel(int deviceSetIndex, int channelIndex);
|
void deleteChannel(int deviceSetIndex, int channelIndex);
|
||||||
void channelDuplicateToDeviceSet(ChannelGUI *sourceChannelGUI, int dsIndexDestination);
|
void channelDuplicateToDeviceSet(const ChannelGUI *sourceChannelGUI, int dsIndexDestination);
|
||||||
void sampleDeviceChange(int deviceType, int deviceSetIndex, int newDeviceIndex, Workspace *workspace);
|
void sampleDeviceChange(int deviceType, int deviceSetIndex, int newDeviceIndex, Workspace *workspace);
|
||||||
void sampleSourceChange(int deviceSetIndex, int newDeviceIndex, Workspace *workspace);
|
void sampleSourceChange(int deviceSetIndex, int newDeviceIndex, Workspace *workspace);
|
||||||
void sampleSinkChange(int deviceSetIndex, int newDeviceIndex, Workspace *workspace);
|
void sampleSinkChange(int deviceSetIndex, int newDeviceIndex, Workspace *workspace);
|
||||||
@ -181,7 +176,7 @@ private:
|
|||||||
bool handleMessage(const Message& cmd);
|
bool handleMessage(const Message& cmd);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void keyPressEvent(QKeyEvent* event) override;
|
void keyPressEvent(QKeyEvent* event) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleMessages();
|
void handleMessages();
|
||||||
@ -202,39 +197,39 @@ private slots:
|
|||||||
void on_action_My_Position_triggered();
|
void on_action_My_Position_triggered();
|
||||||
void on_action_DeviceUserArguments_triggered();
|
void on_action_DeviceUserArguments_triggered();
|
||||||
void on_action_commands_triggered();
|
void on_action_commands_triggered();
|
||||||
void on_action_Quick_Start_triggered();
|
void on_action_Quick_Start_triggered() const;
|
||||||
void on_action_Main_Window_triggered();
|
void on_action_Main_Window_triggered() const;
|
||||||
void on_action_Loaded_Plugins_triggered();
|
void on_action_Loaded_Plugins_triggered();
|
||||||
void on_action_About_triggered();
|
void on_action_About_triggered();
|
||||||
|
|
||||||
void updateStatus();
|
void updateStatus();
|
||||||
void addWorkspace();
|
void addWorkspace();
|
||||||
void viewAllWorkspaces();
|
void viewAllWorkspaces() const;
|
||||||
void removeEmptyWorkspaces();
|
void removeEmptyWorkspaces();
|
||||||
void openConfigurationDialog(bool openOnly);
|
void openConfigurationDialog(bool openOnly);
|
||||||
void loadDefaultConfigurations();
|
void loadDefaultConfigurations() const;
|
||||||
void loadConfiguration(const Configuration *configuration, bool fromDialog = false);
|
void loadConfiguration(const Configuration *configuration, bool fromDialog = false);
|
||||||
void saveConfiguration(Configuration *configuration);
|
void saveConfiguration(Configuration *configuration);
|
||||||
void sampleSourceAdd(Workspace *deviceWorkspace, Workspace *spectrumWorkspace, int deviceIndex);
|
void sampleSourceAdd(Workspace *deviceWorkspace, Workspace *spectrumWorkspace, int deviceIndex);
|
||||||
void sampleSinkAdd(Workspace *workspace, Workspace *spectrumWorkspace, int deviceIndex);
|
void sampleSinkAdd(Workspace *workspace, Workspace *spectrumWorkspace, int deviceIndex);
|
||||||
void sampleMIMOAdd(Workspace *workspace, Workspace *spectrumWorkspace, int deviceIndex);
|
void sampleMIMOAdd(Workspace *workspace, Workspace *spectrumWorkspace, int deviceIndex);
|
||||||
void samplingDeviceChangeHandler(DeviceGUI *deviceGUI, int newDeviceIndex);
|
void samplingDeviceChangeHandler(const DeviceGUI *deviceGUI, int newDeviceIndex);
|
||||||
void channelAddClicked(Workspace *workspace, int deviceSetIndex, int channelPluginIndex);
|
void channelAddClicked(Workspace *workspace, int deviceSetIndex, int channelPluginIndex);
|
||||||
void featureAddClicked(Workspace *workspace, int featureIndex);
|
void featureAddClicked(Workspace *workspace, int featureIndex);
|
||||||
void featureMove(FeatureGUI *gui, int wsIndexDestnation);
|
void featureMove(FeatureGUI *gui, int wsIndexDestnation);
|
||||||
void deviceStateChanged(DeviceAPI *deviceAPI);
|
void deviceStateChanged(DeviceAPI *deviceAPI);
|
||||||
void openFeaturePresetsDialog(QPoint p, Workspace *workspace);
|
void openFeaturePresetsDialog(QPoint p, Workspace *workspace);
|
||||||
void startAllDevices(Workspace *workspace);
|
void startAllDevices(const Workspace *workspace) const;
|
||||||
void stopAllDevices(Workspace *workspace);
|
void stopAllDevices(const Workspace *workspace) const;
|
||||||
void deviceMove(DeviceGUI *gui, int wsIndexDestnation);
|
void deviceMove(DeviceGUI *gui, int wsIndexDestnation);
|
||||||
void mainSpectrumMove(MainSpectrumGUI *gui, int wsIndexDestnation);
|
void mainSpectrumMove(MainSpectrumGUI *gui, int wsIndexDestnation);
|
||||||
void mainSpectrumShow(int deviceSetIndex);
|
void mainSpectrumShow(int deviceSetIndex);
|
||||||
void mainSpectrumRequestDeviceCenterFrequency(int deviceSetIndex, qint64 deviceCenterFrequency);
|
void mainSpectrumRequestDeviceCenterFrequency(int deviceSetIndex, qint64 deviceCenterFrequency);
|
||||||
void showAllChannels(int deviceSetIndex);
|
void showAllChannels(int deviceSetIndex);
|
||||||
void openDeviceSetPresetsDialog(QPoint p, DeviceGUI *deviceGUI);
|
void openDeviceSetPresetsDialog(QPoint p, const DeviceGUI *deviceGUI);
|
||||||
void commandKeyPressed(Qt::Key key, Qt::KeyboardModifiers keyModifiers, bool release);
|
void commandKeyPressed(Qt::Key key, Qt::KeyboardModifiers keyModifiers, bool release) const;
|
||||||
void fftWisdomProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
void fftWisdomProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
||||||
void orientationChanged(Qt::ScreenOrientation orientation);
|
void orientationChanged(Qt::ScreenOrientation orientation) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDE_MAINWINDOW_H
|
#endif // INCLUDE_MAINWINDOW_H
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
#include "mainparser.h"
|
#include "mainparser.h"
|
||||||
#include "mainserver.h"
|
#include "mainserver.h"
|
||||||
|
|
||||||
MainServer *MainServer::m_instance = 0;
|
MainServer *MainServer::m_instance = nullptr;
|
||||||
|
|
||||||
MainServer::MainServer(qtwebapp::LoggerWithFile *logger, const MainParser& parser, QObject *parent) :
|
MainServer::MainServer(qtwebapp::LoggerWithFile *logger, const MainParser& parser, QObject *parent) :
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
@ -74,7 +74,7 @@ MainServer::MainServer(qtwebapp::LoggerWithFile *logger, const MainParser& parse
|
|||||||
loadSettings();
|
loadSettings();
|
||||||
|
|
||||||
qDebug() << "MainServer::MainServer: finishing...";
|
qDebug() << "MainServer::MainServer: finishing...";
|
||||||
QString applicationDirPath = QCoreApplication::instance()->applicationDirPath();
|
QString applicationDirPath = QCoreApplication::applicationDirPath();
|
||||||
|
|
||||||
m_apiAdapter = new WebAPIAdapter();
|
m_apiAdapter = new WebAPIAdapter();
|
||||||
m_requestMapper = new WebAPIRequestMapper(this);
|
m_requestMapper = new WebAPIRequestMapper(this);
|
||||||
@ -89,7 +89,7 @@ MainServer::MainServer(qtwebapp::LoggerWithFile *logger, const MainParser& parse
|
|||||||
|
|
||||||
MainServer::~MainServer()
|
MainServer::~MainServer()
|
||||||
{
|
{
|
||||||
while (m_mainCore->m_deviceSets.size() > 0) {
|
while (!m_mainCore->m_deviceSets.empty()) {
|
||||||
removeLastDevice();
|
removeLastDevice();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ bool MainServer::handleMessage(const Message& cmd)
|
|||||||
{
|
{
|
||||||
if (MainCore::MsgDeleteInstance::match(cmd))
|
if (MainCore::MsgDeleteInstance::match(cmd))
|
||||||
{
|
{
|
||||||
while (m_mainCore->m_deviceSets.size() > 0)
|
while (!m_mainCore->m_deviceSets.empty())
|
||||||
{
|
{
|
||||||
removeLastDevice();
|
removeLastDevice();
|
||||||
}
|
}
|
||||||
@ -118,13 +118,13 @@ bool MainServer::handleMessage(const Message& cmd)
|
|||||||
}
|
}
|
||||||
else if (MainCore::MsgLoadPreset::match(cmd))
|
else if (MainCore::MsgLoadPreset::match(cmd))
|
||||||
{
|
{
|
||||||
MainCore::MsgLoadPreset& notif = (MainCore::MsgLoadPreset&) cmd;
|
auto& notif = (const MainCore::MsgLoadPreset&) cmd;
|
||||||
loadPresetSettings(notif.getPreset(), notif.getDeviceSetIndex());
|
loadPresetSettings(notif.getPreset(), notif.getDeviceSetIndex());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (MainCore::MsgSavePreset::match(cmd))
|
else if (MainCore::MsgSavePreset::match(cmd))
|
||||||
{
|
{
|
||||||
MainCore::MsgSavePreset& notif = (MainCore::MsgSavePreset&) cmd;
|
auto& notif = (const MainCore::MsgSavePreset&) cmd;
|
||||||
savePresetSettings(notif.getPreset(), notif.getDeviceSetIndex());
|
savePresetSettings(notif.getPreset(), notif.getDeviceSetIndex());
|
||||||
m_mainCore->m_settings.sortPresets();
|
m_mainCore->m_settings.sortPresets();
|
||||||
m_mainCore->m_settings.save();
|
m_mainCore->m_settings.save();
|
||||||
@ -132,7 +132,7 @@ bool MainServer::handleMessage(const Message& cmd)
|
|||||||
}
|
}
|
||||||
else if (MainCore::MsgDeletePreset::match(cmd))
|
else if (MainCore::MsgDeletePreset::match(cmd))
|
||||||
{
|
{
|
||||||
MainCore::MsgDeletePreset& notif = (MainCore::MsgDeletePreset&) cmd;
|
auto& notif = (const MainCore::MsgDeletePreset&) cmd;
|
||||||
const Preset *presetToDelete = notif.getPreset();
|
const Preset *presetToDelete = notif.getPreset();
|
||||||
// remove preset from settings
|
// remove preset from settings
|
||||||
m_mainCore->m_settings.deletePreset(presetToDelete);
|
m_mainCore->m_settings.deletePreset(presetToDelete);
|
||||||
@ -140,7 +140,7 @@ bool MainServer::handleMessage(const Message& cmd)
|
|||||||
}
|
}
|
||||||
else if (MainCore::MsgDeleteConfiguration::match(cmd))
|
else if (MainCore::MsgDeleteConfiguration::match(cmd))
|
||||||
{
|
{
|
||||||
MainCore::MsgDeleteConfiguration& notif = (MainCore::MsgDeleteConfiguration&) cmd;
|
auto& notif = (const MainCore::MsgDeleteConfiguration&) cmd;
|
||||||
const Configuration *configuationToDelete = notif.getConfiguration();
|
const Configuration *configuationToDelete = notif.getConfiguration();
|
||||||
// remove configuration from settings
|
// remove configuration from settings
|
||||||
m_mainCore->m_settings.deleteConfiguration(configuationToDelete);
|
m_mainCore->m_settings.deleteConfiguration(configuationToDelete);
|
||||||
@ -148,13 +148,13 @@ bool MainServer::handleMessage(const Message& cmd)
|
|||||||
}
|
}
|
||||||
else if (MainCore::MsgLoadFeatureSetPreset::match(cmd))
|
else if (MainCore::MsgLoadFeatureSetPreset::match(cmd))
|
||||||
{
|
{
|
||||||
MainCore::MsgLoadFeatureSetPreset& notif = (MainCore::MsgLoadFeatureSetPreset&) cmd;
|
auto& notif = (const MainCore::MsgLoadFeatureSetPreset&) cmd;
|
||||||
loadFeatureSetPresetSettings(notif.getPreset(), notif.getFeatureSetIndex());
|
loadFeatureSetPresetSettings(notif.getPreset(), notif.getFeatureSetIndex());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (MainCore::MsgSaveFeatureSetPreset::match(cmd))
|
else if (MainCore::MsgSaveFeatureSetPreset::match(cmd))
|
||||||
{
|
{
|
||||||
MainCore::MsgSaveFeatureSetPreset& notif = (MainCore::MsgSaveFeatureSetPreset&) cmd;
|
auto& notif = (const MainCore::MsgSaveFeatureSetPreset&) cmd;
|
||||||
saveFeatureSetPresetSettings(notif.getPreset(), notif.getFeatureSetIndex());
|
saveFeatureSetPresetSettings(notif.getPreset(), notif.getFeatureSetIndex());
|
||||||
m_mainCore->m_settings.sortPresets();
|
m_mainCore->m_settings.sortPresets();
|
||||||
m_mainCore->m_settings.save();
|
m_mainCore->m_settings.save();
|
||||||
@ -162,7 +162,7 @@ bool MainServer::handleMessage(const Message& cmd)
|
|||||||
}
|
}
|
||||||
else if (MainCore::MsgDeleteFeatureSetPreset::match(cmd))
|
else if (MainCore::MsgDeleteFeatureSetPreset::match(cmd))
|
||||||
{
|
{
|
||||||
MainCore::MsgDeleteFeatureSetPreset& notif = (MainCore::MsgDeleteFeatureSetPreset&) cmd;
|
auto& notif = (const MainCore::MsgDeleteFeatureSetPreset&) cmd;
|
||||||
const FeatureSetPreset *presetToDelete = notif.getPreset();
|
const FeatureSetPreset *presetToDelete = notif.getPreset();
|
||||||
// remove preset from settings
|
// remove preset from settings
|
||||||
m_mainCore->m_settings.deleteFeatureSetPreset(presetToDelete);
|
m_mainCore->m_settings.deleteFeatureSetPreset(presetToDelete);
|
||||||
@ -170,7 +170,7 @@ bool MainServer::handleMessage(const Message& cmd)
|
|||||||
}
|
}
|
||||||
else if (MainCore::MsgAddDeviceSet::match(cmd))
|
else if (MainCore::MsgAddDeviceSet::match(cmd))
|
||||||
{
|
{
|
||||||
MainCore::MsgAddDeviceSet& notif = (MainCore::MsgAddDeviceSet&) cmd;
|
auto& notif = (const MainCore::MsgAddDeviceSet&) cmd;
|
||||||
int direction = notif.getDirection();
|
int direction = notif.getDirection();
|
||||||
|
|
||||||
if (direction == 1) { // Single stream Tx
|
if (direction == 1) { // Single stream Tx
|
||||||
@ -185,7 +185,7 @@ bool MainServer::handleMessage(const Message& cmd)
|
|||||||
}
|
}
|
||||||
else if (MainCore::MsgRemoveLastDeviceSet::match(cmd))
|
else if (MainCore::MsgRemoveLastDeviceSet::match(cmd))
|
||||||
{
|
{
|
||||||
if (m_mainCore->m_deviceSets.size() > 0) {
|
if (!m_mainCore->m_deviceSets.empty()) {
|
||||||
removeLastDevice();
|
removeLastDevice();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,7 +193,7 @@ bool MainServer::handleMessage(const Message& cmd)
|
|||||||
}
|
}
|
||||||
else if (MainCore::MsgSetDevice::match(cmd))
|
else if (MainCore::MsgSetDevice::match(cmd))
|
||||||
{
|
{
|
||||||
MainCore::MsgSetDevice& notif = (MainCore::MsgSetDevice&) cmd;
|
auto& notif = (const MainCore::MsgSetDevice&) cmd;
|
||||||
|
|
||||||
if (notif.getDeviceType() == 1) {
|
if (notif.getDeviceType() == 1) {
|
||||||
changeSampleSink(notif.getDeviceSetIndex(), notif.getDeviceIndex());
|
changeSampleSink(notif.getDeviceSetIndex(), notif.getDeviceIndex());
|
||||||
@ -206,26 +206,26 @@ bool MainServer::handleMessage(const Message& cmd)
|
|||||||
}
|
}
|
||||||
else if (MainCore::MsgAddChannel::match(cmd))
|
else if (MainCore::MsgAddChannel::match(cmd))
|
||||||
{
|
{
|
||||||
MainCore::MsgAddChannel& notif = (MainCore::MsgAddChannel&) cmd;
|
auto& notif = (const MainCore::MsgAddChannel&) cmd;
|
||||||
addChannel(notif.getDeviceSetIndex(), notif.getChannelRegistrationIndex());
|
addChannel(notif.getDeviceSetIndex(), notif.getChannelRegistrationIndex());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (MainCore::MsgDeleteChannel::match(cmd))
|
else if (MainCore::MsgDeleteChannel::match(cmd))
|
||||||
{
|
{
|
||||||
MainCore::MsgDeleteChannel& notif = (MainCore::MsgDeleteChannel&) cmd;
|
auto& notif = (const MainCore::MsgDeleteChannel&) cmd;
|
||||||
deleteChannel(notif.getDeviceSetIndex(), notif.getChannelIndex());
|
deleteChannel(notif.getDeviceSetIndex(), notif.getChannelIndex());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (MainCore::MsgAddFeature::match(cmd))
|
else if (MainCore::MsgAddFeature::match(cmd))
|
||||||
{
|
{
|
||||||
MainCore::MsgAddFeature& notif = (MainCore::MsgAddFeature&) cmd;
|
auto& notif = (const MainCore::MsgAddFeature&) cmd;
|
||||||
addFeature(0, notif.getFeatureRegistrationIndex());
|
addFeature(0, notif.getFeatureRegistrationIndex());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (MainCore::MsgDeleteFeature::match(cmd))
|
else if (MainCore::MsgDeleteFeature::match(cmd))
|
||||||
{
|
{
|
||||||
MainCore::MsgDeleteFeature& notif = (MainCore::MsgDeleteFeature&) cmd;
|
auto& notif = (const MainCore::MsgDeleteFeature&) cmd;
|
||||||
deleteFeature(0, notif.getFeatureIndex());
|
deleteFeature(0, notif.getFeatureIndex());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -244,7 +244,7 @@ void MainServer::handleMessages()
|
|||||||
{
|
{
|
||||||
Message* message;
|
Message* message;
|
||||||
|
|
||||||
while ((message = m_inputMessageQueue.pop()) != 0)
|
while ((message = m_inputMessageQueue.pop()) != nullptr)
|
||||||
{
|
{
|
||||||
qDebug("MainServer::handleMessages: message: %s", message->getIdentifier());
|
qDebug("MainServer::handleMessages: message: %s", message->getIdentifier());
|
||||||
handleMessage(*message);
|
handleMessage(*message);
|
||||||
@ -271,21 +271,14 @@ void MainServer::addSinkDevice()
|
|||||||
{
|
{
|
||||||
DSPDeviceSinkEngine *dspDeviceSinkEngine = m_dspEngine->addDeviceSinkEngine();
|
DSPDeviceSinkEngine *dspDeviceSinkEngine = m_dspEngine->addDeviceSinkEngine();
|
||||||
|
|
||||||
uint dspDeviceSinkEngineUID = dspDeviceSinkEngine->getUID();
|
auto deviceTabIndex = (int) m_mainCore->m_deviceSets.size();
|
||||||
char uidCStr[16];
|
|
||||||
sprintf(uidCStr, "UID:%d", dspDeviceSinkEngineUID);
|
|
||||||
|
|
||||||
int deviceTabIndex = m_mainCore->m_deviceSets.size();
|
|
||||||
m_mainCore->m_deviceSets.push_back(new DeviceSet(deviceTabIndex, 1));
|
m_mainCore->m_deviceSets.push_back(new DeviceSet(deviceTabIndex, 1));
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceSourceEngine = nullptr;
|
m_mainCore->m_deviceSets.back()->m_deviceSourceEngine = nullptr;
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceSinkEngine = dspDeviceSinkEngine;
|
m_mainCore->m_deviceSets.back()->m_deviceSinkEngine = dspDeviceSinkEngine;
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceMIMOEngine = nullptr;
|
m_mainCore->m_deviceSets.back()->m_deviceMIMOEngine = nullptr;
|
||||||
dspDeviceSinkEngine->addSpectrumSink(m_mainCore->m_deviceSets.back()->m_spectrumVis);
|
dspDeviceSinkEngine->addSpectrumSink(m_mainCore->m_deviceSets.back()->m_spectrumVis);
|
||||||
|
|
||||||
char tabNameCStr[16];
|
auto *deviceAPI = new DeviceAPI(DeviceAPI::StreamSingleTx, deviceTabIndex, nullptr, dspDeviceSinkEngine, nullptr);
|
||||||
sprintf(tabNameCStr, "T%d", deviceTabIndex);
|
|
||||||
|
|
||||||
DeviceAPI *deviceAPI = new DeviceAPI(DeviceAPI::StreamSingleTx, deviceTabIndex, nullptr, dspDeviceSinkEngine, nullptr);
|
|
||||||
|
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceAPI = deviceAPI;
|
m_mainCore->m_deviceSets.back()->m_deviceAPI = deviceAPI;
|
||||||
QList<QString> channelNames;
|
QList<QString> channelNames;
|
||||||
@ -318,14 +311,14 @@ void MainServer::addSourceDevice()
|
|||||||
{
|
{
|
||||||
DSPDeviceSourceEngine *dspDeviceSourceEngine = m_dspEngine->addDeviceSourceEngine();
|
DSPDeviceSourceEngine *dspDeviceSourceEngine = m_dspEngine->addDeviceSourceEngine();
|
||||||
|
|
||||||
int deviceTabIndex = m_mainCore->m_deviceSets.size();
|
auto deviceTabIndex = (int) m_mainCore->m_deviceSets.size();
|
||||||
m_mainCore->m_deviceSets.push_back(new DeviceSet(deviceTabIndex, 0));
|
m_mainCore->m_deviceSets.push_back(new DeviceSet(deviceTabIndex, 0));
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceSourceEngine = dspDeviceSourceEngine;
|
m_mainCore->m_deviceSets.back()->m_deviceSourceEngine = dspDeviceSourceEngine;
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceSinkEngine = nullptr;
|
m_mainCore->m_deviceSets.back()->m_deviceSinkEngine = nullptr;
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceMIMOEngine = nullptr;
|
m_mainCore->m_deviceSets.back()->m_deviceMIMOEngine = nullptr;
|
||||||
dspDeviceSourceEngine->addSink(m_mainCore->m_deviceSets.back()->m_spectrumVis);
|
dspDeviceSourceEngine->addSink(m_mainCore->m_deviceSets.back()->m_spectrumVis);
|
||||||
|
|
||||||
DeviceAPI *deviceAPI = new DeviceAPI(DeviceAPI::StreamSingleRx, deviceTabIndex, dspDeviceSourceEngine, nullptr, nullptr);
|
auto *deviceAPI = new DeviceAPI(DeviceAPI::StreamSingleRx, deviceTabIndex, dspDeviceSourceEngine, nullptr, nullptr);
|
||||||
|
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceAPI = deviceAPI;
|
m_mainCore->m_deviceSets.back()->m_deviceAPI = deviceAPI;
|
||||||
|
|
||||||
@ -357,14 +350,14 @@ void MainServer::addMIMODevice()
|
|||||||
{
|
{
|
||||||
DSPDeviceMIMOEngine *dspDeviceMIMOEngine = m_dspEngine->addDeviceMIMOEngine();
|
DSPDeviceMIMOEngine *dspDeviceMIMOEngine = m_dspEngine->addDeviceMIMOEngine();
|
||||||
|
|
||||||
int deviceTabIndex = m_mainCore->m_deviceSets.size();
|
auto deviceTabIndex = (int) m_mainCore->m_deviceSets.size();
|
||||||
m_mainCore->m_deviceSets.push_back(new DeviceSet(deviceTabIndex, 2));
|
m_mainCore->m_deviceSets.push_back(new DeviceSet(deviceTabIndex, 2));
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceSourceEngine = nullptr;
|
m_mainCore->m_deviceSets.back()->m_deviceSourceEngine = nullptr;
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceSinkEngine = nullptr;
|
m_mainCore->m_deviceSets.back()->m_deviceSinkEngine = nullptr;
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceMIMOEngine = dspDeviceMIMOEngine;
|
m_mainCore->m_deviceSets.back()->m_deviceMIMOEngine = dspDeviceMIMOEngine;
|
||||||
dspDeviceMIMOEngine->addSpectrumSink(m_mainCore->m_deviceSets.back()->m_spectrumVis);
|
dspDeviceMIMOEngine->addSpectrumSink(m_mainCore->m_deviceSets.back()->m_spectrumVis);
|
||||||
|
|
||||||
DeviceAPI *deviceAPI = new DeviceAPI(DeviceAPI::StreamMIMO, deviceTabIndex, nullptr, nullptr, dspDeviceMIMOEngine);
|
auto *deviceAPI = new DeviceAPI(DeviceAPI::StreamMIMO, deviceTabIndex, nullptr, nullptr, dspDeviceMIMOEngine);
|
||||||
|
|
||||||
// create a test MIMO by default
|
// create a test MIMO by default
|
||||||
int testMIMODeviceIndex = DeviceEnumerator::instance()->getTestMIMODeviceIndex();
|
int testMIMODeviceIndex = DeviceEnumerator::instance()->getTestMIMODeviceIndex();
|
||||||
@ -392,12 +385,10 @@ void MainServer::addMIMODevice()
|
|||||||
|
|
||||||
void MainServer::removeLastDevice()
|
void MainServer::removeLastDevice()
|
||||||
{
|
{
|
||||||
int removedTabIndex = m_mainCore->m_deviceSets.size() - 1;
|
auto removedTabIndex = (int) (m_mainCore->m_deviceSets.size() - 1);
|
||||||
|
|
||||||
if (m_mainCore->m_deviceSets.back()->m_deviceSourceEngine) // source set
|
if (m_mainCore->m_deviceSets.back()->m_deviceSourceEngine) // source set
|
||||||
{
|
{
|
||||||
DSPDeviceSourceEngine *lastDeviceEngine = m_mainCore->m_deviceSets.back()->m_deviceSourceEngine;
|
|
||||||
|
|
||||||
// deletes old UI and input object
|
// deletes old UI and input object
|
||||||
m_mainCore->m_deviceSets.back()->freeChannels(); // destroys the channel instances
|
m_mainCore->m_deviceSets.back()->freeChannels(); // destroys the channel instances
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->resetSamplingDeviceId();
|
m_mainCore->m_deviceSets.back()->m_deviceAPI->resetSamplingDeviceId();
|
||||||
@ -412,8 +403,6 @@ void MainServer::removeLastDevice()
|
|||||||
}
|
}
|
||||||
else if (m_mainCore->m_deviceSets.back()->m_deviceSinkEngine) // sink set
|
else if (m_mainCore->m_deviceSets.back()->m_deviceSinkEngine) // sink set
|
||||||
{
|
{
|
||||||
DSPDeviceSinkEngine *lastDeviceEngine = m_mainCore->m_deviceSets.back()->m_deviceSinkEngine;
|
|
||||||
|
|
||||||
// deletes old UI and output object
|
// deletes old UI and output object
|
||||||
m_mainCore->m_deviceSets.back()->freeChannels();
|
m_mainCore->m_deviceSets.back()->freeChannels();
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->resetSamplingDeviceId();
|
m_mainCore->m_deviceSets.back()->m_deviceAPI->resetSamplingDeviceId();
|
||||||
@ -428,8 +417,6 @@ void MainServer::removeLastDevice()
|
|||||||
}
|
}
|
||||||
else if (m_mainCore->m_deviceSets.back()->m_deviceMIMOEngine) // MIMO set
|
else if (m_mainCore->m_deviceSets.back()->m_deviceMIMOEngine) // MIMO set
|
||||||
{
|
{
|
||||||
DSPDeviceMIMOEngine *lastDeviceEngine = m_mainCore->m_deviceSets.back()->m_deviceMIMOEngine;
|
|
||||||
|
|
||||||
m_mainCore->m_deviceSets.back()->freeChannels();
|
m_mainCore->m_deviceSets.back()->freeChannels();
|
||||||
m_mainCore->m_deviceSets.back()->m_deviceAPI->resetSamplingDeviceId();
|
m_mainCore->m_deviceSets.back()->m_deviceAPI->resetSamplingDeviceId();
|
||||||
|
|
||||||
@ -486,19 +473,17 @@ void MainServer::changeSampleSource(int deviceSetIndex, int selectedDeviceIndex)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add to buddies list
|
// add to buddies list
|
||||||
std::vector<DeviceSet*>::iterator it = m_mainCore->m_deviceSets.begin();
|
auto it = m_mainCore->m_deviceSets.begin();
|
||||||
int nbOfBuddies = 0;
|
int nbOfBuddies = 0;
|
||||||
|
|
||||||
for (; it != m_mainCore->m_deviceSets.end(); ++it)
|
for (; it != m_mainCore->m_deviceSets.end(); ++it)
|
||||||
{
|
{
|
||||||
if (*it != deviceSet) // do not add to itself
|
if ((*it != deviceSet) && // do not add to itself
|
||||||
|
(deviceSet->m_deviceAPI->getHardwareId() == (*it)->m_deviceAPI->getHardwareId()) &&
|
||||||
|
(deviceSet->m_deviceAPI->getSamplingDeviceSerial() == (*it)->m_deviceAPI->getSamplingDeviceSerial()))
|
||||||
{
|
{
|
||||||
if ((deviceSet->m_deviceAPI->getHardwareId() == (*it)->m_deviceAPI->getHardwareId()) &&
|
(*it)->m_deviceAPI->addBuddy(deviceSet->m_deviceAPI);
|
||||||
(deviceSet->m_deviceAPI->getSamplingDeviceSerial() == (*it)->m_deviceAPI->getSamplingDeviceSerial()))
|
nbOfBuddies++;
|
||||||
{
|
|
||||||
(*it)->m_deviceAPI->addBuddy(deviceSet->m_deviceAPI);
|
|
||||||
nbOfBuddies++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -547,7 +532,7 @@ void MainServer::changeSampleSink(int deviceSetIndex, int selectedDeviceIndex)
|
|||||||
{
|
{
|
||||||
qDebug("MainServer::changeSampleSink: non existent device replaced by File Sink");
|
qDebug("MainServer::changeSampleSink: non existent device replaced by File Sink");
|
||||||
int fileSinkDeviceIndex = DeviceEnumerator::instance()->getFileOutputDeviceIndex();
|
int fileSinkDeviceIndex = DeviceEnumerator::instance()->getFileOutputDeviceIndex();
|
||||||
const PluginInterface::SamplingDevice *samplingDevice = DeviceEnumerator::instance()->getTxSamplingDevice(fileSinkDeviceIndex);
|
samplingDevice = DeviceEnumerator::instance()->getTxSamplingDevice(fileSinkDeviceIndex);
|
||||||
deviceSet->m_deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence);
|
deviceSet->m_deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence);
|
||||||
deviceSet->m_deviceAPI->setDeviceNbItems(samplingDevice->deviceNbItems);
|
deviceSet->m_deviceAPI->setDeviceNbItems(samplingDevice->deviceNbItems);
|
||||||
deviceSet->m_deviceAPI->setDeviceItemIndex(samplingDevice->deviceItemIndex);
|
deviceSet->m_deviceAPI->setDeviceItemIndex(samplingDevice->deviceItemIndex);
|
||||||
@ -559,19 +544,17 @@ void MainServer::changeSampleSink(int deviceSetIndex, int selectedDeviceIndex)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add to buddies list
|
// add to buddies list
|
||||||
std::vector<DeviceSet*>::iterator it = m_mainCore->m_deviceSets.begin();
|
auto it = m_mainCore->m_deviceSets.begin();
|
||||||
int nbOfBuddies = 0;
|
int nbOfBuddies = 0;
|
||||||
|
|
||||||
for (; it != m_mainCore->m_deviceSets.end(); ++it)
|
for (; it != m_mainCore->m_deviceSets.end(); ++it)
|
||||||
{
|
{
|
||||||
if (*it != deviceSet) // do not add to itself
|
if ((deviceSet->m_deviceAPI->getHardwareId() == (*it)->m_deviceAPI->getHardwareId()) &&
|
||||||
|
(deviceSet->m_deviceAPI->getSamplingDeviceSerial() == (*it)->m_deviceAPI->getSamplingDeviceSerial()) &&
|
||||||
|
(*it != deviceSet)) // do not add to itself
|
||||||
{
|
{
|
||||||
if ((deviceSet->m_deviceAPI->getHardwareId() == (*it)->m_deviceAPI->getHardwareId()) &&
|
(*it)->m_deviceAPI->addBuddy(deviceSet->m_deviceAPI);
|
||||||
(deviceSet->m_deviceAPI->getSamplingDeviceSerial() == (*it)->m_deviceAPI->getSamplingDeviceSerial()))
|
nbOfBuddies++;
|
||||||
{
|
|
||||||
(*it)->m_deviceAPI->addBuddy(deviceSet->m_deviceAPI);
|
|
||||||
nbOfBuddies++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -616,7 +599,7 @@ void MainServer::changeSampleMIMO(int deviceSetIndex, int selectedDeviceIndex)
|
|||||||
{
|
{
|
||||||
qDebug("MainServer::changeSampleMIMO: non existent device replaced by Test MIMO");
|
qDebug("MainServer::changeSampleMIMO: non existent device replaced by Test MIMO");
|
||||||
int testMIMODeviceIndex = DeviceEnumerator::instance()->getTestMIMODeviceIndex();
|
int testMIMODeviceIndex = DeviceEnumerator::instance()->getTestMIMODeviceIndex();
|
||||||
const PluginInterface::SamplingDevice *samplingDevice = DeviceEnumerator::instance()->getMIMOSamplingDevice(testMIMODeviceIndex);
|
samplingDevice = DeviceEnumerator::instance()->getMIMOSamplingDevice(testMIMODeviceIndex);
|
||||||
deviceSet->m_deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence);
|
deviceSet->m_deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence);
|
||||||
deviceSet->m_deviceAPI->setDeviceNbItems(samplingDevice->deviceNbItems);
|
deviceSet->m_deviceAPI->setDeviceNbItems(samplingDevice->deviceNbItems);
|
||||||
deviceSet->m_deviceAPI->setDeviceItemIndex(samplingDevice->deviceItemIndex);
|
deviceSet->m_deviceAPI->setDeviceItemIndex(samplingDevice->deviceItemIndex);
|
||||||
@ -671,7 +654,7 @@ void MainServer::deleteChannel(int deviceSetIndex, int channelIndex)
|
|||||||
void MainServer::addFeatureSet()
|
void MainServer::addFeatureSet()
|
||||||
{
|
{
|
||||||
m_mainCore->appendFeatureSet();
|
m_mainCore->appendFeatureSet();
|
||||||
emit m_mainCore->featureSetAdded(m_mainCore->getFeatureeSets().size() - 1);
|
emit m_mainCore->featureSetAdded((int) (m_mainCore->getFeatureeSets().size() - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainServer::removeFeatureSet(unsigned int featureSetIndex)
|
void MainServer::removeFeatureSet(unsigned int featureSetIndex)
|
||||||
|
Loading…
Reference in New Issue
Block a user