diff --git a/plugins/channeltx/modnfm/nfmmod.cpp b/plugins/channeltx/modnfm/nfmmod.cpp index 856fd31b2..c7658d317 100644 --- a/plugins/channeltx/modnfm/nfmmod.cpp +++ b/plugins/channeltx/modnfm/nfmmod.cpp @@ -37,7 +37,6 @@ MESSAGE_CLASS_DEFINITION(NFMMod::MsgConfigureNFMMod, Message) MESSAGE_CLASS_DEFINITION(NFMMod::MsgConfigureChannelizer, Message) MESSAGE_CLASS_DEFINITION(NFMMod::MsgConfigureFileSourceName, Message) MESSAGE_CLASS_DEFINITION(NFMMod::MsgConfigureFileSourceSeek, Message) -MESSAGE_CLASS_DEFINITION(NFMMod::MsgConfigureAFInput, Message) MESSAGE_CLASS_DEFINITION(NFMMod::MsgConfigureFileSourceStreamTiming, Message) MESSAGE_CLASS_DEFINITION(NFMMod::MsgReportFileSourceStreamData, Message) MESSAGE_CLASS_DEFINITION(NFMMod::MsgReportFileSourceStreamTiming, Message) @@ -356,15 +355,6 @@ bool NFMMod::handleMessage(const Message& cmd) return true; } - else if (MsgConfigureAFInput::match(cmd)) - { - MsgConfigureAFInput& conf = (MsgConfigureAFInput&) cmd; - m_afInput = conf.getAFInput(); - qDebug() << "NFMMod::handleMessage: MsgConfigureAFInput:" - << " m_afInput: " << m_afInput; - - return true; - } else if (MsgConfigureFileSourceStreamTiming::match(cmd)) { std::size_t samplesCount; @@ -537,6 +527,7 @@ int NFMMod::webapiSettingsPutPatch( QString& errorMessage __attribute__((unused))) { NFMModSettings settings; + bool frequencyOffsetChanged = false; // for (int i = 0; i < channelSettingsKeys.size(); i++) { // qDebug("NFMMod::webapiSettingsPutPatch: settingKey: %s", qPrintable(channelSettingsKeys.at(i))); @@ -563,8 +554,10 @@ int NFMMod::webapiSettingsPutPatch( if (channelSettingsKeys.contains("fmDeviation")) { settings.m_fmDeviation = response.getNfmModSettings()->getFmDeviation(); } - if (channelSettingsKeys.contains("inputFrequencyOffset")) { + if (channelSettingsKeys.contains("inputFrequencyOffset")) + { settings.m_inputFrequencyOffset = response.getNfmModSettings()->getInputFrequencyOffset(); + frequencyOffsetChanged = true; } if (channelSettingsKeys.contains("modAFInput")) { settings.m_modAFInput = (NFMModSettings::NFMModInputAF) response.getNfmModSettings()->getModAfInput(); @@ -625,6 +618,13 @@ int NFMMod::webapiSettingsPutPatch( } } + if (frequencyOffsetChanged) + { + NFMMod::MsgConfigureChannelizer *msgChan = NFMMod::MsgConfigureChannelizer::create( + 48000, settings.m_inputFrequencyOffset); + m_inputMessageQueue.push(msgChan); + } + MsgConfigureNFMMod *msg = MsgConfigureNFMMod::create(settings, force); m_inputMessageQueue.push(msg); diff --git a/plugins/channeltx/modnfm/nfmmod.h b/plugins/channeltx/modnfm/nfmmod.h index e93fc353a..fa665199f 100644 --- a/plugins/channeltx/modnfm/nfmmod.h +++ b/plugins/channeltx/modnfm/nfmmod.h @@ -159,27 +159,6 @@ public: { } }; - class MsgConfigureAFInput : public Message - { - MESSAGE_CLASS_DECLARATION - - public: - NFMModInputAF getAFInput() const { return m_afInput; } - - static MsgConfigureAFInput* create(NFMModInputAF afInput) - { - return new MsgConfigureAFInput(afInput); - } - - private: - NFMModInputAF m_afInput; - - MsgConfigureAFInput(NFMModInputAF afInput) : - Message(), - m_afInput(afInput) - { } - }; - class MsgReportFileSourceStreamTiming : public Message { MESSAGE_CLASS_DECLARATION diff --git a/plugins/channeltx/modnfm/nfmmodgui.cpp b/plugins/channeltx/modnfm/nfmmodgui.cpp index 7d4b3e7c4..a52eaa9d5 100644 --- a/plugins/channeltx/modnfm/nfmmodgui.cpp +++ b/plugins/channeltx/modnfm/nfmmodgui.cpp @@ -205,8 +205,6 @@ void NFMModGUI::on_play_toggled(bool checked) ui->morseKeyer->setEnabled(!checked); m_settings.m_modAFInput = checked ? NFMModSettings::NFMModInputFile : NFMModSettings::NFMModInputNone; applySettings(); -// NFMMod::MsgConfigureAFInput* message = NFMMod::MsgConfigureAFInput::create(m_modAFInput); -// m_nfmMod->getInputMessageQueue()->push(message); ui->navTimeSlider->setEnabled(!checked); m_enableNavTime = !checked; } @@ -218,8 +216,6 @@ void NFMModGUI::on_tone_toggled(bool checked) ui->morseKeyer->setEnabled(!checked); m_settings.m_modAFInput = checked ? NFMModSettings::NFMModInputTone : NFMModSettings::NFMModInputNone; applySettings(); -// NFMMod::MsgConfigureAFInput* message = NFMMod::MsgConfigureAFInput::create(m_modAFInput); -// m_nfmMod->getInputMessageQueue()->push(message); } void NFMModGUI::on_morseKeyer_toggled(bool checked) @@ -229,8 +225,6 @@ void NFMModGUI::on_morseKeyer_toggled(bool checked) ui->play->setEnabled(!checked); m_settings.m_modAFInput = checked ? NFMModSettings::NFMModInputCWTone : NFMModSettings::NFMModInputNone; applySettings(); -// NFMMod::MsgConfigureAFInput* message = NFMMod::MsgConfigureAFInput::create(m_modAFInput); -// m_nfmMod->getInputMessageQueue()->push(message); } void NFMModGUI::on_mic_toggled(bool checked) @@ -240,8 +234,6 @@ void NFMModGUI::on_mic_toggled(bool checked) ui->morseKeyer->setEnabled(!checked); m_settings.m_modAFInput = checked ? NFMModSettings::NFMModInputAudio : NFMModSettings::NFMModInputNone; applySettings(); -// NFMMod::MsgConfigureAFInput* message = NFMMod::MsgConfigureAFInput::create(m_modAFInput); -// m_nfmMod->getInputMessageQueue()->push(message); } void NFMModGUI::on_navTimeSlider_valueChanged(int value) diff --git a/plugins/channeltx/modnfm/nfmmodsettings.cpp b/plugins/channeltx/modnfm/nfmmodsettings.cpp index 86594eca2..4e3630ad6 100644 --- a/plugins/channeltx/modnfm/nfmmodsettings.cpp +++ b/plugins/channeltx/modnfm/nfmmodsettings.cpp @@ -45,6 +45,7 @@ NFMModSettings::NFMModSettings() : void NFMModSettings::resetToDefaults() { + m_afBandwidth = 3000; m_basebandSampleRate = 48000; m_outputSampleRate = 48000; m_inputFrequencyOffset = 0; diff --git a/sdrbase/dsp/dspdevicesinkengine.cpp b/sdrbase/dsp/dspdevicesinkengine.cpp index 94acf810e..ff5884dbc 100644 --- a/sdrbase/dsp/dspdevicesinkengine.cpp +++ b/sdrbase/dsp/dspdevicesinkengine.cpp @@ -353,9 +353,12 @@ DSPDeviceSinkEngine::State DSPDeviceSinkEngine::gotoIdle() (*it)->stop(); } - disconnect(m_deviceSampleSink->getSampleFifo(), SIGNAL(dataRead(int)), this, SLOT(handleForwardToSpectrumSink(int))); + if (m_spectrumSink) + { + disconnect(m_deviceSampleSink->getSampleFifo(), SIGNAL(dataRead(int)), this, SLOT(handleForwardToSpectrumSink(int))); + m_spectrumSink->stop(); + } - m_spectrumSink->stop(); m_deviceSampleSink->stop(); m_deviceDescription.clear(); m_sampleRate = 0; @@ -410,7 +413,9 @@ DSPDeviceSinkEngine::State DSPDeviceSinkEngine::gotoInit() (*it)->handleSourceMessage(notif); } - m_spectrumSink->handleMessage(notif); + if (m_spectrumSink) { + m_spectrumSink->handleMessage(notif); + } // pass data to listeners if (m_deviceSampleSink->getMessageQueueToGUI()) @@ -481,8 +486,11 @@ DSPDeviceSinkEngine::State DSPDeviceSinkEngine::gotoRunning() (*it)->start(); } - connect(m_deviceSampleSink->getSampleFifo(), SIGNAL(dataRead(int)), this, SLOT(handleForwardToSpectrumSink(int))); - m_spectrumSink->start(); + if (m_spectrumSink) + { + connect(m_deviceSampleSink->getSampleFifo(), SIGNAL(dataRead(int)), this, SLOT(handleForwardToSpectrumSink(int))); + m_spectrumSink->start(); + } qDebug() << "DSPDeviceSinkEngine::gotoRunning: input message queue pending: " << m_inputMessageQueue.size(); diff --git a/sdrsrv/webapi/webapiadaptersrv.cpp b/sdrsrv/webapi/webapiadaptersrv.cpp index b01ab6d6f..6d9dbf1ac 100644 --- a/sdrsrv/webapi/webapiadaptersrv.cpp +++ b/sdrsrv/webapi/webapiadaptersrv.cpp @@ -925,6 +925,76 @@ int WebAPIAdapterSrv::devicesetDeviceSettingsPutPatch( } } +int WebAPIAdapterSrv::devicesetDeviceRunPost( + int deviceSetIndex, + SWGSDRangel::SWGDeviceState& response, + SWGSDRangel::SWGErrorResponse& error) +{ + if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore.m_deviceSets.size())) + { + DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex]; + + if (deviceSet->m_deviceSourceEngine) // Rx + { + DeviceSampleSource *source = deviceSet->m_deviceSourceAPI->getSampleSource(); + return source->webapiRun(true, response, *error.getMessage()); + } + else if (deviceSet->m_deviceSinkEngine) // Tx + { + DeviceSampleSink *sink = deviceSet->m_deviceSinkAPI->getSampleSink(); + return sink->webapiRun(true, response, *error.getMessage()); + } + else + { + error.init(); + *error.getMessage() = QString("DeviceSet error"); + return 500; + } + } + else + { + error.init(); + *error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex); + + return 404; + } +} + +int WebAPIAdapterSrv::devicesetDeviceRunDelete( + int deviceSetIndex, + SWGSDRangel::SWGDeviceState& response, + SWGSDRangel::SWGErrorResponse& error) +{ + if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore.m_deviceSets.size())) + { + DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex]; + + if (deviceSet->m_deviceSourceEngine) // Rx + { + DeviceSampleSource *source = deviceSet->m_deviceSourceAPI->getSampleSource(); + return source->webapiRun(false, response, *error.getMessage()); + } + else if (deviceSet->m_deviceSinkEngine) // Tx + { + DeviceSampleSink *sink = deviceSet->m_deviceSinkAPI->getSampleSink(); + return sink->webapiRun(false, response, *error.getMessage()); + } + else + { + error.init(); + *error.getMessage() = QString("DeviceSet error"); + return 500; + } + } + else + { + error.init(); + *error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex); + + return 404; + } +} + int WebAPIAdapterSrv::devicesetChannelPost( int deviceSetIndex, SWGSDRangel::SWGChannelSettings& query, diff --git a/sdrsrv/webapi/webapiadaptersrv.h b/sdrsrv/webapi/webapiadaptersrv.h index 46ab59b70..502063cf4 100644 --- a/sdrsrv/webapi/webapiadaptersrv.h +++ b/sdrsrv/webapi/webapiadaptersrv.h @@ -147,6 +147,16 @@ public: SWGSDRangel::SWGDeviceSettings& response, SWGSDRangel::SWGErrorResponse& error); + virtual int devicesetDeviceRunPost( + int deviceSetIndex, + SWGSDRangel::SWGDeviceState& response, + SWGSDRangel::SWGErrorResponse& error); + + virtual int devicesetDeviceRunDelete( + int deviceSetIndex, + SWGSDRangel::SWGDeviceState& response, + SWGSDRangel::SWGErrorResponse& error); + virtual int devicesetChannelPost( int deviceSetIndex, SWGSDRangel::SWGChannelSettings& query,